Ignoring Duplicate Events

If you have a question or need help, this is the place to be.
Post Reply
Posts: 1
Joined: Fri Jul 25, 2014 3:48 pm

Ignoring Duplicate Events

Post by johnz1 » Fri Jul 25, 2014 3:59 pm


I am using one of these super cheap USB rollup drum pads to trigger sound clips on a soundboard: http://www.amazon.com/Roll-Drum-Free-Pl ... B000YMNZF6

The Generic HID plugin is used for EG to capture events from the device. The problem is that every time any of the pads are hit, two identical events are created. The result is that two sounds are played back-to-back when you hit the pad just one time.

Is there any way to ignore duplicate events when they come in simultaneously (or within a fraction of a second)?

This is for EventGhost 0.4.1.r1669 (latest release) on Windows 7 Pro SP1. I put this in the General Support forum because I think the plugin is working fine. I am assuming that what I need is a software workaround for a hardware issue on a cheap piece of hardware.

Thank you

User avatar
Plugin Developer
Posts: 2294
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic

Re: Ignoring Duplicate Events

Post by Pako » Sat Jul 26, 2014 12:52 pm

This is a quite simple task:
1.) Create a macro as shown below:
IgnoreDuplicateEvents.png (3.81 KiB) Viewed 3165 times
2.) Into the Python Script action copy the following code:

Code: Select all

timeout = 0.1
if not "lastEventTime" in eg.globals.__dict__:
    eg.globals.lastEventTime = {}
let = eg.globals.lastEventTime
et = eg.event.time
ees = eg.event.string 
if ees in let:
    if et - let[ees] > timeout:
        let[ees] = et                    # Set variable
        #print "Event %s ignored" % ees
        eg.event.skipEvent = True        # Ignore event (rapid sequence)
    let[ees] = et                        # Set variable
3.) The constant timeout adjust as needed
4.) This macro put in your configuration tree as high as possible.

That's it. Other macros (with some HID events) that you use, you can leave unchanged.

Note: Maybe it will be a glitch, that event payload values ​​are ignored. In this case it will be necessary to modify it.


User avatar
Experienced User
Posts: 792
Joined: Wed Oct 08, 2008 4:56 am

Re: Ignoring Duplicate Events

Post by Livin » Fri Dec 16, 2016 6:10 am

Pako, any chance you could make this into an Eventghost built-in Action or a plugin?
setup... XBMC, W7MC for DVR & Live OTA TV, JRMC for multi-zone audio, EG, MiCasaVerde Vera3, USB-UIRT IR receiver, Harmony remote, 5.2 home theater system

Experienced User
Posts: 228
Joined: Thu Feb 12, 2015 7:22 pm
Location: Win7 64bit

Re: Ignoring Duplicate Events

Post by skribb » Thu Mar 29, 2018 9:36 am

I don't understand where to put the actual Action in the macro.... :oops:

EDIT: following this at least made more sense to my noob brain and i seem to have made it work:
Automation is life.

Win7 64bit
EG: v0.5.0-rc4

Post Reply