Help with automation error: Message malformed: extra keys not allowed @ data['automation']

Error upon trying to save the below automation: image

description: Piano Lessons
automation:
  - alias: Piano Lessons
    trigger:
      - platform: calendar
        entity_id: calendar.family
        calendar_event.summary: Piano Lessons
        event: start
      - platform: calendar
        entity_id: calendar.family
        calendar_event.summary: Piano Lessons
        event: end
    action:
      - if:
          - '{{ trigger.event == ''start'' }}'
        then:
          - state: 'on'
        else:
          - state: 'off'

There’s a lot of things wrong with that automation. Where did you get it?

What are you attempting to create because the example you posted isn’t a proper Automation or a Trigger-based Template Binary Sensor.

Here: Calendar - Home Assistant

And then attempted my own twist on it haha.

Thanks for the feedback though.

Basically just want my calendar.family state to change to on when this event starts and then off when it ends

A calendar entity’s state automatically changes to on when one of its scheduled events starts. It changes to off when the event ends.

I had an all day event today and it wasn’t set to “on” does this not apply to all day events?

I have one scheduled event today, it’s an all-day event, and the calendar entity’s state is on.

The calendar entity I have is produced by the Google Calendar integration. Are you using the same integration or are you using the CalDAV integration?

My mistake, it does appear to be showing as on today.

I’ve realized my logic was flawed in what I was trying to achieve anyway (still learning).

End goal is for a picture card to display when our little one has piano lessons or library day, although I’ve set the condition to family.calendar: on, so both appear whenever the calendar is on rather than their individual event being on.