Fix GDACS integration to remove stale entities from entity registry (#33283)
* remove entities from entity registry * added test for removing entities from entity registry
This commit is contained in:
1 parent
558cccc68c
commit
a38db1f677
2 files changed
+8
No files matched your search
@@ -11,6 +11,7 @@ from homeassistant.const import (
|
||||
)
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||
from homeassistant.helpers.entity_registry import async_get_registry
|
||||
from homeassistant.util.unit_system import IMPERIAL_SYSTEM
|
||||
|
||||
from .const import DEFAULT_ICON, DOMAIN, FEED
|
||||
@@ -107,6 +108,9 @@ class GdacsEvent(GeolocationEvent):
|
||||
"""Call when entity will be removed from hass."""
|
||||
self._remove_signal_delete()
|
||||
self._remove_signal_update()
|
||||
# Remove from entity registry.
|
||||
entity_registry = await async_get_registry(self.hass)
|
||||
entity_registry.async_remove(self.entity_id)
|
||||
|
||||
@callback
|
||||
def _delete_callback(self):
|
||||
|
||||
Reference in new issue
Block a user