Add unregister hook to Vera (#150708)

pull/148342/merge
Joost Lekkerkerker 2025-08-15 15:27:49 +02:00 committed by GitHub
parent 94e9f32da5
commit 1e2f7cadc7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 0 deletions

View File

@ -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)