logo elektroda
logo elektroda
X
logo elektroda

OpenBeken Configuring Open/Stop/Close buttons on a Smart Life switch

richardsg307 4770 17
Best answers

How can I make OpenBeken physical Open/Stop/Close button clicks run shutter scripts so only one relay is active at a time and the current motion is interrupted by the next button press?

Use scriptable buttons and `addEventHandler OnClick` to call aliases or script threads, not channel labels or `OnChannelChange`, and start each action with `stopAllScripts` so a new Open/Close press interrupts the current one [#20545714][#20545650][#20545712] A working pattern is to keep the relays on separate channels, define aliases like `Set_Up`, `Set_Down`, and `Set_None`, then map GUI buttons and physical button GPIOs to `Start_Opening`, `Start_Closing`, and `Stop_All`; the example used relay channels 10 and 11 and GPIO click handlers for the buttons [#20545714] The script turns both relays off, waits briefly, enables only the chosen relay for about 10 seconds, then turns everything off again [#20545714] To avoid the default channel buttons causing both relays to be on, hide them with `setChannelVisible` [#20545826] The physical Stop button in the example was RXD1 / pin 10, and the same aliases can also be triggered over MQTT using a command like `cmnd//Start_Opening` [#20545826]
Generated by the language model.
ADVERTISEMENT
  • #1 20544322
    richardsg307
    Level 5  
    Posts: 18
    Rate: 5
    I've flashed and partially configured a Smart Life Switch but I'm struggling with triggering scripts or backlog commands in the event of a button click. I'm familiar with Tasmota but have never used OpenBeken before.
    Here's the unit with the front panel removed:
    OpenBeken Configuring Open/Stop/Close buttons on a Smart Life switch
    Current configuration is Open btn, Open LED, Open Relay all on Ch 1, Stop btn & Stop LED on Ch 2, Close btn, Close LED and Close Relay all on Ch 3. No Channel Types have been set. I have an autoexec.bat file to label the buttons on the GUI and close the window.
    // Add names to the buttons
    setChannelLabel 1 Open 1
    setChannelLabel 2 Stop 1
    setChannelLabel 3 Close 1
    // Close window
    setChannel 1 0
    setChannel 2 0
    setChannel 3 1
    delay_s 10
    setChannel 3 0
    setChannel 2 1
    delay_s 3
    setChannel 2 0
    addEventHandler OnChannelChange 2 backlog setchannel 1 0; setchannel 2 1; setchannel 3 0; delay_s 3; setchannel 2 0

    But the Event Handler doesn't work when I click the Stop btn!
    ATM I'd like it to behave like it did with the Tuya firmware.
    On Open btn click, it should ensure the Close Relay is not on, then turn on the Open Relay and Open LED for 10 seconds then turn both off, then it should turn on the Stop LED for 3 seconds. The Close btn should do the opposite. The Stop btn should turn both relays off (Either one could be on) then turn on the Stop LED for 3 seconds.
    So I just need a bit of help linking the btn clicks to some action. Also, should I use different channels for the buttons away from the relays/LEDs to stop any automatic linkage. I don't want both relays on at the same time as that could blow up the actual opener itself!
    I will be writing this up as a project and new device in the repository when I'm done.
    Thanks in advance.
  • ADVERTISEMENT
  • #2 20545521
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14397
    Help: 650
    Rate: 12321
    Hello, first of all, what kind of behaviour are you trying to achieve? Is it supposed to be a shutter controller?

    Instead of delay_s 3, in backlog, you should use addRepeatingEvent 3 1 <command>, delay_s can now work inside a script thread, not yet in backlog.

    I can write following script if you want:
    Quote:

    On Open btn click, it should ensure the Close Relay is not on, then turn on the Open Relay and Open LED for 10 seconds then turn both off, then it should turn on the Stop LED for 3 seconds. The Close btn should do the opposite. The Stop btn should turn both relays off (Either one could be on) then turn on the Stop LED for 3 seconds.

    I wouldn't use channel labels for that. I would use scriptable buttons. But, is it a shutter controller? I can see tonight what I can get working for you.
    Helpful post? Buy me a coffee.
  • #3 20545650
    richardsg307
    Level 5  
    Posts: 18
    Rate: 5
    Yes, It's a 'Shutter' in concept but in this case it is opening/shutting a Skylight.
    OpenBeken Configuring Open/Stop/Close buttons on a Smart Life switch
    It's a 4 Wire system - Earth, Neutral, Live/Open and Live/Close. So i need either of the 2 Relays to be on but definitely not both. The way the switch operated with the Tuya firmware was that after about 10 seconds (presumably long enough for the window to be opened/closed, both relays went off (to save power and isolate the mechanism I guess).
    Within the File System I have created 3 simple script files. eg for closing, the close.bat file ensures that the Open relay is off before turning on the Close relay, waiting 10 seconds and then turning it off. It then turns the Stop Channel or LED on for just 3 seconds.
    / Close - Turns Open relay off, then turns Close relay on for 10s
    // Then shows Stop LED for 3s
    setchannel 1 0
    setchannel 2 0
    delay_ms 250
    setchannel 3 1
    delay_s 10
    setchannel 3 0
    setchannel 2 1
    delay_s 3
    setchannel 2 0
    
    Similar for the stop.bat and open.bat scripts. They all work when I press the "Save, Run file as script thread" button in the web interface.
    What I cannot figure out is how to get the scripts to run on a button click. I've tried adding event handlers in the autoexec.bat file but nothing seems to work.
    // Add names to the buttons
    setChannelLabel 1 Open 1
    setChannelLabel 2 Stop 1
    setChannelLabel 3 Close 1
    setChannel 1 0
    setChannel 2 0
    setChannel 3 1
    echo "Closing Skylight"
    delay_s 10
    setChannel 3 0
    echo "Loading Event Handlers"
    addEventHandler OnClick 1 startScript open.bat * 123

    I'm just missing something, so a few pointers in the right direction would help.
    On a side note - where do the echos get written out?
    Thanks
  • ADVERTISEMENT
  • #4 20545686
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14397
    Help: 650
    Rate: 12321
    Ok, I will prepare an example for you, but first, can you tell me what should happen if user press open button and then after 1 second the close?
    a) open should interrupt and close should start
    b) open should continue and ignore close request
    Helpful post? Buy me a coffee.
  • #5 20545712
    richardsg307
    Level 5  
    Posts: 18
    Rate: 5
    Thanks. I think Option a).
  • Helpful post
    #6 20545714
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14397
    Help: 650
    Rate: 12321
    Maybe it would be better if I just create a dedicated driver for shutters? It seems your use case is very generic.

    Added after 3 [minutes]:

    Here is a untested (BE CAREFUL!) script idea:
    
    
    // Channel 10 - Relay 1
    // Channel 11 - Relay 2
    
    alias Set_Up setChannel 10 0; setChannel 11 1
    alias Set_Down setChannel 10 1; setChannel 11 0
    alias Set_None setChannel 10 0; setChannel 11 0
    
    // command "Start_Opening" will first kill other script threads, and start with clear open
    alias Start_Opening backlog stopAllScripts; startScript autoexec.bat openShutter
    // command "Start_Closing" will first kill other script threads, and start with clear close
    alias Start_Closing backlog stopAllScripts; startScript autoexec.bat closeShutter
    // command "Start_Closing" will first kill other script threads, and then stop
    alias Stop_All backlog stopAllScripts; Set_None
    
    // create GUI buttons for HTTP panel
    startDriver httpButtons
    setButtonEnabled 0 1
    setButtonLabel 0 "Open"
    setButtonCommand 0 Start_Opening
    
    setButtonEnabled 1 1
    setButtonLabel 1 "Close"
    setButtonCommand 1 Start_Closing
    
    setButtonEnabled 2 1
    setButtonLabel 2 "Stop"
    setButtonCommand 2 Stop_All
    
    // link the same commands to physical button on GPIO pins
    // 8 and 9 are GPIO indices, like P9, etc
    addEventHandler OnClick 8 Start_Opening
    addEventHandler OnClick 9 Start_Closing
    addEventHandler OnClick 10 Stop_All
    
    // do not proceed
    return
    
    // Script thread for opening
    openShutter:
    // setup none
    Set_None
    // wait 0.1 seconds
    delay_s 0.1
    // setup up
    Set_Up
    // wait 10 seconds
    delay_s 10
    Set_None
    // done
    return
    
    // Script thread for closing
    closeShutter:
    // setup none
    Set_None
    // wait 0.1 seconds
    delay_s 0.1
    // setup down
    Set_Down
    // wait 10 seconds
    delay_s 10
    Set_None
    // done
    return
    
    Helpful post? Buy me a coffee.
  • #7 20545826
    richardsg307
    Level 5  
    Posts: 18
    Rate: 5
    I'll give it a go once I understand it. I have the switch mounted in a test box at the moment with nothing wired to the relays so it should be safe!
    I'll report back.

    Update:
    Nearly there! I have 3 questions...
    1) [Solved] Can I disable the default buttons since the autoexec created its own? The problem is - with the default buttons I can have both the Open and Close relays on together! Can I disable them or perhaps make them run the same event handlers as the HTTP GUI buttons? (Found it - setChannelVisible command)
    2) [Solved] What is the number of the RXD1 pin for use in the addEventHandler OnClick command. RXD1 is the input from the Pause/Stop button on my panel! (Found it - RXD1 is Pin 10 and TXD1 is Pin 11)
    3) [Solved] I've connected via MQTT to Home Assistant and used the YAML code as given in the HA Cfg page but this only lets me turn the individual relays on or off. How can I send a command to activate the Open or Close scripts? (Found it - publish MQTT topic cmnd/skylight/Start_Opening where Start_Opening is the Alias of the routine that opens the skylight)

    I will wire up the opener tomorrow and if all good submit the whole thing as a teardown.
  • #8 20548654
    richardsg307
    Level 5  
    Posts: 18
    Rate: 5
    >>20545714
    All sorted now and I've submitted a teardown thing with all the configurations and code. I think it's still pending at the moment. Do I get a free SD card?
  • #9 20548745
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14397
    Help: 650
    Rate: 12321
    Yes, you did a great job with that guide. We'll send you a PM. Remember that you can post another one as well.
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #10 20552378
    mbolty
    Level 3  
    Posts: 6
    OpenBeken Configuring Open/Stop/Close buttons on a Smart Life switch Hello, I have a cb2s module. I tried to enter the code to be able to use it as a shutter module by adding a second relay and a second push button, but it doesn't work for me. the code of the autoexec.bat is the following:
    // Channel 1 - Relay 1
    // Channel 2 - Relay 2
    setChannelVisible 1 0
    setChannelVisible 2 0
    
    alias Set_Up setChannel 1 0; setChannel 2 1
    alias Set_Down setChannel 2 0; setChannel 1 1
    alias Set_None setChannel 1 0; setChannel 2 0
    
    // command "Start_Opening" will first kill other script threads, and start with clear open
    alias Start_Opening backlog stopAllScripts; startScript autoexec.bat openShutter
    // command "Start_Closing" will first kill other script threads, and start with clear close
    alias Start_Closing backlog stopAllScripts; startScript autoexec.bat closeShutter
    // command "Start_Closing" will first kill other script threads, and then stop
    alias Stop_All backlog stopAllScripts; set_none
    
    // create GUI buttons for HTTP panel
    startDriver httpButtons
    setButtonEnabled 0 1
    setButtonLabel 0 "Open"
    setButtonCommand 0 Start_Opening
    
    setButtonEnabled 1 1
    setButtonLabel 1 "Close"
    setButtonCommand 1 Start_Closing
    
    setButtonEnabled 2 1
    setButtonLabel 2 "Stop"
    setButtonCommand 2 Stop_All
    
    // link the same commands to physical button on GPIO pins
    // 8 and 9 are GPIO indices, like P9, etc
    addEventHandler OnClick 24 Start_Opening
    addEventHandler OnClick 26 Start_Closing
    addEventHandler OnClick 10 Stop_All
    
    // do not proceed
    return
    
    // Script thread for opening
    openShutter:
    // setup none
    set_none
    // wait 0.1 seconds
    delay_s 0.1
    // set up
    Set_Up
    //wait 10 seconds
    delay_s 10
    set_none
    // done
    return
    
    // Script thread for closing
    closeShutter:
    // setup none
    set_none
    // wait 0.1 seconds
    delay_s 0.1
    // setup down
    Set_Down
    // wait 10 seconds
    delay_s 10
    set_none
    // done
    return

    But none of the outputs are activated.
    Please I appreciate any help
    OpenBeken Configuring Open/Stop/Close buttons on a Smart Life switch OpenBeken Configuring Open/Stop/Close buttons on a Smart Life switch OpenBeken Configuring Open/Stop/Close buttons on a Smart Life switch OpenBeken Configuring Open/Stop/Close buttons on a Smart Life switch


    Log:

    Info:CMD:CMD_StartScript: started autoexec.bat at label openShutter
    Info:CMD:[WebApp Cmd 'Start_Opening' Result] OK
    Info:GEN:No change in channel 1 (still set to 0) - ignoring

    Info:GEN:No change in channel 1 (still set to 0) - ignoring

    Info:MAIN:Time 451, idle 160941/s, free 68640, MQTT 1(2), bWi
  • #11 20552440
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14397
    Help: 650
    Rate: 12321
    Please edit post and use code tag to post code.

    Please attach some screenshot of your device pin configuration. Have you set the Relay roles for correct GPIOs and assigned the channels to them?

    Have you seen shutter tutorial?
    https://www.elektroda.com/rtvforum/topic3972935.html
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #12 20552484
    mbolty
    Level 3  
    Posts: 6
    Thanks, I had already read the post. I edited my post and added an image of the configuration and a part of the log.
  • #13 20552493
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14397
    Help: 650
    Rate: 12321
    I can see you have two relays, one on channel 1 and second on channel 2.

    If you change the channel states from www panel, do relays click?
    Helpful post? Buy me a coffee.
  • #14 20552569
    mbolty
    Level 3  
    Posts: 6
    I have already solved.
    
    //Configurar alias  Aliases
    alias Set_Stop backlog setChannel 2 0; setChannel 1 0
    alias Set_Open backlog setChannel 1 1
    alias Set_Close backlog setChannel 2 1
    alias Start_Opening backlog stopAllScripts; startScript autoexec.bat openBlind
    alias Start_Closing backlog stopAllScripts; startScript autoexec.bat closeBlind
    alias Stop_All backlog stopAllScripts; startScript autoexec.bat stopBlind
    
    // Channel 60 segundos de trabajo
    setChannel 60 15
    
    //crear botones GUI  para el panel HTTP
    startDriver httpButtons
    
    setButtonEnabled 1 1
    setButtonLabel 1 "Open"
    setButtonCommand 1 Start_Opening
    
    setButtonEnabled 3 1
    setButtonLabel 3 "Close"
    setButtonCommand 3 Start_Closing
    
    setButtonEnabled 2 1
    setButtonLabel 2 "Stop"
    setButtonCommand 2 Stop_All
    setButtonColor 2 red
    
    // Ocultar los botones de los reles en la  GUI HTTP
    setChannelVisible 1 0
    setChannelVisible 2 0
    setChannelVisible 3 0
    
    // Cargar Event Handlers
    addEventHandler OnHold 26 Start_Closing
    addEventHandler OnHold 24 Start_Opening
    addEventHandler OnClick 11 Stop_All
    
    // Detener persiana al encender
    goto stopBlind
    return
    
    // Script abrir
    openBlind:
    Set_Stop
    delay_s 0.1
    Set_Open
    delay_s $CH60
    Set_Stop
    return
    
    // Script cerrer
    closeBlind:
    Set_Stop
    delay_s 0.1
    Set_Close
    delay_s $CH60
    Set_Stop
    return
    
    // Script detener
    stopBlind:
    Set_Stop
    return
    




    I only have one question, in the value of $CH60. The value could not be sent by MQTT by Home Assistant to be able to modify it according to the time of each motor?
    Thank you so much
    (I will send photos of the finished project)
  • #15 20552977
    richardsg307
    Level 5  
    Posts: 18
    Rate: 5
    In the end, I found that I could press the Open window button a second time and it would open a bit (lot) more. To shut it I needed longer so I changed that code back to a number like 25 (seconds) just to make sure it was closed no matter how far I'd opened it. The actuator has a cut-out when it reaches its closed position or when the window itself is shut (before the actuator closed position) and the motor stalls.
  • #16 20553095
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14397
    Help: 650
    Rate: 12321
    Very good job,
    mbolty wrote:

    I only have one question, in the value of $CH60. The value could not be sent by MQTT by Home Assistant to be able to modify it according to the time of each motor?


    By default, channels are only send if they are used for basic IO, but this behaviour can be overridden.
    I will give you two methods:
    1. Just manually publish channel value
    
    addEventHandler OnChannelChange 30 publishInt myCustomValue $CH30 
    

    2. You can also update OpenBeken to latest version, and then make sure you are using channel up to 31, and then in Web App change type:
    OpenBeken Configuring Open/Stop/Close buttons on a Smart Life switch
    If you set type, for example to "Custom", Obk will know there is something in this channel and it will publish it when it changes.
    OpenBeken Configuring Open/Stop/Close buttons on a Smart Life switch
    Keep in mind that you can also set any channel easily via MQTT.
    https://github.com/openshwprojects/OpenBK7231T_App/blob/main/docs/mqttTopics.md
    Helpful post? Buy me a coffee.
  • #17 20556900
    mbolty
    Level 3  
    Posts: 6
    Hello, I have corrected my autoexec.bat and I have created some sensors and automations in home assistant.
    I would like to know your opinion and if it is possible to improve what I have created.
    Thank you all.
    
    //Configurar alias  Aliases
    alias Set_Stop backlog setChannel 2 0; setChannel 1 0
    alias Set_Open backlog setChannel 1 1
    alias Set_Close backlog setChannel 2 1
    alias Start_Opening backlog stopAllScripts; startScript autoexec.bat openBlind
    alias Start_Closing backlog stopAllScripts; startScript autoexec.bat closeBlind
    alias Stop_All backlog stopAllScripts; startScript autoexec.bat stopBlind
    
    // Channel 31 segundos de trabajo por defecto configurable por mqtt
    setChannel 31 5
    //crear botones GUI  para el panel HTTP
    startDriver httpButtons
    
    setButtonEnabled 1 1
    setButtonLabel 1 "Open"
    setButtonCommand 1 Start_Opening
    
    setButtonEnabled 3 1
    setButtonLabel 3 "Close"
    setButtonCommand 3 Start_Closing
    
    setButtonEnabled 2 1
    setButtonLabel 2 "Stop"
    setButtonCommand 2 Stop_All
    setButtonColor 2 red
    
    // Ocultar los botones de los reles en la  GUI HTTP
    setChannelVisible 1 0
    setChannelVisible 2 0
    setChannelVisible 3 0
    setChannelVisible 31 1
    setChannelVisible 32 0
    setChannelVisible 60 0
    
    // Cargar Event Handlers
    addEventHandler OnClick 26 Start_Closing
    addEventHandler OnClick 24 Start_Opening
    addEventHandler OnClick 10 Stop_All
    
    // Detener persiana al encender
    goto stopBlind
    return
    
    openBlind:
    Set_Stop
    delay_s 0.1
    Set_Open
    publish state_topic opening
    delay_s $CH31
    Set_Stop
    publish state_topic open
    return
    
    closeBlind:
    Set_Stop
    delay_s 0.1
    Set_Close
    publish state_topic closing
    delay_s $CH31
    publish state_topic close
    Set_Stop
    return
    
    stopBlind:
    Set_Stop
    publish state_topic stopped
    return
    

    
    sensor:
        - name: "estado persiana"
          state_topic: "obk_02/state_topic/get"
        - name: "tiempo persiana"
          state_topic: "obk_02/31/get"
    

    
    alias: timeblindha_2device
    description: send work time to device from home assistant
    trigger:
      - platform: state
        entity_id:
          - input_button.set_tiem_blind
    condition: []
    action:
      - service: mqtt.publish
        data:
          qos: 0
          retain: false
          topic: obk_02/31/set
          payload_template: "{{ states('input_number.timepersiana')|float }}"
    mode: single
    

    
    alias: timeblind_device2ha
    description: synchronize device working time with home assistant
    trigger:
      - platform: mqtt
        topic: obk_02/31/get
    condition: []
    action:
      - service: input_number.set_value
        data:
          value: "{{ states('sensor.tiempo_persiana')|float }}"
        target:
          entity_id: input_number.timepersiana
    mode: single
    

    Create the button "input_button.set_tiem_blind" so that the new work time is only sent when the button is clicked and not when the value of "input_number.set_value" is modified.
    I am waiting for the relays to arrive to add them to the modules.
  • #18 21701031
    balucio
    Level 1  
    Posts: 1
    >>20545714 >>20556900

    I have a wifi switch with three ouput, that control a single colored led. Thanks to previous post i found a solution to interloock relais outputs and randomly change the led color every 60 seconds...

    This is the core part of my startup.bat

    // Handle colors
    
    alias Violet backlog cancelRepeatingEvent 30; setChannel 1 1 
    alias Blue backlog cancelRepeatingEvent 30; setChannel 2 1
    alias Green backlog cancelRepeatingEvent 30; setChannel 3 1
    
    alias Random backlog cancelRepeatingEvent 30; setChannel 60 $rand01*3 1; setChannel $CH60 1;addRepeatingEventID 60 -1 30 Random
    
    alias onViolet backlog setChannel 2 0; setChannel 3 0; setChannel 60 1
    alias onBlue backlog setChannel 1 0; setChannel 3 0; setChannel 60 2
    alias onGreen backlog setChannel 1 0; setChannel 2 0; setChannel 60 3
    
    alias changeColor backlog setChannel 1 0; setChannel 2 0; setChannel 60 3
    
    
    // interlook events
    addChangeHandler Channel1 == 1 onViolet
    addChangeHandler Channel2 == 1 onBlue
    addChangeHandler Channel3 == 1 onGreen
    
    // Gui buttons
    startDriver HTTPButtons
    
    // Random
    setButtonEnabled 10 1
    setButtonLabel 10 "Random"
    setButtonCommand 10 Random
    setButtonColor 10 gray
    
    setButtonEnabled 11 1
    setButtonLabel 11 "Blue"
    setButtonCommand 11 Blue
    setButtonColor 11 blue
    
    setButtonEnabled 12 1
    setButtonLabel 12 "Violet"
    setButtonCommand 12 Violet
    setButtonColor 12 BlueViolet
    
    setButtonEnabled 13 1
    setButtonLabel 13 "Green"
    setButtonCommand 13 Green
    setButtonColor 13 green
    
    // Hide the default GUI buttons
    setChannelVisible 1 0
    setChannelVisible 2 0
    setChannelVisible 3 0
    
    // Start color
    Random

