I have a question about automations… If I have a loop action in the middle of other actions, the automation will run all the actions even if there is a “block” loop action in the middle or it will wait till the loop action is finished, then continue with the next action?
I try to understand these automations better, how they run, what is needed to break an automation or a loop action and so on…
Edit: besides the fact that I want to understand more about automations, I have a real case as well, which will help me in what I want to achieve… and what I wand is this:
Let’s say that I have a PIR sensor and a Screen on/off Switch. The PIR sensor will have the “detected” state as much as someone is moving in the front of the PIR (if I move one hour, the sensor will have the state “detected” for one hour), and the automation should be something like this
trigger - PIR state "detected"
action 1 - something
action 2 - something
action 3 - loop util Screen Switch is On
- turn on screen
- after and only after util repeat has finished, run the next action
action 4 - loop while PIR state is "detected"
- keep screen on
action 5 - notification
The thing is that I don’t want action 5 to run untill 3 and 4 are finished.
I have an idea how to achieve this but I am curious about other ideas and of course, the first reason to open this post, to know more about automations.
Choose it will only run once the action, loop will loop it till you want…
But I found out by testing now, if you put a loop action in the middle, the rest of the actions won’t run till loop finishes…
Edit: And I think I done the automation, I used a loop until and a loop while after this, all good. Somebody would do this different?
When PIR will detect motion, the screen will be on… then, the screen will still be on untill the PIR will stop being detected.
Edit3: I think I have answer myself to my question, but now I have another one There is any solution to run an automation fully, without stop/wait for the loop actions? But without using scripts No need something, I am just curious
How does this “Loop Action” look like ?, a “if/then” “if/then”“if/then” >infinitely . or a " template" executed somehow ( which in turn doing your “Loop”), unaware of the status of your Automation ?
Yes, I am aware how a loop action it is working, I just needed to find out if the other actions after the loop action, are running imediately after, no matter if the loop finishes or it will wait for the loop to finish. I found the answer meanwhile. Thanks!