You can change this behavior in the flags:
https://github.com/openshwprojects/OpenBK7231T_App/blob/main/docs/flags.md
Flag:
[MQTT] Always publish channels used by TuyaMCUCzy wolisz polską wersję strony elektroda?
Nie, dziękuję Przekieruj mnie tam[MQTT] Always publish channels used by TuyaMCUDebug:TuyaMCU:TuyaMCU_ApplyMapping: id 3 with value 42 is not mappedInfo:TuyaMCU:TuyaMCU_ProcessIncoming[ver=1]: processing command 0 (Hearbeat) with 8 bytes
Info:MAIN:Time 442, idle 190061/s, free 74160, MQTT 0(28), bWifi 1, secondsWithNoPing 377, socks 2/38
Info:MAIN:Time 443, idle 183271/s, free 74160, MQTT 0(28), bWifi 1, secondsWithNoPing 378, socks 2/38
Info:MAIN:Time 444, idle 187831/s, free 74160, MQTT 0(28), bWifi 1, secondsWithNoPing 379, socks 2/38
Info:MAIN:Time 445, idle 189711/s, free 74160, MQTT 0(28), bWifi 1, secondsWithNoPing 380, socks 2/38
Info:TuyaMCU:TUYAMCU received: 55 AA 01 00 00 01 01 02
Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=1]: processing command 0 (Hearbeat) with 8 bytes
Info:MAIN:Time 446, idle 190004/s, free 74160, MQTT 0(28), bWifi 1, secondsWithNoPing 381, socks 2/38
Info:MAIN:Time 447, idle 184056/s, free 74160, MQTT 0(28), bWifi 1, secondsWithNoPing 382, socks 2/38
Info:MAIN:Time 448, idle 189605/s, free 74160, MQTT 0(28), bWifi 1, secondsWithNoPing 383, socks 2/38
Info:MAIN:Time 449, idle 191359/s, free 74160, MQTT 0(28), bWifi 1, secondsWithNoPing 384, socks 2/38// Start NTP Driver
startDriver NTP
// Set NTP Server
ntp_setServer 10.9.10.250
// Set timezone
ntp_timeZoneOfs +2:00
startDriver TuyaMCU
tuyaMcu_defWiFiState 4
waitFor NTPState 1
echo "NTP is ready"
setChannelType 1 toggle
setChannelLabel 1 OnOff
setChannelType 2 toggle
setChannelLabel 2 EnergySaving
setChannelType 3 toggle
setChannelLabel 3 ButtonLock
setChannelType 4 toggle
setChannelLabel 4 ManualMode
setChannelType 5 ReadOnly
setChannelLabel 5 RelayState
setChannelType 6 Temperature_div2
setChannelLabel 6 CurrentTemperature
setChannelType 7 Temperature_div2
setChannelLabel 7 SetTemperature
// linkTuyaMCUOutputToChannel dpId verType tgChannel
linkTuyaMCUOutputToChannel 1 bool 1
linkTuyaMCUOutputToChannel 5 bool 2
linkTuyaMCUOutputToChannel 6 bool 3
linkTuyaMCUOutputToChannel 4 enum 4
linkTuyaMCUOutputToChannel 3 val 6
linkTuyaMCUOutputToChannel 2 val 7// Start NTP Driver
startDriver NTP
// Set NTP Server
ntp_setServer 10.9.10.250
// Set timezone
ntp_timeZoneOfs +2:00
startDriver TuyaMCU
tuyaMcu_defWiFiState 4
waitFor NTPState 1
echo "NTP is ready"
setChannelType 1 toggle
setChannelLabel 1 OnOff
setChannelType 2 toggle
setChannelLabel 2 EnergySaving
setChannelType 3 toggle
setChannelLabel 3 ButtonLock
setChannelType 4 toggle
setChannelLabel 4 ManualMode
setChannelType 5 ReadOnly
setChannelLabel 5 RelayState
setChannelType 6 Temperature_div2
setChannelLabel 6 CurrentTemperature
setChannelType 7 Temperature_div2
setChannelLabel 7 SetTemperature
// linkTuyaMCUOutputToChannel dpId verType tgChannel
linkTuyaMCUOutputToChannel 1 bool 1
linkTuyaMCUOutputToChannel 5 bool 2
linkTuyaMCUOutputToChannel 6 bool 3
linkTuyaMCUOutputToChannel 4 enum 4
linkTuyaMCUOutputToChannel 3 val 6
linkTuyaMCUOutputToChannel 2 val 7
delay_s 5
setChannel 1 1
delay_s 1
setChannel 1 0
Info:MAIN:Module reboot in 1...
00 01 01 10
Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=1]: processing command 7 (State) with 12 bytes
Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 1, dataType 1-DP_TYPE_BOOL and 1 data bytes
Info:TuyaMCU:TuyaMCU_ParseStateMessage: raw data 1 byte:
Info:TuyaMCU:TUYAMCU received: 55 AA 01 07 00 08 02 02 00 04 00 00 00 2A 41
Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=1]: processing command 7 (State) with 15 bytes
Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 2, dataType 2-DP_TYPE_VALUE and 4 data bytes
Info:TuyaMCU:TuyaMCU_ParseStateMessage: raw data 4 int: 42
Info:TuyaMCU:TUYAMCU received: 55 AA 01 07 00 08 03 02 00 04 00 00 00 2A 42
Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=1]: processing command 7 (State) with 15 bytes
Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 3, dataType 2-DP_TYPE_VALUE and 4 data bytes
Info:TuyaMCU:TuyaMCU_ParseStateMessage: raw data 4 int: 42
Info:TuyaMCU:TUYAMCU received: 55 AA 01 07 00 05 04 04 00 01 01 16
Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=1]: processing command 7 (State) with 12 bytes
Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 4, dataType 4-DP_TYPE_ENUM and 1 data bytes
Info:TuyaMCU:TuyaMCU_ParseStateMessage: raw data 1 byte:
Info:TuyaMCU:TUYAMCU received: 55 AA 01 07 00 05 05 01 00 01 00 13
Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=1]: processing command 7 (State) with 12 bytes
Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 5, dataType 1-DP_TYPE_BOOL and 1 data bytes
Info:TuyaMCU:TuyaMCU_ParseStateMessage: raw data 1 byte:
Info:TuyaMCU:TUYAMCU received: 55 AA 01 07 00 05 06 01 00 01 00 14
Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=1]: processing command 7 (State) with 12 bytes
Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 6, dataType 1-DP_TYPE_BOOL and 1 data bytes
Info:TuyaMCU:TuyaMCU_ParseStateMessage: raw data 1 byte:
Info:TuyaMCU:TUYAMCU received: 55 AA 01 07 00 3A 65 00 00 36 19 0F 24 01 08 1F 1D 0B 1E 1E 0D 22 00 11 2C 00 16 1E 00 06 28 00 08 28 1E 0B 28 1E 0D 28 00 11 28 00 16 1E 00 06 28 00 08 28 1E 0B 28 1E 0D 28 00 11 28 00 16 1E 32
Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=1]: processing command 7 (State) with 65 bytes
Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 101, dataType 0-DP_TYPE_RAW and 54 data bytes
Info:TuyaMCU:TUYAMCU received: 55 AA 01 07 00 08 66 02 00 04 00 00 00 F8 73
Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=1]: processing command 7 (State) with 15 bytes
Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 102, dataType 2-DP_TYPE_VALUE and 4 data bytes
Info:TuyaMCU:TuyaMCU_ParseStateMessage: raw data 4 int: 248
Info:TuyaMCU:TUYAMCU received: 55 AA 01 07 00 05 68 01 00 01 00 76
Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=1]: processing command 7 (State) with 12 bytes
Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 104, dataType 1-DP_TYPE_BOOL and 1 data bytes
Info:TuyaMCU:TuyaMCU_ParseStateMessage: raw data 1 byte:
Info:MAIN:Time 5, idle 0/s, free 72104, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/38
Info:TuyaMCU:TUYAMCU received: 55 AA 01 00 00 01 01 02
Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=1]: processing command 0 (Hearbeat) with 8 bytes
Info:MAIN:Main_OnWiFiStatusChange - WIFI_STA_CONNECTING - 1
Info:MAIN:Main_OnWiFiStatusChange - WIFI_STA_CONNECTED - 4
Info:MAIN:Main_OnWiFiStatusChange - WIFI_STA_CONNECTED - 4
Info:MQTT:mqtt_userName 0000000
mqtt_pass 0000000
mqtt_clientID 0000000
mqtt_host 10.9.20.250:1883
Info:MAIN:Time 6, idle 56381/s, free 72656, MQTT 0(1), bWifi 1, secondsWithNoPing -1, socks 3/38
Info:MAIN:Boot complete time reached (5 seconds)
Info:CFG:####### Set Boot Complete #######
Info:MQTT:mqtt_connection_cb: Successfully connected
Info:MQTT:mqtt_subscribed to Testowy/+/set
Info:MQTT:mqtt_subscribed to bekens/+/set
Info:MQTT:mqtt_subscribed to cmnd/Testowy/+
Info:MQTT:mqtt_subscribed to cmnd/bekens/+
Info:MQTT:mqtt_subscribed to Testowy/+/get
Info:TuyaMCU:TUYAMCU received: 55 AA 01 03 00 00 03
Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=1]: processing command 3 (WiFiState) with 7 bytes
Info:NTP:Seconds since Jan 1 1900 = 3906178364
Info:NTP:Unix time : 1697196764
Info:NTP:Local Time : 2023/10/13 11:32:44
Info:MAIN:Time 7, idle 224397/s, free 72888, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38
Info:CMD:"NTP is ready"
Info:GEN:Channel 1 type changed to toggle
Info:GEN:Channel 2 type changed to toggle
Info:GEN:Channel 3 type changed to toggle
Info:GEN:Channel 4 type changed to toggle
Info:GEN:Channel 5 type changed to ReadOnly
Info:GEN:Channel 6 type changed to Temperature_div2
Info:GEN:Channel 7 type changed to Temperature_div2
Info:GEN:Channel 8 type changed to Temperature_div2
Info:GEN:Channel 9 type changed to ReadOnly
// Start NTP Driver
startDriver NTP
// Set NTP Server
ntp_setServer 10.9.10.250
// Set timezone
ntp_timeZoneOfs +2:00
startDriver TuyaMCU
tuyaMcu_defWiFiState 4
waitFor NTPState 1
echo "NTP is ready"
mqtt:
binary_sensor:
- unique_id: "OpenBekenX_C8263D_binary_sensor_5"
name: 5
state_topic: "Testowy/5/get"
qos: 1
payload_on: 1
payload_off: 0
retain: true
availability:
- topic: "Testowy/connected"{
"dev": {
"ids": [
"OpenBK7231N_799F00054"
],
"name": "obkN_799F00054",
"sw": "1.17.273",
"mf": "Beken Corporation",
"mdl": "BK7231N",
"cu": "http://192.168.110.43/index"
},
"name": "RelayState",
"~": "BHT_B_gabinet",
"avty_t": "~/connected",
"pl_on": "0",
"pl_off": "1",
"uniq_id": "OpenBK7231N_799F00054_binary_sensor_5",
"qos": 1,
"stat_t": "~/5/get"
}{
"dev": {
"ids": [
"OpenBK7231N_799F00054"
],
"name": "obkN_799F00054",
"sw": "1.17.273",
"mf": "Beken Corporation",
"mdl": "BK7231N",
"cu": "http://192.168.110.43/index"
},
"name": "Temperature",
"~": "BHT_B_gabinet",
"avty_t": "~/connected",
"uniq_id": "OpenBK7231N_799F00054_temperature_7",
"qos": 1,
"dev_cla": "temperature",
"unit_of_meas": "°C",
"stat_t": "~/7/get",
"stat_cla": "measurement",
"val_tpl": "{{ float(value)*0.5|round(2) }}"
} "stat_t": "~/1/get",
"cmd_t": "~/1/set"BHT_B_gabinet/7/set"{{ float(value)*0.5|round(2) }}"{"dev":{"ids":["OpenBK7231N_799F00054"],"name":"obkN_799F00054","sw":"1.17.273","mf":"Beken Corporation","mdl":"BK7231N","cu":"http://192.168.110.43/index"},"name":"Temperature","~":"BHT_B_gabinet","avty_t":"~/connected","uniq_id":"OpenBK7231N_799F00054_temperature_7","qos":1,"dev_cla":"temperature","unit_of_meas":"°C","stat_t":"~/7/get","stat_cla":"measurement","val_tpl":"{{ float(value)*0.5|round(2) }}"}tomik67 wrote:.in earlier versions of this thermostat "sat" ESP8266 and two great designs were created:
https://github.com/klausahrenberg/WThermostatBeca and an even more interesting fork:
https://github.com/fashberg/WThermostatBeca
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.
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]autoexec.bat. [#20874147]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]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]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]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]Temperature_div2 channels as generic entities, not a full climate model. One user saw the relay payloads reversed as `pl_on: