logo elektroda
logo elektroda
X
logo elektroda

Preventing Simultaneous Activation of Both Relays in OpenBK7231T-Tuya Shutter Switch

hoezyhoest 1632 8
ADVERTISEMENT
  • #1 20413815
    hoezyhoest
    Level 2  
    I just flashed my tuya shutter switch with openbk7231t and everything is working correctly. but how can I prevent activating both relays at the same time? I need something like the shutter mode in tasmota. or is my only option to replace the WB3S chip with ESP and flash tasmota on it?
  • ADVERTISEMENT
  • #2 20413848
    p.kaczmarek2
    Moderator Smart Home
    Well, I can write any driver for you if you want, but it should be also possible to both configure or script OBK to suit your needs.

    You could, for example, set one relay Rel and second to Rel_n, and set them both to single channel, then they would work in mutually exclusive way.

    You could also use some scripting - for example, make a change handler and do something there:
    
    addChangeHandler Channel0 == 1 YourCommandHere
    addChangeHandler Channel0 == 0 YourCommandHere
    

    You can use any command in event handler, or even start a script.
    https://github.com/openshwprojects/OpenBK7231T_App/blob/main/docs/commands.md
    You can also use repeating event with counter set to 1 to do something after a delay.
    
    addRepeatingEvent 2 1 setChannel 0 0
    


    but again, if you have a specific use case in mind, I can write a dedicated driver for you, as long as you can explain how is it supposed to work. Show your device configuration, etc.
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #3 20414102
    hoezyhoest
    Level 2  
    i tried setting them both to single channel but it still keeps one of them constantly on.
    i tried the scripting part but that is a bit complicated for me :P (i do know how to run them)

    i'm using a switch like this and i need something like the InterLock setting in tasmota so that none can accidentally fire two relays on the physical touch buttons
    https://templates.blakadder.com/WF-CS01_EU.html

    these are my settings:

    Preventing Simultaneous Activation of Both Relays in OpenBK7231T-Tuya Shutter Switch
  • ADVERTISEMENT
  • #4 20414125
    p.kaczmarek2
    Moderator Smart Home
    I am not sure yet, but just maybe, this autoexec.bat (in Web Application ->LittleFS tab) can help?
    
    // when channel 0 becomes 1, turn off channel 1
    addChangeHandler Channel0 == 1 SetChannel 1 0
    // when channel 1 becomes 1, turn off channel 0
    addChangeHandler Channel1 == 1 SetChannel 0 0
    

    I haven't done shutters yet. Futhermore, do they require turning off both relays after a given time?
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #5 20414151
    hoezyhoest
    Level 2  
    thnx alot! this is the same as the interlock from tasmota and works like a charm :)

    i'm using home assistant to time the relays so that's not a problem. this was only for protection so i won't blow up the motors by accident.


    cheers!
  • Helpful post
    #6 20433363
    maliciamrg
    Level 2  
    hello ,

    Thks to you two i have complet the setting of my shutter switch WF-CS01_EU

    in complement of your setting , i post mine (5 leds , 3 buttons and 2 relai) :

    Preventing Simultaneous Activation of Both Relays in OpenBK7231T-Tuya Shutter Switch

    and like sugest p.kaczmarek2 , i add a autoexec.bat file , who mimic the original firmware :

    
    //blue led on
    SetStartValue 3 1
    
    // interlock relais
    addChangeHandler Channel0 == 1 SetChannel 2 0
    addChangeHandler Channel2 == 1 SetChannel 0 0
    
    //cancel button
    addChangeHandler Channel1 == 1 SetChannel 0 0
    addChangeHandler Channel1 == 1 SetChannel 2 0
    
    //toggle night led mode
    addEventHandler OnHold 10 ToggleChannel 3
    
    //auto cancel relais after delai 34s
    addChangeHandler Channel0 == 1 addRepeatingEventID 34 1 910 SetChannel 0 0
    addChangeHandler Channel2 == 1 addRepeatingEventID 34 1 912 SetChannel 2 0
    
    //auto cancel cancel button after 5s
    addChangeHandler Channel1 == 1 addRepeatingEventID 5 1 911 SetChannel 1 0
    
    //auto cancel cancel relai
    addChangeHandler Channel1 == 1 cancelRepeatingEvent 910
    addChangeHandler Channel1 == 1 cancelRepeatingEvent 912
    


    :spoko:
  • #7 20433374
    p.kaczmarek2
    Moderator Smart Home
    So you've made a shutters support entirely in our scripting language? Nice.

    I've been also prototyping something like that, here:
    https://github.com/openshwprojects/OpenBK7231...rc/selftest/selftest_demo_scriptForShutters.c
    Helpful post? Buy me a coffee.
  • #8 20433399
    maliciamrg
    Level 2  
    p.kaczmarek2 wrote:
    So you've made a shutters support entirely in our scripting language? Nice.

    I've been also prototyping something like that, here:
    https://github.com/openshwprojects/OpenBK7231...rc/selftest/selftest_demo_scriptForShutters.c


    Wow, now I know how to use "alias" and "backlog", pretty powerful.

    If I can suggest a use case to add in your demo, the possible mind changing of a user. (aka: I start to open my shutter but at the mid course I change my mind and decide to close it)

    Thanks for your work for developing this firmware which saves a lot of my wifi OT, you rock.
  • #9 20433581
    p.kaczmarek2
    Moderator Smart Home
    Your script seems pretty nice, you could submit it as another demo/self test (in separate file) via pull request
    Helpful post? Buy me a coffee.

Topic summary

The discussion revolves around configuring the OpenBK7231T firmware for the Tuya shutter switch to prevent simultaneous activation of both relays. Users suggest using scripting to create an interlock mechanism similar to Tasmota's shutter mode. Solutions include setting relays to single channel mode and implementing change handlers to turn off one relay when the other is activated. A user successfully implemented a script that mimics the original firmware's functionality, ensuring that only one relay operates at a time, thus protecting the motors from damage. Additional configurations for LED indicators and auto-cancel features were also shared.
Summary generated by the language model.
ADVERTISEMENT