Add preset mode to SmartThings climate (#142180)

* Add preset mode to SmartThings climate

* Add preset mode to SmartThings climate
This commit is contained in:
Joost Lekkerkerker 2025-04-03 20:12:24 +02:00 committed by Franck Nijhof
parent 4643fc2c14
commit 2a4996055a
No known key found for this signature in database
GPG Key ID: D62583BA8AB11CA3
4 changed files with 15 additions and 4 deletions

View File

@ -333,7 +333,6 @@ class SmartThingsAirConditioner(SmartThingsEntity, ClimateEntity):
"""Define a SmartThings Air Conditioner."""
_attr_name = None
_attr_preset_mode = None
def __init__(self, client: SmartThings, device: FullDevice) -> None:
"""Init the class."""
@ -545,6 +544,18 @@ class SmartThingsAirConditioner(SmartThingsEntity, ClimateEntity):
SWING_OFF,
)
@property
def preset_mode(self) -> str | None:
"""Return the preset mode."""
if self.supports_capability(Capability.CUSTOM_AIR_CONDITIONER_OPTIONAL_MODE):
mode = self.get_attribute_value(
Capability.CUSTOM_AIR_CONDITIONER_OPTIONAL_MODE,
Attribute.AC_OPTIONAL_MODE,
)
if mode == WINDFREE:
return WINDFREE
return None
def _determine_preset_modes(self) -> list[str] | None:
"""Return a list of available preset modes."""
if self.supports_capability(Capability.CUSTOM_AIR_CONDITIONER_OPTIONAL_MODE):

View File

@ -473,7 +473,7 @@
"timestamp": "2024-09-10T10:26:28.781Z"
},
"acOptionalMode": {
"value": "off",
"value": "windFree",
"timestamp": "2025-02-09T09:14:39.642Z"
}
},

View File

@ -211,7 +211,7 @@
]),
'max_temp': 35,
'min_temp': 7,
'preset_mode': None,
'preset_mode': 'windFree',
'preset_modes': list([
'windFree',
]),

View File

@ -1065,7 +1065,7 @@
'custom.airConditionerOptionalMode': dict({
'acOptionalMode': dict({
'timestamp': '2025-02-09T09:14:39.642Z',
'value': 'off',
'value': 'windFree',
}),
'supportedAcOptionalMode': dict({
'timestamp': '2024-09-10T10:26:28.781Z',