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
71.08k stars 29.74k forks source link

MoesGo WiFi Thermostat is not properly controllable using the new Tuya integration #57184

Closed andrey-yantsen closed 2 years ago

andrey-yantsen commented 2 years ago

The problem

I have 4 thermostats, and all of them not only report incorrect temperature but also do not allow to change the operation mode from HASS. The operation mode is always off, and the temperature is 5 times less than set on the thermostat.

With the previous version, everything was warning like a charm.

What is version of Home Assistant Core has the issue?

2021.10.0

What was the last working version of Home Assistant Core?

2021.9.7

What type of installation are you running?

Home Assistant Container

Integration causing the issue

Tuya

Link to integration documentation on our website

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

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

I tried collecting the device info/specifications as described in https://github.com/tuya/tuya-home-assistant/wiki/How-to-get-the-log, but the current logs do not show any info like this.

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

Hey there @tuya, @zlinoliver, @metisu, 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)


tuya documentation tuya source (message by IssueLinks)

rotem925 commented 2 years ago

I have the same issue. Not controllable. Status not updated and the temperature is 0.

andrey-yantsen commented 2 years ago

Here's the "instruction set" as displayed in Tuya IoT ("status set" is the same):

image

Product Category is wk.

In Tuya IoT I can see the temperature as double the real value (i.e. I see 40º when the thermostat is set to 20º), but in the SmartLife app, the temperature is displayed correctly.

OptimusGREEN commented 2 years ago

similar issue here. real target temp is 20 and integration says 4, real current temp is 20.5 and integration says 0

cybermerlo commented 2 years ago

exact same issue here

alexanderznamensky commented 2 years ago

same issues with MoesHouse BHT-002-GBLW WiFi thermostats and SASWELL SEA801 / SASWG-01-RF-WiFi thermostats:

andrey-yantsen commented 2 years ago

For the time being, I copied the old integration into a custom component you can install with HACS: https://github.com/andrey-yantsen/home-assistant-tuya-old.

Keep in mind: it will stop working in the next month or two when Tuya disables their old API completely. But right now, it works and let you update to the fresh HA release :)

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

tuya_v2 documentation tuya_v2 source (message by IssueLinks)

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, 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)

jone9618 commented 2 years ago

I have the same issue

rafalg7 commented 2 years ago

related issues raised on tuya repo: https://github.com/tuya/tuya-home-assistant/issues/547 https://github.com/tuya/tuya-home-assistant/issues/535 https://github.com/tuya/tuya-home-assistant/issues/361

frenck commented 2 years ago

The operation mode is always off,

This has been fixed in the current development version of Home Assistant. The climate integration had some serious rewrites for the upcoming release.

Unfortunately, I was not able to verify if the temperature issue has been resolved. This requires someone running Home Assistant dev or nightly builds (or wait until the next beta or next release).

andrey-yantsen commented 2 years ago

Hey @frenck! Thanks for the update!

I just tried the latest dev build available in docker (2021.11.0.dev20211016), and actually, it's become a bit worse than with stable version :)

Now I can turn the thermostat off and on, but it's pretty much all I can do:

frenck commented 2 years ago

Now I can turn the thermostat off and on, but it's pretty much all I can do:

Hehe well that is better than unable to do it 😄

For the other issues, unfortunate. But, there is room for fixing stuff!

If you log in, into the IoT cloud of Tuya, go to the device debugging for your thermostat, could you provide me with a dump of the following:

With that information, I should be able to create a reproduction.

Help is greatly appreciated 👍

../Frenck

andrey-yantsen commented 2 years ago

@frenck you can find everything below; I hope it will help you. In any case — I'll be happy to help with the testing/debugging.

P.S. I'm a bit paranoid, so I masked the device ID a little; feel free to poke me if you need the full one :)

Product Name: 柏益温控器(采暖) Device ID: 4231005224a16039%%%% Product Category: wk Device Status: Online Activated At: 2021-05-06 14:41:20 Sub-Device or Not: No


Control:

The real set temperature on the thermostat is 23º. The current temperature is 22.5º.

[
  {
    "code": "switch",
    "value": true
  },
  {
    "code": "child_lock",
    "value": false
  },
  {
    "code": "temp_set",
    "value": 46
  },
  {
    "code": "eco",
    "value": false
  },
  {
    "code": "upper_temp",
    "value": 45
  }
]

Standard instruction set:

Code Type Values
switch Boolean "{true,false}"
child_lock Boolean "{true,false}"
temp_set Integer { "unit": "℃", "min": 10, "max": 70, "scale": 1, "step": 5 }
eco Boolean "{true,false}"
upper_temp Integer { "unit": "℃", "min": 0, "max": 100, "scale": 0, "step": 5 }

Standard status set:

