mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-23 17:27:19 +00:00
Add sequence action for automations & scripts (#32873)
Co-authored-by: c0ffeeca7 <38767475+c0ffeeca7@users.noreply.github.com>
This commit is contained in:
parent
587058b58f
commit
364afbf393
@ -753,6 +753,48 @@ automation:
|
||||
|
||||
{% endraw %}
|
||||
|
||||
## Grouping actions
|
||||
|
||||
The `sequence` {% term action %} allows you to group multiple {% term actions %}
|
||||
together. Each action will be executed in order, meaning the next action will
|
||||
only be executed after the previous action has been completed.
|
||||
|
||||
Grouping actions in a sequence can be useful when you want to be able to
|
||||
collapse related groups in the user interface for organizational purposes.
|
||||
|
||||
Combined with the [`parallel`](#parallelizing-actions) action, it can also be
|
||||
used to run multiple groups of actions in a sequence in parallel.
|
||||
|
||||
In the example below, two separate groups of actions are executed in sequence,
|
||||
one for turning on devices, the other for sending notifications. Each group of
|
||||
actions is executed in order, this includes the actions in each group and the
|
||||
groups themselves. In total, four actions are executed, one after the other.
|
||||
|
||||
```yaml
|
||||
automation:
|
||||
- trigger:
|
||||
- platform: state
|
||||
entity_id: binary_sensor.motion
|
||||
to: "on"
|
||||
action:
|
||||
- alias: "Turn on devices"
|
||||
sequence:
|
||||
- service: light.turn_on
|
||||
target:
|
||||
entity_id: light.ceiling
|
||||
- service: siren.turn_on
|
||||
target:
|
||||
entity_id: siren.noise_maker
|
||||
- alias: "Send notifications"
|
||||
sequence:
|
||||
- service: notify.person1
|
||||
data:
|
||||
message: "The motion sensor was triggered!"
|
||||
- service: notify.person2
|
||||
data:
|
||||
message: "Oh oh, someone triggered the motion sensor..."
|
||||
```
|
||||
|
||||
## Parallelizing actions
|
||||
|
||||
By default, all sequences of {% term actions %} in Home Assistant run sequentially. This
|
||||
|
Loading…
x
Reference in New Issue
Block a user