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.

Network Broadcast Sender / Listener

Questions and comments specific to a particular plugin should go here.
User avatar
jitterjames
Experienced User
Posts: 677
Joined: Thu Aug 13, 2009 4:36 pm
Location: Quebec, Canada
Contact:

Re: Network Broadcast Sender / Listener

Post by jitterjames »

It kind of depends on which variable you want to use but something like this should work:

eg.plugins.BroadcastListener.Broadcast(u'Bedroom.TV.Status.Volume', u'Bedroom.TV.Status.Volume'+MyVar, 33333)

or possibly
eg.plugins.BroadcastListener.Broadcast(u'Bedroom.TV.Status.Volume', u'Bedroom.TV.Status.Volume'+str(MyVar), 33333)
Silverhawk
Posts: 16
Joined: Sun Nov 10, 2013 6:19 pm

Re: Network Broadcast Sender / Listener

Post by Silverhawk »

Always get the following error when I send a WOL packet to the port which the broadcaster is listening on:

error: uncaptured python exception, closing channel <eg.CorePluginModule.Broadcaster.Server connected 192.168.1.89:7 at 0x4993120> (<type 'exceptions.UnicodeDecodeError'>:'ascii' codec can't decode byte 0xff in position 0: ordinal not in range(128) [asyncore.pyc|read|76] [asyncore.pyc|handle_read_event|414] [C:\Program Files (x86)\EventGhost\plugins\Broadcaster\__init__.py|handle_read|94] [C:\Program Files (x86)\EventGhost\eg\Classes\PluginBase.py|TriggerEvent|133] [C:\Program Files (x86)\EventGhost\eg\Classes\EventThread.py|TriggerEvent|78] [C:\Program Files (x86)\EventGhost\eg\Classes\EventGhostEvent.py|__init__|84])
User avatar
jitterjames
Experienced User
Posts: 677
Joined: Thu Aug 13, 2009 4:36 pm
Location: Quebec, Canada
Contact:

Re: Network Broadcast Sender / Listener

Post by jitterjames »

Don't use the same port for WOL and for your Broadcast listener.
Silverhawk
Posts: 16
Joined: Sun Nov 10, 2013 6:19 pm

Re: Network Broadcast Sender / Listener

Post by Silverhawk »

jitterjames wrote:Don't use the same port for WOL and for your Broadcast listener.
But I want to use it to create an event when I send a WOL. I've used this before (think half a year ago) and used to work then..
Running latest EventGhost and broadcaster 2.2.
User avatar
jitterjames
Experienced User
Posts: 677
Joined: Thu Aug 13, 2009 4:36 pm
Location: Quebec, Canada
Contact:

Re: Network Broadcast Sender / Listener

Post by jitterjames »

I don't understand what you are trying to do but maybe if you can explain it we can suggest the proper way to go about it.

To the best of my knowledge, the broadcaster plugin has not changed at all for several years because it works fine as it is.
Silverhawk
Posts: 16
Joined: Sun Nov 10, 2013 6:19 pm

Re: Network Broadcast Sender / Listener

Post by Silverhawk »

jitterjames wrote:I don't understand what you are trying to do but maybe if you can explain it we can suggest the proper way to go about it.

To the best of my knowledge, the broadcaster plugin has not changed at all for several years because it works fine as it is.
I want to generate an event when I receive a WOL packet, this works when I send the WOL packet from Yatse (android app), I get this event:
Broadcast.YatseStart-Xbmc

However when I send it from another app I always get the error as seen above.

This is the Yatse packet, which I can dump into a hex-asci converter and get YatseStart-Xbmc:
Packet recieved from xx.xx.xxx on port xxxxx
at 10:00:47 packet length : 15
00000000 : 59 61 74 73 65 53 74 61 72 74 2D 58 62 6D 63

And this is from the other apps I tried, which do not work:
Packet recieved from xx.xxx.xxx.xxx.xx on port xxxxx
at 10:02:17 packet length : 102
00000000 : FF FF FF FF FF FF 78 2B CB 8E AD CF 78 2B CB 8E
00000010 : AD CF 78 2B CB 8E AD CF 78 2B CB 8E AD CF 78 2B
00000020 : CB 8E AD CF 78 2B CB 8E AD CF 78 2B CB 8E AD CF
00000030 : 78 2B CB 8E AD CF 78 2B CB 8E AD CF 78 2B CB 8E
00000040 : AD CF 78 2B CB 8E AD CF 78 2B CB 8E AD CF 78 2B
00000050 : CB 8E AD CF 78 2B CB 8E AD CF 78 2B CB 8E AD CF
00000060 : 78 2B CB 8E AD CF

Packet recieved from xxx.xxx.xxxx.xx on port xxxxx
at 10:11:05 packet length : 102
00000000 : FF FF FF FF FF FF 78 2B CB 8E AD CF 78 2B CB 8E
00000010 : AD CF 78 2B CB 8E AD CF 78 2B CB 8E AD CF 78 2B
00000020 : CB 8E AD CF 78 2B CB 8E AD CF 78 2B CB 8E AD CF
00000030 : 78 2B CB 8E AD CF 78 2B CB 8E AD CF 78 2B CB 8E
00000040 : AD CF 78 2B CB 8E AD CF 78 2B CB 8E AD CF 78 2B
00000050 : CB 8E AD CF 78 2B CB 8E AD CF 78 2B CB 8E AD CF
00000060 : 78 2B CB 8E AD CF

Want to generate an event from the other apps since I can automate it then which I cannot do with Yatse. The packets they send do seem to be identical but that wouldn't be a problem as long as I can identify when I receive either packet.
sintei
Posts: 26
Joined: Thu Oct 09, 2014 9:46 am

Re: Network Broadcast Sender / Listener

Post by sintei »

Hello,

Yes, I am new to this, learned some python via online tutorials, but it isn't easy :)

I'm sending tcp/udp events to EG from another application (iRule).
I want EG to put some of the information from the string I'm sending into a variable that I later can call and broadcast.

EG receives this (yes I know it is from a plugin at the moment)
TCP.zVirtualScenes.Temperature ['192.168.1.15', u'Fibaro1M',u'2',u'xy.z'. u'ab.c']
I want the xy.a be put into a variable and ab.c put into another variable.

From my limited understanding and from what I have gathered from forums:

temp0 = eg.event.TCP.zVirtualScenes.Temperature.split(';')

temp1 = temp0[4:3] -> This searches the received string for the 4th delimiter in temp0 and inputs those 3 letters into temp1 ?

temp2 = temp0[5:3] -> Also as above but takes the 5th delimiter and sets temp2 with the 3 letters ?

OK, so I think this is OK. Do I create a new Add Action "python script" in EG and enters the above code into that dialog box?
Will the variable temp0 update everythime EventGhost receives the string starting with eg.event.TCP.zVirtualScenes.Temperature and will tempo1 and tempo 2 get updated as well with the new values?

And later on when/if I wish to retrieve the value of temp1 or temp2 i could just use an incoming udp that sets off an action - broadcast variables temp1 or temp2 :)

