Add SmartThings capability for Washer spin level (#145039)

This commit is contained in:
Joost Lekkerkerker 2025-05-21 20:01:12 +02:00 committed by GitHub
parent 3df993b9a4
commit c8ceea4be8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 250 additions and 0 deletions

View File

@ -59,6 +59,9 @@
},
"flexible_detergent_amount": {
"default": "mdi:car-coolant-level"
},
"spin_level": {
"default": "mdi:rotate-right"
}
},
"sensor": {

View File

@ -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,
),
}

View File

@ -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": {

View File

@ -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': <ANY>,
'config_subentry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'select',
'entity_category': <EntityCategory.CONFIG: 'config'>,
'entity_id': 'select.washer_spin_level',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'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': <ANY>,
'entity_id': 'select.washer_spin_level',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'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': <ANY>,
'config_subentry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'select',
'entity_category': <EntityCategory.CONFIG: 'config'>,
'entity_id': 'select.washing_machine_spin_level',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'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': <ANY>,
'entity_id': 'select.washing_machine_spin_level',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'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': <ANY>,
'config_subentry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'select',
'entity_category': <EntityCategory.CONFIG: 'config'>,
'entity_id': 'select.machine_a_laver_spin_level',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'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': <ANY>,
'entity_id': 'select.machine_a_laver_spin_level',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': '1000',
})
# ---
# name: test_all_entities[da_wm_wm_100001][select.washer-entry]
EntityRegistryEntrySnapshot({
'aliases': set({