Invalid config for [automation]: required key not provided @ data['trigger'][1]['platform']

Team

I have 5000 lines in Automation.yaml and have had this error up for some time. I went though all lines to check that the formating for Platform part is correct. Any idea what could be the issue?

line 18 is this in configuration.yaml
image

It seems to be implying that the second trigger (i.e., index 1, since the list of triggers is zero-based) of one of the automations is missing the platform key. Could it be a typo (i.e., misspelled platform)?

1 Like

thank you sir for your response and help pointing me to the right direction.

I have installed Studio Code Server ( been using File Editor ) and the addon it selft found the error.

image

had missing Condition segment in one of the automations. Problem fixed!

1 Like

I have the same sort of error

Automation with alias 'Radiator Schedule' could not be validated and has been disabled: required key not provided @ data['condition'][1]['device_id']. Got None
Automation with alias 'Radiator Schedule' could not be validated and has been disabled: extra keys not allowed @ data['condition'][1]['domain']. Got 'binary_sensor' extra keys not allowed @ data['condition'][1]['type']. Got 'is_not_open' required key not provided @ data['condition'][1]['state']. Got None`

This is my code

- alias: Radiator Schedule
  description: "Set radiators to schedule"
  trigger:
    - entity_id: person.xxxxx
      platform: state
      from: not_home
      to: home
    - entity_id: person.xxxxxx
      platform: state
      from: not_home
      to: home
  condition:
    - condition: time
      after: "07:00:00"
      before: "23:00:00"
    - condition: device
      type: is_not_open
      entity_id: binary_sensor.window_door_sensor
      domain: binary_sensor
  action:
    data: {}
    service: script.radiatorschedule

When I inspect window_door_sensor, I get

"on": true
temperature: 18
device_class: door
friendly_name: Window / Door Sensor
icon: mdi:lock

Can anyone help me identify the error and help fix the code?

Check your automation condition directly in the UI editor. The device id is missing. Create a example device condition and compare the code. Example:


condition: device
type: is_off
device_id: c5c01f5772f5bfbad64f28bd509b50bb
entity_id: 37e41a6b2d3fdf1f866f0a95253fffd0
domain: light

I changed the code to

- alias: Radiator Schedule
  description: "Set radiators to schedule"
  trigger:
    - platform: state
      entity_id: 
        - person.xxxxx
        - person.xxxxxxx
      from: "not_home"
      to: "home"
  condition:
    - condition: time
      after: "07:00:00"
      before: "23:00:00"
    - condition: state
      entity_id: binary_sensor.window_door_sensor
      state: 'off'
  action:
    - service: script.turn_on
      entity_id: script.radiatorschedule

and now the errors are gone.

1 Like