Parallel actions

Hi All,

Can i do parallel actions with multiple waits:

action:
  - parallel:
      - wait_template: "{{ is_state('binary_sensor.toilet_detection', 'off') }}"
      - service: light.turn_off
        target:
          entity_id: light.toilet_all

      - wait_template: "{{ is_state('binary_sensor.kitchen_detection', 'off') }}"
      - service: light.turn_off
        target:
          entity_id: light.kitchen_all

Now i have more automations that work on there own. But if this is also possible then i can combine them.

I think, in order for the waits to actually do anything, you would need set them as sequences, then parallelize the sequences:

action:
  - parallel:
      - sequence:
          - wait_template: "{{ is_state('binary_sensor.toilet_detection', 'off') }}"
          - service: light.turn_off
            target:
              entity_id: light.toilet_all
      - sequence:
          - wait_template: "{{ is_state('binary_sensor.kitchen_detection', 'off') }}"
          - service: light.turn_off
            target:
              entity_id: light.kitchen_all

Parallelizing Actions ( see 2nd Example down)

1 Like