Track if a Light has been on at least once


#1

Hi all,

I have a light in my son’s room that I want to turn on when you enter the room and off ofter 5 minutes except if it’s after 7PM. After 7PM I want the light to turn on but not off. Additionally after 7PM, once the light is turned off I don’t want motion to turn the light back on until 6AM.

Does this make sense? I am having problems trying to figure out how to accomplish this.

Here is what I could think of, but it’s not working. The lights keep turning on with motion:


#2

Set up a variable whose normal state is 0.
If after 7pm and light has been turned on once, set variable to 1.

If variable = 1 and motion occurs, do not turn on light.
At 6am, set variable to 0.


#3

You were getting really close and had the right logic in mind - this will do it.

Make sure where you define the variable you do NOT set a value. Otherwise that value is set every time the piston executes (in the piston you posted it will always be true).