make-all / tuya-local

Local support for Tuya devices in Home Assistant
MIT License
1.35k stars 522 forks source link

BHT-8000 #57

Closed novisys closed 3 years ago

novisys commented 3 years ago

I have a BHT-8000 , and this one is not reconised as climate Is this supported by this integration ?!

make-all commented 3 years ago

Not currently. More information would be required, such as the log messages from when you try to add the device to Home Assistant through this integration, and if possible some more investigation into different possible values that it sends when changing settings (mostly things like presets, for temperatures we just need to differentiate the current and target temperature, but this is probably similar to the other Beca models in that respect.

novisys commented 3 years ago

Hi, the log messages from when you try to add the device to Home Assistant through this integration

Cette erreur provient d'une intégration personnalisée

Logger: custom_components.tuya_local.device
Source: custom_components/tuya_local/device.py:236
Integration: tuya_local (documentation, issues)
First occurred: 23:17:34 (1 occurrences)
Last logged: 23:17:34

Failed to refresh device state for Test.
novisys commented 3 years ago

device details

{
  "result": {
    "active_time": 1624049544,
    "biz_type": 18,
    "category": "wk",
    "create_time": 1622921910,
    "icon": "smart/icon/15264583415nnlzwfs1qd2wqz6i937op3nmi_0.png",
    "id": "xxxxxxxx",
    "ip": "xxxxxx",
    "lat": "xxxxx",
    "local_key": "xxxxx",
    "lon": "xxxx",
    "model": "",
    "name": "Thermostat_LCD",
    "online": true,
    "owner_id": "2694xxx",
    "product_id": "IAYz2WK1th0cMLmL",
    "product_name": "thermostat",
    "status": [
      {
        "code": "switch",
        "value": true
      },
      {
        "code": "temp_set",
        "value": 46
      },
      {
        "code": "upper_temp",
        "value": 46
      },
      {
        "code": "eco",
        "value": false
      },
      {
        "code": "child_lock",
        "value": false
      }
    ],
    "sub": false,
    "time_zone": "+01:00",
    "uid": "xxxxxxxx",
    "update_time": 1634146333,
    "uuid": "xxxxxxxx"
  },
  "success": true,
  "t": 1634155303988
}
novisys commented 3 years ago
Capture d’écran 2021-10-15 à 23 22 09
make-all commented 3 years ago
Failed to refresh device state for Test.

This suggests that it is not possible to make a connection to the device. It may be because you have another connection to the device already, from the phone app or another source. Close your phone app and disable any other local connections to the device and try again.

The log message I am looking for will have all the DPS listed with their ids (the above info from the developer portal is missing ids, and is not a full list of all, only what is available from the cloud API).

make-all commented 3 years ago

It might be worth trying with the BHT-002 support that I just added. The BHT-002 seems to be a lowest common denominator for a number of more recent models.

bosser2407 commented 3 years ago

I have 3 pieces of BHT-002. And none of them work. When you try to change something, the status changes to inaccessible and no changes are visible in Smart life. Also, if you change the settings in Smart life, there are also no changes in the Home assistant.

make-all commented 3 years ago

If you have Smart Life open to observe changes, it is probably using the local connection to the device. Tuya devices only allow one local connection at a time. So it is changing to inaccessible in HA because it is unable to send commands to the device.

bosser2407 commented 3 years ago

If you have Smart Life open to observe changes, it is probably using the local connection to the device. Tuya devices only allow one local connection at a time. So it is changing to inaccessible in HA because it is unable to send commands to the device.

Yes you are right. If you watch the changes in Smart life by turning off Wi Fi, then all changes are visible, and the thermostat is available in the Home assistant

novisys commented 3 years ago

Hi, Good news ! After closing SmartLife App as suggested, it's worked and detected like an BHT-6000 but not all functions work !

here is a screenshot comparaison between my BHT-8000 (detected like BHT-6000) and another Zigbee Thermostat (The two one have the same fonctions theorically and also on the Mobile App)

1- BHT-8000 (detected like BHT-6000)

The Zigbee Thermostat:

If this functions can be added it's will be perfect ! Thanks a lot of your integration, you saved my life ! If you need me to test anything i'm present PS: sorry for my bad English (i'm French native)

make-all commented 3 years ago

To add such functionality, I need more technical details of the capabilities. Probably the info about the device from the tuya developer portal would help, but also a full DPS mapping, if you have tuya-cli installed, you should be able to get it sing that, or by removing the device from HA and adding it again, then looking in the HA log (under configuration) for a message from the tuya-local integration containing the dps. If there is no such message, then the dps must be identical to the BHT-6000, so just the info about the possible values from the dev portal will be enough.

On Wed, 27 Oct 2021 at 07:15, novisys @.***> wrote:

Hi, Good news ! After closing SmartLife App as suggested, it's worked and detected like an BHT-6000 but not all functions work !

here is a screenshot comparaison between my BHT-8000 (detected like BHT-6000) and another Zigbee Thermostat (The two one have the same fonctions theorically and also on the Mobile App)

1- BHT-8000 (detected like BHT-6000) https://zupimages.net/viewer.php?id=21/43/u6b2.png

https://zupimages.net/viewer.php?id=21/43/5fje.png

https://zupimages.net/viewer.php?id=21/43/xx7c.png

The Zigbee Thermostat:

https://zupimages.net/viewer.php?id=21/43/e9lf.png

https://zupimages.net/viewer.php?id=21/43/aqb4.png

https://zupimages.net/viewer.php?id=21/43/na1o.png

If this functions can be added it's will be perfect ! Thanks a lot of your integration, you saved my life ! If you need me to test anything i'm present PS: sorry for my bad English (i'm French native)

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/make-all/tuya-local/issues/57#issuecomment-952190574, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACJNY6YJ3YGEBJ3KOHLLEADUI343LANCNFSM5F77M3HA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

novisys commented 3 years ago

Hi, here is a listed DPS by tuya-cli commad:

{
  '1': true,
  '2': 43,
  '3': 42,
  '4': '1',
  '5': false,
  '6': false,
  '102': 0,
  '103': '1',
  '104': true
}
novisys commented 3 years ago

A debug from iot.tuya: { "result": { "category": "wk", "functions": [ { "code": "switch", "desc": "{}", "name": "开关", "type": "Boolean", "values": "{}" }, { "code": "child_lock", "desc": "{}", "name": "童锁", "type": "Boolean", "values": "{}" }, { "code": "temp_set", "desc": "{\"unit\":\"℃\",\"min\":10,\"max\":70,\"scale\":1,\"step\":5}", "name": "设置温度", "type": "Integer", "values": "{\"unit\":\"℃\",\"min\":10,\"max\":70,\"scale\":1,\"step\":5}" }, { "code": "eco", "desc": "{}", "name": "ECO模式", "type": "Boolean", "values": "{}" }, { "code": "upper_temp", "desc": "{\"unit\":\"℃\",\"min\":0,\"max\":100,\"scale\":0,\"step\":5}", "name": "设置温度上限", "type": "Integer", "values": "{\"unit\":\"℃\",\"min\":0,\"max\":100,\"scale\":0,\"step\":5}" } ], "status": [ { "code": "eco", "name": "ECO模式", "type": "Boolean", "values": "{}" }, { "code": "temp_set", "name": "设置温度", "type": "Integer", "values": "{\"unit\":\"℃\",\"min\":10,\"max\":70,\"scale\":1,\"step\":5}" }, { "code": "switch", "name": "开关", "type": "Boolean", "values": "{}" }, { "code": "child_lock", "name": "童锁", "type": "Boolean", "values": "{}" }, { "code": "upper_temp", "name": "设置温度上限", "type": "Integer", "values": "{\"unit\":\"℃\",\"min\":0,\"max\":100,\"scale\":0,\"step\":5}" } ] }, "success": true, "t": xxxxxx }

novisys commented 3 years ago

And debug logs from remove/add device HA:

2021-10-27 01:34:10 DEBUG (SyncWorker_4) [custom_components.tuya_local.device] Test refreshed device state: {"devId": "xxxxxxxxxxxx", "dps": {"1": true, "2": 43, "3": 42, "4": "0", "5": false, "6": false, "102": 0, "103": "1", "104": true, "updated_at": 1635291250.2775784}}
2021-10-27 01:34:10 DEBUG (SyncWorker_4) [custom_components.tuya_local.device] new cache state (including pending properties): {"1": true, "2": 43, "3": 42, "4": "0", "5": false, "6": false, "102": 0, "103": "1", "104": true, "updated_at": 1635291250.2775784}
make-all commented 3 years ago

The missing off option is actually due to the initial report for BHP-6000 reporting dps 1 as being for backlight. I assumed at the time that it turns off the thermostat display, but the heating continues to operate per the thermostat settings. I see a later comment on that issue said "Backlight off actually disables the entire unit. I think what you've done making it a separate entity is good." which maybe hints that it should in fact be an off for the full system.

This config with Display as a separate (light) entity was then carried over to BHT-6000 and BHT-002. So the functionality is there, just implemented as a separate light entity for on/off.

make-all commented 3 years ago

Unfortunately that debug info from iot.tuya only mentions what we already know about the devices. dps 103 and 104 are the unknowns, and if it supports that list of modes from the screenshot, then it is likely dps 103 that is the key there, but the only info we have is that the current value is '1' (the report for BHT-6000 was also '1'), no information what that means, or what the full list of possible values is. Also whether the values are the same for BHT-6000 and BHT-8000, or different, as that will be the factor as to whether BHT-8000 needs its own config or can share the BHT-6000 config.

novisys commented 3 years ago

Hi, Have you take a look to the new chenagelog version ? Are you think that this change (https://www.home-assistant.io/blog/2021/11/03/release-202111/#entity-categorization) can help us to get the on/off option on the BHT-8000 separated from the Light entity ? Thanks

novisys commented 3 years ago

Good ! Your recent modification work ! I will try some automations to test it to night ! Thanks a lot for the good job !