Skip to content

Update zone ID on config subentry rename#29

Draft
lnagel wants to merge 1 commit into
mainfrom
claude/update-zone-id-rename-D8MwF
Draft

Update zone ID on config subentry rename#29
lnagel wants to merge 1 commit into
mainfrom
claude/update-zone-id-rename-D8MwF

Conversation

@lnagel
Copy link
Copy Markdown
Owner

@lnagel lnagel commented Jan 10, 2026

When a zone config subentry is renamed via Home Assistant's native rename action, this change ensures:

  • Zone ID (subentry.data["id"]) is updated to match the new slugified name
  • Entity registry entries are updated with new unique_id values
  • Device registry identifier is updated
  • Stored state data is migrated from old zone ID to new zone ID

The migration is performed during entry setup by comparing subentry.title with subentry.data["name"]. If they differ, the zone was renamed and migration is triggered.

Includes comprehensive tests for:

  • Zone ID update
  • Entity unique_id updates
  • Device identifier updates
  • Stored state migration
  • Conflict detection when new ID already exists
  • No-op when slugified name matches existing ID

@lnagel lnagel force-pushed the claude/update-zone-id-rename-D8MwF branch from bfd9251 to e6de840 Compare February 2, 2026 16:14
@codecov
Copy link
Copy Markdown

codecov Bot commented Feb 2, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.09%. Comparing base (c141682) to head (4448acc).
✅ All tests successful. No failed tests found.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #29      +/-   ##
==========================================
+ Coverage   95.01%   95.09%   +0.08%     
==========================================
  Files          20       20              
  Lines        1645     1673      +28     
  Branches      251      258       +7     
==========================================
+ Hits         1563     1591      +28     
  Misses         45       45              
  Partials       37       37              
Files with missing lines Coverage Δ
custom_components/ufh_controller/__init__.py 85.71% <100.00%> (+5.19%) ⬆️

@lnagel lnagel force-pushed the claude/update-zone-id-rename-D8MwF branch from e6de840 to b26a4db Compare February 2, 2026 17:12
When a zone subentry is renamed using Home Assistant's native rename
action, detect the rename by comparing subentry.title with stored
name and migrate:
- Entity unique_ids in the entity registry
- Device identifiers in the device registry
- Subentry data (id and name fields)
@lnagel lnagel force-pushed the claude/update-zone-id-rename-D8MwF branch from b26a4db to 4448acc Compare February 2, 2026 18:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants