Skip to content

Commit 265a2ac

Browse files
authored
Add Bubble soak switch to SmartThings (#141139)
* Add Bubble soak switch to SmartThings * Fix
1 parent 1ae2ceb commit 265a2ac

File tree

4 files changed

+74
-0
lines changed

4 files changed

+74
-0
lines changed

homeassistant/components/smartthings/icons.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@
3434
}
3535
},
3636
"switch": {
37+
"bubble_soak": {
38+
"default": "mdi:water-off",
39+
"state": {
40+
"on": "mdi:water"
41+
}
42+
},
3743
"wrinkle_prevent": {
3844
"default": "mdi:tumble-dryer",
3945
"state": {

homeassistant/components/smartthings/strings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,9 @@
458458
}
459459
},
460460
"switch": {
461+
"bubble_soak": {
462+
"name": "Bubble Soak"
463+
},
461464
"wrinkle_prevent": {
462465
"name": "Wrinkle prevent"
463466
}

homeassistant/components/smartthings/switch.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,13 @@ class SmartThingsCommandSwitchEntityDescription(SmartThingsSwitchEntityDescripti
5959
command=Command.SET_DRYER_WRINKLE_PREVENT,
6060
)
6161
}
62+
CAPABILITY_TO_SWITCHES: dict[Capability | str, SmartThingsSwitchEntityDescription] = {
63+
Capability.SAMSUNG_CE_WASHER_BUBBLE_SOAK: SmartThingsSwitchEntityDescription(
64+
key=Capability.SAMSUNG_CE_WASHER_BUBBLE_SOAK,
65+
translation_key="bubble_soak",
66+
status_attribute=Attribute.STATUS,
67+
)
68+
}
6269

6370

6471
async def async_setup_entry(
@@ -86,6 +93,17 @@ async def async_setup_entry(
8693
for capability, description in CAPABILITY_TO_COMMAND_SWITCHES.items()
8794
if capability in device.status[MAIN]
8895
)
96+
entities.extend(
97+
SmartThingsSwitch(
98+
entry_data.client,
99+
device,
100+
description,
101+
Capability(capability),
102+
)
103+
for device in entry_data.devices.values()
104+
for capability, description in CAPABILITY_TO_SWITCHES.items()
105+
if capability in device.status[MAIN]
106+
)
89107
async_add_entities(entities)
90108

91109

tests/components/smartthings/snapshots/test_switch.ambr

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -516,6 +516,53 @@
516516
'state': 'on',
517517
})
518518
# ---
519+
# name: test_all_entities[da_wm_wm_000001_1][switch.washing_machine_bubble_soak-entry]
520+
EntityRegistryEntrySnapshot({
521+
'aliases': set({
522+
}),
523+
'area_id': None,
524+
'capabilities': None,
525+
'config_entry_id': <ANY>,
526+
'config_subentry_id': <ANY>,
527+
'device_class': None,
528+
'device_id': <ANY>,
529+
'disabled_by': None,
530+
'domain': 'switch',
531+
'entity_category': None,
532+
'entity_id': 'switch.washing_machine_bubble_soak',
533+
'has_entity_name': True,
534+
'hidden_by': None,
535+
'icon': None,
536+
'id': <ANY>,
537+
'labels': set({
538+
}),
539+
'name': None,
540+
'options': dict({
541+
}),
542+
'original_device_class': None,
543+
'original_icon': None,
544+
'original_name': 'Bubble Soak',
545+
'platform': 'smartthings',
546+
'previous_unique_id': None,
547+
'supported_features': 0,
548+
'translation_key': 'bubble_soak',
549+
'unique_id': '63803fae-cbed-f356-a063-2cf148ae3ca7_main_samsungce.washerBubbleSoak',
550+
'unit_of_measurement': None,
551+
})
552+
# ---
553+
# name: test_all_entities[da_wm_wm_000001_1][switch.washing_machine_bubble_soak-state]
554+
StateSnapshot({
555+
'attributes': ReadOnlyDict({
556+
'friendly_name': 'Washing Machine Bubble Soak',
557+
}),
558+
'context': <ANY>,
559+
'entity_id': 'switch.washing_machine_bubble_soak',
560+
'last_changed': <ANY>,
561+
'last_reported': <ANY>,
562+
'last_updated': <ANY>,
563+
'state': 'off',
564+
})
565+
# ---
519566
# name: test_all_entities[generic_ef00_v1][switch.thermostat_kuche-entry]
520567
EntityRegistryEntrySnapshot({
521568
'aliases': set({

0 commit comments

Comments
 (0)