mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 21:06:19 +00:00
Delete devices / entities when we remove a config entry. (#23983)
* Remove device when last config entry removed * Remove entities when config entry removed * Update tests to use new behaviour
This commit is contained in:
committed by
Paulus Schoutsen
parent
d7d83c683d
commit
f991ec15f2
@@ -302,9 +302,11 @@ class EntityRegistry:
|
||||
@callback
|
||||
def async_clear_config_entry(self, config_entry):
|
||||
"""Clear config entry from registry entries."""
|
||||
for entity_id, entry in self.entities.items():
|
||||
if config_entry == entry.config_entry_id:
|
||||
self._async_update_entity(entity_id, config_entry_id=None)
|
||||
for entity_id in [
|
||||
entity_id
|
||||
for entity_id, entry in self.entities.items()
|
||||
if config_entry == entry.config_entry_id]:
|
||||
self.async_remove(entity_id)
|
||||
|
||||
|
||||
@bind_hass
|
||||
|
||||
Reference in New Issue
Block a user