From be6ddc314c19d96fedd148291a733554d13cf234 Mon Sep 17 00:00:00 2001 From: Joost Lekkerkerker Date: Sat, 28 Feb 2026 20:11:13 +0100 Subject: [PATCH] Add sound detection switch to SmartThings (#164470) --- .../components/smartthings/icons.json | 3 ++ .../components/smartthings/strings.json | 3 ++ .../components/smartthings/switch.py | 9 ++++ .../smartthings/snapshots/test_switch.ambr | 49 +++++++++++++++++++ 4 files changed, 64 insertions(+) diff --git a/homeassistant/components/smartthings/icons.json b/homeassistant/components/smartthings/icons.json index 29ccf6fd59e..848a545e7f9 100644 --- a/homeassistant/components/smartthings/icons.json +++ b/homeassistant/components/smartthings/icons.json @@ -219,6 +219,9 @@ "sanitizing_wash": { "default": "mdi:lotion" }, + "sound_detection": { + "default": "mdi:home-sound-in" + }, "sound_effect": { "default": "mdi:volume-high", "state": { diff --git a/homeassistant/components/smartthings/strings.json b/homeassistant/components/smartthings/strings.json index 1c00be4621e..140f42eb5b6 100644 --- a/homeassistant/components/smartthings/strings.json +++ b/homeassistant/components/smartthings/strings.json @@ -904,6 +904,9 @@ "sanitizing_wash": { "name": "Sanitizing wash" }, + "sound_detection": { + "name": "Sound detection" + }, "sound_effect": { "name": "Sound effect" }, diff --git a/homeassistant/components/smartthings/switch.py b/homeassistant/components/smartthings/switch.py index c0e66d285b7..7cdffadf795 100644 --- a/homeassistant/components/smartthings/switch.py +++ b/homeassistant/components/smartthings/switch.py @@ -170,6 +170,15 @@ CAPABILITY_TO_SWITCHES: dict[Capability | str, SmartThingsSwitchEntityDescriptio on_command=Command.DO_NOT_DISTURB_ON, off_command=Command.DO_NOT_DISTURB_OFF, ), + Capability.SOUND_DETECTION: SmartThingsSwitchEntityDescription( + key=Capability.SOUND_DETECTION, + translation_key="sound_detection", + status_attribute=Attribute.SOUND_DETECTION_STATE, + entity_category=EntityCategory.CONFIG, + on_key="enabled", + on_command=Command.ENABLE_SOUND_DETECTION, + off_command=Command.DISABLE_SOUND_DETECTION, + ), } DISHWASHER_WASHING_OPTIONS_TO_SWITCHES: dict[ Attribute | str, SmartThingsDishwasherWashingOptionSwitchEntityDescription diff --git a/tests/components/smartthings/snapshots/test_switch.ambr b/tests/components/smartthings/snapshots/test_switch.ambr index 5ca3a0505de..b99036e10d8 100644 --- a/tests/components/smartthings/snapshots/test_switch.ambr +++ b/tests/components/smartthings/snapshots/test_switch.ambr @@ -1028,6 +1028,55 @@ 'state': 'on', }) # --- +# name: test_all_entities[da_rvc_map_01011][switch.robot_vacuum_sound_detection-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': None, + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'switch', + 'entity_category': , + 'entity_id': 'switch.robot_vacuum_sound_detection', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Sound detection', + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': 'Sound detection', + 'platform': 'smartthings', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': 'sound_detection', + 'unique_id': '01b28624-5907-c8bc-0325-8ad23f03a637_main_soundDetection_soundDetectionState_soundDetectionState', + 'unit_of_measurement': None, + }) +# --- +# name: test_all_entities[da_rvc_map_01011][switch.robot_vacuum_sound_detection-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'friendly_name': 'Robot Vacuum Sound detection', + }), + 'context': , + 'entity_id': 'switch.robot_vacuum_sound_detection', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'off', + }) +# --- # name: test_all_entities[da_rvc_normal_000001][switch.robot_vacuum-entry] EntityRegistryEntrySnapshot({ 'aliases': set({