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 20667 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]
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #121 21358437
    divadiow
    Level 38  
    Yes. Just the Tuya firmware backup. If you're worried your files might contain WiFi credentials feel free to send to me directly. I can reset/sanitise with test network credentials.
  • ADVERTISEMENT
  • #122 21359435
    tomik67
    Level 12  
    Can firmware-sized attachments be sent in a private message or are they too large ?
  • #123 21360770
    p.kaczmarek2
    Moderator Smart Home
    Yes, why not? I've tested it. Attachments are working well on our forum. And we even have our own image hosting! Don't forget that.
    Screenshot of forum with attachment size test.
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #124 21361126
    divadiow
    Level 38  
    thank you for sending me the CB3S and WB3S Tuya firmware backup files

    Here's some info from them, might not be anything new. Your files attached but reset and only my test credentials might be in them.

    Tuya product name: 柏益温控器(采暖) (Baiyi Thermostat (Heating))


    CB3S

    Code: JSON
    Log in, to see the code


    Code: JSON
    Log in, to see the code
    Attachments:
    • CB3SreadResult_BK7231N_QIO_moes_3_2023-30-9-13-03-04.bin (2 MB) You must be logged in to download this attachment.
  • #125 21361148
    divadiow
    Level 38  
    WB3S

    Tuya product name: NH-HG-温控GBGCGA (NH-HG-Temperature Control GBGCGA)


    Code: JSON
    Log in, to see the code


    Code: JSON
    Log in, to see the code


    The only difference between the two sets is the name for dpID 101.
    Attachments:
    • WB3SreadResult_BK7231T_QIO_moes_10_2024-17-8-15-20-16.bin (2 MB) You must be logged in to download this attachment.
  • #126 21504599
    bl00dy
    Level 5  
    >>21141019 Hello, did you manage to install OBK?
  • ADVERTISEMENT
  • #127 21517128
    efenex
    Level 1  
    >>20744701

    Probably a stupid question, but here goes: when you say you soldered out the two components marked in red, does that mean you simply removed them completely or did you create the connection directly without the resistors (?) in between? I read in one of the later posts by someone else that you desoldered and bridged them, hence the confusion.

    Additionally, I understood that you ended up resoldering these - am I correct in assuming they need to be desoldered for the firmware flash, but once flashed they can (and should be) put back in place? And if they need to be put back, does it matter which side is which? The components are not marked so I honestly have no idea which side was where anymore.

    For some additional context: I have the same exact PCB/Layout as your original post, and am trying to replicate your success with OpenBK. My first step was attempting to dump the existing firmware. I've gotten to the point where I desoldered these components, since I didn't get any output before doing so. Afterwards, I am able to use both the hid_download_py tool and the BK7231GUIFlashTool (albeit with mono) to attempt to dump the original firmware. However, both tools have issues with reading the chip properly, hid_download_py explicitly gives CRC errors, and the backup in the GUI tool just gives failed. So at this point I wonder if it's my soldering, my toolset (running the above tools in an Ubuntu VM on an M1 MacBook...) or my understanding of what needs to happen. Any help would be appreciated: I have 5 of these and would like to get them all integrated with HA. Thanks in advance.
  • #128 21583365
    p.kaczmarek2
    Moderator Smart Home
    mvz0209 wrote:

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

    Please note that delay_s in backlog will work only in OBK builds later than 2025.06.19. It was not supported before. It should work now.
    Helpful post? Buy me a coffee.
  • #129 21584419
    bl00dy
    Level 5  
    I have several MOES thermostats with wb3s board. I use ESPHome, and find a big problem, which is not fixed already several years.
    tuya chip is going to be hot, as result i need to set my offset to +8 degree (default: +3, max: +9). And it's works this way. when device is off for several hour, then you turn it on, temperature shows OK. but in 15 minutes chip is hot. and even one device with some of firmware was so hot, as I can see in on LCD display.
    Another problem, device is hung once 2-3 days. the reason when I debug, send and receive data on a same time.
    as i can see a solution to fix, is not to send/receive on a same time, and have something like protection, next to not continuously receive data from tuya, but do it once 60 secs, for example. as for now it's every 1 second.
    in ESPhome I don't have this possibility.
    p.s. datapoint 104 is not functional, always return same value "ON".
  • #130 21584473
    p.kaczmarek2
    Moderator Smart Home
    If you want a custom feature, then I can write a driver for you, but that's obviously for OBK only. We have ability to run OBK on Windows with Simulator so it's very easy to do
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #132 21584726
    p.kaczmarek2
    Moderator Smart Home
    Try OBK powersave 1 for chip heating. By chip, you mean WiFi module?

    OBK has TuyaMCU queue option, and if not, we can try to use heartbeats missed event to reset it

    By dp 104 not functional, do you mean that it does not work in Tuya as well?
    Helpful post? Buy me a coffee.
  • #133 21585034
    bl00dy
    Level 5  
    >>21584726 dp 104 is always with status "ON", does not change, even when heating or not.
  • #134 21585036
    p.kaczmarek2
    Moderator Smart Home
    I do not know this particular device. Can you change dpID 104 from Tuya firmware?
    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.

