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
73.63k stars 30.78k forks source link

Support of BHP-8000C 24VAC HVAC Tuya Thermostat #125280

Open illigtr opened 2 months ago

illigtr commented 2 months ago

The problem

This is a bug/feature request. With the new Tuya "official" integration since early 2024, there are known mapping issues with some Tuya thermostats and the HA climate entity. I will document what I have done so far to make my BHP-8000C work with HA, but it is going to require more work (which I am willing to participate in).

What version of Home Assistant Core has the issue?

2024.8.3

What was the last working version of Home Assistant Core?

No response

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-01J6WW54FCJJ5X5E55XEJE0PMX-Thermostat-3fdeb2b9318d5863edd641e6e9b5b741(2).json

Example YAML snippet

No response

Anything in the logs that might be useful for us?

Ok... let's begin.

I purchased the BHP-8000C 24VAC Tuya HVAC thermostat from Ali-Express to replace a non-WiFi thermostat from Honeywell (Model: RTH-8500), the goal, to fully integrate and manage the thermostat with HA.

I expected that I would either get it working with Tuya integration or try with LibreTiny to burn ESPHome to the EB3S internally (as I have done that many times with other Tuya devices, like power monitoring, switched plugs and programmable dimmers).

The ESPHome path ended in a dead end, as the chip simply would not respond normally to info, backup or flashing...

The BHP-8000C works perfectly well with the Tuya "SmartLife" smartphone app.

Using the new "official" core Tuya integration, I got the thermostat to show up in HA, but, alas, as "unsupported", although any SmartLife "scenes" are imported and function correctly.

I then decided to try Tuya Local from HACS. Another dead end.

I returned to official core Tuya integration, but this time I replicate the "dev" branch of Tuya and climate core components to my local config/custom_components. I modified the manifest.json per instructions and was finally able to begin to modify the core code.

I added a section to the tuya/climate.py to support the "key" used by this thermostat Tuya configuration. Voila! The thermostat now appears in HA, albeit with some anomalies.

Various HVAC modes are duplicated and/or do not respond.
Other HVAC modes are missing.
No support for menu options (Permanent Hold, Temporary Hold, Schedule).

I have begun to understand and edit the core tuya component as well as the climate component in order to attain near complete integration of this thermostat into HA.... But I am going to need help and/or some direction. See Additional information for screenshots.

Additional information

image Screenshots showing duplicated settings... missing menu/schedule.

image

home-assistant[bot] commented 2 months ago

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

Code owner commands Code owners of `tuya` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign tuya` Removes the current integration label and assignees on the issue, add the integration domain after the command. - `@home-assistant add-label needs-more-information` Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue. - `@home-assistant remove-label needs-more-information` Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


tuya documentation tuya source (message by IssueLinks)

illigtr commented 2 months ago

I forget to add the edit I made to core/components/climate.py to minimally get the device to show up in HA as a climate device...

CLIMATE_DESCRIPTIONS: dict[str, TuyaClimateEntityDescription] = {
    # Air conditioner
    # https://developer.tuya.com/en/docs/iot/categorykt?id=Kaiuz0z71ov2n
    "kt": TuyaClimateEntityDescription(
        key="kt",
        switch_only_hvac_mode=HVACMode.COOL,
    ),
    # Heater
    # https://developer.tuya.com/en/docs/iot/f?id=K9gf46epy4j82
    "qn": TuyaClimateEntityDescription(
        key="qn",
        switch_only_hvac_mode=HVACMode.HEAT,
    ),
    # Heater
    # https://developer.tuya.com/en/docs/iot/categoryrs?id=Kaiuz0nfferyx
    "rs": TuyaClimateEntityDescription(
        key="rs",
        switch_only_hvac_mode=HVACMode.HEAT,
    ),
    # Thermostat
    # https://developer.tuya.com/en/docs/iot/f?id=K9gf45ld5l0t9
    "wk": TuyaClimateEntityDescription(
        key="wk",
        switch_only_hvac_mode=HVACMode.HEAT_COOL,
    ),
    # Thermostatic Radiator Valve
    # Not documented
    "wkf": TuyaClimateEntityDescription(
        key="wkf",
        switch_only_hvac_mode=HVACMode.HEAT,
    ),
    # ADDED by TONY ILLIG - Thermostat custom TUYA model BHP-8000C 
    # https://developer.tuya.com/en/docs/iot/f?id=K9gf45ld5l0t9
    "bmwk": TuyaClimateEntityDescription(
        key="bmwk",
        switch_only_hvac_mode=HVACMode.HEAT_COOL,
    ),
}