Please correct me and/or tell me what I'm doing is wrong.
Cheers!
User avatar
jitterjames
Experienced User
Posts: 677
Joined: Thu Aug 13, 2009 4:36 pm
Location: Quebec, Canada
Contact:

Re: Network Broadcast Sender / Listener

Post by jitterjames »

sintei wrote:Hello,

EG receives this (yes I know it is from a plugin at the moment)
TCP.zVirtualScenes.Temperature ['192.168.1.15', u'Fibaro1M',u'2',u'xy.z'. u'ab.c']
Cheers!
can you clarify what you mean by this please.

When you say "EG receives this"... to you mean that the history window is showing an EVENT that looks like the following?

Code: Select all

TCP.zVirtualScenes.Temperature ['192.168.1.15', u'Fibaro1M',u'2',u'xy.z'. u'ab.c']
What do you mean by "yes I know it is from a plugin at the moment"?
krambriw
Plugin Developer
Posts: 2570
Joined: Sat Jun 30, 2007 2:51 pm
Location: Stockholm, Sweden
Contact:

Re: Network Broadcast Sender / Listener

Post by krambriw »

Well, with that type of event, I would create a macro with a python script. Then just drag the event to the macro.

The following is a sample of a script you can start from.

Code: Select all

#p = "TCP.zVirtualScenes.Temperature ['192.168.1.15', u'Fibaro1M',u'2',u'xy.z'. u'ab.c']"

#Make a copy of the event string
p = eg.event.string
p = p.split('Temperature')
q = p[1][1:].strip('[]').replace("'", "").replace('u','')

#Create a list from the string
newlist = map(str, q[0:].split(','))

#Process the data and make a sub list
r = newlist[3].split(' ')
print r[0]
print r[1]

#From here on, add further code to convert from strings with your data to float and
#to generate new events, or whatever is the target
sintei
Posts: 26
Joined: Thu Oct 09, 2014 9:46 am

Re: Network Broadcast Sender / Listener

Post by sintei »

Sorry I was so vague.
Until I got this post approved (first one in this forum) I did many online tutorials.
Some time later and information gathering, it was pretty simple to do what I was trying to do:
I create a macro.
Drag the event "TCP.zVirtualScenes.Temperature ['192.168.1.15', u'Fibaro1M',u'2',u'xy.z'. u'ab.c']" to this macro.
I create a python script:
mytemperature = eg.event.payload
eg.globals.temperature = mytemperature [3]

