From 9de57382cd38057a35dac916ce587aa3ac4ba245 Mon Sep 17 00:00:00 2001 From: Maciej Bieniek Date: Mon, 20 Apr 2020 23:00:46 +0200 Subject: [PATCH] Switch brother to async_on_remove (#34478) --- homeassistant/components/brother/sensor.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/homeassistant/components/brother/sensor.py b/homeassistant/components/brother/sensor.py index b8142ac0c34..d4f389908b1 100644 --- a/homeassistant/components/brother/sensor.py +++ b/homeassistant/components/brother/sensor.py @@ -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."""