Hello,
I am seeking assistance with a problem I’m facing in my Home Assistant automation. I have set up an automation in Home Assistant to generate a morning announcement. This announcement includes various information like weather, battery levels, and other personalized details. Additionally, I integrated a calendar to remind me about trash collection days. I include the calendar as ICS format. Due to the fact that the Utility Service does not do a proper CALDAV I cant use caldav extension (PROPFIND not supported). So I am using ics_calendar. I can see it connects and it has on/the event.
I can run the below script snippet. But I want to verify that the current day is the day of the collection day.
Issue:
I encountered an error when trying to include the trash collection reminder in the morning announcement. The error specifically pertains to the rendering of a template. I have tried multiple approaches, but I keep running into the same issue.
Original Working Code Snippet:
Here is the original working code snippet that generates the morning announcement:
{% set trash_message = '' %} {% if state_attr('calendar.abfallkalendar',
'message') is defined %}
{% set trash_event = state_attr('calendar.abfallkalendar', 'message') %}
{% set trash_message = "Heute wird " + trash_event + " abgeholt." %}
{% endif %}
Calendar Entity and Attributes:
I have integrated a calendar into Home Assistant to store and manage trash collection events. The calendar entity has the following attributes:
Name: Abfallkalendar
Message: Restmüll
All Day: false
Start Time: 2023-05-26 07:00:00
End Time: 2023-05-26 07:00:00
Location: Lübecker Straße 66a, Solingen
Description: Restmüll
Offset Reached: false
Friendly Name: Abfallkalendar
What I am trying to achieve:
I want the morning announcement to include a reminder if there is a trash collection scheduled for the day. The trash collection information is obtained from the calendar entity, and I have successfully retrieved the necessary attributes such as the event message and start time.
I am not coder, but I tried things like
% set trash_start_time = state_attr('calendar.abfallkalendar', 'start_time') | as_timestamp %}
{% if trash_start_time.date() == now() %}
I would greatly appreciate any help or suggestions regarding this issue. If you need any further information, code snippets, or specific details about the error message, please let me know, and I will be happy to provide them.
Thank you in advance for your assistance!
Cheers,
Chris