Skip to content

Commit 380fb61

Browse files
authored
Add preset mode to SmartThings climate (#142180)
* Add preset mode to SmartThings climate * Add preset mode to SmartThings climate
1 parent fefa2a9 commit 380fb61

File tree

4 files changed

+15
-4
lines changed

4 files changed

+15
-4
lines changed

homeassistant/components/smartthings/climate.py

+12-1
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,6 @@ class SmartThingsAirConditioner(SmartThingsEntity, ClimateEntity):
333333
"""Define a SmartThings Air Conditioner."""
334334

335335
_attr_name = None
336-
_attr_preset_mode = None
337336

338337
def __init__(self, client: SmartThings, device: FullDevice) -> None:
339338
"""Init the class."""
@@ -545,6 +544,18 @@ def swing_mode(self) -> str:
545544
SWING_OFF,
546545
)
547546

547+
@property
548+
def preset_mode(self) -> str | None:
549+
"""Return the preset mode."""
550+
if self.supports_capability(Capability.CUSTOM_AIR_CONDITIONER_OPTIONAL_MODE):
551+
mode = self.get_attribute_value(
552+
Capability.CUSTOM_AIR_CONDITIONER_OPTIONAL_MODE,
553+
Attribute.AC_OPTIONAL_MODE,
554+
)
555+
if mode == WINDFREE:
556+
return WINDFREE
557+
return None
558+
548559
def _determine_preset_modes(self) -> list[str] | None:
549560
"""Return a list of available preset modes."""
550561
if self.supports_capability(Capability.CUSTOM_AIR_CONDITIONER_OPTIONAL_MODE):

tests/components/smartthings/fixtures/device_status/da_ac_rac_000001.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@
473473
"timestamp": "2024-09-10T10:26:28.781Z"
474474
},
475475
"acOptionalMode": {
476-
"value": "off",
476+
"value": "windFree",
477477
"timestamp": "2025-02-09T09:14:39.642Z"
478478
}
479479
},

tests/components/smartthings/snapshots/test_climate.ambr

+1-1
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@
211211
]),
212212
'max_temp': 35,
213213
'min_temp': 7,
214-
'preset_mode': None,
214+
'preset_mode': 'windFree',
215215
'preset_modes': list([
216216
'windFree',
217217
]),

tests/components/smartthings/snapshots/test_diagnostics.ambr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1065,7 +1065,7 @@
10651065
'custom.airConditionerOptionalMode': dict({
10661066
'acOptionalMode': dict({
10671067
'timestamp': '2025-02-09T09:14:39.642Z',
1068-
'value': 'off',
1068+
'value': 'windFree',
10691069
}),
10701070
'supportedAcOptionalMode': dict({
10711071
'timestamp': '2024-09-10T10:26:28.781Z',

0 commit comments

Comments
 (0)