Elektroda.com
Elektroda.com
X

Search our partners

Find the latest content on electronic components. Datasheets.com
Elektroda.com

Cheap AliExpress 13a socket with CB2S (BK7321N)

Bemsman 3168 3
  • I was hoping to buy the sockets that were ESP based so bought two different versions at very different prices, however these had CB2S modules, after some searching I found this site and the excellent work on OpenBK7231N.

    These are the sockets - both look exactly the same inside and out - even the boxes are the same Cheap AliExpress 13a socket with CB2S (BK7321N)

    So I opened them up, no glue is used, only plastic clips and one fixing screw - when removing the cover you need to push on the power socket to help release the cover.

    Cheap AliExpress 13a socket with CB2S (BK7321N) Cheap AliExpress 13a socket with CB2S (BK7321N) Cheap AliExpress 13a socket with CB2S (BK7321N)

    Next remove the two PCB retaining screws - marked with red lines.

    Cheap AliExpress 13a socket with CB2S (BK7321N)

    Few shots of the PCB LEDs etc.



    Cheap AliExpress 13a socket with CB2S (BK7321N)
    Cheap AliExpress 13a socket with CB2S (BK7321N) Cheap AliExpress 13a socket with CB2S (BK7321N) Cheap AliExpress 13a socket with CB2S (BK7321N) Cheap AliExpress 13a socket with CB2S (BK7321N)

    Now time to program - success, at first I thought I had bricked it because the LEDs came on, checked wifi and there it was, now setup wifi and the rest is easier from a PC once connected to your wifi

    Cheap AliExpress 13a socket with CB2S (BK7321N)

    Cheap AliExpress 13a socket with CB2S (BK7321N) Cheap AliExpress 13a socket with CB2S (BK7321N)

    On the first unit I programmed I clicked on the "Erase All Chip Flash" it seemed to have failed so I then flashed without checking that box, all went OK. setup MQTT and see it sending in to the MQTT server. Homeassistant didn't know about it as still more to setup in HA.

    The second one was a different story, I pulled it open done the flashing without clicking on the "erase all" box, put it all back together (15mins) went through the setup and this one popped up as a Tuya device in HA, but I don't have Tuya cloud, this must have been due to me not doing an "erase all"
    So Instead of pulling it open I decided to do an OTA back to OpenBK7231N_QIO_1.0.0.rbl - it obtained a new IP address and was up and running - I restarted my test instance of HA and no discovery this time. Done another OTA with OpenBK7231N_1.0.20 this time to bring it back to latest and all good, no annoying discovery now - will move on to configuring HA later.

    With my pin assignments - as the switch only has one button I have set it up so that 1 quick press toggles the power socket and 2 quick presses toggle the USB sockets - you can see the second entry across on the P8 line.

    Only issue is that when you plug it in both LEDS will illuminate but the sockets are off, if you do a single and double press it will then have correct status, Another way would be to publish /0/set 100 and /1/set 100 when the socket comes online.
    It may be possible to configure the "change startup control test" but I haven't played with this yet.

    Hope this is of use to some of you.

    Cool? Ranking DIY
    Can you write similar article? Send message to me and you will get SD card 64GB.
    About Author
    Bemsman
    Level 1  
    Offline 
    Bemsman wrote 1 posts with rating 9, helped 0 times. Been with us since 2022 year.
  • #2
    p.kaczmarek2
    Level 26  
    Good job! Thank you for using my firwmare.

    I added a template for your device called "BK7231N CB2S 13A Aliexpress socket":
    https://github.com/openshwprojects/OpenBK7231...mmit/4c0da359b4a2f7a3fdca55d53b5c5a747dbfce2b
    (now i see there is a typo in CB2S but i will correct)

    Of course, the final templates will be like in Tasmota, copied as text, not hard in the code. I just make the firmware from 0 and not everything is ready from scratch.

    I'm glad you used the "one button for two relays" option (clicking and double-clicking has different roles). This is something Tuya does not offer.

    Home Assistant could still see the OpenBeken device as Tuya, because maybe he remembered or recognized it by MAC. But that's just my unsupported guess.

    The bad LED status after booting the device is my oversight, I just have to set the pins after rebooting. It's very easy, I will add it and just do OTA (just paste the link to .rbl in the Config-> OTA field and the socket will automatically download a new batch from github).
  • #3
    ArturAVS
    Moderator of HydePark/Cars
    @ p.kaczmarek2 I really appreciate your contribution to the development of dedicated software. For several years, I have not been able to start any ESP-based system. Perhaps I will change to Beken because you describe everything nicely and in case of problems you can give us a hint. I supported you with a small amount (according to my rather poor possibilities).
  • #4
    p.kaczmarek2
    Level 26  
    Thank you @arturavs, every zloty counts, even if every tenth reader paid PLN 1, I would already have collected for a few new devices for testing.

    However, I would like to emphasize here that my goal is not to compete with Tasmota or ESP, but more to cooperate.
    For this reason, I started working on compatibility with Tasmoty's Device Groups:
    https://tasmota.github.io/docs/Device-Groups/

    Do you know this picture?
    Cheap AliExpress 13a socket with CB2S (BK7321N)
    I will not make this mistake. My BK7231T, BK7231N, XR809 and BL602 and probably also RTL will be able to "get along" with Tasmota through their DGR protocol and it will be possible to use them interchangeably in one ecosystem.

    I am ready to receive and send packets and support for Power State / Dimmer / RGB synchronization is also basically almost done:
    Cheap AliExpress 13a socket with CB2S (BK7321N)
    (the Library from the screenshot is written from 0 and tested on Windows)
    On BK7231 it will definitely start, on XR809 I have to look if LWIP version 1 (BK has version 2-something) supports multicast and IGMP flag for netif, but at most I sport to version 2 ...

    Tasmoty's DeviceGroups allows you to take one smart switch, several bulbs and connect them together so that the controller controls the bulbs, but no server, no Home Assistant .
    And you can even more ...
    Can have two switches , and still control these common lamps with them.
    And much more ...

    DeviceGroups are also a great alternative for "bezsererów" (meaning without Home Assistant), because thanks to them you can only buy one switch, one light bulb and you can do simple automations)


    PS: already in the current version of OpenBeken there is a scriptable "SendGet" command that sends a GET request that may contain a command for the HTTP interface commands of Tasmota, but it's just such a curiosity.