FAQ
TL;DR: With 8 mapped GPIOs and one simple script, you can flash a BK7231N/CB3S-based LoraTap SC400W-EU without fully desoldering the board; as one expert reply put it, "We have a new working native driver for shutters" if you want a cleaner alternative later. This FAQ helps OpenBeken users wire, flash, script, and tune shutter control. [#21856035]
Why it matters: This thread turns a hard-to-open Tuya curtain switch into a documented OpenBeken workflow, including pin mapping, LED behavior, MQTT control, and the path from script hacks to native shutter support.
| Approach |
What it does |
Main advantage |
Main limit |
autoexec.bat script |
Recreates Open/Stop/Close logic and timers |
Works now on SC400W-EU |
Percentage control is manual to design |
| GPIO remapping |
Changes LED behavior and adds LED toggle control |
Fast hardware-aware customization |
Cannot create colors the PCB cannot drive |
| Native shutter driver |
Adds dedicated shutter logic |
Better fit for 0–100% control |
Arrived later and needs testing per device |
Key insight: Start with the proven SC400W-EU pin template and autoexec.bat, then move to the native shutter driver only if you need cleaner percentage-based control. The hardware wiring, especially LED and UART layout, decides what is possible. [#20795168]
Quick Facts
- The working SC400W-EU OpenBeken template maps 8 pins: P6, P7, P8, P9, P14, P23, P24, and P26 for WiFi LED, buttons, LEDs, and relays. [#20795168]
- The original script improved factory-like timing by changing auto-off from 120 s to 60 s and the reset indicator from 2 s to 1 s. [#20795168]
- A later Home Assistant-friendly version exposes channel 4 as "Open/Close Duration" with a default of 30 s instead of the earlier 60 s example. [#20988845]
- One user reported the LoraTap unit cost about $17 from the brand store on AliExpress, showing this is a low-cost shutter platform. [#20796938]
- WSL builds succeeded after installing lib32z1 and python-is-python3; Cygwin also worked, while WSL initially failed for another participant. [#20994640]
How do I open and flash a LoraTap SC400W-EU with a BK7231N/CB3S module when the board pins are soldered and hard to desolder?
Open it by lifting the board instead of fully removing the soldered pin header. Then solder only RX and TX directly to the CB3S pads, and feed power to the two extreme board pins where GND is on the left, the same side as the OPEN button. To enter flashing mode, short GND to CEN. This avoids desoldering the whole switch assembly and was reported to work on the SC400W-EU with a BK7231N-based CB3S module.
[#20795168]
Which RX, TX, VCC, GND, and CEN connections are needed to put the CB3S module on a LoraTap SC400W-EU into flashing mode?
You need RX and TX on the CB3S module pads, VCC and GND on the two extreme board pins, and a temporary short from GND to CEN to enter flashing mode. The thread states GND is on the left side, matching the OPEN button side. The author powered the board from those outer pins and did not rely on automatic pin detection in the flashing app. That manual wiring was enough to flash the device successfully.
[#20795168]
What is the correct OpenBeken pin template for the LoraTap SC400W-EU, including the button, relay, and LED mappings?
The working template is: P6
WifiLED_n;0, P7
Btn;2, P8
LED_n;2, P9
Btn;1, P14
Rel;3, P23
Btn;3, P24
LED;3, and P26
Rel;1. That maps three buttons, two relay outputs, and indicator LEDs for the SC400W-EU. A later LED-focused variant changed P6 to
Rel_n;0 and P24 to
LED_n;3, but the first published template is the baseline mapping for flashing and initial setup.
[#20795168]
How can I use autoexec.bat in OpenBeken to recreate the original LoraTap shutter logic with Open, Close, Stop, and auto-reset timers?
Use
autoexec.bat to label channels 1, 2, and 3 as Close, Stop, and Open, then add change handlers that cancel opposite actions and start timed reset scripts. 1. Create aliases such as
Reset_Stop_Open and
Reset_Close_Open. 2. Attach
addChangeHandler rules so Channel1 and Channel3 auto-start timer scripts. 3. Use
delay_s 60 for open and close, and
delay_s 1 for stop reset. This reproduces the switch logic and prevents both directions staying active together.
[#20795168]
What is the difference between LED, LED_n, WifiLED, and WifiLED_n in OpenBeken IO roles?
LED follows a linked channel, while
LED_n follows the same channel with inverted logic.
WifiLED shows Wi-Fi state, and
WifiLED_n shows the same status with inverted polarity.
"IO role" is a per-GPIO function assignment that tells OpenBeken what a pin should do and whether its logic is normal or inverted. The thread also notes these roles only drive high or low states, so they do not create arbitrary colors unless the PCB already supports multiple LED paths.
[#20977537]
How can I change the touch button LED behavior or color indication on a LoraTap SC400W-EU by remapping GPIO roles in OpenBeken?
Change the LED-related pin roles and linked channels, then test in GPIO Doctor. One user switched to this working LED setup: P6
Rel_n;0, P8
LED_n;2, and P24
LED_n;3. That reversed the visible color behavior on the touch buttons and made the front-panel indication match the desired state better. The key limit is hardware: if the PCB exposes only one LED path per button, remapping can invert or swap behavior, but not invent a new color.
[#20978313]
Why does changing P6 from WifiLED_n to Rel_n on the SC400W-EU let me add a separate button to turn the switch LEDs on and off?
Because
Rel_n binds P6 to a normal user channel instead of automatic Wi-Fi status logic. With
WifiLED_n, OpenBeken controls that pin from connection state and you cannot toggle it manually. After changing P6 to
Rel_n;0, one user added a dedicated channel and exposed it in Home Assistant as a separate LED on/off control. That turned the front LEDs into a scriptable output instead of a fixed network indicator.
[#20978313]
How do I expose the shutter open/close duration as a configurable field in OpenBeken and control it from Home Assistant over MQTT?
Move the fixed delay into channel 4 and use
delay_s $CH4 instead of
delay_s 60. Then set
SetChannelLabel 4 "Open/Close Duration",
SetChannelType 4 TextField,
setStartValue 4 -1, and a default like
if $CH4==0 then setChannel 4 30. A user confirmed this worked and then pushed new values from a Home Assistant
input_number through MQTT publish automation. That made the duration adjustable without editing the script again.
[#20988845]
Where can I read about OpenBeken scripting, GPIO roles, and example autoexec.bat files for shutters and similar devices?
Read the links shared in the thread to the OpenBK7231T_App documentation. The GPIO role reference was linked under
docs/ioRoles.md, and script examples were linked under
docs/autoexecExamples.md. The discussion explicitly points new users to those two files when explaining
LED,
LED_n,
WifiLED_n, channel logic, and timed scripts. Those references are the thread’s main documentation path for OpenBeken scripting and pin-role behavior.
[#20988420]
What is TuyaMCU, and how does it affect flashing and configuring a curtain switch that has a separate MCU connected over UART?
TuyaMCU is a secondary microcontroller that handles device features and talks to the Wi-Fi module over UART using dpIDs and commands. If RX and TX from the Wi-Fi module are wired to that MCU, the switch is a TuyaMCU design and configuration changes differ from a simple GPIO-only device. In that case, flashing OpenBeken is still possible, but you must also identify the UART relationship and often configure TuyaMCU-specific behavior instead of only mapping pins.
[#21109644]
How do I find the correct Tuya dpId for a curtain switch parameter like running time if I want to preserve Tuya-style control instead of replacing it with autoexec.bat logic?
First confirm the switch actually uses TuyaMCU, then inspect TuyaMCU traffic or use the dedicated TuyaMCU guide linked in the thread. The discussion never identifies a confirmed dpId for the running-time field on this SC400W-EU, so the practical answer in-thread was to replace that feature with channel-based
autoexec.bat logic. This is an important edge case: if you cannot see or decode the UART parameter, you cannot preserve the Tuya control field reliably.
[#21109644]
What is GPIO Doctor in the OpenBeken web app, and how can it help identify LEDs, buttons, and relays on a LoraTap switch?
GPIO Doctor is an OpenBeken web-app tool for probing GPIO behavior and testing pin roles interactively. The thread recommends it to discover whether more LEDs exist than the template shows and to experiment safely with LED inversions and channel links. One user used the GPIO finder workflow to reach a working LED configuration for P6, P8, and P24. It is especially useful when the PCB differs from the published SC400W-EU mapping.
[#20978313]
OpenBeken autoexec script vs a native shutter driver — which approach is better for percentage-based blind control on LoraTap switches?
Use
autoexec.bat for immediate results, but prefer the native shutter driver for cleaner 0–100% control. The thread shows scripts work well for Open, Close, Stop, timers, and MQTT-exposed duration fields, but percentage logic quickly becomes complex. Later, the maintainer stated, “We have a new working native driver for shutters,” which makes the driver path the better long-term choice when your firmware supports it. For quick deployment, script first; for maintainability, move to the driver.
[#21856035]
How can I implement or test percentage slider control for shutters in OpenBeken so Home Assistant can set the blind position from 0 to 100%?
Implement it by separating full-travel time from current position. The thread’s proposed logic uses one channel for full open/close duration, another for current or saved position, and a
Slider-type channel with a 0–100 range as the target. Then the script normalizes the requested change and runs open or close long enough to move that percentage. A later shared script used channels 9, 10, and 11 for saved, current, and target position, plus channels 20–22 for Down, Stop, and Up controls.
[#21484624]
What causes OpenBK7231T_App builds to fail under WSL, and how do lib32z1, python-is-python3, line endings, Cygwin, and Docker compare as build options?
WSL failed for two concrete reasons in the thread: missing
lib32z1 and missing
python-is-python3. One user also hit
/bin/sh^M: no such file or directory, which points to Windows CRLF line endings. After installing both packages, the WSL build succeeded. Another participant reported WSL still failed on their side and recommended Cygwin as the proven option, while also noting an alternative Docker build system existed in the repository. This makes Cygwin the known-good path and WSL workable after fixes.
[#20994640]
Generated by the language model.
Comments
Thank you, that's a very detailed guide. I've added this device to our teardowns list. Regarding shutters, I am planning to make dedicated driver for that soon, but I dont know when I will get enough... [Read more]
It would be great to have roller blind controller logic that can be run on the cheapest buttons you can get for a few dollars at AliExpress Choice. For example, this LoraTap device costs about $17 at the... [Read more]
Hi, Thank you for a detailed instructions. I've used these instructions and succeeded to operate the switch with my blinds. I was wondering if there is an option to control the switch LEDs. Currently,... [Read more]
It depends on how LEDs are connected. The template was mentioned in the first post: P6 (PWM0) "WifiLED_n;0" P7 (PWM1) "Btn;2" P8 (PWM2) "LED_n;2" P9... [Read more]
Thanks for your reply. I actually don't know the difference between all these LEDs types that you mentioned (LED, LED_n, and WifiLED_n). Where can I read what it means? My LoraTap switch has 3 touch... [Read more]
IO docs: https://github.com/openshwprojects/OpenBK7231T_App/blob/main/docs/ioRoles.md LED is on when linked channel is on, LED_n has inverted state (it's on when channel is off), WiFILED shows WiFi state,... [Read more]
I managed to switch the LED color by playing with it in GPIO finder. The correct configuration for me is: "pins": { "6": "Rel_n;0", "7":... [Read more]
I have noticed that the switch supports running time parameter which configures how much time the switch will be opened/closed. I understand that we can imitate this field using the autoexec.bat file... [Read more]
Any help would be appreciated!!! [Read more]
Which channel stores this value in autoexec.bat ? You can set any channel via MQTT with set topic: https://obrazki.elektroda.pl/2778138100_1709458059_thumb.jpg [Read more]
Hi, The autoexec.bat does not contain channel which stores the value. This is the autoexec.bat: // P26 - Relay 1 Close // P7 - Btn 2 Stop // P14 - Relay 3 Open // P6 - Led backlight // description SetChannelLabel... [Read more]
So, to which delay from this script are you referring to? Are you referring to this one minute delay: // wait 60 seconds delay_s 60 The following delay appears twice in the code. If that's the... [Read more]
Yes this is the delay I was referring to. The desired solution is to have and in home assistant that will control this value. When the user changes the in home assistant it will change the value in... [Read more]
If you want to have this as an input number, then you need to do the following. 1. change all: // wait 60 seconds delay_s 60 to // wait $CH4 seconds delay_s $CH4 so it uses value of... [Read more]
This worked!!! I linked this field to home assistant using automation on any change to an input number I defined which eventually calls MQTT publish with the input number value. This works perfectly. Here... [Read more]
Well, the LEDs are defined in the "Configure module" tab and there is a field to enter a linked channel number, see an example below: https://obrazki.elektroda.pl/7489322900_1709491903_thumb.jpg ... [Read more]
Yes the LED is on P6. OK now I understand how to set a channel. I managed as you showed me to add channel for the LED and called it light. Now I have a button in Home Assistant to toggle the switch LEDs.... [Read more]
There are two ways to control LEDs. - first way is to assign a LED (or a LED_n, which is inversed LED) role and a channel, then LED will follow the channel and will be scriptable and controllable by user -... [Read more]
That worked (setting it as LED_n), assigning a channel and adding the channel to the autoexec.bat script. The perfect solution for me is to have both the wifi indication and to be able to control it. How... [Read more]