Topic summary

✨ The discussion revolves around configuring OpenBeken firmware for a Smart Life switch to control a skylight shutter. The user seeks assistance in triggering scripts for button clicks, having previously worked with Tasmota but not with OpenBeken. Various solutions are proposed, including using scriptable buttons instead of channel labels, and creating dedicated drivers for shutter control. The user describes their setup, including relay configurations and the need for specific timing in relay activation. They also inquire about disabling default buttons to prevent simultaneous relay activation and how to integrate with Home Assistant via MQTT. Ultimately, the user successfully implements their configuration and shares their findings with the community.
Generated by the language model.

FAQ

TL;DR: Map hardware clicks to script labels in OpenBeken, interlock relays, and run a 10‑second movement by default. “BE CAREFUL!” Use scripts for delays, not backlog. [Elektroda, p.kaczmarek2, post #20545714]

Why it matters: This FAQ helps Tasmota/OpenBeken users wire Open/Stop/Close actions safely, avoid dual‑relay damage, and integrate with Home Assistant.

Quick Facts

How do I run a script when a hardware button is clicked in OpenBeken?

Use addEventHandler to map GPIO clicks to aliases that start labeled script threads. Example: addEventHandler OnClick 8 Start_Opening, OnClick 9 Start_Closing, OnClick 10 Stop_All. Each alias should call backlog stopAllScripts; startScript autoexec.bat

Why doesn’t delay_s work in backlog, and what should I use instead?

delay_s runs inside a script thread, not in backlog. Replace backlog delays with addRepeatingEvent for timed actions. Example pattern: addRepeatingEvent 3 1 . As the expert notes, “delay_s can now work inside a script thread, not yet in backlog.” Move timing logic into labeled script sections for reliability. [Elektroda, p.kaczmarek2, post #20545521]

How can I guarantee both relays never energize at once?

Use an interlock pattern. Define Set_None to set both relay channels to 0. Then add Set_Up and Set_Down that energize one relay only. In each motion thread, call Set_None, delay_s 0.1, then Set_Up or Set_Down. Finish with Set_None after the run time. This prevents simultaneous activation. [Elektroda, p.kaczmarek2, post #20545714]

How do I make Close interrupt an ongoing Open immediately?

Prefix motion aliases with stopAllScripts, then start the new thread. Example: alias Start_Closing backlog stopAllScripts; startScript autoexec.bat closeShutter. This stops current movement and starts the requested one right away. The same pattern applies to Start_Opening. It enforces deterministic behavior under fast user input. [Elektroda, p.kaczmarek2, post #20545714]

How do I hide the default relay controls in the web UI to prevent mistakes?

Hide the raw relay channels using setChannelVisible 0. Then expose safe, scripted buttons via startDriver httpButtons and setButtonCommand mappings. This avoids accidental direct toggles that could bypass interlocks. It also declutters the UI for users. [Elektroda, richardsg307, post #20545826]

What are the RXD1/TXD1 pin numbers for Stop/Pause wiring?

On the referenced build, RXD1 maps to Pin 10 and TXD1 to Pin 11. You can bind OnClick or OnHold events to these pins for Stop/Pause behavior. Confirm on your board definition, then add the matching event handlers. [Elektroda, richardsg307, post #20545826]

How can I trigger Open/Close from Home Assistant via MQTT?

Publish commands to the device cmnd topic using your alias names. Example: publish cmnd//Start_Opening or cmnd//Start_Closing. This calls the same logic used by hardware buttons and the HTTP panel. It keeps HA control aligned with on‑device safety logic. [Elektroda, richardsg307, post #20545826]

My CB2S script runs but relays don’t click. How do I fix it?

Assign Relay roles to the correct GPIOs and ensure channels are bound. Verify by toggling Channel 1 and 2 from the web panel and confirm relay clicks. If no action, correct the pin mapping first. Only then test scripted control. [Elektroda, p.kaczmarek2, post #20552440]

What’s a minimal interlocked shutter script I can copy?

Three steps:
  1. Define aliases: Set_None, Set_Up, Set_Down, and Start_Opening/Start_Closing that call stopAllScripts; startScript with labels.
  2. Map UI and hardware: startDriver httpButtons; addEventHandler OnClick pins to the Start_* aliases.
  3. Implement labels: openShutter/closeShutter do Set_None → delay_s 0.1 → Set_Up/Down → delay_s 10 → Set_None. [Elektroda, p.kaczmarek2, post #20545714]

Can I use long-press actions (OnHold) for Open/Close?

Yes. Bind OnHold on your input pins to motion aliases. Example: addEventHandler OnHold 26 Start_Closing and OnHold 24 Start_Opening. Keep Stop on a normal click to override motion quickly. This provides intuitive manual control. [Elektroda, mbolty, post #20552569]

How do I publish and sync a user-set run time with Home Assistant?

Store run time seconds in a channel (e.g., 31). Publish states and subscribe in HA. Use an automation to publish obk_02/31/set with the new value when a button is pressed. Mirror device-to-HA updates by listening on obk_02/31/get. [Elektroda, mbolty, post #20556900]

What timing values work in practice for skylights or blinds?

10 seconds often moves the window sufficiently. One user increased close time to 25 seconds to ensure full closure. The actuator cuts out on stall or at its internal limit. This offers a safety margin for full closure. [Elektroda, richardsg307, post #20552977]

What’s the right way to expose state instead of using echo?

Publish human-readable states via MQTT that HA can consume. Example: publish state_topic opening, open, closing, or stopped inside your scripts. Use a sensor in HA that subscribes to that topic. This integrates status cleanly. [Elektroda, mbolty, post #20556900]

Is it safe to test scripts with no load attached to the relays?

Bench testing with the relays unwired is a safe approach. One user validated logic in a test box before connecting the actuator. This avoids accidental motor damage during early iterations. [Elektroda, richardsg307, post #20545826]

What happens if both Open and Close relays are ON at once?

You can damage the opener. The original poster warned simultaneous activation could blow the device. Always use an interlock and hide raw relay controls. This prevents dual activation errors. [Elektroda, richardsg307, post #20544322]

How do I auto-publish channel changes without custom code?

Update OpenBeken, keep custom values on channels ≤31, and set their type to “Custom.” The device will publish changes automatically. “Keep in mind you can also set any channel easily via MQTT.” This simplifies HA syncing. [Elektroda, p.kaczmarek2, post #20553095]
Generated by the language model.
ADVERTISEMENT