Arrival sensor Piston


#1

1) Give a description of the problem
When 2 arrival sensors are “not Present” the piston wont fire

2) What is the expected behaviour?
So i want my piston to run when both arrival sensors aren’t present. So for example if i leave home at 8PM and then my wife leaves at 9PM, i would expect the piston to run at 9PM when both sensors have left.

3) What is happening/not happening?
This piston will not run at all. It will run if i alter the setting to “any” of the sensors but wont run if i use “all” sensors

**4) Post a Green Snapshot of the piston![image|45x37]

5) Attach logs after turning logging level to Full
(PASTE YOUR LOGS HERE THEN HIGHLIGHT ALL OF THE LOGS AND CLICK ON THE </> ICON TO FORMAT THEM CORRECTLY)

REMOVE BELOW AFTER READING
If a solution is found for your question then please mark the post as the solution.


#2

Hi,

The piston would only run if both sensors left at exactly the same time. As you’ve seen, changing from all to any works. If you keep the trigger as any then add an additional if

if all of presence sensor 1’s and presence sensor 4’s presence IS not present
with switch 25;turn off…

The second if is a condition (no lightning bold in the margin) this will not act as a trigger and will be evaluated when the piston runs, as triggered by the first if


#3

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:

  1. Is the piston handing an event from Presence Sensor 1?
  2. Is the piston handling an event for the presence attribute?
  3. Is the value in the event not present?
  4. 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:

  1. Is the current value of the presence attribute of Presence Sensor 1 in the device object on SmartThings not present?

#4

@Paul1964 and @orangebucket thanks for your help on this one