Smart Life (tuya) show wrong temperature

Try this: go to this link and it should download the entire folder with all the files inside. Let me know if it works.
https://minhaskamal.github.io/DownGit/#/home?url=https:%2F%2Fgithub.com%2Fhome-assistant%2Fhome-assistant%2Ftree%2Fdev%2Fhomeassistant%2Fcomponents%2Ftuya

Hello,

I couldn’t get this to work at all, with the changes suggested, once I put the changes in the thermostat wouldnt report any temps at all.

I have fixed it by changing the values as below;

 @property
    def current_temperature(self):
        """Return the current temperature."""
        return (self._tuya.current_temperature()/2)

    @property
    def target_temperature(self):
        """Return the temperature we try to reach."""
        return (self._tuya.target_temperature()/2)

I guess it might be an bad indentation problem, it should go like this

    @property
    def current_temperature(self):
        """Return the current temperature."""
        return (self._tuya.current_temperature()/2)

    @property
    def target_temperature(self):
        """Return the temperature we try to reach."""
        return (self._tuya.target_temperature()/2)

Instead of this. There are some spaces missing in your first line. It might be the problem

@property
    def current_temperature(self):
        """Return the current temperature."""
        return (self._tuya.current_temperature()/2)

    @property
    def target_temperature(self):
        """Return the temperature we try to reach."""
        return (self._tuya.target_temperature()/2)

The spaces I think just got muddled with the copy paste.

Just to make sure it is clear for anyone having the same issues.

This is what is recommended but doesn’t work for me

temp = float(self._tuya.current_temperature())/2
        return temp

This is how I have set it and working great

return (self._tuya.current_temperature()/2)

Hi rnlascano, mi browser is blocking the page. Any dangerous filers there…? :wink: On the other hand I intallad tuya from dev>integration and HA recognize the device (I’m using the most recente HA version and coupled the thermostate via tuya App, defined as a “switch”). I have the same problems the others have: (1) temperature multiplied by 2 apparently (the device display 20 the lovelace 40), (2) I cannot set the temperature and (3) I can just switch off the thermostate and last (4) I have to use it with external underfloor sensor that is not detected.

On top of this in my custom-component no tuya directory is present.

Any suggestion? Thanks.

The link is secure, don´t worry. You have to download the folder to your computer and extract all the files; after that, create a folder inside custom-component folder, name it tuya, and then paste inside the newly created tuya folder all the files extracted from the link.
Once you are done, you have to edite climate.py as folows:

from

Copy to clipboard

    @property
    def current_temperature(self):
        """Return the current temperature."""
        return self._tuya.current_temperature()

    @property
    def target_temperature(self):
        """Return the temperature we try to reach."""
        return self._tuya.target_temperature()

to

Copy to clipboard

    @property
    def current_temperature(self):
        """Return the current temperature."""
        temp = float(self._tuya.current_temperature())/2
        return temp

    @property
    def target_temperature(self):
        """Return the temperature we try to reach."""
        temp = float(self._tuya.target_temperature())/2
        return temp

Rafael, thanks for your very helpful suggestion. I solved the wrong temp reading/setting and we have a working baseline. The next step will be to understand how to fully control the thermostate bacause the device itself has much more controls than the software.

1 Like

Excellent!. Let me know if you manage to fully control the thermostat please!

Rafael, the component seems work fine, shows 0.5 degrees, I can switch ON (but not displaying is “on”) and OFF (in this case it shows the state). Anyway as I told you from the app I can manage weeks programming and other stuff I cannot do on this component. I don’t know if I choose a different device in tuya app I can improve it. Thanks again.

I don’t think the tuya component supports the 7 day programming feature as it’s really not needed because you can just create automations to do the same thing.

OptimusGREEN, that’s true but if they do not exchange the data what if we have two different programs (one on the device and the other in Home Assistant) trying to manage the heating?

I think you just need to pick which one you find most convenient and disable the other.

Excellent solution, best of mine, but with this method we have to check sometimes if is a new update from de dev branch of github and re-dwonload the climate.py for modifyng. Shoul be better infomring the developers of tuya compnent to fix the problem

Opened an issue to home assistant core github repo: https://github.com/home-assistant/core/issues/37168

Hello,
in my configuration work without insert anythink in customize.yaml but i have to return to original code as follow:
@property
def target_temperature_step(self):
“”“Return the supported step of target temperature.”""
return self._tuya.target_temperature_step()

Hi , i don’t found PRECISION_WHOLE and PRECISION_TENTHS in tuya/device/climate.py . i’m running 0.113.0 . Anyone can help me ?
Thanks

In 0.113 I only had to copy the whole upstream tuya folder to custom_components, and do this change:

index 15cecef..c524de9 100644
--- a/climate.py
+++ b/climate.py
@@ -19,7 +19,7 @@ from homeassistant.components.climate.const import (
 from homeassistant.const import (
     ATTR_TEMPERATURE,
     CONF_PLATFORM,
-    PRECISION_WHOLE,
+    PRECISION_HALVES,
     TEMP_CELSIUS,
     TEMP_FAHRENHEIT,
 )
@@ -101,7 +101,7 @@ class TuyaClimateEntity(TuyaDevice, ClimateEntity):
     @property
     def precision(self):
         """Return the precision of the system."""
-        return PRECISION_WHOLE
+        return PRECISION_HALVES
 
     @property
     def temperature_unit(self):
@@ -130,12 +130,12 @@ class TuyaClimateEntity(TuyaDevice, ClimateEntity):
     @property
     def current_temperature(self):
         """Return the current temperature."""
-        return self._tuya.current_temperature()
+        return self._tuya.current_temperature() / 2.0
 
     @property
     def target_temperature(self):
         """Return the temperature we try to reach."""
-        return self._tuya.target_temperature()
+        return self._tuya.target_temperature() / 2.0
 
     @property
     def target_temperature_step(self):

That works as expected (in some cases you may need to change the divider from 2.0 to 10.0):

immagine

2 Likes

Hi,
Had problem with target temp displayed 10 times more that the actual value. Solved it by following steps from above. Unfortunately, discovered new problem with my thermostat build into AirCon. When set up target temperature from HA new value seems to not arriving to my AirCon unit. Any Idea how to troubleshoot this?

I’ve been fighting with this for several days and I can’t work out the conversion. It seems like it keeps changing.

The default values (with a stock Tuya installation) are

  • Set Temp = 32.6F

The actual temps are:

  • Set Temp = 38.3F

This gives a conversion of:
32.6-32 = 0.6
0.6*10 = 6
6+32 = 38
Close Enough…

However, if I change the climate.py file to this:

    @property
    def current_temperature(self):
        """Return the current temperature."""
        return (((self._tuya.current_temperature()-32)*10)+32)

I get -480.5F…

EDIT: I think I finally got it. I had to force the units to Celsius even though my InkBird is set to Fahrenheit. Then I had to change climate.py to this:

    @property
    def current_temperature(self):
        """Return the current temperature."""
        return (((self._tuya.current_temperature() * 10) * (9/5)) + 32)

Hi,
I’m running version 0.116.4

  1. When I create cataloge in custom and copy files after restart Tuya component dosn’t work at all.
  2. I’m using Celcius. I have radiators valves witch shows 198 degrees and thermostate for electric heater witch show 48 degrees. In the same time one climate show temperature x10 and second x2. How should be climate.py modified in this case?
1 Like