logo elektroda
logo elektroda
X
logo elektroda
Dostępna jest polska wersja

Czy wolisz polską wersję strony elektroda?

Nie, dziękuję Przekieruj mnie tam

Uploading OpenBK software to MOES BHT-002-GCLW v4 thermostat with TUYA CB3S BK7231N chip

tomik67 22965 133
Best answers

Can I flash the MOES BHT-002-GCLW v4 thermostat with OpenBK without damaging it, and what do I need to know first?

Yes — the device is based on TuyaMCU, and OpenBeken supports this class of BK7231N/TuyaMCU thermostats, but you must first identify and map the device’s dpIDs if you want the thermostat functions to work properly [#20744725] Before flashing, the UART connection to the MCU has to be broken; otherwise the firmware upload will not start [#20748515] The recommended approach is to capture TuyaMCU traffic on the original firmware, figure out which dpID controls which function, and then upload OBK and map those dpIDs to channels [#20744725][#20744898] In the thread, the user later confirmed the device was working with OBK after mapping dpIDs for on/off, eco mode, manual mode, temperatures, and relay state, and reported stable operation with Home Assistant [#20748861][#20874147]
Generated by the language model.
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #91 21147106
    hard3d
    Level 7  
    Posts: 19
    p.kaczmarek2 wrote:
    Are you really sure that your device uses UART 2 for TuyaMCU?

    I also attached a photo of the device

    Image of a section of a red printed circuit board with visible traces and electronic components. Green and blue lines indicate UART1 and UART2 connections.
    UART1 Green lanes
    Blue UART2

    p.kaczmarek2 wrote:
    Have you tried to do Tuya config extraction to check the baud rate of the UART?

    I tried, but when reading I get the error "Failed to extract keys"
    Attachments:
    • BK7231N_TuyaConfig_obk19243A94.bin (72 KB) You must be logged in to download this attachment.
  • ADVERTISEMENT
  • #92 21147113
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14667
    Help: 656
    Rate: 12683
    Ok how do you power this device? Can you try to capture UART2 movement at 9600 and at 115200 bauds?
    Helpful post? Buy me a coffee.
  • #93 21147810
    hard3d
    Level 7  
    Posts: 19
    Hi. I calculated the exchange rate using the selection method. 34800 baud

    That's what the module sends to the MCU:
    Enabling adding to the app:
    //R 08.07.2024 22:39:00 WiFi received:
    55AA0001000000
    //R 08.07.2024 22:39:00 WiFi received:
    55AA000300010003
    //R 08.07.2024 22:39:00 WiFi received:
    55AA0004000003


    When adding an application:
    //R 08.07.2024 22:41:09 WiFi received:
    55AA000300010003
    //R 08.07.2024 22:41:17 WiFi received:
    55AA000300010205
    //R 08.07.2024 22:41:21 WiFi received:
    55AA000300010306
    //R 08.07.2024 22:41:21 WiFi received:
    55AA0008000007
    //R 08.07.2024 22:41:21 WiFi received:
    55AA00070002010009
    //R 08.07.2024 22:41:21 WiFi received:
    55AA0007000202000A
    //R 08.07.2024 22:41:21 WiFi received:
    55AA0007000224002C
    //R 08.07.2024 22:41:21 WiFi received:
    55AA000700020A0012
    //R 08.07.2024 22:41:21 WiFi received:
    55AA00070002100018
    //R 08.07.2024 22:41:21 WiFi received:
    55AA00070002180020
    //R 08.07.2024 22:41:21 WiFi received:
    55AA000700021F0027
    //R 08.07.2024 22:41:21 WiFi received:
    55AA00070002280030
    //R 08.07.2024 22:41:22 WiFi received:
    55AA000700022D0035
    //R 08.07.2024 22:41:22 WiFi received:
    55AA0007000213001B
    //R 08.07.2024 22:41:22 WiFi received:
    55AA000700021A0022
    //R 08.07.2024 22:41:22 WiFi received:
    55AA0007000217001F
    //R 08.07.2024 22:41:22 WiFi received:
    55AA0007000265006D
    //R 08.07.2024 22:41:22 WiFi received:
    55AA0007000266006E
    //R 08.07.2024 22:41:22 WiFi received:
    55AA00070002690071
    //R 08.07.2024 22:41:22 WiFi received:
    55AA000700021E0026
    //R 08.07.2024 22:41:22 WiFi received:
    55AA000700026A0072
    //R 08.07.2024 22:41:22 WiFi received:
    55AA000700026C0074
    //R 08.07.2024 22:41:22 WiFi received:
    55AA000700026D0075
    //R 08.07.2024 22:41:23 WiFi received:
    55AA000700026E0076
    //R 08.07.2024 22:41:23 WiFi received:
    55AA000700026F0077
    //R 08.07.2024 22:41:23 WiFi received:
    55AA00070002700078
    //R 08.07.2024 22:41:23 WiFi received:
    55AA00070002710079
    //R 08.07.2024 22:41:23 WiFi received:
    55AA0007000273007B
    //R 08.07.2024 22:41:24 WiFi received:
    55AA001C00080118070816291901A4
    //R 08.07.2024 22:41:24 WiFi received:
    55AA00070002100018
    //R 08.07.2024 22:41:24 WiFi received:
    55AA0034000A01020010020152030101AA
    
  • #94 21147820
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14667
    Help: 656
    Rate: 12683
    Wait a second, are you sure? Please double check. 34800 baud? That's not a standard one. So far we've only seen 9600 and 115200 bauds on TuyaMCU devices.
    Helpful post? Buy me a coffee.
  • #97 21149060
    divadiow
    Level 38  
    Posts: 5108
    Help: 441
    Rate: 902
    hard3d wrote:
    I tried, but when reading I get the error "Failed to extract keys"


    file contains below. no mention of baud tho

    Code: Text
    Log in, to see the code
  • ADVERTISEMENT
  • #98 21174914
    tomik67
    Level 12  
    Posts: 111
    Rate: 11
    p.kaczmarek2 wrote:
    Counter I can't specifically add, but if there was already a change handler, you could simply increment the selected channel by 1 at the time of such an event (i.e., you could script a counter yourself)


    Could you help me to create such a reset script ?
    I gave up using an optocupler because it caused voltage drops, resulting in erroneous temperature readings from the sensor.
    I used a MOSFET transistor to cut the ground from the MCU. Now just this script controlling the communication.
  • #99 21253455
    hard3d
    Level 7  
    Posts: 19
    Hello friends! I decided to return to the issue of installing the Openbox firmware on my thermostat. I installed version 1.17.740 on it today and was finally able to run it. This is what my autoexec.bat looks like now:
    
    SetFlag 26 1
    
    startDriver NTP
    ntp_timeZoneOfs 3
    
    startDriver TuyaMCU
    tuyaMcu_setBaudRate 38400
    uartSendHex 55AA000300010306
    
    delay_s 20
    tuyaMcu_sendCurTime
    
    waitFor NTPState 1
    echo "NTP is ready"
    


    The time is set. But nothing comes to the log from TuyaMCU. Apparently, something was added to the firmware that the device started working on UART2. But something is missing to accept the answers.
  • ADVERTISEMENT
  • #100 21253543
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14667
    Help: 656
    Rate: 12683
    Maybe you're missing a tuyaMcu_defWiFiState call with a proper WiFi state?
    Helpful post? Buy me a coffee.
  • #101 21253590
    hard3d
    Level 7  
    Posts: 19
    p.kaczmarek2 wrote:
    Maybe you're missing a tuyaMcu_defWiFiState call with a proper WiFi state?

    I added this parameter. It does not affect the operation of the WiFi module in any way.
  • #102 21254152
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14667
    Help: 656
    Rate: 12683
    You need to set it after starting TuyaMCU and you need to power off and on whole device so it can take effect.

    Futhermore, waiting for NTPState after 20 seconds delay and after tuyaMcu_sendCurTime makes no sense.
    Helpful post? Buy me a coffee.
  • #103 21254483
    hard3d
    Level 7  
    Posts: 19
    I removed the specified resistors and connected the MCU to UART1

    PCB with removed resistors and MCU connected to UART1 with a blue outline.

    And with this autoexec.bat configuration, the module started receiving messages from the MCU

    
    startDriver NTP
    ntp_timeZoneOfs 3
    
    startDriver TuyaMCU
    tuyaMcu_setBaudRate 38400
    
    uartSendHex 55AA0001000000
    uartSendHex 55AA000300010003
    uartSendHex 55AA000300010205
    uartSendHex 55AA000300010306
    uartSendHex 55AA0008000007
    
    delay_s 20
    tuyaMcu_sendCurTime
    


    I have a list of DP IDs. I managed to manage some of them. And the part I don't understand is how to send a command.
    D PID 106 must turn on the backlight.

    Thermostat...07_05.xlsx (12.5 kB)You must be logged in to download this attachment.

    
    // Send and Report
    setChannelType 1 Toggle
    setChannelLabel 1 "01 - Switch"
    
    // Send and Report
    setChannelType 2 ReadOnly
    setChannelLabel 2 "02 - Mode"
    
    // Send and Report
    setChannelType 3 Toggle
    setChannelLabel 3 "03 - Frost protection"
    
    // Send and Report
    setChannelType 4 Temperature_div10
    setChannelLabel 4 "04 - Set temperature"
    
    // Send and Report
    setChannelType 5 Temperature_div10
    setChannelLabel 5 "05 - Set temperature ceiling"
    
    // Send and Report
    setChannelType 6 ReadOnly
    setChannelLabel 6 "06 - Temperature scale"
    
    // Report Only
    setChannelType 7 Temperature_div10
    setChannelLabel 7 "07 - Current temperature"
    
    // Send and Report
    setChannelType 8 Temperature_div10
    setChannelLabel 8 "08 - Set temperature flooring"
    
    // Send and Report
    setChannelType 9 ReadOnly
    setChannelLabel 9 "09 - Weekly program"
    
    // Send and Report
    setChannelType 10 ReadOnly
    setChannelLabel 10 "10 - Working day setting"
    
    // Report Only
    setChannelType 11 ReadOnly
    setChannelLabel 11 "11 - Valve state"
    
    // Send and Report
    setChannelType 12 Toggle
    setChannelLabel 12 "12 - Child lock"
    
    // Report Only
    setChannelType 13 ReadOnly
    setChannelLabel 13 "13 - Fault warning"
    
    // Report Only
    setChannelType 14 ReadOnly
    setChannelLabel 14 "14 - Support features"
    
    // Report Only
    setChannelType 15 ReadOnly
    setChannelLabel 15 "15 - Temperature adjust step"
    
    // Report Only
    setChannelType 16 ReadOnly
    setChannelLabel 16 "16 - Mfg model"
    
    // Send and Report
    setChannelType 17 ReadOnly
    setChannelLabel 17 "17 - Backlight Setting"
    
    // Report Only
    setChannelType 18 ReadOnly
    setChannelLabel 18 "18 - Battery power"
    
    // Report Only
    setChannelType 19 ReadOnly
    setChannelLabel 19 "19 - Temp calibration step"
    
    // Send and Report
    setChannelType 20 ReadOnly
    setChannelLabel 20 "20 - Temp calibration"
    
    // Report Only
    setChannelType 21 ReadOnly
    setChannelLabel 21 "21 - Valve state"
    
    // Report Only
    setChannelType 22 ReadOnly
    setChannelLabel 22 "22 - Software version"
    
    // Send and Report
    setChannelType 23 ReadOnly
    setChannelLabel 23 "23 - Switch diff"
    
    // Send and Report
    setChannelType 24 ReadOnly
    setChannelLabel 24 "24 - Sensor type"
    
    // Send and Report
    setChannelType 25 ReadOnly
    setChannelLabel 25 "25 - Floor sensor type"
    
    // Send and Report
    setChannelType 26 Temperature_div10
    setChannelLabel 26 "26 - Floor temperature"
    
    
    // linkTuyaMCUOutputToChannel dpId verType tgChannel
    linkTuyaMCUOutputToChannel 1 1 1
    linkTuyaMCUOutputToChannel 2 4 2
    linkTuyaMCUOutputToChannel 10 1 3
    linkTuyaMCUOutputToChannel 16 2 4
    linkTuyaMCUOutputToChannel 19 2 5
    linkTuyaMCUOutputToChannel 23 4 6
    linkTuyaMCUOutputToChannel 24 2 7
    linkTuyaMCUOutputToChannel 26 2 8
    linkTuyaMCUOutputToChannel 30 0 9
    linkTuyaMCUOutputToChannel 31 4 10
    linkTuyaMCUOutputToChannel 36 4 11
    linkTuyaMCUOutputToChannel 40 1 12
    linkTuyaMCUOutputToChannel 45 5 13
    linkTuyaMCUOutputToChannel 101 2 14
    linkTuyaMCUOutputToChannel 102 2 15
    linkTuyaMCUOutputToChannel 105 3 16
    linkTuyaMCUOutputToChannel 106 0 17
    linkTuyaMCUOutputToChannel 107 2 18
    linkTuyaMCUOutputToChannel 108 2 19
    linkTuyaMCUOutputToChannel 109 2 20
    linkTuyaMCUOutputToChannel 110 1 21
    linkTuyaMCUOutputToChannel 111 3 22
    linkTuyaMCUOutputToChannel 112 2 23
    linkTuyaMCUOutputToChannel 113 4 24
    linkTuyaMCUOutputToChannel 114 2 25
    linkTuyaMCUOutputToChannel 115 2 26
    
  • #104 21254908
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14667
    Help: 656
    Rate: 12683
    hard3d wrote:
    And the part I don't understand is how to send a command.
    D PID 106 must turn on the backlight.

    https://github.com/openshwprojects/OpenBK7231T_App/blob/main/docs/commands.md
    You can use tuyaMcu_sendState command. You should also try using tuyaMcu_sendCmd instead lf Uart send, so it calculates checksum on it's own.
    Sample usage:
    
    // tuyaMcu_sendCmd 0x30 000000
    // This will send 55 AA 00 30 00 03 00 00 00 32
    
    Helpful post? Buy me a coffee.
  • #105 21255785
    Janco245
    Level 10  
    Posts: 6
    Rate: 1
    Hello everyone,

    I have 12 Moes BHT-002 thermostats at home, which originally used WB3S chips. I replaced these with ESP12 and uploaded the thermostat-v1.22-fas.bin.gz firmware. It works great, but the thermostats occasionally freeze, and I have to disconnect and reconnect the power to get them running again. I decided to revert back to the WB3S chips and try using the OpenBK firmware. However, I read that Tomik67 is also having freezing issues with this firmware.

    I am trying to use the code that Tomik67 wrote. The communication through the web interface works well, but I’m struggling to add the thermostat to Home Assistant (HA). It adds automatically, but the temperature is displayed incorrectly— the value of 17 is shown as 17x2/10=3.4. Additionally, there is no option to change the temperature.

    Is there a way to modify the code in OpenBK so that HA recognizes the thermostat correctly? Or is the only option to add it directly through YAML? I’ve tried to add the thermostat to the configuration.yaml following Tomik67 instructions, but I haven’t been successful so far. I don’t have much programming knowledge, so I would greatly appreciate any help.


    Thank you very much for any assistance!

    Thermostat user interface displaying settings and status. Thermostat control panel in an app.
  • #106 21257041
    tomik67
    Level 12  
    Posts: 111
    Rate: 11
    Janco245 wrote:
    It works great, but the thermostats sometimes hang up
    .

    Hi. Unfortunately the problem with the thermostat hanging up is due to instability of the MCU or its software. I have returned the hanging thermostats, leaving one for testing purposes. Because of such cases, I always make a backup of the original to restore it in case of problems and advertise the unit.
    As for the Home Assistrant - you need to add the config file yourself to configuration.yaml and declare the device as mqtt: climate: as in my earlier example, then HA will recognise it as a thermostat.
    The only trouble for you will be with the entity showing the actual state of the thermostat relay, ( mode_state_topic: 'BHT_B_cabinet/5/get', " because originally the thermostat does not send a state, the TUYA application infers the state based on comparing the actual temperature with the desired temperature, you need to rework the thermostat to read the presence of the voltage controlling the relay and pass this information to the free WB3S pin and include this in the configuration.
    The topic has been covered here before, do a search, this has also been written about on the Tasmota forum, if you have trouble finding topics let me know, I can help.
  • ADVERTISEMENT
  • #107 21257408
    Janco245
    Level 10  
    Posts: 6
    Rate: 1
    Thank you for your response. I haven't yet added the thermostat to Home Assistant, and it has already frozen. In this case, it doesn't make sense for me to try to integrate the thermostat into HA with the openBK software if it freezes just like it does with the thermostat-v1.22-fas.bin.gz firmware on the ESP8266. I was under the impression that the thermostats were freezing due to the replacement of WB3S with ESP12.

    I had the thermostats running for about 3 months with Tuya software, and they never froze. Do you think the Tuya software somehow detects a freeze and restarts the MCU? I also have 10 other thermostats at work, which I purchased a bit earlier, and those have the ESP8266 chip straight from the factory. The PCB is slightly different, but they look the same, and their labeling is identical. After flashing the software, those thermostats don’t have any freezing issues.

    The thermostats that are freezing were purchased from AliExpress about a year ago, so I can't return them anymore. Do you think there’s any way to resolve the freezing issue? Or would it be better to switch back to Tuya software and add them through the cloud?
  • #108 21257466
    hard3d
    Level 7  
    Posts: 19
    Hello friends!
    I'm still working on my thermostat. And there are 2 questions.
    1) There is DPIP 106 "Backlight Setting". 55 AA 03 07 00 0C 6A 00 00 08 04 B0 01 E0 00 00 64 00 80
    Which indicates the operating time of the backlight, brightness and status. Is it possible to somehow decompose blocks into variables and manage them from the main interface of the module? And how can HEX be sent from MQTT to TuyaMCU to manage this DPID?

    2) The thermostat has 4 icons of the current weather.
    Digital thermostat display with weather icons and temperature information.
    I know how to turn them on. Are there any developments on the request of the current weather by the module and the execution of any actions?
  • #109 21257841
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14667
    Help: 656
    Rate: 12683
    1. it looks like a raw data packet:
    TuyaMCU Explorer software with data analyzer in hex format.
    Value seems to be 04 B0 01 E0 00 00 64 00, it should be possible to guess the meaning of each bytes but we would need to have separate captures with noted settings, like "this packet set 90% brightness" and then you look for value 90 (as hex), then the same for date, etc, etc. I don't think I can guess that without such sample data captures.
    2. I don't understand the question. Can you be more specific?
    How do you turn those icons on?
    You can request TuyaMCU data points via tuyaMcu_sendQueryState command, if that's what you're asking for?
    Or do you want OpenBeken to request weather from web?
    Helpful post? Buy me a coffee.
  • #110 21257968
    hard3d
    Level 7  
    Posts: 19
    1) I have an explanation for each byte from the seller.
    Byte0 - Byte1: 完全关闭背光的起始时间,距离00:00的分钟数
    Byte2 - Byte3:完全关闭背光的结束时间,距离00:00的分钟数
    Byte4 - Byte5:屏幕熄灭到夜模式生效前的时间,单位秒
    Byte6:屏幕熄灭到夜模式生效前的背光亮度,1-100
    Byte7:夜模式是否使能

    2) Here is the HEX of enabling three icons.

    // The Sun
    55AA0034000A010200030201510301019C

    // Cloudy
    55AA0034000A01020012020146030102A1

    // Rain
    55AA0034000A010200030201500301039D

    As far as I understand, the original firmware determines the location of the device and the current weather by IP and includes the desired icon.
  • #111 21259744
    tomik67
    Level 12  
    Posts: 111
    Rate: 11
    >>21257408 .
    Unfortunately nothing will help, neither swapping modules nor TUYA servers, the fault is either a faulty MCU or badly written MCU firmware which leads to a "Memory Leak" and freezes the MCU.
    Your earlier thermostats may have a different MCU, I have already had to deal with three different mudules (ESP8266, WB3S, CB3S) and four different MCUs when ordering the BHT-002 and WHT-002, working on 3.3V and others on 5V.
    The Chinese ship whatever they have on hand or a foot, three months ago I ordered four black BHT-002s for a friend from one vendor, received two with ESP8266 and two WB3S. Even the model designations sometimes don't matter to them, your thermostats came with WB3S modules so they should be marked WHT-002 not BHT.
  • #112 21296420
    mvz0209
    Level 8  
    Posts: 20
    Hello! Thank you for your work. tomik67 and p.kaczmarek2 did a great job.
    I connected the thermostat to Home Assistant, found the output to reset the thermostat. Soldered it to pin P26.

    Electronic thermostat circuit on a printed circuit board.[/url]

    Please help me write the correct script in autoexecs.bat
    I would like the thermostat to reboot at 30 messages with
    heartbeat_valid = 0
    , and there would be a reboot counter

    Thanks
  • #113 21298207
    mvz0209
    Level 8  
    Posts: 20
    Please tell me which command can be used to find
    heartbeat_valid = 0

    Added after 4 [hours] 39 [minutes]:

    p.kaczmarek2 wrote:
    I can plug the counting of seconds without heartbeat into events and then using addChangeHandler will be able to trigger the handling of this.


    Please tell me how to run such a counter?
  • #114 21319850
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14667
    Help: 656
    Rate: 12683
    With todays update, I've added support for "MissedHeartbeats" to the main releases.
    Sample usage:
    
    addChangeHandler MissedHeartbeats > 4 setChannel 0 1
    

    This should fire event when number of missed heartbeats becomes larger than 4 (i.e. on transition from 4 to 5). It will NOT fire again once it changes from like 5 to 6, etc. It detects transition.

    The more missed heartbeats, the longer TuyaMCU is offline.

    See code:
    https://github.com/openshwprojects/OpenBK7231...mmit/8c0bafc0626157e1eeab1fb210a2f84b8d5d0097
    Helpful post? Buy me a coffee.
  • #115 21326317
    mvz0209
    Level 8  
    Posts: 20
    p.kaczmarek2 wrote:
    With today's update, I've added support for "MissedHeartbeats" to the main releases.
    Sample usage:
    
    addChangeHandler MissedHeartbeats > 4 setChannel 0 1
    

    This should fire event when number of missed heartbeats becomes larger than 4 (i.e. on transition from 4 to 5). It will NOT fire again once it changes from like 5 to 6, etc. It detects transition.

    The more missed heartbeats, the longer TuyaMCU is offline.


    Thank you very much for your work! I will definitely test it and supplement it. BHT-002 thermostats are very common.
  • #116 21330239
    mvz0209
    Level 8  
    Posts: 20
    Great, today I caught the thermostat hanging by turning on pin 26. Now it just turned off when it freezes.


    now I have made a script where channel 10 is a hang counter. We are testing further:

    setChannel 10 0
    alias FaltHeartbeats backlog setChannel 0 1; addChannel 10 1; delay_s 2; setChannel 0 0
    addChangeHandler MissedHeartbeats > 4 FaltHeartbeats

    Moderated By p.kaczmarek2:


    Please note that delay_s in backlog will work only in OBK builds later than 2025.06.19. It was not supported before.

  • #117 21330264
    divadiow
    Level 38  
    Posts: 5108
    Help: 441
    Rate: 902
    Can anyone with a factory firmware backup please send me a copy. Thanks!
  • #118 21333687
    mvz0209
    Level 8  
    Posts: 20
    p.kaczmarek2 Thank you very much, my thermostat is working. There have already been 2 reboots due to the freeze
  • #119 21358174
    tomik67
    Level 12  
    Posts: 111
    Rate: 11
    >>21330264 .
    I don't know what firmware you are referring to, I have copies of all the modules (CB3S, WB3S) in the thermostats I converted from TUYA to OBK at my disposal.
    However, if it is the MCU software that is causing the problems and is described in the last posts of this thread then I don't know how to go about reading it.
    I have kept one thermostat with a freezing problem and am willing to experiment if I get instructions on how to go about it.
  • #120 21358422
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14667
    Help: 656
    Rate: 12683
    I think he asked for original Tuya 2MB backup. It can be used to extract some more information about the device.
    Helpful post? Buy me a coffee.

Topic summary

✨ The discussion centers on uploading OpenBK firmware to the MOES BHT-002-GCLW v4 thermostat, which contains a TUYA CB3S BK7231N WiFi module and a separate MCU managing the relay and sensors. Users confirmed that OpenBK supports TuyaMCU devices but requires knowledge of device-specific dpIDs to map variables correctly. The thermostat’s relay status is not exposed via dpID, necessitating hardware modification by wiring the relay coil voltage to a free GPIO pin for accurate relay state reporting. Communication occurs over UART at a non-standard baud rate (38400 or 34800), with some devices requiring desoldering or voltage level adjustments for proper flashing and MCU communication. The OpenBK autoexec.bat script is used to configure channels, map dpIDs, start drivers (TuyaMCU, NTP), and set WiFi state to paired (defWiFiState 4). Users integrated the thermostat with Home Assistant (HA) via MQTT, facing challenges such as inverted relay state reporting and temperature scaling (values divided by 2). Solutions include custom YAML configuration for HA, channel type adjustments (toggle_inv, read-only), and scripting for temperature setpoint commands with multiplication factors. The MCU occasionally freezes, requiring hardware resets; users implemented MCU reset via GPIO or power cycling using optocouplers or MOSFETs. A new OpenBK feature tracks missed heartbeats to trigger automatic MCU resets. Time synchronization via NTP is essential for correct thermostat operation, with suggestions to implement automatic daylight saving time adjustments. The community shared firmware backups, dpID lists, and scripts to improve stability and integration. Some users noted that original Tuya firmware is more stable, and freezing issues may stem from MCU firmware or hardware faults. Overall, OpenBK firmware provides stable operation and flexible integration with HA after proper configuration and occasional hardware modifications.
Generated by the language model.

