I wanted a SmartApp that would close the garage door if no activity was detected over a period of time using a motion sensor. So this is my initial cut at just that. After X amount of mins after any specified garage door is opened or after the last motion event is detected, the garage doors will be closed. This prevents the garage door from closing on yourself, your kids, your car reversing, etc. but still allows for the garage to close after a specified amount of time.
It supports multiple garage doors and multiple motion sensors. I wrote it to be extremely lightweight.
This smartapp works great for my kids who are playing out in our alley constantly but forget to close the garage when they go on a bike ride or similar.
Definitely use what works for you. I follow the idea of the easier something is to configure and the lighter the codebase, the better my life will be. I got tired of cobbling solutions together to do something as easy as this.
I addressed my timing need by connecting the smartapp automation to Night mode only.
I’m seeing some odd behavior with AllMotionStatesInactive returning false when the camera is actually inactive (arlo camera). If this happens the Activity handler never gets scheduled to trigger again.
It’s basically redundant and would potentially just add more of a burden on the ST scheduling system. Also if the flag gets stuck in the active state for some reason, we’ll just hit an infinite loop of scheduling.
Typically if the active check fails, it means a pending “inactive” state event is going to be fired (or is in the process of being fired). So a “requeue” of the event handler should happen regardless as soon as the motion has stopped.
That’s an excellent question though. Made me retrace my own logic