logo elektroda
logo elektroda
X
logo elektroda

[BK7231N] [CB3S] [AHT20] TH01 Generic Temperature and Humidity Sensor Teardown

anthonythomas 35505 135
ADVERTISEMENT
  • #91 21339167
    Magnetz
    Level 2  
    I have flashed TH01 but want to publish MQTT data to thingspeak.com

    I need to set client ID which I believe is taken from the "Client Topic (Base Topic):" field.

    I also need to set topic as "channels/myid/publish" with "field1=$CH1&field2=$CH3"

    how can I customise the MQTT topic and fields?

    can I disable the 'connected' mqtt message broadcast?

    https://uk.mathworks.com/help/thingspeak/use-desktop-mqtt-client-to-publish-to-a-channel.html

    edit: after leaving the device un-powered for 10 minutes it has forgotten my configuration and reverted to wifi AP mode. is that a bug?
  • ADVERTISEMENT
  • #92 21385175
    Magnetz
    Level 2  
    >>21162096
    255 seconds is the max interval?

    Mine seems to send a temperature value every @150 seconds if I set 'AHT2X_Cycle 255'
  • #93 21387341
    sns1
    Level 5  
    Hi,

    Can I ask, probably, noob questions even though I've read this thread?
    I have a similar tuya wifi sensor, but it has a different pcb. It has BK7321N for sure and I've flashed it with OpenBekken, configured according to config found here (channel 1, channel 2) and it does connect to wifi/HA/mqtt but posts no data. Web App Log does not show any TuyaMCU lines whatsoever... I have to note, that this particular device has never been paired or used - flashed straight out of the box - not sure if it matters...
    Where should I look for a solution? I have another one unopened for testing, but not sure where to proceed. Pair it, hook up to rx/tx and look for possible communications? I doubt that similar device would use dpI, for example, number 7 or 12 instead of 1 and 2... But there might be some error in my config/actions as I do not fully understand all the scheme of how it works...
  • ADVERTISEMENT
  • #94 21387351
    p.kaczmarek2
    Moderator Smart Home
    Please post photos of your device. Maybe you have a version without TuyaMCU? Or maybe you have wrong baud setting?
    Helpful post? Buy me a coffee.
  • #95 21387365
    sns1
    Level 5  
    >>21387351
    Circuit board with electronic components on a wooden surface.
    Hem... I thought BK*** is a TuyaMCU....
  • #96 21387372
    p.kaczmarek2
    Moderator Smart Home
    This seems like a device without TuyaMCU. So TuyaMCU driver and tmSensor are not needed. TuyaMCU approach thus will not work. Luckily, we also have covered non-TuyaMCU sensors on our forum, you need need to find a related thread. You will most likely have to use PinDeepSleep or DeepSleep command in autoexec.bat.
    Maybe this thread may fit your device better: https://www.elektroda.com/rtvforum/topic3945688.html
    Helpful post? Buy me a coffee.
  • #97 21387405
    insmod
    Level 25  
    >>21385175 This is a TuyaMCU device, AHT20 is not connected to CBU, so driver is not needed for it and therefore will not work.
  • #98 21387895
    sns1
    Level 5  
    >>21387372
    >>21387372

    Thank you for the suggestions.

    It turns out that it is a BK7231N with CHT8315 sensor version. I've found threads with like variants (BLE version though).
    Now trying to make it work and got as far as wrong temp/hum returns. Will try to check traces for i2c and understand if current cht83xx driver should work with i2c or not or what possible variant will.

    Added after 1 [hours] 54 [minutes]:

    Found that mine board has different pins connected to a sensor, which are 23 and 24 (sda & scl(sck)) and getting wrong, but different measurements (-40 and 0 for temp/hum).
    Can't yet understand pin<->channel(s) relations, yet those a bit differently configured in native web and app web interfaces...
  • #99 21398650
    vinibali
    Level 7  
    Hi there!
    I also have a somewhat newer version of this board with a shield less CB3S, TuyaMCU and CHT8310. I need to somehow remove the TuyaMCU's connection for now, so this board is not recommended to buy!
    Let me share my experiences
    * flashing was unsuccessful if the MCU TX and RX pins were connected (removing only one connection was enough)
    * had to set the flashing speed to 460800 otherwise it failed around 75% of the process with hid_download's uartprogram on Linux
    * pulling up CEN is needed otherwise the chip resets itself around every 10-11 seconds I powered up only the CB3S board this time!
    ** disconnect TuyaMCU's pin 3 also solved the problem
    * wakeup from deep sleep doesn't work

    Close-up of a circuit board with a blue module and wiring on graph paper background.
  • #100 21399061
    p.kaczmarek2
    Moderator Smart Home
    If you are using deep sleep directly on Beken, and one of the wakeup directions is not working, then you need to configure DSEdge.
    https://www.elektroda.com/rtvforum/find.php?q=DSEdge

    I guess you had to pull up CEN because MCU pulls it down?
    Helpful post? Buy me a coffee.
  • #101 21399107
    vinibali
    Level 7  
    >>21399061 Yes, that was the first try. Later I just disconnected the MCU's pin #3. So now it's floating, shall I pull up or pull down with a resistor?
  • #102 21399112
    p.kaczmarek2
    Moderator Smart Home
    CEN can be left floating. I've never ever pulled it up and so far I had like hundreds of devices.
    Helpful post? Buy me a coffee.
  • #103 21401774
    BobUrban
    Level 2  
    I was able to flash my device successfully with the MCU TX and RX connected.
    When it's powered now, it doesn't properly connect to Wifi, sometimes when I press the button it connects, but the openbk UI only is available for a few seconds.
    Is there anything I could try?

    Is there any recommended similar device to buy instead of this one?

    This is my device:
    PCB with CB3S module and various electronic components.

    This is the connections I used for flashing
    CB3S module with TXD1, RXD1, GND, and 3.3V pins connected.
  • #104 21402357
    p.kaczmarek2
    Moderator Smart Home
    BobUrban wrote:

    When it's powered now, it doesn't properly connect to Wifi, sometimes when I press the button it connects, but the openbk UI only is available for a few seconds.
    Is there anything I could try?

    This is TuyaMCU battery powered device. The SOIC chip on board controls the power connection of WiFi module and it turns on and off the module. That's why it goes offline.
    You can either:
    - configure it properly with tmSensor driver and required dpIDs, maybe autoexec.bat from post 6 in this thread can work, or you can check somewhere else on forum https://www.elektroda.com/rtvforum/find.php?q=tmSensor
    You will need to connect external 3.3V to WiFi module VDD for that...
    - remove the MCU and configure this device manually with CHT driver (if present - which sensor is there?) and use manual deep sleep on OBK directly https://www.elektroda.com/rtvforum/find.php?q=deepsleep
    In any case, don't give up and ask if you have any questions. Battery powered devices are very tricky to work with.
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #105 21420822
    maxim2002
    Level 13  
    They are getting more and more annoying with these temperature sensors.
    I've now been hit with one identical to the one BobUrban has.
    Circuit board with desoldered MCU module and connected wires. .
    Flash uploaded after soldering out the Tuya MCU with no problems.
    Config basic:
    Code: Text
    Log in, to see the code
    .
    In the logs only:
    Code: Text
    Log in, to see the code
    .

    Is there anything I can do to help? I don't have much experience with Tuya protocols, but soldering and connecting the UART I know how to ;)
  • #106 21441634
    doudouni100
    Level 4  
    >>21420822
    I have the same one.
    I got mine working with this autoexec :

    startDriver TuyaMCU
    startDriver tmSensor
    // dpID 27 is temperature div 10
    setChannelType 27 temperature_div10
    linkTuyaMCUOutputToChannel 27 val 27
    // dpID 46 is % humidity
    setChannelType 46 Humidity
    linkTuyaMCUOutputToChannel 46 val 46
    // dpID 101 is battery state - low(0), mid(1) and high(2)
    setChannelType 101 ReadOnly
    linkTuyaMCUOutputToChannel 101 enum 101
    setChannelLabel 101 Battery

    Only the battery level is not working but the dpID is correct.
    I got it using the TuyaMCUAnalyzer as I did the rest.

    Any ideas for the battery level?
  • #107 21441680
    divadiow
    Level 35  
    doudouni100 wrote:
    Any ideas for the battery level?

    try setChannelType 101 LowMidHigh instead of setChannelType 101 ReadOnly
  • #108 21441842
    doudouni100
    Level 4  
    >>21441680
    Thanks for the reply
    Tried it but nothing.
    Did a lot of testing and have come to the conclusion that there is a limit on OBK firmware of 64 channels.

    If I use any channel number under 64 it shows up on the page, but value=0
    Any number over 64 does not show at all.

    The authors have to enable more channels on the OBK firmware !
  • #109 21442664
    angzero
    Level 4  
    so it seems that i'm in the same boat as many people here where each iteration of this device yields different behavior and needs a slightly different approach, so here is mine:
    also, @p.kaczmarek2 i can only imagine the headache you must have from this alone as i went through the whole thread reading the back and forth (hopefully i didn't miss anything)

    so this is my Tuya Temperature and humidity sensor with a CB3S, which i managed to flash the latest 1.18.42 without disordering or cutting off any traces

    Close-up of a Tuya temperature and humidity sensor circuit board with highlighted components.
    Circuit board of a Tuya temperature and humidity sensor with CB3S module.

    - MQTT connected, configured and showing in HA but values are 0 since its powered externally
    - when powering through the battery, no data or ability to see the device neither directly or on HA:
    as one of the posts mentioned, i activated Flag 37 and lowered the uptime from 5 to 3 seconds + static IP but no changes to this behavior

    here's my autoexe.bat:

    startDriver TuyaMCU
    startDriver tmSensor
    tuyaMCU_setBaudRate 115200
    //tuyaMcu_defWiFiState 4 (notsureifneeded)
    // dpID 27 is temperature div 10
    setChannelType 27 temperature_div10
    linkTuyaMCUOutputToChannel 27 val 27
    // dpID 46 is % humidity
    setChannelType 46 Humidity
    linkTuyaMCUOutputToChannel 46 val 46
    // dpID 3 is battery state - low(0), mid(1) and high(2)
    setChannelType 3 ReadOnlyLowMidHigh
    linkTuyaMCUOutputToChannel 3 enum 3
    setChannelLabel 3 Battery
    //tuyaMcu_sendProductInformation


    This is the first time I flash a device like this, usually i manage to get some configs from the original firmware during backup but not here, the configure module page in the web app has nothing configured and left as is

    My main issue right now is that i can't get anything out of the device when running on battery, not sure i'm missing anything or if i skipped a step i need, like cutting off the Tx and Rx from the TuyaMCU

    This is the main page when connected EXTERNALLY


    Screenshot of Tuya temperature and humidity sensor configuration


    hopefully that paints a full picture of the situation, if not, feel free to ask me anything and i'll do my best to respond and provide all the details i can. thanks everyone
  • #110 21442671
    divadiow
    Level 35  
    >>21441842

    @angzero's post may have answer

    setChannelType 101 ReadOnlyLowMidHigh
  • #111 21442677
    angzero
    Level 4  
    >>21442671

    note that this SHOULD work from what i read, but he still needs to lower the channel to 64 and under (to my understanding)
  • #112 21442987
    doudouni100
    Level 4  
    >>21442671

    Hi

    p.kaczmarek2 pointed out to me in another thread that I do not have to use channel 101 in the autoexec.
    I could link it, in the autoexec, to a channel number in the range OBK accepts (1-64).

    So for anyone that has the same
    Electronic module with a blue component on a circuit board with wires. sensor this is the autoexec:

    startDriver TuyaMCU
    startDriver tmSensor
    // dpID 27 is temperature div 10
    setChannelType 27 temperature_div10
    linkTuyaMCUOutputToChannel 27 val 27
    // dpID 46 is % humidity
    setChannelType 46 Humidity
    linkTuyaMCUOutputToChannel 46 val 46
    // dpID 101 is battery state - low(0), mid(1) and high(2)
    setChannelType 10 ReadOnly
    linkTuyaMCUOutputToChannel 101 enum 10
    setChannelLabel 10 Battery


    Added after 1 [hours] 2 [minutes]:

    BobUrban wrote:
    I was able to flash my device successfully with the MCU TX and RX connected.
    When it's powered now, it doesn't properly connect to Wifi, sometimes when I press the button it connects, but the openbk UI only is available for a few seconds.
    Is there anything I could try?

    Is there any recommended similar device to buy instead of this one?

    This is my device:
    PCB with CB3S module and various electronic components.

    This is the connections I used for flashing
    CB3S module with TXD1, RXD1, GND, and 3.3V pins connected.





    Hi
    Put a temporary jumper wire from -Bat of the sensor board to GND on the Wi-Fi module and use this autoexec:

    startDriver TuyaMCU
    startDriver tmSensor
    // dpID 27 is temperature div 10
    setChannelType 27 temperature_div10
    linkTuyaMCUOutputToChannel 27 val 27
    // dpID 46 is % humidity
    setChannelType 46 Humidity
    linkTuyaMCUOutputToChannel 46 val 46
    // dpID 101 is battery state - low(0), mid(1) and high(2)
    setChannelType 10 ReadOnly
    linkTuyaMCUOutputToChannel 101 enum 10
    setChannelLabel 10 Battery
  • ADVERTISEMENT
  • #113 21450156
    angzero
    Level 4  
    Anyone have any ideas on how to help with this please? -> >>21442664
  • #115 21450238
    angzero
    Level 4  
    >>21450164 Lowering the BaudeRate seemed to have helped with getting slightly more time with the wifi module being on and seeing the menu, but not sensor readings is being reported so far, neither in the webpage or in HA, interestingly i saw this message pop out newly:
    "Cfg size: 3584, change counter: 11, ota counter: 0, incomplete boots: 1 (might change to 0 if you wait to 30 sec)!"

    User interface with diagnostic information and configuration buttons.

    i'll try to see if i can get any log readings:

    Info:CFG:####### Boot Count 40 #######
    Warn:CFG:CFG_InitAndLoad: Correct config has been loaded with 11 changes count.
    Error:CMD:no file early.bat err -2
    Info:GEN:PIN_SetupPins pins have been set up.
    Info:MAIN:Main_Init_Before_Delay done
    Info:MAIN:Main_Init_Delay
    Info:MAIN:Main_Init_Delay done
    Info:MAIN:Main_Init_After_Delay
    Info:MAIN:Registered for wifi changes
    Info:MQTT:MQTT_RegisterCallback called for bT obk2DE0035D/ subT obk2DE0035D/+/set
    Info:MQTT:MQTT_RegisterCallback called for bT bekens_n/ subT bekens_n/+/set
    Info:MQTT:MQTT_RegisterCallback called for bT cmnd/obk2DE0035D/ subT cmnd/obk2DE0035D/+
    Info:MQTT:MQTT_RegisterCallback called for bT cmnd/bekens_n/ subT cmnd/bekens_n/+
    Info:MQTT:MQTT_RegisterCallback called for bT obk2DE0035D/ subT obk2DE0035D/+/get
    Info:CMD:CMD_StartScript: started @startup at the beginning
    Info:CMD:CMD_StartScript: started autoexec.bat at the beginning
    Info:MAIN:Main_Init_After_Delay done
    Info:MAIN:Started TuyaMCU.
    Info:MAIN:Started tmSensor.
    Info:GEN:Channel 27 type changed to temperature_div10
    Info:GEN:Channel 46 type changed to Humidity
    Info:GEN:Channel 3 type changed to ReadOnlyLowMidHigh
    Info:MAIN:Time 1, idle 266405/s, free 73480, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 2, idle 195363/s, free 72984, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 3, idle 75067/s, free 73312, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 4, idle 0/s, free 73312, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Boot complete time reached (3 seconds)
    Info:CFG:####### Set Boot Complete #######
    Info:MAIN:Time 5, idle 0/s, free 73312, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Main_OnWiFiStatusChange - WIFI_STA_CONNECTING - 1
    Info:MAIN:Main_OnWiFiStatusChange - WIFI_STA_CONNECTED - 4
    Info:MQTT:mqtt_userName DriveT1
    Info:MAIN:Time 6, idle 102081/s, free 73136, MQTT 0(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MQTT:mqtt_connection_cb: Successfully connected
    Info:MQTT:mqtt_subscribed to obk2DE0035D/+/set
    Info:MQTT:mqtt_subscribed to bekens_n/+/set
    Info:MQTT:mqtt_subscribed to cmnd/obk2DE0035D/+
    Info:MQTT:mqtt_subscribed to cmnd/bekens_n/+
    Info:MQTT:mqtt_subscribed to obk2DE0035D/+/get
    Info:MQTT:Publishing val TemhumbB1 to obk2DE0035D/host retain=0
    Info:MAIN:Time 7, idle 184012/s, free 73384, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MQTT:Publishing val OpenBK7231N 1.18.42 Feb 15 2025 19:44:25 to obk2DE0035D/build retain=0
    Info:MAIN:Time 8, idle 200118/s, free 73112, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MQTT:Publishing val f8:17:2d:e0:03:5d to obk2DE0035D/mac retain=0
    Info:MAIN:Time 9, idle 187807/s, free 64536, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 3/38 
    Info:MQTT:Publishing val 28.52 to obk2DE0035D/temp retain=0
    Info:MAIN:Time 10, idle 194920/s, free 73384, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:GEN:dhcp=0 ip=192.168.2.42 gate=192.168.2.1 mask=255.255.255.0 mac=f8:17:2d:e0:03:5d
    Info:GEN:sta: 1, softap: 0, b/g/n
    Info:MAIN:Time 11, idle 187175/s, free 73144, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MQTT:Publishing val 2 to obk2DE0035D/sockets retain=0
    Info:MAIN:Time 12, idle 185905/s, free 73384, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MQTT:Publishing val -81 to obk2DE0035D/rssi retain=0
    Info:MAIN:Time 13, idle 191601/s, free 73384, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MQTT:Publishing val 13 to obk2DE0035D/uptime retain=0
    Info:MAIN:Time 14, idle 189461/s, free 73152, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MQTT:Publishing val 73384 to obk2DE0035D/freeheap retain=0
    Info:MAIN:Time 15, idle 194553/s, free 73144, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MQTT:Publishing val 192.168.2.42 to obk2DE0035D/ip retain=0
    Info:MAIN:Time 16, idle 190704/s, free 73384, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MQTT:Channel has changed! Publishing 0 to channel 3 
    Info:MQTT:Publishing val 0 to obk2DE0035D/3/get retain=0
    Info:MAIN:Time 17, idle 188579/s, free 73152, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic obk2DE0035D/3/get
    Info:MQTT:Channel has changed! Publishing 0 to channel 27 
    Info:MQTT:Publishing val 0 to obk2DE0035D/27/get retain=0
    Info:MAIN:Time 18, idle 185000/s, free 73384, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic obk2DE0035D/27/get
  • #116 21462840
    BobUrban
    Level 2  
    doudouni100 wrote:
    Hi
    Put a temporary jumper wire from -Bat of the sensor board to GND on the Wi-Fi module and use this autoexec:


    Hi @doudouni100

    Thanks for your input, this worked for me after trying around many times, I am seeing values finally.

    p.kaczmarek2 wrote:
    The SOIC chip on board controls the power connection of WiFi module and it turns on and off the module.


    Is there a way to configure how often this happens?
    Did someone manage to put the PCB back in to the case?
  • #117 21551925
    BAGZZlash
    Level 4  
    anthonythomas wrote:
    This is what I've got so far

    Info:TuyaMCU:TUYAMCU received: 55 AA 00 01 00 24 7B 22 70 22 3A 22 6C 66 33 36 79 35 6E 77 62 38 6A 6B 78 77 67 67 22 2C 22 76 22 3A 22 31 2E 30 2E 30 22 7D 99 
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=0]: processing command 1 (QueryProductInformation) with 43 bytes
    Info:TuyaMCU:TuyaMCU_ParseQueryProductInformation: received {"p":"lf36y5nwb8jkxwgg","v":"1.0.0"}
    Info:TuyaMCU:TUYAMCU received: 55 AA 00 02 00 00 01 
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=0]: processing command 2 (MCUconf) with 7 bytes
    Info:TuyaMCU:TuyaMCU_ProcessIncoming: TUYA_CMD_MCU_CONF, TODO!
    Info:TuyaMCU:TUYAMCU received: 55 AA 00 08 00 0F 00 01 01 01 01 01 01 01 02 00 04 00 00 00 C8 EB 
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=0]: processing command 8 (QueryState) with 22 bytes
    Info:TuyaMCU:TuyaMCU_V0_ParseRealTimeWithRecordStorage: processing dpId 1, dataType 2-DP_TYPE_VALUE and 4 data bytes
    Info:TuyaMCU:TuyaMCU_V0_ParseRealTimeWithRecordStorage: raw data 4 int: 200
    Info:TuyaMCU:TUYAMCU received: 55 AA 00 08 00 0F 00 01 01 01 01 01 01 02 02 00 04 00 00 00 49 6D 
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=0]: processing command 8 (QueryState) with 22 bytes
    Info:TuyaMCU:TuyaMCU_V0_ParseRealTimeWithRecordStorage: processing dpId 2, dataType 2-DP_TYPE_VALUE and 4 data bytes
    Info:TuyaMCU:TuyaMCU_V0_ParseRealTimeWithRecordStorage: raw data 4 int: 73
    Info:TuyaMCU:TUYAMCU received: 55 AA 00 08 00 0C 00 03 03 03 03 03 03 03 04 00 01 00 2D 
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=0]: processing command 8 (QueryState) with 19 bytes
    Info:TuyaMCU:TuyaMCU_V0_ParseRealTimeWithRecordStorage: processing dpId 3, dataType 4-DP_TYPE_ENUM and 1 data bytes
    Info:TuyaMCU:TuyaMCU_V0_ParseRealTimeWithRecordStorage: raw data 1 byte: 
    Info:TuyaMCU:TUYAMCU received: 55 AA 00 10 00 02 01 09 1B 
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=0]: processing command 16 (Unknown) with 9 bytes
    Info:TuyaMCU:TuyaMCU_ProcessIncoming: unhandled type 16


    I have a somewhat embarassing noob question: How do I get to see those TuyaMCU:TUYAMCU logs? In my WebApp, I get logs that mostly look like this:

    Info:CMD:CMD_StartScript: started @startup at the beginning
    Info:CMD:CMD_StartScript: started autoexec.bat at the beginning
    Info:MAIN:Main_Init_After_Delay done
    Info:MAIN:Started TuyaMCU.
    Info:MAIN:Started tmSensor.
    Info:MAIN:Time 1, idle 218322/s, free 78984, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 2, idle 187723/s, free 78984, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 3, idle 189324/s, free 78984, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 4, idle 379946/s, free 78984, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Boot complete time reached (3 seconds)
    Info:CFG:####### Set Boot Complete #######
    Info:MAIN:Time 5, idle 184663/s, free 78984, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Registered for wifi changes
    Info:MAIN:Connecting to SSID [ZZ-Base]
    Info:MAIN:Time 6, idle 181163/s, free 73704, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 7, idle 187953/s, free 73704, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 8, idle 85103/s, free 74000, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 9, idle 0/s, free 74000, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 10, idle 0/s, free 74000, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/38 
    Info:GEN:dhcp=0 ip=0.0.0.0 gate=0.0.0.0 mask=0.0.0.0 mac=f8:17:2d:e0:0d:c6
    Info:GEN:sta: 0, softap: 0, b/g/n
    Info:MAIN:Main_OnWiFiStatusChange - WIFI_STA_CONNECTING - 1
    Info:MAIN:Time 11, idle 92345/s, free 74240, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 12, idle 188451/s, free 74280, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Main_OnWiFiStatusChange - WIFI_STA_CONNECTED - 4
    Info:MAIN:Time 13, idle 187314/s, free 74192, MQTT 0(0), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 14, idle 191996/s, free 65584, MQTT 0(0), bWifi 1, secondsWithNoPing -1, socks 3/38 
    Info:MQTT:mqtt_host empty, not starting mqtt
    Info:MAIN:Time 15, idle 190977/s, free 74192, MQTT 0(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 16, idle 190731/s, free 74192, MQTT 0(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 17, idle 186581/s, free 74192, MQTT 0(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 18, idle 189550/s, free 74192, MQTT 0(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 19, idle 389067/s, free 74192, MQTT 0(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 20, idle 189947/s, free 74192, MQTT 0(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:GEN:dhcp=0 ip=192.168.1.178 gate=192.168.1.1 mask=255.255.255.0 mac=f8:17:2d:e0:0d:c6
    Info:GEN:sta: 1, softap: 0, b/g/n
    Info:GEN:sta:rssi=-64,ssid=ZZ-Base,bssid=1c:b0:44:b9:2c:65,channel=6,cipher_type:CCMP
    Info:MAIN:Time 21, idle 185142/s, free 74192, MQTT 0(1), bWifi 1, secondsWithNoPing -1, socks 2/38 
    Info:MAIN:Time 22, idle 191040/s, free 74192, MQTT 0(1), bWifi 1, secondsWithNoPing -1, socks 2/38


    which doesn't help me a lot. Do I need to activate anything to see those Tuya-Logs?
  • #118 21551929
    p.kaczmarek2
    Moderator Smart Home
    Well, first of all, did you start TuyaMCU driver?

    edit: I can see you did, if so, then please enable log level all on the web app
    Helpful post? Buy me a coffee.
  • #119 21551999
    BAGZZlash
    Level 4  
    Thanks for the quick reply, I really appreciate the help.

    p.kaczmarek2 wrote:
    please enable log level all on the web app


    Already did, also I checked all checkboxes (I clicked the convenient "Select All Features" button). If it matters, so far, my autoexec.bat looks as simple as this:

    startDriver TuyaMCU
    startDriver tmSensor
  • #120 21552004
    insmod
    Level 25  
    Add commands 'logfeature 12 1' and 'loglevel 6' to autoexec before starting tuyamcu driver.

Topic summary

The discussion centers on the teardown, firmware flashing, and configuration of the TH01 generic temperature and humidity sensor, which uses a BK7231N WiFi module and a TuyaMCU microcontroller (MCU) managing sensor data and power. Users report challenges flashing the device due to the MCU controlling power to the WiFi module and UART lines being connected between MCU and WiFi module, requiring either cutting UART traces, desoldering the MCU or WiFi module, or powering the WiFi module externally during flashing. The TuyaMCU driver in OpenBK7231N firmware is essential for communication, with dpIDs 1 and 2 corresponding to temperature (divided by 10) and humidity, and dpID 3 likely representing battery state (low, mid, high). Proper autoexec.bat configuration involves starting TuyaMCU and tmSensor drivers, linking dpIDs to OBK channels, and setting channel types accordingly. MQTT integration is commonly used for data reporting, with some users noting duplicate MQTT messages and template adjustments needed for value formatting. Battery-powered operation requires the MCU to cycle power to the WiFi module to conserve energy, so powering the WiFi module externally can prevent data reporting. Flags such as WiFi quick connect and static IP improve connection stability. Some users successfully flash without desoldering by cutting UART traces and powering the WiFi module directly. The community shares detailed pinout photos, flashing procedures, and configuration scripts. Variations in PCB versions and sensor chips (AHT20, AHT30, CHT8315) affect driver selection and configuration. Deep sleep and wakeup configurations are discussed for battery life optimization. Tools like TuyaMCUAnalyzer assist in decoding UART communication. Issues with MQTT hostname configuration can prevent MQTT startup, and firmware updates have improved battery device support. The thread also covers troubleshooting WiFi connectivity, log inspection via WebUI, and Home Assistant integration challenges.
Summary generated by the language model.
ADVERTISEMENT