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

Proper fan mode handling (Dyson Poor Cool Link) #18

Merged
merged 4 commits into from
Apr 1, 2024
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
14 changes: 12 additions & 2 deletions libdyson/dyson_pure_cool_link.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
class DysonPureCoolLink(DysonFanDevice):
"""Dyson Pure Cool Link device."""

def __init__(self, serial: str, credential: str, device_type: str):
super().__init__(serial, credential, device_type)
self.preset_mode = "FAN"

@property
def fan_mode(self) -> str:
"""Return the fan mode of the fan."""
Expand All @@ -20,7 +24,11 @@ def is_on(self) -> bool:
@property
def auto_mode(self) -> bool:
"""Return auto mode status."""
return self.fan_mode == "AUTO"
if not self.is_on:
return self.preset_mode == "AUTO"
else:
self.preset_mode = self.fan_mode
return self.preset_mode == "AUTO"

@property
def oscillation(self) -> bool:
Expand Down Expand Up @@ -49,7 +57,7 @@ def volatile_organic_compounds(self) -> int:

def turn_on(self) -> None:
"""Turn on the device."""
self._set_configuration(fmod="FAN")
self._set_configuration(fmod=self.preset_mode)
Silther marked this conversation as resolved.
Show resolved Hide resolved

def turn_off(self) -> None:
"""Turn off the device."""
Expand All @@ -60,10 +68,12 @@ def _set_speed(self, speed: int) -> None:

def enable_auto_mode(self) -> None:
"""Turn on auto mode."""
self.preset_mode = "AUTO"
self._set_configuration(fmod="AUTO")

def disable_auto_mode(self) -> None:
"""Turn off auto mode."""
self.preset_mode = "FAN"
self._set_configuration(fmod="FAN")

def enable_oscillation(self) -> None:
Expand Down
Loading