Smart Life (tuya) show wrong temperature

Hi guys,
I find so easy to add all TUYA devices just inserting the tuya account details… and most of many thermostats work correctly… just one model (by another company) has this issue.
How can I fix it without adding too much coding?
Thanks

Easiest solution is to get a new thermostat, like the ones you have. :slight_smile:

The other solution is to create a custom component of the tuya component (copy the files from the tuya component is the custom_components folder, rename the folder to something like tuya-float, and make the modifications above. No coding, just editing the files).

Since you have thermostats that are working fine and one that has a problem, you need two different components. The modifications above don’t allow for two thermostats with different division options (I hope that @rogermiret will add that to his Pull Request).

Ciao Marcel, thanks for your reply.
well… the ones that work are valves’ component of heating… the one with the issue is the thermostat.
So, thermostat must work correctly… I cannot configure only the thermostat with a different profile? any help? Can I configure it within my LAN as component out of Tuya cloud? thanks for support

Hello All,

I have done and tried what the manual says but with no luck. I read most of your comments and tried everything with no luck. I added the HACS from the Github site. Put all the file structure that you are suggesting (https://bit.ly/2XR0SN1), but the problem is when i put the manifest.json file i get the following error.

When i take it off i get the temperature doubled eg 40 C. I am using a thermostat (https://www.aliexpress.com/item/4000265648461.html?spm=a2g0s.9042311.0.0.292a4c4d0t8Pfc)

I am running the HA on VMware and i am at version 0.108.6
I am eager to any suggestions,
Thanks

So I just put my AC unit back in as the temps are rising, and I took the time to figure out what was going on. I mapped the results from HA/Tuya and what the AC was showing:

162 = 72’
160 = 71’
158 = 70’
156 = 69’
154 = 68’
153 = 67’
151 = 66’

After a little algebra, I figured out that that my results reminded me of an equation I already knew:
(C × 9/5) + 32 = F

So, it looks like Tuya was returning the result in Fahrenheit, but assuming it was Celsius and converting that value to Fahrenheit.

My fix in tuya/climate.py was to change:

     @property
     def temperature_unit(self):
         """Return the unit of measurement used by the platform."""
         unit = self.tuya.temperature_unit()
         if unit == "FAHRENHEIT":
             return TEMP_FAHRENHEIT
         return TEMP_CELSIUS

To:

     @property
     def temperature_unit(self):
         """Return the unit of measurement used by the platform."""
         unit = self.tuya.temperature_unit()
         return TEMP_FAHRENHEIT
1 Like

Mi thermostat was working fine up until a few updates before, now i have the target and current temperatures doubled again, and aplying the modifications in climate.py does nothing.
And i now see that there is new custom component files (https://github.com/home-assistant/core/tree/dev/homeassistant/components/tuya). Are these the ones i have to download and modify?. Any help would be appreciated!!.

Mi thermostat was working fine up until a few updates before, now i have the target and current temperatures doubled again, and aplying the modifications in climate.py does nothing.
And i now see that there is new custom component files (https://github.com/home-assistant/core/tree/dev/homeassistant/components/tuya ). Are these the ones i have to download and modify?. Any help would be appreciated!!.

Overwrite the tuya folder in custom components with the new tuya component from GitHub repo.

Then edit climate.py

from

    @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

    @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

Please note that Tuya configuration is now done via frontend (Configuration -> Integrations in the UI, click the button with + sign and from the list of integrations select Tuya)
So remove Tuya code from configuration.yaml

Many thanks for your work done on Tuya integration within HA. Now it displays the right temperature in HA and after modification of target_temperature_step I am able to set teperature to half degree C steps.

Thanks man!. Working just perfect!

Hi I just setup Tuya configuration from Configuration → Integrations. I registered my Thermostat there sucess, however I have the temperature double issue, my appologies but I couldn´t fine the climate.py file to do the change that you mention as workaurond. Can you please support me how to find it or solve this issue
Best Regards

You have to create a folder named “tuya” inside custom components folder, then download inside tuya folder the files from Github repo, as described in post #93 by yashijoe (i did exactly as he sasys, step by step, and it worked like a charm). Then you´ll find climate.py inside tuya folder.

Thanks Rafael for your reply, but how can I download these files? It tried as “save link as” but the file saved is not the same if I click on climate.py for instance
Best regards

ahora se integra desde integraciones

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