logo elektroda
logo elektroda
X
logo elektroda

QS-WIFI-S10-C04 Roller Shutter Module with T1-M WiFi (BK7238) - Flashing and Automation

Hamalaon 540 9
ADVERTISEMENT
  • #1 21850663
    Hamalaon
    Level 5  
    Today I have flashed a wifi roller shutter module, also known as curtain module.

    The device model is QS-WIFI-S10-C04, but it is different from this one.
    It looks like upgraded revision with thinner case and different wifi module.

    Tuya Mini Wi‑Fi Curtain Module with terminal diagram and green screw terminal block

    Generally, it has a built-in button, wifi LED, two 220 switch inputs and two relays.
    Here is a wiring diagram for reference:

    Wiring diagram with L and N lines, a switch, motor M, and terminal connections inside a device housing
    Active signal on external buttons is LOW, while it is triggered by phase to the external contact.
    External buttons are probably made high voltage to allow the use for longer wires.

    Here is what inside:
    Opened Wi‑Fi curtain control module with exposed PCB and labeled white housingClose-up of a PCB with two relays, electrolytic capacitors, and a green screw terminal block Close-up of a PCB with a screw terminal block, two relays, and capacitors


    Wifi module is T1-M.
    Flashing procedure is very human - unsolder the module and flash it with GUI Tool.
    TX RX are not connected and it will probably flash without removing module.
    Config seems to be encrypted and nothing has been automatically extracted, so I had to debug the pinout.

    Small PCB with soldered wires and pin labels 3V3, GND, RX1, TX1, P9, P24

    Here goes the template:
    {
      "vendor": "Tuya",
      "bDetailed": "0",
      "name": "WIFI Roller shutter with automation",
      "model": "QS-WIFI-S10-C04",
      "chip": "BK7238",
      "board": "TODO",
      "flags": "0",
      "keywords": [
        "roller",
        "shutter",
        "curtain"
      ],
      "pins": {
        "6": "dInput;13",
        "8": "WifiLED_n;0",
        "9": "Rel;1",
        "24": "Rel;2",
        "26": "dInput;12"
      },
      "command": "",
      "image": "https://obrazki.elektroda.pl/7311259500_1772256606.png",
      "wiki": "https://www.elektroda.com/rtvforum/viewtopic.php?p=21850663"
    }


    But thats not all.
    Each relay is independent and we can enable them by buttons, but we need to implement the protection against enabling accidently two at once.
    Also it is not very human to hold the button - thats why we need the timers to hold relay enabled for a while, then disable it.

    My roller has stupid mechanical endstops at the ends and different drives for up and down direction.
    It is ok if the relay stays on slightly longer than needed to fully open/close.

    Here is autorun to make it happen:
    
    // State machine
    //0: stopped/unknown position
    //1: opening
    //2: closing
    //3: stopped/opened
    //4: stopped/closed
    
    // dn btn
    SetPinChannel 6 13
    SetPinRole 6 dInput
    
    // up btn
    SetPinChannel 26 12
    SetPinRole 26 dInput
    
    // up relay
    SetPinChannel 9 1
    SetPinRole 9 Rel
    
    // dn relay
    SetPinChannel 24 2
    SetPinRole 24 Rel
    
    // led
    SetPinChannel 8 0
    SetPinRole 8 WifiLED_n
    
    // state
    setChannelType 43 ReadOnly
    ClampChannel 43 0 4
    SetChannelVisible 43 0
    setChannelLabel 43 State 1
    
    
    // Logic
    alias goto-opening-then-opened backlog cancelRepeatingEvent 1; cancelRepeatingEvent 2; setChannel 2 0; setChannel 1 1; setChannel 43 1; addRepeatingEventID 20 20 1 goto-opened
    alias goto-opened backlog cancelRepeatingEvent 1; setChannel 1 0; setChannel 43 3
    
    alias goto-closing-then-closed backlog cancelRepeatingEvent 1; cancelRepeatingEvent 2; setChannel 1 0; setChannel 2 1; setChannel 43 2; addRepeatingEventID 20 20 2 goto-closed
    alias goto-closed backlog cancelRepeatingEvent 2; setChannel 2 0; setChannel 43 4
    
    alias goto-stop backlog cancelRepeatingEvent 1; cancelRepeatingEvent 2; setChannel 1 0; setChannel 2 0; setChannel 43 0
    
    
    // ext up dn buttons
    alias btn-open if $CH43==0||$CH43==2||$CH43==4 then goto-opening-then-opened else btn-open-cancel
    alias btn-open-cancel if $CH43==1 then goto-stop
    addChangeHandler Channel12 == 0 btn-open
    
    alias btn-close if $CH43==0||$CH43==1||$CH43==3 then goto-closing-then-closed else btn-close-cancel
    alias btn-close-cancel if $CH43==2 then goto-stop
    addChangeHandler Channel13 == 0 btn-close
    
    
    // Hide default web buttons
    setChannelVisible 1 0
    setChannelVisible 2 0
    
    // web up dn buttons
    startDriver httpButtons
    setButtonEnabled 41 1
    setButtonLabel 41 Up
    setButtonEnabled 42 1
    setButtonLabel 42 Down
    
    setButtonCommand 41 btn-open
    setButtonCommand 42 btn-close
    
    
    // stop on boot
    addEvent 1 goto-stop


    I have improved scripts from another posts to work fine for me.
    However here is still a room for improvement.
    I want to make button response time instant. Right now it takes about half a second for button to trigger. I dont know currently more optimal functions - maybe there should be some kind of interrupts.
  • ADVERTISEMENT
  • #2 21850681
    DeDaMrAz
    Level 22  
    Hamalaon wrote:
    I want to make button response time instant. Right now it takes about half a second for button to trigger.


    Try to activate flag 6 in the config and report if the trigger feels better?
  • #3 21850900
    Hamalaon
    Level 5  
    >>21850681
    Yep, it feels much better. Thank you.
  • ADVERTISEMENT
  • #4 21851125
    p.kaczmarek2
    Moderator Smart Home
    Nice script, but we have internal Shutters driver in OBK now. Have you tried it?
    Smartphone screen showing “Shutters Controls Section” with Open, Shut, and Stop buttons
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #6 21851426
    p.kaczmarek2
    Moderator Smart Home
    I've merged shutters driver into main tree, but it's disabled by default. Here is enabled build:
    https://github.com/openshwprojects/OpenBK7231T_App/pull/2013
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #7 21851468
    Hamalaon
    Level 5  
    >>21851426
    Good. How can I download any of these files?

    Screenshot of an “Artifacts” list showing OpenBK7231T file names and sizes in MB.
  • #9 21852097
    Hamalaon
    Level 5  
    Today I found out that login may be required to download from github.

    I have tested the new Shutters driver and from UI it works fine.

    Screenshot of “smartcurtain1” with shutter calibration and control sections and Open/Stop/Close buttons

    With updated pin roles the template looks like this:
    {
      "vendor": "Tuya",
      "bDetailed": "0",
      "name": "Full Device Name Here",
      "model": "enter short model name here",
      "chip": "BK7238",
      "board": "TODO",
      "flags": "64",
      "keywords": [
        "TODO",
        "TODO",
        "TODO"
      ],
      "pins": {
        "6": "BtnShutterUp;1",
        "8": "WifiLED_n;0",
        "9": "ShutterA;1",
        "24": "ShutterB;1",
        "26": "BtnShutterDown;1"
      },
      "command": "",
      "image": "https://obrazki.elektroda.pl/YOUR_IMAGE.jpg",
      "wiki": "https://www.elektroda.com/rtvforum/topic_YOUR_TOPIC.html"
    }


    Also works with HA
    Screenshot of a smart home app showing “Garage” with status “Closed”.

    The calibration thing does not work instantly after driver start, so I added a delay before it.
    startDriver Shutters
    delay_s 1
    ShutterCalibrate 1 19 19


    Wired buttons are not functional however. Seems like driver not getting it.

Topic summary

✨ The discussion centers on flashing and automating the QS-WIFI-S10-C04 roller shutter (curtain) module, which features a thinner case and a T1-M WiFi module (BK7238) compared to previous versions. The device includes a built-in button, WiFi LED, two 220V switch inputs, and two relays. External buttons operate with an active LOW signal triggered by phase voltage, suitable for long wiring runs. The flashing process involves unsoldering the T1-M WiFi module. Configuration adjustments, such as enabling flag 6, improve trigger responsiveness. Additionally, an internal Shutters driver is now available in OBK firmware, offering an alternative automation solution.
Generated by the language model.
ADVERTISEMENT