Notice: This forum has been recovered from an old backup, so some content, links, and dates may be outdated. The forum is currently read-only while we restore sign-in and registration functionality. Details

If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.

Wildcard parts of event names

Do you have questions about writing plugins or scripts in Python? Meet the coders here.
Post Reply
rfid_mb
Posts: 1
Joined: Sat Apr 21, 2012 11:56 pm

Wildcard parts of event names

Post 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>
blaher
Experienced User
Posts: 487
Joined: Thu Nov 17, 2011 1:27 am

Re: Wildcard parts of event names

Post 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.
Post Reply