Skip to content

Populate uid and recurrence_id in CalDAV calendar events#170910

Merged
balloob merged 1 commit into
devfrom
frenck-2026-0547
May 16, 2026
Merged

Populate uid and recurrence_id in CalDAV calendar events#170910
balloob merged 1 commit into
devfrom
frenck-2026-0547

Conversation

@frenck
Copy link
Copy Markdown
Member

@frenck frenck commented May 16, 2026

Proposed change

The CalDAV integration was not passing uid or recurrence_id from the source VEVENT when constructing CalendarEvent objects, even though both fields are supported by CalendarEvent and other calendar integrations (local_calendar, google, remote_calendar) properly populate them.

This meant that both the REST API (/api/calendars/<entity_id>) and the calendar.get_events service returned null for uid and recurrence_id on every event, breaking downstream consumers that rely on uid to identify or deduplicate events.

This PR passes uid and recurrence_id from the vobject VEVENT to CalendarEvent in both code paths (async_get_events and _async_update_data).

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Deprecation (breaking change to happen in the future)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

Checklist

  • I understand the code I am submitting and can explain how it works.
  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • I have followed the perfect PR recommendations
  • The code has been formatted using Ruff (ruff format homeassistant tests)
  • Tests have been added to verify that the new code works.
  • Any generated code has been carefully reviewed for correctness and compliance with project standards.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies a diff between library versions and ideally a link to the changelog/release notes is added to the PR description.

To help with the load of incoming pull requests:

Copilot AI review requested due to automatic review settings May 16, 2026 15:12
@home-assistant home-assistant Bot added bugfix cla-signed has-tests integration: caldav small-pr PRs with less than 30 lines. Top 200 Integration is ranked within the top 200 by usage Quality Scale: No score labels May 16, 2026
@frenck frenck added this to the 2026.5.3 milestone May 16, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.uid and CalendarEvent.recurrence_id in 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 for recurrence_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 balloob merged commit 6ae50ff into dev May 16, 2026
34 checks passed
@balloob balloob deleted the frenck-2026-0547 branch May 16, 2026 16:22
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>
@github-actions github-actions Bot locked and limited conversation to collaborators May 17, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CalDAV integration: CalendarEvent.uid not populated from source VEVENT

3 participants