Get all-day events for specific days

As reported here, all-day events will always have an end 1 day after start date.

But, when I want to get_events from a calendar with all-day events for tomorrow only (today is 2024-01-23) with

- service: calendar.get_events
  target:
    entity_id: calendar.homeassistant_alldayevents
  data:
    start_date_time: '2024-01-24'
    duration:
      days: 1
    response_variable: homeoffice_agenda

I also receive all-day events for today:

homeoffice_agenda:
  calendar.homeassistant_alldayevents:
    events:
      - start: '2024-01-23'
        end: '2024-01-24'
        summary: 'Today event'

(I already tested with other values for duration and end_date_time - also with second granularity.)

How can I restrict the list to only show (all-day) events for tomorrow? I want to check on the events - and don’t want to trigger on them.

(This is my first post here - so let me say “Hi!” first! I searched the forum before I posted here, but found no solution that worked.)

P.S. I saw this thread adding a filter like

 - variables:
      all_events: >-
        {{ homeoffice_agenda['calendar.homeassistant_alldayevents'].events  |
        rejectattr('start', 'eq', today_at().date() | string ) | list }}

But I would imagine this also filters out multi-day events.

FWIW, I couldn’t replicate the problem.

I created three all-day events, each in a separate day (today, tomorrow, and the day after). Then I used Developer Tools > Services to test the service call you posted (using my calendar). The result contained just tomorrow’s all-day event.

The calendar I used for the test uses the Google Calendar integration.

1 Like

That’s interesting. I use the caldav integration - didn’t think this could be the source of the problem.

Possibly related to this reported issue:

Thanks for pointing that out! You may be right, that this problem is related, although it concerns triggers. I had no problems with states based on all-day events yet, but maybe it’s really an issue with the integration and not with my configuration. Thank you (especially for testing my config with a different integration)!