Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix invalid uniqueness constraint on unique_id #159

Merged
merged 2 commits into from
Aug 10, 2024
Merged

Conversation

dmulcahey
Copy link
Contributor

@dmulcahey dmulcahey commented Aug 10, 2024

Oh boy... where to start...

fixes: #157
related: home-assistant/core#123387

Back story

An incorrect assumption was made when converting ZHA to a lib that the unique_id of an entity in HA was globally unique. This is not the case. unique_id is only unique per platform. This caused unique id clashes that can be seen as detailed in the linked issues.

image

Fix

To fix the issue the platform_entities dict is now keyed by a tuple: (platform, unique_id) and all areas that leverage the dict are updated to account for the change.

Copy link

codecov bot commented Aug 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.68%. Comparing base (77e4094) to head (9e004c5).

Additional details and impacted files
@@            Coverage Diff             @@
##              dev     #159      +/-   ##
==========================================
- Coverage   95.69%   95.68%   -0.02%     
==========================================
  Files          61       61              
  Lines        9270     9270              
==========================================
- Hits         8871     8870       -1     
- Misses        399      400       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@dmulcahey dmulcahey marked this pull request as ready for review August 10, 2024 22:33
@puddly puddly merged commit 584e56b into dev Aug 10, 2024
6 checks passed
@dmulcahey dmulcahey deleted the dm/fix-missing-entities branch August 18, 2024 18:40
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.

Valve device switch.id_on_off is not set in switch entity
3 participants