From cc7929f8fb724a649831b9d6fa381b8dcc3a707b Mon Sep 17 00:00:00 2001 From: Retha Runolfsson <137745329+zerzhang@users.noreply.github.com> Date: Wed, 30 Apr 2025 02:52:12 +0800 Subject: [PATCH] Add log when device is online and unavailable (#143648) --- homeassistant/components/switchbot/coordinator.py | 2 ++ homeassistant/components/switchbot/quality_scale.yaml | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/switchbot/coordinator.py b/homeassistant/components/switchbot/coordinator.py index 807132d13e8..3e3b59f9e06 100644 --- a/homeassistant/components/switchbot/coordinator.py +++ b/homeassistant/components/switchbot/coordinator.py @@ -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) diff --git a/homeassistant/components/switchbot/quality_scale.yaml b/homeassistant/components/switchbot/quality_scale.yaml index aa32c629482..e9d8a9626ac 100644 --- a/homeassistant/components/switchbot/quality_scale.yaml +++ b/homeassistant/components/switchbot/quality_scale.yaml @@ -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