From 7ee9f0af2de9ddec673a7ef73dc25df781ddf4ca Mon Sep 17 00:00:00 2001 From: Joost Lekkerkerker Date: Thu, 8 May 2025 20:41:04 +0200 Subject: [PATCH] Add cooktop operating state to SmartThings (#144500) --- .../components/smartthings/icons.json | 11 ++ .../components/smartthings/sensor.py | 10 ++ .../components/smartthings/strings.json | 9 ++ .../smartthings/snapshots/test_sensor.ambr | 116 ++++++++++++++++++ 4 files changed, 146 insertions(+) diff --git a/homeassistant/components/smartthings/icons.json b/homeassistant/components/smartthings/icons.json index 3125bd65548..b6e33e1a142 100644 --- a/homeassistant/components/smartthings/icons.json +++ b/homeassistant/components/smartthings/icons.json @@ -48,6 +48,17 @@ "default": "mdi:car-coolant-level" } }, + "sensor": { + "cooktop_operating_state": { + "default": "mdi:stove", + "state": { + "ready": "mdi:play-speed", + "run": "mdi:play", + "paused": "mdi:pause", + "finished": "mdi:food-turkey" + } + } + }, "switch": { "bubble_soak": { "default": "mdi:water-off", diff --git a/homeassistant/components/smartthings/sensor.py b/homeassistant/components/smartthings/sensor.py index 2d6451fa279..3c32df271a9 100644 --- a/homeassistant/components/smartthings/sensor.py +++ b/homeassistant/components/smartthings/sensor.py @@ -265,6 +265,16 @@ CAPABILITY_TO_SENSORS: dict[ ) ] }, + Capability.CUSTOM_COOKTOP_OPERATING_STATE: { + Attribute.COOKTOP_OPERATING_STATE: [ + SmartThingsSensorEntityDescription( + key=Attribute.COOKTOP_OPERATING_STATE, + translation_key="cooktop_operating_state", + device_class=SensorDeviceClass.ENUM, + options_attribute=Attribute.SUPPORTED_COOKTOP_OPERATING_STATE, + ) + ] + }, Capability.DISHWASHER_OPERATING_STATE: { Attribute.MACHINE_STATE: [ SmartThingsSensorEntityDescription( diff --git a/homeassistant/components/smartthings/strings.json b/homeassistant/components/smartthings/strings.json index 81f4d34c8bb..828948910c2 100644 --- a/homeassistant/components/smartthings/strings.json +++ b/homeassistant/components/smartthings/strings.json @@ -172,6 +172,15 @@ "tested": "Tested" } }, + "cooktop_operating_state": { + "name": "Operating state", + "state": { + "ready": "[%key:component::smartthings::entity::sensor::oven_machine_state::state::ready%]", + "run": "[%key:component::smartthings::entity::sensor::dishwasher_machine_state::state::run%]", + "paused": "[%key:common::state::paused%]", + "finished": "[%key:component::smartthings::entity::sensor::oven_job_state::state::finished%]" + } + }, "dishwasher_machine_state": { "name": "Machine state", "state": { diff --git a/tests/components/smartthings/snapshots/test_sensor.ambr b/tests/components/smartthings/snapshots/test_sensor.ambr index ad073a1d670..8c631ed6983 100644 --- a/tests/components/smartthings/snapshots/test_sensor.ambr +++ b/tests/components/smartthings/snapshots/test_sensor.ambr @@ -2578,6 +2578,65 @@ 'state': '27', }) # --- +# name: test_all_entities[da_ks_cooktop_31001][sensor.induction_hob_operating_state-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': dict({ + 'options': list([ + 'ready', + 'run', + 'paused', + ]), + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'sensor', + 'entity_category': None, + 'entity_id': 'sensor.induction_hob_operating_state', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': , + 'original_icon': None, + 'original_name': 'Operating state', + 'platform': 'smartthings', + 'previous_unique_id': None, + 'supported_features': 0, + 'translation_key': 'cooktop_operating_state', + 'unique_id': '808dbd84-f357-47e2-a0cd-3b66fa22d584_main_custom.cooktopOperatingState_cooktopOperatingState_cooktopOperatingState', + 'unit_of_measurement': None, + }) +# --- +# name: test_all_entities[da_ks_cooktop_31001][sensor.induction_hob_operating_state-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'device_class': 'enum', + 'friendly_name': 'Induction Hob Operating state', + 'options': list([ + 'ready', + 'run', + 'paused', + ]), + }), + 'context': , + 'entity_id': 'sensor.induction_hob_operating_state', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'ready', + }) +# --- # name: test_all_entities[da_ks_microwave_0101x][sensor.microwave_completion_time-entry] EntityRegistryEntrySnapshot({ 'aliases': set({ @@ -3568,6 +3627,63 @@ 'state': 'running', }) # --- +# name: test_all_entities[da_ks_range_0101x][sensor.vulcan_operating_state-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': dict({ + 'options': list([ + 'run', + 'ready', + ]), + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'sensor', + 'entity_category': None, + 'entity_id': 'sensor.vulcan_operating_state', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': , + 'original_icon': None, + 'original_name': 'Operating state', + 'platform': 'smartthings', + 'previous_unique_id': None, + 'supported_features': 0, + 'translation_key': 'cooktop_operating_state', + 'unique_id': '2c3cbaa0-1899-5ddc-7b58-9d657bd48f18_main_custom.cooktopOperatingState_cooktopOperatingState_cooktopOperatingState', + 'unit_of_measurement': None, + }) +# --- +# name: test_all_entities[da_ks_range_0101x][sensor.vulcan_operating_state-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'device_class': 'enum', + 'friendly_name': 'Vulcan Operating state', + 'options': list([ + 'run', + 'ready', + ]), + }), + 'context': , + 'entity_id': 'sensor.vulcan_operating_state', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'ready', + }) +# --- # name: test_all_entities[da_ks_range_0101x][sensor.vulcan_oven_mode-entry] EntityRegistryEntrySnapshot({ 'aliases': set({