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

Move to StrEnum with backport for older Python versions #923

Merged
merged 3 commits into from
Aug 6, 2023

Conversation

iMicknl
Copy link
Owner

@iMicknl iMicknl commented Aug 4, 2023

No description provided.

@github-actions github-actions bot added the enhancement New feature or request label Aug 4, 2023
@iMicknl iMicknl merged commit 89fb1ad into main Aug 6, 2023
4 checks passed
@iMicknl iMicknl deleted the enhancement/backport-strenum branch August 6, 2023 16:15
@fetzerch
Copy link
Contributor

fetzerch commented Sep 5, 2023

This PR causes a change of all sensor unique_id in https://github.com/home-assistant/core/blob/dev/homeassistant/components/overkiz/entity.py#L117C84-L117C84 between 2023.8.4 (with pyoverkiz 1.9.0) and the current dev (with pyoverkiz 1.10.1). This leads to new entity_ids and essentially duplicated and unavailable entities. I'm not sure if that's an intentional breaking change, but I guess it's rather an issue that just slipped in.

The old Enum has __str__ set to {classname}.{optionname} while StrEnum uses {optionvalue}. E.g unique_id="io://XXXX-XXXX-XXXX/XXXXXXX-OverkizState.CORE_DISCRETE_RSSI_LEVEL" became unique_id="io://XXXX-XXXX-XXXX/XXXXXXX-core:DiscreteRSSILevelState" (you can double check that in .storage/core.entity_registry).

In order to change it back to the old behavior we can either change the integration to use self.entity_description.key.__class__.__name__.self.entity_description.key.name in https://github.com/home-assistant/core/blob/dev/homeassistant/components/overkiz/entity.py#L117C84-L117C84 or override __str__ in the library. I'm not sure if there's any other place that relied on the old behavior but if not it's probably easiest to adapt the integration.

I have not found a corresponding issue in the integration yet. I did find home-assistant/core#99404, but I'm not sure if it's the same.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants