2013-01-29, 09:30
(2013-01-29, 07:37)giftie Wrote:(2013-01-29, 05:04)Tomkun Wrote:(2013-01-28, 21:06)storstenson Wrote: Hi
I'm trying to use the new broadcast code posted for broadcasting events to eventghost;
self.broadcastUDP("eventname&&extrainfo")
def broadcastUDP(self,data):
IPADDR = '255.255.255.255'
PORTNUM = 33000
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, 0)
s.connect((IPADDR, PORTNUM))
s.send(data)
s.close()
But I cant make it work. Can someone perhaps make a home_automation.py with the code implanted? It would have been great help!
I'd be ever so grateful too. Just looking at that makes my head hurt.
I do have this working.. It will be part of the next release(still more things to go before that happens....)
but in the mean time...
after the following:
addCode:import xbmc, xbmcaddon
Code:import socket
add the following before def activate_on( trigger == "None" ):
Code:def broadcastUDP( data, port = 8278 ): # XBMC's former HTTP API output port is 8278
IPADDR = '255.255.255.255'
PORTNUM = port
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, 0)
s.connect((IPADDR, PORTNUM))
s.send(data)
s.close()
change your script from this:
Code:xbmc.executehttpapi( "Broadcast(<b>CE_Automate<li>script_start</b>)" )
to this:
Code:broadcastUPD( "<b>CE_Automate<li>script_start</b>" )
if you need to have a different port number just add it like so:
orCode:broadcastUPD( "<b>CE_Automate<li>script_start</b>", port = 8900 )
Code:broadcastUPD( "<b>CE_Automate<li>script_start</b>", 8900 ) # the port = is optional
or just download this file -> http://www.mediafire.com/file/l834hqkb8o...tion(3).py
be sure to rename it to 'home_automation.py' and save it in the userdata/addon_data/script.cinema.experience/ha_scripts folder
This should allow you to use the XBMC Event Receiver plug-in in EventGhost like it was before(pertaining to the script that is) so you shouldn't have to make any changes to EventGhost, just make sure that XBMC Broadcast IP is set to 255.255.255.255
Thanks! I'll try it soon!