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:
parent
314bc07cee
commit
4ebbabcdd1
71 changed files with 355 additions and 209 deletions
|
@ -139,13 +139,17 @@ class RflinkSensor(RflinkDevice):
|
|||
self.hass.data[DATA_ENTITY_LOOKUP][EVENT_KEY_SENSOR][_id].append(
|
||||
self.entity_id
|
||||
)
|
||||
async_dispatcher_connect(
|
||||
self.hass, SIGNAL_AVAILABILITY, self._availability_callback
|
||||
self.async_on_remove(
|
||||
async_dispatcher_connect(
|
||||
self.hass, SIGNAL_AVAILABILITY, self._availability_callback
|
||||
)
|
||||
)
|
||||
async_dispatcher_connect(
|
||||
self.hass,
|
||||
SIGNAL_HANDLE_EVENT.format(self.entity_id),
|
||||
self.handle_event_callback,
|
||||
self.async_on_remove(
|
||||
async_dispatcher_connect(
|
||||
self.hass,
|
||||
SIGNAL_HANDLE_EVENT.format(self.entity_id),
|
||||
self.handle_event_callback,
|
||||
)
|
||||
)
|
||||
|
||||
# Process the initial event now that the entity is created
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue