mirror of
https://github.com/home-assistant/core.git
synced 2025-09-08 14:21:33 +02:00
Add unregister hook to Vera (#150708)
This commit is contained in:
committed by
GitHub
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)
|
||||
|
Reference in New Issue
Block a user