Page 1 of 1

After upgrading to version 0.5.0-rc6 HTTP webserver events need to be renamed

Posted: Thu Apr 02, 2020 3:15 pm
by mkanet
In the last stable release version 0.4, the webserver would trigger/generate events in the log called like:

SamsungTV-OFF

..after sending an HTTP GET to the webserver.

Now, the events are called:

HTTP.SamsungTV-OFF

It's not a big deal, but I have to rename all my webserver events to start with HTTP. if I want to use the new EG beta.

Re: After upgrading to version 0.5.0-rc6 HTTP webserver events need to be renamed

Posted: Thu Apr 02, 2020 4:07 pm
by Sem;colon
Hi mkanet,
That's not a bug, it's a bugfix :)
No, seriously, when plugins are able to create an event without prefix, multiple plugins could trigger the same event, what may lead to an unexpected behavior in your actions.
That's why with EG 0.5 a mandatory prefix has been added.
It also makes things more structured, so you instantly see where your event it coming from.

Re: After upgrading to version 0.5.0-rc6 HTTP webserver events need to be renamed

Posted: Sun Apr 05, 2020 3:40 pm
by kgschlosser
@sem;colon is correct.
It helps to minimize the chances of having an event collision between plugins. Because EG has close to 400 plugins available event collisions are a real thing. so when an event comes from a plugin a prefix MUST exist.

Now there is a way you can remove that prefix if you like. If you create a macro and add the event HTTP.* to the macro. Then add a python command action and past in the line of code below into that action it will remove the HTTP. from the beginning of the event.

Code: Select all

eg.TriggerEvent(prefix=eg.event.string.split('.', 1)[-1], payload=eg.event.payload, source=eg.event.source)