Ver Fonte

Dehumidifier light control is inverted.

It seems the display lighting control for the Goldair Dehumidifier (GPDH420 at least) is inverted.
Fix it so the Light in the HomeAssistant interface is in sync with the lighting.
Jason Rumney há 5 anos atrás
pai
commit
a366699a01

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

@@ -15,7 +15,7 @@ ATTR_AIR_CLEAN_ON = "air_clean_on"
 ATTR_CHILD_LOCK = "child_lock"
 ATTR_ERROR = "error"
 ATTR_ERROR_CODE = "error_code"
-ATTR_DISPLAY_ON = "display_on"
+ATTR_DISPLAY_OFF = "display_off"
 ATTR_DEFROSTING = "defrosting"
 
 PRESET_NORMAL = "Normal"
@@ -35,7 +35,7 @@ PROPERTY_TO_DPS_ID = {
     ATTR_FAN_MODE: "6",
     ATTR_CHILD_LOCK: "7",
     ATTR_ERROR: "11",
-    ATTR_DISPLAY_ON: "102",
+    ATTR_DISPLAY_OFF: "102",
     ATTR_TEMPERATURE: "103",
     ATTR_HUMIDITY: "104",
     ATTR_DEFROSTING: "105",

+ 6 - 6
custom_components/tuya_local/dehumidifier/light.py

@@ -10,7 +10,7 @@ from homeassistant.components.climate import ATTR_HVAC_MODE, HVAC_MODE_OFF
 from homeassistant.const import STATE_UNAVAILABLE
 
 from ..device import TuyaLocalDevice
-from .const import ATTR_DISPLAY_ON, HVAC_MODE_TO_DPS_MODE, PROPERTY_TO_DPS_ID
+from .const import ATTR_DISPLAY_OFF, HVAC_MODE_TO_DPS_MODE, PROPERTY_TO_DPS_ID
 
 
 class GoldairDehumidifierLedDisplayLight(LightEntity):
@@ -53,22 +53,22 @@ class GoldairDehumidifierLedDisplayLight(LightEntity):
     @property
     def is_on(self):
         """Return the current state."""
-        return self._device.get_property(PROPERTY_TO_DPS_ID[ATTR_DISPLAY_ON])
+        return !self._device.get_property(PROPERTY_TO_DPS_ID[ATTR_DISPLAY_OFF])
 
     async def async_turn_on(self):
-        await self._device.async_set_property(PROPERTY_TO_DPS_ID[ATTR_DISPLAY_ON], True)
+        await self._device.async_set_property(PROPERTY_TO_DPS_ID[ATTR_DISPLAY_OFF], False)
 
     async def async_turn_off(self):
         await self._device.async_set_property(
-            PROPERTY_TO_DPS_ID[ATTR_DISPLAY_ON], False
+            PROPERTY_TO_DPS_ID[ATTR_DISPLAY_OFF], True
         )
 
     async def async_toggle(self):
         dps_hvac_mode = self._device.get_property(PROPERTY_TO_DPS_ID[ATTR_HVAC_MODE])
-        dps_display_on = self._device.get_property(PROPERTY_TO_DPS_ID[ATTR_DISPLAY_ON])
+        dps_display_off = self._device.get_property(PROPERTY_TO_DPS_ID[ATTR_DISPLAY_OFF])
 
         if dps_hvac_mode != HVAC_MODE_TO_DPS_MODE[HVAC_MODE_OFF]:
-            await (self.turn_on() if not dps_display_on else self.turn_off())
+            await (self.turn_on() if dps_display_off else self.turn_off())
 
     async def async_update(self):
         await self._device.async_refresh()