Skip to content

Commit

Permalink
Fix assertion error when unloading ZHA with pollable entities (#107311)
Browse files Browse the repository at this point in the history
  • Loading branch information
dmulcahey authored and frenck committed Jan 6, 2024
1 parent 5a01b55 commit 003d2be
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 003d2be

Please sign in to comment.