Unsub dispatcher when removing entity from hass (#33510)

* Unsub dispatcher when removing entity from hass

* Update homeassistant/components/plaato/sensor.py

Co-Authored-By: Martin Hjelmare <marhje52@gmail.com>

* Update homeassistant/components/volvooncall/__init__.py

Co-Authored-By: Martin Hjelmare <marhje52@gmail.com>

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
This commit is contained in:
Paulus Schoutsen 2020-04-02 09:25:33 -07:00 committed by GitHub
parent 314bc07cee
commit 4ebbabcdd1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
71 changed files with 355 additions and 209 deletions

View file

@ -99,8 +99,10 @@ class AquaLogicSensor(Entity):
async def async_added_to_hass(self):
"""Register callbacks."""
self.hass.helpers.dispatcher.async_dispatcher_connect(
UPDATE_TOPIC, self.async_update_callback
self.async_on_remove(
self.hass.helpers.dispatcher.async_dispatcher_connect(
UPDATE_TOPIC, self.async_update_callback
)
)
@callback