logo elektroda
logo elektroda
X
logo elektroda

[Solved] OpenBK - Code extension for inching function for 2-channel Tuya Relay module

ulisch 243 3
ADVERTISEMENT
Treść została przetłumaczona german » english Zobacz oryginalną wersję tematu
  • #1 21499257
    ulisch
    Level 2  
    Beginner, help!
    I have successfully flashed OpenBK on a 2-channel Tuya relay module, can address the relays, the local buttons work, great so far. Now I want the relays to drop out again after 1 sec after pressing ("inching"), the "Tuya" firmware was able to do this by default. I found an autoexe code snippet in the documentation ( /turn_off_relay_after_time.bat), which works great for CH1, but I can't get the few lines extended so that both relay channels drop out after one second.
    Maybe someone can extend the code correctly?
    Thank you
  • ADVERTISEMENT
  • Helpful post
    #2 21505937
    p.kaczmarek2
    Moderator Smart Home
    The backlog allows you to execute several commands, such as setting both channels to zero.
    alias turn_off backlog setChannel 1 0; setChannel 2 0
    // This aliased command will turn off relay on CH1 after 10 seconds
    // addRepeatingEvent	[IntervalSeconds][RepeatsOr-1][CommandToRun]
    alias turn_off_after_time addRepeatingEvent 10 1 turn_off 
    // this will run the turn off command every time that CH1 becomes 1
    addChangeHandler Channel1 == 1 turn_off_after_time 
    addChangeHandler Channel2 == 1 turn_off_after_time 
    .
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #3 21506268
    ulisch
    Level 2  
    Thanks for the help!
    In the meantime, I have found another way to set an automatic "turn off" after xxx ms under MQTT.
    So now I have two solutions!
    Uli
  • #4 21506270
    ulisch
    Level 2  
    Advanced MQTT option in MQTTthing plugin: turn off after xxx ms.
ADVERTISEMENT