Akron
January 23, 2024, 4:02pm
1
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.
123
(Taras)
January 23, 2024, 4:41pm
2
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
Akron
January 23, 2024, 4:56pm
3
That’s interesting. I use the caldav integration - didn’t think this could be the source of the problem.
123
(Taras)
January 23, 2024, 5:00pm
4
Possibly related to this reported issue:
opened 09:28AM - 13 Dec 23 UTC
integration: caldav
### The problem
I am using the Caldav integration to access a Nextcloud calenda… r.
When using automations, the Calendar trigger event does not fire for all-day events. It works fine for events that are not added as all-day events.
A service call to calendar.get_events returns the following:
calendar.homeoffice:
events:
- start: "2023-12-13T10:35:00+01:00"
end: "2023-12-13T10:40:00+01:00"
summary: Homeofficetest
- start: "2023-12-13"
end: "2023-12-14"
summary: Alldaytest
The first entry with start: "2023-12-13T10:35:00+01:00" works fine, however the second entry with start: "2023-12-13 did not cause the calendar trigger event to fire.
Am I missing something or is this a bug?
Thanks
Jan
### What version of Home Assistant Core has the issue?
core-2023.12.1
### What was the last working version of Home Assistant Core?
_No response_
### What type of installation are you running?
Home Assistant OS
### Integration causing the issue
caldav
### Link to integration documentation on our website
_No response_
### Diagnostics information
_No response_
### Example YAML snippet
```yaml
alias: "CAL: HeuteHomeoffice"
description: ""
trigger:
- platform: calendar
event: start
offset: "0:0:0"
entity_id: calendar.homeoffice
id: Anfang
- platform: calendar
event: end
offset: "-0:0:0"
entity_id: calendar.homeoffice
id: Ende
condition: []
action:
- if:
- condition: trigger
id:
- Anfang
then:
- service: input_boolean.turn_on
data: {}
target:
entity_id: input_boolean.heutehomeoffice
- if:
- condition: trigger
id:
- Ende
then:
- service: input_boolean.turn_off
target:
device_id: []
area_id: []
entity_id: input_boolean.heutehomeoffice
data: {}
mode: parallel
max: 10
```
### Anything in the logs that might be useful for us?
_No response_
### Additional information
_No response_
Akron
January 23, 2024, 5:07pm
5
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)!
ma-ns
November 8, 2024, 10:49am
6
Sorry for reviving this thread, I just wanted to share what I found out for whoever next might need these insights:
On the linked github issue, allenporter mentioned time zones , which made me try the following:
action: calendar.get_events
target:
entity_id: calendar.andrena_termine
data:
duration:
days: 1
start_date_time: "2024-11-08T00:00Z"
The Z
after the time indicates Zulu Time, aka UTC. You could use UTC
or +00:00
. Or use midnight UTC in your server time zone – but beware daylight saving time! If you want to save 3 bytes, T00Z
would be enough for the time part, but I think it’s easier on the eyes to have T00:00Z
.