mirror of
https://github.com/home-assistant/core.git
synced 2025-08-01 01:28:24 +00:00
Don't clear entity_sources when removing an entity which is in the registry
This commit is contained in:
parent
cfb4161635
commit
3d6cfc0018
@ -1424,6 +1424,10 @@ class Entity(
|
|||||||
self.registry_entry.write_unavailable_state(self.hass)
|
self.registry_entry.write_unavailable_state(self.hass)
|
||||||
else:
|
else:
|
||||||
self.hass.states.async_remove(self.entity_id, context=self._context)
|
self.hass.states.async_remove(self.entity_id, context=self._context)
|
||||||
|
# The check for self.platform guards against integrations not using an
|
||||||
|
# EntityComponent and can be removed in HA Core 2024.1
|
||||||
|
if self.platform:
|
||||||
|
del entity_sources(self.hass)[self.entity_id]
|
||||||
|
|
||||||
async def async_added_to_hass(self) -> None:
|
async def async_added_to_hass(self) -> None:
|
||||||
"""Run when entity about to be added to hass.
|
"""Run when entity about to be added to hass.
|
||||||
@ -1482,10 +1486,6 @@ class Entity(
|
|||||||
|
|
||||||
Not to be extended by integrations.
|
Not to be extended by integrations.
|
||||||
"""
|
"""
|
||||||
# The check for self.platform guards against integrations not using an
|
|
||||||
# EntityComponent and can be removed in HA Core 2024.1
|
|
||||||
if self.platform:
|
|
||||||
del entity_sources(self.hass)[self.entity_id]
|
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
def _async_registry_updated(
|
def _async_registry_updated(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user