Skip to content

Commit

Permalink
fix: avoid updates during shutdown (#307)
Browse files Browse the repository at this point in the history
* fix: avoid updates during shutdown

* invert check
  • Loading branch information
chemelli74 authored Sep 19, 2024
1 parent 688b416 commit f47bbfd
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion custom_components/midea_ac_lan/midea_entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,21 @@ def update_state(self, status: Any) -> None: # noqa: ANN401
"""Update entity state."""
if not self.hass:
_LOGGER.error(
"Midea entity update_state for %s [%s] with status %s",
"MideaEntity update_state for %s [%s] with status %s: HASS is None",
self.name,
type(self),
status,
)
return

if self.hass.is_stopping:
_LOGGER.debug(
"MideaEntity update_state for %s [%s] with status %s: HASS is stopping",
self.name,
type(self),
status,
)
return

if self._entity_key in status or "available" in status:
self.schedule_update_ha_state()

0 comments on commit f47bbfd

Please sign in to comment.