I want to store all events of the following day in a sensor, so that every evening a tts notification tells me what events I have for tomorrow. This logic worked fine, but I think since two updates, if I have a full day event today, it is also part of tomorrow’s list.
if i read it right, the code is correctly returning what you asked it to, and it should not have been any different 2 updates ago.
gruene tonne is an all day event that spans two days. it starts on 2024-08-09 (today) and it continues and includes tomorrow (2024-08-10). therefore your query for all events that occur tomorrow properly includes this because it is also happening tomorrow. if you only want to include events that start tomorrow, then you’d have to filter it out in your ev_list_t template. something like {% if value.events.start > today_at() + timedelta(days=1) %}… (warning, quick coded w/o testing, but hopefully it communicates the essence… and if you wrote the current template, i’m guessing this is enough to get you going)
I played around with your suggestion and the following works:
{% set ns = namespace(cal_events=[]) %}
{%- for key, value in calendars2.items() %}
{%- for event in value.events %}
{% if as_timestamp(event.start) >= as_timestamp(today_at() + timedelta(days=1)) %}
{%- set ns.cal_events = ns.cal_events + [event] %}
{%- endif %}
{%- endfor %}
{%- endfor %}
{{ ns.cal_events | sort(attribute='start') | list }}
However I could have sworn that the old solution worked before. I display the number of events for today and number of events for tomorrow prominently in a dashboard and they were always correct in regards to the all day events and just a while ago they started to show wrong numbers.
calendar.family:
events:
- start: "2024-08-30"
end: "2024-08-31"
summary: No School
My timezone is UTC-4, so I tested subtracting 4 hours from my end_date_time, so I set it to 19:59:59 and this fixes it.
If I move forward another hour (20:59:59), the next day’s events start showing up again.
My guess would be that all day calendar events(?) get interpreted as UTC?
2024-08-30 00:00:00 then becomes 2024-08-29 20:00:00 in my timezone. Then the filter is applied and catches it.