Code Type Values
eco Boolean "{true,false}"
temp_set Integer { "unit": "℃", "min": 10, "max": 70, "scale": 1, "step": 5 }
switch Boolean "{true,false}"
child_lock Boolean "{true,false}"
upper_temp Integer { "unit": "℃", "min": 0, "max": 100, "scale": 0, "step": 5 }
frenck commented 2 years ago

@andrey-yantsen Could you add the real temperature that shown in the app/display for the temperatures shown in the above debug data?

andrey-yantsen commented 2 years ago

@frenck yup, sorry, I forgot about it. Added to the original comment. set=23º, current=22.5º.

cybermerlo commented 2 years ago

Thanks Frenck for all your work

lucaxxaa commented 2 years ago

...same problems. We hope on @frenck resolution

frenck commented 2 years ago

Well, I have some more information. As it seems, this device has customizations, specifically for this manufacturer/device. Thus isn't supported/being able to support the cloud API (according to Tuya).

This makes it hard to implement. From an API consumer perspective (Home Assistant), we currently do not have a way to differentiate between this device and others.

I've added some extra information in the upcoming Home Assistant release, that might help to find and implement a solution. But this means for 2021.11, this issue won't be fixed.

andrey-yantsen commented 2 years ago

@frenck, thanks for the update anyway.

Any chance you can add some temporary ugly workaround for 2021.11? Like an option to add an attribute __tuya_multiplier for a thermostat entity via customizations. If Tuya decides to shut down the old API before the fix is ready — everybody using the affected thermostats will have to update their automation to adjust the temperature.

P.S. I wonder how the Smart Life app works appropriately while the API has no idea about the multiplication. Also, I'm surprised that the temperature displayed in HA has to be multiplied by 5, while the temperature visible in Tuya IoT debug has to be divided by 2 to get the correct temperature :)

frenck commented 2 years ago

Any chance you can add some temporary ugly workaround for 2021.11?

No, that is not something we accept or do.

andrey-yantsen commented 2 years ago

Well, that's understandable, but I had to try :)

Thanks!

P.S. Don't hesitate to poke me if you'll get any ideas on how I can assist here.

alexanderznamensky commented 2 years ago

Hi All! Looks like there is still no solution for correct working of thermostats?

paulius2k commented 2 years ago

Hi, I also need this one to work (for BHT-002-GCLW).

According to these tickets, it's not very optimistic: https://github.com/tuya/tuya-home-assistant/issues/361 https://github.com/tuya/tuya-home-assistant/issues/502 https://github.com/tuya/tuya-home-assistant/issues/676 https://github.com/tuya/tuya-home-assistant/issues/675 https://github.com/tuya/tuya-home-assistant/issues/670 https://github.com/tuya/tuya-home-assistant/issues/547 https://github.com/tuya/tuya-home-assistant/issues/542 https://github.com/tuya/tuya-home-assistant/issues/535 https://github.com/tuya/tuya-home-assistant/issues/502

The main problem for me is that current_temperature is not reported at all.

paulius2k commented 2 years ago

@frenck : I have just found out from Tuya support, that current_temperature value from BHT-002 is actually sent in parameter upper_temp, I checked it at it seems to be true:

2022-01-19 12:19:21 DEBUG (Thread-5) [homeassistant.components.tuya] Received update for device xxx: {'switch': True, 'temp_set': 24, 'upper_temp': 29, 'eco': False, 'child_lock': False}

EDIT: I just noticed this had been found already in https://github.com/home-assistant/core/issues/57403#issuecomment-956505123

I could use this data in e.g. templates to workaround the current_temperture=null issue, however, I don't see the upper_temp parameter anywhere, eventhough as shown above, it registers in logs.

Is there any way to access it? maybe include it into the list of attributes of this climate entity, next to others:

hvac_modes: off, heat_cool
min_temp: 1
max_temp: 7
target_temp_step: 0.5
current_temperature: null
temperature: 2.4
friendly_name: xx
supported_features: 1

OR do implement quirk for BHT thermostats and set current_temperature attribute = to upper_temp, not sure if that's ok tough.

frenck commented 2 years ago

In this case, the device is communicating non-standard. This is an issue that either Tuya or the manufacturer needs to resolve; as it is using customized data points, not supported by Tuya cloud, not documented and specific for this device model.

We cannot add/support these things, as with 400K+ different models in Tuya's database, it would be one endless fest of exceptions. That is not a maintainable situation.

paulius2k commented 2 years ago

@frenck : on a global scale - I do agree.

  1. For the long term solution I will write to the support of MOES House (producer of devices) and see what they are ready to do.
  2. As a workaround: is there any way to register and access upper_temp value received in Tuya update message?
alexanderznamensky commented 2 years ago

Hi All!

In old version of Tuya component this device worked fine: image

In new one: image

Does this mean that Tuya made some changes in old component for such devices?

frenck commented 2 years ago

@alexanderznamensky

In old version of Tuya component this device worked fine

