From c795fe8585f4fc08682c4c4d51168c1b07defd2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joris=20Pelgr=C3=B6m?= Date: Tue, 2 Dec 2025 20:48:53 +0100 Subject: [PATCH] Add LPH22, LPH32 for Air, SE models --- letpot/converters.py | 18 +++++++++++------- tests/test_converter.py | 2 ++ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/letpot/converters.py b/letpot/converters.py index 7055490..5f5e97e 100644 --- a/letpot/converters.py +++ b/letpot/converters.py @@ -86,25 +86,25 @@ def _hex_bytes_to_int_array(self, hex_message: PayloadType) -> list[int] | None: class LPHx1Converter(LetPotDeviceConverter): - """Converters and info for device type LPH11 (Mini), LPH21 (Air), LPH31 (SE).""" + """Converters and info for device type LPH11 (Mini), LPH21, LPH22 (Air), LPH31, LPH32 (SE).""" @staticmethod def supports_type(device_type: str) -> bool: - return device_type in ["LPH11", "LPH21", "LPH31"] + return device_type in ["LPH11", "LPH21", "LPH22", "LPH31", "LPH32"] def get_device_model(self) -> tuple[str, str] | None: if self._device_type == "LPH11": return MODEL_MINI - elif self._device_type == "LPH21": + elif self._device_type in ["LPH21", "LPH22"]: return MODEL_AIR - elif self._device_type == "LPH31": + elif self._device_type in ["LPH31", "LPH32"]: return MODEL_SE else: return None def supported_features(self) -> DeviceFeature: features = DeviceFeature.CATEGORY_HYDROPONIC_GARDEN | DeviceFeature.PUMP_STATUS - if self._device_type in ["LPH21", "LPH31"]: + if self._device_type in ["LPH21", "LPH22", "LPH31", "LPH32"]: features |= DeviceFeature.LIGHT_BRIGHTNESS_LOW_HIGH return features @@ -137,7 +137,7 @@ def convert_hex_to_status(self, message: PayloadType) -> LetPotDeviceStatus | No _LOGGER.debug("Invalid message received, ignoring: %s", message) return None - if self._device_type == "LPH21": + if self._device_type in ["LPH21", "LPH22"]: error_pump_malfunction = None else: error_pump_malfunction = True if data[7] & 2 else False @@ -162,7 +162,11 @@ def convert_hex_to_status(self, message: PayloadType) -> LetPotDeviceStatus | No ) def get_light_brightness_levels(self) -> list[int]: - return [500, 1000] if self._device_type in ["LPH21", "LPH31"] else [] + return ( + [500, 1000] + if self._device_type in ["LPH21", "LPH22", "LPH31", "LPH32"] + else [] + ) class IGSorAltConverter(LetPotDeviceConverter): diff --git a/tests/test_converter.py b/tests/test_converter.py index b33583b..e335649 100644 --- a/tests/test_converter.py +++ b/tests/test_converter.py @@ -11,8 +11,10 @@ "IGS01", "LPH11", "LPH21", + "LPH22", "LPH27", "LPH31", + "LPH32", "LPH37", "LPH39", "LPH60",