Edit: I’ve updated this as a Latching Piston to make sure motion active keeps things in the right state if the motion sensor doesn’t got out of active state due to constant motion, which a simple piston will do.
Here’s another that uses motion, lux, power, and lights.
Scenario: Dining room is dark when light outside isn’t cloud free…so turn it on when lux is low, unless watching TV or other lights in the Living Room/Dining Room are already on.
Piston Mode: Latching
If…
–Living Room Motion Sensor -> motion is active
And
–Living Room Theater Outlet -> power is less than 30W
And
–Bloomsky -> illuminance is less than 3600lux (yes my BS is working fine with this!)
And
– Each of Dining Room Light, Living Room Light or Kitchen Sink Light -> switch is off
Then…
–With Dining Room Light
- Turn on
But if…
Living Room Motion Sensor -> motion is inactive
Then…
–With Dining Room Light (Cancel on piston state change)
- Wait 5 minutes
- Turn off
- Turn on after 1000ms
- Wait 1 minute
- Turn off