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.
AI summary based on the discussion. May contain errors.
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. 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. . 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!
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.
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
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
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.
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.
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.
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.
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!
About Author
richardsg307 wrote 18 posts with
rating 6 .
Been with us since 2023 year.
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... [Read more]
Nanganator
25 Apr 2023 00:29
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... [Read more]
p.kaczmarek2
25 Apr 2023 08:37
@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... [Read more]
Nanganator
25 Apr 2023 10:48
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... [Read more]
richardsg307
25 Apr 2023 19:08
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... [Read more]
PSlowik
25 Apr 2023 22:22
I have identical drivers, so I'm also thinking about going to OpenBeken [Read more]
Acefx
02 Jul 2023 18:26
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... [Read more]
p.kaczmarek2
03 Jul 2023 06:16
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,... [Read more]
Acefx
03 Jul 2023 11:12
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... [Read more]
p.kaczmarek2
03 Jul 2023 12:06
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... [Read more]
Acefx
03 Jul 2023 13:18
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... [Read more]
marnypopis1
11 Jul 2023 15:11
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... [Read more]
Acefx
22 Jul 2023 20:06
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... [Read more]
marnypopis1
24 Jul 2023 14:43
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... [Read more]
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... [Read more]
marnypopis1
24 Jul 2023 21:31
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... [Read more]
Acefx
25 Jul 2023 08:52
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.... [Read more]
Romanusss
21 Dec 2023 09:29
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.
https://obrazki.elektroda.pl/8867022900_1703146971_thumb.jpg... [Read more]
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.
Solder TXD1, RXD1, GND, and VCC.
Use a 3.3 V USB/UART adapter and cut interfering tracks if flashing fails.
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]
AI summary based on the discussion. May contain errors.
Comments
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... [Read more]
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... [Read more]
@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... [Read more]
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... [Read more]
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... [Read more]
I have identical drivers, so I'm also thinking about going to OpenBeken [Read more]
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... [Read more]
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,... [Read more]
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... [Read more]
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... [Read more]
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... [Read more]
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... [Read more]
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... [Read more]
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... [Read more]
indeed ! [Read more]
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... [Read more]
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... [Read more]
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.... [Read more]
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. https://obrazki.elektroda.pl/8867022900_1703146971_thumb.jpg... [Read more]