diff --git a/homeassistant/components/homekit/accessories.py b/homeassistant/components/homekit/accessories.py index 3832d9d31c2..75b122dfb94 100644 --- a/homeassistant/components/homekit/accessories.py +++ b/homeassistant/components/homekit/accessories.py @@ -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