Reactor automation with a twist

I’ve watched the excellent videos by toggledbits and have created a script but need help completing. I have a motion sensor that turns on lights on my counter when tripped and then turns them off after 60 seconds. Works great but when someone turns that Z-wave controlled light switch on, it turns the lights off after 60 seconds. How can I add a condition that if the switch is turned on, the lights stay on until manually turned off and still have the motion controlled?

That’s a universally tricky thing to do with Z-Wave and most hubs, because there is typically no separate notice for a light being turned on manually vs being turned by a scene, Lua, or other action. There are some tricks you can pull, though.

Perhaps the simplest is to add a condition to your motion detection to only turn the light on if it is currently off. In this way, if the light is turned on manually, the motion sensing will not act, because it only acts if the light is off.

This may not work, however, if the light switch being used is on the path of the motion sensor. In that case, the motion sensor usually is tripped before the human reaches the switch. so there are “environmental” conditions to be considered as well. That’s a universal problem with motion light automation. Mitigation here may involve installing a “satellite” switch outside of the motion sensor range and training your housemates to use it.

This is a good simple project to learn with. Experiment. Feel free to fail, it’s harmless (as I often say, you’re playing with lights and switches, not nuclear launch codes). :slight_smile: