I hate date math. I want to check every 5 or 10 minutes to see if an event has cleared, do something and stop checking. I’ve got a simple loop.
def turn_off_lights
if event is active
self.run_at(turn_off_lights,now+10minutes)
else
turn_off(lights)
I could do it with a run_minutely and then cancel the handle when the event clears, but at this point, I’m determined to figure out the math. I see several examples of adding an offset to sunrise or sunset. I’m just having trouble finding one that shows me how to do “now”+10.
You are right, I did not notice the run_in statement. I have three web browser tabs open all the time. HA, HA Forums, and the AppDeamon API. It would be nice if the API was indexed or had a linked table of contents. The font sizes are so similar it’s easy to skip over something.