When no one is home do something, when someone comes home, do something


#1

1) Give a description of the problem
I am trying to build a piston that runs a couple of pistons if the last person leaves home (through presence sensors) and runs another couple when one person (or more) comes home. The piston triggers on those events but my logic must be faulty because it is not triggering the sub-pistons calls.

2) What is the expected behavior?
When one person is detected to have left and everyone is out, trigger the first set of sub-pistons
When one person presence is detected, trigger the second set of pistons

3) What is happening/not happening?
From what I can see the conditions are never fulfilled either way. I never get any of the notifications
and the sub-pistons are never called (they each have separate notifications as well that I don’t see)

4) Post a Green Snapshot of the pistonimage

I don’t have Smarthings logs for this, I can try to capture later today. Let me know if you need the Webcore logs in Smartthings or all devices (which would be. a lot).

Thanks in advance for your help.


#2

Do you really need the “only when” restriction? It seems to me that if you want the pistons to fire when everybody leaves, that is still covered in the IF trigger. The pistons aren’t firing because of the restriction, so try removing that and see what happens.


#3

I did and that seems to work. I guess I am not used to the thought of the piston causing webcore to subscribe to events on devices and felt like the only when a change is seen was needed. So I understand why it works without it, now (the if condition causes a subscription to device events of sorts). But I don’t understand why the only when caused it to not happen.


#4

I’m not sure either. Maybe someone can fully explain.

The IF was nested, which generally isn’t a good idea. Usually you see IFs nested under IFs incorrectly. That wasn’t the case here, but it was still sort of a conditional nesting. That may have been the issue but I can’t explain exactly why.