Populate uid and recurrence_id in CalDAV calendar events#170910
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request updates the CalDAV integration to propagate uid and recurrence_id from CalDAV VEVENTs into Home Assistant CalendarEvent objects so API consumers can reliably identify/deduplicate events.
Changes:
- Populate
CalendarEvent.uidandCalendarEvent.recurrence_idin both CalDAV event listing (async_get_events) and coordinator refresh (_async_update_data). - Extend CalDAV calendar tests to assert
uid(and add a new test forrecurrence_id) in the/api/calendars/{entity_id}response.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| homeassistant/components/caldav/coordinator.py | Adds uid and recurrence_id mapping when constructing CalendarEvent instances. |
| tests/components/caldav/test_calendar.py | Updates expected API event payload to include uid and adds a recurrence-id-focused API test. |
| "location": "Hamburg", | ||
| "description": "Surprisingly rainy", | ||
| "uid": None, | ||
| "uid": "0", |
Comment on lines
79
to
+87
| end=self.to_local(self.get_end_date(vevent)), | ||
| location=get_attr_value(vevent, "location"), | ||
| description=get_attr_value(vevent, "description"), | ||
| uid=get_attr_value(vevent, "uid"), | ||
| recurrence_id=( | ||
| str(v) | ||
| if (v := get_attr_value(vevent, "recurrence_id")) is not None | ||
| else None | ||
| ), |
balloob
approved these changes
May 16, 2026
Copilot AI
pushed a commit
to AlCalzone/homeassistant-core
that referenced
this pull request
May 17, 2026
…ant#170910) Co-authored-by: AlCalzone <17641229+AlCalzone@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposed change
The CalDAV integration was not passing
uidorrecurrence_idfrom the source VEVENT when constructingCalendarEventobjects, even though both fields are supported byCalendarEventand other calendar integrations (local_calendar, google, remote_calendar) properly populate them.This meant that both the REST API (
/api/calendars/<entity_id>) and thecalendar.get_eventsservice returnednullforuidandrecurrence_idon every event, breaking downstream consumers that rely onuidto identify or deduplicate events.This PR passes
uidandrecurrence_idfrom the vobject VEVENT toCalendarEventin both code paths (async_get_eventsand_async_update_data).Type of change
Additional information
CalendarEvent.uidnot populated from source VEVENT #170761Checklist
ruff format homeassistant tests)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest.requirements_all.txt.Updated by running
python3 -m script.gen_requirements_all.To help with the load of incoming pull requests: