mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 20:57:21 +00:00
Unregister updates when a Wemo entry is removed (#44005)
This commit is contained in:
parent
6ce45e39d1
commit
c9c3a8fe38
@ -67,6 +67,11 @@ class WemoBinarySensor(BinarySensorEntity):
|
|||||||
await self.hass.async_add_executor_job(registry.register, self.wemo)
|
await self.hass.async_add_executor_job(registry.register, self.wemo)
|
||||||
registry.on(self.wemo, None, self._subscription_callback)
|
registry.on(self.wemo, None, self._subscription_callback)
|
||||||
|
|
||||||
|
async def async_will_remove_from_hass(self) -> None:
|
||||||
|
"""Wemo sensor removed from hass."""
|
||||||
|
registry = self.hass.data[WEMO_DOMAIN]["registry"]
|
||||||
|
await self.hass.async_add_executor_job(registry.unregister, self.wemo)
|
||||||
|
|
||||||
async def async_update(self):
|
async def async_update(self):
|
||||||
"""Update WeMo state.
|
"""Update WeMo state.
|
||||||
|
|
||||||
|
@ -249,6 +249,11 @@ class WemoHumidifier(FanEntity):
|
|||||||
await self.hass.async_add_executor_job(registry.register, self.wemo)
|
await self.hass.async_add_executor_job(registry.register, self.wemo)
|
||||||
registry.on(self.wemo, None, self._subscription_callback)
|
registry.on(self.wemo, None, self._subscription_callback)
|
||||||
|
|
||||||
|
async def async_will_remove_from_hass(self) -> None:
|
||||||
|
"""Wemo humidifier removed from hass."""
|
||||||
|
registry = self.hass.data[WEMO_DOMAIN]["registry"]
|
||||||
|
await self.hass.async_add_executor_job(registry.unregister, self.wemo)
|
||||||
|
|
||||||
async def async_update(self):
|
async def async_update(self):
|
||||||
"""Update WeMo state.
|
"""Update WeMo state.
|
||||||
|
|
||||||
|
@ -279,6 +279,11 @@ class WemoDimmer(LightEntity):
|
|||||||
await self.hass.async_add_executor_job(registry.register, self.wemo)
|
await self.hass.async_add_executor_job(registry.register, self.wemo)
|
||||||
registry.on(self.wemo, None, self._subscription_callback)
|
registry.on(self.wemo, None, self._subscription_callback)
|
||||||
|
|
||||||
|
async def async_will_remove_from_hass(self) -> None:
|
||||||
|
"""Wemo dimmer removed from hass."""
|
||||||
|
registry = self.hass.data[WEMO_DOMAIN]["registry"]
|
||||||
|
await self.hass.async_add_executor_job(registry.unregister, self.wemo)
|
||||||
|
|
||||||
async def async_update(self):
|
async def async_update(self):
|
||||||
"""Update WeMo state.
|
"""Update WeMo state.
|
||||||
|
|
||||||
|
@ -220,6 +220,11 @@ class WemoSwitch(SwitchEntity):
|
|||||||
await self.hass.async_add_executor_job(registry.register, self.wemo)
|
await self.hass.async_add_executor_job(registry.register, self.wemo)
|
||||||
registry.on(self.wemo, None, self._subscription_callback)
|
registry.on(self.wemo, None, self._subscription_callback)
|
||||||
|
|
||||||
|
async def async_will_remove_from_hass(self) -> None:
|
||||||
|
"""Wemo switch removed from hass."""
|
||||||
|
registry = self.hass.data[WEMO_DOMAIN]["registry"]
|
||||||
|
await self.hass.async_add_executor_job(registry.unregister, self.wemo)
|
||||||
|
|
||||||
async def async_update(self):
|
async def async_update(self):
|
||||||
"""Update WeMo state.
|
"""Update WeMo state.
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user