Page 1 of 1

Wildcard parts of event names

Posted: Sun Apr 22, 2012 12:06 am
by rfid_mb
Hello EG-community,

my setup: a RFID-Reader connected to EventGhost via Serial Port Plugin.

I receive events from the reader that contain the RFID-Tag-ID but also date and time (Hex).
This events come from the same RFID-Tag for example:

Code: Select all

Serial1.550E2000FA77AECD573914240412DD
Serial1.550E2000FA77AECD583914240412D2
Serial1.550E2000FA77AECD593914240412D3
Serial1.550E2000FA77AECD004014240412F3
This comes from another RFID-Tag:

Code: Select all

Serial1.550E20006A6DAECD19461424041266
Serial1.550E20006A6DAECD2046142404125F
Serial1.550E20006A6DAECD2146142404125E
I want to trigger different actions with different Tags.
Therefore I must tell EventGhost to ignore everything that comes after the 16th character of the event.

Is there a way to wildcard parts of event names?

I tried something like:

Serial1.550E20006A6DAECD*

But that obviously doesn't work in EG.

Can anybody help me out with a phyton script?
(I'm designer without phyton skills - but I could make a small donation to EG for your help).

Thank you very much,
Matthias

___
This is my current test file:

Code: Select all

<EventGhost Version="1568" Guid="{718DEE46-54C9-4A9E-AEC1-F578F49A3B5F}" Time="1335052766.77">
    <Autostart Name="Autostart" Expanded="True">
        <Action>
            EventGhost.EnableExclusive(XmlIdLink(-1))
        </Action>
        <Plugin Identifier="Serial" Guid="{D565171F-1703-4212-972C-B824B55329CB}" File="Serial">
            gAIoSwBNgCVLA0sASwBLAIhYBAAAAFx4QUFxAFgHAAAAU2VyaWFsMXEBSwF0cQIu
        </Plugin>
    </Autostart>
    <Folder Name="test_event" Expanded="True">
        <Macro Name="test_event_hello_world" Expanded="True">
            <Event Name="Serial1.550E2000FA77AECD*" />
            <Action>
                EventGhost.PythonScript(u'print "Hello, World!"\n')
            </Action>
        </Macro>
    </Folder>
</EventGhost>

Re: Wildcard parts of event names

Posted: Tue Jul 24, 2012 4:37 am
by blaher
viewtopic.php?f=2&t=2883&p=16548&hilit= ... hed#p16548 should be able to help you out.


Trigger Event
Serial

Then add python command:
eg.TriggerEvent(eg.event.payload[0][1:24], prefix = eg.event.suffix)

Where 1:24 is the range of characters you want displayed in your trigger event; in your case, it looks like you only want 24 so you get Serial1.550E20006A6DAECD

I hope that's what you're after.