Fix HomeKit logging None instead of the linked battery sensor (#81860)

This commit is contained in:
Andrew Berry 2022-11-14 22:35:10 -05:00 committed by GitHub
parent 9c0a3cdae0
commit f96a4e2d0f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -358,12 +358,12 @@ class HomeAccessory(Accessory): # type: ignore[misc]
if state is not None:
battery_found = state.state
else:
self.linked_battery_sensor = None
_LOGGER.warning(
"%s: Battery sensor state missing: %s",
self.entity_id,
self.linked_battery_sensor,
)
self.linked_battery_sensor = None
if not battery_found:
return