logo elektroda
logo elektroda
X
logo elektroda

Setting Delay for Relay Off on OpenBeken DIY 1-Channel Switch

sterium 777 3
ADVERTISEMENT
  • #1 20939669
    sterium
    Level 2  
    Hello Everyone,
    I am new to openbeken, I just flash with success a generic diy 1 channel switch.

    I tried reading command from github but I didn't understand well.

    it's possible delay off before received the off command?
  • ADVERTISEMENT
  • #2 20940154
    p.kaczmarek2
    Moderator Smart Home
    Can you be a bit more specific, what do you mean exactly by "delay"?

    Do you want something like this:
    -> when a channel sets to 1, relay closes without delay
    -> when a channel sets to 0, relay opens with a 5 seconds delay
    Or do you want relay to open automatically after a given time?
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #3 20940384
    sterium
    Level 2  

    Quote:
    ="p.kaczmarek2"]-> When a channel is set to 0, the relay opens with a 5-second delay

    Thanks for the reply, yes, like this.
  • #4 20940593
    p.kaczmarek2
    Moderator Smart Home
    Sure, I've made a sample of such script for you. Keep in mind that is shows two channels now, where first one is a "direct access" (without delay) and second introduces 5 seconds delay:
    
    
    // Following sample shows how to turn on relay without delay, but turn it off with a delay
    
    // Assumptions:
    // - channel 1 has a relay (one of pins has role Relay and channel set to 0)
    // - channel 2 is purely virtual channel used to introduce the relay
    
    alias enable_without_delay backlog cancelRepeatingEvent 123456; setChannel 1 1
    alias disable_with_delay backlog cancelRepeatingEvent 123456; addRepeatingEventID 5 1 123456 setChannel 1 0
    
    setChannelType 2 Toggle
    addChangeHandler Channel2 == 1 enable_without_delay
    addChangeHandler Channel2 == 0 disable_with_delay
    
    Helpful post? Buy me a coffee.
ADVERTISEMENT