Hi there,
I have an automation where the two final actions both contain some conditions.
So action A basically turns on the light in the morning and then turns it off again once it is not dark anymore.
So the cycle of action A lasts anywhere from 10 minutes to 2 hours depending on the time of year.
My issue is that the next action - action B - does not start until after action A has ended.
So:
Can anyone explain to me why action B only runs AFTER the cycle of action A has ended?
Shouldnt these actions just run one by one by and not interfere with each other?
Thx to everyone.
The fact that one action needs to end before the automation moves one was a big eye opener.
In my opinion that behaviour seems a bit strange, but if that is how it is, then thats how it is…
On a side note, when looking at the graphical version of your automation under “traces”, it to me appears that all automations will run one after the other no matter if the previous automation has ended or not…
Actions can be blocking (script or automation waits for completion) or non-blocking (script or automation continues without waiting); it depends on the service or integration being used. And if you call a script, how you call it will determine if it is blocking or non-blocking.
In general it’s best to assume the actions will be blocking but it’s not always the case. As jeffcrum mentioned, use parallel to force non-blocking execution.
However, I would suggest that long delays in an automation are generally bad practice and I would avoid any solution which results in an automation running for an extended period of time.
Instead, add another trigger for whatever you are waiting for. You can do this in a separate automation but I think it is cleaner to keep it all in one, and have your first action be a “choose” action. You can set trigger ID’s in your triggers, then use those trigger ID’s as conditions in your “choose” options so that you know which condition fired the automation.
All running automations will be killed upon HA restart, so this method makes your automations more robust.
Yes, i understand that now and am using now “run in parallel” where needed.
In my case i had an automation (running every evening that would measure the temperature in my sons bedroom and send an actionable notification to my mobile phone to turn on the air conditioner in case the room was above 25 degrees.
In case i dismissed the notification without choosing any of the actions available (turn on AC or do nothing), the rest of the automation would never trigger and the following days the automation would not trigger since the initial run had not ended.
Solution was obviously running some of the actions in parallel and changing the mode from “single” to “restart”…
So far we have not seen anything that we can help you with.
You have just posted images of the GUI.
Post your automation instead. That is always step 1 when you need help.
Hi there,
i actually received the help i needed immediately after my initial post and i am very grateful for the quick and useful response that i received from the community.
Should you have any input to…
where the “sweet spot between running multiple automations vs a single automation with a longer run time” is…
I generally don’t use any form of wait or delay longer than a few seconds, but it’s really personal preference. I don’t resort to multiple automations though; generally a solution can be found by adding triggers to the existing automation.
Having an automation running for hours or days due to a delay isn’t going to hurt HA, but it does make it sensitive to restarts, and I don’t really see any drawback to doing it the “correct” way.