logo elektroda
logo elektroda
X
logo elektroda

[BK7231N/CBU] Door sensor without TuyaMCU - easy flashing and configuration guide

auntlydia 18984 57
ADVERTISEMENT
  • Helpful post
    #1 20683982
    auntlydia
    Level 10  
    Posts: 70
    Help: 2
    Rate: 14
    Hi, first of all thank you for this amazing community and firmware, finally I got rid of Tuya apps thanks to OpenBK!
    I wanted to share my user experience on this device, since I successfully flashed and set up two of these recently, and they both worked exactly the same way. I believe it is the same device, no name Door Sensor (sold on AliExpress as AUBESS Door Sensor), also the one from this post: https://www.elektroda.com/rtvforum/topic3964392.html
    A white cardboard box labeled Door/Window Sensor with a schematic outline of a door/window sensor set on a blue surface. Box of a door sensor with visible specifications and features printed on a light background. Opened white door sensor case with visible battery springs inside. Two white components of an AUBESS door sensor on a blue background. Door sensor PCB with electronic components and visible header pins for wire connection. Close-up of a PCB with exposed pins, a central microchip, and markings such as CBU and MK1, used in a door sensor. Close-up of a PCB with a BK7231N chip and visible pin labels.

    If you have trouble setting it up, maybe it helps to follow these steps.

    1. prepare the Hardware and solder 5 wires to the pins, as in my picture:

    Close-up of a PCB board with pin labels. Close-up of a door sensor circuit board with soldered wires.

    2. connect 4 wires (3.3V, GND, TX-->RX, RX-->TX) to UART-USB-Module and make sure to use 3.3V power setting on your module. be careful with double checking the wires correctly connected and make sure you don't get any shorts, don't put any batteries in the device and don't plug in the USB yet

    3. open Windows bk7231flasher software, select chip type BK7231N and then click "download latest from web"
    Screenshot of BK7231 Easy UART Flasher application with highlighted options.
    4. this step is optional but I recommend it, since it makes everything easier. if you choose not to use this step, you will have to make all those settings via the web interface, which has the same result.
    click "change OBK settings for flash write", then fill in everything according to the screenshot. Important is to choose a different channel for the battery pins, or else the device will not work correctly. you can also predefine the flags, I chose flags 10, 11, 35 and 37, but maybe there are other settings that are useful too. Also, I chose to set a startup command [backlog dstime 30] to let the device sleep after 30 seconds from last sensor activity.
    Screenshot of OpenBK software configuration window.

    5. Now close the configuration window and connect the usb with everything attached as described above. it should pop up right away in UART port selection. double check all settings if you like. if you are happy with your settings, start the process with "Do backup and flash new", confirm the backup file name and look at the log field, it is now waiting for the device to power on.

    6. Now carefully take the wire that is connecet to CEN pin and quickly short it to the ground wire, only very short. The device should reset and the read/write process should start without any error messages. Then disconnect the device

    7. If everything went well, the device should connect to your wifi automatically after powering it on (you can either connect 3.3V from your USB or insert batteries). you might wanna push the device button every 30 seconds (or move a magnet next to it) to keep the connection alive, since it will sleep after 60 seconds or 30 seconds in my case. Now check the device IP address in your router and open the web interface through the address. double check the module, name, flag, mqtt, startup command configuration and lastly, start Home Assistant discovery, done!
    Information interface with BK7231N device and sensors data.

    I hope this might be useful to someone. Have fun!
  • ADVERTISEMENT
  • #2 20684016
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14580
    Help: 654
    Rate: 12604
    Very nice and detailed guide. I have split it into separate topic, as it really deserves to be seen.

    I am happy to see people making good use of "configure at flash time" feature that I've recently added to our flasher:
    https://github.com/openshwprojects/BK7231GUIFlashTool
    Good job!

    Btw, here's the previous door sensor topic:
    https://www.elektroda.com/rtvforum/topic3982902.html

    Regarding the guide itself - I will just give here some hints:
    - make sure to configure both sensor pin and button pin. Button pin can be used to emergency-wakeup device without moving door
    - if device does not wake up from one of the states (for example closing doors wakes it up, but opening doesn't), try entering DSEdge setting in short startup command or autoexec.bat, there are 3 possible options for that, see our docs
    A table excerpt from documentation describing the DSEdge parameter for DeepSleep mode.

    Our docs:
    https://github.com/openshwprojects/OpenBK7231T_App/blob/main/docs/commands.md
    Helpful post? Buy me a coffee.
  • #3 20684082
    auntlydia
    Level 10  
    Posts: 70
    Help: 2
    Rate: 14
    Thanks for bringing this forward - I must say I enjoyed a lot playing around with your software and it actually works great! I flashed temperature/humidity sensors and hidden switch relays as well - it all works flawlessly once the configuration is done properly.
    The option to preconfigure in the Windows flashing tool is very useful - especially for low power profile devices, as they seem troublesome to set up when we always have to find a workaround to reach the web interface during the short power-on intervals.

    Now I still have two questions:
    1. Is it possible for you to add the inverted DoorSnsrWSleep role to the list? In HA, there is always a way to invert buttons or actions, but the Door option is always the wrong way, so the status shows "Open" (which means On for the sensor) when the magnet is near the module, and "Closed" when the magnet is away. An inverted option in the module would solve this problem. I have tried the nPup and pd options but there is no difference. I realize in the other post this was already mentioned, however, I couldn't find the related setting in the current 7231N firmware.

    2. With all the low-powered modules, I am running into some problems. After some troubleshooting, I am certain that it has to do with the MQTT connection. Whenever the sensors quickly disconnect (sleep) after having sent updated data to the server, some other devices (some connected to MQTT, some not but also managed by HA integrations) in my home network lose the connection shortly and reconnect. With a number of sensors installed, this can get very annoying, since some other devices rely on a stable connection. The router itself should not be the problem. I want to further look into other forums about this problem, too, but maybe you have some idea about this, is this a typical issue?

    Thanks again, your work with this is very much appreciated!
  • ADVERTISEMENT
  • #4 20684103
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14580
    Help: 654
    Rate: 12604
    There are multiple DoorSnsrWSleep types already and adding invert would require us to duplicate them all.

    What about a different approach: I can add a flag for you, flag saying "invert door sensor read state", which will work for all the door sensor types?

    It would be easier to maintain and document.

    Hmmm, that second issue seems very strange. I haven't seen anything like that before. The first thing I would suggest is to check if the problem persists without MQTT. Maybe... maybe your router doesn't like extra client connecting suddenly and then leaving?
    Helpful post? Buy me a coffee.
  • #5 20684119
    auntlydia
    Level 10  
    Posts: 70
    Help: 2
    Rate: 14

    Hi, thanks! Adding such a flag would be a great idea! I will test it once it's possible and give you feedback if it works.

    As for the other issue, it could be quite complex. I found a thread that describes a similar problem: https://community.home-assistant.io/t/constant-mqtt-devices-disconnections-socket-error/83477

    and it mainly concerns Tasmota devices and a Tapo camera. Both of these devices disconnect and reconnect to HA once one of the door or temperature/humidity sensors close their connection. The router seems not to be the problem because the devices don't lose their WiFi connection but the connection/availability to Home Assistant. It has to be something with MQTT or another Home Assistant integration. I will dig into that further because I need to fix this problem or else my smart home doesn't work properly. But it is another topic. Maybe keep this topic here to the door sensor setup, and I can open another topic once I have more information on it.
  • ADVERTISEMENT
  • #7 20691114
    auntlydia
    Level 10  
    Posts: 70
    Help: 2
    Rate: 14

    Thanks! As of the newly updated version 1.17.212, it is possible to invert sensor status with flag 42. It works, and the HA workaround is no longer necessary. Very nice!

    As for my other problem I mentioned before, it turned out to be a router problem, so there was nothing wrong with the sensors, firmware, MQTT, or Home Assistant. All good. Thanks again!
  • #8 20691486
    simovicsava
    Level 8  
    Posts: 11
    Help: 2
    Rate: 4

    Thanks! With flag 42, it works great and the HA workaround is no longer necessary!
  • #9 20715097
    woszu
    Level 15  
    Posts: 287
    Help: 2
    Rate: 33
    Hello
    I have a similar sensor, but a little differently organized hardware-wise (different BK pins). I've already arrived at what and how and it works nicely, but.....
    I wanted to use the sensor to report the opening of a letterbox. Unfortunately, the mailman opens the box for too short a time for the sensor to report anything. After a deep sleep, it needs some time to connect. Is there any way to set a flag that there was a change in input state after waking up and before connecting?
  • ADVERTISEMENT
  • #10 20715121
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14580
    Help: 654
    Rate: 12604
    From what I remember, the latest version of the DoorSensor driver (the one that's on Github) keeps an eye on the situation where "the door was opened and closed before the sensor connected to WiFi" and even then it should report the status correctly. We tested this with colleague @nihildiximus .
    Screenshot of text regarding the DoorSensor driver.
    Do you use the DoorSensor driver, or did you configure the whole thing manually, with a script?
    Helpful post? Buy me a coffee.
  • #11 20715240
    woszu
    Level 15  
    Posts: 287
    Help: 2
    Rate: 33
    I am using DoorSensor. The problem is that moving the magnet away (changing the input to OFF) wakes up the BK, but after a while reapplying the magnet changes back to ON before the device connects to the HA, and when it does, it reports the ON state (which is the current state), and I want to report this temporary OFF
  • #12 20718232
    auntlydia
    Level 10  
    Posts: 70
    Help: 2
    Rate: 14

    Hi, based on the previous answer, this problem should be solved with the reporting of temporary states between WiFi connections..!? Have you updated to the latest OpenBK?

    Also, I thought about a similar idea: to have a notification once a post has been inserted into my mailbox. Since my mailbox is not to be opened by anyone else than myself, the post is just inserted into it through a slot. How about installing a wireless motion sensor into the mailbox? It would report motion triggered by an inserted letter or packages.

    Another idea: do you have the option to supply permanent wired power to the sensor? Then you would not need to set the sensor to Sleep-state, but could use a normal input with instant recognition and permanent WiFi connection.
  • #13 20718299
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14580
    Help: 654
    Rate: 12604
    I am confused because I am sure that we've fixed that issue with @nihildiximus and that the door sensor indeed reports the state from before it connected to MQTT.

    See:
    C code snippet about publishing initial door sensor states using MQTT.
    After getting WiFi and MQTT, for the first 3 loops (first 3 seconds), it force-publishes the initial states of pins which is queried in new_pins.c ...
    C code snippet setting GPIO pin roles Code snippet in C programming language with highlighted variable bSampleInitialState.
    Maybe I need to check it myself, find some sensor...


    @woszu - what about just reporting a custom value on every reboot? Doing a publish command or a SendGET in autoexec.bat?
    Helpful post? Buy me a coffee.
  • #14 20721162
    woszu
    Level 15  
    Posts: 287
    Help: 2
    Rate: 33

    And yet it works.
    I fired up MQTT Explorer and it does indeed report a 1 for 3s and then goes back to zero.
    Sorry for the confusion, I checked on the BK settings page and didn't see it there :) .
  • #15 20721184
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14580
    Help: 654
    Rate: 12604
    Thanks for the info, as I was already wondering how it could have broken down since the last tests. And in that case it's good to hear that it continues to work.

    If you have problems you can always manually do from autoexec.bat MQTT publish or HTTP GET.

    If you have any other questions or need some functionality, go ahead and write.
    Helpful post? Buy me a coffee.
  • #16 20835517
    emrecetinkaya86
    Level 4  
    Posts: 8
    Rate: 1

    Hi all,

    First of all, thank you all for sharing information here. It is very much appreciated!

    I have the same device and successfully burned the firmware on it. I applied the template and tried all the pin configurations described here, but no matter what I do, I get the following result:
    - On the index page, the sensor value doesn't change no matter what I do (changing magnet positions).
    - In HA, the sensor sends a "turned on/turned off" message every 10 seconds while it's powered on, by itself, without any change with the magnet.

    It seems like the pin number 16 may be wrong, or what am I missing?

    Thanks
  • #17 20835677
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14580
    Help: 654
    Rate: 12604
    Maybe they changed something., Try to extract the template (but disable door sensor driver for that time):
    https://www.youtube.com/watch?v=WunlqIMAdgw
    Helpful post? Buy me a coffee.
  • #18 20836473
    emrecetinkaya86
    Level 4  
    Posts: 8
    Rate: 1

    Hi,

    Thanks for the answer. I've just tried but from binary, it says no meaningful data:

    Screenshot showing meaningless JSON data on the left and an error message on the right.

    And when I paste JSON in web app:

    Screenshot of a web application with a JSON converter in OpenBeken.

    I'm stuck... This is my first time with OpenBeken and I don't want to give up...
  • #19 20837792
    emrecetinkaya86
    Level 4  
    Posts: 8
    Rate: 1

    >>20835677

    Hi @p.kaczmarek2 and all,

    Yes they changed something, which is the pin number of hall effect sensor. At first I'm happy that I'll contribute to the community with this experience for the first time, with my pleasure! What to do to add this change what I explained below to the templates?

    After looking twice, I've recognized that the module on the device is CBU-NL instead of CBU. This is how the module looks like:

    Close-up of the CBU-NL electronic module with visible connectors and components on the circuit board.

    Also, the board is different than the one in this topic and others in the forum. I've traced the hall effect sensor pin from it to module pin and it corresponds to pin 22, instead of 16! And it's pulled down.

    Image of a printed circuit board (PCB) held in hand with marked components. Photo of a circuit board with a marked pin.

    Then I've changed my pin configuration (other pins are still the same, only the hall effect sensor pin number has been changed):

    Screenshot of pin configuration for a module with channel type settings.

    I've also changed the channel type of channel 0 which hall sensor pin included to "openclosed", so I can see on the index page the status more clearly.

    The only thing remaining now is, when the module is awake after pin change, it sends sensor turned on/off messages every 10 seconds and without any change. And the sensor value came automatically doesn't show the correct value, I've copied sensor yaml lines from OpenBeken web to configuration yaml in HA and it shows the correct value.

    Screenshot of a user interface displaying sensor information and an event log.

    And my last question is, when the module wakes up, it stays awake for at least a minute and then sleeps. Is there any way to set it up like "do your job and sleep"? Sorry again if I ask something which was explained before, as I'm a newbie.

    Enjoy
  • #20 20837805
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14580
    Help: 654
    Rate: 12604
    Thanks for the info. Can you include template from the Web App so I can add it to devices list?

    I think you can set a DSTime variable to adjust the time how long it's up.

    Regarding on and off messages, is the status read in the OBK panel correct?

    PS: I think you can change channel name from that "1" string to any other with setChannelLabel command
    Helpful post? Buy me a coffee.
  • #21 20837864
    emrecetinkaya86
    Level 4  
    Posts: 8
    Rate: 1
    Hi @p.kaczmarek2,

    Here is the template:

    Code: JSON
    Log in, to see the code


    And this is the link to the product: https://www.aliexpress.com/item/1005005216868...der_detail.order_detail_item.3.63b443cepjkRkP

    Thanks, I've changed the DSTime value to 15 seconds, as it's more than enough to send MQTT data.

    Quote:
    Regarding on and off messages, is the status read in the OBK panel correct?


    I really don't have an idea about the answer... After I made MQTT configuration on the OBK web, I triggered discovery and those values showed up. And the value of "1" sensor doesn't change, as I said I manually added the sensor (which works very well) with this configuration to the YAML file of HA:

    mqtt:
      binary_sensor:
        - unique_id: "doorsensormain_binary_sensor_0"
          name: "Maindoor"
          state_topic: "doorsensor/0/get"
          qos: 1
          payload_on: 1
          payload_off: 0
          availability:
            - topic: "doorsensor/connected"


    Quote:
    PS: I think you can change the channel name from that "1" string to any other with the setChannelLabel command


    It's very useful information, thanks! I'll change it as soon as I make it work when the sensor value changes.

    Thanks!
  • #22 20881128
    Xinayder
    Level 8  
    Posts: 24
    Rate: 4
    I have a very similar sensor I bought from AliExpress, branded as AUBESS: https://www.aliexpress.com/item/1005004699337230.html

    I used the Windows flasher tool and it worked perfectly, it even loaded the configuration retrieved from the original firmware.

    I also checked the door sensor guide on the forums and had to do a quick tweak on my sensor. By default, the battery relay/adc were set to the same channel as the door sensor, so whenever the HAL sensor was triggered, it would go to the opposite state because of the relay. To fix this, I set the battery ADC and relay to a different channel.

    The HAL sensor pin was set to DoorSnsrWSleep (no pull down or pull up), as instructed in the guide: https://www.elektroda.com/rtvforum/topic3960149.html

    I also enabled the quick wifi connect flag to prevent waiting a long time to broadcast the values. This is my template:

    {
      "vendor": "Tuya",
      "bDetailed": "0",
      "name": "AUBESS Smart Wifi Door/Window Sensor (no TuyaMCU)",
      "model": "enter short model name here",
      "chip": "BK7231N",
      "board": "TODO",
      "flags": "1152",
      "keywords": [
        "TODO",
        "TODO",
        "TODO"
      ],
      "pins": {
        "16": "DoorSnsrWSleep;0",
        "17": "BAT_Relay;2",
        "20": "Btn;1",
        "23": "BAT_ADC;2",
        "26": "WifiLED_n;0"
      },
      "command": "",
      "image": "https://obrazki.elektroda.pl/YOUR_IMAGE.jpg",
      "wiki": "https://www.elektroda.com/rtvforum/topic_YOUR_TOPIC.html"
    }
    


    EDIT: I've also attached the original firmware extracted from the sensor.
    Attachments:
    • readResult_BK7231N_QIO_doorsensor_tuya_2023-28-12-18-12-52.bin (2 MB) You must be logged in to download this attachment.
  • Helpful post
    #23 20896836
    spln
    Level 5  
    Posts: 7
    Help: 1
    Rate: 10

    >>20837792

    I also got a similar sensor, the PCB looks the same, but with different pin configuration so created a separate topic for it:
    [BK7231N CBU-NL] ONENUO Tuya Wifi Door Sensor - 19JWT

    The HAL sensor has neither pull-up nor pull-down, battery is read through a switchable voltage divider like above.
  • #24 20942554
    pincopallino1010
    Level 5  
    Posts: 22

    >>20683982
    Hi, @auntlydia @pkaczmarek262! I have 9 of these devices and am preparing to modify them. Once you follow this guide do you need to set/do anything else from the web interface? Is there anything to tweak/install to better manage the battery consumption of the devices?
    Also, how can I do to send a request to a webserver as soon as a port opening is detected? :)
  • #25 20947444
    pincopallino1010
    Level 5  
    Posts: 22

    Nvm I was able to flash them without any problems! Thanks a lot for the guide :)
    Just a couple of questions @auntlydia @pkaczmarek262 (sorry for the tag), is there anything to tweak/install to better manage the battery consumption of the devices? Is it possible to totally disable MQTT since I do not use it?
    Also, how can I do to send a request to a webserver as soon as a door open/close is detected? :)
    Thank you in advance!
  • #26 20968460
    pincopallino1010
    Level 5  
    Posts: 22

    >>20683982

    Hi @auntlydia @p.kaczmarek2 (Sorry for the tag again). I flashed the firmware on one of these devices by following this guide (without entering any configuration via the tool) and unfortunately I can't figure out why the device seems to be "not working."
    It boots but whatever configuration I enter (pin, flag, wifi...) this is not maintained and also the web application page does not load.
    Screenshot of a web browser showing a blank page at the address 192.168.4.1.
    The screen I end up in when I connect to the device is as follows (photo).
    Screenshot of the OpenBK7231N device web interface showing configuration options.
    Even if I enter the configurations through the tool nothing seems to change, plus the led doesn't seem to light up anymore...
    Can anyone help me? Thanks!
  • #27 20968463
    divadiow
    Level 38  
    Posts: 5027
    Help: 438
    Rate: 891
    I'd start by flashing an up-to-date version of OBK. The one in the screenshot is from August.
  • #28 20968641
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14580
    Help: 654
    Rate: 12604
    Wait, do I understand correctly, you haven't configured it? I can see no drivers running, nothing is set... you need to configure it first, I guess.
    Helpful post? Buy me a coffee.
  • #29 20969015
    pincopallino1010
    Level 5  
    Posts: 22

    @divadiow I had already tried to install the latest version but it gave me the same problems, so I tried to install the one that is used in the guide

    @p.kaczmarek2 Initially I followed the procedure from top to bottom (entering the configurations via the tool) but I was having the same problems, so I thought of entering them "by hand" after flashing the firmware but nothing... for example if I set the wifi network to connect to it doesn't work when rebooting and it keeps creating its wifi to connect. Same with the pins, every time I reboot the device all the fields reset.

    What does it mean: "0 drivers active, total 35"
    And: "boot incompletes 1 (might change to 0 If you wait to 30 sec)!"

    Maybe they are the problem but I really don't understand what is going wrong....
  • #30 20983574
    insmod
    Level 31  
    Posts: 1388
    Help: 164
    Rate: 432

    Circuit board with visible electronic components.
    Hardware mod, U2 is CHT8305. Now waiting for simultaneous pin and timer deep sleep support
    P7->CHT8305_SCK
    P8->CHT8305_SDA

