Smart Life (tuya) show wrong temperature

Home Assistant 2021.12.9

Hi there,
I have the latest HA version and the official Tuya plugin, unfortunately the thermostat shows wrong values, these would have to be multiplied by 5. How can I change that? thank you

2 Likes

Hi there!
it happens to me too

Hi There,

I have 7 generic thermostats and have added them in to the Tuya app so that I could automate them in HA. However the functionality seems basic to say the least. In the Developers tools I can only see the following attributes, just wondered if anyone knows how to get the ‘current_temperature’ as that would seem to be a minimum requirements for any “Smart” thermostat.

hvac_modes:
  - 'off'
  - heat_cool
min_temp: 4.1
max_temp: 104
target_temp_step: 0.1
current_temperature: null
temperature: 18
friendly_name: Upstairs Heating
supported_features: 1

‘current_temperature’ always shows “null” whether the thermostat is switched ON (heat_cool) or OFF (off) modes.

thank you for any guidance.

Hi colseven,

I got exactly the same problem as you in Home Assistant 2021.12.10

Here are the current attributes from the thermostate entity:

hvac_modes: off, heat_cool, heat_cool
min_temp: 0.1
max_temp: 5.9
target_temp_step: 0.5
current_temperature: 19.9
temperature: 3.4
friendly_name: Heizkörper rechts Wohnzimmer
supported_features: 1

The current_temperature is correct but the (target) temperature is devided by 5. Is it possible to manipulate this attribute?

Did you find a solution?

hello,

I have tuya installed on the home assistant but it didn’t create any folders and I can’t change the temperature, which is wrong, but does anyone else have this problem?

Tuya " old "- custom components
GitHub - andrey-yantsen/home-assistant-tuya-oldScreenShot_20220120182056

1 Like

ty works :slight_smile:

I’m experienced the same issues since I moved to the Official integration. I’m quite disappointed that a basic piece of a smart house cannot be supported and we have to patch stepping back to an unofficial integration (I don’t want to do that). I expect to see at least 4 entities for each thermostat (I’m using electrical heating): room temperature, floor temperature, setting temperature and on/off state. I hope someone will take care of this otherwise I can control just lights and switches. I hope someone from HA, like @balloob of @frenck can help us. This impact in HA usage and in my opinion it’s more relevant that improving media in HA. Thanks

4 Likes

I’m using the Tuya v2 to control two thermostats (brandname “Warmme”). They work and I can control the temperatures from HA. However the current_temperature is only updated after restarting HA or reloading the integration from the configuration->integrations screen. Would it be possible to script an automatic reload every few minutes? That would iron out the last wrinkle for me.

:thinking:

...
action:
  - service: homeassistant.reload_config_entry
    data:
      entity_id:
        -  thermostat.tuya

My auto refresh Tuya

Logs error
ScreenShot_20220318200436

configuration.yaml

system_log:
 fire_event: true

ScreenShot_20220318200511

Automations:

alias: TuyaAuto
description: ''
trigger:
  - platform: event
    event_type: system_log_event
    event_data:
      level: ERROR
      name: tuya_iot
condition:
  - condition: template
    value_template: '{{ "error while get mqtt config" in trigger.event.data.message[0] }}'
action:
  - service: homeassistant.reload_config_entry
    data: {}
    target:
      entity_id:
        - one_Tuya.device
mode: single

Restart HA

I have managed to get it working with a similar setup, thanks!

Am I retarded or WAHT?
HOW DID YOU GOT TO THIS MENU???

Having this on docker, Tuya Integrated, but wrong current temp

Verze core-2022.4.5
Typ instalace Home Assistant Container
Vývoj false
Supervisor false
Docker true

BUT I CAN NOT FIND THIS CONFIG…
Have czech translation. so only see an “System Options” on tuya and there is only something about actualizing device (T/F slider)

Thanks for help, Jan

What version doyou have, what type of instalation…i have grown grey on this…i don’t have it there

I’m sorry, don’t have “Configure” on Tuya, only advanced options, which goes to “Enable actualiztion for newly added…”, but no config…could you be so kind and make screenshot, where are you clocking on “Configure”?
…sorry I’m probably braindead, but can’t see it
Regards
Jan

In case if anyone have to divide the temp, this is what I did. In my case temp was 5 times higher than it should be and max temp was 10 times higher.

Home Assistant 2022.4.6

For Docker:
vi /usr/src/homeassistant/homeassistant/components/tuya/climate.py

1. Setting MAX temp to 35

From:

        if self._set_temperature:
            self._attr_supported_features |= SUPPORT_TARGET_TEMPERATURE
            self._attr_max_temp = self._set_temperature.max_scaled
            self._attr_min_temp = self._set_temperature.min_scaled
            self._attr_target_temperature_step = self._set_temperature.step_scaled

