|
2 | 2 |
|
3 | 3 | from __future__ import annotations
|
4 | 4 |
|
| 5 | +import logging |
| 6 | + |
5 | 7 | from enum import Enum
|
6 | 8 |
|
7 | 9 | from ..backports.functools import cached_property
|
|
27 | 29 | STATE_PM1 = ["SensorPM1", "airState.quality.PM1"]
|
28 | 30 | STATE_PM10 = ["SensorPM10", "airState.quality.PM10"]
|
29 | 31 | STATE_PM25 = ["SensorPM2", "airState.quality.PM2"]
|
30 |
| -STATE_TANK_LIGHT = ["WatertankLight", "airState.notificationExt"] |
| 32 | +STATE_TANK_LIGHT = ["WatertankLight", "airState.miscFuncState.watertankLight"] |
| 33 | +STATE_NOTIFICATION_LIGHT = ["NotificationLight", "airState.notificationExt"] |
31 | 34 |
|
32 | 35 | STATE_POWER = [STATE_POWER_V1, "airState.energy.onCurrent"]
|
33 | 36 |
|
|
44 | 47 |
|
45 | 48 | ADD_FEAT_POLL_INTERVAL = 300 # 5 minutes
|
46 | 49 |
|
| 50 | +_LOGGER = logging.getLogger(__name__) |
| 51 | + |
47 | 52 |
|
48 | 53 | class DHumOp(Enum):
|
49 | 54 | """Whether a device is on or off."""
|
@@ -314,9 +319,36 @@ def water_tank_full(self):
|
314 | 319 | return None
|
315 | 320 | return self._update_feature(DehumidifierFeatures.WATER_TANK_FULL, value)
|
316 | 321 |
|
| 322 | + @property |
| 323 | + def notification_light(self) -> bool | None: |
| 324 | + """Return notification light status.""" |
| 325 | + try: |
| 326 | + key = self._get_state_key(STATE_NOTIFICATION_LIGHT) |
| 327 | + except: |
| 328 | + key = None |
| 329 | + _LOGGER.exception("LGE ThinQ dehumidifier - unable to get Notification Light status") |
| 330 | + if key is None: |
| 331 | + ntf_real_value = None |
| 332 | + ntf_light_int_value = None |
| 333 | + ntf_light_bool_val = None |
| 334 | + else: |
| 335 | + ntf_real_value = self.lookup_range(key) |
| 336 | + ntf_light_int_value = self.to_int_or_none(ntf_real_value) |
| 337 | + if ntf_light_int_value is None: |
| 338 | + ntf_light_bool_val = None |
| 339 | + _LOGGER.warning(f"LGE ThinQ dehumidifier Notification light is {ntf_real_value}. int {ntf_light_int_value}. bool {ntf_light_bool_val}") |
| 340 | + elif ntf_light_int_value > 0: |
| 341 | + ntf_light_bool_val = True |
| 342 | + else: |
| 343 | + ntf_light_bool_val = False |
| 344 | + if ntf_light_bool_val is not None: |
| 345 | + _LOGGER.debug(f"LGE ThinQ dehumidifier Notification light is {ntf_real_value}. int {ntf_light_int_value}. bool {ntf_light_bool_val}") |
| 346 | + return self._update_feature(DehumidifierFeatures.NOTIFICATION_LIGHT, ntf_light_bool_val) |
| 347 | + |
317 | 348 | def _update_features(self):
|
318 | 349 | _ = [
|
319 | 350 | self.current_humidity,
|
320 | 351 | self.target_humidity,
|
321 | 352 | self.water_tank_full,
|
| 353 | + self.notification_light |
322 | 354 | ]
|
0 commit comments