Problem with automation using calendar trigger

Hi all,

I have a problem with my automation. I keep getting the following error:

Error: Error rendering data template: UndefinedError: ‘dict object’ has no attribute ‘calendar_event’

My automation YAML looks like this:

id: '123'
alias: Water plants
description: ''
trigger:
  - platform: calendar
    event: start
    offset: '0:0:0'
    entity_id: calendar.my_calendar
condition: []
action:
  - service: notify.mobile_app
    data:
      message: This is a {{ trigger.calendar_event.summary }}
      data:
        notification_icon: mdi:flower
mode: single

I already tried sending a notification without the {{ trigger.calendar_event.summary }} and it works without any problems.

Try looking at the calendar.my_calendar in developer tools / states and have a look if it has an summary

Hi Rossk,

Thank you for a quick response! I check and there are only two attributes: offset_reached and friendly_name. Do you know, by any chance how to add more attributes here? I tried searching for it, but I couldn’t find any walkthrough.

I got it to work! When I used this:

{{ states.calendar.my_calendar.attributes.message }}

it worked as it should. Thanks again for the help :wink: