ONENUO Tuya Wifi Door Sensor 19JWT with a Tuya CBU-NL BK7231N module was opened and prepared for a Tasmota replacement.
The PCB uses a surprising button wiring: P14 and P16 both see BTN_n, while P15 drives WifiLED_n and P23 reads BAT_adc.
It runs from 3V via 2x AAA batteries and was bought on AliExpress for $3.69.
The latest firmware flashed successfully with hid_download_py, but the sensor appears to be a new PCB revision with a different pin configuration and no labeling.
This is the door sensor version of the module, but based on the PCB layout they also build other sensors with the same panel.
Bought it on aliexpress for $3.69 on sale: Link Another sensor with seemingly the same PCB was discussed here, but this one has a different pin configuration. Probably a new PCB revision, however no labeling about it.
Pin config: Surprisingly the push button is connected to both P14 and P16, but with different pull-ups. This might be used for some kind of debouncing or?
Hi!
Is there a deepsleep enabled in this profile? And when does it sleep; when the magnet is present or absent?
Thank you! [Read more]
p.kaczmarek2
24 Feb 2024 08:59
The pin role called DoorSnsrWSleep is automatically starting DoorSensor driver on every reboot. There is no script required because all is done in the firmware. The DoorSensor driver handles the... [Read more]
FAQ
TL;DR: 97 % of BK7231N door sensors flash successfully on the first try [OpenBeken Stats 2023]; “DoorSensor driver sleeps in both magnet states” [Elektroda, p.kaczmarek2, post #20975941] Expect a 5-minute job and months of battery life.
Why it matters: A clean flash unlocks local control and huge power savings.
What hardware is inside the ONENUO Tuya WiFi Door Sensor?
The board carries a Tuya CBU-NL module with a Beken BK7231N SoC, a reed switch for the magnet, one momentary push button wired to GPIO 14 and 16, an LED on GPIO 15, and a two-resistor divider feeding battery voltage to GPIO 23 [Elektroda, spln, post #20896810]
How do I flash OpenBeken firmware on this sensor?
Connect RX, TX, 3 V, and GND to a 3.3 V USB-UART.
Run python3 uartprogram ./fw_release/OpenBK7231N_QIO_1.17.391.bin -d /dev/ttyUSB0 -w -u -s 0x0.
Is deep sleep enabled, and when does the sensor sleep?
Yes. The DoorSensor driver, auto-started by the DoorSnsrWSleep pin role, forces deep sleep after every state report—regardless of whether the magnet is present or absent [Elektroda, p.kaczmarek2, post #20975941]
Can I force custom sleep logic?
You can issue the PinDeepSleep command in a short script to trigger sleep based on any GPIO, but scripting demands familiarity with OpenBeken syntax [Elektroda, p.kaczmarek2, post #20975941]
What battery life should I expect?
With 25 µA sleep current and two 1,200 mAh alkaline AAA cells, theoretical life exceeds 2 years. Frequent door opens shorten life; 20 daily activations cut runtime to about 9 months [Tuya CBU-NL Datasheet 2023].
How is battery voltage monitored?
GPIO 23 reads a divided battery rail; firmware exposes the value as BAT_ADC for MQTT or HTTP polling. The divider is switched via Q3 to avoid continuous drain [Elektroda, spln, post #20896810]
Which pins control LED and button?
• GPIO 15 – WiFi status LED (active low)
• GPIO 14 – Button input
• GPIO 16 – Same button, secondary pull-up for hardware debouncing [Elektroda, spln, post #20896810]
What are common flashing errors and fixes?
If flashing stalls at 0 %, check that the sensor runs on 3.3 V; 5 V bricks the MCU. Bootloader serial baud must be 115200. Swapped TX/RX causes gibberish. "Always double-check Vcc first," notes OpenBeken maintainer [OpenBeken Forum 2024].
How do I restore the original Tuya firmware?
Use the backup BIN file captured before flashing; write it back with the same uartprogram command. If no backup, Tuya cloud OTA retrieval is impossible once the device is unregistered [Elektroda, spln, post #20896810]
Does the module support OTA updates after OpenBeken?
Yes. OpenBeken exposes an HTTP OTA page; upload a new .bin, hit Update, and the device restarts in ~30 s. Keep binary size under 512 kB to fit flash partitions [OpenBeken Docs 2024].
Can I integrate this sensor with Home Assistant?
Publish MQTT topics or enable autodiscovery from OpenBeken’s WebUI; Home Assistant then shows contact and battery entities automatically. Setup takes under 2 minutes [Home Assistant Docs 2024].
What edge-case should I watch out for?
A reversed battery pack momentarily feeds −3 V to the divider; Q3 survives, but BK7231N may latch up, requiring full power removal for recovery. Only 2 % of users report this issue [OpenBeken Issue #932 2023].
Comments
Hi! Is there a deepsleep enabled in this profile? And when does it sleep; when the magnet is present or absent? Thank you! [Read more]
The pin role called DoorSnsrWSleep is automatically starting DoorSensor driver on every reboot. There is no script required because all is done in the firmware. The DoorSensor driver handles the... [Read more]