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.01k stars 29.65k forks source link

New tuya integration thermostat problem (BHT-3000/6000/8000) (`wk`) #57403

Closed antoweb closed 2 years ago

antoweb commented 2 years ago

The problem

After update my home assistant to 2021.10.2 my thermostat show temperature divided by 5

I cant see settings Like decimal, celsius and most important Temp divide by 2 See the screenshot, this settings are missing with new integration Screenshot_2021-10-09-17-23-12-590_io homeassistant companion android

What is version of Home Assistant Core has the issue?

2021.10.2

What was the last working version of Home Assistant Core?

2021.9.7

What type of installation are you running?

Home Assistant OS

Integration causing the issue

tuya

Link to integration documentation on our website

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

antoweb commented 2 years ago

Another issue is related my beca bht-6000. With old integration i see the correct temp values like image

I cant see the current temperature but only the target temp divided by 5 image

And now i cant set Automatic or manual nor turn on and off

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)

Sergmasharov commented 2 years ago

The same problem! Rolled back to 9.7 It completely doesn't work with 10 release. Not showing correct temperature and cant control it!!!

frenck commented 2 years ago

You can help us with this issue by providing some information about your device.

To do that, please follow the next steps:

From this debugger, we can get some information that can be useful. From the "Basic Information" tab, please provide:

Next, click on the "Device Debugging" tag. Once on that tab, you will find a small link called "JSON Editing", click on that link. It will now show a text field called JSON_EDITOR with some code in it. It looks something like this:

image

Copy and share that code from that text field into this issue.

That will help a lot! Thanks already!

../Frenck

antoweb commented 2 years ago

Hi follow is the device info requested Product Name: 柏益温控器(采暖)--> English --> Boyi Thermostat (Heating) Product Category: wk

And follow is the json

[
  {
    "code": "switch",
    "value": false
  },
  {
    "code": "child_lock",
    "value": false
  },
  {
    "code": "temp_set",
    "value": 42
  },
  {
    "code": "eco",
    "value": false
  },
  {
    "code": "upper_temp",
    "value": 37
  }
]

Take a look thath the temp value i think is doubled, in fact in old tuya integration i have to set divided by 2 for obtain correct value

frenck commented 2 years ago

Thanks for the additional information @antoweb 👍

novisys commented 2 years ago

Hi, i have the same probleme with BHT-8000

[
  {
    "code": "switch",
    "value": false
  },
  {
    "code": "child_lock",
    "value": false
  },
  {
    "code": "temp_set",
    "value": 42
  },
  {
    "code": "eco",
    "value": false
  },
  {
    "code": "upper_temp",
    "value": 37
  }
]
frenck commented 2 years ago

@novisys That is also a device from the wk product category?

novisys commented 2 years ago
{
  "result": {
    "active_time": 1624049544,
    "biz_type": 18,
    **"category": "wk",**
    "create_time": 1622921910,
    "icon": "smart/icon/15264583415nnlzwfs1qd2wqz6i937op3nmi_0.png",
    "id": "XXXXXXXXXXXXXX",
    "ip": "XXXXXXXXXXXX",
    "lat": "",
    "local_key": "XXXXXXXXXXX",
    "lon": "XXXXXXXXXXXXXXX",
    "model": "",
    "name": "Thermostat_LCD",
    "online": true,
    "owner_id": "269XXXXX",
    "product_id": "IAYz2WK1th0cMLmL",
    "product_name": "thermostat",
    "status": [
      {
        "code": "switch",
        "value": true
      },
      {
        "code": "temp_set",
        "value": 40
      },
      {
        "code": "upper_temp",
        "value": 40
      },
      {
        "code": "eco",
        "value": false
      },
      {
        "code": "child_lock",
        "value": false
      }
    ],
    "sub": false,
    "time_zone": "+01:00",
    "uid": "XXXXXXXXXXXXXXX",
    "update_time": 1633984530,
    "uuid": "XXXXXXXXXXXXXXXXX"
  },
  "success": true,
  "t": 1634040667098
}
novisys commented 2 years ago

@novisys That is also a device from the wk product category?

yes!

fparrav commented 2 years ago

