Samsung AC Wind Mode (#119750)

This commit is contained in:
Jan Čermák 2024-06-21 13:19:42 +02:00 committed by GitHub
parent f0452e9ba0
commit 4707108146
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 85 additions and 6 deletions

View file

@ -56,6 +56,7 @@ OPERATING_STATE_TO_ACTION = {
"pending cool": HVACAction.COOLING,
"pending heat": HVACAction.HEATING,
"vent economizer": HVACAction.FAN,
"wind": HVACAction.FAN,
}
AC_MODE_TO_STATE = {
@ -67,6 +68,7 @@ AC_MODE_TO_STATE = {
"heat": HVACMode.HEAT,
"heatClean": HVACMode.HEAT,
"fanOnly": HVACMode.FAN_ONLY,
"wind": HVACMode.FAN_ONLY,
}
STATE_TO_AC_MODE = {
HVACMode.HEAT_COOL: "auto",
@ -87,7 +89,7 @@ FAN_OSCILLATION_TO_SWING = {
value: key for key, value in SWING_TO_FAN_OSCILLATION.items()
}
WIND = "wind"
WINDFREE = "windFree"
UNIT_MAP = {"C": UnitOfTemperature.CELSIUS, "F": UnitOfTemperature.FAHRENHEIT}
@ -390,11 +392,17 @@ class SmartThingsAirConditioner(SmartThingsEntity, ClimateEntity):
# Turn on the device if it's off before setting mode.
if not self._device.status.switch:
tasks.append(self._device.switch_on(set_status=True))
tasks.append(
self._device.set_air_conditioner_mode(
STATE_TO_AC_MODE[hvac_mode], set_status=True
)
)
mode = STATE_TO_AC_MODE[hvac_mode]
# If new hvac_mode is HVAC_MODE_FAN_ONLY and AirConditioner support "wind" mode the AirConditioner new mode has to be "wind"
# The conversion make the mode change working
# The conversion is made only for device that wrongly has capability "wind" instead "fan_only"
if hvac_mode == HVACMode.FAN_ONLY:
supported_modes = self._device.status.supported_ac_modes
if WIND in supported_modes:
mode = WIND
tasks.append(self._device.set_air_conditioner_mode(mode, set_status=True))
await asyncio.gather(*tasks)
# State is set optimistically in the command above, therefore update
# the entity state ahead of receiving the confirming push updates