Fix HomeKit handling of unavailable state (#101021)

This commit is contained in:
J. Nick Koston 2023-09-27 16:34:25 -05:00 committed by GitHub
parent 6a52283ce0
commit 7d07694496
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 31 additions and 4 deletions

View file

@ -465,7 +465,9 @@ class HomeAccessory(Accessory): # type: ignore[misc]
def async_update_state_callback(self, new_state: State | None) -> None:
"""Handle state change listener callback."""
_LOGGER.debug("New_state: %s", new_state)
if new_state is None:
# HomeKit handles unavailable state via the available property
# so we should not propagate it here
if new_state is None or new_state.state == STATE_UNAVAILABLE:
return
battery_state = None
battery_charging_state = None