Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions custom_components/smartthinq_sensors/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,12 @@ class ThinQBinarySensorEntityDescription(BinarySensorEntityDescription):
key=DehumidifierFeatures.WATER_TANK_FULL,
name="Water Tank Full",
),
ThinQBinarySensorEntityDescription(
key=DehumidifierFeatures.NOTIFICATION_LIGHT,
name="Notification Light",
device_class=BinarySensorDeviceClass.PROBLEM,
value_fn=lambda x: x.notification_light,
),
)

BINARY_SENSOR_ENTITIES = {
Expand Down
1 change: 1 addition & 0 deletions custom_components/smartthinq_sensors/wideq/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ class DehumidifierFeatures(StrEnum):
HUMIDITY = "humidity"
TARGET_HUMIDITY = "target_humidity"
WATER_TANK_FULL = "water_tank_full"
NOTIFICATION_LIGHT = "notification_light"


class RangeFeatures(StrEnum):
Expand Down
26 changes: 26 additions & 0 deletions custom_components/smartthinq_sensors/wideq/devices/dehumidifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
STATE_PM10 = ["SensorPM10", "airState.quality.PM10"]
STATE_PM25 = ["SensorPM2", "airState.quality.PM2"]
STATE_TANK_LIGHT = ["WatertankLight", "airState.miscFuncState.watertankLight"]
STATE_NOTIFICATION_LIGHT = ["NotificationLight", "airState.notificationExt"]

STATE_POWER = [STATE_POWER_V1, "airState.energy.onCurrent"]

Expand Down Expand Up @@ -314,9 +315,34 @@ def water_tank_full(self):
return None
return self._update_feature(DehumidifierFeatures.WATER_TANK_FULL, value)

@property
def notification_light(self) -> bool | None:
"""Return notification light status."""
try:
key = self._get_state_key(STATE_NOTIFICATION_LIGHT)
except KeyError:
key = None
if key is None:
ntf_real_value = None
ntf_light_int_value = None
ntf_light_bool_val = None
else:
ntf_real_value = self.lookup_range(key)
ntf_light_int_value = self.to_int_or_none(ntf_real_value)
if ntf_light_int_value is None:
ntf_light_bool_val = None
elif ntf_light_int_value > 0:
ntf_light_bool_val = True
else:
ntf_light_bool_val = False
return self._update_feature(
DehumidifierFeatures.NOTIFICATION_LIGHT, ntf_light_bool_val
)

def _update_features(self):
_ = [
self.current_humidity,
self.target_humidity,
self.water_tank_full,
self.notification_light,
]