logo elektroda
logo elektroda
X
logo elektroda

OpenBK CB3S Door/Window Sensor Issues: PB-69W VER1.4, Battery Life, Rear Alarm Button

4139ggn 6729 44
Best answers

How can I stop an OpenBK-flashed PB-69W VER1.4 CB3S door/window sensor from draining 2xAA batteries in a few hours, and how can I use the rear alarm/reset button?

The batteries drain so fast because the CB3S stays powered all the time; the real fix is deep sleep with wake-on-IO, not just `PowerSave 1` [#20456565] [#20456605] For this kind of door sensor, once you configure the door pin, OpenBK’s DoorSensor driver can automatically enter `PinDeepSleep` after MQTT connects or after a timeout, so you do not need a custom `autoexec.bat` script for the basic setup [#20458219] If you want battery reporting, start the Battery driver and configure it with `startDriver Battery` plus `Battery_Setup 2000 3000` (or a divider such as `2.29`), then use Home Assistant discovery [#20458124] [#20458539] The board has no TuyaMCU; the CB3S itself handles everything, and without deep sleep it can draw about 100 mA on average [#20456565] [#20456605] The back has two buttons: the protruding one is the tamper/alarm switch when the lid is removed, and the inner one is reset/AP mode; the alarm switch could be used through scripting, but the thread does not identify its GPIO pin [#20468702] [#20460758] If the sensor seems dead after flashing or sleeping, remove the batteries for a few minutes to discharge capacitors, and if needed do a full erase/reflash; low battery can also put it into a failsafe state [#20457306] [#20457982]
Generated by the language model.
ADVERTISEMENT
  • #31 20458452
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14395
    Help: 650
    Rate: 12319
    I don't know about battery yet. Maybe we can just let the battery driver be started by "startDriver Battery" in short startup command. It's always a bit easier than fully fledged scripting. Does battery need any more configuration than just starting the driver? What are the requirements?
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #32 20458521
    dheenhasty
    Level 13  
    Posts: 111
    Help: 2
    Rate: 17
    The high level and low level voltage, and the divider apply on ADC.

    Honestly it should be something apply at template level just like the pin ......
  • #33 20458534
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14395
    Help: 650
    Rate: 12319
    Templates can set short startup command. That would be the correct way.

    Btw, regarding scripts, I've been thinking about making a database of example scripts. What kind of devices do you have, @dheenhasty ?
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #34 20458539
    dheenhasty
    Level 13  
    Posts: 111
    Help: 2
    Rate: 17
    Yes it could be enough. a startDriver Battery; Battery_setup 2000 3000 2.29

    I was thinking about something similaire a script database with sensor/usecase
    I only have generic temp/hum sensor.
  • ADVERTISEMENT
  • #35 20458713
    4139ggn
    Level 5  
    Posts: 36
    Rate: 1
    Well, for now it's still working...
    Now I go out for a few days to work. So when I get back I'll start over.
    I have to see why it gives me negative values in consumption and battery leakage. And see what other advances there are.
    I think I found one of the back buttons. But I don't know how to give it the "reset" option, for example. And the alarm button that gives an emergency warning or something like that.
    Thanks, people!
  • ADVERTISEMENT
  • #36 20458898
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14395
    Help: 650
    Rate: 12319
    What would you like that special button to do?
    Helpful post? Buy me a coffee.
  • #37 20460745
    4139ggn
    Level 5  
    Posts: 36
    Rate: 1
    I would like to try to leave it as it is from the factory.
    Honestly, I can't think of any other utility for that button. Could we trigger a warning like "disassembled sensor" or something like that?
  • #38 20460758
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14395
    Help: 650
    Rate: 12319
    It should be possible via scripting.
    But for factory, the button was enabling AP mode for setup, right?
    Helpful post? Buy me a coffee.
  • #39 20468702
    4139ggn
    Level 5  
    Posts: 36
    Rate: 1
    No.
    On the back it has two buttons:
    One that protrudes from the lid and acts as an alarm button if it is removed.
    Inside the cover, it has another button that is the one that resets and puts it in AP mode.
    Would there be a way to see the battery level without MCU?

    I'm still away from home, so I can't test....
  • #40 20472444
    4139ggn
    Level 5  
    Posts: 36
    Rate: 1
    Hello good! Ready to start testing again!
    Today, I turned on the door sensor again. Initially, Home Assistant has found it in one go and shows the status.
    That was several hours ago.
    Right now, it appears as closed. And when I open the door, I see that the LED lights up. But it doesn't send any message...
    Also, since it's "asleep", I can't access its IP...
    Would you please guide me?
    Thank you!
  • #41 20473211
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14395
    Help: 650
    Rate: 12319
    You can recover device by removing batteries and waiting several minutes until capacitors are discharged.

    How did you configure the pins? Are you 100% sure that the pin you configured as door sensor is really such a sensor? Because if you configured wrong pin, then it wouldn't be able to wake up..
    Helpful post? Buy me a coffee.
  • #42 20474038
    4139ggn
    Level 5  
    Posts: 36
    Rate: 1
    OpenBK CB3S Door/Window Sensor Issues: PB-69W VER1.4, Battery Life, Rear Alarm Button

    Since yesterday, he doesn't know when I open or close the door.
    However, the LED does light up when it is open.
    Regarding the pin configuration, I am 99% sure that it is correct. In tests, it was the only one that worked...
  • #43 20474207
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14395
    Help: 650
    Rate: 12319
    Are you sure that you are using latest OBK version?

    Do you have any custom scripts with "PinDeepSleep" or "DeepSleep" commands used?
    Helpful post? Buy me a coffee.
  • #44 20477075
    4139ggn
    Level 5  
    Posts: 36
    Rate: 1
    Hello!
    Yesterday I updated to the latest version.
    I set up again and it seemed to work fine. But it stayed in the open state and does not change.
    The first thing I would like to set up would be the battery monitor theme. Since right now, I don't know if it's a battery problem or a configuration problem.
    It gives me two values:
    Voltage: (0.000v)
    Battery: (-200%)

    How could I adjust this to obtain more or less real values and know if it is a battery or configuration problem?
    Then I'll start again with the configuration from 0.

    Thanks for your help!
  • #45 21722834
    meillagimeil
    Level 5  
    Posts: 3
    Hello people

    I have this device ZY-D02-CB3S-V1.3, BK7231N, firmware 1.18.190.... and it's driving me nuts...
    PCB with CB3S Bluetooth module and USB-C connector

    If I read the logs, I can see the BK7231N getting the right values from TuyaMCU, but publishing them to the mqtt broker is a lottery.

    My startup command: backlog startDriver tuyaMCU; startDriver tmSensor; linkTuyaMCUOutputToChannel 1 val 1; setChannelType 1 ReadOnly; setChannelLabel 1 WindowState; setChannelType 3 ReadOnlyLowMidHigh; setChannelLabel 3 BatteryLevel; linkTuyaMCUOutputToChannel 3 val 3;

    Filesystem had no files. I've created one autoexec.bat, but left it blank.

    Flags. I've tried different combinations of 2, 10, 19..and others..no success.

    What it does? Usually at first boot or after reset, it sends all self state information to the mqtt broker and 0 for channels 1 and 3. After the first boot, doesn't publish self state or channel values. Also the values on the home page remains the same. Tried to set 99 as default to channel 1 and it stays like this.

    Initially I thought it doesn't have enough time to publish all the info, but it looks that it reads the real values only when processing tuya information. The values read from tuya doesn't get passed further.

    Hints from Gemini: SetOtaPeriod 0, TapoTime 0 or PublishPeriod 0 to avoid publishing status info. TuyaSendAllDPC to force TuyaMCU to publish the info once it's booting. PublishChannelState 1 that forces publishing the values even if they are different or not. None of them works because the firmware is not compiled with this instructions.

    Is there any way to make this device work? I can see that there is a mix of hardware and software for reaching the goal. I prefer the software one. If BK7231N reads data from TuyaMCU, then it should publish that data to the broker. What am I setting wrong?
    Attachments:
    • log.txt (14.85 KB) You must be logged in to download this attachment.

Topic summary

✨ The discussion revolves around issues faced with OpenBK flashed CB3S door/window sensors, specifically the PB-69W VER 1.4 model. Users report problems with battery life, with batteries lasting only 5-6 hours, and difficulties in re-establishing Wi-Fi connections after the sensors enter deep sleep mode. Solutions proposed include enabling PowerSave features and implementing a DeepSleep mode with wakeup on IO events. Users also discuss the configuration of pins for the door sensor and the functionality of a rear alarm button. There are mentions of firmware updates and the need for proper pin configuration to ensure the sensors operate correctly. The conversation highlights troubleshooting steps, including reflashing firmware and using tools like RealTerm for debugging.
Generated by the language model.

FAQ

TL;DR: Deep-sleep firmware cuts idle draw from 100 mA to ≈120 µA (-99.9 %) [Elektroda, p.kaczmarek2, post #20456605] “PowerSave alone won’t suffice” [Elektroda, p.kaczmarek2, post #20455596] Update to ≥v1.15.493, erase flash, set DoorSensor pin, then Battery driver. Why it matters: Correct setup turns a 5-hour gadget into a year-long sensor.

Quick Facts

• PCB: PB-69W VER 1.4, CB3S (BK7231N) SoC [Elektroda, 4139ggn, post #20453815] • Stock current draw: ~100 mA active; deep-sleep: ~120 µA [Elektroda, p.kaczmarek2, post #20456605] • Power: 2 × AA (typ. 2000 mAh) → ≈1 year in deep-sleep mode (calc.) • Latest tested OpenBeken: 1.15.493+ [Elektroda, 4139ggn, post #20458005] • Key pins: P7 Door, P9 Wi-Fi LED, P? Tamper (find via Assign).

How do I stop the CB3S sensor from draining batteries in 5 hours?

  1. Flash OpenBeken ≥1.15.493. 2. In flasher, click “Erase all”, then “RF Restore”, then write firmware [Elektroda, 4139ggn, post #20458093] 3. In Web UI: Assign DoorSensor to P7, LED_n to P9, save. 4. Enable deep-sleep automatically (built into DoorSensor driver) and leave PowerSave at 1. Current falls from ~100 mA to ≈120 µA, extending life to months [Elektroda, p.kaczmarek2, post #20456605]

What command enables basic power saving?

Enter PowerSave 1 in Short Startup or autoexec.bat. It switches Wi-Fi to dynamic powersave but does not cut current below 100 mA [Elektroda, p.kaczmarek2, post #20455596]

Do I still need a script for PinDeepSleep?

No. When a pin is set to DoorSensor, the DoorSensor driver auto-runs PinDeepSleep after MQTT connects (60 s) or after 300 s offline, waking on edge change [Elektroda, p.kaczmarek2, post #20458219]

Home Assistant shows the entity as unavailable—why?

Availability topics must be omitted because the node sleeps most of the time. Delete the old entity and use automatic MQTT discovery so HA treats it as a sleeping sensor [Elektroda, p.kaczmarek2, post #20456992]

How can I read battery voltage without an external MCU?

Start the built-in Battery driver: add “startDriver Battery; Battery_Setup 2000 3000” to Short Startup. It reports raw voltage and percentage via MQTT [Elektroda, dheenhasty, post #20458124]

I get 0 V and –200 % battery—fix?

Set correct divider and thresholds in Battery_Setup. Example for 2 × AA: Battery_Setup 2000 3000 2.29 (third value = resistor ratio). Wrong values return negatives [Elektroda, dheenhasty, post #20458539]

How do I recover from a boot loop or corrupt firmware?

Pull batteries, wait 3 min to discharge capacitors, then flash via UART: Full erase → RF restore → write new firmware. Device should create its AP again [Elektroda, 4139ggn, post #20457982]

Which pin is the rear tamper switch?

Use Assign → Button on each unused GPIO, save, press the rear switch, and watch console; the pin that logs a change is your tamper pin [Elektroda, dheenhasty, post #20458124]

Can the tamper button publish a disassembly alert?

Yes. Assign that GPIO as Button, then add a rule or script: onPress → publish MQTT topic “sensor/door/tamper=ON”. Expert quote: “It should be possible via scripting.” [Elektroda, p.kaczmarek2, post #20460758]

Edge case: What if the sensor never creates an AP after flashing?

If five power cycles don’t trigger failsafe, battery voltage may be below 2.2 V; replace cells. If still absent, UART log showing random characters indicates corrupted flash—redo full erase + firmware write [Elektroda, dheenhasty, #20456987; #20457782].

3-step How-To: Pair with Home Assistant quickly

  1. Flash and configure pins; ensure Wi-Fi connects. 2. In Console type scheduleHADiscovery; sensor appears in HA within 10 s [Elektroda, dheenhasty, post #20458124] 3. Remove old entities with availability topics to avoid offline errors.
Generated by the language model.
ADVERTISEMENT