Add unregister hook to Vera (#150708)
parent
94e9f32da5
commit
1e2f7cadc7
|
@ -48,6 +48,10 @@ class VeraEntity[_DeviceTypeT: veraApi.VeraDevice](Entity):
|
|||
"""Subscribe to updates."""
|
||||
self.controller.register(self.vera_device, self._update_callback)
|
||||
|
||||
async def async_will_remove_from_hass(self) -> None:
|
||||
"""Unsubscribe from updates."""
|
||||
self.controller.unregister(self.vera_device, self._update_callback)
|
||||
|
||||
def _update_callback(self, _device: _DeviceTypeT) -> None:
|
||||
"""Update the state."""
|
||||
self.schedule_update_ha_state(True)
|
||||
|
|
Loading…
Reference in New Issue