First automation from doc ha doen't work

I’m using the YAML code below for my first automation. I copied and pasted this code from the Home Assistant documentation and adapted it to my context (entity…) but it doesn’t work. Any ideas?"

automation:

  • alias: Front Light Schedule
    trigger:
    • platform: calendar
      event: start
      entity_id: calendar.calendar_home
    • platform: calendar
      event: end
      entity_id: calendar.calendar_home
      condition:
    • condition: template
      value_template: “{{ ‘Front Lights’ in trigger.calendar_event.summary }}”
      action:
    • if:
      • “{{ trigger.event == ‘start’ }}”
        then:
      • service: switch.turn_on
        entity_id: switch.lave_linge_switch
        else:
      • service: switch.turn_off
        entity_id: switch.lave_linge_switch

Nobody can tell what is wrong.

1 Like

It’s trigger.id. Not trigger.event

but please check what @francisp posted. if it was any complex or if it was an indent issue it’s neigh impossible to find unless you post code properly

Oh… also I think you need:

service: switch.turn_off
target:
  entity_id: switch.lave_linga_switch

This makes me wonder… Are you using the UI to do these scripts? You should either be using the UI to build them or at least to check them. It would have helped you on both of these issues