From a41d373958b4a9b270a007e2ae2eb7724d5958f9 Mon Sep 17 00:00:00 2001 From: Silther Date: Wed, 8 Nov 2023 15:05:28 +0100 Subject: [PATCH 1/4] Maybe proper fan mode handling --- libdyson/dyson_device.py | 1 + libdyson/dyson_pure_cool_link.py | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/libdyson/dyson_device.py b/libdyson/dyson_device.py index 8a3407f..68fbb3a 100644 --- a/libdyson/dyson_device.py +++ b/libdyson/dyson_device.py @@ -34,6 +34,7 @@ def __init__(self, serial: str, credential: str): self._serial = serial self._credential = credential self._mqtt_client = None + self.preset_mode = None self._connected = threading.Event() self._disconnected = threading.Event() self._status = None diff --git a/libdyson/dyson_pure_cool_link.py b/libdyson/dyson_pure_cool_link.py index ecf78e4..777a0fe 100644 --- a/libdyson/dyson_pure_cool_link.py +++ b/libdyson/dyson_pure_cool_link.py @@ -20,7 +20,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.fan_mode == "AUTO" @property def oscillation(self) -> bool: @@ -60,10 +64,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: From 538c6199c096241ecb742f1349bcab28b87868a5 Mon Sep 17 00:00:00 2001 From: Silther Date: Wed, 8 Nov 2023 15:18:33 +0100 Subject: [PATCH 2/4] set the correct fan mode after powering on --- libdyson/dyson_pure_cool_link.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libdyson/dyson_pure_cool_link.py b/libdyson/dyson_pure_cool_link.py index 777a0fe..3c40808 100644 --- a/libdyson/dyson_pure_cool_link.py +++ b/libdyson/dyson_pure_cool_link.py @@ -53,7 +53,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) def turn_off(self) -> None: """Turn off the device.""" From 2206b53d91feb77d0f321f05a2e408389e5fafae Mon Sep 17 00:00:00 2001 From: Silther Date: Thu, 9 Nov 2023 22:20:00 +0100 Subject: [PATCH 3/4] move preset_mode from Dyson Device to Dyson pure Cool Link --- libdyson/dyson_device.py | 1 - libdyson/dyson_pure_cool_link.py | 4 ++++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/libdyson/dyson_device.py b/libdyson/dyson_device.py index 68fbb3a..8a3407f 100644 --- a/libdyson/dyson_device.py +++ b/libdyson/dyson_device.py @@ -34,7 +34,6 @@ def __init__(self, serial: str, credential: str): self._serial = serial self._credential = credential self._mqtt_client = None - self.preset_mode = None self._connected = threading.Event() self._disconnected = threading.Event() self._status = None diff --git a/libdyson/dyson_pure_cool_link.py b/libdyson/dyson_pure_cool_link.py index 3c40808..09f8e5d 100644 --- a/libdyson/dyson_pure_cool_link.py +++ b/libdyson/dyson_pure_cool_link.py @@ -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.""" From 9f8a2da0b3404a22b0b0d8811ed4427b5d540eef Mon Sep 17 00:00:00 2001 From: "Silther (xIUPITERx)" <97352673+Silther@users.noreply.github.com> Date: Sun, 7 Jan 2024 21:21:00 +0100 Subject: [PATCH 4/4] Update dyson_pure_cool_link.py --- libdyson/dyson_pure_cool_link.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libdyson/dyson_pure_cool_link.py b/libdyson/dyson_pure_cool_link.py index 09f8e5d..95a3bdf 100644 --- a/libdyson/dyson_pure_cool_link.py +++ b/libdyson/dyson_pure_cool_link.py @@ -28,7 +28,7 @@ def auto_mode(self) -> bool: return self.preset_mode == "AUTO" else: self.preset_mode = self.fan_mode - return self.fan_mode == "AUTO" + return self.preset_mode == "AUTO" @property def oscillation(self) -> bool: