Calendar Integration Issue

I am using the Calendar integration for automation of reminders. I want to send the reminders to the Awtrix LED. Following the documented calendar “get_cal_events” and using a response variable, in a subsequent action the variable does not contain the events and I receive and error message in the logs that my calendar object is not found. Error while executing automation automation.awtrix_rest_reminders: Error rendering data template: UndefinedError: ‘dict object’ has no attribute ‘calendar.main’. The get_cal_events works fine in the developers tools->service but no joy in an automation. Automation below. Any suggestions. Thanks in advance.

alias: Awtrix_REST_Reminders
description: ""
trigger:
  - platform: time_pattern
    minutes: /1
condition: []
action:
  - service: script.get_cal_events
    target:
      entity_id: calendar.main
    data:
      duration:
        days: 1
    response_variable: agenda
  - service: rest_command.awtrix_message
    data:
      message: >-
        Reminder {% for event in agenda["calendar.main"]["events"] %} {{
        event.start}}: {{ event.summary }} {% endfor %}
      color: "#E97451"
      duration: 15
mode: queued

Please post the configuration of the script that is being called… we have no idea what it is doing, so there is no way for us to determine the source of the error.

script.get_cal_events is built in as per the documentation. The rest command works just fine. Not sure that your asking. thanks much.

I’m asking you to provide the script you are calling, script.get_cal_events, since I can find no such script in the docs and the way you have constructed that service call action doesn’t follow the standard syntax. Normally, a script that is called directly does not include a target.

Are you sure you have not mistakenly written script.get_cal_events when you meant calendar.get_events?

I sit corrected! It’s calendar.get_events… will try that…user error :grinning: