Timer on basement lights


#1

1) Give a description of the problem
Piston is designed to start a timer when I open the door to the basement and turn off after 5 min. It seems that the timer restarts when i come back up the door after having picked up what i needed.

2) What is the expected behaviour?
Timer only starts first time I open the door and the light switch is off.

3) What is happening/not happening?
Essentials of piston works - lights go on, lights go off, but behaviour of timer is resetting when opening the door again even if the lights are already on.

4) Post a Green Snapshot of the pistonimage


#2

Move line 37 to line 41 and set Task Cancellation Policy to Never On line 38 (with)

So it should look like

With (tcp set to Never)
{basement lights}
Do
Wait 5 minutes
Turn off
End do
End with


#3

Just my two cents here…just be aware that the way your piston is written, if you are in the basement for > 5 minutes, the lights might go out on you. :slight_smile:


#4

Thanks. Didn’t work straight out of the box, but i tried to add an else statement in my first if, defining the LightsOn parameter to false and now things are working perfectly. By the way changed the timer delay to 30 seconds just for testing purpose…


#5

I’m perfectly aware of this. My intention is to keep things simple here as I’m only picking things up in the basement. I could add a IR sensor, but just don’t feel like it’s worth the effort…


#6

Could you set the timer to start when the contact sensor closes instead? If you decide to stay longer in the basement, simply leave the door open.


#7

I frequently modify my pistons (and my behavior) and attempt to make the solution more reliable. But when I am standing there in the dark, it just reminds me that a perfect solution may not exist. :slight_smile: