Add log when device is online and unavailable (#143648)

This commit is contained in:
Retha Runolfsson 2025-04-30 02:52:12 +08:00 committed by GitHub
parent d657298791
commit cc7929f8fb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 1 deletions

View File

@ -91,6 +91,7 @@ class SwitchbotDataUpdateCoordinator(ActiveBluetoothDataUpdateCoordinator[None])
"""Handle the device going unavailable."""
super()._async_handle_unavailable(service_info)
self._was_unavailable = True
_LOGGER.info("Device %s is unavailable", self.device_name)
@callback
def _async_handle_bluetooth_event(
@ -114,6 +115,7 @@ class SwitchbotDataUpdateCoordinator(ActiveBluetoothDataUpdateCoordinator[None])
if not self.device.advertisement_changed(adv) and not self._was_unavailable:
return
self._was_unavailable = False
_LOGGER.info("Device %s is online", self.device_name)
self.device.update_from_advertisement(adv)
super()._async_handle_bluetooth_event(service_info, change)

View File

@ -32,7 +32,7 @@ rules:
docs-installation-parameters: done
entity-unavailable: done
integration-owner: done
log-when-unavailable: todo
log-when-unavailable: done
parallel-updates: done
reauthentication-flow:
status: exempt