From cf41da803d5679e902799ba734fadce0709f075a Mon Sep 17 00:00:00 2001 From: XiaoLing-git Date: Tue, 9 Dec 2025 18:00:03 +0800 Subject: [PATCH 1/2] add _set_attributes --- .../components/switchbot_cloud/binary_sensor.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/homeassistant/components/switchbot_cloud/binary_sensor.py b/homeassistant/components/switchbot_cloud/binary_sensor.py index 2a892206d8f02..8d15504130ba2 100644 --- a/homeassistant/components/switchbot_cloud/binary_sensor.py +++ b/homeassistant/components/switchbot_cloud/binary_sensor.py @@ -147,16 +147,17 @@ def __init__( 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 ) + return From 95f38dbf100e596e541035dd612441ee5e3b6b59 Mon Sep 17 00:00:00 2001 From: Joost Lekkerkerker Date: Fri, 12 Dec 2025 15:30:06 +0100 Subject: [PATCH 2/2] Update homeassistant/components/switchbot_cloud/binary_sensor.py --- homeassistant/components/switchbot_cloud/binary_sensor.py | 1 - 1 file changed, 1 deletion(-) diff --git a/homeassistant/components/switchbot_cloud/binary_sensor.py b/homeassistant/components/switchbot_cloud/binary_sensor.py index 8d15504130ba2..316badc42f736 100644 --- a/homeassistant/components/switchbot_cloud/binary_sensor.py +++ b/homeassistant/components/switchbot_cloud/binary_sensor.py @@ -160,4 +160,3 @@ def _set_attributes(self) -> None: self.coordinator.data.get(self.entity_description.key) == self.entity_description.on_value ) - return