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.

xPL

Questions and comments specific to a particular plugin should go here.
damage
Posts: 40
Joined: Thu Nov 27, 2008 6:39 pm

Re: xPL plugin

Post by damage »

interesting. that leads me to think there may a problem with my plugin binding to a port in vista. unfortunately (or forunately depending on how you look at it :D ) i don't have vista to test with. but since the source code is there, maybe somebody can tweak it.
damage
Posts: 40
Joined: Thu Nov 27, 2008 6:39 pm

Re: xPL plugin

Post by damage »

here's something fun i did using my xPL plugin, a SliMP3 music player, squeezecenter and an old tivo remote to control sagetv.

http://doghouselabs.blogspot.com/2009/0 ... d-xpl.html
krambriw
Plugin Developer
Posts: 2570
Joined: Sat Jun 30, 2007 2:51 pm
Location: Stockholm, Sweden
Contact:

Re: xPL plugin

Post by krambriw »

That's really nice work,,,I would love to get such things a beautiful day and to make something similar. Currently I have Dreambox as sat receivers...and EG is not running on such a box

Besides, the Sage stuff doesn't seem to be that expensive either

I wonder if the Sage supports streaming from my Dreambox, then my sat receiver would still be useful

Best regards, Walter
damage
Posts: 40
Joined: Thu Nov 27, 2008 6:39 pm

Re: xPL plugin

Post by damage »

somebody has gotten dreambox to work w/ sage according to the last post here: http://forums.sagetv.com/forums/showthread.php?t=36850
User avatar
Livin
Experienced User
Posts: 792
Joined: Wed Oct 08, 2008 4:56 am

Re: xPL plugin

Post by Livin »

Damage,
I think that using EG & xPL would be cool to control home lighting (X-10). But, I have very complex scenes that I'd rather not try to hack out line by line. Is there any xPL gui based app that will allow you to setup complex scenes and timers, then EG can just trigger them?

thx
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
damage
Posts: 40
Joined: Thu Nov 27, 2008 6:39 pm

Re: xPL plugin

Post by damage »

what do you currently use to set your lighting scenes?
User avatar
Livin
Experienced User
Posts: 792
Joined: Wed Oct 08, 2008 4:56 am

Re: xPL plugin

Post by Livin »

I was using Homeseer 1.7 and changed to Girder 5 recently but the lighting scenes control is 'messy'. They may be fixing it soon, not sure.

If there is no easy way in EG that is fine. Girder is very powerful.
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
damage
Posts: 40
Joined: Thu Nov 27, 2008 6:39 pm

Re: xPL plugin

Post by damage »

i am unaware of any xpl based gui that would help you. the only gui i know is mentioned here http://www.xpl-home.org/forums/viewtopic.php?t=788 but i haven't looked into it at all to know anything other than it's a gui.
User avatar
Bitmonster
Site Admin
Posts: 2239
Joined: Mon Feb 06, 2006 10:28 pm

Re: xPL plugin

Post by Bitmonster »

I just took a short look at the current version of the plugin, regarding inclusion into the distribution with the installer. If you have a SourceForge account, PM me your account details and I can add you to the developer list, so you can update it directly on the SVN trunk.

Two things attracted my attention:
1. The plugin doesn't seem to shutdown properly or better say "not fast enough". I guess this is because your "main" Thread is blocking on the select.select call, so the mainThreadEvent can't be evaluated quick enough. One way around this might be to initiate a connection from your __stop__ method after you have set the mainThreadEvent, just to wake up the select.select loop.

2. You use multiple wx.TextCtrls to gather the xPL message from the user. Wouldn't it be easier and more flexible to just use a single multiline wx.TextCtrl for this?
Please post software-related questions in the forum - PMs will only be answered, if really private, thanks!
damage
Posts: 40
Joined: Thu Nov 27, 2008 6:39 pm

Re: xPL plugin

Post by damage »

Bitmonster wrote: 1. The plugin doesn't seem to shutdown properly or better say "not fast enough". I guess this is because your "main" Thread is blocking on the select.select call, so the mainThreadEvent can't be evaluated quick enough. One way around this might be to initiate a connection from your __stop__ method after you have set the mainThreadEvent, just to wake up the select.select loop.

