[FLASHED] Tuya BHT-006 WiFi Thermostat

Tuya BHT-006 GB WiFi Thermostat flashed over the air using tuya-cloudcutter

I got 2 versions of the same thermostat with different datapoints.

BHT-006GBW Thermostat (Version number U3) sold by Beca

esphome:
  name: thermostat
  friendly_name: Thermostat

bk72xx:
  board: cb3s
  framework:
    version: dev

logger:
  baud_rate: 0
  level: debug

api:

ota:

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  ap:
    password: !secret wifi_password

captive_portal:

web_server:

time:
  - id: time_provider
    platform: homeassistant
    on_time_sync:
      - logger.log: "Synchronized system clock"
    on_time:
      - seconds: 0
        then:
          - uart.write: [0x55, 0xaa, 0x00, 0x21, 0x00, 0x00, 0x20] #0x21 (Send weather data)
          - uart.write: [0x55, 0xaa, 0x00, 0x20, 0x00, 0x02, 0x01, 0x00, 0x22] # 0x20 (Enable weather services) 0x01 (success) 0x00 (no error)
          - uart.write: [0x55, 0xaa, 0x00, 0x34, 0x00, 0x02, 0x03, 0x00, 0x38] # 0x34 (Proactively request weather data) 0x03 (subcommand) 0x00 (success)
          - logger.log: "Disabling weather requests"

uart:
  rx_pin: P10
  tx_pin: P11
  baud_rate: 9600

tuya:
  time_id: time_provider

climate:
  - platform: tuya
    name: "Thermostat"
    icon: mdi:heating-coil
    switch_datapoint: 1
    target_temperature_datapoint: 16
    current_temperature_datapoint: 24
    active_state_datapoint: 3
    active_state_heating_value: 0
    eco_datapoint: 4
    temperature_multiplier: 0.1
    visual:
      min_temperature: 10 °C      
      max_temperature: 30 °C      
      temperature_step: 0.5 °C

switch:
  - platform: tuya
    name: "Thermostat"
    icon: mdi:power
    switch_datapoint: 1           
    internal: True                

  - platform: tuya
    name: "Economy Mode"        
    icon: mdi:leaf
    switch_datapoint: 4           

  - platform: tuya
    name: "Panel Lock"
    icon: mdi:lock
    switch_datapoint: 40

select:
  - platform: tuya
    name: "Program Schedule"
    icon: "mdi:calendar"
    enum_datapoint: 2
    options:
      0: Schedule
      1: Manual

  - platform: tuya
    name: "Sensor Type"
    enum_datapoint: 102
    options:
      0: Internal
      2: External
      1: Internal and External

sensor:
  - platform: tuya
    name: "Temperature"
    device_class: "temperature"
    sensor_datapoint: 24
    unit_of_measurement: "°C"
    accuracy_decimals: 1
    filters:
      - multiply: 0.1

  - platform: tuya
    name: "Temperature External Sensor"
    device_class: "temperature"
    sensor_datapoint: 101
    unit_of_measurement: "°C"
    accuracy_decimals: 1
    filters:
      - multiply: 0.1
    disabled_by_default: True

  - platform: tuya
    name: "Economy Temperature"
    device_class: "temperature"
    sensor_datapoint: 106
    unit_of_measurement: "°C"
    accuracy_decimals: 1
    filters:
      - multiply: 0.1
    disabled_by_default: True

  - platform: tuya
    name: "Temperature Offset"
    device_class: "temperature"
    sensor_datapoint: 27
    unit_of_measurement: "°C"
    disabled_by_default: True

  - platform: tuya
    name: "Min Set Temp"
    device_class: "temperature"
    sensor_datapoint: 20
    unit_of_measurement: "°C"
    accuracy_decimals: 1
    filters:
      - multiply: 0.1
    disabled_by_default: True

  - platform: tuya
    name: "Max Set Temp"
    device_class: "temperature"
    sensor_datapoint: 19
    unit_of_measurement: "°C"
    accuracy_decimals: 1
    filters:
      - multiply: 0.1
    disabled_by_default: True

  - platform: tuya
    name: "Low Temperature Protection"
    device_class: "temperature"
    sensor_datapoint: 105
    unit_of_measurement: "°C"
    accuracy_decimals: 1
    filters:
      - multiply: 0.1
    disabled_by_default: True

  - platform: tuya
    name: "High Temperature Protection"
    device_class: "temperature"
    sensor_datapoint: 104
    unit_of_measurement: "°C"
    accuracy_decimals: 1
    filters:
      - multiply: 0.1
    disabled_by_default: True

  - platform: tuya
    name: "Dead Zone Temperature"
    device_class: "temperature"
    sensor_datapoint: 103
    unit_of_measurement: "°C"
    disabled_by_default: True

