diff --git a/homeassistant/components/airly/air_quality.py b/homeassistant/components/airly/air_quality.py index fa42e58e9ad..deeff9af00f 100644 --- a/homeassistant/components/airly/air_quality.py +++ b/homeassistant/components/airly/air_quality.py @@ -128,11 +128,9 @@ class AirlyAirQuality(AirQualityEntity): async def async_added_to_hass(self): """Connect to dispatcher listening for entity data notifications.""" - 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) + self.async_on_remove( + self.coordinator.async_add_listener(self.async_write_ha_state) + ) async def async_update(self): """Update Airly entity.""" diff --git a/homeassistant/components/airly/sensor.py b/homeassistant/components/airly/sensor.py index 0ee9fb3aac5..ec7b8cb3c76 100644 --- a/homeassistant/components/airly/sensor.py +++ b/homeassistant/components/airly/sensor.py @@ -149,11 +149,9 @@ class AirlySensor(Entity): async def async_added_to_hass(self): """Connect to dispatcher listening for entity data notifications.""" - 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) + self.async_on_remove( + self.coordinator.async_add_listener(self.async_write_ha_state) + ) async def async_update(self): """Update Airly entity."""