Not really relevant; as the API used there is no longer an option (as it is going to be discontinued). The question you ask at the end is more a question you should ask Tuya, as they developed those APIs.

frenck commented 2 years ago

@frenck : on a global scale - I do agree.

  1. For the long term solution I will write to the support of MOES House (producer of devices) and see what they are ready to do.
  2. As a workaround: is there any way to register and access upper_temp value received in Tuya update message?

There isn't a way to access that parameter from within automations or templates, as it is not a used/known/picked up data point by Home Assistant.

mowl111 commented 2 years ago

Hi All!

In old version of Tuya component this device worked fine: image

In new one: image

Does this mean that Tuya made some changes in old component for such devices?

Is it possible to change to the previous (old) version, to get them working? I just installed HA for control and protocol those devices.... Great work with HA @frenck 👌

andrey-yantsen commented 2 years ago

@mowl111 nope, unfortunately, it's not really possible. As it was said multiple times, Tuya will deprecate the old API sometime soon, and the old integration will stop working. You can try raising a ticket with Tuya (via their https://iot.tuya.com interface), but the chances are low.

As an alternative, you can use LocalTuya — they just released thermostat support today, or you can use the old integration via HACS, installing it from the repo andrey-yantsen/home-assistant-tuya-old.

alexanderznamensky commented 2 years ago

HI @andrey-yantsen! Have you tried to use LocalTuya for our device? I did it once without sucess....

andrey-yantsen commented 2 years ago

@alexanderznamensky yeah, I set it up yesterday, working like a charm. I used values from https://github.com/rospogrigio/localtuya/pull/548#pullrequestreview-793253904 but removed the mode control altogether as it was somewhat broken for me. I'm using Schedy anyway, and just set the required temperature to 19ºC when don't need the heating.

I don't think I would be able to help you with any questions, but it definitely will be better to continue the discussion in the PR to LocalTuya and not here, to avoid being too much off-topic.

P.S. During the config flow the integration was failing to add the device, but after a few more attempts — it was indeed added.

paulius2k commented 2 years ago

Update on the Tuya Developer IoT Platform / App solution:

What is displayed on the APP is the manufacturer's customized panel, which is defined by the manufacturer during production. The manufacturer does not define the current_temperature directive, and this does not meet the cloud standard. This is the cloud standard instruction document: https://developer.tuya.com/en/docs/iot/f?id=K9gf45ld5l0t9

UPD 01.27: I got a message that the delay in response is due to the Chinese New Year holidays, which according to the web are:

Celebrations of Chinese New Year traditionally last for 16 days, starting from Chinese New Year's Eve to the Lantern Festival. In 2022, that is from January 31st to February 15th.

As a public holiday, Chinese people will get 7 days off from work from January 31st to February 6th in 2022.

Traditionally Chinese Lunar New Year activities started as early as three weeks before Chinese New Year's Eve. Old-fashioned (mostly rural) folk start cleaning their houses from the 23rd of the twelfth lunar month (January 25th, 2022).

frenck commented 2 years ago

Home Assistant 2022.2 (now in beta, feel free to join!), will have a diagnostics dump tool on the device page, which contains information to share in issues like these.

It can be helpful if all of you having issues with these MoesGo thermostats posted their diagnostics results here. I will allow finding a solution (or worst case, conclude there is none).

andrey-yantsen commented 2 years ago

Thank you, Franck, for not giving up on us! :) Here's what I have: https://gist.github.com/andrey-yantsen/fbf856451e0b0b36c269d334a04d36a9.

Target temperature = 19 ºC Current temperature = 21.5 ºC

alexanderznamensky commented 2 years ago

Hi Franck! Thanks indeed! Mine diagostic file is here: https://gist.github.com/alexanderznamensky/5168b2031998e7221cf93f7c7e897043

KrisRux commented 2 years ago

config_entry-tuya-5f8ac624adb28d287097151e1188e142.json.txt

Thanks @frenck

nawwman commented 2 years ago

tuya-7f9cc39ea0465650084176882f541e7c-1OG Arbeitszimmer-68127b3731f6815fe90f89651d48f452.json (1).txt

For reference, current temp=20.5°C, target temp=22.0°C device in HA is showing 4.4°C as target temp and no current temp

SaSa1983 commented 2 years ago

@frenck This should be fixed with #63941

Although still the "current_temperature" is missing because it is sent as "upper_temp" or "upper_temp_f" But this has to be fixed in a separator commit

andrey-yantsen commented 2 years ago

Just copied the updated base.py to my "beta" instance — it indeed helped with the scale! Thank you!

snorbik commented 2 years ago

after update to 2022.2.8 - tuya thermostats are broken for me.

Current temperature = 16,5 C (showing 90 C) Set temperature = 10,0 C (showing 50 C)

Any idea how to fix it?

frenck commented 2 years ago

@snorbik Please, don't respond the same message on every closed issue.