I have the same problem but with a product of the kt category . It only lets me turn off and does not allow to adjust the temperature, in the integration it moves the slider that controls the temperature but the command does not reach the device.

[
  {
    "code": "temp_set",
    "value": 21
  },
  {
    "code": "mode",
    "value": "hot"
  },
  {
    "code": "switch",
    "value": false
  },
  {
    "code": "c_f"
  },
  {
    "code": "turbo",
    "value": false
  },
  {
    "code": "fan_speed_enum",
    "value": "auto"
  }
]
frenck commented 2 years ago

@fparrav Please don't stack issues for different things. Instead, create a new issue.

Thanks! 👍

nicdjb commented 2 years ago

Was going to open an issue however it looks like I have the same issue, temperature reported for thermostat is incorrect, Tuya shows the values as doubled, HA shows them as the Tuya value divided by 10 (e.g actual temp is 20, Tuya reports 40, HA shows 4.0). Here's my debug info:

Debug info Product Name 柏益温控器(采暖) Device ID 86806317a4cf12cf0433 Product Category wk Device Status Online Activated At 2020-12-12 19:07:02

[ { "code": "switch", "value": true }, { "code": "child_lock", "value": false }, { "code": "temp_set", "value": 44 }, { "code": "eco", "value": false }, { "code": "upper_temp", "value": 43 }

Many thanks Edit: Apologies if this has already been fixed as I notice it's been marked closed, I'm running HA core-2021.10.5

frenck commented 2 years ago

@nicdjb Its not closed yet :) There is a possible fix on our current development branch (also available in our nightly builds of Home Assistant).

I've unfortunately not been able to get the fix confirmed at this point, hence the issue is currently still pending.

zlinoliver commented 2 years ago

Thanks @frenck for the help. Hi @antoweb, for the product your mention: Boyi Thermostat (Heating), Product Category: wk

The integration cannot support it as the calculation logic of temperature is specially customized from the producer, it doesn't meet the general conversion standard of Tuya's product category. It's a non-standard product. So unfortunately, the integration cannot support it well.

We recommend you fork the Tuya v2 integration and customize the drive yourself.

BTW, to get the device information and specification more convenient, you can follow this tutorial doc to get it from home assistant log directly. How to Get the Log.

frenck commented 2 years ago

@zlinoliver Is there a way for us to identify these specific devices? E.g., by a model or something? We could add a mechanism to handle devices with quirks. Having such device quirks is fairly common in drivers (for example, Zigbee uses them a lot!).

3v1n0 commented 2 years ago

I've just tested the current git as custom component, but it still fails:

{
      "active_time": 1585101583,
      "biz_type": 18,
      "category": "wk",
      "create_time": 1578563858,
      "icon": "smart/icon/15264583415nnlzwfs1qd2wqz6i937op3nmi_0.png",
      "id": "471635222cf4324c3d77",
      "ip": "***",
      "lat": "***",
      "local_key": "***",
      "lon": "***",
      "model": "",
      "name": "Carajito",
      "online": true,
      "owner_id": "11237838",
      "product_id": "IAYz2WK1th0cMLmL",
      "product_name": "thermostat",
      "status": [
        {
          "code": "switch",
          "value": false
        },
        {
          "code": "temp_set",
          "value": 38
        },
        {
          "code": "upper_temp",
          "value": 42
        },
        {
          "code": "eco",
          "value": false
        },
        {
          "code": "child_lock",
          "value": false
        }
      ],
      "sub": false,
      "time_zone": "+01:00",
      "uid": "***",
      "update_time": 1635128706,
      "uuid": "471635222cf4324c3d77"
    }

Note: it's configured at 19°C and currently it's 21°C.

3v1n0 commented 2 years ago

In order to show the current temperature, this was needed:

Author: Marco Trevisan (Treviño) <mail@3v1n0.net>
Date:   Mon Nov 1 19:06:23 2021 +0100

    climate: Also use Upper temp as current temperature

