I’ve been working on the guts of this Piston getting it to work before adding other conditions/restrictions. What I’m trying to do is when I open the door from the house into the garage I want the lights to come on and stay on while I’m in the garage. Then turn off after no motion for a set time. I can’t make it just motion based for a few reasons and one of them is the position of the motion sensor wouldn’t allow the lights to come on until you were 4 feet into a pitch black garage down the steps. I also need a no motion buffer because part of my workbench is out of the motion detectors line of sight. so if I step out of the view for a few minutes I don’t want to be standing there in the dark with lots of sharp objects around me.
Here is one version I put together last night that works but I feel is inefficient. It also runs the loop 3 times ie I get 3 push messages each time on the turn off. It’s 3 every time too so I’m guess it’s a timing issue before the loop registers the exit flag.
Would the use of Piston states work better than a Boolean variable? any suggestions for making this better more efficient?
There’s lot of other features I’d like to add to this at some point too, like manual switch on disables motion off, if the door opens and there is no motion or very short lived motion the lights turn off faster (we have a shelf right on the inside of the door we place things like tools and such on to put away later) and also having the lights turn on with just motion but no door in case I’m in there and the lights go out or I come in from the other door.