From 0891d814fa71bcfe88525dd7c62441e8a85bd982 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20S=C3=A1nchez=20L=C3=B3pez?= <77412126+ChayoteJarocho@users.noreply.github.com> Date: Tue, 17 Mar 2026 14:42:20 -0600 Subject: [PATCH] Add sensor support for Tuya WG2 alarm panel (Duosmart C30) (#165834) --- homeassistant/components/tuya/sensor.py | 1 + .../tuya/snapshots/test_sensor.ambr | 55 +++++++++++++++++++ 2 files changed, 56 insertions(+) diff --git a/homeassistant/components/tuya/sensor.py b/homeassistant/components/tuya/sensor.py index a3b756c5150..c391b4de824 100644 --- a/homeassistant/components/tuya/sensor.py +++ b/homeassistant/components/tuya/sensor.py @@ -1233,6 +1233,7 @@ SENSORS: dict[DeviceCategory, tuple[TuyaSensorEntityDescription, ...]] = { ), *BATTERY_SENSORS, ), + DeviceCategory.WG2: (*BATTERY_SENSORS,), DeviceCategory.WK: (*BATTERY_SENSORS,), DeviceCategory.WKCZ: ( TuyaSensorEntityDescription( diff --git a/tests/components/tuya/snapshots/test_sensor.ambr b/tests/components/tuya/snapshots/test_sensor.ambr index 126e7989ce4..f11ece5895f 100644 --- a/tests/components/tuya/snapshots/test_sensor.ambr +++ b/tests/components/tuya/snapshots/test_sensor.ambr @@ -3944,6 +3944,61 @@ 'state': '0.0', }) # --- +# name: test_platform_setup_and_discovery[sensor.c30_battery-entry] + EntityRegistryEntrySnapshot({ + 'aliases': list([ + None, + ]), + 'area_id': None, + 'capabilities': dict({ + 'state_class': , + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'sensor', + 'entity_category': , + 'entity_id': 'sensor.c30_battery', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Battery', + 'options': dict({ + }), + 'original_device_class': , + 'original_icon': None, + 'original_name': 'Battery', + 'platform': 'tuya', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': 'battery', + 'unique_id': 'tuya.rirsc4vhpbv2whkp2gwbattery_percentage', + 'unit_of_measurement': '%', + }) +# --- +# name: test_platform_setup_and_discovery[sensor.c30_battery-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'device_class': 'battery', + 'friendly_name': 'C30 Battery', + 'state_class': , + 'unit_of_measurement': '%', + }), + 'context': , + 'entity_id': 'sensor.c30_battery', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': '85.0', + }) +# --- # name: test_platform_setup_and_discovery[sensor.c9_battery-entry] EntityRegistryEntrySnapshot({ 'aliases': list([