rospogrigio / localtuya

local handling for Tuya devices
GNU General Public License v3.0
2.72k stars 532 forks source link

Airton AC not fully recognised #1115

Open ejalal opened 1 year ago

ejalal commented 1 year ago

The problem

Airton AC has some missing data points to finish integration, on/off and temperature change works OK, but I would like at least to be able to change Operation Mode from the UI to Heating/Cooling/Ventilation/Dehumidification. Changing Fan speed or enabling Swing could be a bonus.

HVAC Mode DP (optional) => Set tp DP 4, but always says Auto ! HVAC Mode Set (optional) => Don't know what to put in here but I'm expecting a list for auto, cold, wet, heat, fan HVAC Current Action DP (optional) => Don't know what to put in here

Environment

Steps to reproduce

1.

Configuration configuration.yaml or config_flow

DP dump

    DPS [1] VALUE [True]
    DPS [2] VALUE [240]
    DPS [3] VALUE [250]
    DPS [4] VALUE [heat]
    DPS [5] VALUE [mute]
    DPS [8] VALUE [False]
    DPS [9] VALUE [False]
    DPS [12] VALUE [True]
    DPS [13] VALUE [True]
    DPS [15] VALUE [off]
    DPS [20] VALUE [0]
    DPS [22] VALUE [0]
    DPS [101] VALUE [0]
    DPS [102] VALUE [78]
    DPS [103] VALUE [1]
    DPS [105] VALUE [c]
    DPS [106] VALUE [off]
    DPS [107] VALUE [off]
    DPS [108] VALUE [False]
    DPS [109] VALUE [False]
    DPS [110] VALUE [True]
    DPS [111] VALUE [False]
    DPS [112] VALUE [cold]
    DPS [113] VALUE [0]
    DPS [114] VALUE [heat]
    DPS [115] VALUE [False]

Provide Home Assistant taceback/logs

Additional information

API call for "Get Device Specification Attribute"