diff --git a/climate.py b/climate.py
index bd3afd8..e6aaf7b 100644
--- a/climate.py
+++ b/climate.py
@@ -144,9 +144,9 @@ class TuyaClimateEntity(TuyaEntity, ClimateEntity):
         # use whatever the device is set to, with a fallback to celsius.
         if all(
             dpcode in device.status
-            for dpcode in (DPCode.TEMP_CURRENT, DPCode.TEMP_CURRENT_F)
+            for dpcode in (DPCode.TEMP_CURRENT, DPCode.TEMP_CURRENT_F, DPCode.UPPER_TEMP)
         ) or all(
-            dpcode in device.status for dpcode in (DPCode.TEMP_SET, DPCode.TEMP_SET_F)
+            dpcode in device.status for dpcode in (DPCode.TEMP_SET, DPCode.TEMP_SET_F, DPCode.UPPER_TEMP)
         ):
             self._attr_temperature_unit = TEMP_CELSIUS
             if any(
@@ -198,7 +198,7 @@ class TuyaClimateEntity(TuyaEntity, ClimateEntity):
         # Determine dpcode to use for getting the current temperature
         if all(
             dpcode in device.status
-            for dpcode in (DPCode.TEMP_CURRENT, DPCode.TEMP_CURRENT_F)
+            for dpcode in (DPCode.TEMP_CURRENT, DPCode.TEMP_CURRENT_F, DPCode.UPPER_TEMP)
         ):
             self._current_temperature_dpcode = DPCode.TEMP_CURRENT
             if self._attr_temperature_unit == TEMP_FAHRENHEIT:
@@ -207,6 +207,8 @@ class TuyaClimateEntity(TuyaEntity, ClimateEntity):
             self._current_temperature_dpcode = DPCode.TEMP_CURRENT
         elif DPCode.TEMP_CURRENT_F in device.status:
             self._current_temperature_dpcode = DPCode.TEMP_CURRENT_F
+        elif DPCode.UPPER_TEMP in device.status:
+            self._current_temperature_dpcode = DPCode.UPPER_TEMP

         # If we have a current temperature dpcode, get the integer type data
         if (
diff --git a/const.py b/const.py
index a9f7afb..f0f1ecd 100644
--- a/const.py
+++ b/const.py
@@ -298,6 +298,7 @@ class DPCode(str, Enum):
     TEMP_VALUE = "temp_value"  # Color temperature
     TEMP_VALUE_V2 = "temp_value_v2"
     TEMPER_ALARM = "temper_alarm"  # Tamper alarm
+    UPPER_TEMP = "upper_temp"
     UV = "uv"  # UV sterilization
     VA_BATTERY = "va_battery"
     VA_HUMIDITY = "va_humidity"

While, in order to get the proper scaling, i think that IntegerDataType should be changed a bit so that scalecan be overridden in a way that also powers of 2 are supported. I've hacked mine in order to do that, but not something I'd would be ready for public usage.

Also I'm wondering if there could be a way to figure out what devices will need this kind of math.

frenck commented 2 years ago

While, in order to get the proper scaling, i think that IntegerDataType should be changed a bit so that scalecan be overridden in a way that also powers of 2 are supported

That is not supported. These devices implement a non-standard interface, which is not supported by this API.

The upper temp change seems wrong, as it is not related to the current temperature in any way.

3v1n0 commented 2 years ago

Indeed the upper temp name seems indeed misleading, but that's respecting the value of the current temperature that is also shown in the Smart Life App.

I'm not sure if tuya API is wrong here, or missing something.

image

Which leads to this with such hack (and different - 2.0 - multipliers):

image

antoweb commented 2 years ago

Tuya app for bht-6000 works good

AlessandroTischer commented 2 years ago

I have the same problem also with 2021.11

[ { "code": "switch", "value": false }, { "code": "child_lock", "value": false }, { "code": "temp_set", "value": 39 }, { "code": "eco", "value": false }, { "code": "upper_temp", "value": 33 } ]

3v1n0 commented 2 years ago

This is far from optimal, but using this way should give you a temporay workaround.

apomper commented 2 years ago

Is there a fix for this yet? When I upgraded to 2021.10 my wk/BHT-8000 started reporting the wrong temps but I was still able to adjust the levels via automations. Since 2021.11, the automations now no longer work :(

PedroKTFC commented 2 years ago

I also have a problem with my thermostat. It used to work with the old integration and now it doesn't. Temperature reporting is out by a factor of 5 (ie instead of 20deg I get 4). I can't send anything to the device from HA and it doesn't seem to be reading the current temperature or temperature setting from it. It's a MOES BHT-002 wifi thermostat.

Details are: Product Name 柏益温控器(采暖) Product Category wk

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

awaldram commented 2 years ago

Not sure if you want an additional bug report for these devices but besides the Multiplier issue they also don't report in Hassio since the new core -integration .

1 no current temperature 2 no Child lock 3 no Eco Mode 4 no floor temp (Under floor heating variants)

1- For reference Current Temperature is surprisingly called { "code": "upper_temp", "value": 37 } Juts realised why its call 'Upper Temp' physically the Floor thermistor is the lower temp so obviously the sensor fitted in the stat is the upper Temperature sensor. :D Surely this can just be added to the 'code - current_temp or upper _temp' which will at least resolve temp reading part making it possible to create a template sensor to resolve Scaling .!

2- Child Lock { "code": "child_lock", "value": false },

3 - eco { "code": "eco", "value": false },

4 - floor Temperature

Appears in the logs as 2021-11-22 15:58:21 | Report | 地板温度 | 4.00℃ | device itself

Which represents a floor temp of 20 Degree Celsius.

awaldram commented 2 years ago

Given Tuya have stated they're unsupportable and the current massive latency from the TUYA cloud (11 seconds plus) making the Tuya supported integration unusable I've re-looked at localtuya and tuya-local.

Both run alongside the official integration happily and local tuya supports all switches fans etc but not climate Tuya local however only supports hvac devices https://github.com/make-all/tuya-local and supports officially the following thermotstats

Inkbird ITC306A thermostat smartplug (not fully functional) Beca BHP-6000 Room Heat Pump control thermostat Beca BHT-6000/8000 Floor Heating thermostat Beca BHT-002 Floor Heating thermostat (with external temp sensor) Moes BHT-002 thermostat (without external temp sensor) Awow/Mi-heat TH213 thermostat Siswell T29UTW thermostat Siswell C16 thermostat (rebadged as Warmme, Klima and others) Minco MH-1823D thermostat

I can report that the bht3000 works well with the bht002+external template . The only issue is you cant access teh device locally with two endpoints (smart life + home assistant ) at the same time so ensure its not running in the background on your phone. Screenshot from 2021-11-24 11-59-11

I think until (if ever) the Official integration supports these WK category devices then tuya-local is the only game in town :D

AlessandroTischer commented 2 years ago

Given Tuya have stated they're unsupportable and the current massive latency from the TUYA cloud (11 seconds plus) making the Tuya supported integration unusable I've re-looked at localtuya and tuya-local.

Both run alongside the official integration happily and local tuya supports all switches fans etc but not climate Tuya local however only supports hvac devices https://github.com/make-all/tuya-local and supports officially the following thermotstats

Inkbird ITC306A thermostat smartplug (not fully functional) Beca BHP-6000 Room Heat Pump control thermostat Beca BHT-6000/8000 Floor Heating thermostat Beca BHT-002 Floor Heating thermostat (with external temp sensor) Moes BHT-002 thermostat (without external temp sensor) Awow/Mi-heat TH213 thermostat Siswell T29UTW thermostat Siswell C16 thermostat (rebadged as Warmme, Klima and others) Minco MH-1823D thermostat

I can report that the bht3000 works well with the bht002+external template . The only issue is you cant access teh device locally with two endpoints (smart life + home assistant ) at the same time so ensure its not running in the background on your phone. Screenshot from 2021-11-24 11-59-11

I think until (if ever) the Official integration supports these WK category devices then tuya-local is the only game in town :D

Problem is if the appliance is under another network...

floxboy commented 2 years ago

it works! Yes! it would be nice to add the floor temperature to this thermostat. it is issued in a metric of 102

awaldram commented 2 years ago

it works! Yes! it would be nice to add the floor temperature to this thermostat. it is issued in a metric of 102

I have the additional sensor which is the floor sensor .. see above BHT3000 External (28 oC). You should have it to if you used the same template BHT002+external

frenck commented 2 years ago

Home Assistant 2022.2 (now in beta, feel free to join) has a diagnostic tool on the device page. It allows you to download diagnostic information about the device, that can be shared in GitHub issues.

It would help if all of you using the BHT thermostats could post a diagnostic dump. This will allow us to either find a solution or conclude there is no solution.

Thanks! 👍

apomper commented 2 years ago

Hi @frenck

Diagnostics dump for my BHT Thermostat. I hope it helps.

https://gist.github.com/apomper/a1253d7a7549172806fa925c4ce064a0

PedroKTFC commented 2 years ago

Can I just clarify if this requires the new Tuya integration? I'm currently using the old Tuya as I absolutely need it working in the winter.

frenck commented 2 years ago

@PedroKTFC This is about the Tuya integration in Home Assistant 2022.2.

AlessandroTischer commented 2 years ago

Home Assistant 2022.2 (now in beta, feel free to join) has a diagnostic tool on the device page. It allows you to download diagnostic information about the device, that can be shared in GitHub issues.

It would help if all of you using the BHT thermostats could post a diagnostic dump. This will allow us to either find a solution or conclude there is no solution.

Thanks! 👍

Here it is mine, hope this helps!

tuya-c7876e3dd89a70097543c8b5df944d44-Piano Terra-3e7918f108299543c04d1ac8da81e2af.json.txt

LPK60 commented 2 years ago

Home Assistant 2022.2 (now in beta, feel free to join) has a diagnostic tool on the device page. It allows you to download diagnostic information about the device, that can be shared in GitHub issues.

It would help if all of you using the BHT thermostats could post a diagnostic dump. This will allow us to either find a solution or conclude there is no solution.

Thanks! 👍

Here it's mine referred to BHT6000 for floor heating.. In HA shows temperature divided by 10 and only one sensor for device (set point). Hope this be useful to fix it. Thanks

Tuya Thermostat Living.json.txt

LPK60 commented 2 years ago

@frenck Thanks for fixing the tuya thermostat in the 2022.2.8 release. I can finally see the right set point value and also the room temperature. Unfortunately, In my case, this last value appears as multiplied by 10 (the real temperature in the device and app is 26.5 but the integration is showing 260). I'm attaching the diagnostic file and an image from the dashboard, hoping this can help to fix it. Thanks.

tuya-ef8c154fffd44f6195ca6967e045216c-Termostato Suite-6934cfbc522d3d3b7859603170cd268f.json.txt

Thermostat image
PedroKTFC commented 2 years ago

This thread might help you get around it (especially around comment 195).

antoweb commented 2 years ago

Same problem of @LPK60 attached diagnostic and screenshot image tuya-712ff66b08a4c697f873f07859635ad9-termostato-2f8997d9ebbe28ba57280dc533161ead.json.txt

frenck commented 2 years ago

There is a separate issue open for that. Please take a look at the open and known issues. That would have saved you the time and need to post it here in a closed issues 😉

../Frenck

antoweb commented 2 years ago

There is a separate issue open for that. Please take a look at the open and known issues. That would have saved you the time and need to post it here in a closed issues 😉

../Frenck

Where is separate issue?

antoweb commented 2 years ago

I cant find info about the multiplier. Someone can help me?

frenck commented 2 years ago

Hi there @antoweb 👋

The issue is tracked here: #66693

You can find known issues by e.g., going into the Home Assistant integrations page, clicking the three-dotted menu -> known issues.

CleanShot 2022-02-18 at 10 58 05@2x

Or on the documentation page:

CleanShot 2022-02-18 at 10 48 03@2x

antoweb commented 2 years ago

Hi there @antoweb 👋

The issue is tracked here: #66693

You can find known issues by e.g., going into the Home Assistant integrations page, clicking the three-dotted menu -> known issues.

CleanShot 2022-02-18 at 10 58 05@2x

Or on the documentation page:

CleanShot 2022-02-18 at 10 48 03@2x

Hi thanks, i have checked the issue you mentioned but i cant find a solution. Right?

frenck commented 2 years ago

Its not about finding solution, its about finding known issues. See https://github.com/home-assistant/core/issues/66693

Its an open issue, which isn't resolved; ergo, no solution yet.