xZetsubou / hass-localtuya

🔹 A Home Assistant integration to handle Tuya devices locally "fork from localtuya"
https://xzetsubou.github.io/hass-localtuya/
GNU General Public License v3.0
361 stars 38 forks source link

[Bug]: Tuya thermostat wrong configuration and temperature value #257

Closed Hammerhand17 closed 3 months ago

Hammerhand17 commented 3 months ago

LocalTuya Version

2024.5.0

Home Assistant Version

2024.5.5

Environment

What happened?

I have a tuya thermostat for fancoils with the following info: Product Name 柏益加温控器(空调) Device ID 31571686cc50e3e73cd9 Product Category wk Device Status Online Activated At 2023-12-02 21:01:15 Device Association

The values aren't setup correctly as you have fan/heat/cold modes and auto/low/medium/high fan speed and they are not recognized fine.

Besides, the temperature is reduced x5 times, so I can't ever see the actual temperature nor set it correctly.

Steps to reproduce.

I tried the auto setup with no success. Then configured the modes etc. manually and they are fine now but the temperature is still reduced x5.

This is the debuggin result in tuya api platform:

{
  "result": {
    "properties": [
      {
        "code": "Power",
        "custom_name": "",
        "dp_id": 1,
        "time": 1717101950699,
        "value": false
      },
      {
        "code": "TempSet",
        "custom_name": "",
        "dp_id": 2,
        "time": 1717100796442,
        "value": 54
      },
      {
        "code": "TempCurrent",
        "custom_name": "",
        "dp_id": 3,
        "time": 1717167239095,
        "value": 55
      },
      {
        "code": "Mode",
        "custom_name": "",
        "dp_id": 4,
        "time": 1717100251666,
        "value": "1"
      },
      {
        "code": "ECO",
        "custom_name": "",
        "dp_id": 5,
        "time": 1717100247449,
        "value": false
      },
      {
        "code": "ChildLock",
        "custom_name": "",
        "dp_id": 6,
        "time": 1717100257247,
        "value": false
      },
      {
        "code": "systemMode",
        "custom_name": "",
        "dp_id": 102,
        "time": 1717100673351,
        "value": "0"
      },
      {
        "code": "speed",
        "custom_name": "",
        "dp_id": 103,
        "time": 1717100620613,
        "value": "0"
      },
      {
        "code": "program",
        "custom_name": "",
        "dp_id": 104,
        "time": 1701543675611
      }
    ]
  },
  "success": true,
  "t": 1717173758237,
  "tid": "ca40fbc21f6c11efbdd1c23db552a5a2"
}

Relevant log output

No response

Diagnostics information.

No response

xZetsubou commented 3 months ago

Without device diagnostics I won't be able to understand anything...

Hammerhand17 commented 3 months ago

Ok, do you need the full file or just the part that affects my thermostat?

xZetsubou commented 3 months ago

Post the JSON file of the diagnostics is enough.

Hammerhand17 commented 3 months ago

localtuya-83247307e6778426f5b4c3938defb459-Termostato Fancoil-6948d95cd06958de825ac8abdbc5e76b.json There you are.

xZetsubou commented 3 months ago

What do you mean by temperature is reduced by x5?

Also the configuration you made manually aren't the best. HVAC Modes:

off: false
heat: true

The fan speeds:

0,1,2,3

You can also add 1 more select platform entity tho I don't know what it that do: systemMode DP 102 The options should be

0: 0
1: 1
2: 2
Hammerhand17 commented 3 months ago

It's as seen here: https://github.com/midstar/homeassistant_tuya_with_bht-002_support Or here: https://github.com/home-assistant/core/issues/72703

In smart life the modes are cold,heat,fan, and fan speed is auto, high,medium,low. Also you have manual, program and eco modes and child lock.

xZetsubou commented 3 months ago

The values in cloud are not the same values on local they are different in cloud it's kinda translated but in local it actually "0,1 etc ..."

To debug then further do one of this options.

1st Option: Monitor the DPS changes for the device

  1. Go to Home Assistant -> Developer tools -> Events
  2. Listen to one of these events localtuya_device_dp_triggered or localtuya_states_update
  3. Go to Smart Life then Change the modes to Cold then change it To Heat Then change it Fan

