Skip to content
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

Remove auto from the fan speed modes for VeSync #40559

Merged
merged 5 commits into from
Sep 25, 2020
Merged
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
16 changes: 6 additions & 10 deletions homeassistant/components/vesync/fan.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
"LV-PUR131S": "fan",
}

SPEED_AUTO = "auto"
FAN_SPEEDS = [SPEED_AUTO, SPEED_OFF, SPEED_LOW, SPEED_MEDIUM, SPEED_HIGH]
FAN_SPEEDS = [SPEED_OFF, SPEED_LOW, SPEED_MEDIUM, SPEED_HIGH]
FAN_MODE_AUTO = "auto"


async def async_setup_entry(hass, config_entry, async_add_entities):
Expand All @@ -36,7 +36,6 @@ async def async_discover(devices):
hass.data[DOMAIN][VS_DISPATCHERS].append(disp)

_async_setup_entities(hass.data[DOMAIN][VS_FANS], async_add_entities)
return True


@callback
Expand Down Expand Up @@ -71,8 +70,8 @@ def supported_features(self):
@property
def speed(self):
"""Return the current speed."""
if self.smartfan.mode == SPEED_AUTO:
return SPEED_AUTO
if self.smartfan.mode == FAN_MODE_AUTO:
return None
if self.smartfan.mode == "manual":
current_level = self.smartfan.fan_level
if current_level is not None:
Expand Down Expand Up @@ -105,11 +104,8 @@ def set_speed(self, speed):
if not self.smartfan.is_on:
self.smartfan.turn_on()
MartinHjelmare marked this conversation as resolved.
Show resolved Hide resolved

if speed is None or speed == SPEED_AUTO:
self.smartfan.auto_mode()
else:
self.smartfan.manual_mode()
self.smartfan.change_fan_speed(FAN_SPEEDS.index(speed))
self.smartfan.manual_mode()
self.smartfan.change_fan_speed(FAN_SPEEDS.index(speed))

def turn_on(self, speed: str = None, **kwargs) -> None:
"""Turn the device on."""
Expand Down