mirror of
https://github.com/home-assistant/core.git
synced 2025-11-04 16:39:28 +00:00
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:
@@ -28,11 +28,15 @@ class APICount(Entity):
|
||||
|
||||
async def async_added_to_hass(self):
|
||||
"""Added to hass."""
|
||||
self.hass.helpers.dispatcher.async_dispatcher_connect(
|
||||
SIGNAL_WEBSOCKET_CONNECTED, self._update_count
|
||||
self.async_on_remove(
|
||||
self.hass.helpers.dispatcher.async_dispatcher_connect(
|
||||
SIGNAL_WEBSOCKET_CONNECTED, self._update_count
|
||||
)
|
||||
)
|
||||
self.hass.helpers.dispatcher.async_dispatcher_connect(
|
||||
SIGNAL_WEBSOCKET_DISCONNECTED, self._update_count
|
||||
self.async_on_remove(
|
||||
self.hass.helpers.dispatcher.async_dispatcher_connect(
|
||||
SIGNAL_WEBSOCKET_DISCONNECTED, self._update_count
|
||||
)
|
||||
)
|
||||
self._update_count()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user