Velbus unsubscribe to the status updates on removal (#135530)

pull/135545/head
Maikel Punie 2025-01-13 20:08:04 +01:00 committed by GitHub
parent 38dcc782d1
commit c489f94026
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 1 deletions

View File

@ -40,6 +40,10 @@ class VelbusEntity(Entity):
"""Add listener for state changes."""
self._channel.on_status_update(self._on_update)
async def async_will_remove_from_hass(self) -> None:
"""Remove listener for state changes."""
self._channel.remove_on_status_update(self._on_update)
async def _on_update(self) -> None:
self.async_write_ha_state()

View File

@ -17,7 +17,7 @@ rules:
docs-high-level-description: done
docs-installation-instructions: done
docs-removal-instructions: done
entity-event-setup: todo
entity-event-setup: done
entity-unique-id: done
has-entity-name: todo
runtime-data: done