tuya / tuya-home-assistant

Home Assistant integration for controlling Powered by Tuya (PBT) devices using Tuya Open API, maintained by the Home Assistant Community and Tuya Developer Team.
MIT License
879 stars 207 forks source link

Thermostat IAYz2WK1th0cMLmL report wrong temperature again on latest HA releases #849

Open ugoviti opened 2 years ago

ugoviti commented 2 years ago

Hi,

I'm sorry but I must reopen a fixed issue as reported in the #769

It was fixed with the PR https://github.com/home-assistant/core/pull/66715 and release of HA https://github.com/home-assistant/core/releases/tag/2022.2.9

I can't say when it's back, but in the latest release of HA 2022.9.6 It's report wrong temperature again (divided by 5 factor).

Screenshot_20220925_112742

Screenshot_20220925_113854

This is my diagnostic file:

tuya-55962a6e1fb8471a408e2358701c49f4-Soggiorno Termostato-1e624c121ce638d87af7fa43dd7e1c51.json.txt

any quick workaround?

Thanks for the support.

Kind Regards

Dafinx commented 2 years ago

Hi,

Same issue for me. Temp is divided by 5. I attached the diagnostic file.

BR, tuya-a13d2526c9a87a375f11bae2e0812920-Birou Giany-dc7a461d6db539dfb01cc48a90847043.json.txt

celsiusHF commented 2 years ago

The same issue for me with a Houzetek thermostat (recognized in HA as IAYz2WK1th0cMLmL). The standard instruction/status sets in Tuya IoT Cloud are wrong:

Code    Type    Values
switch  Boolean "{true,false}"

child_lock  Boolean "{true,false}"

temp_set    Integer {
                  "unit": "℃",
                  "min": 10,
                  "max": 70,
                  "scale": 1,
                  "step": 5
                  }
eco Boolean  "{true,false}"

upper_temp  Integer {
                    "unit": "℃",
                    "min": 0,
                    "max": 100,
                    "scale": 0,
                    "step": 5
                    }

From what I see in the actual device, and even in the Smart Life app, the temp_set range should be 5-35, and the upper_temp scale should be 1, if my assumption that the actual step in both temp_set and upper_temp should be equal to: step/10^(scale) --> 5/10^1 = 0.5, that is the increment I see in my hw thermostats and in SmartLife app (and even Google Home).

I've opened a support ticket in Tuya IoT Cloud. As I'm not quite confident they will resolve that, I have tweaked the script https://github.com/home-assistant/core/blob/aabd681d7e0470b8384da984199400232dfbf724/homeassistant/components/tuya/climate.py

and now it works as intended.

These are the changes I've made:

diff climate.py climate.py_orig
--- climate.py
+++ climate.py_orig
@@ -195,9 +195,9 @@
         # it to define min, max & step temperatures
         if self._set_temperature:
             self._attr_supported_features |= ClimateEntityFeature.TARGET_TEMPERATURE
-            self._attr_max_temp = self._set_temperature.max_scaled * 5
-            self._attr_min_temp = self._set_temperature.min_scaled * 5
-            self._attr_target_temperature_step = self._set_temperature.step_scaled 
+            self._attr_max_temp = self._set_temperature.max_scaled
+            self._attr_min_temp = self._set_temperature.min_scaled
+            self._attr_target_temperature_step = self._set_temperature.step_scaled

         # Determine HVAC modes
         self._attr_hvac_modes: list[str] = []
@@ -342,7 +342,7 @@
                 {
                     "code": self._set_temperature.dpcode,
                     "value": round(
-                        self._set_temperature.scale_value_back(kwargs["temperature"]/5)
+                        self._set_temperature.scale_value_back(kwargs["temperature"])
                     ),
                 }
             ]
@@ -363,7 +363,7 @@
             # rounding, Home Assistant doesn't need to round but we will always
             # need to divide the value by 10^1 in case of 0 as scale.
             # https://developer.tuya.com/en/docs/iot/shift-temperature-scale-follow-the-setting-of-app-account-center?id=Ka9qo7so58efq#title-7-Round%20values
-            temperature = temperature / 2
+            temperature = temperature / 10

         return self._current_temperature.scale_value(temperature)

@@ -389,7 +389,7 @@
         if temperature is None:
             return None

-        return self._set_temperature.scale_value(temperature) * 5
+        return self._set_temperature.scale_value(temperature)

     @property
     def target_humidity(self) -> int | None:

I will update when I have a response from Tuya.

celsiusHF commented 2 years ago

Or maybe it is just a trick from Tuya IoT Cloud to enforce the use of integers in the API calls

celsiusHF commented 2 years ago

@frenck , could you take a look at this issue ?

celsiusHF commented 2 years ago

Answer from Tuya engineer:

It can not be change ,Because the data point was defined by manufacture

klyushkov commented 2 years ago

tuya-af00004f730e56de4cfbc696a7a9f5af-Макс-c31fbd2d87b60f42bca998cce88f00a7.json.txt I have the same issue with my 8 thermostats (all of them are IAYz2WK1th0cMLmL).

I've tried old_tula integration as workaround, but it didn't help, now values are not divided by 5, but still wrong + I can't see some other devices =).

Will be glad to get a solution using official Tu yaHA integration.

p.s. help, the winter is coming...

Infeconex commented 1 year ago

Same issue here with brand new thermostats arrived this morning. @celsiusHF I was going to have a go with your workaround. Can I ask ...

(1) Where do I make these changes? I'm running Hass Supervised

(2) Am I right in assuming this is a global change? i.e. all Thermostat devices are affected if I do the above change? I have 4 other thermostats that report fine. If I make this change, that means their temps will report incorrectly, but these Tuya ones will be right. If so, maybe I can use an alternate lovelace card that allows me to change how the values are presented, or a template (I'm not even sure if either of those two are valid options!)

riscris commented 11 months ago

Screenshot_1 Screenshot_2 как исправить?

migitcheetah commented 11 months ago

I m also seeing this with my Electric Fireplace. The range is from 59F-95F but on home assistant it comes in as 139F-203F image

image

home assistant versions image

aniello70 commented 1 month ago

Ho lo stesso problema con termostato rileva con home Assistant temperatura errata come devo fare info