-
-
Notifications
You must be signed in to change notification settings - Fork 31.6k
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
Cleanup devices in Nord Pool from reconfiguration #134043
Conversation
entities = er.async_entries_for_device(entity_reg, entry.id) | ||
for _entity in entities: | ||
entity_reg.async_remove(_entity.entity_id) |
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.
entities = er.async_entries_for_device(entity_reg, entry.id) | |
for _entity in entities: | |
entity_reg.async_remove(_entity.entity_id) |
entities will be cleaned up automatically once the config entry is removed from the device. The below code is preferred because other integrations might be connected to the same device
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.
The below code is preferred because other integrations might be connected to the same device.
The other method uses async_update_device
but I guess there is some reason why it exists, but I'll take a look at that some other time.
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍 |
Proposed change
Clean up devices (services) and entities from a reconfiguration of the config entry.
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: