Add unregister hook to Vera (#150708)

This commit is contained in:
Joost Lekkerkerker
2025-08-15 15:27:49 +02:00
committed by GitHub
parent 94e9f32da5
commit 1e2f7cadc7

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)