|
8 | 8 | from aiomqtt.types import PayloadType |
9 | 9 |
|
10 | 10 | from letpot.exceptions import LetPotException |
11 | | -from letpot.models import DeviceFeature, LetPotDeviceErrors, LetPotDeviceStatus |
| 11 | +from letpot.models import ( |
| 12 | + DeviceFeature, |
| 13 | + TemperatureUnit, |
| 14 | + LetPotDeviceErrors, |
| 15 | + LetPotDeviceStatus, |
| 16 | +) |
12 | 17 |
|
13 | 18 | _LOGGER = logging.getLogger(__name__) |
14 | 19 |
|
@@ -243,6 +248,7 @@ def supported_features(self) -> DeviceFeature: |
243 | 248 | DeviceFeature.LIGHT_BRIGHTNESS_LEVELS |
244 | 249 | | DeviceFeature.PUMP_AUTO |
245 | 250 | | DeviceFeature.TEMPERATURE |
| 251 | + | DeviceFeature.TEMPERATURE_SET_UNIT |
246 | 252 | | DeviceFeature.WATER_LEVEL |
247 | 253 | ) |
248 | 254 | if self._device_type != "LPH60": |
@@ -270,7 +276,7 @@ def get_update_status_message(self, status: LetPotDeviceStatus) -> list[int]: |
270 | 276 | if status.light_brightness is not None |
271 | 277 | else 0, |
272 | 278 | status.light_brightness % 256 if status.light_brightness is not None else 0, |
273 | | - status.temperature_unit if status.temperature_unit is not None else 0, |
| 279 | + 1 if status.temperature_unit is TemperatureUnit.CELSIUS else 0, |
274 | 280 | 1 if status.system_sound is True else 0, |
275 | 281 | 1 if status.pump_nutrient is True else 0, |
276 | 282 | ] |
@@ -299,7 +305,7 @@ def convert_hex_to_status(self, message: PayloadType) -> LetPotDeviceStatus | No |
299 | 305 | low_nutrients=True if data[7] & 1 else False, |
300 | 306 | refill_error=True if data[7] & 4 else False, |
301 | 307 | ), |
302 | | - temperature_unit=data[24], |
| 308 | + temperature_unit=TemperatureUnit(data[24]), |
303 | 309 | temperature_value=256 * data[22] + data[23], |
304 | 310 | water_level=256 * data[20] + data[21], |
305 | 311 | water_mode=data[17], |
@@ -376,7 +382,7 @@ def convert_hex_to_status(self, message: PayloadType) -> LetPotDeviceStatus | No |
376 | 382 | low_nutrients=True if data[7] & 1 else False, |
377 | 383 | refill_error=True if data[7] & 4 else False, |
378 | 384 | ), |
379 | | - temperature_unit=data[24], |
| 385 | + temperature_unit=TemperatureUnit(data[24]), |
380 | 386 | temperature_value=256 * data[22] + data[23], |
381 | 387 | water_level=256 * data[20] + data[21], |
382 | 388 | water_mode=data[17], |
|
0 commit comments