Help with outage automation

I get this error message for below automation:
Invalid config for [automation]: required key not provided @ data[‘trigger’][1][‘platform’]. Got None.

- alias: 'Reset after power failure'
  initial_state: 'on'
  trigger:
  - platform: state
    entity_id: light.hue_color_candle_1
    to: 'on'
  - condition: or
    conditions:
    - condition: state
      entity_id: input_select.house_mode
      state: 'Away'
    - condition: template
      value_template: "{{ states.sensor.period_of_day.state != 'night' }}"
  action:
    - service: light.turn_on
      data: 
        entity_id: light.bedroom_light, light.bedroom_window_light, light.book_shelf_color_two, light.bookshelf_color, light.guest_room_1, light.guest_room_2, light.guest_room_3, light.hallway_1, light.hallway_2, light.hallway_3, light.hallway_hanger, light.kitchen_fan, light.kitchen_fan_2, light.kitchen_sink, light.kitchen_sink_two, light.hue_color_candle_1, light.living_room_right_sofa, light.living_room_window_light
        color_temp: 454
        brightness: 135
    - delay:
        seconds: 1
    - service: light.turn_off
      entity_id: light.bedroom_light, light.bedroom_window_light, light.book_shelf_color_two, light.bookshelf_color, light.guest_room_1, light.guest_room_2, light.guest_room_3, light.hallway_1, light.hallway_2, light.hallway_3, light.hallway_hanger, light.kitchen_fan, light.kitchen_fan_2, light.kitchen_sink, light.kitchen_sink_two, light.hue_color_candle_1, light.living_room_right_sofa, light.living_room_window_light, light.onoff_plug_1, light.onoff_plug_2, light.onoff_plug_3, light.onoff_plug_4
    - service: notify.push
      data_template:
        title: Power failure
        message: 'Outage'

You were missing the condition section.

- alias: 'Reset after power failure'
  initial_state: 'on'
  trigger:
  - platform: state
    entity_id: light.hue_color_candle_1
    to: 'on'
  condition:
  - condition: or
    conditions:
    - condition: state
      entity_id: input_select.house_mode
      state: 'Away'
    - condition: template
      value_template: "{{ states.sensor.period_of_day.state != 'night' }}"
  action:
    - service: light.turn_on
      data: 
        entity_id: light.bedroom_light, light.bedroom_window_light, light.book_shelf_color_two, light.bookshelf_color, light.guest_room_1, light.guest_room_2, light.guest_room_3, light.hallway_1, light.hallway_2, light.hallway_3, light.hallway_hanger, light.kitchen_fan, light.kitchen_fan_2, light.kitchen_sink, light.kitchen_sink_two, light.hue_color_candle_1, light.living_room_right_sofa, light.living_room_window_light
        color_temp: 454
        brightness: 135
    - delay:
        seconds: 1
    - service: light.turn_off
      entity_id: light.bedroom_light, light.bedroom_window_light, light.book_shelf_color_two, light.bookshelf_color, light.guest_room_1, light.guest_room_2, light.guest_room_3, light.hallway_1, light.hallway_2, light.hallway_3, light.hallway_hanger, light.kitchen_fan, light.kitchen_fan_2, light.kitchen_sink, light.kitchen_sink_two, light.hue_color_candle_1, light.living_room_right_sofa, light.living_room_window_light, light.onoff_plug_1, light.onoff_plug_2, light.onoff_plug_3, light.onoff_plug_4
    - service: notify.push
      data_template:
        title: 'Power failure'
        message: 'Outage'
1 Like

:man_facepalming:

1 Like

Happens to the best of us!

Especially with conditions.

I for one find all those ‘condition(s)’ a very confusing syntax…

Agreed, I personally think the condition block of an automation should be called exceptions:, and then condition: would only refer to the conditions themselves. But that would be a seriously mental breaking change, and in all honesty it’s probably not worth the hassle after all this time.

1 Like