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 SchoutsenandMartin Hjelmare authored and GitHub committed 2020-04-02 09:25:33 -07:00
1 parent 314bc07cee
commit 4ebbabcdd1
71 files changed
+355 -209

No files matched your search

+3 -1
View File
@@ -42,7 +42,9 @@ class HomeworksLight(HomeworksDevice, Light):
"""Call when entity is added to hass."""
signal = f"homeworks_entity_{self._addr}"
_LOGGER.debug("connecting %s", signal)
async_dispatcher_connect(self.hass, signal, self._update_callback)
self.async_on_remove(
async_dispatcher_connect(self.hass, signal, self._update_callback)
)
self._controller.request_dimmer_level(self._addr)
@property