Elektroda.com
Elektroda.com
X

[BK7231N - CB3S] Generic Tuya Wall Switch Push Button Type 1-3 Gang No Neutral

ferbulous 4158 55
  • #31
    jo_sef
    Level 2  
    p.kaczmarek2 wrote:
    Hello @jo_sef , it is certainly possible to detach those relays from live wire (then basically there is a separation between relay contacts and coil), but from the photo I am unable to determine if you located the correct place. It even feels like it's not the correct place to cut. I'm afraid that cutting there would cut off the power supply of the device. I would need to see the whole device, where are relays, etc.
    Futhermore, I am confused - what are those two MOSFETs doing there? Those KND3403A...


    Hello @p.kaczmarek2, as I understand that MOSFET 1 is directly connected to L wire and the MOSFET 2 switching low voltage as as you can see it is connected to the SOURCE of the MOSFET 1.

    What I am confused is that not all relays are connected to the L wire, only pins of relay L2 and L3. The pin L1 goes on DRAIN connected to the MOSFET 2.

    So as I am thinking now it would may work if I cut it L track before the cap 0.01nF as I marked on the picture below for the reference. But I am not sure.

    [BK7231N - CB3S] Generic Tuya Wall Switch Push Button Type 1-3 Gang No Neutral [BK7231N - CB3S] Generic Tuya Wall Switch Push Button Type 1-3 Gang No Neutral
  • #32
    suntribe
    Level 2  
    is there any way to flash lsps5 1gang wifi switch if the mcu firmware is 1.1.0?
  • #33
    p.kaczmarek2
    Moderator Smart Home
    @suntribe do you mean flash via OTA? Or by wires? Any BK device can be easily programmed by connecting wires...
  • #34
    suntribe
    Level 2  
    Sorry for not mentioning it, I was thinking via OTA... as currently i have no usb-ttl adapter that's working (i realized last night that none of both usb-ttl adapters that i own is working... they both power up, but one gives a clear error in the dmesg logs while other one is dead silent - but both of them indicate like they are working - power led is on; rx/tx leds even flash here and there; but none of them actually shows in lsusb nor, ofc create a /dev/ttyUSBx - so i need to order new ones).

    So is it possible to do it via OTA with that fw version?
  • #35
    p.kaczmarek2
    Moderator Smart Home
    Sorry, but I am not able to determine if it's OTA-hackable just by the firmware version. Please check their list of supported devices and their images, and try the profiles of devices that are similar to yours. You won't break your device if OTA hack fails.
  • #36
    suntribe
    Level 2  
    all good, tnx for your support. in the end i went and bought two new usb/ttl adapters and they got me to the point to flash esphome on it. after that esphome’s ota just works…

    have to thank all the people putting effort in freeing these devices from the cloud and making them real local devices…

    Added after 5 [hours] 40 [minutes]:

    actually, i do have one issue... the device 'works' but as soon as i press the button, the relay is shortly toggled and after that the device soft-resets itself... not sure what's going on i turned on debug logging on the esphome, but nothing useful there in order to give me a clue of what might be happening...

    as this is a no-neutral device, for low power leds it should have a capacitor on the load, but my main light is not a low power led... it's more like 15-18W so it should not be the case... i'll still try to add a cap across the L/N on the load itself, but i honestly doubt it will help.. this more looks like a fw issue to me..

    Update:
    Adding the capacitor actually helped...
  • #37
    jrhenk
    Level 9  
    >>20321289
    I was wondering whether there is any way to tell if this one has the LEDs for the buttons directly connected to the relays or whether they can be controlled independently from the relay state https://www.aliexpress.com/item/4000532726890.html

    Based on the design of the glass plate it looks like the DS-101, DS-102, DS-103 and the version by athom (https://templates.blakadder.com/athom_SW11-TAS-3EU.html) ... and according to the templates, all of them have LEDs that can be independently controlled. I already bought and installed two athom 3 gangs, but wonder if I could save a few euros as they seem pretty identical
  • #38
    p.kaczmarek2
    Moderator Smart Home
    OpenBeken is very flexible when it comes to extra buttons and LEDs. You can assign them any role you want, you can even write a scripts with delays, conditional statements and loops. You can also use buttons to fire multiple events, on click, 2x, 3x, or even 4x click, don't forget about onHoldStart and OnHold and OnRelease...
  • #39
    ferbulous
    Level 15  
    jrhenk wrote:
    >>20321289
    I was wondering whether there is any way to tell if this one has the LEDs for the buttons directly connected to the relays or whether they can be controlled independently from the relay state https://www.aliexpress.com/item/4000532726890.html

    Based on the design of the glass plate it looks like the DS-101, DS-102, DS-103 and the version by athom (https://templates.blakadder.com/athom_SW11-TAS-3EU.html) ... and according to the templates, all of them have LEDs that can be independently controlled. I already bought and installed two athom 3 gangs, but wonder if I could save a few euros as they seem pretty identical


    Unfortunately, this switch design has the 'red led' tied to the relay
    The switch design similar to athom and this one (MILFRA) has the LEDs with dedicated pins
  • #40
    jrhenk
    Level 9  
    >>20470099
    Thanks and it's indeed really cool that all this is possible.... your whole project in general is just awesome, opened a whole new world for me :)

    Added after 2 [minutes]:

    >>20470147
    Ah thanks so much for letting me know... Betting on being lucky but then finding out after the aliexpress package finally arrives I wasn't is a big downer... guess I better stick to the athoms for a few euros more then since my soldering skills are really not good enough to connect the LEDs to the chip
  • #43
    p.kaczmarek2
    Moderator Smart Home
    Cutting trace to get LED controlled separately, right? We will think about.

    Currently, we have three videos ready to publish, waiting in queue:
    - one button to control LED strip - no scripting needed - along with soldering that button to LED strip that has no button by default. That way you can power it on off, adjust colors, dimmer with a single button!
    - hot air desoldering of wifi module
    - generic obk overview
  • #44
    ferbulous
    Level 15  
    p.kaczmarek2 wrote:
    Cutting trace to get LED controlled separately, right? We will think about.


    Yes, if possible
    I’m worried i might damage the pcb if it isn’t done properly.
  • #46
    jrhenk
    Level 9  
    >>20321289
    It's pretty wild how different these devices can turn out to be, I just got a three gang DS-101 (in the database it's called DS-103) and instead of a WB3S it has a CB3S chip. I think this should be changed in the database or there should be two versions of the DS-10x devices as people might end up bricking their switch with the wrong firmware. BUT what's more: I can configure the LEDs independently from the relay state which is super cool!

    [BK7231N - CB3S] Generic Tuya Wall Switch Push Button Type 1-3 Gang No Neutral

    This is the link to the product page https://www.aliexpress.com/item/4000532726890.html

    The flashing with cloudcutter was a bit weird but I had this with another switch. The initial exploit works with two times a 10sec press, but for the firmware flashing to work I needed to do a combination of 6x off/on, then hold a button for 10sec for fast blink and then 10sec for slow blink

    The pins are also different than in the database, took quite some time to figure it out, but the PINDOCTOR helped with figuring out the LEDs and Relays which sped up the process, here's the final template

    Code: json
    Log in, to see the code


    A little tip for everyone who wants to use the relays independently from the buttons:
    Use the template underneath instead, and in HA you can e.g. for button 1 use the MQTT trigger
    -----
    Topic:
    [MQTT_CLIENT_TOPIC}/4/get
    Payload:
    1
    ------
    For button 2 use 5 and for button 3 use 6

    Code: json
    Log in, to see the code


    What's cool after applying this changed template: your leds will turn up like switches, so via the webui (or mqtt) you can just turn the leds on and off (power 4 to 6) without effecting the state of the relay
    [BK7231N - CB3S] Generic Tuya Wall Switch Push Button Type 1-3 Gang No Neutral
  • #47
    p.kaczmarek2
    Moderator Smart Home
    Thanks for the information. Btw, while pin doctor can be very useful, it's important to know that latest release of BK7231 GUI flasher:
    https://github.com/openshwprojects/BK7231GUIFlashTool
    can automatically get GPIO config from 2MB device Tuya binary:
    [BK7231N - CB3S] Generic Tuya Wall Switch Push Button Type 1-3 Gang No Neutral
    Next release will be able to automatically configure OBK at the flash time.
  • #48
    jrhenk
    Level 9  
    Ah that's cool! I prefer sticking to cloudcutter so I guess I just keep doing the trial and error thing :) But all in all pretty amazing at what pace this project is going.

    Kind of connected I was curious about something: With that many devices existing, some keeping the same name yet changing the chip and others just packaging the same devices under a different name... is there any way to correctly identify and potentially also group identical devices from different brands based on some identifier?
  • #49
    elektradi
    Level 4  
    I have a 4 gang DS-101, has anyone flash it before?

    Need photos?
  • #51
    elektradi
    Level 4  
    4 gang DS-101

    [BK7231N - CB3S] Generic Tuya Wall Switch Push Button Type 1-3 Gang No Neutral [BK7231N - CB3S] Generic Tuya Wall Switch Push Button Type 1-3 Gang No Neutral [BK7231N - CB3S] Generic Tuya Wall Switch Push Button Type 1-3 Gang No Neutral [BK7231N - CB3S] Generic Tuya Wall Switch Push Button Type 1-3 Gang No Neutral

    Do I need to cut any PCB to flash to extract the info? I'm really noob at this.
  • #53
    jrhenk
    Level 9  
    >>20606293
    Yes I successfully flashed that one with cloudcutter, works great... However the only limitation compared to the 1,2,3 gang ones is that you can't access the leds from the buttons independently from relay states. This is also the case with the athoms and I guess there are just not enough pins for 4 relays + 4 buttons + 5 leds. You can just configure the relays with another number than the buttons (so e.g. button 1,2,3,4 and relays 5,6,7,8) and this way you can use the buttons without the relays being triggered but still can use the relays for something. You can still configure a feedback for the button press by letting the WIFI led light up on a button press. Good Luck!
  • #54
    jkwim
    Level 7  
    jrhenk wrote:
    >>20606293
    Yes I successfully flashed that one with cloudcutter, works great... However the only limitation compared to the 1,2,3 gang ones is that you can't access the leds from the buttons independently from relay states. This is also the case with the athoms and I guess there are just not enough pins for 4 relays + 4 buttons + 5 leds. You can just configure the relays with another number than the buttons (so e.g. button 1,2,3,4 and relays 5,6,7,8) and this way you can use the buttons without the relays being triggered but still can use the relays for something. You can still configure a feedback for the button press by letting the WIFI led light up on a button press. Good Luck!


    Yes, both CB3S (BK7231N) and WB3S (BK7231T) modules expose only 10 pins that we can use as I/Os.

    However there are the SPI Pins (20,21,22,23). Wonder whether those can be repurposed -:)

    I was looking at repurposing one of these switches (probably a single gang) for some external sensors for a project since there will be 6 I/O pins that I can extend out of the board. Since the AC & DC PCBs are nicely separated it would be a good all-in-one device. I am assuming that the same 3.3V Power Switch (OB25133JP) would have been used in 1-Gang and 3-Gang switches
  • #55
    p.kaczmarek2
    Moderator Smart Home
    You can repurpose any GPIO that has a "Px" role in Tuya docs, anything like P1, P8, P12, should work. P20, P21, P22 and P23 should work as well.
  • #56
    jrhenk
    Level 9  
    >>20608439
    Ah thanks! Fun to find out I was right with my working hypothesis, never really researched it :)