#Loop condition with safety timeout

1 messages · Page 1 of 1 (latest)

hidden olive
#

I'm looking to have a script/automation that does something in a loop (play an audio file) until some state changes based on activity of a human.

To make sure this can run somewhat safely I want this to have a timeout.
Similar to how the actions to wait for a state to occur have a timeout, I want a timeout on the loop condition.

Is there a reasonable way to build this? I was thinking maybe with a helper that gets set before the loop is entered and a time condition (or templated) but it seems annoying to need a helper per script that behaves this way

fallow pagoda
#

You can have a variable local to the script, you set the current time to it and then you compare current_time - time_from_variable and react accordingly