Smart Life (tuya) show wrong temperature

Yes!

Not now though, latest version works as is, but you need to set a divider.
However it’s still buggy, so I may do something like that again:

diff --git a/climate.py b/climate.py
index 6da15b0..6e93868 100644
--- a/climate.py
+++ b/climate.py
@@ -23,8 +23,7 @@ from homeassistant.const import (
     ATTR_TEMPERATURE,
     CONF_PLATFORM,
     CONF_UNIT_OF_MEASUREMENT,
-    PRECISION_TENTHS,
-    PRECISION_WHOLE,
+    PRECISION_HALVES,
     TEMP_CELSIUS,
     TEMP_FAHRENHEIT,
 )
@@ -157,9 +156,7 @@ class TuyaClimateEntity(TuyaDevice, ClimateEntity):
     @property
     def precision(self):
         """Return the precision of the system."""
-        if self._tuya.has_decimal():
-            return PRECISION_TENTHS
-        return PRECISION_WHOLE
+        return PRECISION_HALVES
 
     @property
     def temperature_unit(self):
@@ -201,7 +198,7 @@ class TuyaClimateEntity(TuyaDevice, ClimateEntity):
     @property
     def target_temperature_step(self):
         """Return the supported step of target temperature."""
-        return self._tuya.target_temperature_step()
+        return 0.5
 
     @property
     def fan_mode(self):
@@ -213,10 +210,24 @@ class TuyaClimateEntity(TuyaDevice, ClimateEntity):
         """Return the list of available fan modes."""
         return self._tuya.fan_list()
 
+    def tuya_set_temperature(self, temperature):
+        """Set new target temperature."""
+
+        # the value used to set temperature is scaled based on the configured divider
+        divider = self._tuya._divider or 1
+        temp_val = round(float(temperature) * 20.0) / 20.0
+        set_val = temp_val * divider
+
+        _LOGGER.info("Setting temperature to {} ({})".format(temp_val, set_val))
+        if self._tuya._control_device("temperatureSet", {"value": temp_val}):
+            self._tuya._update_data("temperature", set_val)
+        else:
+            _LOGGER.error("Temperature not set")
+
     def set_temperature(self, **kwargs):
         """Set new target temperature."""
         if ATTR_TEMPERATURE in kwargs:
-            self._tuya.set_temperature(kwargs[ATTR_TEMPERATURE])
+            self.tuya_set_temperature(kwargs[ATTR_TEMPERATURE])
 
     def set_fan_mode(self, fan_mode):
         """Set new target fan mode."""

Impossible to change target temp through HomeKit and HA as “bridge”

Thanks for this info.
Originally I had double values displayed (42C instead of 21C), but after changing the Temperature values divider from 0 (default) to 2 it started to show the correct value!

Yeah, even using Google Home it doesn’t seem possible.

See Smart Life (tuya) show wrong temperature it is still not correct, as it loses precision.

I created a pull request that let us override the temperature precision.
I hope it will be merged soon :slight_smile:

1 Like

Szia Csabi,

sikerült megoldani ezt a thermosztát problémát? megosztanád velem? napok óta küzdök…
Köszi
farkas.istvan.leo(kukac)gmail.com

Szia, nem. A topicban irtam, hogy talaltam azt a leirast es megrendeltem a mqtt zigbee illeszteshez a cuccokat. Kozben rajottem, hogy a radios termosztat esp kompatibilis, lehet, kiprobalom atasmotat.

All,

I understand that there are some issue with Tuya climate devices, especially related to precision used.
Unfortunately Tuya manage many different devices with different specification and in some case one fix broke functionality for another.
At this moment there are a couple of PR opened in TuyaHA and other opened in HA, some of them in conflict each other.
I don’t have Tuya climate device, but as codeowner of Tuya integration my objective is to have integration working fine for all.
I created some times ago custom integration Tuya Custom with the only scope to perform tests before creating PR in official integration and related library.
I just finished today to re-align this integration with my last changes released HA official component, so features provided are exactly the same, but perform test will be simplest. I also added some fixes for climate device based on issues open in the repository itself, but tester with climate device are required to validate the fixes.
My suggestion is to create PR there, I will be happy to review them together to find the best solution, than we will come back to official repository when everything is fine, avoiding any possible breaking change for device that doesn’t have any issue.

3 Likes

After adding divider into configuration, I can’t control temperature from HA

Logger: tuyaha.tuyaapi
Source: /usr/local/lib/python3.8/site-packages/tuyaha/tuyaapi.py:273
First occurred: 13:51:57 (2 occurrences)
Last logged: 16:03:55

control device error, error code is ValueOutOfRange
1 Like

same problem. following the thread

Hi,

Great job!
Only on more thing:
The HVAC_MODE seems to only show ‘Off’ or Auto. Anyone know how it can be persuaded to show ‘Heat’ when it is heating and maybe even ‘Idle’ when it is switched on but at target temp and hence not using power.

Is it possible to connect the device locally?

Thank you

1 Like

This might be an old post, but I faced the same issue
and found out that there is a simple solution without custom component or code changes

I’m using Home Assistant Core 2020.12.2, I guess it is the same for some older versions as well

In the integrations -> tuya -> options
Select your climate device under the option “Select the devices to configure…” and click submit.
This will forward you to a climate device settings screen

image
Then you can configure the “current temperature value divider”

Hope this helps :slight_smile:

9 Likes

Hi @ollo69

I followed your GitHub manual installation instructions and created the “custom_components” folder in my /config/custom_components/tuya_custom. I then copied your GitHub folder in to the sub directory. But after restating the server I could not find any “Tuya Custom” version in the Integrations menu…only the original Tuya version is present.

EDIT: my system is running the latest versions 2020.12.7 & HA OS 5.9

Is there some thing else that I have missed?

With the standard Tuya integration my ProTouch start thermostats don’t see any temperatures at all. Please see the screen shot from my HA instance. Does anyone have any suggesting?

I read 150 pages. I’ve tried all the ways. Isn’t it ridiculous that this problem still remains unsolved?

I got it working for me with the custom component integration “Tuya Custom” installed with HACS.

This is normally a browser cache problem. Clear the cache a try again

1 Like

Solving is in progress. There is one PR open in HA and one in TuyaHA library. As immediate work-around use Tuya Custom component.

3 Likes

Thanx @ollo69

I installed TUYA_CUSTOM from my mobile phone after uninstalling the standard Tuya integration. I then restarted my server and checked the thermostat overview page that I had previously created. Unfortunately its still not showing actual temperatures (just shows 0 degC) is all that is displayed. I can only use the cards to turn on (Auto) and off the heating systems. I changed the Tuya_custom settings as suggested in the earlier posts to halves and now when i move the green circular temperature set point it does show the setting from the Dashboard card however these are not retained when the thermostat is cycled on and off and on again.

When I edit the dashboard page and check the code for one thermostat I have the following:

type: thermostat
entity: climate.4220004198f4abba4650

Should that be all the code required to get temperature status from the thermostat?

Could you explain this issue more clearly?