Holiday Lights - On when luminance level <=10 and off 3 hours later


#1

1) Give a description of the problem
I cant figure out how to get the lights to turn off 3 hours after they were turn on when the luminance level reaches 10 at night.

2) What is the expected behaviour?
The expected behavior is for the lights to turn on when it gets dark outside and for the lights to turn off 3 hours later. The lights should only come on one time each night.

3) What is happening/not happening?
I cant figure out how to program the lights to turn off three hours later, especially since the off time will fluctuate as the months progress. Not sure if the below pistol will work.

**4) Post a Green Snapshot of the piston!


#2

Two things:

  1. You probably want ‘drops below 11 lux’ for your trigger. This will only turn on the lights and start the timer the first time lux is 10 or less. As you have above, it will repeat when lux hits 10, 9, 8,… because all those match ‘is less than or equal to 10’
  2. You need Task Cancellation Policy (TCP) set to never. Any change to the Motion sensor will trigger this piston and cancel your timer because any change requires the logic run to see if it is true or false. To avoid cancelling the timer, set TCP to never on the ‘with’ statement.

#3

I agree with @guxdude, you’ll want to update the condition to a trigger.

An alternative approach would be to use variables as a check system rather than changing TCP. Updating the TCP will ensure the light turns off after the 3 hours but depending on the location of the sensor, if any light source causes the illuminance to jump and drop again, lights will turn on and start the timer again. Possibility of multiple runs per night.

I mocked this up quickly, haven’t tested but it should work.


#4

Thank you!