FAQ
TL;DR: "They require autoexec.bat setup." Use OpenBK deepsleep/PinDeepSleep in seconds (typical 300–86400), publish, then sleep; set 3600 for hourly. [Elektroda, divadiow, post #21271947]
Why it matters: For Tuya CHT8310/TH01 owners on OpenBK, this enables reliable hourly MQTT updates without killing the battery.
Quick-Facts
- Set sleep duration with deepsleep xx; value is seconds for timed wakes. [Elektroda, divadiow, post #21271630]
- Autoexec example sleeps 5 minutes if MQTT is disconnected and 1 day when connected. [Elektroda, divadiow, post #21271947]
- CHT_Alert now has four parameters; the second controls humidity threshold. [Elektroda, insmod, post #21271974]
- Sensor and battery sampling can run every 2 seconds (CHT_Cycle 2, Battery_cycle 2). [Elektroda, divadiow, post #21271947]
- A user reported "battery will be empty in less than an hour" with an alternative method. [Elektroda, qrmonzergamal, post #21271703]
Quick Facts
- Set sleep duration with deepsleep xx; value is seconds for timed wakes. [Elektroda, divadiow, post #21271630]
- Autoexec example sleeps 5 minutes if MQTT is disconnected and 1 day when connected. [Elektroda, divadiow, post #21271947]
- CHT_Alert now has four parameters; the second controls humidity threshold. [Elektroda, insmod, post #21271974]
- Sensor and battery sampling can run every 2 seconds (CHT_Cycle 2, Battery_cycle 2). [Elektroda, divadiow, post #21271947]
- A user reported "battery will be empty in less than an hour" with an alternative method. [Elektroda, qrmonzergamal, post #21271703]
How do I make the Tuya CHT8310 wake every hour and publish data?
Use OpenBK autoexec to publish, then sleep. Example plan: 1) Configure drivers and MQTT. 2) publishChannels, set mqtt_broadcastInterval 3, delay_s 60. 3) PinDeepSleep 3600 for hourly cadence. This mirrors the posted working logic using PinDeepSleep with second-based values. [Elektroda, divadiow, post #21271947]
What’s the correct OpenBK template/pin map for the TH01/CHT8310 board?
Use the updated template for BK7231N. Pins: 7 dInput, 8 BAT_Relay, 14 Btn, 16 WifiLED_n, 20 CHT83XX_SCK, 22 CHT83XX_SDA, 23 BAT_ADC. Apply this template before scripting sleep. It matches the working configuration shared in-thread. [Elektroda, divadiow, post #21271947]
DoorSnsrWSleep made my sensor sleep and never wake—how do I fix it?
Skip DoorSnsrWSleep for periodic TH use. Use deepsleep with seconds in autoexec to control wake intervals. This approach, suggested in-thread, targets scheduled reporting rather than door interrupts. [Elektroda, divadiow, post #21271630]
How do I calibrate temperature/humidity on CHT8310?
Use CHT_Calibrate temp_offset humidity_offset. Example: CHT_Calibrate -8 0 applies a -8°C temperature offset and zero humidity offset. Verify with a trusted reference and adjust. Keep offsets minimal to avoid drift. [Elektroda, divadiow, post #21271947]
What CHT_Alert syntax should I use now?
Use four parameters; the second parameter is the humidity threshold. Update older scripts to the new syntax to avoid errors. "cht_alert is now a little different." [Elektroda, insmod, post #21271974]
How do I ensure Home Assistant gets a reading before sleep?
At boot, call publishChannels. Set mqtt_broadcastInterval 3 to push quickly. Add delay_s 60 to allow delivery, then PinDeepSleep. This ensures HA receives at least one payload per wake. [Elektroda, divadiow, post #21271947]
MQTT is down—how should the device behave?
Gate sleep on $MQTTState. If disconnected, publishChannels, wait about 30 seconds, then PinDeepSleep 300 and retry later. This avoids long blackouts while the broker is unavailable. [Elektroda, divadiow, post #21271947]
Do I really need autoexec for this device?
Yes. "They require autoexec.bat setup." Autoexec manages power saving, sensor cadence, MQTT publishing, and timed deepsleep reliably. It also provides a safe-mode fallback. [Elektroda, divadiow, post #21271947]
Which command schedules the sleep timer: deepsleep or PinDeepSleep?
Both accept seconds for sleep duration. The shared working script uses PinDeepSleep after a short delay to allow MQTT publishing. Either way, schedule via autoexec. [Elektroda, divadiow, post #21271947]
Wi‑Fi reconnection is flaky—any firmware I can try?
Test the OTA build linked from PR #1297. It’s suggested when you cannot alter router settings. Flash it and re-test wake/publish cycles. [Elektroda, insmod, post #21271939]
Does aggressive polling hurt battery life?
Yes. The example polls sensor and battery every 2 seconds. Reduce these cycles or extend deepsleep to save power. Shorter awake windows also help. [Elektroda, divadiow, post #21271947]
Can I wake on big temperature changes instead of on a schedule?
Use CHT_Alert to trigger early wake on thresholds. On newer builds, configure four parameters with the second for humidity. Tune thresholds cautiously. [Elektroda, insmod, post #21271974]
How do I add a long-press to enter Safe Mode?
Bind the button hold to Safe Mode using addEventHandler OnHold 4 SafeMode. This provides a recovery path if a script misbehaves. [Elektroda, divadiow, post #21271947]