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

Czy wolisz polską wersję strony elektroda?

Nie, dziękuję Przekieruj mnie tam

Teardown of a Smart Life Curtain (Shutter) switch, Flashing, Configuring and setting up with HA

richardsg307 11244 32

TL;DR

  • Teardown and conversion of a Smart Life DS-151 N+L WiFi+BLE curtain switch and skylight opener, replacing Tuya firmware with OpenBeken for Home Assistant control.
  • A WB3S module with BK7231T was flashed after cutting the TXD1/RXD1 tracks, because BK_Writer failed and the hid_download_py Python method succeeded.
  • The controller uses 3 buttons, 3 LEDs, and 2 relays, and the skylight run time was increased from 10 seconds to 15 seconds.
  • An autoexec.bat script emulates the original Tuya behavior, and Home Assistant MQTT buttons trigger Open, Stop, and Close commands successfully.
  • Default GUI buttons were hidden to avoid energizing both relays at once, since the actuator’s behavior in that case was uncertain.
Summary generated by AI based on the discussion content.
ADVERTISEMENT
📢 Listen (AI):
  • https://www.elektroda.com/rtvforum/posting.php?mode=editpost&p=20547099#I bought this Skylight opener and switch from AliExpress Link
    with the EU Wifi Switch. My skylight is out of reach and I have to get a ladder from that garage to open it! My original intention was to use it with Local Tuya (this would have been my first) within Home Assistant (HA) as I'd read manufacturers had moved away from ESP8266 boards; I'd flashed plenty of those with Tasmota. But then I came across OpenBeken so thought I'd give it a go.
    First off, the opener itself is a 4 wire mains device. Teardown of a Smart Life Curtain (Shutter) switch, Flashing, Configuring and setting up with HA
    Green/Yellow - Earth, Blue - Neutral, Brown - Live Open and Black - Live Close.

    The controller is a Smart Life DS-151 N+L, WiFi+BLE Curtain Switch (as labelled on the box) and fits into a standard UK single wall box. The pic shows it with the front panel already removed (flat screwdriver at the base). The board is a WB3S with the BK7231T processor. Teardown of a Smart Life Curtain (Shutter) switch, Flashing, Configuring and setting up with HA. Three buttons for Open, Stop and Close. The terminal block has Live and Neutral in and the Live/Open and Live/Close outputs.

    Flashing
    I soldered wires onto the TXD1, RXD1, GND and VCC pads of the WB3S and connected it up my USB/UART converter set to 3V3, Got the appropriate file to flash it with by this method ( OpenBK7231T_UA_1.15.700.bin), downloaded and 'installed' BK_WriterV1.60.exe, and tried to flash. No joy - got a Failed message!
    Teardown of a Smart Life Curtain (Shutter) switch, Flashing, Configuring and setting up with HA
    After some advice from the ever so helpful p.kaczmarek2 I had the solution. The Tx and Rx pins are both used by the device as Button input and LED output respectively and the circuitry interfered with the flashing signalling. So I cut the Tracks leading away from those pins in the positions shown.
    Teardown of a Smart Life Curtain (Shutter) switch, Flashing, Configuring and setting up with HA Teardown of a Smart Life Curtain (Shutter) switch, Flashing, Configuring and setting up with HA
    Tried to flash again using BK_Writer at the default settings but still no joy. Tried again at 115200 baud and this time it started to erase but then failed. I found then that i could read and save the whole of the preloaded firmware so that was progress.
    I then turned to another method of flashing using a python program. This was successful so I'll just give the details.
    I opened a command window on my PC and created and moved to a directory called 'OpenBKT', then I got the program using the command
    git clone https://github.com/OpenBekenIOT/hid_download_py

    I already had Python installed from years back but you might need that too. When I tried to use the flashing program I found I needed something called 'tqdm' so I got that with the command
    pip install tqdm

    I then successfully flashed the device with the command
    python uartprogram C:\Users\Grumps\Openbkt\OpenBK7231T_UA_1.15.700.bin -d com3 -w -b 115200

    You will need to change the path and com port as appropriate.
    I then repaired the cut tracks. One was easily bridged with a blob of solder but the other just wouldn't so in the end I used a very fine wire.
    Teardown of a Smart Life Curtain (Shutter) switch, Flashing, Configuring and setting up with HA Teardown of a Smart Life Curtain (Shutter) switch, Flashing, Configuring and setting up with HA

    Connecting
    Power up the device and use your phone to find and connect to its WiFi - the SSID is pretty obvious. Having done that, open a browser on the phone and go to 192.168.4.1, this should get you into the GUI where you should now enter your own WiFi's credentials. Reboot the device and try and find it through your own router. On my router when I looked at WiFi devices it was actually named so was pretty obvious. You will want to set a reserved IP I guess.

    Configuration
    The Tuya controller has 3 buttons, 3 LEDs which illuminate the buttons and 2 relays. I set them up thus:
    "pin":"function":"channel"
    "6": "Rel;1",
    "8": "Btn;3",
    "9": "Rel;3",
    "10": "Btn;2",
    "11": "LED_n;3",
    "14": "LED_n;1",
    "24": "Btn;1",
    "26": "LED_n;2"
    Everything worked as expected but not how it needed to function so don't connect the actuator at this point!!!!!
    With more help from p.kaczmarek2 I wrote an autoexec.bat file to emulate the way the Tuya firmware operated. eg pressing the Open button would turn everything off then turn on the Open relay and LED for 10 seconds. It would then turn all off before turning the Stop LED on for just 3 seconds. I think just to confirm all was off and to not leave power going to the actuator when not necessary. As it turns out 10s is not long enough to open the skylight fully so I increased it to 15s. Here's the autoexec.bat file.
    // Set up Aliases
    alias Set_Stop backlog setChannel 3 0; setChannel 2 0; setChannel 1 0; setButtonColor 3 red; setButtonColor 2 red; setButtonColor 1 red
    alias Set_Open backlog setChannel 1 1; setButtonColor 1 blue 
    alias Set_Close backlog setChannel 3 1; setButtonColor 3 blue
    alias Set_Finish backlog setChannel 2 1; setButtonColor 2 blue
    alias Start_Opening backlog stopAllScripts; startScript autoexec.bat openSkylight
    alias Start_Closing backlog stopAllScripts; startScript autoexec.bat closeSkylight
    alias Stop_All backlog stopAllScripts; startScript autoexec.bat stopSkylight
    
    // Channel 60 is seconds for power to be applied
    setChannel 60 15
    
    // create GUI buttons for HTTP panel
    startDriver httpButtons
    
    setButtonEnabled 1 1
    setButtonLabel 1 "Open"
    setButtonCommand 1 Start_Opening
    setButtonColor 1 red
    
    setButtonEnabled 3 1
    setButtonLabel 3 "Close"
    setButtonCommand 3 Start_Closing
    setButtonColor 3 red
    
    setButtonEnabled 2 1
    setButtonLabel 2 "Stop"
    setButtonCommand 2 Stop_All
    setButtonColor 2 red
    
    // Hide the default GUI buttons
    setChannelVisible 1 0
    setChannelVisible 2 0
    setChannelVisible 3 0
    
    // Loading Event Handlers
    addEventHandler OnClick 8 Start_Closing
    addEventHandler OnClick 24 Start_Opening
    addEventHandler OnClick 10 Stop_All
    
    // Close Skylight on power up
    goto closeSkylight
    
    // do not proceed
    return
    
    openSkylight:
    Set_Stop
    delay_s 0.1
    Set_Open
    delay_s $CH60
    Set_Stop
    Set_Finish
    delay_s 3
    Set_Stop
    return
    
    closeSkylight:
    Set_Stop
    delay_s 0.1
    Set_Close
    delay_s $CH60
    Set_Stop
    Set_Finish
    delay_s 3
    Set_Stop
    return
    
    stopSkylight:
    Set_Stop
    Set_Finish
    delay_s 3
    Set_Stop
    return

    I hid the default buttons since they could be used to turn both relays on at the same time and I don't know how the actuator would cope with that! After lots of testing, pressing buttons at random, I was satisfied the code worked ok so connected the actuator.
    Teardown of a Smart Life Curtain (Shutter) switch, Flashing, Configuring and setting up with HA
    And it works




    Home Assistant
    I then configured the MQTT section of the device (IP, Port, User and Password) and gave the Client Topic as 'skylight'. I then copied the YAML code from the HA configuration section and pasted it, as appropriate, into my configuration.yaml file in HA.
    mqtt:
      switch:
      - unique_id: "OpenBK_Skylight_Control_relay_1"
        name: "SkyLight 1"
        state_topic: "skylight/1/get"
        command_topic: "skylight/1/set"
        qos: 1
        payload_on: 1
        payload_off: 0
        retain: true
        availability:
          - topic: "skylight/connected"
      - unique_id: "OpenBK_Skylight_Control_relay_2"
        name: "SkyLight 2"
        state_topic: "skylight/2/get"
        command_topic: "skylight/2/set"
        qos: 1
        payload_on: 1
        payload_off: 0
        retain: true
        availability:
          - topic: "skylight/connected"
      - unique_id: "OpenBK_Skylight_Control_relay_3"
        name: "SkyLight 3"
        state_topic: "skylight/3/get"
        command_topic: "skylight/3/set"
        qos: 1
        payload_on: 1
        payload_off: 0
        retain: true
        availability:
          - topic: "skylight/connected"
    

    This gave me 3 new buttons as entities, but they all operated individually and cannot be used that way. So I created a card for my dashboard with the following code.
    type: vertical-stack
    cards:
      - type: custom:mushroom-title-card
        title: Skylight Control
        alignment: center
      - type: horizontal-stack
        cards:
          - show_name: true
            show_icon: true
            type: button
            tap_action:
              action: call-service
              service: mqtt.publish
              data:
                qos: 0
                retain: false
                topic: cmnd/skylight/Start_Opening
              target: {}
            entity: switch.skylight_1
            name: Open
            icon: mdi:unfold-more-vertical
          - show_name: true
            show_icon: true
            type: button
            tap_action:
              action: call-service
              service: mqtt.publish
              data:
                qos: 0
                retain: false
                topic: cmnd/skylight/Stop_All
              target: {}
            entity: switch.skylight_2
            icon: mdi:pause
            name: Stop
          - show_name: true
            show_icon: true
            type: button
            tap_action:
              action: call-service
              service: mqtt.publish
              data:
                qos: 0
                retain: false
                topic: cmnd/skylight/Start_Closing
              target: {}
            entity: switch.skylight_3
            name: Close
            icon: mdi:unfold-less-vertical
    

    That works properly by calling the MQTT publish service with commands that trigger the event handlers in the autoexec.bat file




    And that's it, I just need to fit it to my skylight now and wire it in! If I've missed anything just post a comment and I'll sort it.

    Finally, a big shout out to all the characters that develop all this open software; you are amazing.

    Edit: All installed now and working.
    I put the switch panel in the airing cupboard as I intend to automate the window from HA rather than operate it manually, and it keeps those pesky grand children from playing with it!



    Cool? Ranking DIY
    About Author
    richardsg307
    Level 5  
    Offline 
    richardsg307 wrote 18 posts with rating 5. Been with us since 2023 year.
  • ADVERTISEMENT
  • #2 20548771
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14684
    Help: 656
    Rate: 12714
    That's a very useful and well written guide, thank you. It looks like OpenBeken can control shutters well, even without a dedicated driver. We'll send you a free gift for documenting and sharing your good work.
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #3 20554283
    Nanganator
    Level 6  
    Posts: 14
    Rate: 6
    This is really cool and well documented. Going to try the same thing with some roller shutters. Was just wondering how it handles stopping part way through and changing direction/continuing later if it is based on “time” to open. i.e. if fully open to fully closed is simply 15 seconds of close relay on and you stop it half way. Does it then try and close or open for too long the next time you push a button? Or does it somehow know how long it ran for and factors that in the next time you give it an open/close command.

    Would be really cool to see this interpreted as a percentage based scale on a slider to open the window 30% etc.
  • #4 20554417
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14684
    Help: 656
    Rate: 12714
    @Nanganator if you have some free time for testing, I could try writing just a hardcoded, C code driver for you with this feature. The only thing is, I don't have shutters at hand and they are pretty expensive here, so I would need you (or some other shutter owner) to help with testing. Bonus points if you know C.
    Helpful post? Buy me a coffee.
  • #5 20554569
    Nanganator
    Level 6  
    Posts: 14
    Rate: 6
    Absolutely willing to help test. Just moved from BE to PT and our new apartment has electric shutters on every window. So planning to grab a bunch of these https://www.aliexpress.com/item/1005004608903981.html to put behind the existing switches. Assuming they’re Beken inside so will be dumping the firmware and documenting the teardown and flashing.

    Unfortunately I don’t know any programming languages.
  • #6 20555187
    richardsg307
    Level 5  
    Posts: 18
    Rate: 5
    >>20554283
    My code just applied power for the set time ($CH60). It could have been indefinite as the actuator itself stops gracefully when reaching the limits or the motor stalls. Make sure your blinds have similar cut-outs at their limits.
    My actuator has a pot for setting maximum opening which I have used and equates to about 17 seconds. So pressing open once gives me around 60% open. Pressing again will give me my preset opening (my 100%) but the relay will still deliver power for a further 3 seconds.
    Because I want the window to shut on one press, I have changed the closing delay to 20s to be on the safe side.
    You will only be able to set a percentage from the duration the relays are on subject to a limit of 0 or 100%. This could drift so would need resetting at 0% say.
    Good luck.
  • #7 20555481
    PSlowik
    Level 12  
    Posts: 80
    Rate: 2
    I have identical drivers, so I'm also thinking about going to OpenBeken
  • #8 20639305
    Acefx
    Level 9  
    Posts: 23
    Rate: 2
    Hi,
    I wanted to thanks you for your work, that helped me a lot.

    Just flashed a "Etersky" wf-cs01 roller shutter module with some of your recommendation
    Despite the fact it's running on CB3s and the wiring aren't the same i succeed making it work as intended.

    I write to you about the Autoexec script which may need some improvement. :-) :-)
    First, do you think it's possible to have the closing/opening delay time variable into the web command interface.
    I think it's not very handy to edit the delay inside the Autoexec.bat

    The second improvement is that when you touch a second time the button up/down button, it should stop the opening/closing if i was operating at this time.

    I also have a strange bug that occurs on the physical touch of the up button, the relay seems to do an on/off/on very rapidly.
    Does @p.kaczmarek2 the script wizard could improve the integration ?

    I will post my template as soon as it's completely tested
    Cheers

    [EDIT] Ok i got some more time to edit it a little bit.
    Now the switching between relay with the stop condition is fast
    I also add a variable for the Mouvement timer, and the led ( on my model )
    all the data are reboot persistent.

    Here the script
    
    // Autoexec file for Etersky WS01, please adapt to your hardware if different
    // Set up Aliases
    alias Set_Stop backlog setChannel 3 0; setChannel 1 0; setChannel 2 0; setButtonColor 3 CornflowerBlue; setButtonColor 2 CornflowerBlue; setButtonColor 1 CornflowerBlue
    alias UPmouv_Stop backlog  setChannel 1 0
    alias DWmouv_Stop backlog setChannel 3 0
    alias Set_Open backlog setChannel 1 1; setButtonColor 1 Coral 
    alias Set_Close backlog setChannel 3 1; setButtonColor 3 Coral
    alias Set_Finish backlog setChannel 2 1; setButtonColor 2 Coral
    alias Start_Opening backlog stopAllScripts; startScript autoexec.bat openSkylight
    alias Start_Closing backlog stopAllScripts; startScript autoexec.bat closeSkylight
    alias Stop_All backlog stopAllScripts; startScript autoexec.bat stopSkylight
    alias Stop_led_up backlog setButtonColor 1 Coral
    alias Stop_led_finish backlog setButtonColor 2 Coral
    alias Stop_led_dw backlog setButtonColor 3 Coral
    
    
    // create GUI buttons for HTTP panel
    startDriver httpButtons
    
    setButtonEnabled 1 1
    setButtonLabel 1 "Open"
    setButtonCommand 1 Start_Opening
    setButtonColor 1 CornflowerBlue
    
    setButtonEnabled 3 1
    setButtonLabel 3 "Close"
    setButtonCommand 3 Start_Closing
    setButtonColor 3 CornflowerBlue
    setButtonEnabled 2 1
    setButtonLabel 2 "Stop"
    setButtonCommand 2 Stop_All
    setButtonColor 2 CornflowerBlue
    
    // Hide the default GUI buttons
    setChannelVisible 1 0
    setChannelVisible 2 0
    setChannelVisible 3 0
    
    // Loading Event Handlers
    addEventHandler OnClick 7 Start_Closing
    addEventHandler OnClick 24 Start_Opening
    addEventHandler OnClick 10 Stop_All
    
    // Stop Operation on power up
    goto stopSkylight
    
    
    // do not proceed
    return
    
    openSkylight:
    DWmouv_Stop
    delay_ms 5
    Set_Open
    setChannel 2 0
    setButtonColor 2 CornflowerBlue
    delay_s $CH4
    Set_Stop
    Set_Finish
    delay_s 2
    Set_Stop
    return
    
    closeSkylight:
    UPmouv_Stop
    delay_ms 5
    Set_Close
    setChannel 2 0
    setButtonColor 2 CornflowerBlue
    delay_s $CH4
    Set_Stop
    Set_Finish
    delay_s 2
    Set_Stop
    return
    
    stopSkylight:
    Set_Stop
    Set_Finish
    delay_s 3
    Set_Stop
    return 



    The last thing i need to test is a conditional behavior that test the relay state to prevent, when switched a second time , to switch off and then on. Also i need to test if it doesn't add too much delay
  • #9 20639755
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14684
    Help: 656
    Rate: 12714
    Thank you for sharing. Can you show me the web app log from the moment you touch and hold the physical button, when the relay switches on/off very rapidly?

    That script should be good for most cases, but I still have to mention, that the best option would be having a dedicated driver for shutters written in C, compatible with Tasmota commands. The only problem is that I don't have curtains to test it. So it's hard for me to implement it. Maybe we could somehow do that remotely with somebody, I would write code and the user would test it, feedback, and help me improve it, but it could take some time.
    Helpful post? Buy me a coffee.
  • #10 20640021
    Acefx
    Level 9  
    Posts: 23
    Rate: 2
    The rapid switching is corrected , it was due to a to high delay & redondant stop command in the original code.

    For the testing, i have a dozen of curtain and etersky under openbeke ready to be your guinea Pig !
    Just tell me what you need.
    You could also, if you have a curtain/rollershutter module, replace the motor with some light.
  • #11 20640080
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14684
    Help: 656
    Rate: 12714
    Acefx wrote:

    Just tell me what you need.

    I've been thinking about doing a very similar driver to the one in Tasmota, maybe also with the same commands, would that suit all needs? Or should we take another approach? Again, I don't have shutters so I don't know if there is anything that could be done better.

    Acefx wrote:

    You could also, if you have a curtain/rollershutter module, replace the motor with some light.

    I've been thinking about but light wouldn't be able tell which "direction" is active, furthermore, as far as I know, some precise timing is required to get shutters perfectly running.
    Helpful post? Buy me a coffee.
  • #12 20640181
    Acefx
    Level 9  
    Posts: 23
    Rate: 2
    p.kaczmarek2 wrote:
    I've been thinking about but light wouldn't be able tell which "direction" is active, furthermore, as far as I know, some precise timing is required to get shutters perfectly running.

    Well basically yes, you need 2 ( One for simulating Up Command, the second for down command.
    A curtain/shutter motor is a simple motor with rotary physical endstop, nothing more.
    The only absolutely important thing is to NEVER power the two direction in the same time.

    I don't know the tasmota driver for shutter but i will look at it.
    The feature a shutter driver needs :
    -2 relay Channel --> 1 for UP/OPEN, 1 for DOWN/CLOSE

    -1 Stop Channel to stop the roller

    -1 Channel for timing countdown for the relay to deactivate after a certain amount of time
    By default it will be set to 2min
    ( this is luxury, almost all the shutter system have hardcoded timer @ 2min

    -3 physicals buttons ( UP / STOP / DOWN)

    -3 Led Button ( Led underneath the button that need to be light-up when action and shutdown delayed by xx seconds.

    -1 One WIFI LEd

    -1 Panel backlit led,

    Rules
    --During Boot the module deactivate all the relay
    --NEVER activate the two relay at the same time
    --Deactivate all movements after countdown.
    -- When a relay is activated , need to check the relay state
    ---> If no relay active, then activate
    ---> If another relay active, deactivate the other relay then activate with a 15ms delay
    ---> if already active , do nothing ( this prevent the relay re-click a second time )


    Additional functionality : proportional slider
    This functionality is paired with the timer and need some manual calibration .
    The user need to time the shutter individually and define how much time it take to open & close,
    and define a proportional opening. 0% -25% -50% -75% -100%
  • ADVERTISEMENT
  • #13 20650291
    marnypopis1
    Level 10  
    Posts: 12
    I have a broken roller shutter switch. At the moment it works like a regular on/off switch. I can test when I get the firmware file.

    I have it on Chipset: BK7231N - latest Firmware from yesterday version 1.17.179

    If I get something that I can upload via OTA, I will test it.
  • #14 20664100
    Acefx
    Level 9  
    Posts: 23
    Rate: 2
    Hey Everybody ! i got some update & a problem !
    I use Mqtt for my smart home & i wish to integrate the roller shutter into it.
    But the Mqtt command are raw channel one , not the logic one that we added on the autoexec.

    The consequences are The stop command doesn't operate, and more dangerously the two relay could be switched on simultaneously which can lead to motor Or button destruction.
    Do you think about a solution ? does the driver's ready to test ? @p.kaczmarek2
    [Edit]
    After reading more carefully i found that it's possible to execute the start_opening / start_closing command.
    But since i don't use home assistant... i can't succeed doing it. any hint ?
    The Mqtt command should be
    cmnd/SHUTTER_NAME
    Payload : start_opening
    ?

    All the best
  • #15 20665983
    marnypopis1
    Level 10  
    Posts: 12
    I have the same problem, and for now, I'm living with it - I've built a button in the dashboard that triggers states from autoexec, and then it works as it should. Through MQTT, there's only relay 2 working independently. So, it's possible to turn both on at once and boom.

    That's how it is for me now.
    Teardown of a Smart Life Curtain (Shutter) switch, Flashing, Configuring and setting up with HA
    It resembles TASMOTA, but MQTT doesn't see these three buttons and doesn't create three entities from them. I'm waiting patiently until someone figures it out - then it would be complete. Heck, one could even combine TASMOTA with Openbeken and create a single platform ;-)
  • #17 20666170
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14684
    Help: 656
    Rate: 12714
    I may try to come up with something, but I can't promise how and when. Recently I've been focusing on LED stuff again, we've been reverse-engineering KP18058 LED driver: https://www.elektroda.com/rtvforum/topic3985037.html
    And I still have a pending Win32 OBK Simulator release... there is a lot of work to do, each and every day.

    @marnypopis11 I think you can send any command from HA, would that solution work for you?
    Helpful post? Buy me a coffee.
  • #18 20666484
    marnypopis1
    Level 10  
    Posts: 12
    HA works on entities - now in this form on this switch, which I have flashed and detached from the cloud, I have only two entities via MQTT. In HA, automation and scenes are built, and for this you need the above-mentioned entities - ideal are Open, stop, close and setting the time, how long Open and close should last.

    If such a state, as you can see in my screenshot from the post above, could be pushed into MQTT, then the topic is solved. Then I would have 3 entities - Open, Stop, Close, and I would set the duration in autoexec. I think most users would be happy with that.

    A lot is devoted to LED lighting in Openbeken, luckily there are no blinds.
  • #19 20666845
    Acefx
    Level 9  
    Posts: 23
    Rate: 2
    Hi,
    Well the way that HA behave isn't ideal for other systems.
    I explain
    HA behavior for mqtt is to generate multiple fixed name topics (tele/stat/cmnd) has a prefix and then the name of the device. Resulting in a format like
    Cmnd/NAME_device/#
    In an opposite way, other Système recognize Mqtt topic with the device name has the root topic
    NAME_DEVICE/cmnd/#
    In tasmota there is a way to change this behavior, but not in openbeken.

    Concerning the ability to execute a command, I succeeded running it via http request, but unsucceful via mqtt. I certainly missing something because Richard had no problem with it
  • #20 20870978
    Romanusss
    Level 5  
    Posts: 6
    Rate: 1
    Hello !
    Thanks richardsg307 for your great work about this device.

    I flashed my own Smartlife DS-151 and got a strange behaviour, if I press Open or Close the button keeps ON or OFF.

    Touch panel with illuminated buttons: blue and red.

    I have the same on OpenBeken web interface,

    Screenshot of an interface with three buttons labeled Toggle 1, Toggle 2, and Toggle 3.

    I also have the pause button that doesn't respond.

    Here the pin settings
    Code: JSON
    Log in, to see the code


    Any idea?
  • ADVERTISEMENT
  • #21 20871172
    marnypopis1
    Level 10  
    Posts: 12
    You haven't done the most important thing - you need to add entries to autoexec.bat as mentioned earlier in the posts. Without that, it won't work.

    Moderated By p.kaczmarek2:

    On com domain, please use English - I translated the post

  • #22 20871307
    Romanusss
    Level 5  
    Posts: 6
    Rate: 1
    Wow!

    Sorry for my lack of attention, it works perfectly...

    Thanks for support :)
  • #23 21213665
    formeTA
    Level 3  
    Posts: 3
    Very helpful, I am testing a teekar shutter with CBS03
    and did not find a hint where to place the autoexec.bat. Could you please help me?
    Thank you! @ElektrodaBot
  • #24 21213675
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14684
    Help: 656
    Rate: 12714
    Autoexec.bat tutorial:


    Helpful post? Buy me a coffee.
  • #25 21490390
    andres2
    Level 2  
    Posts: 2
    First of all, thanks for your work. As an initial version, works for me but I would like to control the current position. Im a newbie with OpenBeken and still learning, but would be great to know the position. In Tasmota, you can specify the opening time and closing time and it calculates de position. I will try to work on that and will share if I get it.
  • #26 21752387
    Romanusss
    Level 5  
    Posts: 6
    Rate: 1
    Hi Everyone !

    Have you tried to configure DS-151 with BK7231N chipset?
    I tried but it seems to get only 1 relay, close and stop (physical) don’t respond to pressure.
    I got multiple strange logs regarding PIN 8 (Close):

    Info:GEN:8 Button_OnLongPressHold
  • #27 21752395
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14684
    Help: 656
    Rate: 12714
    Hm do you know how pin 8 is connected physically? Can you do Tuya config extraction? That message would mean that you configured it as a button but it's permantently shorted to ground so OBK sees it as a button that is held all the time.
    Helpful post? Buy me a coffee.
  • #28 21752494
    Romanusss
    Level 5  
    Posts: 6
    Rate: 1
    >>21752395

    Hello p.kaczmarek2,

    Thanks for your reply !

    I don’t know How PIN 8 could be connected but I join you a picture took during the UART flash.
    How to extract Tuya configuration?
    CB3S module on PCB with attached test probes and visible SMD components
  • Suggesting Tuya config extraction with OpenBeken

    #29 21752496
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14684
    Help: 656
    Rate: 12714
    Tuya config extraction:




    Thanks for the pic, but it just tells us there is a CB3S and that it may or may not be TuyaMCU. It doesn't show where P8 is connected. We would need to investigate the PCB a bit. Maybe with multimeter.

    Maybe let's try Tuya Config extraction first. It's a very useful feature of OpenBeken, maybe it can work here as well? Not all Tuya devices have this config present, but we'll give it a go.
    Helpful post? Buy me a coffee.
  • #30 21752510
    Romanusss
    Level 5  
    Posts: 6
    Rate: 1
    >>21752496

    WOOOW, you are just so genius !

    It seems kindly better, All the physical button seem working properly now.

    Just to help the community, please find a screenshot of the config import from Tuya config extract,

    Screenshot of Cloudcutter config interface with JSON template input and generated OBK script.

    Great thanks !!
📢 Listen (AI):

Topic summary

✨ Discussion about reverse-engineering and flashing a Smart Life / Tuya curtain and roller-shutter switch based on WB3S/CB3S modules with BK7231T/BK7231N chips, then configuring it in OpenBeken for Home Assistant use. The thread covers wiring of a skylight/roller shutter motor, firmware dumping, OTA flashing, pin mapping, and the need for an autoexec.bat script to implement shutter logic such as open/close/stop, relay interlocking, timing-based travel calibration, and percentage position control. Several users report successful operation after importing Tuya configuration, while others ask for improvements such as native MQTT/HA cover entities, proper stop handling, and a dedicated C driver compatible with Tasmota-style commands.
Summary generated by AI based on the discussion content.

FAQ

TL;DR: This FAQ covers 15 practical DS-151/OpenBeken shutter lessons; “NEVER power the two direction in the same time” is the core safety rule. It helps Home Assistant users flash BK7231T/BK7231N curtain switches, map pins, script safe relays, and avoid MQTT hazards. [#20640181] Why it matters: A wrong shutter configuration can energize Open and Close together, risking motor, relay, or switch damage.

Approach Chip or platform Strength Limitation
OpenBeken script BK7231T/BK7231N, WB3S/CB3S Works locally with autoexec.bat and MQTT commands No native cover driver in the thread
Original Tuya firmware Tuya Smart Life Operates 3 buttons and 2 relays out of the box Cloud-based unless kept in Tuya ecosystem
Tasmota-style shutter logic Referenced as target behavior Uses travel times and position calculation Not yet implemented as OpenBeken C driver in the thread

Key insight: Treat the DS-151 as a two-direction motor controller, not as two independent switches. Safe control requires scripts or a future driver that interlocks relays before Home Assistant or MQTT can operate it.

Quick Facts

  • The DS-151 example uses a WB3S module with a BK7231T processor, 3 touch buttons, 3 LEDs, and 2 relay outputs. [#20547099]
  • UART flashing used TXD1, RXD1, GND, and VCC pads with a USB/UART adapter set to 3.3 V. [#20547099]
  • The skylight actuator wiring was 4-wire mains: Earth, Neutral, Live Open, and Live Close. [#20547099]
  • The successful flash command used 115200 baud and wrote OpenBK7231T_UA_1.15.700.bin through com3. [#20547099]
  • The working script used channel 60 as a movement timer, changed from 10 s to 15 s, then used 20 s for safer closing. [#20555187]

How do I flash OpenBeken onto a Smart Life DS-151 WiFi+BLE curtain switch with a WB3S BK7231T module?

Flash it by UART after exposing the WB3S pads and using the BK7231T OpenBeken binary.
  1. Solder TXD1, RXD1, GND, and VCC.
  2. Use a 3.3 V USB/UART adapter and cut interfering tracks if flashing fails.
  3. Run python uartprogram ...OpenBK7231T_UA_1.15.700.bin -d com3 -w -b 115200. After flashing, repair the cut tracks with solder or fine wire. [#20547099]

Why does BK_Writer fail when flashing a DS-151 curtain switch, and how do the TXD1 and RXD1 circuit tracks interfere with UART flashing?

BK_Writer can fail because DS-151 circuitry also uses TXD1 and RXD1 for normal hardware functions. TX is used as a button input, and RX is used as an LED output. That extra circuitry interferes with UART signalling during flashing. Cutting the tracks from those pins allowed progress, but BK_Writer still failed at default settings. The Python UART method succeeded at 115200 baud. [#20547099]

What is OpenBeken, and how is it different from Tasmota for BK7231T and BK7231N smart switch modules?

OpenBeken is firmware for Beken-based smart devices that replaced the cloud firmware in this DS-151 case. "OpenBeken is an alternative IoT firmware that runs on BK7231T and BK7231N modules, providing local configuration, scripting, web control, and MQTT integration without relying on the original Tuya cloud." Tasmota was mentioned as familiar ESP8266 firmware and as a model for future shutter commands. [#20547099]

How should the pins be configured in OpenBeken for the Smart Life DS-151 curtain switch with Open, Stop, Close buttons, LEDs, and two relays?

Configure the BK7231T DS-151 with relays on pins 6 and 9, buttons on 8, 10, and 24, and inverted LEDs on 11, 14, and 26. The working mapping used Rel;1 on pin 6, Rel;3 on pin 9, Btn;3 on pin 8, Btn;2 on pin 10, and Btn;1 on pin 24. It used LED_n for the three button lights. [#20547099]

How do I write an autoexec.bat script in OpenBeken to safely control a skylight or roller shutter without powering both relays at once?

Write aliases that stop all movement before energizing Open or Close. The shared script used Set_Stop to set channels 1, 2, and 3 to 0, then Set_Open or Set_Close. It added stopAllScripts before each new motion. Channel 60 stored the movement time, set to 15 s in the example. The script hid default GUI channels because they could switch both relays on together. [#20547099]

What is autoexec.bat in OpenBeken, and where do I place it on a Teekar or DS-151 shutter switch?

autoexec.bat is the OpenBeken startup script file used to define aliases, buttons, event handlers, and relay logic. "autoexec.bat is a device-side startup script that runs OpenBeken commands automatically, letting the switch create safe Open, Stop, and Close behavior after boot." The thread points Teekar and DS-151 users to the OpenBeken autoexec tutorial for placement and upload details. [#21213675]

How do I connect an OpenBeken curtain switch to Home Assistant using MQTT and create Open, Stop, and Close dashboard buttons?

Configure MQTT in OpenBeken with broker IP, port, user, password, and client topic such as skylight. Copy the generated YAML into Home Assistant configuration.yaml. Then create dashboard buttons that call mqtt.publish. The working card published to cmnd/skylight/Start_Opening, cmnd/skylight/Stop_All, and cmnd/skylight/Start_Closing. That approach calls script aliases instead of raw relay states. [#20547099]

Why is it dangerous to control OpenBeken shutter relays directly through MQTT, and how can MQTT commands trigger Start_Opening, Stop_All, and Start_Closing instead?

Direct MQTT relay control is dangerous because it can turn both direction relays on at once. That can damage the motor or switch. Users reported raw channel MQTT only exposed relay behavior, not the scripted logic. Use command topics that call the aliases instead: Start_Opening, Stop_All, and Start_Closing. In the working Home Assistant card, each button published to a cmnd/skylight/... topic. [#20664100]

How can a roller shutter or skylight controller estimate opening percentage from relay run time, and what causes position drift over time?

It can estimate position by timing relay run duration against calibrated full-travel times. For example, a 17 s actuator travel time makes 8.5 s approximately 50%. The thread warns this can drift because the script only knows how long the relay was on, not the true position. A stop halfway, manual movement, or limit cut-out can desynchronize the estimate. Resetting at 0% can reduce drift. [#20555187]

What safety checks are needed before using a time-based OpenBeken shutter script with skylights, blinds, or roller shutters?

Verify end-stop or stall protection before relying on timed relay control. The skylight actuator stopped gracefully at limits or when the motor stalled. The author warned users to ensure blinds have similar cut-outs. Also confirm the script never powers Open and Close together. Use an initial short time, such as 10 s or 15 s, before extending closing to 20 s. [#20555187]

How do I troubleshoot a DS-151 switch where Open or Close stays on and the Stop button does not respond after flashing OpenBeken?

Add the required autoexec.bat script before testing shutter behavior. A user reported Open or Close staying on and Stop not responding with the listed DS-151 pin settings. The fix was not a new pin map. Another participant identified the missing autoexec.bat entries as the cause. After adding the script, the user confirmed it worked perfectly. [#20871172]

How do I use Tuya config extraction in OpenBeken to fix pin mappings on a DS-151 with a CB3S or BK7231N chipset?

Use Tuya config extraction first when a CB3S or BK7231N DS-151 behaves differently from the WB3S template. The thread shows a CB3S unit improved after importing the extracted Tuya configuration. The extracted JSON included module: CB3S, bt1_pin: 24, bt2_pin: 20, bt3_pin: 7, rl1_pin: 6, and rl3_pin: 8. [#21752890]

What does the OpenBeken log message “Button_OnLongPressHold” on pin 8 mean on a DS-151 BK7231N curtain switch?

It means OpenBeken sees pin 8 as a button held continuously. The maintainer explained that a permanent short to ground would produce that log when the pin is configured as a button. On the reported BK7231N DS-151, close and stop did not respond. The suggested next step was Tuya config extraction, then PCB tracing or multimeter checks if needed. [#21752395]

How can the physical button LED colors on a DS-151 or CB3S curtain switch be changed in OpenBeken when setButtonColor only affects logical web buttons?

The thread does not provide a confirmed method for changing physical LED colors. A CB3S user reported that physical LEDs stayed blue and changed to red during action. They tried setButtonColor in autoexec.bat, but it affected only logical OpenBeken web buttons. No later post in the supplied thread gives a working physical LED color command or driver setting. [#21752890]

What would a proper OpenBeken C shutter or cover driver need to support for Home Assistant discovery, cover entities, position control, WiFi status, uptime, and LED preferences?

A proper driver would need interlocked Open and Close relays, Stop handling, travel timers, percentage position, and Home Assistant cover discovery. Users requested 3 physical buttons, 3 LEDs, WiFi status, uptime, LED on/off preference, and native cover entities instead of 3 relay entities. One user also listed a 2-minute default movement countdown and a 15 ms delay when reversing direction. [#20640181]
Summary generated by AI based on the discussion content.
ADVERTISEMENT