Skip to content

Commit 8365717

Browse files
authored
Add LPH22, LPH32 for Air, SE models (#25)
1 parent 07e2249 commit 8365717

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

letpot/converters.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -86,25 +86,25 @@ def _hex_bytes_to_int_array(self, hex_message: PayloadType) -> list[int] | None:
8686

8787

8888
class LPHx1Converter(LetPotDeviceConverter):
89-
"""Converters and info for device type LPH11 (Mini), LPH21 (Air), LPH31 (SE)."""
89+
"""Converters and info for device type LPH11 (Mini), LPH21, LPH22 (Air), LPH31, LPH32 (SE)."""
9090

9191
@staticmethod
9292
def supports_type(device_type: str) -> bool:
93-
return device_type in ["LPH11", "LPH21", "LPH31"]
93+
return device_type in ["LPH11", "LPH21", "LPH22", "LPH31", "LPH32"]
9494

9595
def get_device_model(self) -> tuple[str, str] | None:
9696
if self._device_type == "LPH11":
9797
return MODEL_MINI
98-
elif self._device_type == "LPH21":
98+
elif self._device_type in ["LPH21", "LPH22"]:
9999
return MODEL_AIR
100-
elif self._device_type == "LPH31":
100+
elif self._device_type in ["LPH31", "LPH32"]:
101101
return MODEL_SE
102102
else:
103103
return None
104104

105105
def supported_features(self) -> DeviceFeature:
106106
features = DeviceFeature.CATEGORY_HYDROPONIC_GARDEN | DeviceFeature.PUMP_STATUS
107-
if self._device_type in ["LPH21", "LPH31"]:
107+
if self._device_type in ["LPH21", "LPH22", "LPH31", "LPH32"]:
108108
features |= DeviceFeature.LIGHT_BRIGHTNESS_LOW_HIGH
109109
return features
110110

@@ -137,7 +137,7 @@ def convert_hex_to_status(self, message: PayloadType) -> LetPotDeviceStatus | No
137137
_LOGGER.debug("Invalid message received, ignoring: %s", message)
138138
return None
139139

140-
if self._device_type == "LPH21":
140+
if self._device_type in ["LPH21", "LPH22"]:
141141
error_pump_malfunction = None
142142
else:
143143
error_pump_malfunction = True if data[7] & 2 else False
@@ -162,7 +162,11 @@ def convert_hex_to_status(self, message: PayloadType) -> LetPotDeviceStatus | No
162162
)
163163

164164
def get_light_brightness_levels(self) -> list[int]:
165-
return [500, 1000] if self._device_type in ["LPH21", "LPH31"] else []
165+
return (
166+
[500, 1000]
167+
if self._device_type in ["LPH21", "LPH22", "LPH31", "LPH32"]
168+
else []
169+
)
166170

167171

168172
class IGSorAltConverter(LetPotDeviceConverter):

tests/test_converter.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@
1111
"IGS01",
1212
"LPH11",
1313
"LPH21",
14+
"LPH22",
1415
"LPH27",
1516
"LPH31",
17+
"LPH32",
1618
"LPH37",
1719
"LPH39",
1820
"LPH60",

0 commit comments

Comments
 (0)