{
  "result": {
    "category": "kt",
    "functions": [
      {
        "code": "switch",
        "dp_id": 1,
        "type": "Boolean",
        "values": "{}"
      },
      {
        "code": "eco",
        "dp_id": 8,
        "type": "Boolean",
        "values": "{}"
      },
      {
        "code": "drying",
        "dp_id": 9,
        "type": "Boolean",
        "values": "{}"
      },
      {
        "code": "cleaning",
        "dp_id": 111,
        "type": "Boolean",
        "values": "{}"
      },
      {
        "code": "temp_unit_convert",
        "dp_id": 105,
        "type": "Enum",
        "values": "{\"range\":[\"c\",\"f\"]}"
      },
      {
        "code": "temp_set",
        "dp_id": 2,
        "type": "Integer",
        "values": "{\"unit\":\"℃\",\"min\":160,\"max\":880,\"scale\":1,\"step\":10}"
      },
      {
        "code": "mode",
        "dp_id": 4,
        "type": "Enum",
        "values": "{\"range\":[\"auto\",\"cold\",\"wet\",\"heat\",\"fan\"]}"
      },
      {
        "code": "heat",
        "dp_id": 12,
        "type": "Boolean",
        "values": "{}"
      },
      {
        "code": "light",
        "dp_id": 13,
        "type": "Boolean",
        "values": "{}"
      },
      {
        "code": "sleep",
        "dp_id": 109,
        "type": "Boolean",
        "values": "{}"
      },
      {
        "code": "health",
        "dp_id": 110,
        "type": "Boolean",
        "values": "{}"
      },
      {
        "code": "fan_speed_enum",
        "dp_id": 5,
        "type": "Enum",
        "values": "{\"range\":[\"auto\",\"low\",\"low_mid\",\"mid\",\"mid_high\",\"high\",\"mute\",\"turbo\"]}"
      }
    ],
    "status": [
      {
        "code": "switch",
        "dp_id": 1,
        "type": "Boolean",
        "values": "{}"
      },
      {
        "code": "fan_speed_enum",
        "dp_id": 5,
        "type": "Enum",
        "values": "{\"range\":[\"auto\",\"low\",\"low_mid\",\"mid\",\"mid_high\",\"high\",\"mute\",\"turbo\"]}"
      },
      {
        "code": "eco",
        "dp_id": 8,
        "type": "Boolean",
        "values": "{}"
      },
      {
        "code": "drying",
        "dp_id": 9,
        "type": "Boolean",
        "values": "{}"
      },
      {
        "code": "cleaning",
        "dp_id": 111,
        "type": "Boolean",
        "values": "{}"
      },
      {
        "code": "temp_unit_convert",
        "dp_id": 105,
        "type": "Enum",
        "values": "{\"range\":[\"c\",\"f\"]}"
      },
      {
        "code": "temp_set",
        "dp_id": 2,
        "type": "Integer",
        "values": "{\"unit\":\"℃\",\"min\":160,\"max\":880,\"scale\":1,\"step\":10}"
      },
      {
        "code": "temp_current",
        "dp_id": 3,
        "type": "Integer",
        "values": "{\"unit\":\"℃\",\"min\":0,\"max\":600,\"scale\":1,\"step\":1}"
      },
      {
        "code": "mode",
        "dp_id": 4,
        "type": "Enum",
        "values": "{\"range\":[\"auto\",\"cold\",\"wet\",\"heat\",\"fan\"]}"
      },
      {
        "code": "heat",
        "dp_id": 12,
        "type": "Boolean",
        "values": "{}"
      },
      {
        "code": "light",
        "dp_id": 13,
        "type": "Boolean",
        "values": "{}"
      },
      {
        "code": "countdown_left",
        "dp_id": 22,
        "type": "Integer",
        "values": "{\"unit\":\"分钟\",\"min\":0,\"max\":1440,\"scale\":0,\"step\":1}"
      },
      {
        "code": "sleep",
        "dp_id": 109,
        "type": "Boolean",
        "values": "{}"
      },
      {
        "code": "health",
        "dp_id": 110,
        "type": "Boolean",
        "values": "{}"
      }
    ]
  },
  "success": true,
  "t": 1667830527939,
  "tid": "a11e9daf5ea611ed8c069ee482573564"
}
sambarlick commented 1 year ago

I just saw your post as I was about to create a bug report myself with a similar issue.

My Aircon has Heat, Cool, Dry(Dehumidify) and Fan modes. Even though I link the correct DP to the HVAC mode which includes these modes, the options Tuya Local offer are Auto and Heat. This is not good enough and all modes should be supported.

I agree fan speed and swing should be included but I had to create a seperate fan entity within the device to handle the fan speed and swing.

Also, min and max temperature should be a manual text field and not linked to a DP. My Aircon doesn't have these values as a DP.

balloo42 commented 1 year ago

Hi, I modified the climate.py (/config/custom_components/localtuya/climate.py) to add the missing modes for my Airton HVAC.

I added the following modes : HVAC_MODE_COOL, HVAC_MODE_DRY, HVAC_MODE_FAN_ONLY

from homeassistant.components.climate.const import ( CURRENT_HVAC_HEAT, CURRENT_HVAC_IDLE, HVAC_MODE_AUTO, HVAC_MODE_HEAT, HVAC_MODE_OFF, HVAC_MODE_COOL, HVAC_MODE_DRY, HVAC_MODE_FAN_ONLY, PRESET_AWAY, PRESET_ECO, PRESET_HOME, PRESET_NONE, SUPPORT_PRESET_MODE, SUPPORT_TARGET_TEMPERATURE, SUPPORT_TARGET_TEMPERATURE_RANGE, )

And i added the following mode_set : auto/cold/wet/heat/fan