FAQ

TL;DR: With dpIDs 1, 2, 3, 4, 5, 6, 101, and 102 identified and the UART path restored after flashing, this OpenBK workflow solves MOES BHT-002-GCLW v4 setup for Home Assistant users. One maintainer summed it up: "make a copy of the batch, upload OBK"—but only after packet capture and correct autoexec ordering. [#20768815]

Why it matters: This thread turns a risky BK7231N thermostat flash into a repeatable OpenBK, TuyaMCU, and Home Assistant integration path.

Variant Wi-Fi module Typical UART/Tuya notes Main risk from thread
BHT-002-GCLW v4 CB3S / BK7231N TuyaMCU over UART, usually 9600 baud Must break MCU-UART path for backup/flash
Earlier BHT-002 TYWE3S / ESP8266 Existing ESP thermostat projects exist Different firmware path
Some WHT/BHT revisions WB3S Some boards use 5 V MCU-UART levels May need voltage divider and different wiring

Key insight: OpenBK works on this thermostat when you treat it as a TuyaMCU device, not a direct-relay device. The flash itself is only half the job; dpID discovery, correct channel mapping, and script order determine whether controls work after reboot.

Quick Facts

  • The thermostat reported these working dpIDs in the thread: 1 power, 2 target temperature, 3 current temperature, 4 manual/program mode, 5 ECO, 6 button lock, 101 schedule raw, 102 floor or external temperature. [#20774147]
  • Temperature values are doubled: 10 = 5.0°C, 11 = 5.5°C, and the usable setpoint range shown was 5°C to 35°C in 0.5°C steps. [#20748861]
  • A working relay-state hardware mod used a free CB3S GPIO to sense about 3.25 V when the relay coil was energized and 0 V when off, because this thermostat does not expose real relay status by dpID. [#20761670]
  • The maintainer later added MissedHeartbeats handling; one tested reset rule triggered when missed heartbeats became greater than 4, then pulsed a reset channel for 2 seconds. [#21330239]
  • For one alternate thermostat board, TuyaMCU traffic was captured at 38400 baud on UART2, while the earlier CB3S/WB3S-backed BHT thread repeatedly referenced 9600 baud TuyaMCU communication. [#21253455]

How do I flash OpenBeken onto a MOES BHT-002-GCLW v4 thermostat with a TUYA CB3S BK7231N module without breaking TuyaMCU communication?

Yes—flash it as a TuyaMCU device, but restore the MCU-UART path afterward. 1. Back up the original CB3S firmware before writing OpenBK. 2. Temporarily break the MCU UART connection so BK7231 flashing tools can talk to the module cleanly. 3. After flashing, resolder the removed parts, boot OpenBK, start TuyaMCU, set tuyaMcu_defWiFiState 4, and verify dpIDs in the log. The thread showed OpenBK booting only after the removed components were soldered back, because TuyaMCU communication needed the original path restored. [#20748487]

What is TuyaMCU, and why do dpIDs matter when configuring a MOES BHT-002 thermostat with OpenBK or Tasmota?

"TuyaMCU" is a serial control protocol layer that lets a Wi-Fi module exchange typed data points with a separate thermostat MCU, using numbered dpIDs for each function. dpIDs matter because OpenBK and Tasmota cannot map power, temperature, ECO, or mode controls until each function’s dpID is known. The maintainer stated that without knowing which dpID matches which variable, you will not get started. On this thermostat, that meant capturing UART traffic before building the final OpenBK mapping. [#20744725]

Which dpIDs are used by the MOES BHT-002-GCLW thermostat for power, target temperature, current temperature, ECO mode, button lock, and manual/program mode?

The working map was: dpID 1 = power, 2 = target temperature, 3 = current temperature, 4 = manual/program mode, 5 = ECO mode, and 6 = button lock. The thread later confirmed 101 as the heating schedule raw block and 102 as external or floor temperature. For mode, the thermostat used dpID 4 enum, with 0 = programmable/auto and 1 = manual. These values were confirmed through captures, logs, and a final shared autoexec.bat. [#20874147]

What is the safest way to capture TuyaMCU UART packets on a MOES thermostat before flashing OpenBK?

The safest method is to capture packets while the thermostat still runs original firmware and is powered only from a safe low-voltage bench supply. 1. Resolder the UART path and pair the thermostat with the Tuya app. 2. Power the board from 3.3 V, or 5 V before the LDO, with mains disconnected. 3. Listen on the Wi-Fi module’s U1TX/U1RX during actions like setpoint changes or relay events, then decode the packets in TuyaMCUAnalyzer. That approach lets you identify dpIDs before flashing and avoids guessing. [#20744725]

Why do I need to disconnect or desolder the UART path to the MCU before backing up or flashing a CB3S/WB3S module?

You need to do it because the MCU shares the serial lines and interferes with the flashing session. The thread explicitly notes that firmware upload required the UART connection to the MCU to be broken first, and one user had to remove two nearby parts before BK7231 readout worked at all. After flashing, those parts were soldered back so TuyaMCU communication could resume. If you skip this, backup reads can fail with CRC or communication errors, and OpenBK may flash but not boot correctly with the thermostat logic. [#20748515]

Where should OpenBK TuyaMCU mapping commands be placed on this thermostat, and how do I build a working autoexec.bat file?

Place the TuyaMCU startup and channel mapping commands in autoexec.bat, not only in one-off command execution. A working file started NTP and TuyaMCU, set tuyaMcu_defWiFiState 4, declared channels 1 to 9, and linked dpIDs with linkTuyaMCUOutputToChannel, including 1 bool 1, 5 bool 2, 6 bool 3, 4 enum 4, 3 val 6, 2 val 7, 102 val 8, and 101 raw 9. That file became the stable baseline later shared for Home Assistant use. [#20874147]

Why did the ON/OFF command only start working properly after reboot when the channel mapping was moved before waitFor NTPState in autoexec.bat?

It started working because waitFor NTPState 1 delayed channel creation until after the MCU had already sent its initial state. When mapping came late, OpenBK missed the first dpID values, so the power channel was not initialized correctly after reboot. The maintainer identified this ordering bug and advised placing mapping first, or removing waitFor entirely. After that change, the user reported that ON/OFF and other functions worked immediately after reboot. [#20768969]

How can I map doubled temperature values on the MOES BHT-002 to OpenBK Temperature_div2 channels and Home Assistant MQTT topics correctly?

Map the thermostat’s value dpIDs to Temperature_div2 channels, then scale MQTT values in Home Assistant. In OpenBK, the working mapping was dpID 3 -> channel 6 for current temperature and dpID 2 -> channel 7 for target temperature. In Home Assistant YAML, the thread used current_temperature_template: '{{ float(value)*0.5|round(2) }}' and temperature_command_template: '{{ float(value)*2 }}'. That converts OpenBK channel traffic into real Celsius readings and sends the thermostat the doubled integer it expects. [#20874147]

What is Temperature_div2 in OpenBeken, and how does it convert the thermostat's doubled temperature values into real °C readings?

"Temperature_div2" is an OpenBeken channel type that stores a thermostat’s doubled integer temperature and presents it as a Celsius value divided by two, preserving 0.5°C steps. In this thread, 10 meant 5.0°C and 11 meant 5.5°C, so OpenBK needed a special type instead of a plain value channel. The maintainer added support after confirming this scale on the BHT thermostat, and later users showed it displaying correct temperatures in both the OpenBK GUI and Home Assistant. [#20748861]

How do I send time updates from OpenBK to a TuyaMCU thermostat and configure a custom NTP server for the MOES BHT-002?

Start the NTP driver, set your server, and let OpenBK feed time to the MCU. The working example used startDriver NTP, ntp_setServer 10.9.10.250, and ntp_timeZoneOfs +2:00. The thermostat’s MCU asked for time about hourly, and a user confirmed that a manually set clock reset after roughly 1 hour if no update arrived. The maintainer also noted that OpenBK can send time on demand from script, but regular NTP plus TuyaMCU time handling was enough for normal operation. [#20761117]

Why does Home Assistant Discovery show the relay state inverted or create a read-only temperature entity for this thermostat, and how can I fix it with manual YAML?

It happens because Discovery treats this thermostat’s relay-state and Temperature_div2 channels as generic entities, not a full climate model. One user saw the relay payloads reversed as `pl_on:
Generated by the language model.
ADVERTISEMENT