2nd Option: Monitor using the logs: So to debug this more enable the debug for the integration and device as well reporting an issue note you can enable the debug from UI without need to restart HA then after enabling both them go to smart life and change the modes from cold to heat then to fan

Hammerhand17 commented 3 months ago

The values in cloud are not the same values on local they are different in cloud it's kinda translated but in local it actually "0,1 etc ..."

To debug then further do one of this options.

1st Option: Monitor the DPS changes for the device

  1. Go to Home Assistant -> Developer tools -> Events
  2. Listen to one of these events localtuya_device_dp_triggered or localtuya_states_update
  3. Go to Smart Life then Change the modes to Cold then change it To Heat Then change it Fan

2nd Option: Monitor using the logs: So to debug this more enable the debug for the integration and device as well reporting an issue note you can enable the debug from UI without need to restart HA then after enabling both them go to smart life and change the modes from cold to heat then to fan

Ok. There are all the actions in smartlife app:

switch on:

event_type: localtuya_device_dp_triggered data: device_id: 31571686cc50e3e73cd9 dp: "1" value: true origin: LOCAL time_fired: "2024-06-03T14:19:19.791994+00:00" context: id: 01HZF7G2BF4CTH68W1RKTKV5QC parent_id: null user_id: null

Fan speed:

Auto->High: event_type: localtuya_device_dp_triggered data: device_id: 31571686cc50e3e73cd9 dp: "103" value: "1" origin: LOCAL time_fired: "2024-06-03T14:19:29.366434+00:00" context: id: 01HZF7GBPPAQMCAVBKCBVA51Z8 parent_id: null user_id: null

High->Medium: event_type: localtuya_device_dp_triggered data: device_id: 31571686cc50e3e73cd9 dp: "103" value: "2" origin: LOCAL time_fired: "2024-06-03T14:19:32.226037+00:00" context: id: 01HZF7GEG2GZRRECKXYQ1S4Q0F parent_id: null user_id: null

Medium->Low: event_type: localtuya_device_dp_triggered data: device_id: 31571686cc50e3e73cd9 dp: "103" value: "3" origin: LOCAL time_fired: "2024-06-03T14:19:33.869615+00:00" context: id: 01HZF7GG3DVNW4M0KEWMXK4VX6 parent_id: null user_id: null

Low->Auto: event_type: localtuya_device_dp_triggered data: device_id: 31571686cc50e3e73cd9 dp: "103" value: "0" origin: LOCAL time_fired: "2024-06-03T14:19:35.251226+00:00" context: id: 01HZF7GHEKF38Z46GGGM93TF4H parent_id: null user_id: null

Mode: Cool->Heat: event_type: localtuya_device_dp_triggered data: device_id: 31571686cc50e3e73cd9 dp: "102" value: "1" origin: LOCAL time_fired: "2024-06-03T14:20:21.548170+00:00" context: id: 01HZF7HYNCJD7KP7WXKFT0XEQ8 parent_id: null user_id: null

Heat->Fan: event_type: localtuya_device_dp_triggered data: device_id: 31571686cc50e3e73cd9 dp: "102" value: "2" origin: LOCAL time_fired: "2024-06-03T14:20:23.744277+00:00" context: id: 01HZF7J0T02DMMW35S3ZYGGNJH parent_id: null user_id: null

Fan->Cool: event_type: localtuya_device_dp_triggered data: device_id: 31571686cc50e3e73cd9 dp: "102" value: "0" origin: LOCAL time_fired: "2024-06-03T14:20:24.947400+00:00" context: id: 01HZF7J1ZKQ0V1X65MWXQX09VX parent_id: null user_id: null

Lock: event_type: localtuya_device_dp_triggered data: device_id: 31571686cc50e3e73cd9 dp: "6" value: true origin: LOCAL time_fired: "2024-06-03T14:21:16.875081+00:00" context: id: 01HZF7KMPBB7Y6F9BNHMY7P0TN parent_id: null user_id: null

Unlock: event_type: localtuya_device_dp_triggered data: device_id: 31571686cc50e3e73cd9 dp: "6" value: false origin: LOCAL time_fired: "2024-06-03T14:21:19.844882+00:00" context: id: 01HZF7KQK4WJNBT95GSK4P6R3P parent_id: null user_id: null

