Parallel actions to run "blocks" of actions

Currently, any action you put under “Run in parallel” (https://peyanski.com/home-assistant-2022-5-the-most-exciting-features/#Home_Assistant_20225_Parallelizing_Actions), is run in parallel. That means you can paralellize only single actions. But what if you want to parallelize whole blocks/sequences?
Could you please update “Run in parallel” so it allows blocks/sequences? Similar way how “If condition” has “then” and “else”, and you can put multiple actions into “then”, multiple actions into “else”. Here it would be “sequence 1”, “sequence 2”… and those sequences would be run to parallel to each other, but tasks in them in sequence, if that makes sense:

Sequence1Action1, Sequence1Action2, Sequence1Action3

and parallel to that you could run

Sequence2Action1, Sequence2Action2…

Strangely enough, HA has its own documentation so that you don’t have to rely on random 3rd party sites.

See Script Syntax - Home Assistant

Great news, thank you. Is it possible to do it via GUI?

Just checked and it looks like GUI is missing support for “sequence:”. If this support is added, that’s sorts this out. Can we please have this added?

2 Likes

Switch the Automation Editor to YAML mode and type it in.

The Automation Editor is unlikely to include every possible scripting feature, in UI mode, because it would overwhelm new and average users. Making a simple automation would become an onerous process of slogging through many unfamiliar options. For example, I have seen users improperly configure a simple State Trigger by mistakenly filling in the attribute field because they thought it couldn’t be left blank.

If someone understands an advanced concept like parallelization of actions, enabling the feature in YAML mode should be a trivial task for them.

Nevertheless, you are certainly free to make a Feature Request for its inclusion in the UI.

3 Likes

That’s a problem of UI that’s not intelligible to users (e.g. “attribute” should be clearly indicated as not required), not a problem of exposing things in the UI in the first place. Running actions in sequence/in series inside a parallel action block isn’t any more foreign of a concept than running in parallel in the first place. Maybe there should be a simple mode for users who want to remove more advanced options, but as an advanced user sometimes, shocking I know, I might want to use the UI instead of yaml because editing text on my phone sucks and I’m not on my computer.

Yaml itself has a discoverability problem. It’s nice to use the UI because it presents the options that aren’t already turned on: there’s an option for “run in parallel” even though nothing is already doing so, or a field for “attribute” even though it’s not used. Some configuration implementations use “add all defaults as blank initially”, which shows what options you are able to use even if you’re using yaml; HA doesn’t do that so the docs, complete albeit sometimes unclearly written though they may be, have to be pored over instead of just using the UI where the list of options are included in-place.

The dismissive and condescending attitude of “read the docs” and “use yaml” doesn’t help the community grow in a positive direction, and I really hate to see it.

1 Like

You mean your idea of a positive direction. With 5 votes in 1.5 years, it’s not everyone’s idea of a necessity for growth.


So far, this FR hasn’t inspired a volunteer software developer to implement it. However, that’s the fate of most FRs.

If the “dismissive and condescending” suggestion to use YAML is unacceptable to you, then your remaining options are:

  1. Wait until someone agrees this FR is worth fulfilling (might be never).
  2. Implement it yourself if you have available time and requisite skills.

There are cases where the UI doesn’t expose all available options. For example, the Time Pattern Trigger, Event Trigger, etc.

Reading the documentation remains the best way to learn about all available scripting features.

I already created PR for this last October. For some reason, it was still not merged, and it was also impossible to update the PR to latest dev branch. So I created new PR (Handle sequences under parallel actions by surfingbytes · Pull Request #18470 · home-assistant/frontend · GitHub).

3 Likes

@tomas1 It looks like this is still not available in the UI. As a work-around, I have used a Repeat block with the number of repeats set to 1.
It is less satisfying, but functionally should be the same.

1 Like

this is primarily useful when you’re runing things in parallel.

if someone wants to run 2 sequences of commands in parallel, they must currently drop to yaml to do this:

  - parallel:
      - sequence:
          - service: script.thread1_script1
          - service: script.thread1_script2
      - sequence:
          - service: script.thread2_script1
          - service: script.thread2_script2

and once you do that, you can’t edit the sequences in ui mode anymore.

I, too, am interested in this feature functionality.

Just a heads up, a similar request exists here: Parallel actions to run "blocks" of actions - #8 by tomas1

1 Like

ah… i looked for a duplicate and did not see that one when i searched. that one does seem to have morphed from it’s original request which was to support it functionally to then the gui. not sure what the right thing is in terms of calling this a duplicate or not.

This is duplicate of the Feature Request linked above - it’s the exact same thing I want to achieve. I’m working on adding it to GUI, but it doesn’t go as quick as I’d wish.

k. cool. i’ll add a vote to that. maybe should update the title of that one to now be about adding the ui support.

What about running two scripts in parallel instead?

You can do that from the UI.

Use the script.turn_on service, see: https://www.home-assistant.io/integrations/script/#waiting-for-script-to-complete

that’s a workaround…to be blunt, one of the use cases is helping people here in this forum.

It’s a bit more complex to instruct someone to do that in this community forum… on the flip side if we post the yaml for it in one script/automation then then they go switch it to the gui, the gui kinda barfs on it.

This PR is now waiting for approval.

3 Likes