Running stuff in parallel is great, but what if I want some tasks within a parallel action to be run sequentially. It would be great to add a sequential action to the UI (this can be done in yaml).
Example of parallel and sequential actions. What if I want to check the time for a specific action flow as a condition action that only relates to that parallel thread?
Problem is, then Iād creating duplicate scripts for actions. For example, I have a script for notifications. This turns on speaker zones, sets input and volume. But I donāt want to specify what notification sound or tts within that script. Iād rather call the script from an automation, then send the tts after the script has completed. Perhaps this could be done with a template and somehow passing a variable from the automation to the script, but that seems overly complicatedā¦
sequence can already be done in parallel actions, just has to be done in YAML.
It is also possible to run a group of actions sequantially inside the parallel actions. The example below demonstrates that:
script:
example_script:
sequence:
- parallel:
- sequence:
- wait_for_trigger:
- platform: state
entity_id: binary_sensor.motion
to: "on"
- service: notify.person1
data:
message: "This message awaited the motion trigger"
- service: notify.person2
data:
message: "I am sent immediately and do not await the above action!"
Oh wait, you already knew, but you want it in the GUIā¦
True ā¦ and probably why a programming concept like parallelism isnāt exposed in visual mode (an interface suitable for novices).
In addition to the Automation Editorās limitations in visual mode there are several quirks when handling YAML. For example, it has a habit of quoting boolean and list values (thereby converting them to strings). It removes any YAML comments you may have entered and reformats Jinja2 templates to comply with its guidelines.
I mean I guess Iām genuinely kind of curious to see how many votes this gets. Because youāre right, not everyone is a coder. But also would a non-coder ever pick parallel?
Chicken or the egg I guess. I personally find Jinja2 templates confusing and unnecessarily complicated. YAML is āOKā. Itās always nice to be able to write code and make something, but also nice to put something together via the gui in a visual view.
I personally like using node red and use function nodes to write more complex conditions, but tracing failures is a pain if you donāt enable logging on each line. Also, when it triggers something, it just gets triggered by the service and not an automation so sometimes it can be difficult to troubleshoot.
I use the GUI all the time except when I canāt, and I understand there are cases where the GUI just isnāt smart enough (yet) but not being able to pick sequence is just plain silly!
The ālikeā on my last post (@hldh214) brought my attention back to sequence in automations/scripts so now that weāre on 2024.4.x I had another look at options in the visual editor and I discovered a way to do it (which probably existed before) using repeat: with count: 1: