فهرست منبع

Use OK for the no error value.

OK is more concise and makes more sense in the UI for a "tank status".
Also, modify the logic to ensure that 0 does not skip conversion to a string,
and subsequently get converted to None.
Jason Rumney 5 سال پیش
والد
کامیت
a1355a7375
2فایلهای تغییر یافته به همراه3 افزوده شده و 4 حذف شده
  1. 2 3
      custom_components/tuya_local/dehumidifier/climate.py
  2. 1 1
      custom_components/tuya_local/dehumidifier/const.py

+ 2 - 3
custom_components/tuya_local/dehumidifier/climate.py

@@ -260,8 +260,7 @@ class GoldairDehumidifier(ClimateDevice):
         error = self._device.get_property(PROPERTY_TO_DPS_ID[ATTR_ERROR])
         if error is not None:
             return (
-                TuyaLocalDevice.get_key_for_value(ERROR_CODE_TO_DPS_CODE, error)
-                == ERROR_TANK
+                TuyaLocalDevice.get_key_for_value(ERROR_CODE_TO_DPS_CODE, error) == ERROR_TANK
             )
         else:
             return None
@@ -274,7 +273,7 @@ class GoldairDehumidifier(ClimateDevice):
     def device_state_attributes(self):
         """Get additional attributes that HA doesn't naturally support."""
         error = self._device.get_property(PROPERTY_TO_DPS_ID[ATTR_ERROR])
-        if error:
+        if isinstance(error, int):
             error = TuyaLocalDevice.get_key_for_value(
                 ERROR_CODE_TO_DPS_CODE, error, error
             )

+ 1 - 1
custom_components/tuya_local/dehumidifier/const.py

@@ -23,7 +23,7 @@ PRESET_HIGH = "High"
 PRESET_DRY_CLOTHES = "Dry clothes"
 PRESET_AIR_CLEAN = "Air clean"
 
-ERROR_NONE = "No error"
+ERROR_NONE = "OK"
 ERROR_TANK = "Tank full or missing"
 
 PROPERTY_TO_DPS_ID = {