Correct Dyson climate fan auto mode (#44569)

Co-authored-by: Justin Gauthier <justin@justin-tech.com>
pull/44742/head
Sian 2021-01-02 01:36:36 +10:30 committed by GitHub
parent 176415b045
commit 52e1aad008
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 4 deletions

View File

@ -2,6 +2,7 @@
import logging
from libpurecool.const import (
AutoMode,
FanPower,
FanSpeed,
FanState,
@ -333,7 +334,10 @@ class DysonPureHotCoolEntity(ClimateEntity):
@property
def fan_mode(self):
"""Return the fan setting."""
if self._device.state.fan_state == FanState.FAN_OFF.value:
if (
self._device.state.auto_mode != AutoMode.AUTO_ON.value
and self._device.state.fan_state == FanState.FAN_OFF.value
):
return FAN_OFF
return SPEED_MAP[self._device.state.speed]
@ -368,7 +372,7 @@ class DysonPureHotCoolEntity(ClimateEntity):
elif fan_mode == FAN_HIGH:
self._device.set_fan_speed(FanSpeed.FAN_SPEED_10)
elif fan_mode == FAN_AUTO:
self._device.set_fan_speed(FanSpeed.FAN_SPEED_AUTO)
self._device.enable_auto_mode()
def set_hvac_mode(self, hvac_mode):
"""Set new target hvac mode."""

View File

@ -677,8 +677,7 @@ async def test_purehotcool_set_fan_mode(devices, login, hass):
{ATTR_ENTITY_ID: "climate.living_room", ATTR_FAN_MODE: FAN_AUTO},
True,
)
assert device.set_fan_speed.call_count == 4
device.set_fan_speed.assert_called_with(FanSpeed.FAN_SPEED_AUTO)
assert device.enable_auto_mode.call_count == 1
@patch("homeassistant.components.dyson.DysonAccount.login", return_value=True)