Firstly, forgive me, I’m new. I’ve spent the last week or two trawling through many examples and posts about motion sensitive lights. After much fiddling this is mine. I like it more than the others I have tried.
The logic is fairly simple:
- If any of the assigned motion sensors see movement or any of the doors open and the light is not already on then turn on the light and save a variable indicating that the light was turned on via motion.
- If the light was turned on by motion, all of the doors are shut and there hasnt been any movement in the last x minutes then turn off the light.
- If you leave a door open the light will stay on
- If you manually turn the light off the variable is cleared and the piston will lay in wait again.
- If you turn the light on manually the piston will never do anything.
The result is a light that stays on if you turn it on manually - toggling it on-off-on will keep the light on eternally. If you open the door and then close it again without entering the light will turn off after 5 seconds.
Its not shown in the screen shot but the selection of ‘All’ or ‘Any’ devices in the triggers is important.
PS. I didn’t particularly want the 5 second delay when closing the door without triggering motion, but the piston wouldn’t work reliably otherwise.
If you want to use it for an outdoor light then you can limit the ‘turn on’ logic to also require it to be between sunset and sunrise - or whatever time you like - as below: