8000 Fix fan AC mode in SmartThings AC by joostlek · Pull Request #145064 · home-assistant/core · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix fan AC mode in SmartThings AC #145064

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8000
17 changes: 10 additions & 7 deletions homeassistant/components/smartthings/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
"heat": HVACMode.HEAT,
"heatClean": HVACMode.HEAT,
"fanOnly": HVACMode.FAN_ONLY,
"fan": HVACMode.FAN_ONLY,
"wind": HVACMode.FAN_ONLY,
}
STATE_TO_AC_MODE = {
Expand All @@ -88,6 +89,7 @@
}

WIND = "wind"
FAN = "fan"
WINDFREE = "windFree"


Expand Down Expand Up @@ -387,14 +389,15 @@ async def async_set_hvac_mode(self, hvac_mode: HVACMode) -> None:
tasks.append(self.async_turn_on())

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 new hvac_mode is HVAC_MODE_FAN_ONLY and AirConditioner support "wind" or "fan" mode the AirConditioner
# new mode has to be "wind" or "fan"
if hvac_mode == HVACMode.FAN_ONLY:
if WIND in self.get_attribute_value(
Capability.AIR_CONDITIONER_MODE, Attribute.SUPPORTED_AC_MODES
):
mode = WIND
for fan_mode in (WIND, FAN):
if fan_mode in self.get_attribute_value(
Capability.AIR_CONDITIONER_MODE, Attribute.SUPPORTED_AC_MODES
):
mode = fan_mode
break

tasks.append(
self.execute_device_command(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"timestamp": "2025-02-09T14:35:56.800Z"
},
"supportedAcModes": {
"value": ["auto", "cool", "dry", "wind", "heat", "dryClean"],
"value": ["auto", "cool", "dry", "fan", "heat", "dryClean"],
"timestamp": "2025-02-09T15:42:13.444Z"
},
"airConditionerMode": {
Expand Down
8 changes: 5 additions & 3 deletions tests/components/smartthings/test_climate.py
6BEC
Original file line number Diff line number Diff line change
Expand Up @@ -196,17 +196,19 @@ async def test_ac_set_hvac_mode_turns_on(


@pytest.mark.parametrize("device_fixture", ["da_ac_rac_000001"])
async def test_ac_set_hvac_mode_wind(
@pytest.mark.parametrize("mode", ["fan", "wind"])
async def test_ac_set_hvac_mode_fan(
hass: HomeAssistant,
devices: AsyncMock,
mock_config_entry: MockConfigEntry,
mode: str,
) -> None:
"""Test setting AC HVAC mode to wind if the device supports it."""
set_attribute_value(
devices,
Capability.AIR_CONDITIONER_MODE,
Attribute.SUPPORTED_AC_MODES,
["auto", "cool", "dry", "heat", "wind"],
["auto", "cool", "dry", "heat", mode],
)
set_attribute_value(devices, Capability.SWITCH, Attribute.SWITCH, "on")

Expand All @@ -223,7 +225,7 @@ async def test_ac_set_hvac_mode_wind(
Capability.AIR_CONDITIONER_MODE,
Command.SET_AIR_CONDITIONER_MODE,
MAIN,
argument="wind",
argument=mode,
)


Expand Down
0