FAQ
TL;DR: Deep-sleep BK7231N door sensors can run >16 years on a CR2032 (“600 notifications vs 5 years at 2 s wake”, [Elektroda, krzbor, post #20458745]) and reconnect to MQTT in “about 4 s” with Fast-Connect enabled [Elektroda, p.kaczmarek2, post #20465020] Why it matters: matching sleep time, static IP and battery calibration maximises life and avoids missed door events.
Quick Facts
• Sleep current: ~50–80 µA (image, [Elektroda, p.kaczmarek2, post #20457191])
• Wake current: 50–150 mA burst, 7 s Wi-Fi join typical [Elektroda, miroww1, post #20464951]
• Fast-Connect flag + static IP cuts latency to 4–5 s [Elektroda, p.kaczmarek2, post #20465020]
• Default DSTime 60 s; configurable 1-3600 s via DSTime cmd [Elektroda, p.kaczmarek2, post #20671018]
• RF-cal partition loss sets MAC to 00:00:00 and halves range [Elektroda, p.kaczmarek2, post #20467352]
How do I flash OpenBeken on a BK7231N window sensor?
- Solder TX/RX/GND/3V3 to the rear pads or use OTA if Tuya firmware still active [Elektroda, Mad_Maxs, post #20972327]
- In BK7231 GUI Flash Tool choose correct RBL file, tick “Erase all”, then “Restore RF partition” to keep calibration [Elektroda, p.kaczmarek2, post #20463304]
- After reboot, connect to the AP, set Wi-Fi and MQTT.
Which pin roles must be set for a deep-sleep door sensor?
• Door reed: DoorSnsrWSleep (or nPUP/PD variant) on Channel 0.
• Button: Btn (or Btn_ScriptOnly) on Channel 2.
• Battery ADC: BAT_ADC on Channel 1.
• Battery relay (if fitted): BAT_Relay on Channel 1.
• Wi-Fi LED: WifiLED or WifiLED_n. [Elektroda, p.kaczmarek2, #20457191; Mad_Maxs, #20973013]
How do I change the deep-sleep timeout?
Run DSTime (1-3600). The driver overwrites the default 60 s after reboot. Example: DSTime 15 sets sleep after 15 s inactivity [Elektroda, p.kaczmarek2, post #20671018] If nothing changes, ensure DoorSensor driver is loaded before the command or place it in autoexec.bat [Elektroda, bchris326, post #20987616]
What does PinDeepSleep with an argument do?
Since v1.17.5xx PinDeepSleep accepts an optional wake timer. PinDeepSleep 600
sleeps until door/button interrupt OR 10 min timer fires—ideal for health pings [Elektroda, p.kaczmarek2, post #21000124]
My sensor needs 20 s to report after wake-up. How can I speed it up?
- Enable Fast-Connect flag (Settings → Wi-Fi).
- Assign a static IP to skip DHCP. Latency drops from 8 s to ~4 s [Elektroda, p.kaczmarek2, post #20546299]
- Keep MQTT broker reachable; otherwise OBK retries for 300 s before sleep [Elektroda, p.kaczmarek2, post #20457191]
Can I use HTTP instead of MQTT?
Yes. Use SendGET in autoexec, e.g. SendGET http://server/ip?door=$CH0&bat=$batteryLevel
. OBK supports variable substitution for any channel or $rebootReason
[Elektroda, p.kaczmarek2, post #20951901]
Why does my MAC show 00:00:00 and Wi-Fi range is poor?
The RF-cal partition was erased during flashing. Re-flash original Tuya image or use “Restore RF partition” in the flasher; otherwise TX power drops and range halves [Elektroda, p.kaczmarek2, post #20467352]
Battery shows 120 %. How do I calibrate it?
Execute Battery_Setup <max_mV> <min_mV> <coeff>
; typical CR2032 values are 3000 2200 1.0. Adjust until $batteryLevel
reads 100 % at 3.0 V and 0 % near 2.2 V [Elektroda, p.kaczmarek2, post #20996514]
Edge case: opening and closing within 2 s isn’t reported—how to fix?
Store the first pin state at boot, then compare after Wi-Fi up. Example snippet:
setChannel 5 $CH0
waitFor WiFiState 4
if $CH5!=$CH0 then backlog SendGET ...; delay_s 2
This ensures both transitions publish even during fast toggles [Elektroda, p.kaczmarek2, post #20953662]
How can I recover if a buggy script locks the sensor in deep sleep?
Add a safety button check at script start:
if $CH2==1 then goto safe
...
PinDeepSleep
safe:
Pressing the button skips deep sleep, keeping the device online for OTA fixes [Elektroda, p.kaczmarek2, post #20953786]
What rebootReason codes are available?
0 = Normal, 3 = Pin Interrupt, 4 = Sleep Timer. Access via $rebootReason
for logging or conditional logic [Elektroda, p.kaczmarek2, post #21000290]
Will 10+ sensors overload my mesh Wi-Fi?
No. Each sensor sends ≈0.5 kB per event; even 50 sensors total <25 kB/day. Ensure ≤10 m distance or add AP; lost RF-cal increases retries [Elektroda, Mad_Maxs, post #20973013]
How to restore a wiped device quickly?
3-step How-To:
- Hold button, power cycle → enters OpenBeken recovery.
- From WebApp choose OTA → select latest release.
- Reboot, run
resetConfiguration
to load template, then startDriver DoorSensor
.