logo elektroda
logo elektroda
X
logo elektroda

[BK7231N/CBU] Tuya TH01? Generic Wi-Fi Temperature & Humidity Sensor [CHT8310]

divadiow 46266 160
Best answers LABEL_AI_GENERATED

Do I need to dump anything else before flashing OpenBeken on this BK7231N temperature/humidity sensor?

No additional dump was identified as necessary; the firmware dump and boot logs you already captured were enough to move forward, and the thread later confirmed support for the CHT8310 sensor through the CHT8305 driver. Enable the CHT8305 driver in OpenBeken, then check the log for `DRV_CHT8305_init: ID: 59 59 8215` to confirm the chip is being detected correctly [#20874759][#20876020] After that, the device should work normally, and one user reported it was fine aside from needing calibration [#20876035] The thread also concluded this device is really a TH01-style unit rather than TH08, so update the template/name accordingly [#21109755][#21109760] If you want to try cloudcutter first, note that the device may be on patched firmware / NL battery firmware, so serial flashing may still be required [#20852460][#20852625][#20970455]
AI summary based on the discussion. May contain errors.
ADVERTISEMENT
  • ADVERTISEMENT
  • #122 21402430
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14770
    Help: 659
    Rate: 12913
    Maybe we can start with Tuya Config Extraction:


    Helpful post? Buy me a coffee.
  • #123 21403366
    rhizome
    Level 2  
    Posts: 2
    @divadiow thanks! I haven't seen the topic.. their config worked instantly without tweaks. @p.kaczmarek2 many thanks for fundamentals! :)
  • Suggested BK7231N CHT8310 pinout and config

    #124 21403545
    lktrdng
    Level 5  
    Posts: 15
    Help: 1
    Rate: 2
    >>21402420
    Remember i am a newbie, mine is more good intentions than knowledge.
    I would reboot without any driver, double check the CHT83XX_SCK and CHT83XX_SDA, and maybe load it manually.
    Also, you can quickly check if my config also works with your device. I think we have the very same device.
    
    {
      "vendor": "Tuya",
      "bDetailed": "0",
      "name": "Tuya TH Sensor",
      "model": "enter short model name here",
      "chip": "BK7231N",
      "board": "PCB_576P1-V1.0",
      "flags": "0",
      "keywords": [
        "Tuya",
        "CHT8310",
        "temperature",
        "humidity",
        "battery",
        "sensor"
      ],
      "pins": {
        "6": "CHT83XX_SCK;1;0",
        "9": "CHT83XX_SDA;1;2",
        "17": "BAT_Relay;5",
        "20": "dInput;43",
        "23": "BAT_ADC;40",
        "26": "WifiLED_n;37"
      },
      "command": "backlog PowerSave 1; startDriver battery; startDriver CHT83XX; Battery_Setup 2350 3000; CHT_calibrate -1.5 10",
      "image": "https://obrazki.elektroda.pl/5076675700_1736544409.jpg",
      "wiki": "https://www.elektroda.com/rtvforum/topic4098816.html"
    }


    Added after 2 [minutes]:

    >>21403545
    Sorry, i just realized you already solved the issue. My bad :S.
  • Battery divider calibration and deep-sleep timing issues

    #125 21414181
    sns1
    Level 5  
    Posts: 12
    Hi,

    I'd like to share some thoughts on this sensor and its optimization and take some advice if any.
    I've converted 4 units (BK7321N CHT3815), added lifepo4 18650 (1.5ah) battery and usb-charger module, packed all in small box with leds/buttons so it's somewhat useful device for monitoring temps on premises.

    Autoexec.bat -
    PowerSave 1
    
    startDriver NTP
    startDriver Battery
    startDriver CHT83XX
    
    Battery_Setup 2500 3400 2.00 2400 4096
    Battery_cycle 2
    
    addEventHandler OnHold 20 SafeMode
    //addEventHandler OnClick 20 delay_s 600
    DSEdge
    
    
    waitFor WiFiState 4
    
    
    publishAll
    delay_s 5
    
    PinDeepSleep 900


    Issues:
    - You have to calibrate each one for reasonable battery measurement. Across all 4 units - dividers are 1.96 to 2.10, it's somewhat important for proper battery monitoring.
    - It's not convenient to reconfigure device, since the path is to boot it into safemode, delete autoexec, restart and configure... If I could launch Web Application under SafeMode - it would be much easier.
    - I'm yet to optimize for how long it should delay before deepsleep. 3 seconds is too small, 10 seconds is too long (for battery reasons), I wish there would be some mqtt state on finishing publish. Probably have to mqtt publish properly and estimate across devices, since not all report, for example, battery data in time, for some devices 5 seconds is enough, for 2 of them it is not...

    p.s. not yet implemented mqtt not found workaround.
  • Boot log ends in garbage after Main_Init_Before_Delay

    #126 21511164
    irogala
    Level 2  
    Posts: 2
    Hi!
    My sensor just went crazy after a couple of months working relatively normal (but draining battery like hell). Yesterday it went silent and after trying all I could I realized the only things which still work are flashing and debug output on TX2 which looks like this:

    V:BK7231N_1.0.1
    REG:cpsr     spsr     r13      r14
    SVC:000000D3          00401C1C 000033AC
    IRQ:000000d2 00000010 00401e0c 00004c28
    FIR:000000d1 00000010 00401ffc db6ca612
    SYS:000000df          0040192c 00000158
    ST:0001AD12
    J 0x10000
    bk_misc_init_start_type b 1ad12
    prvHeapInit-start addr:0x4142f0, size:113936
    [Flash]id:0xeb6015
    sctrl_sta_ps_init
    cset:0 0 0 0
    Entering initLog()...
    Commands registered!
    initLog() done!
    Info:MAIN:Main_Init_Before_Delay



    after this there are only garbage output and of course software doesn't start.
    Any idea what/how to try to bring it to life?
  • ADVERTISEMENT
  • #127 21511232
    divadiow
    Level 38  
    Posts: 5220
    Help: 449
    Rate: 918
    irogala wrote:
    Any idea what/how to try to bring it to life?

    I believe we've seen this before when battery gets too low and the solution has been to solder it back up and reflash - maybe to full factory to restore all then start with OBK again.
  • #128 21511415
    irogala
    Level 2  
    Posts: 2
    >>21511232
    I felt the same but apparently it can be reflashed without desoldering, I can read OBD config successfully but it doesn't help with boot. Not sure what to reset or erase to change that. And yes, it died due to depleted battery probably.

    Dodano po 9 [godziny] 23 [minuty]:

    Seems reflashing with original tuya firmware and back OBK couple of times helped, it's back working 8-/
  • Asking how to identify the cloudcutter model ID

    #129 21571199
    bzzzt
    Level 1  
    Posts: 1
    A friend of mine bought a couple of these WiFi thermostats, and he realized later, that they (annoyingly) connect to the main server and you also need an app to monitor them,
    On the chip it says the following:
    CBU 2.01.01.103308
    Close-up of a thermostat PCB with a WiFi module labeled CBU and part number 2.01.01.103308.

    I searched around, and I found the tuya-cloudcutter github repo and the list of supported models, but I can't seem to find the exact model for this item.
    I searched the net and according to some images there are different versions (possibly older) of this thermostat, the differences being rather minor, like different icon on plastic or some of them have a barcode model name printed on one of the sides of the battery cover.

    Could the procedure presented in this thread work on this, or is it a different model?
    How could I find the model id/name and see if it is supported by cloudcutter?
    Do I need to dump the firmware?

    Also attaching additional images:
    Close-up of a white electronic module with black printed text, with a white casing visible underneath.
    Label with barcode and product info Tuya WiFi Temperature Humidity Sensor Smart Life on a white cardboard box.
    Close-up of a temperature and humidity sensor package label, showing a QR code and manufacturer details.
    White box with Wi-Fi temperature and humidity sensor, Tuya and Wi-Fi logos, and a thermometer graphic on the front.
    Three parts of a disassembled WiFi thermometer: back cover, front case with thermometer symbol, and electronic circuit board.
  • ADVERTISEMENT
  • CHT83xx GPIO mapping still unresolved

    #131 21598960
    oddyutza
    Level 4  
    Posts: 7
    I have a BK7321N CBU CHT8305 with a Green PCB Dated 2023.
    On the PCB there is written MCU WFWSD01 Ver01.
    I've managed to flash it properly but I've used all possible templates for the GPIO Assignments none of them worked Temperature is shown as 125Celsius and hum as 100%
    I've tried to extract the Tuya GPIO pins but I had no luck ( please see attached picture from the first post in the thread ).
    Manually I tried with:
    "20": "CHT83xx_SCK;0",
    "22": "CHT83xx_SDA;0;1",
    //
    "20": "CHT83xx_SCK;0",
    "22": "CHT83xx_SDA;1;0",
    //

    Any ideas further on ?
  • ADVERTISEMENT
  • TuyaMCU setup requires autoexec and dpID mapping

    #135 21612622
    divadiow
    Level 38  
    Posts: 5220
    Help: 449
    Rate: 918
    Your device has a TuyaMCU so assigning CHT83XX driver to GPIOs is not how to set this one up. It'll be a case of creating an autoexec.bat and configuring dpID mappings. This device is similar https://www.elektroda.com/rtvforum/topic3968377.html

    Many TuyaMCU devices are in the devicelist from which the experience of others may help https://openbekeniot.github.io/webapp/devicesList.html

    https://github.com/openshwprojects/OpenBK7231T_App/blob/main/docs/autoexecExamples.md
    https://www.elektroda.com/rtvforum/topic3970199.html
    https://www.youtube.com/watch?v=kXi8S12tmC8
  • dInput_n on P7 wakes device on alert signal

    #136 21688538
    moviesakbar
    Level 3  
    Posts: 6
    >>21185005 Hi, I tested it and alert signal works if P7 is set to dInput_n, then it successfully wakes up the device after the set change in temperature occurs.


    My working config

    {
    "vendor": "Tuya",
    "bDetailed": "0",
    "name": "Full Device Name Here",
    "model": "enter short model name here",
    "chip": "BK7231N",
    "board": "TODO",
    "flags": "1024",
    "keywords": [
    "TODO",
    "TODO",
    "TODO"
    ],
    "pins": {
    "7": "dInput_n;5;0",
    "8": "BAT_Relay;3;0",
    "14": "Btn;4;0",
    "16": "WifiLED_n;0;0",
    "20": "CHT83XX_SCK;0;0",
    "22": "CHT83XX_SDA;0;1",
    "23": "BAT_ADC;2"
    },
    "command": "backlog PowerSave 1; Battery_cycle 2; CHT_Calibrate -4 0; CHT_Cycle 5; addEventHandler OnHold 14 stopallscripts; Battery_Setup 2200 3000 2.042",
    "image": "https://obrazki.elektroda.pl/YOUR_IMAGE.jpg",
    "wiki": "https://www.elektroda.com/rtvforum/topic_YOUR_TOPIC.html"
    }


    configure autoexec.bat as per your requirement,
    To test if cht_alert works properly, I did,

    delay_s 15
    cht_alert .5 5 2
    pindeepsleep 7200
  • #137 21697058
    fjk
    Level 11  
    Posts: 21
    >>21598960 I have same problem, temperature is 125 and hum as 100%. I tried few autoexecs from this thread but nothing works :( I'm always have temp 125. I have few identical looking devices but some of them have CHT8310 and others AHT20.
    I have problems only with that CHT8310. I have original firmware dump but I don't know how to extract pins from it. How I can discover proper pins?
    Attachments:
    • [BK7231N/CBU] Tuya TH01? Generic Wi-Fi Temperature & Humidity Sensor [CHT8310] PXL_20250510_163455438.jpg (2.91 MB) You must be logged in to download this attachment.
    • readResult_BK7231N_QIO_2025-16-9-19-17-15.bin (2 MB) You must be logged in to download this attachment.
    • [BK7231N/CBU] Tuya TH01? Generic Wi-Fi Temperature & Humidity Sensor [CHT8310] Capture1.JPG (71.53 KB) You must be logged in to download this attachment.
  • No meaningful pins data and zero readings

    #139 21697373
    fjk
    Level 11  
    Posts: 21
    >>21697328 Tuya extractor says only "Sorry, no meaningful pins data found"
    I've changed drivers but nothing changed, also tried on batteries, now readings is always zero
    I'm only able to extract this:

    {
       "abi":"0",
       "id":"null",
       "swv":"2.1.8",
       "bv":"40.00",
       "pv":"2.2",
       "lpv":"3.4",
       "pk":"x3o8epevyeo3z3oa",
       "firmk":"keycx5ftedppgup7",
       "cadv":"1.0.3",
       "cdv":"1.0.0",
       "dev_swv":"1.0.0",
       "s_id":"null",
       "dtp":"9",
       "sync":"0",
       "attr_num":"0",
       "mst_tp_0":"0",
       "mst_ver_0":"null",
       "mst_tp_1":"0",
       "mst_ver_1":"null",
       "mst_tp_2":"0",
       "mst_ver_2":"null",
       "mst_tp_3":"0",
       "mst_ver_3":"null "
    }


    Changed startup commands to:

    startDriver TuyaMCU
    startDriver tmSensor
    setChannelType 1 temperature_div10
    linkTuyaMCUOutputToChannel 1 val 1
    setChannelType 2 Humidity
    linkTuyaMCUOutputToChannel 2 val 2
    Attachments:
    • [BK7231N/CBU] Tuya TH01? Generic Wi-Fi Temperature & Humidity Sensor [CHT8310] Capture3.JPG (55.49 KB) You must be logged in to download this attachment.
  • doorsensorwsleep fails; dInput_n works instead

    #140 21698629
    moviesakbar
    Level 3  
    Posts: 6
    >>21697328
    Hi , Anyway to make this work with doorsensorwsleep, I tried all the variants and blasting the sensor with heat gun ,but didn't work, whereas dInput_n works perfectly fine,

    Code: JSON
    Log in, to see the code



    configure autoexec.bat as per your requirement,
    To test if cht_alert works properly, I did,

    delay_s 15
    cht_alert .5 5 2
    pindeepsleep 7200
  • #141 21702006
    ertoh2o
    Level 2  
    Posts: 2
    Quick question as a noob here, I have 2 of these which, unfortunately, even with 1.0.0v firmware are tuya-cloudcutter patched, so I will restart to serial flashing which is not problem, but on this forum there are a lot of configs, does anyone have a working one that doesn't eat battery?, also I have the "blue one" if it helps, thanks for your patience
  • Deep sleep configuration prevents wake-up after sleep

    #142 21703052
    ertoh2o
    Level 2  
    Posts: 2
    >>21702006

    I used the following config, the device at intervals disconnect Wi-Fi and blinks LED, is it normal?
    json
    Code: JSON
    Log in, to see the code


    then i changed autoexec to this


    PowerSave 1; waitFor MQTTState 1; delay_s 5; PinDeepSleep 3600; startDriver battery; startDriver NTP; startDriver CHT8305; CHT_Alert 0.2 0 60 2; CHT_Calibrate -1.5 2;



    now module sleeps, but never comes back, any idea?
  • #143 21708067
    Besuz
    Level 1  
    Posts: 1
    >>21697058
    Hi, any luck finding the issue?
  • #144 21709965
    fjk
    Level 11  
    Posts: 21
    No luck :( Still two zeros :( I don't know where and what to search, maybe these values are on other channels than 1 and 2...
  • UART pads are reversed and pin 14 logic is inverted

    #145 21829496
    tahunasky
    Level 4  
    Posts: 11
    I had alot of problems trying to get this to work, even flashing was an ordeal.

    With my sensor, the breakout pin pads on PCB where labelled weirdly. TX was connected to RX on module and RX was connected to TX. So with UART programmer I had to connect TX to TX on PCB pads and RX to RX. Check your PCB as maybe my one is different to others.

    I lifted the PCB in corner near MCU and used test hooks to connect the UART programmer so I didn't have to soldier anything.
    I tried several USB programmers and the only one I could get to work was a CP2102.
    To quickly connect CEN to ground I used a dupont jumper cables, GND from programmer went to breadboard, then I had test hook to GND on PCB and dupont jumper for CEN reset. I would quickly touch CEN on PCB with other end of dupont jumper cable. Takes 2 tries max to get sensor to go into programming mode. You could also use a button on breadboard to do the same thing.

    Close-up of an electronics setup with a circuit board, wires, breadboard, and a USB‑UART adapter

    The template from here didn't do what I wanted, as I wanted the autoexec,bat to no execute if button on sensor was pressed so sensor wouldn't go into deepsleep, and I would be able to change settings. The original template has button on pin 14 set to "14": "DoorSnsrWSleep;4",, not sure why as this is not a door sensor..

    Pin 14 is set to high (1) normally on my sensor so I could not get addEventHandler OnHold 14 to work.. My log was full of Info:GEN:14 Button_OnLongPressHold as if I was continuously pressing the button. On my one when button is pressed pin14 goes to 0, and when I release it pin14 goes back to 1.
    To check the value of your pin you can set flag 13.
    To do this remove settings for pin 14 ( "14": "dinput;4",) from template or in web app.. then from main gui -> config menu -> Configure General/Flags -> tick "Flag 13" -> Submit. This shows actual PIN logic level for unconfigured pins. Look for pin status on main gui.

    Screenshot of OpenBK7231N status page with system info and buttons: Config, Restart, Launch Web Application

    My config template:
    
    {
      "vendor": "Tuya",
      "bDetailed": "0",
      "name": "Generic Wi-Fi TH01? Temperature & Humidity Sensor [CHT8310]",
      "model": "TH08",
      "chip": "BK7231N",
      "board": "CBU",
      "flags": "0",
      "keywords": [
        "battery",
        "environment",
        "AAA",
        "hygrometer",
        "th08 label",
        "blue pcb",
        "sensylink"
      ],
      "pins": {
        "8": "BAT_Relay;3",
        "14": "dinput;4",
        "16": "WifiLED_n;0",
        "20": "CHT83XX_SCK;0",
        "22": "CHT83XX_SDA;0;1",
        "23": "BAT_ADC;2"
      },
      "command": "backlog PowerSave 1; startDriver battery; startDriver CHT83XX",
      "image": "https://obrazki.elektroda.pl/5743076800_1701986603.png",
      "wiki": "https://www.elektroda.com/rtvforum/topic4019974.html"
    }
    


    AUTOEXEC.BAT
    
    // press and hold button while inserting battery, wait for wifi connecting LED to go out and wait another 5 seconds before releasing button to stop below code from running.
    if $CH4==0 then  goto END
    //CHT_Calibrate 0 6
    
    setChannelType 0 Temperature_div10
    setChannelType 1 Humidity
    
    waitFor MQTTState 1
    delay_s 1
    //publish temp-humidity/device_1 "{\"CHN4\":$CH4}" 1
    
    publish temp-humidity/device_1 "{\"temp\":$CH0,\"humidity\":$CH1,\"bat_voltage\":$batteryVoltage,\"bat_percent\":$batteryLevel}" 1
    delay_s 1
    DeepSleep 300
    
    END:
    
    


    My home assistant configuration.yaml settings are:

    
    mqtt:
      sensor:
        # Tuya TH08 wifi only
        - name: "th08_temperature"
          state_topic: "temp-humidity/device_1"
          unit_of_measurement: "°C"
          device_class: temperature
          state_class: measurement
          value_template: "{{ value_json.temp / 10 }}"
    
        - name: "th08_humidity"
          state_topic: "temp-humidity/device_1"
          unit_of_measurement: "%"
          device_class: humidity
          state_class: measurement
          value_template: "{{ value_json.humidity }}"
    
        - name: "th08_battery_voltage"
          state_topic: "temp-humidity/device_1"
          unit_of_measurement: "V"
          entity_category: "diagnostic"
          device_class: battery
          state_class: measurement
          value_template: "{{ value_json.bat_voltage / 1000 }}"
    
        - name: "th08_battery_percent"
          state_topic: "temp-humidity/device_1"
          unit_of_measurement: "%"
          entity_category: "diagnostic"
          device_class: battery
          state_class: measurement
          value_template: "{{ value_json.bat_percent }}"
    


    And this is what a my basic panel looks like in HA:

    TH08 panel readings: temperature 29.5°C, humidity 81%, battery 87%, battery voltage 2.878 V

    Not sure how long sensor will run with these settings, but hopefully a few months. Once I have completed testing I will set deepsleep to 600 (10 minutes) or longer depending on my needs.

    Hopefully this will help others and save time setting up sensor.
  • #146 21840909
    daffodilistic
    Level 2  
    Posts: 2
    Hi, I've just bought one of these devices from AliExpress, but I do not have a CH340-based USB-TTL adapter. However, I do have an old UartSBee_V4 that I got way back during my tinkering with Arduino Uno days, almost 12 years ago (I'm still quite new to the IoT/embedded world 😅). Would this old adapter be able to flash OpenBeken on the TH01 device? Thanks!
  • #147 21841771
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14770
    Help: 659
    Rate: 12913
    Any USB to UART adapter should work. A good power supply is required, but I see yours have 3.3V LDO?
    Quote:

    DC current for 3.3v pin, up to 500mA provided for better support of XBee pro
    Helpful post? Buy me a coffee.
  • RX/TX reversed on this sensor PCB

    #148 21846683
    daffodilistic
    Level 2  
    Posts: 2
    p.kaczmarek2 wrote:
    Any USB to UART adapter should work. A good power supply is required, but I see yours have 3.3V LDO?
    Quote:

    DC current for 3.3v pin, up to 500mA provided for better support of XBee pro


    Hi—yes, it does provide 3.3 V out via one of the output pins. I managed to get it to work with a mini-USB to USB-C adapter, but it seems like the device that I got is similar to @tahunasky version; RX and TX are flipped via PCB connection—whether this is for ease of flashing the device in the factory or a genuine mistake on the manufacturer's end, I am not sure.

    Two blue circuit boards connected with multicolored wires on a desk

    Flashing it was OK with the latest version of the flasher tool, but I had to flash it twice, as the first flash succeeded but failed to start—seems like an issue with the boot or with configuration somewhere.

    Finally, after playing with some device config files posted here in this thread (I had to remove the door sensor from the preset), it seems like I messed up the autoexec.bat settings and bricked the device, or it genuinely failed at that point in time—I'll investigate further another time.

    PS: If anyone knows how to set the button on the back of the sensor to function as a "factory reset" button, it would be greatly appreciated!
  • #149 21883872
    mkrum001
    Level 3  
    Posts: 41
    Rate: 5
    Hello,

    how do you control the retention for the entities? Example: if I use the sensor to report data every 600 s, the HA values go to unavailable after around 2 minutes. Is there a way to manage the retention time? Flag7 is an option, but then if the battery dies or there is any connectivity issue, it will be hard to notice.
  • #150 21883890
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14770
    Help: 659
    Rate: 12913
    Well... I don't think there is a ready mechanism for that in HA. Home Assistant would have to know how often device reports to detect it being unable to go online for longer time than usual. Maybe HA could somehow check last report time and go from there?
    Helpful post? Buy me a coffee.

Topic summary

LABEL_AI_GENERATED
Discussion centers on a Tuya Wi‑Fi temperature/humidity sensor based on BK7231N/CBU and a Sensylink CHT8310 sensor, initially mislabeled as TH08/TH01. The thread covers identifying the correct hardware, obtaining the full CHT8310 protocol datasheet, flashing OpenBK firmware via BK7231GUIFlashTool or tuya-cloudcutter, and confirming the device configuration. Support was added by reusing the CHT8305 driver for CHT8310, with the correct sensor ID reported as 59 59 8215. Contributors worked through pin mapping, secondary I²C channel setup, battery monitoring, MQTT/Home Assistant discovery, calibration offsets, and low-battery bootloop behavior. Later updates added ALERT pin support on P7 for deep-sleep wakeup, improved battery-saving scripts, and clarified that the device can be configured as a generic TH01/TH08-style sensor with CHT8310 support in OpenBeken.
AI summary based on the discussion. May contain errors.
ADVERTISEMENT