Just noticed that in the latest version of home-assistant, calendar.list_events is deprecated in favour of calendar.get_events which supports multiple calendar entities as an input.
I’m having trouble migrating one of my automations that currently iterates through events in each calendar in a template. With list_events, i’m running the script multiple times for each calendar and concatenating the outputs. With get_events, i shouldn’t need to do this and use the script one. However, the output from the service is different and not sure how to iterate the new output format…
Solved it. The new output is returned as a dictionary. This now works:
{%- for key, value in agenda.items() %}
{%- for event in value.events %}
- Summary: {{ event.summary }}
{%- if event.location is defined %}
Location: {{ event.location }}
{% endif -%}
{%- endfor %}
{%- endfor %}
Just figured it out. Since all my events that I’m concerned about come from a single calendar, I just use the calendar’s name as an index before the events.
Detected use of deprecated service `calendar.lists_events’
Use calendar.get_events instead which supports multiple entities.
Please replace this service and adjust your automations and scripts and select submit to close this issue.
I only have one calendar.
And two automations.
Each calls one event off the one calendar - One turns state of switch on. The other turns state of switch off
I have a script that runs once a day to check the webpage of my electricity distribution company for any scheduled maintenance in my neighborhood. If maintenance is scheduled, it adds the event to my calendar and raises a warning. Since scheduled maintenance is a rare occurrence, I overlooked the transition from using calendar.list_events to calendar.get_events . Yesterday, I received a warning about this issue, along with a repair warning. The message advised me to replace the deprecated service with calendar.get_events , which supports multiple entities. I quickly found the solution after reading your post. Thank you very much!