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: if state is not None:
battery_found = state.state battery_found = state.state
else: else:
self.linked_battery_sensor = None
_LOGGER.warning( _LOGGER.warning(
"%s: Battery sensor state missing: %s", "%s: Battery sensor state missing: %s",
self.entity_id, self.entity_id,
self.linked_battery_sensor, self.linked_battery_sensor,
) )
self.linked_battery_sensor = None
if not battery_found: if not battery_found:
return return