Topic summary

✨ The discussion centers on flashing and configuring BK7231N-based door sensors without TuyaMCU, specifically devices sold as AUBESS Door Sensor and similar models with CBU or CBU-NL boards. Users share detailed guides on flashing using OpenBK firmware and the BK7231GUIFlashTool, including pin configurations for hall effect sensors, battery ADC, button inputs, and WiFi LED control. Key issues addressed include inverting door sensor logic states (solved by adding flag 42 in firmware version 1.17.212), handling short door open events (e.g., letterbox openings) with deep sleep and MQTT reporting, and managing battery consumption via PowerSave commands. Some users report hardware variations requiring different pin assignments, such as hall sensor pins on GPIO22 instead of GPIO16. Problems with device booting after flashing, flash write errors, and recovery methods including full 2MB flash backups are discussed. The door sensor driver relies on MQTT for state reporting and sleep management; disabling MQTT is possible but not recommended due to battery drain. Alternatives using HTTP requests via autoexec.bat scripts are considered. Hardware modifications like enabling step-up converters and integrating additional sensors (e.g., CHT8305 temperature/humidity) are also mentioned. The community provides templates for device configuration and troubleshooting advice for flashing and firmware stability.
Generated by the language model.

FAQ

TL;DR: In 7 steps, this guide shows how to flash BK7231N AUBESS/no-name door sensors at 3.3V and preconfigure pins before first boot. As one maintainer put it, "Good job!" It is for OpenBeken users who want reliable sleep, correct door state, and easier Home Assistant setup on low-power sensors. [#20684016]

Why it matters: Preconfiguring these battery door sensors during flashing avoids short wake-window setup problems and fixes common errors such as wrong hall-sensor pins, inverted states, and bad channel mapping.

Option Best use Main advantage Main drawback
Preconfigure in BK7231GUIFlashTool First flash of sleeping sensors Works before the short wake window closes Requires correct pin map upfront
Configure later in web app Bench testing on stable power Same end result Harder on devices sleeping after 30–60 s
DoorSensor driver MQTT/Home Assistant workflows Handles wake, report, then sleep Waits for MQTT by design
Script with PinDeepSleep + SendGET HTTP-only alerts No MQTT dependency Needs manual logic and testing

Key insight: The most important fix is to map the hall sensor correctly and keep BAT_Relay/BAT_ADC on a different channel. On several variants, using the wrong hall pin or sharing the hall channel with battery measurement causes false or missing door events. [#20881128]

Quick Facts

  • Flashing requires a 3.3 V USB-UART connection with 4 active wires for serial data and power, plus a 5th wire on CEN for a brief reset-to-ground during write start. [#20683982]
  • Typical awake time in the guide is 60 s by default, shortened to 30 s with backlog dstime 30; another working example uses DSTime 15 for faster return to sleep. [#20683982]
  • Open/closed inversion was added in OpenBeken 1.17.212 using flag 42, removing the need for the earlier Home Assistant workaround. [#20691114]
  • Published working hall-sensor pins vary by board: one common AUBESS/CBU layout uses P16, while a CBU-NL variant in the thread required P22 instead. [#20837792]
  • Newer firmware force-publishes initial pin states for the first 3 loops / 3 seconds after Wi‑Fi and MQTT connect, which helps catch very short door events before normal reporting resumes. [#20718299]

How do I flash an AUBESS or no-name BK7231N/CBU door sensor with OpenBeken using BK7231GUIFlashTool and preconfigure it during flashing?

Use BK7231GUIFlashTool, wire the sensor for 3.3 V UART, and write the config before first boot. 1. Solder 5 wires: 3.3V, GND, TX, RX, and CEN. Connect TX↔RX, RX↔TX, and keep batteries out. 2. In the Windows flasher, select BK7231N, download the latest firmware, then open change OBK settings for flash write and enter pins, flags, Wi‑Fi, and optional backlog dstime 30. 3. Click Do backup and flash new, then briefly short CEN to GND to reset and start flashing. After boot, check the router for the IP and verify settings in the web UI. [#20683982]

Why do the battery relay and BAT_ADC need to be assigned to a different channel than the hall sensor in these Tuya door sensors?

They must use a different channel because sharing the hall channel can flip or corrupt the reported door state. One user reported that when BAT_Relay and BAT_ADC were on the same channel as the hall sensor, every battery read made the sensor appear to change to the opposite state. Moving battery relay and ADC to another channel fixed the false toggling. This matters on battery door sensors because the voltage divider is switched and interacts with the same logical channel if you map it badly. [#20881128]

What is DoorSnsrWSleep in OpenBeken, and how is it different from configuring a normal input pin manually?

DoorSnsrWSleep is the correct role for a sleeping magnetic door sensor because it couples GPIO state with wake/sleep behavior. "DoorSnsrWSleep is a driver role that monitors a door sensor pin, wakes the BK7231N on state changes, reports status, and then returns the device to low-power sleep." A normal input pin only reads a level; it does not manage low-power wake timing, MQTT reporting flow, or door-specific logic. The thread also notes you should configure both the sensor pin and the button pin, so the button can wake the device without moving the door. [#20684016]

What is DSTime in OpenBeken, and how does it affect how long a low-power door sensor stays awake before sleeping?

DSTime sets how long the device stays awake after activity before deep sleep. "DSTime is a low-power timing command that defines the awake window after a wake event, letting a battery sensor finish Wi‑Fi tasks before it sleeps again." In the guide, default behavior was about 60 seconds, but backlog dstime 30 reduced that to 30 seconds. Another tested template used DSTime 15, which was enough to send MQTT data and then sleep sooner. Shorter values save battery, but they also shorten your configuration window. [#20837864]

How can I invert the open/closed state of a BK7231N door sensor in Home Assistant using OpenBeken flag 42?

Set OpenBeken flag 42 to invert the sensor state at the device level. That fix was confirmed after the update to version 1.17.212, and it removed the need for the previous Home Assistant-side workaround. This is cleaner than inverting logic only in HA because the firmware then publishes the correct open/closed meaning everywhere, including MQTT and the web panel. If your sensor shows “Open” when the magnet is near, flag 42 is the intended fix. [#20691114]

What should I try if my BK7231N door sensor wakes on one state change but not the other, and how does DSEdge help?

Try changing DSEdge in the short startup command or autoexec.bat. The maintainer stated there are 3 possible DSEdge options, and this setting helps when one transition wakes the device but the opposite transition does not, such as close waking it while open does nothing. "DSEdge is an edge-selection setting that tells the door-sensor driver which transition should trigger wake logic, with multiple modes for different hall sensor circuits." This is the first fix to test before remapping pins. [#20684016]

Why would a flashed door sensor keep sending on/off MQTT messages every 10 seconds even when the magnet position does not change?

This usually means the hall pin mapping or pull configuration is wrong, not that the magnet is changing. A reported case showed repeated on/off messages every 10 seconds while the index page never changed with magnet movement. The working fix came from tracing the hall sensor to a different GPIO: the board used P22 pulled down instead of the published P16. Once the hall role was moved to the real pin, the sensor value became meaningful. If BAT_Relay and BAT_ADC also share the hall channel, that can create false toggles too. [#20837792]

How do I find the correct GPIO or hall sensor pin on a Tuya door sensor when the published template uses P16 but my board actually uses P22 or another pin?

Trace the hall sensor electrically or extract the original roles from a firmware backup. In one documented variant, the board used CBU-NL instead of CBU, and the hall trace led to pin 22, not pin 16. Another user later confirmed yet another similar board with different pin mapping. If your panel never changes with the magnet, the published template may be for a different PCB revision. The reliable path is: inspect the board revision, trace the hall sensor pad to the module pin, then assign the matching DoorSnsrWSleep role with the correct pull mode. [#20837792]

What is the best way to extract or recover the original Tuya GPIO template from a BK7231N device before or after flashing OpenBeken?

The best way before flashing is to make a full 2 MB backup with BK7231GUIFlashTool and let the tool extract roles from the original firmware. The maintainer explicitly recommended a 2MB firmware backup for GPIO extraction. If you already flashed OpenBeken, use the post-flash extraction method referenced in the thread’s video workflow instead of expecting the original JSON to still exist. A binary can also show “no meaningful data” if the vendor firmware variant does not expose a usable template, so backup first whenever possible. [#21641213]

Why does my OpenBeken door sensor show '0 drivers active' or fail to save Wi-Fi and pin settings after reboot?

That usually means the device is unconfigured or running an outdated build, not that the hardware is dead. One maintainer reply states plainly that the shown screen had no drivers running because nothing was set, while another user noted the screenshot used an August firmware build and suggested updating first. If settings still vanish after reboot, reflash a current OpenBeken image and reapply the template or flash-time configuration. The line “0 drivers active, total 35” means the firmware has 35 available drivers, but none are assigned to your pins yet. [#20968641]

How can I reduce battery usage on an OpenBeken door sensor, including PowerSave 1, backlog DSTime, and other low-power flags?

Use a shorter DSTime, enable PowerSave, and keep the low-power flags that were proven on this sensor. The guide used flags 10, 11, 35, and 37 with backlog dstime 30, and a later maintainer reply added PowerSave 1 in the short startup command or autoexec.bat. That combination cuts awake time and reduces idle radio work. If you do not use MQTT, disable it so the device does not wait on a broker unnecessarily. On these sensors, every extra second awake costs battery life because Wi‑Fi startup dominates power use. [#21080933]

OpenBeken DoorSensor driver vs a script-based approach with PinDeepSleep and SendGET — which is better if I want HTTP notifications instead of MQTT?

Use the DoorSensor driver for MQTT workflows, but prefer a script if your only goal is HTTP notifications. The maintainer explained that the DoorSensor driver waits for MQTT by design so it knows when it can sleep again. Without MQTT, it stays awake longer and wastes battery. A script-based approach with PinDeepSleep, SendGET, and optional button logic avoids that dependency, but you must write and test the wake/report/sleep flow yourself. In short: DoorSensor is easier for Home Assistant; scripts are better for lean HTTP-only setups. [#21084211]

How does OpenBeken handle a door that opens and closes before Wi-Fi or MQTT connects, such as for a mailbox flap or very short trigger event?

It handles short events by force-publishing initial states during the first few seconds after connect. The maintainer described that after Wi‑Fi and MQTT are up, the firmware force-publishes initial pin states for the first 3 loops, about 3 seconds, using cached startup readings. This was tested specifically for the case where a door opens and closes before the sensor finishes connecting. A later user confirmed the behavior in MQTT Explorer: the device reported 1 for 3 seconds and then returned to 0. That makes quick mailbox-flap events visible even on sleeping sensors. [#20721162]

What wiring changes would be needed to replace the hall effect sensor with an NC or NO relay so a BK7231N door sensor can report a freezer power-loss event?

The thread does not confirm a final relay wiring mod, so the safest answer is to mimic the hall sensor with a relay contact on the hall input and test current draw carefully. The proposal in the thread was to use an NC relay so loss of mains opens the contact and looks like magnet removal, which should report “door open” as a power-loss alarm. That logic aims to keep the sensor in its low-current closed state most of the time. No posted reply validated the exact wiring, so treat it as an unverified hardware concept rather than a finished template. [#21205190]

How can I fix a BK7231N door sensor that flashes successfully but will not boot, enters safe mode or a boot loop, or seems corrupted after low battery or bad configuration?

Start with a full erase or full-firmware restore, not just another app flash. In one recovery, flashing a complete 2 MB dump from a same-chip device restored booting, after which fresh OpenBeken could be written again. Another case linked low battery to corruption and later showed safe mode activated - boot failures 327. A further fix suggestion was to erase from 0x0 with BKFIL because one method only erased from 0x11000. If a write fails repeatedly at a sector like 0xE2000, also swap the USB-serial adapter; that solved one flashing fault immediately. [#21559686]
Generated by the language model.
ADVERTISEMENT