forked from home-assistant/core
Switch airly to async_on_remove (#34498)
This commit is contained in:
@@ -128,11 +128,9 @@ class AirlyAirQuality(AirQualityEntity):
|
|||||||
|
|
||||||
async def async_added_to_hass(self):
|
async def async_added_to_hass(self):
|
||||||
"""Connect to dispatcher listening for entity data notifications."""
|
"""Connect to dispatcher listening for entity data notifications."""
|
||||||
|
self.async_on_remove(
|
||||||
self.coordinator.async_add_listener(self.async_write_ha_state)
|
self.coordinator.async_add_listener(self.async_write_ha_state)
|
||||||
|
)
|
||||||
async def async_will_remove_from_hass(self):
|
|
||||||
"""Disconnect from update signal."""
|
|
||||||
self.coordinator.async_remove_listener(self.async_write_ha_state)
|
|
||||||
|
|
||||||
async def async_update(self):
|
async def async_update(self):
|
||||||
"""Update Airly entity."""
|
"""Update Airly entity."""
|
||||||
|
@@ -149,11 +149,9 @@ class AirlySensor(Entity):
|
|||||||
|
|
||||||
async def async_added_to_hass(self):
|
async def async_added_to_hass(self):
|
||||||
"""Connect to dispatcher listening for entity data notifications."""
|
"""Connect to dispatcher listening for entity data notifications."""
|
||||||
|
self.async_on_remove(
|
||||||
self.coordinator.async_add_listener(self.async_write_ha_state)
|
self.coordinator.async_add_listener(self.async_write_ha_state)
|
||||||
|
)
|
||||||
async def async_will_remove_from_hass(self):
|
|
||||||
"""Disconnect from update signal."""
|
|
||||||
self.coordinator.async_remove_listener(self.async_write_ha_state)
|
|
||||||
|
|
||||||
async def async_update(self):
|
async def async_update(self):
|
||||||
"""Update Airly entity."""
|
"""Update Airly entity."""
|
||||||
|
Reference in New Issue
Block a user