Fix assertion error when unloading ZHA with pollable entities (#107311)

This commit is contained in:
David F. Mulcahey 2024-01-05 16:53:43 -05:00 committed by Franck Nijhof
parent 5a01b55fd1
commit 003d2be477
No known key found for this signature in database
GPG Key ID: D62583BA8AB11CA3

View File

@ -216,9 +216,9 @@ class PollableSensor(Sensor):
async def async_will_remove_from_hass(self) -> None: async def async_will_remove_from_hass(self) -> None:
"""Disconnect entity object when removed.""" """Disconnect entity object when removed."""
assert self._cancel_refresh_handle if self._cancel_refresh_handle is not None:
self._cancel_refresh_handle() self._cancel_refresh_handle()
self._cancel_refresh_handle = None self._cancel_refresh_handle = None
self.debug("stopped polling during device removal") self.debug("stopped polling during device removal")
await super().async_will_remove_from_hass() await super().async_will_remove_from_hass()