From 1d289c00834904eec2476f4aa742fae38cdc6dc0 Mon Sep 17 00:00:00 2001 From: Samuel Xiao <40679757+XiaoLing-git@users.noreply.github.com> Date: Fri, 12 Dec 2025 22:39:08 +0800 Subject: [PATCH] Switchbot Cloud: Fixed binary sensors didn't update automatically (#158434) Co-authored-by: Joost Lekkerkerker --- .../components/switchbot_cloud/binary_sensor.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/homeassistant/components/switchbot_cloud/binary_sensor.py b/homeassistant/components/switchbot_cloud/binary_sensor.py index 2a892206d8f0..316badc42f73 100644 --- a/homeassistant/components/switchbot_cloud/binary_sensor.py +++ b/homeassistant/components/switchbot_cloud/binary_sensor.py @@ -147,16 +147,16 @@ class SwitchBotCloudBinarySensor(SwitchBotCloudEntity, BinarySensorEntity): self.entity_description = description self._attr_unique_id = f"{device.device_id}_{description.key}" - @property - def is_on(self) -> bool | None: + def _set_attributes(self) -> None: """Set attributes from coordinator data.""" if not self.coordinator.data: - return None + return if self.entity_description.value_fn: - return self.entity_description.value_fn(self.coordinator.data) + self._attr_is_on = self.entity_description.value_fn(self.coordinator.data) + return - return ( + self._attr_is_on = ( self.coordinator.data.get(self.entity_description.key) == self.entity_description.on_value )