i wrote a little app that turns the light on when i get home; i.e. when a my presents sensor is detected.
it worked fine for a long time.
now in the middle of the night the light turns on. i checked the log and sure enough for 1 minutes the presents sensors was gone and then re-detected. so the house thought i was gone and arrived again.
so, i am wondering how i could add to my app a minimum time gone check?
You’d have to subscribe to both “present” and “not present” events. In your “not present” event handler save current time in the state hash, then in your “present” event handler, calculate elapsed time and decide whether to turn on the light or not.