To:

        if self._set_temperature:
            self._attr_supported_features |= SUPPORT_TARGET_TEMPERATURE
            self._attr_max_temp = self._set_temperature.max_scaled / 10
            self._attr_min_temp = self._set_temperature.min_scaled
            self._attr_target_temperature_step = self._set_temperature.step_scaled

You can change the min too, if it’s not set to 5.

2. Setting step value (for setting the correct temp)

From:

                   "code": self._set_temperature.dpcode,
                    "value": round(
                        self._set_temperature.scale_value_back(kwargs["temperature"])
                    ),

To:

                   "code": self._set_temperature.dpcode,
                    "value": round(
                        self._set_temperature.scale_value_back(kwargs["temperature"]) * 5
                    ),

3. To show correct current temp

From:

        if self._current_temperature.scale == 0 and self._current_temperature.step != 1:
            # The current temperature can have a scale of 0 or 1 and is used for
            # rounding, Home Assistant doesn't need to round but we will always
            # need to divide the value by 10^1 in case of 0 as scale.
            # https://developer.tuya.com/en/docs/iot/shift-temperature-scale-follow-the-setting-of-app-account-center?id=Ka9
            temperature = temperature / 10

        return self._current_temperature.scale_value(temperature)

To:

        if self._current_temperature.scale == 0 and self._current_temperature.step != 1:
            # The current temperature can have a scale of 0 or 1 and is used for
            # rounding, Home Assistant doesn't need to round but we will always
            # need to divide the value by 10^1 in case of 0 as scale.
            # https://developer.tuya.com/en/docs/iot/shift-temperature-scale-follow-the-setting-of-app-account-center?id=Ka9
            temperature = temperature / 10

        temperature = temperature / 5

        return self._current_temperature.scale_value(temperature)

4. To show current set temp:

From:

        temperature = self.device.status.get(self._set_temperature.dpcode)
        if temperature is None:
            return None

        return self._set_temperature.scale_value(temperature)

To:

        temperature = self.device.status.get(self._set_temperature.dpcode)
        if temperature is None:
            return None

        temperature = temperature / 5

        return self._set_temperature.scale_value(temperature)

obraz

2 Likes

Hello Yozen,
thanks a million, got it working, thanks to you.
I had my modified climate.py in …/custom_components and was on version 2022.4.5. After copying script to /components with old version of HA, nothing happened, but after updating HA to current, everything works flawlessly.
Thanks again
SLMQ

Hello Yozen,
just addendum - I have tried to edit climate.py on upgraded version of HA again and nothing changed, so I will wait till next update to recreate container with new settings in config.
Did you have to delete an install HA againt after edit? Restart seems to be not sufficient.

Regards
Jan

1 Like

Found an open Issue on the Tuya integration and I’ve posted my issue there:

However just to repeat here because this is one of the top results when googling. This is utterly ridiculous and maddening.

If I run an API call against my AirCon unit I get the exact correct information:

{“result”:[{“code”:“switch”,“value”:false},{“code”:“temp_set”,“value”:24},{“code”:“temp_current”,“value”:26},{“code”:“humidity_set”,“value”:90},{“code”:“mode”,“value”:“cold”},{“code”:“windspeed”,“value”:“3”},{“code”:“c_f”,“value”:“C”},{“code”:“temp_set_f”,“value”:62},{“code”:“temp_current_f”,“value”:32},{“code”:“humidity_curre
nt”,“value”:55}],“success”:true}

And yet, what gets reported in Home Assistant via (and I will state because people here are using a variety) the OFFICIAL TUYA INTEGRATION:

hvac_modes:

  • ‘off’
  • heat_cool
  • cool
  • heat
  • dry
  • fan_only
    min_temp: -8.9
    max_temp: -0.6
    target_temp_step: 1
    min_humidity: 0
    max_humidity: 100
    fan_modes:
  • ‘1’
  • ‘2’
  • ‘3’
    current_temperature: 0
    temperature: -4.4
    humidity: 90
    fan_mode: null
    friendly_name: Cabin Air Conditioner
    supported_features: 13

Brilliant.

I’ve tried all various attempts of my least favourite subject, Math, to figure it out via custom integration to no avail. I get it close, but that’s with static figures, no idea if it relates once they move.

If anyone can see wood for the trees in the above figures and have a suggestion on the math, I’ll forever be in your debt. Until then, I guess I and we are at the mercy of Tuya and HA sorting this out.

hello,

i have the same problem, but i cannot find this file, climate.py to edit…

Home Assistant 2022.7.7
Supervisor 2022.07.0
Operating System 8.4
Frontend 20220707.1 - latest

1 Like