I’ve done some research and coded what I feel should be a valid way for a continuous loop to happen in my system. Every time it runs it checks the condition of whether a particular sensor is “on”. See below:
As you can see, it’s actually 2 scripts running together, since it’s my understanding that you can no longer have a script call itself.
What actually happens here is the reminder_baby script gate only gets called up to 2 times, then terminates, even if the senor continues in the “on” state. Any ideas why this is happening here?
I imagine you are running into the reason that scripts can’t call themselves, you’ve just found a way to do it that isn’t being trapped. I can think of some ways to do it with an input boolean an three automations and a script. Or I can think of a quick and easy way to do it in appdaemon.
Yeah, I’d totally accept that explanation if it weren’t for other examples such as (How can repeat this automation?) where people claim to have it working. Am I doing anything different than the example there that could be throwing mine off?
So just to be clear, there isn’t any supported/official method to simulate a while loop in HA/yaml?
I know it could be a little late but i was trying to do something similar.
If you check your logs you will have an entry like delay_babygate is already running.
The answer is to put a delay in reminder_babygate before calling the delay script so you end up with this…