Add sequence action for automations & scripts #117690
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Proposed change
Context: It came out of a discussion with the UX & frontend team @ Nabu Casa when we where talking about this frontend PR: home-assistant/frontend#18470
This PR adds a new script action that can be used in automations and scripts:
sequence
.The
sequence
action allows a user to group one of more actions into its own sequence. For example:This might not sound helpful at first, but it has quite a few use cases.
Organizing: Each sequence group can be named, but also enabled/disabled. From the automation editor perspective, a group of actions can be collapsed.
Blueprints: When using the actions selector, the author of a blueprint can ask a user for one or more action to take. However, the author of a blueprint will never be able to combine it with predefined actions (as lists in YAML are not mergable). This will now work:
YAML Anchors: For our power users, YAML anchors and lists are hard. Again, lists are not mergeable, so this means it is also harder for YAML users to re-use lists of sequences. With the above, it provides a way to still be able to do this.
Parallel action: The source of this all, can be found in this PR. When the sequence action is added like is done in this PR, it becomes a generic available building block. Meaning that most of the "weirdness" or specific things done in making the UI for parallel action with sequence work... will just work without much special handling.
Type of change
Additional information
Checklist
ruff format homeassistant tests
)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest
.requirements_all.txt
.Updated by running
python3 -m script.gen_requirements_all
..coveragerc
.To help with the load of incoming pull requests: