logo elektroda
logo elektroda
X
logo elektroda
Dostępna jest polska wersja

Czy wolisz polską wersję strony elektroda?

Nie, dziękuję Przekieruj mnie tam

[BK7231N] AUBESS Power Monitor Switch - Setting Up Power Measurement Channel

brazoayeye 2196 15
ADVERTISEMENT
  • #1 21209568
    brazoayeye
    Level 4  
    I bought this AUBESS "Power Monitor Switch"

    I umounted it, founding a BK7231N
    Connected 3.3V, GND, TX, RX under the small board

    Backed up using BK7231Flasher , and then flashed latest openBK

    Following the found json
    Spoiler:
    {
    "rl1_lv":"1",
    "on_off_cnt":"5",
    "onoff_rst_m":"1",
    "onoff_clear_t":"5",
    "rand_dpid":"42",
    "net_trig":"4",
    "onoff_n":"5",
    "netled1_lv":"0",
    "jv":"102",
    "onoff_rst_type":"2",
    "total_bt_pin":"23",
    "nety_led":"2",
    "over_cur":"0",
    "total_stat":"0",
    "reset_t":"5",
    "netled1_pin":"8",
    "chip_type":"3",
    "lose_vol":"0",
    "remote_add_dp":"49",
    "remote_list_dp":"50",
    "net_type":"0",
    "over_vol":"0",
    "inch_dp":"44",
    "module":"CB2S",
    "ch_cddpid1":"9",
    "onoff1":"24",
    "clean_t":"5",
    "init_conf":"38",
    "zero_select":"0",
    "onoff_type":"0",
    "series_ctrl":"2",
    "total_bt_lv":"0",
    "cyc_dpid":"43",
    "remote_select":"0",
    "ch_num":"1",
    "rl1_pin":"26",
    "ele_rx":"10",
    "netn_led":"2",
    "vol_def":"0",
    "ch_dpid1":"1",
    "ele_tx":"11",
    "crc":"48"
    }
    Device configuration, as extracted from Tuya:
    - Pair/Toggle All Button on P23  => it's the board button, P23 = ADC3 https://docs.libretiny.eu/boards/cb2s/#pinout
    - WiFi LED on P8     => that's right
    - TglChannelToggle (channel 1) on P24  => it's the S1/S2 switch
    - Relay (channel 1) on P26  => right
    Device seems to be using CB2S module, which is using BK7231N.
    And the Tuya section starts, as usual, at 2023424

    How can i find and setup the channel for the power measurement?
    Attached some photos, do you need other infos?

    Thanks

    Electronic module with BK7231N chip. Close-up of an AUBESS electronic switch board with visible components. Close-up of a printed circuit board with electronic components Back label of AUBESS power switch with technical specifications. Close-up of a circuit board with electronic components, including a CB2S module.
  • ADVERTISEMENT
  • #2 21209629
    p.kaczmarek2
    Moderator Smart Home
    BL0942 is always using UART1 for communication. You need to enter:
    
    startDriver BL0942
    in your either autoexec.bat or short startup command. Then reboot. Then you need to calibrate, like you'd do in Tasmota. VoltageSet/CurrentSet/PowerSet commands.

    For this kind of device, you also might need to enable PowerSave 1 so the device capacitors can last longer.
    Helpful post? Buy me a coffee.
  • #3 21210158
    brazoayeye
    Level 4  
    Thanks for the info, so it's used a BL0942 and it communicates with the same TX/RX used for flashing.

    Can you provide a guide or a link where I can deepen how to calibrate it?

    At the end I want to flash espHome as I did in other devices without power metering, do you know if it's possible to read the current using it?

    When you write "this kind of devices" do you mean I should check also my other espHome DIY switch to enable some kind of low power mode? Example >>21126030

    Thanks
  • #4 21583952
    brazoayeye
    Level 4  
    I flashed another identical device, and I have many questions:

    1. S1-S2 switch gives me problems. P24 is TglChnOnTgl but when left unconnected it randomly double toggles (like 1 time every 3 seconds). Switch usually off but relay turns on and off very fast because of that false signal. If I short circuit S1 S2 the relay remains stable, but if I open S1 S2 it starts ticking again. I found a stable 3.3V between S1 and S2
    2. I wrote on startup_command "powersave 1; startDriver BL0942" but idk where I can read the power consumption. I tried to calibrate the device having this message
    Last command: VoltageSet 226
    Last status: ERROR: Unknown command (undefined) 


    If I go to the console and I write "startDriver BL0942" then I start having "Last status: OK (200)!"
    PS: when I enable the driver I also can read the measure, so why it doesn't start on boot?

    Thanks
  • #5 21583963
    p.kaczmarek2
    Moderator Smart Home
    Let's do one issue at time. Where do you enter startDriver command? Startup command is run after reboot. VoltageSet command is available once driver is started. There is information about running drivers in the main page.

    I don't know much about Esphome. Last time I checked it had just powersave copied from OBK by one of our user. OBK, on the other hand, is calibrated to utilize OBK powersave - as far as I remember it was done few years ago by @ btsimonh, who adjusted timers to allow longer dynamic sleep. Just keep in mind that device won't sleep if you keep web app log open.

    By "this kind of devices" I mean like smart plugs or smart switches. Or... or just enable PowerSave 1 on any OBK device. It should be okay since we adjusted PowerSave to take BL0937 into the account.
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #6 21584375
    brazoayeye
    Level 4  
    p.kaczmarek2 wrote:
    Let's do one issue at time. Where do you enter startDriver command? Startup command is run after reboot. VoltageSet command is available once driver is started. There is information about running drivers in the main page.

    From here:
    [BK7231N] AUBESS Power Monitor Switch - Setting Up Power Measurement Channel

    p.kaczmarek2 wrote:
    I don't know much about Esphome. Last time I checked it had just powersave copied from OBK by one of our user. OBK, on the other hand, is calibrated to utilize OBK powersave - as far as I remember it was done few years ago by @ btsimonh, who adjusted timers to allow longer dynamic sleep. Just keep in mind that device won't sleep if you keep web app log open.

    For now I stopped testing modules with EspHome because I saw they haven't got the same experience with this kind of cpus and I want to minimize surprises.
    For example I don't have time to test real module consumption with different firmware to check that consumption are comparable.
  • #7 21584469
    p.kaczmarek2
    Moderator Smart Home
    If you want to run multiple commands in line, you need to use backlog - like in Tasmota.
    [BK7231N] AUBESS Power Monitor Switch - Setting Up Power Measurement Channel
    So now, you need to either:
    - add backlog at the start of line
    OR
    - put each command in separate line

    In current state, second command is not run.
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #8 21584534
    brazoayeye
    Level 4  
    Thanks! I had missed that backlog was a keyword. I suggest to write something like: write one command in each line or use the keyword backlog to group them (ex "backlog cmd1; cmd2; cmd3)

    Do you have ideas regarding the S1 S2 problem?
    S1 is connected with N-OUT
    N-OUT have a 0.001 ohm to N-IN
    cpu GND is connected to N-out or N-in (idk which)
    S2 goes to RS0 (1k) and then directly to P24 (arrows)
    [BK7231N] AUBESS Power Monitor Switch - Setting Up Power Measurement Channel

    [BK7231N] AUBESS Power Monitor Switch - Setting Up Power Measurement Channel

    Do you know if there is a capacitor between S1 and S2 that I should check?

    Thanks

    Added after 20 [minutes]:

    
    Info:MAIN:Time 61, idle 70067/s, free 61992, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 6/38 POWERSAVE
    Info:MQTT:Channel has changed! Publishing 1 to channel 2 
    Info:MQTT:Channel has changed! Publishing 0 to channel 2 
    Info:MAIN:Time 62, idle 69054/s, free 70600, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 5/38 POWERSAVE
    Info:MAIN:Time 63, idle 78461/s, free 70600, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 5/38 POWERSAVE
    Info:MAIN:Time 64, idle 73866/s, free 70600, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 5/38 POWERSAVE
    Info:MAIN:Time 65, idle 75561/s, free 70600, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 5/38 POWERSAVE
    Info:MAIN:Time 66, idle 76257/s, free 70600, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 5/38 POWERSAVE
    Info:MAIN:Time 67, idle 75214/s, free 70600, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 5/38 POWERSAVE
    Info:MQTT:Channel has changed! Publishing 1 to channel 2 
    Info:MQTT:Channel has changed! Publishing 0 to channel 2 
    Info:MAIN:Time 68, idle 73065/s, free 70600, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 5/38 POWERSAVE


    Is it possible to add millis or similar to log?

    I tried
    addChangeHandler Channel2 == 0 echo OFF
    addChangeHandler Channel2 == 1 echo ON

    but I can't understand if there is an echoable field to give me this information[/code]

    I found that with tglchnontgl I have false positive but not with dInput.
    Is there a different software debouncing?
  • #9 21590876
    brazoayeye
    Level 4  
    sorry to bother you again, is it possible that tglChnOnTgl does not have a software debounce and therefore creates problems for me that are not present if I use it as a dInput ?

    For sure I can reach a similar result setting the button on dInput on Chn2 and then using triggers to switch Chn1 (relay) but a confirmation of the debouncer theory will reassure me that it's not a hardware problem.

    Thank
  • #10 21590884
    p.kaczmarek2
    Moderator Smart Home
    Sorry for the delay, next time please just ping me earlier, okay? I might have missed that post.

    ThlChannelOnToggle works on my devices, but devices come in different versions. Tgl tries to be more responsive than dinput, but maybe our algorithm is too eager, here's other version to check:
    https://github.com/openshwprojects/OpenBK7231T_App/pull/1694
    Please download artifacts with OTA file from Github there and try it on your device, and let me know if it works?

    Added after 19 [seconds]:

    Of course, do it once the Github build is complete.
    Helpful post? Buy me a coffee.
  • #11 21590920
    brazoayeye
    Level 4  
    Sorry but idk what to load because I can't file a rbl file

    From the last post I added last rows in another message, but they were merged. Probably you haven't got a notification if you had visited the post before the modification
  • #12 21590958
    p.kaczmarek2
    Moderator Smart Home
    This is how you can find zip with RBL for BK7231N
    [BK7231N] AUBESS Power Monitor Switch - Setting Up Power Measurement Channel
    [BK7231N] AUBESS Power Monitor Switch - Setting Up Power Measurement Channel
    [BK7231N] AUBESS Power Monitor Switch - Setting Up Power Measurement Channel
    Helpful post? Buy me a coffee.
  • #13 21590997
    brazoayeye
    Level 4  
    Perfect, using OpenBK7231N_1694_merge_11ebfc7a0926.rbl the signal is stable also with tglChnOnTgl

    Will it be merged to the next release?

    Thanks
  • ADVERTISEMENT
  • #15 21591302
    brazoayeye
    Level 4  
    The reaction time is quite low (~150ms) and imho right for a toggle switch
  • #16 21591763
    p.kaczmarek2
    Moderator Smart Home
    Thanks, i merged it now into main release
    Helpful post? Buy me a coffee.

Topic summary

✨ The discussion focuses on setting up the power measurement channel on an AUBESS Power Monitor Switch based on the BK7231N chipset and CB2S module. The device uses a BL0942 power measurement IC communicating via UART1 on the same TX/RX lines used for flashing. To enable power measurement, the command "startDriver BL0942" must be added to the startup commands (preferably using the "backlog" keyword for multiple commands) and the device rebooted. Calibration commands such as VoltageSet, CurrentSet, and PowerSet are available only after the driver starts. PowerSave mode (PowerSave 1) is recommended to extend capacitor life and reduce power consumption. The user experienced issues with the S1-S2 toggle switch on pin P24 (TglChnOnTgl), which caused rapid relay toggling due to signal instability. A software update from a GitHub pull request (OpenBK7231T_App PR #1694) improved toggle switch debounce and stabilized the signal. The update was tested successfully and merged into the main release. ESPHome compatibility was questioned, with the recommendation to prefer OpenBK firmware for better power measurement support on BK7231N devices. The discussion includes detailed pin assignments, troubleshooting steps, and firmware flashing instructions for BK7231N-based power monitor switches.

FAQ

TL;DR: On AUBESS BK7231N, enable BL0942 and calibrate with 3 commands; "BL0942 is always using UART1." Use PowerSave 1, then calibrate. If VoltageSet errors, start the driver first. Update firmware for stable toggles. [Elektroda, p.kaczmarek2, post #21209629]

Why it matters: This FAQ helps BK7231N AUBESS owners quickly get reliable energy readings and stable switch inputs without guesswork.

Quick Facts

Which chip handles power metering and how does it communicate?

The BL0942 handles energy measurement and communicates over UART1. “BL0942 is always using UART1.” Start its driver, then calibrate the readings. This is the required path to see voltage, current, and power values in OpenBK. [Elektroda, p.kaczmarek2, post #21209629]

Where should I put startDriver BL0942 so it runs after every reboot?

Place it in autoexec.bat or the Startup command field. That ensures the driver loads at boot and your calibration commands become available immediately. You can then add calibration or power-saving settings. [Elektroda, p.kaczmarek2, post #21209629]

Why do VoltageSet/CurrentSet return “Unknown command”?

The driver is not started yet. VoltageSet is only available after BL0942 starts. Run startDriver BL0942 first, then issue calibration commands. The main page shows information about running drivers when active. [Elektroda, p.kaczmarek2, post #21583963]

How do I calibrate BL0942 in OpenBK?

Calibrate like Tasmota using three commands. 1) startDriver BL0942 2) VoltageSet 3) CurrentSet . Optionally use PowerSet to refine. Use accurate references for best results, then save. [Elektroda, p.kaczmarek2, post #21209629]

How can I run multiple startup commands (e.g., PowerSave and driver start)?

Use backlog to chain commands or put each command on a separate line. Example: backlog PowerSave 1; startDriver BL0942. This executes both on boot without skipping the second command. [Elektroda, p.kaczmarek2, post #21584469]

Where do I see power readings once the driver is running?

OpenBK’s main page lists running drivers and shows measurements when the BL0942 driver is active. Confirm the driver there, then view voltage, current, and power values. Close the live log if you need power saving. [Elektroda, p.kaczmarek2, post #21583963]

My P24 switch double-toggles with TglChnOnTgl. How do I fix it?

Update to the build that includes the revised TglChnOnTgl handling (PR 1694). After flashing OpenBK7231N_1694..., users reported the input became stable without false toggles. Use the newer main release once available. [Elektroda, brazoayeye, post #21590997]

How fast is the toggle after the debounce update?

The observed reaction time is about 150 ms. That latency feels natural for a toggle switch and keeps inputs stable. This value was measured after applying the updated firmware. [Elektroda, brazoayeye, post #21591302]

How do I download the correct BK7231N OTA (RBL) from GitHub builds?

Open the build or PR page, expand the Checks/Artifacts section, and download the BK7231N ZIP. Inside, pick the .rbl for OpenBK7231N and update via OTA. This is shown step-by-step with screenshots in the thread. [Elektroda, p.kaczmarek2, post #21590958]

Why doesn’t PowerSave 1 seem to reduce consumption?

The device won’t sleep if the web app log remains open. Close browser logs to allow dynamic sleep. “OBK is calibrated to utilize OBK powersave,” but logging keeps it awake. Re-test after closing the log tab. [Elektroda, p.kaczmarek2, post #21583963]

Is ESPHome viable here, or should I stay on OpenBK for BL0942?

The expert did not confirm ESPHome support in this case. OpenBK has native BL0942 support and tuned power saving. “OBK is calibrated to utilize OBK powersave,” so it’s the safer choice here. [Elektroda, p.kaczmarek2, post #21583963]

Will the TglChnOnTgl debounce fix be in the main release?

Yes. The maintainer confirmed the updated handling was merged into the main release. Update to the latest official firmware to benefit from the fix. [Elektroda, p.kaczmarek2, post #21591763]

What pin mapping did the Tuya config reveal for this AUBESS unit?

P23 is the on-board button, P8 is the Wi‑Fi LED, P24 is the S1/S2 toggle input, and P26 drives the relay. The module is CB2S (BK7231N). These mappings came from the extracted Tuya JSON. [Elektroda, brazoayeye, post #21209568]

How can I verify the driver really started at boot?

Check the main page for running drivers. If values only appear after manual startDriver BL0942, your startup line didn’t run both commands. Use backlog or separate lines to ensure execution. [Elektroda, p.kaczmarek2, post #21583963]

What’s a safe workaround if I can’t update firmware yet for P24 bouncing?

Configure the switch as dInput and link it to the relay with triggers. Users reported dInput did not show the false positives seen with TglChnOnTgl before the fix. [Elektroda, brazoayeye, post #21584534]
ADVERTISEMENT