logo elektroda
logo elektroda
X
logo elektroda

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

divadiow 46263 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
  • Longer deep sleep and alkaline batteries

    #61 20981813
    insmod
    Level 31  
    Posts: 1432
    Help: 168
    Rate: 455

    It can be easily improved, for example, use Ni-MH, or even better - alkaline batteries. I use Li-ion, and they have much less energy capacity in AAA format. But I use them as they, when discharged, drop voltage to zero, and so the MCU will not try to start and fail, and eventually drop to safe mode. Another solution is longer deep sleep. I have 15 minutes, you can stretch it to 30, or even longer. I believe that with 1hr deep sleep and alkaline batteries it will work at least half a year.
  • ADVERTISEMENT
  • Add MQTT timeout fallback to prevent battery drain

    #62 20981885
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14770
    Help: 659
    Rate: 12913
    WiFi is not a suitable protocol for battery-powered devices by design and I'd always opt for Zigbee in such cases, but you can still improve the script that has been shown above.

    For example, I think it may be worth to add some kind of fallback case for the situation when MQTT is not up, some kind of timeout. A single repeating event can be used for that. It would have to be inserted before waitFor . Otherwise , this script will wait forever for MQTT to connect and it can quickly discharge battery when your HA is off for maintance.
    Helpful post? Buy me a coffee.
  • Add MQTT connection timeout to prevent battery drain

    #63 20982640
    hojnikb
    Level 12  
    Posts: 45
    Rate: 2

    p.kaczmarek2 wrote:
    WiFi is not a suitable protocol for battery-powered devices by design and I'd always opt for Zigbee in such cases, but you can still improve the script that has been shown above.

    For example, I think it may be worth to add some kind of fallback case for the situation when MQTT is not up, some kind of timeout. A single repeating event can be used for that. It would have to be inserted before waitFor . Otherwise, this script will wait forever for MQTT to connect and it can quickly discharge battery when your HA is off for maintenance.


    Could you give us an example of such timeout?
  • #64 20983428
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14770
    Help: 659
    Rate: 12913
    This can be easily done with addRepeatingEventID, for example:
    
    // [IntervalSeconds][RepeatsOr-1][UserID][CommandToRun]
    addRepeatingEventID 30 1 666 DeepSleep 900
    

    This will create an event with ID 666 with repeats count 1 and delay 30 seconds.
    Futhermore, if you want to create a config button, you can cancel it with:
    
    cancelRepeatingEvent 666 
    
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #65 21000232
    bl00dy
    Level 7  
    Posts: 38
    Rate: 3

    Have the same, successfully installed firmware with tuya-cloudcutter
  • #66 21027475
    Zogdan
    Level 10  
    Posts: 25
    Help: 6
    Rate: 13

    >>20981813
    The PW33 dc-dc boost converter used to boost the 2x1.5V to 3.3V is a PW5100 that can take up to 5V input voltage so you might consider using Li-ion.
    Maybe good to include I blew up mine by not disconnecting the 3.3V from the UART while inserting the batteries.
    Practically this led to a short in the PW33, shorting the battery now, waiting for PW33 to replace.
  • CHT8310 alert mode for deep sleep wakeup

    #67 21050429
    crispybeken
    Level 2  
    Posts: 2
    Rate: 1
    >>20876365

    @artin961 The problem with periodic wakeup from DeepSleep is we could miss changes in temperature and/or humidity if we sleep too long and waste battery by waking up even when nothing has changed.
    However, both CHT8310 and CHT8305 feature an ALERT mode, which can be used to wake up the BK7231N from DeepSleep when reaching temperature and/or humidity limitation programmed by setting temperature and/or high/low-limit registers of the sensor.
    All we need to do is set new limits based on last read value before activating Deep Sleep, for example at 22° set lower limit to 21.5° and upper limit to 22.5°. The BK7231N would stay asleep as long as the temperature stays between these values but immediately wake up when the limit is reached.
    The ALERT pin of CHT8310 is connected to P7 with a 10kΩ resistor in between. The I²C commands necessary are already shown to work in this arduino library: CHT8305.
    If we could add a setAltert([temp_high, temp_low, hum_high, hum_low]) function to OpenBeken it would greatly reduce power usage and make the readings more accurate, since we would get any change in temperature and/or humidity when they occur.
  • #68 21054403
    sanysneky
    Level 3  
    Posts: 6

    I have this temperature and humidity sensor with Bk7231n sht30. Everything was working fine until the batteries died. Now I can't connect it to the Live Smart app. I press the reset button and the device is visible but cannot be paired. What do I need to do to pair this sensor again
  • #69 21055193
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14770
    Help: 659
    Rate: 12913
    Wait, to be clear, you haven't flashed your device with OBK and it still died after batteries run out?
    Helpful post? Buy me a coffee.
  • Battery depletion prevents pairing after reset

    #70 21055214
    sanysneky
    Level 3  
    Posts: 6

    Yes. After the battery runs out, it will not pair. I didn't flash it. After entering pairing mode, the app sees the device, but in the next step, after entering the code from my 2.4Ghz wifi network, it won't pair. Tried manual pairing with both modes and LED flashing fast and flashing slow. When it flashes slowly, the SSID of the device is visible and connects to it, but when I go back a step, the app searches for devices and does not connect.
  • #71 21058981
    sanysneky
    Level 3  
    Posts: 6

    solved the problem after the factory reset of the router
  • #72 21059351
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14770
    Help: 659
    Rate: 12913
    Wait, what? Are you saying that factory reset of the router made your Tuya device pair again?
    Helpful post? Buy me a coffee.
  • #73 21059651
    sanysneky
    Level 3  
    Posts: 6

    I reset the router to factory settings and after that the Tuya device paired with the app. Something was wrong with the router.
  • Low-temperature CHT8310 offset calibration issue

    #74 21098612
    joseang
    Level 2  
    Posts: 3
    hojnikb wrote:

    Does anyone else experience very poor precision on lower temps? I've noticed that when temps drop below 10°C, its accuracy drops off even further. While at ~20-25°C, it's usually around 2°C off (easily fixed by offsetting), by 10 or even 0°C, it's easily off by ~5°C or more (shows higher than it actually is).

    Any way to calibrate or something? Or is CHT8310 just that inaccurate.


    I have the same issue. Temperature is 2ºC above the real temp.

    How can I fix it by offsetting? I'm using Smart Life app.

    Thanks.
  • ADVERTISEMENT
  • #75 21100192
    vincenzoernst1
    Level 9  
    Posts: 100
    Help: 3
    Rate: 7

    @p.kaczmarek2

    can you plz update the template in the wiki?

    @All

    would it be possible to use PinDeepSleep instead of Deepsleep? for Btn we could use the reset button of the unit? or will this interfere with general openbeken operation? with PinDeepSleep we would be able to wake up the unit at any time for maintenance reasons.

    also how to set temp/hum offsets in openbeken?
  • Template should use dInput or DoorSnsrWSleep for pin 14

    #76 21109748
    divadiow
    Level 38  
    Posts: 5220
    Help: 449
    Rate: 918
    vincenzoernst1 wrote:
    can you plz update the template in the wiki?


    with reference to: https://www.elektroda.com/rtvforum/topic4056603.html#21097621

    change template from this

    "14": "Btn;4",
    to
    "14": "dInput;4",
    or
    "14": ""DoorSnsrWSleep;4",
    ?
    I guess either make more sense than btn.

    Added after 2 [minutes]:

    joseang wrote:
    How can I fix it by offsetting? I'm using Smart Life app.


    @joseang you're using factory fw still?
  • #77 21109752
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14770
    Help: 659
    Rate: 12913
    @joseang if there is no calibration option in Tuya/SmartLife app, then I don't think it's possible. I tested quite a few Tuya/SmartLife device and I noticed that only more expensive models have calibration option.
    Helpful post? Buy me a coffee.
  • #78 21109755
    divadiow
    Level 38  
    Posts: 5220
    Help: 449
    Rate: 918
    Also. I think I should revise thread title and template to remove reference to TH08. I've seen elsewhere mention of incorrect label on package and have since seen Tuya's API response from info in the fw dump refer to this as a "TH01".

    Also, it's blatantly another TH01 going on looks alone.
  • #79 21109760
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14770
    Help: 659
    Rate: 12913
    Changed name to TH01:
    Screenshot of an online forum discussing the Tuya TH01 device, displaying views and replies statistics.
    You can update template if you want.
    Helpful post? Buy me a coffee.
  • #80 21109766
    joseang
    Level 2  
    Posts: 3

    joseang wrote:
    How can I fix it by offsetting? I'm using Smart Life app.


    @joseang you're using factory fw still?[/quote]

    Yes, I'm still using factory fw. I'll try the custom fw of this thread.

    I'm currently experimenting with a solar panel and a supercapacitor to charge and supply the TH08.
  • CHT8310 template keywords and variant notes

    #81 21156905
    vincenzoernst1
    Level 9  
    Posts: 100
    Help: 3
    Rate: 7
    maybe you could also add "CHT8310" to the templates keywords.

    Added after 6 [minutes]:

    divadiow wrote:
    Curious, mine has 8304 in the log, not 8305.

    Info:SENSOR:DRV_CHT8304_readEnv: Temperature:125.000000C Humidity:100.000000%


    Info:SENSOR:DRV_CHT8305_init: ID: FF FF FFFF
    Error:CMD:command with name CHT_Calibrate already exists!
    Error:CMD:command with name CHT_Cycle already exists!
    Info:MAIN:Started cht8305.


    Screenshot of OpenBK software with temperature and humidity sensor readings.

    My startup command is

    backlog PowerSave 1; startDriver SSDP; startDriver Wemo; startDriver NTP; startDriver CHT8305


    What flags have you set @Baustromverteiler and what channel/pin settings?

    Added after 12 [minutes]:

    Silly me https://github.com/openshwprojects/OpenBK7231T_App/issues/983#issue-1997790886

    Screenshot showing interface elements with labels P20, P21, P22 and associated values CHT8305_SCK and CHT8305_SDA.

    Info:SENSOR:DRV_CHT8305_init: ID: 59 59 8215
    


    Screenshot of the OpenBK7231N interface displaying CHT8305 data and a channel configuration warning.

    Added after 9 [hours] 48 [minutes]:

    OBK template for this variant

    Code: JSON
    Log in, to see the code


    ah i see u already have the template updated. can you plz be sure to have the template in the inital post updated as well any time you update it in the thread...this would help a lot not to have to read the whole thing.... ;-)
  • ADVERTISEMENT
  • Request to reduce CHT sensor polling rate

    #82 21160571
    vincenzoernst1
    Level 9  
    Posts: 100
    Help: 3
    Rate: 7
    @p.kaczmarek2

    when i check the logs is see the CHT driver poll the temp/hum about every second, which is in any case never needed.
    @work i work with environment sensors all the time and we never poll that much, even on grid powered units, cause temp never changes that much (u never should apply sensors to direct sunlight.)

    on battery powered units this makes no sense at all. it drains the battery unnecessarily.

    can we adjust the polling rate? how?
    if not, maybe by adding a parameter to "startDriver CHT8305 x" where x is the poll rate in sec? this should be usefull for any kind of environmental sensor.

    
    Info:SENSOR:DRV_CHT8304_readEnv: Temperature:29.812500C Humidity:47.622680%
    Info:SENSOR:DRV_CHT8304_readEnv: Temperature:29.812500C Humidity:47.564697%
    Info:SENSOR:DRV_CHT8304_readEnv: Temperature:29.843750C Humidity:47.525024%
    Info:SENSOR:DRV_CHT8304_readEnv: Temperature:29.906250C Humidity:47.409057%
    Info:SENSOR:DRV_CHT8304_readEnv: Temperature:29.781250C Humidity:47.463989%
    Info:SENSOR:DRV_CHT8304_readEnv: Temperature:29.812500C Humidity:47.421264%
    Info:SENSOR:DRV_CHT8304_readEnv: Temperature:29.875000C Humidity:47.525024%
    Info:SENSOR:DRV_CHT8304_readEnv: Temperature:29.843750C Humidity:47.479248%
    Info:SENSOR:DRV_CHT8304_readEnv: Temperature:29.843750C Humidity:47.509765%
    Info:SENSOR:DRV_CHT8304_readEnv: Temperature:29.875000C Humidity:47.409057%
    Info:SENSOR:DRV_CHT8304_readEnv: Temperature:29.843750C Humidity:47.479248%
    Info:SENSOR:DRV_CHT8304_readEnv: Temperature:29.843750C Humidity:47.393798%
    Info:SENSOR:DRV_CHT8304_readEnv: Temperature:29.875000C Humidity:47.409057%
    Info:SENSOR:DRV_CHT8304_readEnv: Temperature:29.812500C Humidity:47.406005%
    Info:SENSOR:DRV_CHT8304_readEnv: Temperature:29.843750C Humidity:47.451782%
    Info:SENSOR:DRV_CHT8304_readEnv: Temperature:29.906250C Humidity:47.338867%
    Info:SENSOR:DRV_CHT8304_readEnv: Temperature:29.875000C Humidity:47.351074%
    Info:SENSOR:DRV_CHT8304_readEnv: Temperature:29.875000C Humidity:47.393798%
    Info:SENSOR:DRV_CHT8304_readEnv: Temperature:29.875000C Humidity:47.280883%
    Info:SENSOR:DRV_CHT8304_readEnv: Temperature:29.875000C Humidity:47.409057%
    Info:SENSOR:DRV_CHT8304_readEnv: Temperature:29.875000C Humidity:47.293090%
    Info:SENSOR:DRV_CHT8304_readEnv: Temperature:29.875000C Humidity:47.250366%
    Info:SENSOR:DRV_CHT8304_readEnv: Temperature:29.812500C Humidity:47.235107%
    Info:SENSOR:DRV_CHT8304_readEnv: Temperature:29.875000C Humidity:47.250366%
    Info:SENSOR:DRV_CHT8304_readEnv: Temperature:29.906250C Humidity:47.265625%
    Info:SENSOR:DRV_CHT8304_readEnv: Temperature:29.906250C Humidity:47.280883%
    Info:SENSOR:DRV_CHT8304_readEnv: Temperature:29.812500C Humidity:47.204589%
    Info:SENSOR:DRV_CHT8304_readEnv: Temperature:29.906250C Humidity:47.296142%
    Info:SENSOR:DRV_CHT8304_readEnv: Temperature:29.968750C Humidity:47.311401%
    Info:SENSOR:DRV_CHT8304_readEnv: Temperature:29.906250C Humidity:47.265625%
    Info:SENSOR:DRV_CHT8304_readEnv: Temperature:29.906250C Humidity:47.265625%
    Info:SENSOR:DRV_CHT8304_readEnv: Temperature:29.906250C Humidity:47.323608%
    Info:SENSOR:DRV_CHT8304_readEnv: Temperature:29.906250C Humidity:47.280883%
    Info:SENSOR:DRV_CHT8304_readEnv: Temperature:29.906250C Humidity:47.409057%
    Info:SENSOR:DRV_CHT8304_readEnv: Temperature:29.906250C Humidity:47.222900%
    Info:SENSOR:DRV_CHT8304_readEnv: Temperature:29.906250C Humidity:47.265625%
    Info:SENSOR:DRV_CHT8304_readEnv: Temperature:29.906250C Humidity:47.238159%
  • #83 21160676
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14770
    Help: 659
    Rate: 12913
    startDriver CHT8305 x
    is out of the question because we are using the same syntax for passing pins to drivers.

    Maybe we should introduce something universal, per driver, like driverUpdateRate CHT8305 60 ?
    Helpful post? Buy me a coffee.
  • #84 21160993
    vincenzoernst1
    Level 9  
    Posts: 100
    Help: 3
    Rate: 7
    hmmm.... sounds reasonable.

    universality is always a good thing.

    maybe we can also set the default poll time to something less bus stressing. lets say 5sec?
  • #86 21171229
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14770
    Help: 659
    Rate: 12913
    The following PR is now merged, thank you.
    Helpful post? Buy me a coffee.
  • #87 21182138
    vincenzoernst1
    Level 9  
    Posts: 100
    Help: 3
    Rate: 7
    >>21170847

    how to use it correctly?!

    Added after 7 [minutes]:

    >>21170847

    for eg bathrooms it would also be handy to have the same with humidity.
  • Questioning correct CHT8310 driver usage and fault queue

    #88 21182153
    divadiow
    Level 38  
    Posts: 5220
    Help: 449
    Rate: 918
    vincenzoernst1 wrote:
    how to use it correctly?!


    https://github.com/openshwprojects/OpenBK7231...dec39d5c7794ba4/src/driver/drv_cht8305.c#L273

    Added after 14 [minutes]:

    @insmod @p.kaczmarek2 is description correct here? https://github.com/openshwprojects/OpenBK7231T_App/pull/1301

    Added after 5 [minutes]:

    I didn't actually know what the fault queue was

    Table showing alert fault queue setup for CONSEC_FQ[1:0] bits.
  • #89 21182369
    insmod
    Level 31  
    Posts: 1432
    Help: 168
    Rate: 455
    >>21182153 Looks accurate enough. Though you have to edit the source file, not .md one. Will add humidity on the weekends if I don't forget.

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