-
-
Notifications
You must be signed in to change notification settings - Fork 35.8k
Fix update of the entity ID does not clean up an old restored state #151696
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well spotted @jbouwh 👍 👍
The solution needs some tweaks though
|
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍 |
Co-authored-by: Erik Montnemery <erik@montnemery.com>
Co-authored-by: Erik Montnemery <erik@montnemery.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! I'd like a second opinion before merging though.
|
CI test failure seems not related |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense.
|
Thanks! |
…ome-assistant#151696) Co-authored-by: Erik Montnemery <erik@montnemery.com>
Proposed change
When a user changes the
entity_idof enabled entity, that has not been loaded yet, the old restored state not cleaned up. This can cause issues with integrations like MQTT that can have entities in the entity registry that are not loaded (yet). After the entity has been renamed (e.g. via the UI or via discovery, the change cannot be reverted, because the old restored state is still loaded after renaming). This PR cleans up the old entity state in case the old entity had a restored state during a rename of theentity_idand sets anunavailablestate to the entity with the new ID.Type of change
Additional information
Checklist
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: