From f7e5dc7637414d1e4e5221405907c866ecb02175 Mon Sep 17 00:00:00 2001 From: Samuel Xiao <40679757+XiaoLing-git@users.noreply.github.com> Date: Tue, 28 Oct 2025 14:33:21 +0800 Subject: [PATCH] Add Presence Sensor support to Switchbot Cloud (#155309) --- homeassistant/components/switchbot_cloud/__init__.py | 1 + homeassistant/components/switchbot_cloud/binary_sensor.py | 2 ++ homeassistant/components/switchbot_cloud/sensor.py | 1 + 3 files changed, 4 insertions(+) diff --git a/homeassistant/components/switchbot_cloud/__init__.py b/homeassistant/components/switchbot_cloud/__init__.py index 23247be935b..a23d45b62ff 100644 --- a/homeassistant/components/switchbot_cloud/__init__.py +++ b/homeassistant/components/switchbot_cloud/__init__.py @@ -205,6 +205,7 @@ async def make_device_data( if isinstance(device, Device) and device.device_type in [ "Motion Sensor", "Contact Sensor", + "Presence Sensor", ]: coordinator = await coordinator_for_device( hass, entry, api, device, coordinators_by_id, True diff --git a/homeassistant/components/switchbot_cloud/binary_sensor.py b/homeassistant/components/switchbot_cloud/binary_sensor.py index a9148076ae7..2a892206d8f 100644 --- a/homeassistant/components/switchbot_cloud/binary_sensor.py +++ b/homeassistant/components/switchbot_cloud/binary_sensor.py @@ -52,6 +52,7 @@ MOVE_DETECTED_DESCRIPTION = SwitchBotCloudBinarySensorEntityDescription( value_fn=( lambda data: data.get("moveDetected") is True or data.get("detectionState") == "DETECTED" + or data.get("detected") is True ), ) @@ -108,6 +109,7 @@ BINARY_SENSOR_DESCRIPTIONS_BY_DEVICE_TYPES = { IS_LIGHT_DESCRIPTION, MOVE_DETECTED_DESCRIPTION, ), + "Presence Sensor": (MOVE_DETECTED_DESCRIPTION,), } diff --git a/homeassistant/components/switchbot_cloud/sensor.py b/homeassistant/components/switchbot_cloud/sensor.py index 87f0db93030..5d5231e5c0a 100644 --- a/homeassistant/components/switchbot_cloud/sensor.py +++ b/homeassistant/components/switchbot_cloud/sensor.py @@ -180,6 +180,7 @@ SENSOR_DESCRIPTIONS_BY_DEVICE_TYPES = { HUMIDITY_DESCRIPTION, BATTERY_DESCRIPTION, ), + "Presence Sensor": (BATTERY_DESCRIPTION,), "Relay Switch 1PM": ( POWER_DESCRIPTION, VOLTAGE_DESCRIPTION,