diff --git a/homeassistant/components/smartthings/icons.json b/homeassistant/components/smartthings/icons.json index f0c688b2ddc..15526dc7d88 100644 --- a/homeassistant/components/smartthings/icons.json +++ b/homeassistant/components/smartthings/icons.json @@ -59,6 +59,9 @@ }, "flexible_detergent_amount": { "default": "mdi:car-coolant-level" + }, + "spin_level": { + "default": "mdi:rotate-right" } }, "sensor": { diff --git a/homeassistant/components/smartthings/select.py b/homeassistant/components/smartthings/select.py index 39a49da2bbe..b5fb27610c2 100644 --- a/homeassistant/components/smartthings/select.py +++ b/homeassistant/components/smartthings/select.py @@ -20,6 +20,26 @@ LAMP_TO_HA = { "extraHigh": "extra_high", } +WASHER_SPIN_LEVEL_TO_HA = { + "none": "none", + "rinseHold": "rinse_hold", + "noSpin": "no_spin", + "low": "low", + "extraLow": "extra_low", + "delicate": "delicate", + "medium": "medium", + "high": "high", + "extraHigh": "extra_high", + "200": "200", + "400": "400", + "600": "600", + "800": "800", + "1000": "1000", + "1200": "1200", + "1400": "1400", + "1600": "1600", +} + @dataclass(frozen=True, kw_only=True) class SmartThingsSelectDescription(SelectEntityDescription): @@ -93,6 +113,15 @@ CAPABILITIES_TO_SELECT: dict[Capability | str, SmartThingsSelectDescription] = { extra_components=["hood"], capability_ignore_list=[Capability.SAMSUNG_CE_CONNECTION_STATE], ), + Capability.CUSTOM_WASHER_SPIN_LEVEL: SmartThingsSelectDescription( + key=Capability.CUSTOM_WASHER_SPIN_LEVEL, + translation_key="spin_level", + options_attribute=Attribute.SUPPORTED_WASHER_SPIN_LEVEL, + status_attribute=Attribute.WASHER_SPIN_LEVEL, + command=Command.SET_WASHER_SPIN_LEVEL, + options_map=WASHER_SPIN_LEVEL_TO_HA, + entity_category=EntityCategory.CONFIG, + ), } diff --git a/homeassistant/components/smartthings/strings.json b/homeassistant/components/smartthings/strings.json index 607583c8941..2ce72dc0c95 100644 --- a/homeassistant/components/smartthings/strings.json +++ b/homeassistant/components/smartthings/strings.json @@ -160,6 +160,28 @@ "extra": "[%key:component::smartthings::entity::select::detergent_amount::state::extra%]", "custom": "[%key:component::smartthings::entity::select::detergent_amount::state::custom%]" } + }, + "spin_level": { + "name": "Spin level", + "state": { + "none": "None", + "rinse_hold": "Rinse hold", + "no_spin": "No spin", + "low": "[%key:common::state::low%]", + "extra_low": "Extra low", + "delicate": "Delicate", + "medium": "[%key:common::state::medium%]", + "high": "[%key:common::state::high%]", + "extra_high": "Extra high", + "200": "200", + "400": "400", + "600": "600", + "800": "800", + "1000": "1000", + "1200": "1200", + "1400": "1400", + "1600": "1600" + } } }, "sensor": { diff --git a/tests/components/smartthings/snapshots/test_select.ambr b/tests/components/smartthings/snapshots/test_select.ambr index c1093bbd209..58a206f109c 100644 --- a/tests/components/smartthings/snapshots/test_select.ambr +++ b/tests/components/smartthings/snapshots/test_select.ambr @@ -459,6 +459,70 @@ 'state': 'stop', }) # --- +# name: test_all_entities[da_wm_wm_000001][select.washer_spin_level-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': dict({ + 'options': list([ + 'rinse_hold', + 'no_spin', + 'low', + 'medium', + 'high', + 'extra_high', + ]), + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'select', + 'entity_category': , + 'entity_id': 'select.washer_spin_level', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': 'Spin level', + 'platform': 'smartthings', + 'previous_unique_id': None, + 'supported_features': 0, + 'translation_key': 'spin_level', + 'unique_id': 'f984b91d-f250-9d42-3436-33f09a422a47_main_custom.washerSpinLevel_washerSpinLevel_washerSpinLevel', + 'unit_of_measurement': None, + }) +# --- +# name: test_all_entities[da_wm_wm_000001][select.washer_spin_level-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'friendly_name': 'Washer Spin level', + 'options': list([ + 'rinse_hold', + 'no_spin', + 'low', + 'medium', + 'high', + 'extra_high', + ]), + }), + 'context': , + 'entity_id': 'select.washer_spin_level', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'high', + }) +# --- # name: test_all_entities[da_wm_wm_000001_1][select.washing_machine-entry] EntityRegistryEntrySnapshot({ 'aliases': set({ @@ -517,6 +581,72 @@ 'state': 'run', }) # --- +# name: test_all_entities[da_wm_wm_000001_1][select.washing_machine_spin_level-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': dict({ + 'options': list([ + 'rinse_hold', + 'no_spin', + '400', + '800', + '1000', + '1200', + '1400', + ]), + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'select', + 'entity_category': , + 'entity_id': 'select.washing_machine_spin_level', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': 'Spin level', + 'platform': 'smartthings', + 'previous_unique_id': None, + 'supported_features': 0, + 'translation_key': 'spin_level', + 'unique_id': '63803fae-cbed-f356-a063-2cf148ae3ca7_main_custom.washerSpinLevel_washerSpinLevel_washerSpinLevel', + 'unit_of_measurement': None, + }) +# --- +# name: test_all_entities[da_wm_wm_000001_1][select.washing_machine_spin_level-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'friendly_name': 'Washing Machine Spin level', + 'options': list([ + 'rinse_hold', + 'no_spin', + '400', + '800', + '1000', + '1200', + '1400', + ]), + }), + 'context': , + 'entity_id': 'select.washing_machine_spin_level', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': '1400', + }) +# --- # name: test_all_entities[da_wm_wm_01011][select.machine_a_laver-entry] EntityRegistryEntrySnapshot({ 'aliases': set({ @@ -695,6 +825,72 @@ 'state': 'standard', }) # --- +# name: test_all_entities[da_wm_wm_01011][select.machine_a_laver_spin_level-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': dict({ + 'options': list([ + 'rinse_hold', + 'no_spin', + '400', + '800', + '1000', + '1200', + '1400', + ]), + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'select', + 'entity_category': , + 'entity_id': 'select.machine_a_laver_spin_level', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': 'Spin level', + 'platform': 'smartthings', + 'previous_unique_id': None, + 'supported_features': 0, + 'translation_key': 'spin_level', + 'unique_id': 'b854ca5f-dc54-140d-6349-758b4d973c41_main_custom.washerSpinLevel_washerSpinLevel_washerSpinLevel', + 'unit_of_measurement': None, + }) +# --- +# name: test_all_entities[da_wm_wm_01011][select.machine_a_laver_spin_level-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'friendly_name': 'Machine à Laver Spin level', + 'options': list([ + 'rinse_hold', + 'no_spin', + '400', + '800', + '1000', + '1200', + '1400', + ]), + }), + 'context': , + 'entity_id': 'select.machine_a_laver_spin_level', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': '1000', + }) +# --- # name: test_all_entities[da_wm_wm_100001][select.washer-entry] EntityRegistryEntrySnapshot({ 'aliases': set({