Smart Life (tuya) show wrong temperature

Hi Guys,

My thermostat has two sensors (temperature and UFH temperature)

self.tuya.current_temperature() is the temperature sensor

Is there another call where I can get the secondary sensor?

Thanks.

Check what states are exposed in homeassistant --> dev-tool -->states

@Fraschi Thanks for the help. Sorry I’ve been away.

The output in the states is below, I do not think it picks up the UFH sensor as I couldn’t find a second temperature variable in tuya.py.

Cheers.

current_temperature: 13
min_temp: 5
max_temp: 35
temperature: 8
target_temp_step: 1
friendly_name: Loft Bathroom
supported_features: 4097

Try to query if it’s supported in the generic tuya topic. As I remember the official tuya support has not full device support, but there was something related to supported_feature code that i din’t fully understand. Anyway, I’ve made a local support for, tuya based, bht-6000 thermostat BHT-6000 Thermostat (tuya) support , there are some hints on how to retrieve locally the device dps (data exposed by the device). The localtuya.py can be a good base, the code is pretty simple, probably You have to find the dps that reports the seconds temperature and then add a specific function to the py

Thanks Fraschi, I will read up on your notes on the BHT-6000 and have a poke around with the code.

1 Like
  1. in homeassistant custom_components folder create a folder named climate
  2. then homeassistant custom_components/climate folder:
    wget https://raw.githubusercontent.com/home-assistant/home-assistant/master/homeassistant/components/climate/tuya.py
  3. edit the custom_component as described above

Great way around this problem, but after update 0.88 is not working any more ???

Problem solved since update 0.88 the HA structure is change https://github.com/home-assistant/architecture/issues/141
to solved this change config to /custom_components/tuya/climate.py to overwrite tuya.
You still ned to change :

def current_temperature(self):
temp = float(self.tuya.current_temperature())/2
return temp

In the update 0.89 of HA it doesn’t work anymore… Did somebody solve it?

1 Like

Same kind of problem for me… The devices ( AIXI-SHS Wireless Wi-Fi thermostat plug sold by Amazon) are discovered 100% automatically but the temperature in HA is 10 times what it should be (I am using Smart_Life)… Solved it before (including 0.88) by a custom_component but is not working anymore with HA 0.89.1 … Any solution to fix this ?

with the new update, all the tuya files must be in homeassistant config /custom_component/tuya/, which means climate.py, cover.py, fan.py. light.py scene.py switch.py and a empty init file. With 0.89 you are no longer allow custom components to be partial overlays.
You still ned to change climate.py :
def current_temperature(self):
temp = float(self.tuya.current_temperature())/2
return temp

So I copied all native elements from tuya including the “init.py” file to config/custom_components/tuya (I tried an empty file for the init file but I got an error message and tuya was not loading anymore). Now it is working again with the right temperature displayed as I modified the climate.py file in the custom_components to get the correct temperature… Thanks !

Maybe someone can give insight… I have added all the TUYA files in the config folders and made the edits… but still showing double temp readings.

If the init.py file is empty the system does not see the A/C at all… this is the Costco TCL Window A/C

image

Hello… Can you confirm that you added all the TUYA files in the <config/custom_components/tuya> folder (because you are mentioning config folder)… You should have in the home-assistant.log when HA starts some warnings saying that “You are using a custom component for tuya which has not been tested by Home Assistant. This component might cause stability problems,…”

Yes I do believe I have all the files and have modified the climate.py as mentioned.

image
image

Hello… You should have strictly the same number of python files with the same names… In your list you have two init files one with underscore that you need to keep as is and another one init.py that should not exist for me (I know my post is maybe confusing)… Compare the <components/tuya/.py> with the <config/custom_components/tuya/.py>… than it should show the right temperature.

Removed the other init file and confirmed the files are all good. The devices are not found after editing the climate.py as posted.

from:

@property
def current_temperature(self):
“”“Return the current temperature.”""
return self.tuya.current_temperature()

to:

@property
def current_temperature(self):
temp = float(self.tuya.current_temperature())/2
return temp

I believe there are two issues here:

  1. for current temperature, you would want to use this:

@property
def current_temperature(self):
“”“Return the current temperature.”""
temp = float(self.tuya.current_temperature() or 0)/2
return temp

The issue here is that null is being read as the current temperature, and trying to divide null (which is not the same as 0) by two causes the failure and for the device to not be created when using the custom component.

  1. Current temperature isn’t really what we want here. I have the same costco TCL air conditioner, and the 158 you see is target temperature. It can be halved as well like this:

@property
def target_temperature(self):
“”“Return the temperature we try to reach.”""
“”“temp2 = float(self.tuya.target_temperature() or 0)/2
return temp2"”"
return self.tuya.target_temperature()

However, the issue I’m having, is that mine showed 153 before… and halved is 76.5. But, my AC is set to 68. So maybe someone else knows where those 8.5’ are coming from and/or how to correct them?

1 Like

Hi Im new here, just set the Tuya access, it found my thermostat just right, but it shows bad temperature. For example 23,5 Celsius shows as 235 Celsius. How to solve it, divided by 10?

Hello, which version a HA do you run (as the solution depends if it is before HA version 0.89 or after)… What 's your config ?

HI, I was using the latest version HA 0.92. My config for TUYA was simple, I got only these lines filled:

tuya:
username: MY_TUYA_USERNAME
password: MY_TUYA_PASSWORD
country_code: 420
plattform: smart_life

Then HA auto recognised all my themrostats.