Presence Sensor 1 presence changes to not present
can only ever be true if the piston is currently handling a presence event on Presence Sensor 1
. It is impossible for Presence Sensor 4 presence changes to not present
to be true at the same time so line 18 can never be true.
Simply change the comparison to the condition are not present
. The piston will still run when the presence sensors change, but you will be evaluating their current state when it does.
Despite what you may see written, pistons do NOT need to have explicit triggers. They are frequently desirable but leaving them out is a better idea sometimes.
Background:
When you create a trigger condition like Presence Sensor 1 presence changes to not present
you are telling the piston that you want it to subscribe to events for the presence
attribute of Presence Sensor 1
. When those events occur the piston will fire and start executing from the top. It doesn’t matter what the content of the event is, the piston starts running. When it gets to the comparison it evaluates:
- Is the piston handing an event from
Presence Sensor 1
?
- Is the piston handling an event for the
presence
attribute?
- Is the value in the event
not present
?
- Is that different to what it was last time this event was handled?
If the answer is true to all of those, then the comparison is true. Note that the current state of the device is not checked.
On the other hand if you use the condition Presence Sensor 1 presence is not present
you are indicating to the piston that you are interested in the presence
attribute of Presence Sensor 1
but you are not explicitly instructing the piston to subscribe to it. However if there aren’t any explicit trigger conditions in the piston, the piston will fall back to considering the conditions instead and subscribe to the things of interest to those. When the piston runs for any reason the comparison evaluates as follows:
- Is the current value of the
presence
attribute of Presence Sensor 1
in the device object on SmartThings not present
?