Skip to content

Commit

Permalink
Use the latest version of libdyson with vis nav (#147)
Browse files Browse the repository at this point in the history
  • Loading branch information
dotvezz committed Apr 1, 2024
1 parent b509ccc commit e61637f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion custom_components/dyson_local/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
"import_executor": true,
"iot_class": "local_push",
"issue_tracker": "https://github.com/libdyson-wg/ha-dyson/issues",
"version": "1.4.0-rc1",
"version": "1.4.0-rc2",
"import_executor": true
}
1 change: 1 addition & 0 deletions custom_components/dyson_local/vendor/libdyson/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
DEVICE_TYPE_NAMES = {
DEVICE_TYPE_360_EYE: "360 Eye robot vacuum",
DEVICE_TYPE_360_HEURIST: "360 Heurist robot vacuum",
DEVICE_TYPE_360_VIS_NAV: "360 Vis Nav robot vacuum",
DEVICE_TYPE_PURE_COOL: "Pure Cool",
DEVICE_TYPE_PURIFIER_COOL_K: "Purifier Cool",
DEVICE_TYPE_PURIFIER_COOL_E: "Purifier Cool",
Expand Down
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)

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

0 comments on commit e61637f

Please sign in to comment.