home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
72.11k stars 30.18k forks source link

tuya thermostat Temperature still wrong after latest update #66853

Closed Photogad closed 2 years ago

Photogad commented 2 years ago

The problem

You can see below what it reports in SmartLife vs. Home Assistant

Screenshot_20220218-230756_Home Assistant Screenshot_20220218-231142_Smart Life

What version of Home Assistant Core has the issue?

2022.2.9

What was the last working version of Home Assistant Core?

2022.2.7

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Tuya

Link to integration documentation on our website

https://www.home-assistant.io/integrations/tuya/

Diagnostics information

tuya-6e1a4ae19b74756253472cd31dae3077-Garage Tower Heater-29e4efe2c63a7c77d1de1fb9d91f5c57.json.txt

Example YAML snippet

Not sure

Anything in the logs that might be useful for us?

Not sure

Additional information

Nope

probot-home-assistant[bot] commented 2 years ago

tuya documentation tuya source (message by IssueLinks)

probot-home-assistant[bot] commented 2 years ago

Hey there @tuya, @zlinoliver, @metisu, @frenck, mind taking a look at this issue as it has been labeled with an integration (tuya) you are listed as a code owner for? Thanks! (message by CodeOwnersMention)

nelsonamen commented 2 years ago

IMG_20220219_041907

Photogad commented 2 years ago

I suppose here is problem? Also it should be heat only, not heat_cool.

