Piston to turn lights on and off when dark outside and more


1) Give a description of the problem
turn lights on when it is dark outside.

2) What is the expected behaviour?
If it is dark outside, if a virtual switch “livingroommotionsensor” is on, and motion is detected, the lights should turn on and turn off if there is no motion.

If the lights are turned on with a light switch or google home manually while it is not dark outside, the lights should turn off if there is no motion in the room and “livingroommotionsensor” is on.

The purpose of turning “livingroommotionsensor” off is to keep the lights on when someone is in the room rather motionless, maybe doing homework. It will also keep the lights off when watching a movie for instance and you dont want to trigger the motion lights.

3) What is happening/not happening?
I think this might be working somewhat now. I’m hoping others can review my work and provide suggestions to make the piston more efficient.

**4) Post a Green Snapshot of the piston


switch 7 is the virtual switch tied the livingroommotionsensor i mentioned in the post. Keypad2 is an outlet. the outlet doesn’t support dimming, hence i think i need a separate with statement for this.


modified the piston as i only have one lumen sensor outside. The problem was as the sun sets, it gets darker on the front side of the hose prior to the back. When it was dark enough that I would want the lights on, the lumen sensor in the rear of the house was still getting nailed by the sun setting maxing out the lumen sensor, hence it didn’t show a drop in lumens. I changed the piston to use 30 minutes before sunset and 30 minutes after sunrise.