Hi all
I’m trying to make a helper list of all the calendar evens I have in some calendars so that I can use that to trigger automations. But I’m not getting the list and not sure where I’m going wrong. Any help would be appreciated.
alias: Schedule - Calendar events for the day
description: >-
Gets a list of events that are on the calendars and can be used in other
automations
triggers:
- trigger: time
at: "00:01:00"
conditions: []
actions:
- action: calendar.get_events
target:
entity_id:
- calendar.calendar1
- calendar.calendar2
response_variable: calendar_events
- action: input_text.set_value
data:
value: "{{ calendar_events | map(attribute='summary') | join(', ') }}"
target:
entity_id: input_text.helper_calendar_events_for_the_day
mode: single
Your variable calendar_events does not contain anything with a summary attribute. It contains a dictionary whose keys are the entity IDs of your calendars. Those entity ID strings don’t have a “summary” attributes.
You might be better off setting this up as a Trigger-based template sensor and storing the list of events in an attribute.
Regarding Hellis81’s comment about state length… if you really want to store the list in a state, make sure to use the truncate() filter to cutoff the returned value at 254 characters.
Thanks, I’ll have a look at that. I don’t specifically want to store as a state. I just want anyway I can get my calendar events and use the results in automation conditions. I’m still n00b so trying to figure out and learn as I go along.