logo elektroda
logo elektroda
X
logo elektroda

Roller shutter Etersky WF-CS01 : CB3S and WB3S pin mapping and scripts

benjaminklamerek 2472 33
ADVERTISEMENT
  • Helpful post
    #1 21006126
    benjaminklamerek
    Level 1  
    Hello,

    First, thank you for your work.

    Based on all the useful information that I found in this topic https://www.elektroda.com/rtvforum/topic3972935.html + github docs, I did scripts to adapt Etersky WF-CS01 device.

    I don't have good images, but this is the same device as mentioned here : https://www.elektroda.com/rtvforum/topic4007022.html

    The main problem that I had is that over the years, the constructor used many different cards !
    I have found devices with TYWE3S (used Tasmota for these), CB3S and WB3S.

    I also discovered that CB3S and WB3S don't have the same pin mapping (maybe the mapping is more related to the date/version labels that you can find in the device, I'm not sure)

    CB3S pin mapping :

    Code: Arduino
    Log in, to see the code


    WB3S pin mapping :

    Code: Arduino
    Log in, to see the code


    I also tried (based on that I found in this forum) to create scripts that will mostly replicate the initial behavior :
    - LEDs are blue by default
    - LED is red when relay is activated (or stopping)
    - Up, middle and down buttons are for open, stop and close (in this order)
    - Both relays cannot be activated at the same time (sadly with MQTT, if you update directly the channel values this is possible)

    Other features :
    - Thank to the community, MQTT commands can use script aliases to open and close shutters
    - Duration is controlled by a specific channel (4)
    - I wanted to add a more easiest way to activate AP safe mode so I added a channel for this : if you enter 10 times in a row stop button
    - in WB3S, there is channel 6 which is hardcoded to force green led shudown (the button 1 have a second LED)

    CB3S script :

    Code: Arduino
    Log in, to see the code


    WB3S script :


    Code: Arduino
    Log in, to see the code


    I could also create templates but the added value is, from my point of view, quite low because you need autoexec.bat script too. That's why I put PIN configuration directly in the script, not sure if it's a good practice.

    For flashing, I totally unsolder the CB3S/WB3S component. This is a sensitive operation (I already broke 2 devices) but I use one ESP burner like this one :
    ESP8266 programmer with pin connectors


    I'm using CB3S for more than a week now. WB3S is tested but not used yet in a "real" context.
  • ADVERTISEMENT
  • #2 21007064
    p.kaczmarek2
    Moderator Smart Home
    That's a very nice script, thank you for sharing! I will add this later to our autoexec.bat samples page:
    https://github.com/openshwprojects/OpenBK7231T_App/blob/main/docs/autoexecExamples.md

    CB3S and WB3S have indeed a slightly different pinouts. This is problematic and I already had this issue while making my BK7231 dev board:
    https://www.youtube.com/watch?v=xGE-DVrm3BU
    Helpful post? Buy me a coffee.
  • Helpful post
    #5 21285677
    dennis3
    Level 1  
    >>21006126 I made a better autoexec.bat script for the wb3s.

    
    // Set up Aliases
    alias Toggle_Backlight startScript autoexec.bat toggleBacklight
    // alias Btn_open backlog stopAllScripts; startScript autoexec.bat btnOpenAction
    // alias Btn_close backlog stopAllScripts; startScript autoexec.bat btnCloseAction
    // alias Btn_stop backlog stopAllScripts; startScript autoexec.bat btnStopAction
    alias Btn_open startScript autoexec.bat btnOpenAction
    alias Btn_close startScript autoexec.bat btnCloseAction
    alias Btn_stop backlog stopAllScripts; startScript autoexec.bat btnStopAction
    alias Initial_Button_Color backlog setButtonColor 1 blue; setButtonColor 2 blue; setButtonColor 3 blue
    alias Start_open startScript autoexec.bat DoOpenAction
    alias Start_close startScript autoexec.bat DoCloseAction
    alias Start_stop backlog stopAllScripts; startScript autoexec.bat DoStopAction
    alias All_LED_off backlog setChannel 8 0; setChannel 9 0; setChannel 10 0
    alias Http_Button_open backlog setButtonColor 1 red; setButtonColor 2 blue; setButtonColor 3 blue
    alias Http_Button_stop backlog setButtonColor 1 blue; setButtonColor 2 red; setButtonColor 3 blue
    alias Http_Button_close backlog setButtonColor 1 blue; setButtonColor 2 blue; setButtonColor 3 red
    
    //To make this component visible in Windows
    startDriver SSDP
    
    // create GUI buttons for HTTP panel
    startDriver httpButtons
    
    SetChannelLabel 1 UP 1
    SetChannelLabel 2 STOP 1
    SetChannelLabel 3 DOWN 1
    SetChannelLabel 4 DURATION 1
    SetChannelLabel 5 STOP_COUNT 1
    SetChannelLabel 7 BACKLIGHT 1
    SetChannelLabel 8 AUF 1
    SetChannelLabel 9 HALT 1
    SetChannelLabel 10 ZU 1
    
    SetChannelPrivate 1 1
    SetChannelPrivate 2 1
    SetChannelPrivate 3 1
    
    setButtonEnabled 1 1
    setButtonLabel 1 "Öffnen"
    setButtonCommand 1 Btn_open
    setButtonColor 1 blue
    
    setButtonEnabled 2 1
    setButtonLabel 2 "Halt"
    setButtonCommand 2 Btn_stop
    setButtonColor 2 blue
    
    setButtonEnabled  3 1
    setButtonLabel 3 "Schliessen"
    setButtonCommand 3 Btn_close
    setButtonColor 3 blue
    
    setButtonEnabled 6 1
    setButtonLabel 6 "Beleuchtung"
    setButtonCommand 6 Toggle_Backlight
    setButtonColor 6 blue
    
    // Hide the default GUI buttons
    setChannelVisible 1 0
    setChannelVisible 2 0
    setChannelVisible 3 0
    setChannelVisible 7 0
    setChannelVisible 6 0
    
    addEventHandler OnClick 24 Btn_open
    addEventHandler OnClick 10 Btn_stop
    addEventHandler OnClick 8 Btn_close
    addEventHandler OnHold 10 Toggle_Backlight
    AddChangeHandler Channel8 == 1 Start_open
    AddChangeHandler Channel9 == 1 Start_stop
    AddChangeHandler Channel10 == 1 Start_close
    
    // ---------------------- Inputs
    setPinRole 24 Btn
    setPinRole 10 Btn
    setPinRole 8 Btn
    
    // ---------------------- Outputs
    setPinRole 6 Rel
    setPinRole 7 Rel
    
    setPinRole 14 LED
    setPinRole 0 LED
    setPinRole 26 LED
    setPinRole 11 Rel
    setPinRole 1 WifiLED_n
    
    
    setPinChannel 6 1
    setPinChannel 14 8
    setPinChannel 7 3
    setPinChannel 0 10
    setPinChannel 26 9
    setPinChannel 11 7
    setChannelType 5 TextField
    setChannelType 4 TextField
    
    if $CH4>0 then goto btnStopAction
    setChannel 4 30
    goto btnStopAction
    
    return
    
    btnOpenAction:
    setChannel 8 1
    return
    
    btnStopAction:
    setChannel 9 1
    return
    
    btnCloseAction:
    setChannel 10 1
    return
    
    toggleBacklight:
    ToggleChannel 7
    if $CH7==0 then setButtonColor 6 blue
    if $CH7==1 then setButtonColor 6 green
    return
    
    DoOpenAction:
    if $CH10==1 then setChannel 8 0
    if $CH10==1 then return
    if $CH9==1 then setChannel 8 0
    if $CH9==1 then return
    
    setChannel 5 0
    Http_Button_open 
    delay_s 0.1
    setChannel 1 1
    delay_s $CH4
    setChannel 1 0
    Initial_Button_Color
    All_LED_off 
    return
    
    DoCloseAction:
    if $CH8==1 then setChannel 10 0
    if $CH8==1 then return
    if $CH9==1 then setChannel 10 0
    if $CH9==1 then return
    
    setChannel 5 0
    Http_Button_close
    delay_s 0.1
    setChannel 3 1
    delay_s $CH4
    setChannel 3 0
    Initial_Button_Color
    All_LED_off 
    return
    
    DoStopAction:
    addChannel 5 1
    if $CH5>9 then goto enterSafeMode
    
    setChannel 1 0
    setChannel 3 0
    setChannel 8 0
    setChannel 10 0
    
    Http_Button_stop
    delay_s 2
    Initial_Button_Color
    All_LED_off 
    return
    
    enterSafeMode:
    SafeMode 3
    return
    
  • #6 21758546
    Acefx
    Level 9  
    Hi, sorry to revive the subject, but I own a big batch of these.
    They were configured to work on Jeedom and working well.
    I'm now switching to Home Assistant, and it seems that with my config they appear as 3 relays and not as a Cover entity.
    Do you know why? Do I have to update firmware and add a flag/startup driver script?

    Thanks a lot
  • #7 21762063
    p.kaczmarek2
    Moderator Smart Home
    So you have this script working, but it does not appear in HA?
    Maybe we can figure something out.
    I've managed to get Cover entity to show up in HA, but I dont' have hadware to test it with physical device.
    Main Door control panel displaying Open state with directional control buttons.
    Helpful post? Buy me a coffee.
  • #8 21762120
    Acefx
    Level 9  
    Yes! I have plenty of hardware to test here.
    With the latest firmware to date, this is what I get in Home Assistant

    BK7231N device panel in OpenBK interface showing diagnostic and configuration data

    And in OpenBK firmware

    OpenBK interface showing control buttons and system parameters

    5 is the retrolighting of the command
    4 is the delay, calculated with a stopwatch.

    The good thing is that I don't have the relay anymore, because on the previous firmware I got

    MQTT interface showing BKT231N device info and shutter activity log
    which is pretty bad because it doesn't command "start opening / stop and start closing" but the relay itself, without any security.
    And you exactly know what occurs when a shutter motor is powered in both directions: destruction !
  • ADVERTISEMENT
  • #9 21762945
    Acefx
    Level 9  
    @p.kaczmarek2, Seems you have the solution, I'm dying for it :-) :-) :-)

    Thanks a lot
  • #10 21762948
    p.kaczmarek2
    Moderator Smart Home
    I just have code snippet to make it show in HA, but it is not integrated with autoexec bat from the first post.

    How good are you at scripting, would you be able to integrate it, with my help?
    Helpful post? Buy me a coffee.
  • #11 21762954
    Acefx
    Level 9  
    >>21762948
    I already made the script for the CB3S before it went official.
    So I'm comfortable with editing and following your guide/help

    Edit: editing an autoexec isn't a problem.
  • #12 21762983
    p.kaczmarek2
    Moderator Smart Home
    Oh that's good to hear, I've been actually waiting for someone to help us with that. Okay, give me a moment, I don't know, until tomorrow, and I will do basics on my side and give you guidance how to integrate it.
    Helpful post? Buy me a coffee.
  • #13 21762990
    Acefx
    Level 9  
    Ok, great.
    I'm not every day at the place where the device is, but I can manage to have an appointment for the programming/test on site.
    Keep me in touch.
  • #15 21767428
    p.kaczmarek2
    Moderator Smart Home
    We would need a C driver for best results, but currently, with latest OBK update, you can do something like that.
    Screenshot of JSON editor displaying configuration for Main Door sensor
    1 HA discovery JSON:
    
    {
      "dev": {
        "ids": [
          "WinTest_3145CAFF"
        ],
        "name": "WT3145CAFF",
        "sw": "Win_Test",
        "mf": "Microsoft",
        "mdl": "WIN32",
        "cu": "http://127.0.0.1/index"
      },
      "name": "Main Door",
      "~": "WindowsOBK",
      "avty_t": "~/connected",
      "uniq_id": "WinTest_00000000_sensor_0_Main_Door",
      "qos": 1,
      "unique_id": "Main Door",
      "device_class": "garage",
      "state_topic": "~/shutterState/get",
      "command_topic": "cmnd/WindowsOBK/backlog",
      "payload_open": "OPEN",
      "payload_close": "CLOSE",
      "payload_stop": "STOP",
      "state_open": "open",
      "state_closed": "closed"
    }
    

    2. autoexec stub:
    
    
    alias open echo "Your open handling"
    alias close echo "Your close handling"
    alias stop echo "Your stop handling"
    
    addEventHandler OnDiscovery 0 publishFile homeassistant/cover/WinTest_00000000_sensor_0_Main_Door/config d.json 1
    scheduleHADiscovery
    
    
    startDriver httpButtons
    setButtonEnabled 0 1
    setButtonLabel 0 "Send closed"
    setButtonCommand 0 "publish shutterState closed"
    
    setButtonEnabled 1 1
    setButtonLabel 1 "Send open"
    setButtonCommand 1 "publish shutterState open"
    

    HA should see:
    Main door control panel with MQTT branding and diagnostic data display
    if you press buttons in HA:
    Console with repeated MQTT debug messages showing packet receipt and command handling\
    If you press buttons in OBK:
    Event log from November 30, 2025 showing WT3145CAFF door opening and closing.
    Note that you need to edit json to have your mqtt device name:
    MQTT configuration screen with input form and device information

    Added after 36 [seconds]:

    This is basically a communication stub for HA, to be linked with existing script
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #16 21767511
    Acefx
    Level 9  
    Ok well noted, so d.json as is
    and for the autoexec.bat i need to add the code to mine ?

    Actually my autoexec . bat is like this :

    
    // 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 6
    Set_Stop
    return
    


    do i need to adapt it ?
  • ADVERTISEMENT
  • #17 21767517
    p.kaczmarek2
    Moderator Smart Home
    Well, I assumed that you are familiar with basic programming, but here are more hints:
    1. you need to adapt json file to is has your device topic and name
    2. you need to adapt your autoexec.bat , I basically did only communication with HA
    2.1 you need to adapt calls from HA, replace echo with your aliases:
    
    alias open echo "Your open handling"
    alias close echo "Your close handling"
    alias stop echo "Your stop handling"
    

    Comands "open", "close", "stop", must not change - that's what HA sends.
    2.2 to tell HA that shutter state is, for example, closed, you need to call publish shutterState closed in your code
    Helpful post? Buy me a coffee.
  • #18 21767557
    Acefx
    Level 9  
    Yes sorry my knowledge in this maybe more limited then i though. ;-(
    and i don't think i'm more advanced now , jajaja.

    I went to openbk with a simple flashing & an autoexec.bat injection and that was it.
    But i'm not against find a good solution.
    I'm going to investigate with what you said below, and maybe scream if i burn everything :-)

    i will be on place tomorrow to see.


    You say that a C driver would be better, for that kind of appliance also safer i think because operating dual way motor can be quite bad if the 2 relay are operated in the same time ( fire hazard )

    Keep you in touch
  • #19 21767587
    p.kaczmarek2
    Moderator Smart Home
    Well, you basically need just to locate two places in your code:
    - where you assign commands
    - where you detect states
    For commands, I can clearly see you have aliases like Start_Opening , etc.
    So you'd do:
    
    alias open Start_Opening 
    
    Helpful post? Buy me a coffee.
  • #20 21767773
    Acefx
    Level 9  
    Ok basicaly before testing, here what 'im planning to do :
    insert d.json
    {
      "name": "Etersky Volet",
      "unique_id": "etersky_volet_cover",
      "device_class": "shutter",
      "~": "etersky_volet",
      "command_topic": "~/backlog",
      "state_topic": "~/shutterState/get",
      "payload_open": "OPEN",
      "payload_close": "CLOSE",
      "payload_stop": "STOP",
      "state_open": "open",
      "state_closed": "closed",
      "availability_topic": "~/connected",
      "payload_available": "online",
      "payload_not_available": "offline"
    }


    And autoexec.bat :

    
    // Autoexec file for Etersky WS01 - HA MQTT Adaptation
    
    // --- Partie Communication Home Assistant ---
    // Ces alias font le lien entre la commande HA (OPEN) et ton script sécurisé (Start_Opening)
    alias OPEN Start_Opening
    alias CLOSE Start_Closing
    alias STOP Stop_All
    
    // Envoi de la configuration à HA au démarrage (Discovery)
    // Remplace 'etersky_volet' par le nom MQTT de ton appareil si besoin dans le chemin ci-dessous
    addEventHandler OnDiscovery 0 publishFile homeassistant/cover/etersky_volet/config d.json
    scheduleHADiscovery
    
    // --- Partie Configuration Matérielle et Alias ---
    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
    
    // Scripts de lancement (appellent les scripts sécurisés)
    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
    
    // --- Configuration Boutons Physiques ---
    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 (Boutons physiques)
    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
    
    // --- SCRIPTS SECURISE ---
    
    openSkylight:
    DWmouv_Stop
    delay_ms 5
    Set_Open
    setChannel 2 0
    setButtonColor 2 CornflowerBlue
    // Attente du temps de course défini par CH4
    delay_s $CH4
    Set_Stop
    Set_Finish
    // Informe HA que le volet est OUVERT
    publish shutterState open
    delay_s 2
    Set_Stop
    return
    
    closeSkylight:
    UPmouv_Stop
    delay_ms 5
    Set_Close
    setChannel 2 0
    setButtonColor 2 CornflowerBlue
    // Attente du temps de course défini par CH4
    delay_s $CH4
    Set_Stop
    Set_Finish
    // Informe HA que le volet est FERME
    publish shutterState closed
    delay_s 2
    Set_Stop
    return
    
    stopSkylight:
    Set_Stop
    Set_Finish
    // Si on stop, on ne sait pas la position exacte, HA restera sur le dernier état connu
    delay_s 6
    Set_Stop
    return
    



    seems right ?

    Added after 3 [minutes]:

    Also i've asked to Gemini if it was possible to pick the mqtt module name directly without the need of hard encoding it everytime.
    He gave me this solution : an fully autoexec.bat with AH discovery

    here it is

    
    // Autoexec file for Etersky WS01 - HA MQTT Adaptation (Dynamic)
    // Interlock de sécurité : 100% Actif
    
    // --- PARTIE COMMUNICATION HOME ASSISTANT (DYNAMIQUE) ---
    
    // On définit les commandes qu'attend HA
    alias OPEN Start_Opening
    alias CLOSE Start_Closing
    alias STOP Stop_All
    
    // Envoi de la découverte automatique SANS fichier json.
    // $mqtt_client sera remplacé automatiquement par le nom du module.
    addEventHandler OnDiscovery 0 publish homeassistant/cover/$mqtt_client/config {"name":"$mqtt_client","uniq_id":"$mqtt_client","~":"$mqtt_client","dev_cla":"shutter","cmd_t":"~/backlog","stat_t":"~/shutterState/get","pl_open":"OPEN","pl_cls":"CLOSE","pl_stop":"STOP","stat_o":"open","stat_c":"closed"}
    scheduleHADiscovery
    
    // --- PARTIE CONFIGURATION MATERIELLE ET ALIAS ---
    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
    
    // Scripts de lancement
    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
    
    // --- CONFIGURATION BOUTONS PHYSIQUES ---
    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
    
    // Cache les boutons par défaut
    setChannelVisible 1 0
    setChannelVisible 2 0
    setChannelVisible 3 0
    
    // Event Handlers (Boutons physiques)
    addEventHandler OnClick 7 Start_Closing
    addEventHandler OnClick 24 Start_Opening
    addEventHandler OnClick 10 Stop_All
    
    // Stop au démarrage
    goto stopSkylight
    return
    
    // --- SCRIPTS SECURISES (INTERLOCK) ---
    
    openSkylight:
    DWmouv_Stop
    delay_ms 5
    Set_Open
    setChannel 2 0
    setButtonColor 2 CornflowerBlue
    delay_s $CH4
    Set_Stop
    Set_Finish
    publish shutterState open
    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
    publish shutterState closed
    delay_s 2
    Set_Stop
    return
    
    stopSkylight:
    Set_Stop
    Set_Finish
    delay_s 6
    Set_Stop
    return


    not sure about the result, will test .
    IA gave me some headache when it comes to coding, since i'm a pretty bad dev ;-)

    Added after 4 [hours] 2 [minutes]:

    Ok i tried many things today but i can't either make it recognize as a cover , and still operate it "per relay " which is pretty bad in term of self destruction.
    I'm going to need some more help ( if possible )
  • #21 21768003
    p.kaczmarek2
    Moderator Smart Home
    I don't think that AI is reliable source of information.

    I'd suggest to first try to get it working with hardcoded MQTT name, I can make it flexible later.

    Also, set channels as hidden so they don't get discovered along with cover entity.

    My first question is - did you manage to get cover entity discovery working?
    Helpful post? Buy me a coffee.
  • #22 21768019
    Acefx
    Level 9  
    Your're totaly right, IA is completly out of subject, going in wrong direction. and i'm lost !

    Let do it step by step.
    1. the d.json is on the module

    the initial autoexec ( mine ) isn't edited and is here :
    
    
    // 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 6
    Set_Stop
    return
    


    Next ?

    Added after 6 [minutes]:

    >>21768019

    My Mqtt topic is

    MQTT Topic: Shutter_02
    Device Short Name: Shutter_02
  • #23 21768046
    p.kaczmarek2
    Moderator Smart Home
    Adjust d.json to match your device name and mqtt topic.

    Then paste my autoexec.bat content here and do hass discovery:
    Screenshot of code with three addEventHandler functions and a red arrow pointing at one.

    Then, maybe, hide the relays you mentioned from HA with SetChannelPrivate command in your script. When you retry discovery, just to be sure, remove old device discovered by HA
    Helpful post? Buy me a coffee.
  • #24 21768056
    Acefx
    Level 9  
    Ok, following your hint, I still have the channel visible in MQTT Explorer so I may have placed the
    SetChannelPrivate at the wrong place/syntax

    I added:
    SetChannelPrivate 1
    SetChannelPrivate 2
    SetChannelPrivate 3
    SetChannelPrivate 4

    Is it the right way to do it?

    Added after 35 minutes:

    Update,
    I think the autoexec with the cover routine is messing everything up.
    Even when renaming all the MQTT topics and names, I get the 5 raw relays straight to Home Assistant after the HA discovery procedure.

    If you don't have time to rewrite the script cleanly (even the one that makes the cover work), I will do it with some HTTP API calls as before.
    I think I don't have the knowledge to insert some code inside a script whose function I barely understand.

    If you have time to rewrite something I can test it on all the devices I have here, if not: thanks for the effort.
  • #25 21768119
    p.kaczmarek2
    Moderator Smart Home
    https://github.com/openshwprojects/OpenBK7231T_App/blob/main/docs/commands.md
    Documentation table showing SetChannelPrivate command and its description
    This command requires two arguments, second should be 1 to set channel to private to hide it.

    Added after 3 [hours] 16 [minutes]:

    I found another issue - you didn't have OnHaDiscovery event - so you didn't test my autoexec itself before jumping to editing... it should be working in upcoming update (from releases)
    Helpful post? Buy me a coffee.
  • #26 21768614
    Acefx
    Level 9  
    Ok, I had some time working a bit on this (what a pain).

    After all my integration & test
    I succeeded understanding the autoexec
    I succeeded understanding the backlog concept
    I succeeded hiding the "Raw" relay to let only the logic command.
    I succeeded hiding it from Home Assistant MQTT

    I also succeeded in sending the Home Assistant discovery @ start... But it's not sending it with the good prefix
    I find it inside the device topic (instead of root). Any idea for this? I think it's the last problem


    Edit: Not really the last one, are you aware of another bug? When I browse into the "flag" section of the firmware, it starts to load then freezes the module (unresponsive) for approx 20 to 30 min then comes back to life.

    Added after 56 [minutes]:

    Re-Edit.
    My d.json was somewhere faulty, now I can get a correct publishing in Home Assistant topic, and a cover entity that calls the correct backlog. Pain Pain Paiinnnn
    Next step is certainly the publishing of the shutter state, after each move / stop so I can get correct information.

    Seems there is also a big mismatch between names:
    MQTT topic / shortname has to be the same ...

    My state @ the end of the night is that I finally got an entity for the shutter, with the correct command (not yet the state update)
    but for now I got the modules on another side...
  • #27 21768743
    p.kaczmarek2
    Moderator Smart Home
    I can try to add an automatic method for device mqtt name today or later and we'll do improved version.... so now you need to publish device state for HA
    Helpful post? Buy me a coffee.
  • #28 21768873
    Acefx
    Level 9  
    Ok so i managed to get these info, pretty everything that we need to command it
    BK7231N device control panel with diagnostics and recent activity sections

    Diagnostic informations are transmitted only when the flag [2] is activated
    by the way, the flag ui page display under certain circonstance freeze the module for approx 20 minutes.

    Actually the code is this :
    Autoexec.bat
    
    
    // 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
    
    // Définit le texte qui s'affiche à côté
    setChannelLabel 4 "Shutter travel time (sec)"
    
    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
    
    SetChannelPrivate 1 1
    SetChannelPrivate 2 1
    SetChannelPrivate 3 1
    
    // Loading Event Handlers
    addEventHandler OnClick 7 Start_Closing
    addEventHandler OnClick 24 Start_Opening
    addEventHandler OnClick 10 Stop_All
    
    // --- INSÉRER LE BLOC HOME ASSISTANT ICI ---
    
    addEventHandler OnDiscovery 0 publishFile homeassistant/cover/openbeken/config d.json 1
    scheduleHADiscovery
    
    
    // Déclaration du fichier de config pour Home Assistant
    //addEventHandler OnDiscovery 0 publishRaw homeassistant/cover/VOLETS_02/config d.json
    
    // Attendre un peu que le Wifi soit stable
    //delay_s 5
    // Forcer la découverte maintenant
    //scheduleHADiscovery
    
    // ------------------------------------------
    
    
    // Stop Operation on power up
    goto stopSkylight
    
    
    // do not proceed
    return
    
    openSkylight:
    DWmouv_Stop
    delay_ms 100
    Set_Open
    setChannel 2 0
    setButtonColor 2 CornflowerBlue
    delay_s $CH4
    Set_Stop
    Set_Finish
    publish shutterState/get open
    delay_s 2
    Set_Stop
    return
    
    closeSkylight:
    UPmouv_Stop
    delay_ms 100
    Set_Close
    setChannel 2 0
    setButtonColor 2 CornflowerBlue
    delay_s $CH4
    Set_Stop
    Set_Finish
    publish shutterState/get closed
    delay_s 2
    Set_Stop
    return
    
    stopSkylight:
    Set_Stop
    Set_Finish
    delay_s 6
    publish shutterState/get open
    Set_Stop
    return
    


    and d.json ( discovery template )
    
    {
      "dev": {
        "ids": [
          "VOLETS_02"
        ],
        "name": "VOLETS_02",
        "sw": "1.18.221",
        "mf": "Beken Corporation",
        "mdl": "BK7231N",
        "cu": "http://192.168.241.152/index"
      },
      "name": "Volets 02",
      "~": "VOLETS_02",
      "avty_t": "~/connected",
      "uniq_id": "VOLETS_02_cover",
      "qos": 1,
      "unique_id": "Volet living 01",
      "device_class": "shutter",
      "state_topic": "~/shutterState/get",
      "command_topic": "cmnd/VOLETS_02/backlog",
      "payload_open": "Start_Opening",
      "payload_close": "Start_Closing",
      "payload_stop": "Stop_All",
      "state_open": "open",
      "state_closed": "closed"
    }


    Next step is to implement variable based on Mqtt topic and shortname so we don't have hardcoded shitty d.json

    Regarding the doc it seems that only numeric variable are available ? no trace of $mqtt_topic / $shortname / $fullname ? neither the software version ?
  • #29 21768991
    p.kaczmarek2
    Moderator Smart Home
    So you did it, good job! See, it weren't that hard...

    Okay, I think I can try to introduce those variables for you, I'll try to do this tonight. I just need to think on how to do this efficiently and introduce mandatory self tests.
    Helpful post? Buy me a coffee.
  • #30 21769064
    Acefx
    Level 9  
    Not that hard, but it wasn't planned in my schedule to learn about OBK scripting ;-). I also have a 250 m^2 flat with a lot of windows/shutters to deliver ^w^.

    The variable needed will be IMAO
    - MQTT topic
    - shortname
    - Fullname

    Best

Topic summary

The discussion revolves around the Etersky WF-CS01 roller shutter device, focusing on the pin mapping and scripting for different versions, specifically CB3S and WB3S. The user shares their experience adapting the device using scripts based on information from various sources, including GitHub documentation. They highlight the variability in pin mapping across different versions of the device, which complicates setup. Responses include acknowledgments of the user's script contributions and suggestions for improving the autoexec.bat script for the WB3S model, emphasizing the need for clear documentation and setup guidance for users.
Summary generated by the language model.
ADVERTISEMENT