An automation question

An automation question. I noticed a strange behavior in one of my automations and hope someone could elaborate, maybe I’m wrong in my conclusions.
Suppose you have an automation with 2 action sequences, in which the first sequence has a device involved that is cloud dependent , and the second action is a generic hass service call. If the internet is down and the target of the first action becomes unreachable (media_player.play_media), shouldn’t the second action be executed no matter of what? In my case the automation stops and doesn’t continue to the second action if the internet is down. If I change the actions order the service call is executed normally. Is this normal?

alias: Leaving home
description: ""
trigger:
  - platform: state
    entity_id:
      - binary_sensor.all_off_when_leaving_mqtt
    to: "on"
    id: Button
  - platform: event
    event_type: yandex_speaker
    event_data:
      value: Сделай громче на 0
    id: Phrase
condition: []
action:
  - choose:
      - conditions:
          - condition: trigger
            id: Button
        sequence:
          - service: media_player.play_media
            data:
              media_content_id: >-
                {{ ["XXXXXXXXXXX", "YYYYYYYYYY", "ZZZZZZZZZZZ"]|random }}
              media_content_type: text
            target:
              device_id: 54c1cd20cb9a86e3cd9c4a4f94d8b119
          - service: homeassistant.turn_off
            data: {}
            target:
              entity_id:
                - light.group_all_lights
                - media_player.media_devices
                - switch.group_switches
                - climate.18691697717200_climate
      - conditions:
          - condition: trigger
            id: Phrase
        sequence:
          - service: media_player.play_media
            data:
              media_content_id: >-
                {{ ["XXXXXXXXXXXX", "YYYYYYYYYYYY", "ZZZZZZZZZZZZ"]|random }}
              media_content_type: text
            target:
              entity_id: "{{ trigger.event.data.entity_id }}"
          - service: homeassistant.turn_off
            data: {}
            target:
              entity_id:
                - light.group_all_lights
                - media_player.media_devices
                - switch.group_switches
                - climate.18691697717200_climate
    default: []
  - delay:
      hours: 0
      minutes: 10
      seconds: 0
      milliseconds: 0
  - service: automation.turn_on
    data: {}
    target:
      entity_id: automation.coming_home
mode: restart

The default is not to continue on error, you can change that if you want.

1 Like