FAQ
TL;DR: Set PinDeepSleep to 3600 s for hourly wake-ups; proven ranges span 300–86400 s. "require autoexec.bat" for stability [Elektroda, divadiow, post #21271947] DoorSnsrWSleep caused ~50 s sleep lockouts for CHT8310 users [Elektroda, qrmonzergamal, post #21271142]
Why it matters: This FAQ helps Tuya CHT8310 owners make reliable, battery-friendly hourly MQTT updates using OpenBeken.
Quick Facts
- Sleep control: PinDeepSleep supports seconds; examples use 300 s (retry) and 86400 s (daily) [Elektroda, divadiow, post #21271947]
- Typical hourly updates: set PinDeepSleep 3600 s in autoexec (same mechanism as examples) [Elektroda, divadiow, post #21271947]
- CHT_Alert now takes 4 params; the 2nd is humidity [Elektroda, insmod, post #21271974]
- Battery sampling example: Battery_cycle 2 = measure every 2 s [Elektroda, divadiow, post #21271947]
- Command reference: deepsleep, MQTT, CHT83xx documented in OpenBeken Commands (extended) [OpenBeken Commands (extended)].
- Caution: DoorSnsrWSleep led to ~50 s sleep and no rejoin for one CHT8310 setup [Elektroda, qrmonzergamal, post #21271142]
How do I make my Tuya CHT8310 wake every hour and publish data?
Use an autoexec script with PinDeepSleep 3600 and an MQTT connection check. Example logic: if connected, publish, wait 60 s, then sleep 3600 s; if not, publish, wait 30 s, sleep 300 s and retry. This mirrors the shared 86400/300 s example [Elektroda, divadiow, post #21271947] "They require autoexec.bat setup too" [Elektroda, divadiow, post #21271947] Commands are documented in OpenBeken [OpenBeken Commands (extended)].
What’s the quick 3-step setup to enable hourly updates?
- Enable PowerSave and start battery and CHT83xx drivers (PowerSave 1, startdriver battery, CHT_Cycle) [Elektroda, divadiow, post #21271947]
- Add MQTT-state check; on connect, publish then delay_s 60, then PinDeepSleep 3600 [Elektroda, divadiow, post #21271947]
- On no-connect, publish, mqtt_broadcastInterval 3, delay_s 30, PinDeepSleep 300 to retry [Elektroda, divadiow, post #21271947]
Why did DoorSnsrWSleep make my sensor sleep after ~50 seconds and never come back?
DoorSnsrWSleep targets door/contact sensors, not the CHT8310 TH sensor flow. A user reported ~50 s sleep with no subsequent updates after using it [Elektroda, qrmonzergamal, post #21271142] Switch to deepsleep/PinDeepSleep with an autoexec and MQTT check to control wake cycles [Elektroda, divadiow, #21271630; OpenBeken Commands (extended)].
Which OpenBeken commands matter for CHT8310 hourly reporting?
Core commands: PowerSave 1; startdriver battery; Battery_cycle 2; CHT_Cycle 2; CHT_Calibrate -8 0; CHT_Alert with 4 params; publishChannels; mqtt_broadcastInterval; delay_s; PinDeepSleep N seconds [Elektroda, divadiow, #21271947; Elektroda, insmod, #21271974]. Command syntax and options are in the extended docs [OpenBeken Commands (extended)].
How should I configure CHT_Alert on current firmware?
Use four parameters; the second controls humidity thresholds. Example shared earlier had three; it is now updated to four [Elektroda, insmod, #21271974; Elektroda, divadiow, #21272067]. Quote: "You should have 4 parameters - where second is for humidity" [Elektroda, insmod, post #21271974] Refer to the command reference for exact argument meaning [OpenBeken Commands (extended)].
What template or pin mapping should a CHT8310 (BK7231N) use?
Use the updated template that exposes CHT83XX_SCK/SDA, BAT_ADC, BAT_Relay, Btn, and WifiLED_n pins, not the older one from the first post. The author provided a corrected template and promised to update the thread [Elektroda, divadiow, #21271947; Elektroda, divadiow, #21271682].
How does the MQTT connection check affect sleep timing?
The sample autoexec sleeps for 1 day (86400 s) when MQTT is connected, or 5 minutes (300 s) when not connected. It publishes first, waits 60 s before long sleep, or 30 s before retry sleep [Elektroda, divadiow, post #21271947] This same pattern can be used with 3600 s hourly sleep [OpenBeken Autoexec Examples].
Can this setup wake on button press or temperature change?
Yes. Use addEventHandler OnHold 4 SafeMode to get a maintenance mode via button. Use CHT_Alert to trigger wake on temperature/humidity deltas. The example sets labels and alert thresholds for testing [Elektroda, divadiow, #21271947; Elektroda, insmod, #21271974].
I used method 2 and my battery died fast—how to avoid that?
One user reported the battery "will be empty in less than an hour" with a different method [Elektroda, qrmonzergamal, post #21271703] Reduce wake time (delay_s 60), enable PowerSave 1, and increase sleep intervals via PinDeepSleep (e.g., 3600–86400 s) to cut consumption [Elektroda, divadiow, post #21271947]
What’s a safe maintenance window before the device goes back to sleep?
The shared script uses delay_s 60 after publishing when connected. That gives a 60-second window to interact before deep sleep. For retry cycles, it uses delay_s 30 [Elektroda, divadiow, post #21271947] Adjust these delays to balance maintenance time and battery life [OpenBeken Autoexec Examples].
How do I fix CHT8310 that never goes online after flashing?
Check that you used the correct template for CHT83XX pins and added an autoexec. As the expert noted, "They require autoexec.bat setup too" [Elektroda, divadiow, post #21271947] If still failing, enter SafeMode by holding the button (OnHold 4 SafeMode) and correct MQTT or sleep settings [Elektroda, divadiow, post #21271947]
What if MQTT never connects because of my Wi‑Fi/router?
The example loops forever with 5-minute sleeps when MQTT cannot connect. Ensure broker and router settings allow the client. A maintainer suggested testing an alternative OTA build from PR #1297 if you cannot change router settings [Elektroda, insmod, #21271939; Elektroda, divadiow, #21271947; OpenBeken PR #1297].
Is deepsleep different from PinDeepSleep for this use case?
Both control sleep, specified in seconds. The community examples show PinDeepSleep for event-driven sleeps after short delays. The commands page documents deepsleep semantics for scripting as well [Elektroda, divadiow, #21271630; Elektroda, divadiow, #21271947; OpenBeken Commands (extended)].
How do I calibrate temperature readings from CHT8310?
Use CHT_Calibrate with your offset. One shared config used CHT_Calibrate -8 0 to bring readings closer to reality. Humidity calibration was left as-is in that example [Elektroda, divadiow, post #21271947] Validate with a reference thermometer and then adjust offsets [OpenBeken Commands (extended)].
Where can I find working autoexec examples for battery sensors?
A full working autoexec with PowerSave, battery driver, CHT83xx cycle, MQTT checks, and sleep logic was shared in the thread. Video and docs also show autoexec patterns for low-power nodes [Elektroda, divadiow, #21271947; Elektroda, divadiow, #21271630; OpenBeken Autoexec Examples].