logo elektroda
logo elektroda
X
logo elektroda

Reducing Relay Delay with dInput_n on OpenBeken BK7231N for Fast Switch Response

zakdma 780 6
ADVERTISEMENT
  • #1 21463267
    zakdma
    Level 3  
    Posts: 27
    Hi, there!

    The light switch relay is controlled by a hardware switch (ON/OFF positions).
    OpenBeken latest version on BK7231N installed.
    TglChanOnTgl configured for the switch pin and works ok and fast, but I need the relay to follow the hardware switch. So I changed pin it to dInput_n.
    It's working fine and relay follows hardware switch, but there is a small annoying delay between hardware switch changed state and relay reflects it.
    Is there any way to avoid this delay, so the switch works as fast as TglChanOnTgl?

    Thank you!
  • ADVERTISEMENT
  • #2 21466519
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14620
    Help: 655
    Rate: 12636
    I think there is a little hidden feature where you can use this flag to reduce debounce time:
    
    	int debounceMS;
    	if (CFG_HasFlag(OBK_FLAG_BTN_INSTANTTOUCH)) {
    		debounceMS = 100;
    	}
    	else {
    		debounceMS = 250;
    	}
    
    
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #3 21467358
    zakdma
    Level 3  
    Posts: 27
    >>21466519
    Thank you! I already set Flag 6 and saw that the delay is shorter but still exists.
    Why does the toggle have no such delay?
    Toggle doesn't use debouncing, but the switch does?
  • ADVERTISEMENT
  • #4 21921502
    groove6j
    Level 10  
    Posts: 52
    Help: 3
    Rate: 13
    Hello. I'm gonna revive this thread. My zigbee switches after flashing with romasku's firmware now became instantaneous. And I have a feeling my wifi switches running OpenBeken became slower to respond after some update last year. Then I ticked flag 6 and it become bareable, but still worse. Clicking from webui is instantaneous.

    Is there any easy option to reduce the timeout even more or do we have to recompile the firmware? It's a bit annoying that some light switches in my house work with no delay and some take even 100ms more.

    I compiled my own version with 40ms/80ms values and the relay clicks instantly, there seems to be no problems.
  • ADVERTISEMENT
  • #5 21921572
    divadiow
    Level 38  
    Posts: 5063
    Help: 438
    Rate: 893
    maybe there could be a new flag or a command to choose your own debounceMS.

    what role is your button assigned?

    groove6j wrote:
    And I have a feeling my wifi switches running OpenBeken became slower to respond after some update last year

    maybe this if you're using toggle? https://github.com/divadiow/OpenBK7231T_App/commit/b9bdc0bc79e1170febb57edad6fb823a03e94dd8
  • #6 21921968
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14620
    Help: 655
    Rate: 12636
    groove6j wrote:

    I compiled my own version with 40ms/80ms values and the relay clicks instantly, there seems to be no problems.

    If tested, maybe we can merge those changes?
    Helpful post? Buy me a coffee.
  • #7 21922049
    groove6j
    Level 10  
    Posts: 52
    Help: 3
    Rate: 13
    My button is TglChanOnTgl. I'm using it as a standard light switch. Actually it was 20ms/60ms. I made the change here:
    https://github.com/openshwprojects/OpenBK7231...compare/main...kellerman:OpenBK7231T_App:main

    Nothing broke and switch is very snappy with these settings, feels like no micro controller in between the light. Maybe the settings could be 20ms/100ms for example? For some toggle switches too quick switching (poor contact etc...) might be too low to set it to 20 (maybe?).

    100ms would be okay in terms of latency for a standard setting, but you can definitely feel the delay. For people who want more instant switching, 20 would be perfect, if there are no consequences to this low setting.

    I'd be happy if a faster debounce setting would be included in main build. For the meantime I tested 10ms, and it still works, even quicker.

Topic summary

✨ The discussion revolves around reducing the relay delay when using dInput_n on the OpenBeken BK7231N for a light switch controlled by a hardware switch. The user has configured TglChanOnTgl for fast response but seeks to eliminate the delay when the relay follows the hardware switch state. A response suggests utilizing a hidden feature to adjust the debounce time, with a configuration flag that can reduce the delay. However, the user notes that despite setting Flag 6, a delay persists, questioning why the toggle function operates without such a delay while the switch does.
Generated by the language model.
ADVERTISEMENT