Invalid config for [automation]: [platform] is an invalid option for [automation]

can someone please help me understand why this is failing?

Invalid config for [automation]: [platform] is an invalid option for [automation]. Check: automation->condition->0->platform. (See /config/configuration.yaml, line 12).

- id: work_leave
  alias: Leave Work
  trigger:
    platform: zone
    entity_id: device_tracker.life360_ken
    zone: zone.dc3
    event: leave
  action:
    service: notify.gmail
    data:
      message: Ken has left work
- id: work_arrive
  alias: Arrive At Work
  trigger:
    platform: zone
    entity_id: device_tracker.life360_ken
    zone: zone.dc3
    event: enter
  action:
    service: notify.gmail
    data:
      message: Ken has arrived at work
- id: sunset_lights
  alias: Lights on at sunset
  trigger:
    platform: sun
    event: sunset
    offset: "-00:15:00"
  condition: 
    condition: state
    entity_id: sensor.home_occupied
    state: 'Occupied'
  action:
    entity_id: scene.sunset_lights
    service: scene.turn_on
- id: office_day_motion
  alias: Office Motion office_day_motion
  trigger:
    platform: state
    entity_id: binary_sensor.office_sensor
    to: 'on'
  condition: 
    platform: sun
    after: sunrise
    before: sunset
  action: 
    - service: timer.start
      entity_id: timer.office_motion
    - service: light.turn_on
      data: 
        kelvin: 2700
        brightness: 254
        transition: 10
      entity_id: light.officedesk
- id: office_timer
  alias: Turn off office after no motion (10 mins)
  trigger:
    platform: event
    event_type: timer.finished
    event_data: 
      entity_id: timer.office_timer
  condition:
    condition: state
    entity_id: binary_sensor.office_sensor
    state: 'off'
  action: 
    service: light.turn_off
    data: 
      transition: 10
    entity_id: light.officedesk

this

- id: office_day_motion
  alias: Office Motion office_day_motion
  trigger:
    platform: state
    entity_id: binary_sensor.office_sensor
    to: 'on'
  condition: 
    platform: sun
    after: sunrise
    before: sunset

is different. check how it should be here or in any of your automations.

I know the way HA reports errors is not ideal… oh, well.

EDIT: i removed this portion from the automation and it now passes, so apparently this is the cause of the error?

- id: office_day_motion
  alias: Office Motion office_day_motion
  trigger:
    platform: state
    entity_id: binary_sensor.office_sensor
    to: 'on'
  condition:
    platform: sun
    after: sunrise
    before: sunset
  action:
  - service: timer.start
    entity_id: timer.office_motion
  - service: light.turn_on
    data:
      kelvin: 2700
      brightness: 254
      transition: 10
    entity_id: light.officedesk
- id: office_timer
  alias: Turn off office after no motion (10 mins)
  trigger:
  - event_data:
      entity_id: timer.office_timer
    event_type: timer.finished
    platform: event
  condition:
  - condition: state
    entity_id: binary_sensor.office_sensor
    state: 'off'
  action:
  - data:
      brightness: 1
      transition: 10
    entity_id: light.officedesk
    service: light.turn_off

Yes. platform: sun should be condition: sun in the condition: section.

Doh cant believe I did that…thanks!

In my log I have this error:
[homeassistant.config] Invalid config for [automation]: [to] is an invalid option for [automation]
I don’t understand because I have plenty of to: “on” in my automation. The one that is causing the error is:

  - alias: lumiere rouge
    initial_state: True
    trigger:
      platform: state
      entity_id: input_boolean.avis_hydro
      to: "on"
    action:
      - service: sinope.set_led_indicator
        data:
          entity_id:
            - group.sinope_pointe
          state: 1
          intensity: 50
          red: 255
          green: 5
          blue: 5

Not sure if this is what causing the error, but You should use lower case for the initial_state condition, so change to true and see if that helps.

No it didn’t change anything. Maybe I should add a for: statement like

- alias: lumiere rouge
    initial_state: True
    trigger:
      platform: state
      entity_id: input_boolean.avis_hydro
      to: "on"
      for: 
        minutes: 5

The Invalid config for [automation]: [to] is gone but the automation is still not loading

The to option is valid so I think the complaint may be due to a simpler cause like incorrect indentation (which causes the to option to appear to be invalid). Check if this new automation is indented by the same amount as the automation before it.

Found it. It was the previous automation in the same file that was wrong and cause indentation validation problem. I’ve move those two automation in another file and reload and everything is fine. So I’m gonna remove the faulty automatons.
Thank you for pointing me in that direction.