"entity_id": "climate.garage_tower_heater", "state": "off", "attributes": { "hvac_modes": [ "off", "heat_cool" ], "min_temp": 140, "max_temp": 187, "target_temp_step": 1.0, "swing_modes": [ "off", "on" ], "current_temperature": 115, "temperature": 140,

Neowonder-cell commented 2 years ago

The same problem here. The target temperature multiplied by 5 after upgrading to 2022.2.9 (It was multiplied by 10 after upgrading to 2022.2.8)

image

RaJeronimo commented 2 years ago

Still multiplied by 5 for target temp in update 2022.2.9 Magnum floor thermostat

Device Information Product Name ET_8A Device ID ... Product Category wk

debugging screen in tuya iot says 150 ( 15 ℃)

Strange thing is the status section in HA integration diagnostics is correct:


        },
        "status": {
          "mode": "hot",
          "temp_set": 150,
          "temp_current": 170,
          "c_f": "C"

image

image

maxkrok commented 2 years ago

Yes.. i confirm the same.. but it is not "temperature" it is "target temperature" problem

frenck commented 2 years ago

@maxkrok so it is not the same?

maxkrok commented 2 years ago

@maxkrok so it is not the same?

Not the same comparing to the title of issue. But the same with people are reporting on their screenshots

Photogad commented 2 years ago

@frenck in my OP screenshot you can see actual target temp is 65, but HASS reports 140. I don't know where people are getting 5x multiplication from, this is 2.15x multiplication on my end unless I am misunderstanding.

Also, "actual temp" (reported by thermostat) is multiplying by 2.62x or something

Photogad commented 2 years ago

Please note that this don't affect all Tuya based heater. I have two of them (one is a HeatStorm brand, the other Atomi brand). The HeatStorm brand one reports correctly in HASS.

Screenshot_20220219-125830_Home Assistant

nelsonamen commented 2 years ago

tuya-fa17395f972aa0ee64ede486a79f3c48-Termostato Garza-ee2253b3cdee89dc8ed1239296740616.json.txt 18 C is 90 C....

maxkrok commented 2 years ago

I don't know where people are getting 5x multiplication from

I have 5x multiplication.. My thermo valve target temp is 20 С and in HASS it is shown as 100 C... 100/20=5 This is happening after 2.8 core update and on 2.9 is still broken... изображение 23,5 is current temperature изображение

heinoldenhuis commented 2 years ago

Hi all,

Seems I have also the same problem. Previously seemed it worked ok in version 2022.2.7. In 2022.2.8 and 2022.2.9 the Target temperature and Current temperature are 5 times higher then expected.

afbeelding

afbeelding

Please let me know if I could help.

maxkrok commented 2 years ago

Previously seemed it worked ok.

Definitely it was ok on 2.7 core version..

heinoldenhuis commented 2 years ago

Previously seemed it worked ok.

Definitely it was ok on 2.7 core version..

You are correct, I have updated my comment. Tested both versions (2022.2.7 and 2022.2.8) as a custom component.

iqueban commented 2 years ago

Hi! I just upgraded from 2021.12.10 to 2.9 and I have the same problem

Screenshot 2022-02-20 11 37 03

johnvanderster commented 2 years ago

Here the same. 2.7 okay, 2.8 and 2.9 not anymore. I had to upgrade because of SamsungTV token update image

starkillerOG commented 2 years ago

Same problem here: 5x multiplication due to the "step": 5 reported. status info in debug is correct (10x as specified by "scale":1): from diagnostics:

    "status": {
      "switch": true,
      "temp_set": 100,
      "temp_current": 295,
      "mode_eco": true,
      "lock": false
    },

from diagnostics:

      "temp_current": {
        "type": "Integer",
        "value": {
          "unit": "\u00b0C",
          "min": 0,
          "max": 500,
          "scale": 1,
          "step": 5
        }
      },

while the status is 5x to high (from diagnostics):

         "state": {
            "entity_id": "climate.xxxxxxxx",
            "state": "heat",
            "attributes": {
              "hvac_modes": [
                "off",
                "heat"
              ],
              "min_temp": 25.0,
              "max_temp": 175.0,
              "target_temp_step": 0.5,
              "current_temperature": 147.5,
              "temperature": 50.0,
              "icon": "mdi:xxxxxxx",
              "friendly_name": "xxxxxxxxx",
              "supported_features": 1
            },

No update available for the device. Was working in HomeAssistant 2022.02.07, not working in 2022.02.08 and 2022.02.09

Santanachia commented 2 years ago

@frenck, you wrote:

Reason for this change complying with Tuya's official documented sources.

2022.2.7 worked (and still works) correctly 2022.2.9 works wrong

So it is not a change on Tuya's side that causes the error.

frenck commented 2 years ago

I wrote a bit more, did you read it?

Tuya updated the documentation, which I linked as part of the comment you are only partially quoting; Our previous implementation was incorrect. We now comply.

Do you think our implementation is incorrect? Could you point out the part of the logic that isn't correct in that case?

Please note, Tuya sells chips and software products, manufacturers can customize those. We do not (and cannot at this time) support that. If your product doesn't work as specified by Tuya (and thus is customized by the manufacturer), there is not much we can do.

maxkrok commented 2 years ago

Why to break a working functionality and then gives big lectures about high matters? Please repair the broken logic, which we reported.

Santanachia commented 2 years ago

I read the rest of what you wrote and looked at the documentation. Unfortunately this documentation does not match the reality. You can see it well at iot.tuya.com image temp_current = 190 (19°C) temp_set = 170 (17°C)

frenck commented 2 years ago

@maxkrok Why to break a working functionality and then gives big lectures about high matters? Please repair the broken logic, which we reported.

Sorry, that doesn't sound reasonable and oddly demanding in many ways. Do you suggest breaking others to fix your use case specifically?

I think it makes way more sense Home Assistant to follow the standard, so most things just work as expected.

Anyways, I'm happy to see a contribution that fixes it for all cases.

frenck commented 2 years ago

I read the rest of what you wrote and looked at the documentation. Unfortunately this documentation does not match the reality. You can see it well at iot.tuya.com

That would in that case be a manufacturer-specific implementation. If you provide the diagnostics file, I'm happy to show you the calculation and why your device is probably not working according to standards set by Tuya (not Home Assistant).

Santanachia commented 2 years ago

@frenck I have attached the file in the issue you closed.

I am perfectly aware of where the values presented come from, I can apply the formula you indicated, but I emphasize: 2022.2.7 worked correctly, 2022.2.9 works incorrectly. The only place where there has been a change is in the HA code.

frenck commented 2 years ago

2022.2.7 worked correctly, 2022.2.9 works incorrectly.

That might be true, the other way around will be the case for many others. The calculation was incorrect, and we fixed that.

If your device worked because of a bug, that is unfortunate, but that is not something we do anything about 🤷

If your device is not working correctly, I recommend contacting Tuya (you can submit a support ticket when logged in into your Tuya IoT account). We cannot change your device.

Santanachia commented 2 years ago

in short, you write that I spent $$$ on equipment that works properly with HA and then you change the code and leave me alone without support?

Santanachia commented 2 years ago

@frenck Could you at least add somewhere a parameter that could be used to correct these values?

augard commented 2 years ago

@frenck That seams very strange, i have two different valve brands, and both are affected with same issue. At least add the value to configuration.

maxkrok commented 2 years ago

If your device worked because of a bug, that is unfortunate, but that is not something we do anything about 🤷

Who said that is was a bug? Ok.. now it is clear that different tuya models works with different quotients So we need some customization .. How to add this?

maxkrok commented 2 years ago

Do you suggest breaking others to fix your use case specifically?

I do not think that someone has correct way of work of this topic. Even if someone does we do not have evidence of that or even if we have, then what is the ratio between who has working and who has broken functionality? If broken is for more people - then it is broken. Here I do not see anyone with working way..

Did anybody complaine on this topic before broken core 2.8 ??? Links? Proofs?

lazovit1937 commented 2 years ago

I have problem with Beok termostat

frenck commented 2 years ago

Could you at least add somewhere a parameter that could be used to correct these values?

@Santanachia That would require device or entity options, which is not a known construct in Home Assistant at this point (we only have integration level options, which won't work when having multiple thermostats).

Who said that is was a bug?

@maxkrok, feel free to check the documentation here on how the calculation works: https://developer.tuya.com/en/docs/iot/datatypedescription?id=K9i5ql2jo7j1k#title-1-Example

I do not think that someone has correct way of work of this topic. Even if someone does we do > not have evidence of that or even if we have, then what is the ratio between who has working > and who has broken functionality? If broken is for more people - then it is broken. Here I do not see anyone with working way..

Did anybody complaine on this topic before broken core 2.8 ??? Links? Proofs?

@maxkrok Wow, I would ask you to tone down a bit now, since you are now trying to motivate people to bring out pitchforks (figurative speaking).

You can look at the issue history here in our issue tracker, the related pull requests, and even the original Tuya repo, to find tons of references.

We did not change and made this bugfix because of simply documentation, we also had tons of bug reports. Once it was confirmed by Tuya that it was indeed incorrect, we have adjusted the calculation to follow specifications. Sorry to hear it causes problems for your use case.

That said, I (and everybody else here in this issue) will be happy to receive contributions to make things better. That said, I don't see a short-term possibility for that myself.

frenck commented 2 years ago

@Santanachia Your calculation is incorrect here, as the scale is 0 and not 1 as you did in your calculation. Using your dump there with the calculation would be: (2379 x 1) ÷ (0 × 10^1) = 2379V

Santanachia commented 2 years ago

@frenck You're right. My mistake.

maxkrok commented 2 years ago

@maxkrok, feel free to check the documentation here on how the calculation works: https://developer.tuya.com/en/docs/iot/datatypedescription?id=K9i5ql2jo7j1k#title-1-Example

Ok, thanx.. Could you give a hint how and where in HASS recalculate Tuya current_temperature in a way I need ? Which place in code?

frenck commented 2 years ago

@maxkrok The Integer data type handling and its calculations for all Tuya numeric values, can be found here: https://github.com/home-assistant/core/blob/c496748125b811ef5437ad666d21c09025e0967f/homeassistant/components/tuya/base.py#L20

Santanachia commented 2 years ago

@frenck

we only have integration level options here's a start. Since previously all devices were working fine for me and now they are all working incorrectly, adding at the integration level temp_current_multiplier and temp_set_multiplier would fix all my readings at once without affecting others.

frenck commented 2 years ago

@Santanachia That should not (and will not become) an integration level option. If you have 2 thermostats that need different multipliers, that will not work.

As said, we don't have a concept of device or entity level options in Home Assistant at this point, thus such an option won't be provided right now.

Santanachia commented 2 years ago

Knowing that all devices of a certain type work incorrectly, couldn't you add a correction per product_id?

frenck commented 2 years ago

With 400K+ SKU's that isn't an option and unmaintainable.

Please, if your device is not functioning according to specification, contact Tuya.

Santanachia commented 2 years ago

Please, if your device is not functioning according to specification, contact Tuya.

it doesn't work like that. From my experience so far I can say that Tuya will reply "API is only transmitting data from the device, contact the manufacturer" and the manufacturer will reply "it's the device's fault, please complain to the seller". :(

You are a representative of a large group. Could you please contact Tuya on behalf of all of us?

frenck commented 2 years ago

You are a representative of a large group. Could you not contact Tuya on behalf of all of us?

I'm in regular contact with Tuya and we are in agreement it will be impossible to support all devices as they can be tuned/modified by the manufacturer to be non-standard.

starkillerOG commented 2 years ago

@frenck I noticed that the values in the Tuya app are displayed correctly while in HomeAssistant since 2022.02.08 the values are 5x to high due to a apperently incorrect "step" value reported by the device (apperntly a firmware bug). Why are the values displayed correctly in the Tuya app? Does the Tuya app use a diffrent protocol/API then the one beeing used by HomeAssistant? Or does the Tuya app use a diffrent calculation than HomeAssistant?

Since somehow the Tuya app knows how to properly convert the values from the device, it cannot be soly a problem of the device firmware. So eather a fix schould be possible in the Tuya API side or in the HomeAssistant side (even if the current device reports a wrong step value somehow the Tuya app knows how to deal with it).

Edit: @frenck could you possibly discuss the differnce between the API and the Tuya app with Tuya since you have contacts there?

frenck commented 2 years ago

I noticed that the values in the Tuya app are displayed correctly while in HomeAssistant since 2022.02.08 the values are 5x to high due to a apperently incorrect "step" value reported by the device (apperntly a firmware bug). Why are the values displayed correctly in the Tuya app?

The overlay displayed in the Tuya App can be customized by the manufacturer.

This also is visible with e.g., 2 bulb from different manufacturers being displayed differently.

could you possibly discuss the differnce between the API and the Tuya app with Tuya since you have contacts there?

Already answered that above.

maxkrok commented 2 years ago

@frenck https://github.com/home-assistant/core/blob/c496748125b811ef5437ad666d21c09025e0967f/homeassistant/components/tuya/base.py#L20

this is a wrong place of code.. the correct place is in

https://github.com/home-assistant/core/blob/c496748125b811ef5437ad666d21c09025e0967f/homeassistant/components/tuya/climate.py line 383 temperature = self.device.status.get(self._set_temperature.dpcode)

if somebody has error than you have add the needed calculations

temperature = self.device.status.get(self._set_temperature.dpcode) / 5

for me works fine.. but this is urgent patch..

the correct way is to divide on variable of "scale", which i have = "5"... but I don't know the name of this variable... will continue the back engineering of the "correct new version" of tuya component or core... i'm not sure now... what they broke exactly...

frenck commented 2 years ago

this is a wrong place of code..

It's not, you are hacking a workaround in the wrong place of the code now.

starkillerOG commented 2 years ago

@frenck maybe I missed it, but could you explain where/what the proper way of reporting a firmware bug in a Tuya device is? Schould make a ticket via service.console.tuya.com, what catogory schould I use? Or do I need to contact the manufacturer of the specific device?

maxkrok commented 2 years ago

It's not, you are hacking a workaround in the wrong place of the code now.

ok.. you know better.. please tell me the name of the variable, I should put instead of the constant "5" in my code.. this i believe will work for 99% of people, who are suffering now from "new correct version"

BTW my patch works only to show the target_temperture, but if I try to change it than it works as the new atrget_temperature is divided to 5 again.. for example from 100 dergees it becomes - 20, and after changing to 25 becomes 5... so it is broken very seriously