Smart switch and motion sensor. If switch is turned on, after 30 minutes of motion sensor being inactive turn switch off.
I’ve tried this a few different ways, and this way seems to work for me. But is it the right way to do this?
Smart switch and motion sensor. If switch is turned on, after 30 minutes of motion sensor being inactive turn switch off.
I’ve tried this a few different ways, and this way seems to work for me. But is it the right way to do this?
You have two triggers in the if statement, which is not usually a good idea.
Why do you need the switch changes at all portion of the if?
You can just turn off the light after 30 mins of inactivity with just the motion says…
With only the if motion is and stays inactive for xx, then turn off. Wasn’t reliable. Sometimes it would turn the switch off, others it never would.
I never figured out the rhyme or reason behind it.
Edit. I just realized my original way I had “stays inactive for xx minutes” and not “is now, and stays inactive for xx minutes”.
Could that “is now” be the key?
edit 2.
I also seem to recall having to set not to cancel task on a state change. 🤷
I guess would need some logs (medium or higher).
If your motion changes a lot, it may take a while to turn off.
I don’t see why you need to monitor the switch changes. I don’t think ANDing two triggers together is a good idea…
I see two issues. Firstly the motion has to be inactive when the switch turns on in order to start the 30 minute timer. Is that what you want?
Secondly I don’t expect the stays
to work as it needs to be evaluated if motion turns active and it won’t be.
No that’s not what I intended. The motion could be active or inactive when the switch turns on.
I think what you are saying makes sense. It’s not continually evaluating the motion sensor.
Here I’m thinking this should be a super simple piston.
Here’s one I came across last night on the S.T. forum but haven’t tried. I bookmarked it but wasn’t sure if that was correct either. But it kinda makes sense now. In this one, I’m assuming if the motion goes back to active, when it goes back to inactive it re-starts that 5 minute countdown?
So I’ve been using this last one here FDW07 for a few days and seems to be working as expected…