HVAC_MODE_SETS = { "manual/auto": { HVAC_MODE_HEAT: "manual", HVAC_MODE_AUTO: "auto", }, "Manual/Auto": { HVAC_MODE_HEAT: "Manual", HVAC_MODE_AUTO: "Auto", }, "Manual/Program": { HVAC_MODE_HEAT: "Manual", HVAC_MODE_AUTO: "Program", }, "True/False": { HVAC_MODE_HEAT: True, }, "1/0": { HVAC_MODE_HEAT: "1", HVAC_MODE_AUTO: "0", }, "auto/cold/wet/heat/fan": { HVAC_MODE_HEAT: "heat", HVAC_MODE_AUTO: "auto", HVAC_MODE_COOL: "cold", HVAC_MODE_DRY: "wet", HVAC_MODE_FAN_ONLY: "fan",
},

image

In order to control the fan speed you need to add a select with the following entries : auto;low;low_mid;mid;mid_high;high;mute;turbo

image

carmelo42 commented 1 year ago

Hello @balloo42 ! Can you provide more information about localTuya configuration please ?

I have modified my climate.py file like you said, but I don't know how to configure the Airton device in local Tuya integration :

image

Any help would be much appreciated :)

balloo42 commented 1 year ago

Hello @carmelo42,

My settings :

image image

After that screen, i unchecked the "Do not add any more entities", and i chose the entity type "select" to configure the fan speed on DP 5 (values are : auto;low;low_mid;mid;mid_high;high;mute;turbo), i also added a switch for "Health" (DP 110), and "light" (DP 13).

carmelo42 commented 1 year ago

Thanks @balloo42 it is way better now : I can turn on / off the AC.

But when I'm select "heat" the mode automatically switch on "Auto" itself.

If I select cold, or fan only, or dry, the mode stays on the good value.

Also have 180°C for target temperature instead of 18°C ^^

image
carmelo42 commented 1 year ago

Thanks again @balloo42 it's now fully working with Airton - Yuzu - Fujicool HVAC devices (self installables HVAC devices). I've forked the repo and added my modifications : https://github.com/carmelo42/localtuya/tree/fujicool-yuzu-hvac

balloo42 commented 1 year ago

looks like there is a slight difference between our mode_sets : heat vs hot and fan vs wind happy to share and that you figured this out.

PhilippeP62 commented 1 year ago

Well I also have a Airton unit so I can say that you both helped me a lot ! Thanks

CFTechno commented 1 year ago

Thank you all! That really helped.

Small question however: does any of you know the DP for "auxiliaryHeat" and/or "8c heat" Specially the last one is interesting because you can set it and it will work. If you set the "8c heat" the unit will beep but no indication is activated in the smart life app but it does work.

PhilippeP62 commented 1 year ago

AuxiliaryHeat is DP12 No Idea about 8cHeat but I allready do that in automation.

uriirichard commented 1 year ago

Hi, I modified the climate.py (/config/custom_components/localtuya/climate.py) to add the missing modes for my Airton HVAC.

I added the following modes : HVAC_MODE_COOL, HVAC_MODE_DRY, HVAC_MODE_FAN_ONLY

from homeassistant.components.climate.const import ( CURRENT_HVAC_HEAT, CURRENT_HVAC_IDLE, HVAC_MODE_AUTO, HVAC_MODE_HEAT, HVAC_MODE_OFF, HVAC_MODE_COOL, HVAC_MODE_DRY, HVAC_MODE_FAN_ONLY, PRESET_AWAY, PRESET_ECO, PRESET_HOME, PRESET_NONE, SUPPORT_PRESET_MODE, SUPPORT_TARGET_TEMPERATURE, SUPPORT_TARGET_TEMPERATURE_RANGE, )

And i added the following mode_set : auto/cold/wet/heat/fan

