Prevent repetitive switch pushes?

Hi all,

In my Domoticz system I have made a lua script that prevent repetitive pushes of my doorbell by borrowin bits and pices from others.

This is to prevent getting send multiple notifications and pictures to my Telegram account if someone - like my 4yr old - thinks its fun to keep ringing the doorbell.

I’m very slowly migrating from Domoticz to openHAB. OpenHAB is a lot harder to learn to get the same functionality as Domoticz has by default.

I have not been able to find any info in this forum or google about this.

Is this possible and how with openHAB?

I’m not a programmer and do only have very basic scripting skills so please be patient with me.

Thanks
Br Søren

Can you be more specific about the Domoticz behavior? What qualifies as “repetitive”? Does it ignore events within a time period after the first event or ???.

Yes, of course. Sorry.

In Domoticz I have made like this.

When the doorbell is pressed/pushed it will blink some lights in the house and send a notification + a picture from my frontdoor cam to telegram.

If the doorbell is pushed one or more times within the first 15 secs. of the first push it is ignored hence not getting flooded with blinking lights and notifications. :blush:

Br Søren

var Timer doorbellTimer = null

rule "Doorbell"
when
    Item Doorbell received command
then
    if(doorbellTimer == null || doorbellTimer.hasTerminated) {
        doorbellTimer = createTimer(now.plusSeconds(15), [|
            doorbellTimer = null
        ])
        // alert code goes here
    }
    // ignore while there is a timer active
}
2 Likes

Thank you, Rich. :smiley:

That was actually a lot less code and effort compared to the same function in Domoticz. :grin: