Motion Lights: What happens if...?


#1

1) Give a description of the problem
I want my lights to turn on when there is motion; turn off after motion. This was resolved fine using wait and “Never cancel”; however, I noticed that if my kids were active the motion detector recorded motion for the full duration of the time out; the trigger never reset so the light would turn off even if there was motion.

If we went in and out of the room (so the motion detector registered ‘inactive’), then the “wait” and “never cancel” worked fine. I only had the lights turn off when there was constant motion detected.

2) What is the expected behavior?
I solved the problem by adding another “IF” statement in my Piston. The second IF statement looks for a duration of inactivity. This appears to trigger the desired behavior.

3) What is happening/not happening?
I don’t like the fact I have a second IF statement and I am wondering if there is a cleaner way to do this.

4) Post a Green Snapshot of the pistonimage


#2

I think that’s a well designed piston. Other ways to do it but this seems pretty clean. Especially if it works!


#3

Your never cancel tasks is why there could be constant motion and once it blips to inactive then even if motion resumes (which would have canceled the inactive motion tasks) everything turns off because it was not allowed to cancel tasks.

If motion changes to active
Turn on lights
End if
If motion changes to inactive
Wait xx time
Turn off lights
End if