Smart Life (tuya) show wrong temperature

Options are available from 0.118.1 so i must update…now works good

Hello all,
Good news for bht-6000 tuta/Beca thermostat.
With last update of home assistant 0.118.1 is possible to configure temperature type (centigrade or farenheit) and most important the divided factor for correct the problem like doubled temperature or 10x. Also is possible to set the polling time of update states. So finally is not necessary anymore to edit any line of climate.py.
All info there https://www.home-assistant.io/integrations/tuya

Hello,

when I change climat.py file line:
@property
def current_temperature(self):
temp = float(self.tuya.current_temperature())/10
return temp
“”“Return the current temperature.”""

The sensor have a status unavailabe in HA and wen I click on it I have an error " Faild to call service climate/set_havac_mode.‘TuyaClimateEntity’ object has no attribute "tuya’

What is wrong?

SOLVED, by changing a options in intergation

6 Likes

There is not this settings panel in my HA

go to Settings, then Integrations then Options in TUYA… once inside, select the menu of last line and choose your device… then you will see the view posted by Jakub

2 Likes

Still can’t figure out how to use halves precision with Moes BHT-002-GBLW

The divider settings do not affect which temperatures are displayed.
Device Moes BHT-002-GBLW. HASS 0.118.3.

Unfortunately this is still wrong when the device uses a divider of 2.0 as float values won’t be considered.

So I proposed this tiny PR for tuyaha https://github.com/PaulAnnekov/tuyaha/pull/54/

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