Skip to content

Commit

Permalink
Support Purifier Humidify+Cool Formaldehyde
Browse files Browse the repository at this point in the history
  • Loading branch information
vwt12eh8 committed Nov 28, 2021
1 parent e52f4da commit 5b5ff41
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
5 changes: 4 additions & 1 deletion libdyson/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
DEVICE_TYPE_PURE_HOT_COOL_NEW,
DEVICE_TYPE_PURE_HOT_COOL_LINK,
DEVICE_TYPE_PURE_HUMIDIFY_COOL,
DEVICE_TYPE_PURIFIER_HUMIDIFY_COOL_FORMALDEHYDE,
)
from .const import CleaningMode # noqa: F401
from .const import CleaningType # noqa: F401
Expand All @@ -33,7 +34,7 @@
from .dyson_pure_cool_link import DysonPureCoolLink
from .dyson_pure_hot_cool import DysonPureHotCool
from .dyson_pure_hot_cool_link import DysonPureHotCoolLink
from .dyson_pure_humidify_cool import DysonPureHumidifyCool
from .dyson_pure_humidify_cool import DysonPureHumidifyCool, DysonPurifierHumidifyCoolFormaldehyde
from .utils import get_mqtt_info_from_wifi_info # noqa: F401


Expand Down Expand Up @@ -64,4 +65,6 @@ def get_device(serial: str, credential: str, device_type: str) -> Optional[Dyson
return DysonPureHotCool(serial, credential, device_type)
if device_type == DEVICE_TYPE_PURE_HUMIDIFY_COOL:
return DysonPureHumidifyCool(serial, credential, device_type)
if device_type == DEVICE_TYPE_PURIFIER_HUMIDIFY_COOL_FORMALDEHYDE:
return DysonPurifierHumidifyCoolFormaldehyde(serial, credential, device_type)
return None
2 changes: 2 additions & 0 deletions libdyson/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
DEVICE_TYPE_PURE_COOL_FORMALDEHYDE = "438E"
DEVICE_TYPE_PURE_COOL_DESK = "520"
DEVICE_TYPE_PURE_HUMIDIFY_COOL = "358"
DEVICE_TYPE_PURIFIER_HUMIDIFY_COOL_FORMALDEHYDE = "358E"
DEVICE_TYPE_PURE_HOT_COOL_LINK = "455"
DEVICE_TYPE_PURE_HOT_COOL = "527"
DEVICE_TYPE_PURE_HOT_COOL_NEW = "527E"
Expand All @@ -25,6 +26,7 @@
DEVICE_TYPE_PURE_HOT_COOL_NEW: "Pure Hot+Cool (New)",
DEVICE_TYPE_PURE_HOT_COOL_LINK: "Pure Hot+Cool Link",
DEVICE_TYPE_PURE_HUMIDIFY_COOL: "Pure Humidify+Cool",
DEVICE_TYPE_PURIFIER_HUMIDIFY_COOL_FORMALDEHYDE: "Purifier Humidify+Cool Formaldehyde",
}

ENVIRONMENTAL_OFF = -1
Expand Down
9 changes: 9 additions & 0 deletions libdyson/dyson_pure_humidify_cool.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,12 @@ def set_target_humidity(self, target_humidity: int) -> None:
def set_water_hardness(self, water_hardness: WaterHardness) -> None:
"""Set water hardness."""
self._set_configuration(wath=WATER_HARDNESS_ENUM_TO_STR[water_hardness])


class DysonPurifierHumidifyCoolFormaldehyde(DysonPureHumidifyCool):
"""Dyson Purifier Humidify+Cool Formaldehyde device."""

@property
def formaldehyde(self) -> int:
"""Return formaldehyde reading."""
return self._get_environmental_field_value("hcho")

0 comments on commit 5b5ff41

Please sign in to comment.