Then I just send a broadcast action with {eg.globals.temperature}

Now my listener in other software picks up the variable xy.z and I can for example display my temperature in iRule :)
Goddamn easy when you know what you are doing.

Now.. I'm off to learn how to make variables persistent or maybe how to send them to a mysql databas so they can be read by other devices via EG when asked for.

Thanks to the both of you!

Cheers!
DaBIGOne
Posts: 9
Joined: Thu Nov 24, 2011 7:22 pm

Re: Network Broadcast Sender / Listener

Post by DaBIGOne »

Hello all,

I have had the need to distinct my "broadcasts" to certain "servers" (In my case some fans controlled by an Atmel ATMega328p chip, also used in Arduino Uno).
Every fan array I control accepts certain commands like, FanON, FanOFF, SpeedUP, SpeedDown.
Because I have multiple controllers I would like the broadcaster to target a specific controller, so I changed the __init__.py of Broadcaster a bit to allow sending to a specific IP in stead of a broadcast of over the whole network.

if you leave the IP input empty it will default to the broadcast zone entered in the plugin settings.

Image

__init__.py attached in .zip
Attachments
__init__.zip
(3.51 KiB) Downloaded 193 times
piert
Experienced User
Posts: 321
Joined: Tue Jun 14, 2011 2:53 pm

Re: Network Broadcast Sender / Listener

Post by piert »

I have been using the Broadcaster plugin for years successfully to generate commands within Eventghost to trigger various actions. Settings were the default ones.

Since recently I have started sending UDP commands from an another computer to the Eventghost computer.
I can see the UDP commands appear in the Eventhghost logs without a problem.
I can drag these events to actions in Eventghost and trigger those actions as well.
Brilliant!

However, here comes the problem: when I save the file, close Eventghost and try to re-open the file, I get a large number of RED lines with errors that I have never seen before and the Eventghost tree does not load at all.
So this means at the moment I can not use the external UDP commands within Eventghost.
Does anybody have any idea what is going on here?

I was using EG version 4.0.1.r1688 and when I found out about the problems I upgraded to latest 1700 version.
This did not help.
I don't know what version of Broadcaster plugin I am using (can't see the version anywhere; where can I find the plugin version number?)

I hope someone can point me in the right direction on how to be able to use UDP commands from external source to Eventghost.

Below are the error codes.

Thanks,
Perry

19:15:32 Unhandled exception in WorkerThread <EventThread>:
19:15:32 Callers stack:
19:15:32 File "wx\_core.pyc", line 8010, in MainLoop
19:15:32 File "wx\_core.pyc", line 7306, in MainLoop
19:15:32 File "wx\_core.pyc", line 14669, in <lambda>
19:15:32 Traceback (most recent call last) (1700):
19:15:32 File "C:\Program Files\EventGhost\eg\Classes\ThreadWorker.py", line 326, in __DoOneEvent
19:15:32 self.HandleAction(action)
19:15:32 File "C:\Program Files\EventGhost\eg\Classes\ThreadWorker.py", line 289, in HandleAction
19:15:32 action()
19:15:32 File "C:\Program Files\EventGhost\eg\Classes\ThreadWorker.py", line 62, in __call__
19:15:32 self.returnValue = self.func(*self.args, **self.kwargs)
19:15:32 File "C:\Program Files\EventGhost\eg\Classes\EventThread.py", line 142, in StartSession
19:15:32 actionThread.Func(actionThread.StartSession, 120)(filename)
19:15:32 File "C:\Program Files\EventGhost\eg\Classes\ThreadWorker.py", line 62, in __call__
19:15:32 self.returnValue = self.func(*self.args, **self.kwargs)
19:15:32 File "C:\Program Files\EventGhost\eg\Classes\ActionThread.py", line 39, in StartSession
19:15:32 eg.document.Load(filename)
19:15:32 File "C:\Program Files\EventGhost\eg\Classes\Document.py", line 143, in Load
19:15:32 xmlTree = ElementTree.parse(filePath)
19:15:32 File "<string>", line 45, in parse
19:15:32 File "<string>", line 32, in parse
19:15:32 SyntaxError: not well-formed (invalid token): line 280, column 71
User avatar
jitterjames
Experienced User
Posts: 677
Joined: Thu Aug 13, 2009 4:36 pm
Location: Quebec, Canada
Contact:

Re: Network Broadcast Sender / Listener

Post by jitterjames »

Can you walk us through what kind of messages you are sending and what the events end up looking like?

I've been sending UDP commands to eventGhost from other programs for years with no problem.

Looking at that error message, I don't see anything related to the Broadcaster and without more information about how you create the error I can't make much of a guess.

