Eliminating redundant device events


I have started on a driver [BETA] IKEA TRADFRI Shortcut Button.

I am having trouble with the button sending multiple ZigBee (cluster 0x0006) messages at every push. The parse() method is activated 3 times within ~10ms.

Do you have any suggestions how to eliminate the redundant events without synchronization or mutex available? The messages happen within too short a timespan to use state or device.eventsSince().


Use something like now() to calc the time elapsed after the last event. If the difference is less than 20 ms: Ignore the new event.

Or just wait it out, e.g.:

@Field static Boolean isParsing = false

def parse(...) {
if (isParsing) return
isParsing = true

// do your things here, e.g. fire sendEvent

pauseExecution 20 //ms
isParsing = false


Thanks, I went with the latter suggestion.

1 Like

Download the Hubitat app