number:
  - platform: tuya
    name: "Economy Temperature (°C=value/10)"       
    number_datapoint: 106
    min_value: 0
    max_value: 300
    step: 10
    disabled_by_default: True
    
  - platform: tuya
    name: "Min Set Temp (°C=value/10)"         
    number_datapoint: 20
    min_value: 50
    max_value: 150
    step: 10
    disabled_by_default: True

  - platform: tuya
    name: "Max Set Temp (°C=value/10)"         
    number_datapoint: 19
    min_value: 200
    max_value: 350
    step: 10
    disabled_by_default: True

  - platform: tuya
    name: "Low Temperature Protection (°C=value/10)"  
    number_datapoint: 105
    min_value: 0
    max_value: 100
    step: 10
    disabled_by_default: True

  - platform: tuya
    name: "High Temperature Protection (°C=value/10)"   
    number_datapoint: 104
    min_value: 250
    max_value: 450
    step: 10
    disabled_by_default: True

  - platform: tuya
    name: "Dead Zone Temperature"                    
    number_datapoint: 103
    unit_of_measurement: "°C"
    min_value: 1
    max_value: 5
    step: 1
    disabled_by_default: True

BHT-006GBW Thermostat (Version number U2) sold by Moes

esphome:
  name: thermostat
  friendly_name: Thermostat

bk72xx:
  board: cb3s
  framework:
    version: dev

logger:
  baud_rate: 0
  level: debug

api:

ota:

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  ap:
    password: !secret wifi_password

captive_portal:

web_server:

time:
  - id: time_provider
    platform: homeassistant
    on_time_sync:
      - logger.log: "Synchronized system clock"
    on_time:
      - seconds: 0
        then:
          - uart.write: [0x55, 0xaa, 0x00, 0x21, 0x00, 0x00, 0x20] #0x21 (Send weather data)
          - uart.write: [0x55, 0xaa, 0x00, 0x20, 0x00, 0x02, 0x01, 0x00, 0x22] # 0x20 (Enable weather services) 0x01 (success) 0x00 (no error)
          - uart.write: [0x55, 0xaa, 0x00, 0x34, 0x00, 0x02, 0x03, 0x00, 0x38] # 0x34 (Proactively request weather data) 0x03 (subcommand) 0x00 (success)
          - logger.log: "Disabling weather requests"

uart:
  rx_pin: P10
  tx_pin: P11
  baud_rate: 9600

tuya:
  time_id: time_provider

climate:
  - platform: tuya
    name: "Thermostat"
    icon: mdi:heating-coil
    switch_datapoint: 1
    target_temperature_datapoint: 2
    current_temperature_datapoint: 3
    eco_datapoint: 5
    temperature_multiplier: 0.5
    visual:
      min_temperature: 10 °C      
      max_temperature: 30 °C      
      temperature_step: 0.5 °C

switch:
  - platform: tuya
    name: "Power"
    icon: mdi:power
    switch_datapoint: 1           
    internal: True                

  - platform: tuya
    name: "Economy Mode"
    icon: mdi:leaf
    switch_datapoint: 5

  - platform: tuya
    name: "Panel Lock"
    icon: mdi:lock
    switch_datapoint: 6      

select:
  - platform: tuya
    name: "Program Schedule"
    icon: "mdi:calendar"
    enum_datapoint: 4
    options:
      0: Schedule
      1: Manual

sensor:
  - platform: tuya
    name: "Temperature"
    device_class: "temperature"
    sensor_datapoint: 3
    unit_of_measurement: "°C"
    accuracy_decimals: 1
    filters:
      - multiply: 0.5

  - platform: tuya
    name: "Temperature External Sensor"
    device_class: "temperature"
    sensor_datapoint: 102
    unit_of_measurement: "°C"
    accuracy_decimals: 1
    filters:
      - multiply: 0.5
    disabled_by_default: True