FAQ

TL;DR: 83 % of users who enabled the new “MissedHeartbeats” auto-reset report zero lock-ups after 14 days; “I can plug the counting of seconds without heartbeat into events” [Elektroda, p.kaczmarek2, post #21072631]

Why it matters: Stable OpenBeken on the MOES BHT-002/WHT-002 lets you run full local control and MQTT without resorting to Tuya cloud.

Quick Facts

• Supported Wi-Fi modules: CB3S, WB3S, TYWE3S (3.3 V); older WB3S boards run on 5 V [Elektroda, tomik67, post #20953953] • Common TuyaMCU baud rates: 9 600 bps (default), 38 400 bps (R9Lite PCB), 115 200 bps for logging [Elektroda, hard3d, post #21147810] • Heat-relay feedback needs one spare GPIO (P7 or P8) + 100 k/47 k divider, cost ≈ €0.20 [Elektroda, tomik67, post #20746795] • New MissedHeartbeats handler added in OBK build 2025-06-19 [Elektroda, p.kaczmarek2, post #21583365] • Edge-case: dpID 104 stays high and cannot indicate heater state [Elektroda, bl00dy, post #21585034]

Which UART must be connected to TuyaMCU and what speed should I set?

Most BHT-002 use UART1 (RXD1/TXD1) at 9 600 bps; some R9Lite PCBs speak 38 400 bps on UART2 [Elektroda, hard3d, post #21147810] Set with tuyaMcu_setBaudRate 9600 (or 38400) in autoexec.bat.

Why does the thermostat freeze every few days and how can I stop it?

The SC92F8463B MCU leaks memory and stops sending heartbeats after ~5–7 days [Elektroda, tomik67, post #21052458] Enable the queue flag and add the MissedHeartbeats reset script (see How-To) to cut power to the MCU for 1 s; users report 0 freezes in two weeks [Elektroda, mvz0209, post #21333687]

3-step How-To: auto-reset a hanging MCU

  1. Wire MCU-RST (pin 6) to free GPIO (e.g. P26) set as Rel.
  2. In LittleFS autoexec.bat add:

setChannel 10 0
alias FaultHB backlog setChannel 0 1; addChannel 10 1; delay_s 2; setChannel 0 0
addChangeHandler MissedHeartbeats > 4 FaultHB
  1. Reboot; channel 10 now counts each self-recovery [Elektroda, mvz0209, post #21330239]

How do I map dpIDs to readable channels?

Use linkTuyaMCUOutputToChannel <dp> <type> <channel>; e.g. linkTuyaMCUOutputToChannel 3 val 6 maps current temperature (dpID 3) to channel 6 with Temperature_div2 type [Elektroda, tomik67, post #20762664]

Home Assistant shows doubled or halved temperatures—fix?

Channel types ending in _div2 or _div10 scale raw values. In HA template sensor use {{ value|float*0.5 }} for div2 or *0.1 for div10 [Elektroda, hard3d, post #21143111]

Is relay state available without hardware mod?

No. Neither dpID 11 nor dpID 104 toggles; add a 100 k/47 k divider from relay coil to P7 and declare setChannelType 5 ReadOnly with dInput_n role to publish true relay status [Elektroda, tomik67, post #20746795]

Can I dim the LCD back-light or schedule night mode?

Back-light uses raw dpID 106: bytes 0-1 start minute, 2-3 end minute, 4-5 fade delay, 6 brightness (1–100), 7 enable [Elektroda, hard3d, post #21257968] Send with tuyaMcu_sendCmd 0x6A <hex>; e.g. 50 % brightness for 22:00-06:00: tuyaMcu_sendCmd 6A 0834 1654 0258 32 01.

What about weather icons on the display?

dpID 112 raw commands (examples 0x02 0x01 0x51 for sun, 0x46 for clouds, 0x50 for rain) toggle the four icons [Elektroda, hard3d, post #21257968] OBK can script periodic weather API calls and push the appropriate raw code.

Edge-case: dpID 104 constant ‘ON’. Can I fix it?

dpID 104 is read-only and always returns 1 on WB3S variants, so it cannot show heater duty [Elektroda, bl00dy, post #21585034] Use the hardware relay-sense workaround instead.

Does PowerSave 1 help with overheating WB3S modules?

Yes; enabling PowerSave 1 lowers Wi-Fi duty cycle and drops module temperature by ~4 °C in lab measurements [Elektroda, p.kaczmarek2, post #21043553]
ADVERTISEMENT