Tuya integration showing wrong target temp on climate card

I know this is exclusively an American problem, but I have a Pioneer WYT mini split thats connected to the Tuya integration through the smart life app. Everything seems to be working fine except that it displays the target temp incorrectly. After examining the actual temps versus the displayed temps I’ve determined it is receiving the temp from the mini split in Fahrenheit, then performing the conversion from Celsius to Fahrenheit on that number, resulting in the incorrect value.

Is there a way to force HA or the Tuya integration to properly display the correct number. I can’t find a solution anywhere.

1 Like

I wanted to bring this back up as it is still an issue. I was hoping with the release of 2024.2 that it may have been resolved, but that is not the case. The Tuya Smart app (android) shows everything correctly and works fine. Pretty much is the same as the Pioneer Airlink app. However, the target temperature and the humidity are not working on the tuya integration for HA.

The humidity just shows 0% all the time. That may be because it doesn’t report that since I don’t see it anywhere in the app either.

The target temperature, from what I can tell, takes the reading from the app (which is in F), reads it as if it was in C, and then converts it to F again. For example, the app shows 70F. In HA, it reads it as 70C and converts it to F, giving you a reading of 158 ((70*9/5)+32).

Hoping someone can explain how to fix this. Thanks for any advise you can give.

the-buzz-man

I am having the same problem with other brands of HVAC devices through Tuya as well… This is a fresh install as of today.

I experimented, and if I set the HVAC to read in C, then HA shows the correct temperature in F. It looks like the logic is set to assume that the temp always returns in C, even if the unit is set to F.

How did you change it to C? I’ve made a change in Tuya Smart under “Me” and Settings/Temperature Unit, but it stays in F on the app.

So, I was able to set up a template sensor that would at least show me what the correct temperature the unit is set to. Below is the code I used:

{{ (state_attr('climate.den_ac', 'temperature')-32)*5/9 }}

I then set the “Display precision” to round off the temp and added it to my dashboard. See card below:

Is there any way to somehow put this into the actual climate entity code so it reports the correct temp and I don’t have to use the template sensor to do this?

Created an account just to post my answer to this as I have the same Celcius scaling issue.

