Automations Stop if Device Is Offline

I have a goodnight script (and a few others) that turns off all the lights / devices in the home, but occasionally it will stop running to completion. I will find that several lights are left on and some of the script did not complete.

What i usually find is that there is a device that is offline and the script seems to just die at that point and never continue to the other devices. I thought the run in parallel feature in the editor would solve this, but sadly it has not.

Is there a feature that will tell the script to run whether or not it finds the device?

yaml

alias: Google Home - Goodnight
sequence:
  - parallel:
      - service: alarm_control_panel.alarm_arm_home
        target:
          entity_id: alarm_control_panel.home_alarm
        data: {}
      - choose:
          - conditions:
              - condition: state
                entity_id: lock.front_door_lock
                state: unlocked
            sequence:
              - service: lock.lock
                target:
                  entity_id: lock.front_door_lock
                data: {}
        default: []
      - service: script.shut_down_upstairs_lights
        data: {}
      - service: script.turn_off_downstairs_other
        data: {}
      - service: script.shut_down_downstairs
        data: {}
      - service: light.turn_off
        data: {}
        target:
          entity_id: light.dining_room_lamp
mode: single
icon: mdi:script

Yeah, do this for each of the script service calls:

- service: script.turn_on
  entity_id: script.shut_down_upstairs_lights

There’s also this now: https://www.home-assistant.io/docs/scripts/#continuing-on-error

1 Like

Thanks so much!

I have tried the continue on error addition to the actions of the scripts to see if this will resolve it.

I also threw a feature request in to add it to the visual editor. I had no idea this existed. Such an important that may go un-noticed.

I really appreciate it!