Skip to content

Commit

Permalink
Fix assertion error when unloading ZHA with pollable entities (home-a…
Browse files Browse the repository at this point in the history
  • Loading branch information
dmulcahey authored Jan 5, 2024
1 parent 2b43271 commit 2ed9397
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions homeassistant/components/zha/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,9 +216,9 @@ async def async_added_to_hass(self) -> None:

async def async_will_remove_from_hass(self) -> None:
"""Disconnect entity object when removed."""
assert self._cancel_refresh_handle
self._cancel_refresh_handle()
self._cancel_refresh_handle = None
if self._cancel_refresh_handle is not None:
self._cancel_refresh_handle()
self._cancel_refresh_handle = None
self.debug("stopped polling during device removal")
await super().async_will_remove_from_hass()

Expand Down

0 comments on commit 2ed9397

Please sign in to comment.