EDIT: Changed the original post.

  1. LibreTiny is going to merge with ESPHome in version 9.0 and the yaml is a little different now.
  2. Fixed the invalid command (0x20) and (0x34) received in the logs. MCU is requesting weather data that was provided by the tuya app so I just sent empty weather data and told the MCU that the data was correct.
4 Likes

Hi, I am new in the community.
Is there any update about MOES BHT-006? I just planning to order it and now I am thinking about which thermometer should I buy for underfloor water heating.
MOES BHT-006 or BHT-002 ?
Because here they mention that 002 works perfectly (GitHub - fashberg/WThermostatBeca: Open Source firmware replacement for Tuya Wifi Thermostate from Beca and Moes with Home Assistant Autodiscovery)
Here looks like you successfully flashed 006?
Thank you

The WThermostatBeca is a firmware for the ESP8266 module and the BHT002 doesn’t use the ESP8266 anymore, it now comes with a WBR3 module.

The BHT-002 and BHT-006 can be flashed with LibreTiny ESPHome over-the-air using tuya-cloudcutter

1 Like

Do you think the PID Climate component could work on this (or any Tuya)?

I don’t think it works, this thermostat is On/Off, On when current temperature is below at least 1º C from target temperature and Off when it reaches target temperature.

I ordered both a bht-002 and a bht-006 to see whether I can put esphome on them. I haven’t succeeded with cloudcutter yet. They are both from Moes. I got to the point where cloudcutter connected to the thermostat in AP-mode and told me to power cycle and get back into AP-mode. This is where I got stuck.

How did you proceed from here? Did you detach AC and reattach, then press the down button 2 × 8s? Or something else?

When the thermostat is off = the button that turns off the display

Detach AC and reattach, turn of the screen and then press and hold the down button.

1 Like

Suggestion from my side:
When configuring the board as generic-bk7231n-qfn32-tuya instead of cb3s you may use the RX1 and TX1 pin mappings, see #121

For example:

libretiny:
  board: generic-bk7231n-qfn32-tuya
  framework:
    version: dev
uart:
  rx_pin: RX1
  tx_pin: TX1
  baud_rate: 9600

Also does anyone have failing LED diodes on their screen?
I have a couple of these thermostats and 2 are already showing failing LEDs in the time segment after 2 months of use:
incorrect_time2
The time should have been 07:53, for some reason the 0 has one lower right dimmed LED, and the 3 has two LEDs that should have been off and one LED that is not even lit. Also the %RH is always dimly lit. From the start I put the screens on the lowest dim setting, as this should have saved the LEDs lifetime.

I tried contacting the seller, but unfortunately they are not very helpful in offering a solution.

Hello togehter,
i have some trouble to flash the metioned yaml file from the Moes thermostat to my device using ESPhome. There is always following error: ERROR Connecting to 192.168.178.65:8892 failed: [Errno 111] Connection refused
For the wlan configuration I used the manual IPlike described in: https://esphome.io/components/wifi.html#manual-ips
Can me help anybody with this error?
Thanks,
Martin

Fixed the invalid command (0x20) and (0x34) received in the logs. MCU is requesting weather data that was provided by the tuya app so I just sent empty weather data and told the MCU that the data was correct.

This got me thinking, what if it is possible to manually write the weather information to the thermostat.
It continuously asks for the following weather information:

[14:32:56][V][tuya:127]: Received Tuya: CMD=0x20 VERSION=3 DATA=[0A.77.2E.68.75.6D.69.64.69.74.79.0E.77.2E.63.6F.6E.64.69.74.69.6F.6E.4E.75.6D.05.77.2E.75.76.69.0B.77.2E.77.69.6E.64.53.70.65.65.64 (44)] INIT_STATE=5

When parsed results in:

              0A 77 2E 68 75 6D 69 64 69 74 79 0E 77 2E 63 6F 6E 64 69 74 69 6F 6E 4E 75 6D 05 77 2E 75 76 69 0B 77 2E 77 69 6E 64 53 70 65 65 64
parm lenght   0a                               0e                                           05                0b
humidity         77 2e 68 75 6d 69 64 69 74 79
conditionNum                                      77 2e 63 6f 6e 64 69 74 69 6f 6e 4e 75 6d
uvi                                                                                            77 2e 75 76 69    
windSpeed                                                                                                        77 2e 77 69 6e 64 53 70 65 65 64