Eco Mode ON: event_type: localtuya_device_dp_triggered data: device_id: 31571686cc50e3e73cd9 dp: "5" value: true origin: LOCAL time_fired: "2024-06-03T14:21:46.226614+00:00" context: id: 01HZF7MHBJTNPH3RGFFNZQBEY3 parent_id: null user_id: null

Eco Mode OFF: event_type: localtuya_device_dp_triggered data: device_id: 31571686cc50e3e73cd9 dp: "5" value: false origin: LOCAL time_fired: "2024-06-03T14:21:47.488634+00:00" context: id: 01HZF7MJK0BFA0A5XMF58JBD1E parent_id: null user_id: null

Program mode ON: event_type: localtuya_device_dp_triggered data: device_id: 31571686cc50e3e73cd9 dp: "4" value: "0" origin: LOCAL time_fired: "2024-06-03T14:22:08.391697+00:00" context: id: 01HZF7N707WMCQ6919NNF9NRD7 parent_id: null user_id: null

Manual mode ON: event_type: localtuya_device_dp_triggered data: device_id: 31571686cc50e3e73cd9 dp: "4" value: "1" origin: LOCAL time_fired: "2024-06-03T14:22:25.853229+00:00" context: id: 01HZF7NR1X8TP19B1X2YS231CK parent_id: null user_id: null

Set Temperature UP: event_type: localtuya_device_dp_triggered data: device_id: 31571686cc50e3e73cd9 dp: "2" value: 58 origin: LOCAL time_fired: "2024-06-03T14:22:36.407570+00:00" context: id: 01HZF7P2BQ5ZQBZP162AWDTTRX parent_id: null user_id: null

Set Temperature DOWN: event_type: localtuya_device_dp_triggered data: device_id: 31571686cc50e3e73cd9 dp: "2" value: 54 origin: LOCAL time_fired: "2024-06-03T14:22:53.028590+00:00" context: id: 01HZF7PJK4MMBVYQHESSBJZVX1 parent_id: null user_id: null

Switch OFF: event_type: localtuya_device_dp_triggered data: device_id: 31571686cc50e3e73cd9 dp: "1" value: false origin: LOCAL time_fired: "2024-06-03T14:23:03.841501+00:00" context: id: 01HZF7PX51NFYNTZNV7ZG43QCV parent_id: null user_id: null

xZetsubou commented 3 months ago

You can re-add the device with auto configuration if you installed master version

Install Master Version

Go HACS -> Local Tuya -> On top right corner click on the ⋮ and choose redownload and select master ![image](https://github.com/xZetsubou/hass-localtuya/assets/46300268/e326b0b6-74cf-49e0-9696-3b444178083b) And restart HA then re-add your device


Manually adjust the existed configuration to:

Mode DP -> 102 HVAC Modes:

cool: "0"
heat: "1"
fan_only: "2"

FAN DP -> 103 FAN Speeds:

0,1,2,3

Preset DP -> 4 Presets:

"0": Program
"1": Manual
Hammerhand17 commented 3 months ago

Ok, done and working fine, just the temperature error left: image As you can see it shows 5,4ºC when It's really 27, and actual temperature shows 5,6ºC when it's really 28.

xZetsubou commented 3 months ago

Re-configure the device and change these

Precision (optional, for DPs values) -> 0.5 Target Precision (optional, for DP values) -> 0.5

Hammerhand17 commented 3 months ago

Re-configure the device and change these

Precision (optional, for DPs values) -> 0.5 Target Precision (optional, for DP values) -> 0.5

Perfect, now it works as expected!! Thanks!

Hammerhand17 commented 3 months ago

One more question: Can I start updating now to latest versions? it appears that I can update to 2024.5.0 but I don't want to lose the setup.

xZetsubou commented 3 months ago

The Master version are always ahead of any other version however I don't recommend to stick with it the changes fix a problems

for your case it was only configuration issue so it fine if you update to stable version 2024.5.0

Hammerhand17 commented 3 months ago

Ok then, Thanks again for your work!

gabrielhopkins commented 2 months ago

Re-configure the device and change these Precision (optional, for DPs values) -> 0.5 Target Precision (optional, for DP values) -> 0.5

Perfect, now it works as expected!! Thanks!

Thanks you very much - great integration @xZetsubou