r/SmartThings • • 14d ago

Help Help on a routine

I have a smart socket and temp and presence sensor. Currently I have the following routines :

  1. IF Presence + Temp <17 + time of day THEN turn on switch
  2. IF Button 1 on temp sensor pressed THEN turn on switch
  3. IF Button 2 on temp sensor pressed THEN turn off switch
  4. IF Presence OR Temp >18 OR time of day THEN turn off switch

My question is, is press button to enable 2), does 1) still take over should someone leave the room ? I guess I am asking does any routine have priority / do they all run concurrent / is there a possibility of loop happening ?

6 Upvotes

3 comments sorted by

4

u/devilworks 14d ago

Yes, routine will run when all the conditions are met. You can avoid this by using a virtual switch.

Add a virtual switch and name it as Pressed State. Turn it on and off in routine 2 and 3. Add it as a pre-condition in routine 1 and 4.

2

u/madskvistkristensen 14d ago

Short version: there's no priority. Each routine is separate and runs whenever its own conditions become true.

So if you press button 1, nothing "locks" the switch on. If routine 4's conditions become true later (someone leaves, temp goes over 18, or the time hits), it turns the switch off. Same the other way. Routine 1 can turn it back on after you pressed button 2.

A loop is unlikely here. None of your routines use the switch itself as a condition. Loops happen when one routine's action is another routine's trigger and back again.

Worth knowing: every condition in a SmartThings If acts as a trigger by default. You can mark a condition as a precondition, so it only gets checked and doesn't start the routine on its own. That cuts down a lot of surprise runs.

If you want the button to win for a while, a virtual switch works as an "override" flag. The button turns it on, and routines 1 and 4 check that it's off.

One more thing, if that plug runs a space heater: heater makers usually say to plug straight into the wall, so check the heater manual and the plug's rating. I wrote about watching a cold room without switching a heater from a plug here: www.homeautomationcookbook.com/automation/climate/room-heater-maintain-temp.html

1

u/Simonsersii 14d ago

Button 1 turns the socket on; it doesn't disable your off routine or give the button priority. Does 'presence' in routine 4 mean someone home or everyone away? An off routine can undo the button press when triggered, but a condition staying true doesn't mean it keeps firing. Overlapping rules aren't automatically a loop—that needs actions feeding back into triggers; splitting the off rule may make it clearer, but won't create a manual override.