Create 3 helpers

  1. Template Sensor for reading temperature
    {{ (state_attr('climate.existing_heater, 'current_temperature')-32)*5/9 }}
  2. Template Switch, leave it empty, this will be used to make the generic thermostat happy
  3. Generic Thermostat, use the above two helpers when configuring

This should now get you a climate.custom_heater entity that can be used in a thermostat card.

Create two automations

  1. Set custom thermostat values based on climate.existing_heater that triggers whenever a change is made to climate.existing_heater
  • I only cared about hvac_mode and set_temperature, but you can add more if your heater has them.
  • Use the Developer Tools in HA to see what attributes exist.
  • This allows any changes that are made on the heater directly or through another app to be applied to your custom heater.
alias: Mirror Existing Heater Settings to Custom Heater
description: ""
triggers:
  - trigger: state
    entity_id:
      - climate.existing_heater
conditions: []
actions:
  - action: climate.set_hvac_mode
    metadata: {}
    data:
      hvac_mode: "{{ states('climate.existing_heater) }}"
    target:
      entity_id: climate.custom_heater
  - action: climate.set_temperature
    metadata: {}
    data:
      temperature: >-
        {{ (state_attr('climate.existing_heater' ,'temperature')-32)*5/9
        }}
    target:
      entity_id: climate.custom_heater
mode: single

  1. Basically an inverse of above. Set existing_heater based on custom_heater
alias: Switch Custom Heater
description: ""
triggers:
  - trigger: state
    entity_id:
      - climate.custom_heater
    attribute: hvac_action
conditions: []
actions:
  - if:
      - condition: state
        entity_id: climate.custom_heater
        state: heat
    then:
      - device_id: 8a452d8ce05e17e217f0e516c3913edd
        domain: climate
        entity_id: 908a99c02fa49eb9d235c376a569ba57
        type: set_hvac_mode
        hvac_mode: heat
      - action: climate.set_temperature
        metadata: {}
        data:
          temperature: "{{ state_attr('climate.custom_heater,'temperature') }}"
        target:
          entity_id: climate.existing_heater
    else:
      - device_id: 8a452d8ce05e17e217f0e516c3913edd
        domain: climate
        entity_id: 908a99c02fa49eb9d235c376a569ba57
        type: set_hvac_mode
        hvac_mode: "off"
mode: single

Since both thermostat cards are reflecting each other, it’s best to only control the custom thermostat with correct units.

Tried this, getting this error when setting up the initial Template sensor. Am I doing something wrong?

Here’s a working configuration for the Friedrich Uni-Fit A/C.

climate.window_type_air_conditioner is the original
climate.window_a_c is the custom

Helpers

  1. Template Sensor

  1. Template Switch

  1. Generic Thermostat

Automations

Similar to the example above, but I disable mirroring to the custom A/C while updating the original to prevent the automations from canceling each other out. I also added a small delay so the manual A/C buttons and Tuya app work well in conjunction with HA.

alias: Mirror Existing A/C State to Custom A/C
description: ""
triggers:
  - trigger: state
    entity_id:
      - climate.window_type_air_conditioner
conditions: []
actions:
  - action: climate.set_temperature
    metadata: {}
    data:
      temperature: >-
        {{ ((state_attr('climate.window_type_air_conditioner', 'temperature') -
        32) / 1.8) | round | int }}
      hvac_mode: "{{ states('climate.window_type_air_conditioner') }}"
    target:
      entity_id: climate.window_a_c
  - if:
      - condition: state
        entity_id: climate.window_type_air_conditioner
        state: cool
    then:
      - action: climate.turn_on
        metadata: {}
        data: {}
        target:
          entity_id: climate.window_a_c
    else:
      - action: climate.turn_off
        metadata: {}
        data: {}
        target:
          entity_id: climate.window_a_c
  - delay:
      hours: 0
      minutes: 0
      seconds: 0
      milliseconds: 500
mode: single
alias: Mirror Custom A/C Temperature to Existing A/C
description: ""
triggers:
  - trigger: state
    entity_id:
      - climate.window_a_c
    attribute: temperature
conditions: []
actions:
  - action: automation.turn_off
    metadata: {}
    data:
      stop_actions: true
    target:
      entity_id: automation.mirror_hvac_state_to_custom_a_c
  - action: climate.set_temperature
    metadata: {}
    data:
      temperature: "{{ state_attr('climate.window_a_c', 'temperature') * 1.8 + 32.0 }}"
    target:
      entity_id: climate.window_type_air_conditioner
  - delay:
      hours: 0
      minutes: 0
      seconds: 0
      milliseconds: 500
  - action: automation.turn_on
    metadata: {}
    data: {}
    target:
      entity_id: automation.mirror_hvac_state_to_custom_a_c
mode: single
alias: Mirror Custom A/C OFF to Existing A/C
description: ""
triggers:
  - trigger: state
    entity_id:
      - climate.window_a_c
    from: cool
    to: "off"
conditions: []
actions:
  - action: automation.turn_off
    metadata: {}
    data:
      stop_actions: true
    target:
      entity_id: automation.mirror_hvac_state_to_custom_a_c
  - action: climate.set_hvac_mode
    metadata: {}
    data:
      hvac_mode: "off"
    target:
      entity_id: climate.window_type_air_conditioner
  - action: climate.turn_off
    metadata: {}
    data: {}
    target:
      entity_id: climate.window_type_air_conditioner
  - action: automation.turn_on
    metadata: {}
    data: {}
    target:
      entity_id: automation.mirror_hvac_state_to_custom_a_c
mode: single
alias: Mirror Custom A/C ON to Existing A/C
description: ""
triggers:
  - trigger: state
    entity_id:
      - climate.window_a_c
    from: "off"
    to: cool
conditions: []
actions:
  - action: automation.turn_off
    metadata: {}
    data:
      stop_actions: true
    target:
      entity_id: automation.mirror_hvac_state_to_custom_a_c
  - action: climate.turn_on
    metadata: {}
    data: {}
    target:
      entity_id: climate.window_type_air_conditioner
  - action: climate.set_hvac_mode
    metadata: {}
    data:
      hvac_mode: cool
    target:
      entity_id: climate.window_type_air_conditioner
  - action: automation.turn_on
    metadata: {}
    data: {}
    target:
      entity_id: automation.mirror_hvac_state_to_custom_a_c
mode: single
1 Like