Switch brother to async_on_remove (#34478)

pull/34480/head
Maciej Bieniek 2020-04-20 23:00:46 +02:00 committed by GitHub
parent 6fc517fdbe
commit 9de57382cd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 5 deletions

View File

@ -142,11 +142,9 @@ class BrotherPrinterSensor(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 Brother entity."""