HVAC_MODE_SETS = { "manual/auto": { HVAC_MODE_HEAT: "manual", HVAC_MODE_AUTO: "auto", }, "Manual/Auto": { HVAC_MODE_HEAT: "Manual", HVAC_MODE_AUTO: "Auto", }, "Manual/Program": { HVAC_MODE_HEAT: "Manual", HVAC_MODE_AUTO: "Program", }, "True/False": { HVAC_MODE_HEAT: True, }, "1/0": { HVAC_MODE_HEAT: "1", HVAC_MODE_AUTO: "0", }, "auto/cold/wet/heat/fan": { HVAC_MODE_HEAT: "heat", HVAC_MODE_AUTO: "auto", HVAC_MODE_COOL: "cold", HVAC_MODE_DRY: "wet", HVAC_MODE_FAN_ONLY: "fan", },

image

In order to control the fan speed you need to add a select with the following entries : auto;low;low_mid;mid;mid_high;high;mute;turbo

image

Thanks, with this, and some from https://github.com/rospogrigio/localtuya/pull/888 I finnaly have a PROKLIMA-A018-12KR2/C fully working!

PhilippeP62 commented 1 year ago

Still missing from 5.0.1 ...

sanyajorj commented 1 year ago

climate.py line 289 ........... self._current_temperature = self._current_temperature * 10 Change 10 to 1 and the temperature will be displayed correctly

patpac9 commented 1 year ago

I can't set "HVAC Mode Set" to this... I only have the following options. grafik

vinceg0267 commented 1 year ago

Thanks again @balloo42 it's now fully working with Airton - Yuzu - Fujicool HVAC devices (self installables HVAC devices). I've forked the repo and added my modifications : https://github.com/carmelo42/localtuya/tree/fujicool-yuzu-hvac

Thanks @balloo42 it is way better now : I can turn on / off the AC.

But when I'm select "heat" the mode automatically switch on "Auto" itself.

If I select cold, or fan only, or dry, the mode stays on the good value.

Also have 180°C for target temperature instead of 18°C ^^

image

@carmelo42 how did you solve the target temperature problem?

neko-ctrl commented 11 months ago

Hi, I'm new here. I have almost similar issue with my Fujiaire Aircons. I can change Temperature & Modes, but my Aircons Switch[On/Off] doesn't work. I tried Cloud Tuya & Local Tuya. Both same. Mobile app does have full feature. Even Tuya IoT have On/Off as Boolean that I tried already. Working fine. Please help. Screenshot 2023-07-15 065651

P/S : My Home-assistant runs on Raspberry Pi 3B.

tolnai commented 11 months ago

I have Polar AC, but ended up here because their DPs seem to be similar (e.g. ["cold", "hot", "wet", "wind", "auto"] mode). How could we speed up adding handling them to localtuya? Create a separate PR from this one only for the HVAC side?

OpenGrowBox commented 1 month ago

its also working for Air Condition-A012 from Tuya the Costway 4-1 in Device. But only the Dry mode looks not to work for me.

all other modes get selected only the Dry not.

here is the code part

"auto/cold/wet/heat/fan": {
HVAC_MODE_HEAT: "Heat",
HVAC_MODE_AUTO: "Auto",
HVAC_MODE_COOL: "Cool",
HVAC_MODE_DRY: "Dry",
HVAC_MODE_FAN_ONLY: "Fan",
},

have anybody got the same issue that one mode isnt working ?

OpenGrowBox commented 1 month ago

found the issue on the API it self on the DEVICE is a TYPO for DRY - There is a enum with DYR image

bumptronic commented 2 weeks ago

its also working for Air Condition-A012 from Tuya the Costway 4-1 in Device. But only the Dry mode looks not to work for me.

all other modes get selected only the Dry not.

here is the code part

"auto/cold/wet/heat/fan": {
HVAC_MODE_HEAT: "Heat",
HVAC_MODE_AUTO: "Auto",
HVAC_MODE_COOL: "Cool",
HVAC_MODE_DRY: "Dry",
HVAC_MODE_FAN_ONLY: "Fan",
},

have anybody got the same issue that one mode isnt working ?

Have you tried:

HVAC_MODE_DRY: "wet",

OpenGrowBox commented 2 weeks ago

no it was a typo on the API from tuya it self it should be "Dry" but it is "Dyr"

with "Dyr" all works fine :D some times we nned typos in our life :D haha