"switch was on" condition never works


#1

I have what is supposedly a very simple piston. But it never does anything. Can someone help me figure out what I am doing wrong?

It is now 11:30. The outlet was supposed to turn off at 8:10, but didn’t. It never does.


#2

Pistons are executed in response to device events being received. Your piston runs every time Outlet 5’s switch attribute reports on or off. The was condition is only evaluated when the piston runs and it looks back in time. So nothing runs the piston at 8:10.

What you need is stays, not was. When your outlet turns on and the piston runs and evaluate stays it will see the switch is on and set a timer for one hour. It will then return false to the stays condition so it can continue with the piston. After an hour, and provided the piston hasn’t changed to off and executed again in the meantime, the piston will execute again and act like it has just returned true to stays.


#3

Thank you!