If I had to guess, I would think you are using some characters that are ultimately messing up your xml somehow. I don't think that should really be possible but you never know.
piert
Experienced User
Posts: 321
Joined: Tue Jun 14, 2011 2:53 pm

Re: Network Broadcast Sender / Listener

Post by piert »

Thank you very much for contributing in the investigation!

I use a small proprietary computer in my KNX home automation system that has a built-in feature to send UDP commands.
I can program this proprietary computer (the EIBPC by Enertex http://www.enertex.de/e-eibpc.html) in such a way that when I press a switch in my house, an UDP command is sent on my LAN network.
The following program syntax is programmed in the proprietary computer for issuing the UDP command on the LAN network:

sendudp(33333u16,192.168.1.16,$sbwoonkuit$)

Some explanation of the command:
The u16 behind the port number is used to define the datatype of the port numberr (a normal necessity in the ETSsoftware for the KNX domotica world).
The IP address is the IP of the receiving computer on which Eventghost is running.
The letters between the dollar signs are the UDP command that actually gets sent. Like for the port number, text strings for ETS/KNX purposes must be between dollar signs. As you can see, the command itself only contains normal letters.

With the command programmed in the EIBPC and then when I press the programmed switch in my house, the UDP commands is sent by the EIBPC, which is received in Eventghost without a problem.
The event I receive in the log of Eventghost is the following:

01:50:57 Broadcast.sbwoonkuit

This is exactly what I would expect.
If I then don't do anything else but just receive the UDP event in the log, save and exit Eventghost, I can then re-open Eventghost without a problem.

I can also drag the UDP event to a Macro and it will trigger the Macro when I press the switch.
That is exactly what I would expect.
However, if I NOW save and exit Eventghost, Eventghost can NOT be re-opened normally again. When I try to restart, it takes a bit longer and then the only information in the log I get are the error messages (new log after just trying again just now):

02:18:16 ---> Welcome to EventGhost <---
02:18:22 Unhandled exception in WorkerThread <EventThread>:
02:18:22 Callers stack:
02:18:22 File "wx\_core.pyc", line 8010, in MainLoop
02:18:22 File "wx\_core.pyc", line 7306, in MainLoop
02:18:22 File "wx\_core.pyc", line 14669, in <lambda>
02:18:22 Traceback (most recent call last) (1700):
02:18:22 File "C:\Program Files\EventGhost\eg\Classes\ThreadWorker.py", line 326, in __DoOneEvent
02:18:22 self.HandleAction(action)
02:18:22 File "C:\Program Files\EventGhost\eg\Classes\ThreadWorker.py", line 289, in HandleAction
02:18:22 action()
02:18:22 File "C:\Program Files\EventGhost\eg\Classes\ThreadWorker.py", line 62, in __call__
02:18:22 self.returnValue = self.func(*self.args, **self.kwargs)
02:18:22 File "C:\Program Files\EventGhost\eg\Classes\EventThread.py", line 142, in StartSession
02:18:22 actionThread.Func(actionThread.StartSession, 120)(filename)
02:18:22 File "C:\Program Files\EventGhost\eg\Classes\ThreadWorker.py", line 62, in __call__
02:18:22 self.returnValue = self.func(*self.args, **self.kwargs)
02:18:22 File "C:\Program Files\EventGhost\eg\Classes\ActionThread.py", line 39, in StartSession
02:18:22 eg.document.Load(filename)
02:18:22 File "C:\Program Files\EventGhost\eg\Classes\Document.py", line 143, in Load
02:18:22 xmlTree = ElementTree.parse(filePath)
02:18:22 File "<string>", line 45, in parse
02:18:22 File "<string>", line 32, in parse
02:18:22 SyntaxError: not well-formed (invalid token): line 280, column 45

That is the only thing that is in the Eventghost log. On the right hand side, nothing happens (i.e. the Autostart does not come up, plugins are not loaded, etc.).
The only things that add to the Eventghost log are the 'idle', 'unidle' messages that you always get when you check every once in while to look at the Eventghost window.

I am using Windows 7 for the Eventghost machine and I run Eventghost 'as administrator' at each start.

I am just clueless about what the issue could be here.
I really appreciate your feedback and input!
Let me know if you need me to check/try something else.

Thanks again,
Perry
piert
Experienced User
Posts: 321
Joined: Tue Jun 14, 2011 2:53 pm

Re: Network Broadcast Sender / Listener

Post by piert »

And another observation:

After I receive the error messages in the log and exit Eventghost, it does not close properly. The eventghost Icon stays in the right bottom corner and I then have to use taskmanager to kill the still running Eventghost Process.

After I have done that, it is not longer possible to re-open the file that was previously saved normally again. It will always come up with the error messages.
This is why I always (have to) keep several previous version back-up files, which I use to be able to restart Eventghost again.
Post Reply