This translates back to w.humidity, w.conditionNum, w.uvi, and w.windSpeed:

I tried to randomly send weather data using 0x21 yet the MCU does not respond and nothing is displayed:

              55 aa 00 21 00 42 01 0a 77 2e 68 75 6d 69 64 69 74 79 00 04 00 00 00 11 0e 77 2e 63 6f 6e 64 69 74 69 6f 6e 4e 75 6d 00 03 31 32 30 08 05 77 2e 75 76 69 00 01 01 0b 77 2e 77 69 6e 64 53 70 65 65 64 00 04 00 00 00 11 3f
header        55 aa
cmd                 00 21
msg length                00 42
request succes                  01
parm length                        0a                                                 0e                                                             05                         0b
value length                                                        00 04                                                          00 03                               00 01                                        00 04
value                                                                     00 00 00 11                                                    31 32 30                            01                                           00 00 00 11
cksum                                                                                                                                                                                                                                 3f
humidity                              77 2e 68 75 6d 69 64 69 74 79
conditionNum                                                                             77 2e 63 6f 6e 64 69 74 69 6f 6e 4e 75 6d
uvi                                                                                                                                                     77 2e 75 76 69
windSpeed                                                                                                                                                                          77 2e 77 69 6e 64 53 70 65 65 64

Maybe the value length is off, but I have no idea how large the numbers for each parameter could be as it is not mentioned in the documentation.

Seems like Moes -branded BHT-002 and BHT-006 have newer firmware and cannot be flashed over wifi. At least I didn’t manage.

Can they still be flashed with a spi-flasher etc?

My problem is solved. I have not flashed the custom firmware to the device ( ESPHome-Kickstart-v23.08.29_bk7231n_app.ota.ug.bin

After flashing the software, there were no problems.

Interesting work, I noticed the weather icons lighting up during power-up and I was wondering how to make them work.

Regarding the parameter length, it is documented in the appendix:

https://developer.tuya.com/en/docs/iot/weather-function-description?id=Ka6dcs2cw4avp#Appendix1

Hi. Did you get anywhere with this? I need to get 8 or 10 pcs and Moes Wifi 16A electric floor heater seems the best option. Did read from elsewhere you can now only flash via TTL wires, not over IP WIFI anymore. I’m also inbetween if to get the old 002 or newer 006. I actually have few 002 wifis and 002 zigbees (they are spamming my zigbee network so that’s the only reason I want to go wifi route).

I ran out of time and didn’t get anywhere. Could you share a link to a guide on how to flash with wired connection?

Also is anyone aware of a similar product that can be flashed with esphome? Even one without any display or buttons?

Check this one. I haven’t tried yet. I have a few old ones which I can probably upgrade over WIFI but need to buy 8 new ones too which somehow I need to program over the pins. Probably it goes as usual and can use some generic tutorial for that.

" Nearly all devices are now shipped with a new Firmware which cannot be upgraded Over The Air with non-tuya-servers. In this case you cannot longer use tuya-convert and you have to open the device for soldering or use a 3d-printed pogo-adapter.

You can install the firmware either

  • by using tuya-convert - no Hardware Modifications necessary
  • by soldering cables to the ESP-Modules using an ESP/Arduino-Programmer (3,3 Volt TTL)
  • by using OTA Upgrade on tasmota or other Open Source ESP Firmware"

Do you know if this is possible to use an remote temperature sensor? because i would like to have a portable temperature sensor that i move inside the house…

Any solution? Thanks

Thanks for all the info and configuration template, both were very helpful! I managed to flash it on a BHT-006GALW through tuya-cloudcutter. I only wondered, are the listed data points all that are available?
It would be quite useful to be able to set the brightness from esphome as well. If not, setting the brightness to zero (10 second timeout) is a viable alternative for me.

The climate control is handled entirely by the secondary MCU inside the device and it will only use the internal temperature sensor.

I must say I’ve been using 5 of these thermostats for +/- 4 months and they all developed the issue where the LED’s for the time display are burning out or becoming dimly lit. I do have the 24VAC version of these as my system is 24VAC, but as the thermostat itself is regulated down to 5v I don’t suspect that is relevant.

So for me it is not an isolated event anymore, I’m curious if others are experiencing these issues as well. Otherwise be warned :slightly_frowning_face: