diff --git a/homeassistant/components/switcher_kis/climate.py b/homeassistant/components/switcher_kis/climate.py index 75ce386bd39..99b9208e4ad 100644 --- a/homeassistant/components/switcher_kis/climate.py +++ b/homeassistant/components/switcher_kis/climate.py @@ -196,7 +196,7 @@ class SwitcherClimateEntity( if not self._remote.modes_features[self.coordinator.data.mode]["fan_levels"]: raise HomeAssistantError("Current mode doesn't support setting Fan Mode") - await self._async_control_breeze_device(fan_mode=HA_TO_DEVICE_FAN[fan_mode]) + await self._async_control_breeze_device(fan_level=HA_TO_DEVICE_FAN[fan_mode]) async def async_set_hvac_mode(self, hvac_mode: HVACMode) -> None: """Set new target operation mode.""" @@ -213,6 +213,6 @@ class SwitcherClimateEntity( raise HomeAssistantError("Current mode doesn't support setting Swing Mode") if swing_mode == SWING_VERTICAL: - await self._async_control_breeze_device(swing_mode=ThermostatSwing.ON) + await self._async_control_breeze_device(swing=ThermostatSwing.ON) else: - await self._async_control_breeze_device(swing_mode=ThermostatSwing.OFF) + await self._async_control_breeze_device(swing=ThermostatSwing.OFF) diff --git a/tests/components/switcher_kis/test_climate.py b/tests/components/switcher_kis/test_climate.py index 212ab88746b..56fbbe61ef9 100644 --- a/tests/components/switcher_kis/test_climate.py +++ b/tests/components/switcher_kis/test_climate.py @@ -1,5 +1,5 @@ """Test the Switcher climate platform.""" -from unittest.mock import patch +from unittest.mock import ANY, patch from aioswitcher.api import SwitcherBaseResponse from aioswitcher.device import ( @@ -59,7 +59,9 @@ async def test_climate_hvac_mode(hass, mock_bridge, mock_api, monkeypatch): await hass.async_block_till_done() assert mock_api.call_count == 2 - mock_control_device.assert_called_once() + mock_control_device.assert_called_once_with( + ANY, state=DeviceState.ON, mode=ThermostatMode.HEAT + ) state = hass.states.get(ENTITY_ID) assert state.state == HVACMode.HEAT @@ -79,7 +81,7 @@ async def test_climate_hvac_mode(hass, mock_bridge, mock_api, monkeypatch): await hass.async_block_till_done() assert mock_api.call_count == 4 - mock_control_device.assert_called_once() + mock_control_device.assert_called_once_with(ANY, state=DeviceState.OFF) state = hass.states.get(ENTITY_ID) assert state.state == HVACMode.OFF @@ -110,7 +112,7 @@ async def test_climate_temperature(hass, mock_bridge, mock_api, monkeypatch): await hass.async_block_till_done() assert mock_api.call_count == 2 - mock_control_device.assert_called_once() + mock_control_device.assert_called_once_with(ANY, target_temp=22) state = hass.states.get(ENTITY_ID) assert state.attributes["temperature"] == 22 @@ -160,7 +162,9 @@ async def test_climate_fan_level(hass, mock_bridge, mock_api, monkeypatch): await hass.async_block_till_done() assert mock_api.call_count == 2 - mock_control_device.assert_called_once() + mock_control_device.assert_called_once_with( + ANY, fan_level=ThermostatFanLevel.HIGH + ) state = hass.states.get(ENTITY_ID) assert state.attributes["fan_mode"] == "high" @@ -194,7 +198,7 @@ async def test_climate_swing(hass, mock_bridge, mock_api, monkeypatch): await hass.async_block_till_done() assert mock_api.call_count == 2 - mock_control_device.assert_called_once() + mock_control_device.assert_called_once_with(ANY, swing=ThermostatSwing.ON) state = hass.states.get(ENTITY_ID) assert state.attributes["swing_mode"] == "vertical" @@ -214,7 +218,7 @@ async def test_climate_swing(hass, mock_bridge, mock_api, monkeypatch): await hass.async_block_till_done() assert mock_api.call_count == 4 - mock_control_device.assert_called_once() + mock_control_device.assert_called_once_with(ANY, swing=ThermostatSwing.OFF) state = hass.states.get(ENTITY_ID) assert state.attributes["swing_mode"] == "off" @@ -243,7 +247,9 @@ async def test_control_device_fail(hass, mock_bridge, mock_api, monkeypatch): ) assert mock_api.call_count == 2 - mock_control_device.assert_called_once() + mock_control_device.assert_called_once_with( + ANY, state=DeviceState.ON, mode=ThermostatMode.HEAT + ) state = hass.states.get(ENTITY_ID) assert state.state == STATE_UNAVAILABLE @@ -268,7 +274,9 @@ async def test_control_device_fail(hass, mock_bridge, mock_api, monkeypatch): ) assert mock_api.call_count == 4 - mock_control_device.assert_called_once() + mock_control_device.assert_called_once_with( + ANY, state=DeviceState.ON, mode=ThermostatMode.HEAT + ) state = hass.states.get(ENTITY_ID) assert state.state == STATE_UNAVAILABLE