2. You use multiple wx.TextCtrls to gather the xPL message from the user. Wouldn't it be easier and more flexible to just use a single multiline wx.TextCtrl for this?
the __stop__ method issues a "heartbeat stop" message. is that what you mean by initiating a connection?

i'll take a look at cleaning up TextCtrl.

thanks
User avatar
Bitmonster
Site Admin
Posts: 2239
Joined: Mon Feb 06, 2006 10:28 pm

Re: xPL plugin

Post by Bitmonster »

No. The "SendHeartbeat" thread looks OK, because it is wait()-ing on the hbThreadEvent and therefore gets the change of the event immediately.

But the "main" thread might stay blocked, because select.select() only returns after something has changed on the sockets (or after the timeout of 60 seconds). And only after such a change it can detect mainThreadEvent.isSet(). So I suggest to create another socket in the __stop__ method, to connect to your self.UDPSock, just to wake up the select.select() call, so this thread can see the change of mainThreadEvent immediately. A smaller timeout for select is no real solution, as it only would uselessly consume CPU-cycles if set small enough (like under a second).
Please post software-related questions in the forum - PMs will only be answered, if really private, thanks!
damage
Posts: 40
Joined: Thu Nov 27, 2008 6:39 pm

Re: xPL plugin

Post by damage »

__stop__ looks like this:

Code: Select all

    def __stop__(self):
        self.hbThreadEvent.set()
        self.mainThreadEvent.set()
        hbSock = socket(AF_INET,SOCK_DGRAM)
        hbSock.setsockopt(SOL_SOCKET,SO_BROADCAST,1)
        msg = "xpl-stat\n{\nhop=1\nsource="+str(self.hostname)+"\ntarget=*\n}\nhbeat.end\n{\ninterval=5\nport="
        msg = msg + str(self.port) + "\nremote-ip=" + str(self.LocalIP) + "\nversion=1.2\n}\n"
        hbSock.sendto(msg,("255.255.255.255",3865))
        print "XPL is stopped."
doesn't hbSock.sendto(msg,("255.255.255.255",3865)) qualify as making a connection? it's issuing the same kind of udp message the main thread is waiting to receive.
User avatar
Bitmonster
Site Admin
Posts: 2239
Joined: Mon Feb 06, 2006 10:28 pm

Re: xPL plugin

Post by Bitmonster »

Not exactly (even though I have overlooked this piece of code). It is sending to the fixed port 3865 and not the self.port the self.UDPSock is listening to. So this doesn't trigger the self.UDPSock and therefore the select() doesn't terminate. (Tested on Vista32.)

BTW: Isn't it important for the users setup to have a fixed port for the UDP socket, as this is the port he has to setup all other xPL equipment to? So shouldn't this be a user option instead of finding the next free one by code?
Please post software-related questions in the forum - PMs will only be answered, if really private, thanks!
damage
Posts: 40
Joined: Thu Nov 27, 2008 6:39 pm

Re: xPL plugin

Post by damage »

an xPL hub listens on port 3865 and rebroadcasts the packet to all xpl listeners on the machine. each xPL app will bind to an unused port 50000 or higher and the hub will forward packets to those ports. ( http://wiki.xplproject.org.uk/index.php ... cification ). so xPL apps will send packets to port 3865 and the hub will retransmit to all apps on the machine @ ports 50000+. i think you don't have a hub installed ( http://www.xplmonkey.com/xplhub.html ).
User avatar
Bitmonster
Site Admin
Posts: 2239
Joined: Mon Feb 06, 2006 10:28 pm

Re: xPL plugin

Post by Bitmonster »

damage wrote:i think you don't have a hub installed.
Actually I haven't installed any xPL thingy. :)
But now it makes sense. So you don't see this blocking, as actually your xPL hub is triggering the select loop. OK, but I think you should add another socket.sendto(... self.port)), just to make sure the plugin closes down nicely even if no hub is available.
Please post software-related questions in the forum - PMs will only be answered, if really private, thanks!
Post Reply