From 6a8ed5c59ecf17d06facb4121ec6752095b7694e Mon Sep 17 00:00:00 2001 From: Kevin Lemonnier <873423+Ulrar@users.noreply.github.com> Date: Mon, 12 Dec 2022 12:19:35 +0000 Subject: [PATCH] Adding support for 527K - Dyson Pure Hot+Cool Formaldehyde --- libdyson/__init__.py | 5 ++++- libdyson/const.py | 2 ++ libdyson/dyson_pure_hot_cool.py | 11 ++++++++++- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/libdyson/__init__.py b/libdyson/__init__.py index 7b05791..ae8fb07 100644 --- a/libdyson/__init__.py +++ b/libdyson/__init__.py @@ -15,6 +15,7 @@ DEVICE_TYPE_PURE_HOT_COOL_LINK, DEVICE_TYPE_PURE_HUMIDIFY_COOL, DEVICE_TYPE_PURIFIER_HUMIDIFY_COOL_FORMALDEHYDE, + DEVICE_TYPE_PURE_HOT_COOL_FORMALDEHYDE, ) from .const import CleaningMode # noqa: F401 from .const import CleaningType # noqa: F401 @@ -32,7 +33,7 @@ from .dyson_pure_cool import DysonPureCool from .dyson_pure_cool import DysonPureCoolFormaldehyde from .dyson_pure_cool_link import DysonPureCoolLink -from .dyson_pure_hot_cool import DysonPureHotCool +from .dyson_pure_hot_cool import DysonPureHotCool, DysonPureHotCoolFormaldehyde from .dyson_pure_hot_cool_link import DysonPureHotCoolLink from .dyson_pure_humidify_cool import DysonPureHumidifyCool, DysonPurifierHumidifyCoolFormaldehyde from .utils import get_mqtt_info_from_wifi_info # noqa: F401 @@ -58,6 +59,8 @@ def get_device(serial: str, credential: str, device_type: str) -> Optional[Dyson return DysonPureCoolFormaldehyde(serial, credential, device_type) if device_type == DEVICE_TYPE_PURE_HOT_COOL_LINK: return DysonPureHotCoolLink(serial, credential, device_type) + if device_type == DEVICE_TYPE_PURE_HOT_COOL_FORMALDEHYDE: + return DysonPureHotCoolFormaldehyde(serial, credential, device_type) if device_type in [ DEVICE_TYPE_PURE_HOT_COOL, DEVICE_TYPE_PURE_HOT_COOL_NEW, diff --git a/libdyson/const.py b/libdyson/const.py index 254e1cb..d655aa0 100644 --- a/libdyson/const.py +++ b/libdyson/const.py @@ -13,6 +13,7 @@ DEVICE_TYPE_PURE_HOT_COOL_LINK = "455" DEVICE_TYPE_PURE_HOT_COOL = "527" DEVICE_TYPE_PURE_HOT_COOL_NEW = "527E" +DEVICE_TYPE_PURE_HOT_COOL_FORMALDEHYDE = "527K" DEVICE_TYPE_NAMES = { DEVICE_TYPE_360_EYE: "360 Eye robot vacuum", @@ -27,6 +28,7 @@ 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", + DEVICE_TYPE_PURE_HOT_COOL_FORMALDEHYDE: "Pure Hot+Cool Formaldehyde" } ENVIRONMENTAL_OFF = -1 diff --git a/libdyson/dyson_pure_hot_cool.py b/libdyson/dyson_pure_hot_cool.py index 3ceb789..561b383 100644 --- a/libdyson/dyson_pure_hot_cool.py +++ b/libdyson/dyson_pure_hot_cool.py @@ -1,8 +1,17 @@ """Dyson Pure Hot+Cool device.""" +from typing import Optional + from .dyson_device import DysonHeatingDevice from .dyson_pure_cool import DysonPureCool - class DysonPureHotCool(DysonPureCool, DysonHeatingDevice): """Dyson Pure Hot+Cool device.""" + +class DysonPureHotCoolFormaldehyde(DysonPureHotCool): + """Dyson Pure Hot+Cool Formaldehyde device.""" + + @property + def formaldehyde(self) -> Optional[int]: + """Return formaldehyde reading.""" + return self._get_environmental_field_value("hcho")