What is precondition?

Im new to creating routines in smartthings. Can someone explain what the button “Use as precondition” means simply? It appears when I add something in the if part of the routine such as a thermostat temp. I dont see how precondition differs from it being not selected, but the item is still in the if section.

The precondition never starts (triggers) the routine, but it must be valid so that the execution of the routine can be started by other conditions.

So is that the same as selecting all conditions need to be met if you have multiple ifs in the routine? It could be a precondition or an if (ex- temp and a light is on)

Here is an example of a precondition:
The precondition is, for example, the time period. If you want the routine to work only at night you define to the routine time period as a precondition. Then the routine turns on the lights only at night. Of course, you also need a condition that starts the routine. Starting the routine can be done, for example, by a motion sensor.

SmartThings routines allow you to have multiple conditions like

If The location mode is night

If the security mode is armed stay

if movement is detected in the kitchen

If movement is detected in the living room


Without preconditions, your choice to trigger the routine is

A) If all of these conditions are true


B) if any one of these conditions is true.


The precondition option was added so that you could pick one or more conditions and say that those had to always be true before the routine would run, but you could still have ors for the other conditions.

So I could set the preconditions to

Security Mode is armed stay
Location mode is night

And have the regular conditions be

Motion is detected in the kitchen OR motion is detected in the living room.

Now the routine will only run
If it is night AND
security mode is armed stay AND
(there is motion in the kitchen OR
there is motion in the living room)

Without preconditions, my only choices were that all four of those were true, or that any one of those four were true.

With preconditions, I can say that two of the four must be true, and either one of the others must be true. It lets me have an “and” and an “or” in the same routine.

I hope that’s clear. It’s obvious when you’re creating your own routines with multiple conditions because without the precondition you end up with a lot more routines just to cover all the possibilities. :thinking:


The UI has actually been improved a bit lately. It used to be that if you only had two conditions (including the precondition) you couldn’t really tell them apart. Now you can.

Terminology is always an issue as words like ‘activate’, ‘execute’, ‘run’ and ‘trigger’ can mean different things to different people.

Basically the difference between the a ‘precondition’ and a vanilla flavoured condition is:

If something happens that could affect the evaluation of a precondition then the precondition is re-evaluated. However nothing of note is going to happen as a consequence of that.

If something happens that could affect the evaluation of a condition then the condition is re-evaluated. The routine then takes a look at the current values of the preconditions and conditions to see whether it should be running the actions in the ‘then’ section.


Preconditions can also be useful as an “is” test rather than a “just became” test, particularly for security mode values and presence. As @orangebucket mentioned, the triggers in the preconditions group will be reevaluated when one of the triggers in the regular group becomes true. For example, if you have a regular condition of “security mode equals armed“ it’s possible that a routine won’t run, because the security mode became armed an hour ago, so nothing triggers the routine to check again when, say, the motion sensor detects motion.

If you move security mode to the precondition, then it gets reevaluated when the motion sensor detects motion, so it doesn’t matter when it became armed as long as it is armed now. :rotating_light:

This is a common troubleshooting tip for people who say their routines aren’t running when the routine includes a security mode check.


No preconditions

If security mode is armed away
Motion is detected in the living room

Might not run if the security mode was changed to armed away earlier in the day. :thinking:


with preconditions

Security mode is armed away as a precondition

Motion is detected in the living room as a regular condition

Will run when motion is detected in the living room, because the security mode will be reevaluated at that time.

So that’s another use for preconditions. :sunglasses:

1 Like

As I used to struggle with this, I’ll add my 2 cents if learning.

If the only condition that changes is the precondition, the routine won’t trigger.

If you want a condition to trigger a routine, don’t make it a precondition.

Beyond that, the others have filled in the details nicely.