Ability to turn off lights after x minutes of no motion is missing

The fix is something they may find distasteful: a state variable that tracks the on/off status of the switches managed by the automation (not device.currentSwitch), and a state variable used instead of unschedule() to kill a runIn(minutes,turnOff) that’s been launched. They told everyone months ago that unschedule() was unreliable, and to my knowledge have never commented about it since. I just blew it off and use a state variable to know when a new motion event has occurred, and therefore NOT to execute any pending turnOff(). My approach works, theirs doesn’t.

2 Likes