2011-10-31, 05:10
No offense Giftie, but that post was almost solely responsible for me destroying my Harmony controller by throwing it into the wall.. I kept trying all of what was posted there but could not get the XBMC/Cinema Experience to talk to EventGhost the way described.
Jitterjames posted that he couldn't get thart part to work, and after I posted in the X10 Commander Lights thread Shoop_NL said he developed that plugin when he could not get this one to work too. So then I tried thinking about it from a different angle. During this weekend the big difficulty has been the communication from XBMC to EventGhost in what I have tried, there have been numerous macro attempts in EventGhost that seemed to work fine when pressing the test button in EG. On these threads[url=http://forum.xbmc.org/showthread.php?tid=10 are where I got this idea...
1300]http://forum.xbmc.org/showthread.php?tid=101300[/url] and http://forum.melloware.com/viewtopic.php...18&start=0.
Since it seemed to work in EG as a Python script macro event, I thought why not just call the line straight from your cinema experience script (which is in python) and skip having to use EventGhost at all? I installed X10 Commander from here http://melloware.com/download/ , and now I seem to have it working perfectly.
On the top of your home_automation.py file I added urllib2 in the import lines and for the action codes I used
I will post my whole working code here, A1 are multicolored strobe lights on my mantel, A2 is my lamp
Jitterjames posted that he couldn't get thart part to work, and after I posted in the X10 Commander Lights thread Shoop_NL said he developed that plugin when he could not get this one to work too. So then I tried thinking about it from a different angle. During this weekend the big difficulty has been the communication from XBMC to EventGhost in what I have tried, there have been numerous macro attempts in EventGhost that seemed to work fine when pressing the test button in EG. On these threads[url=http://forum.xbmc.org/showthread.php?tid=10 are where I got this idea...
1300]http://forum.xbmc.org/showthread.php?tid=101300[/url] and http://forum.melloware.com/viewtopic.php...18&start=0.
Since it seemed to work in EG as a Python script macro event, I thought why not just call the line straight from your cinema experience script (which is in python) and skip having to use EventGhost at all? I installed X10 Commander from here http://melloware.com/download/ , and now I seem to have it working perfectly.
On the top of your home_automation.py file I added urllib2 in the import lines and for the action codes I used
Code:
urllib2.urlopen('http://localhost:8086/?x10command=DEVICE~sendrf~"A2 OFF"')
urllib2.urlopen('http://localhost:8086/?x10command=DEVICE~sendrf~"A1 ON"')
urllib2.urlopen('http://localhost:8086/?x10command=DEVICE~sendrf~"A2 ON"')
urllib2.urlopen('http://localhost:8086/?x10command=DEVICE~sendrf~"A2 BRIGHT 30"')
etc
I will post my whole working code here, A1 are multicolored strobe lights on my mantel, A2 is my lamp
Code:
# This module's future home should be inside userdata/addon_data/script.cinema.experience/ha_scripts
# to make sure it does not get over written when updating the script
import xbmc, xbmcaddon, urllib2
_A_ = xbmcaddon.Addon('script.cinema.experience')
_L_ = _A_.getLocalizedString
_S_ = _A_.getSetting
def activate_on( trigger = "None" ):
"""
Scripting to trigger almost anything(HA, other scripts, etc...) when videos start.
Usage:
activate_on( "Movie" )
will trigger code that is set under the Movie heading.
"""
if trigger == "None":
xbmc.log( "[script.cinema.experience] - [ home_automation.py ] - No Trigger Sent, Returning", level=xbmc.LOGNOTICE )
return
xbmc.log( "[script.cinema.experience] - [ home_automation.py ] - activate_on( %s ) Triggered" % trigger, level=xbmc.LOGNOTICE )
# Script Start
if trigger == _L_( 32613 ) and _S_( "ha_script_start" ) == "true":
xbmc.log( "[script.cinema.experience] - [ home_automation.py ] - %s Triggered" % _L_( 32613 ), level=xbmc.LOGNOTICE )
# place code below this line
urllib2.urlopen('http://localhost:8086/?x10command=DEVICE~sendrf~"A2 OFF"')
# Trivia Intro
elif trigger == _L_( 32609 ) and _S_( "ha_trivia_intro" ) == "true":
xbmc.log( "[script.cinema.experience] - [ home_automation.py ] - %s Triggered" % _L_( 32609 ), level=xbmc.LOGNOTICE )
# place code below this line
urllib2.urlopen('http://localhost:8086/?x10command=DEVICE~sendrf~"A1 ON"')
# Trivia
elif trigger ==_L_( 32615 ) and _S_( "ha_trivia_start" ) == "true":
xbmc.log( "[script.cinema.experience] - [ home_automation.py ] - %s Triggered" % _L_( 32615 ), level=xbmc.LOGNOTICE )
# place code below this line
urllib2.urlopen('http://localhost:8086/?x10command=DEVICE~sendrf~"A1 OFF"')
urllib2.urlopen('http://localhost:8086/?x10command=DEVICE~sendrf~"A2 ON"')
urllib2.urlopen('http://localhost:8086/?x10command=DEVICE~sendrf~"A2 BRIGHT 30"')
# Trivia Outro
elif trigger ==_L_( 32610 ) and _S_( "ha_trivia_outro" ) == "true":
xbmc.log( "[script.cinema.experience] - [ home_automation.py ] - %s Triggered" % _L_( 32610 ), level=xbmc.LOGNOTICE )
# place code below this line
urllib2.urlopen('http://localhost:8086/?x10command=DEVICE~sendrf~"A1 ON"')
# Movie Theatre Intro
elif trigger ==_L_( 32607 ) and _S_( "ha_mte_intro" ) == "true":
xbmc.log( "[script.cinema.experience] - [ home_automation.py ] - %s Triggered" % _L_( 32607 ), level=xbmc.LOGNOTICE )
# place code below this line
urllib2.urlopen('http://localhost:8086/?x10command=DEVICE~sendrf~"A1 OFF"')
# Coming Attractions Intro
elif trigger ==_L_( 32600 ) and _S_( "ha_cav_intro" ) == "true":
xbmc.log( "[script.cinema.experience] - [ home_automation.py ] - %s Triggered" % _L_( 32600 ), level=xbmc.LOGNOTICE )
# place code below this line
urllib2.urlopen('http://localhost:8086/?x10command=DEVICE~sendrf~"A1 ON"')
# Trailer
elif trigger ==_L_( 32605 ) and _S_( "ha_trailer_start" ) == "true":
xbmc.log( "[script.cinema.experience] - [ home_automation.py ] - %s Triggered" % _L_( 32605 ), level=xbmc.LOGNOTICE )
# place code below this line
urllib2.urlopen('http://localhost:8086/?x10command=DEVICE~sendrf~"A1 OFF"')
urllib2.urlopen('http://localhost:8086/?x10command=DEVICE~sendrf~"A2 OFF"')
# Coming Attractions Outro
elif trigger ==_L_( 32608 ) and _S_( "ha_cav_outro" ) == "true":
xbmc.log( "[script.cinema.experience] - [ home_automation.py ] - %s Triggered" % _L_( 32608 ), level=xbmc.LOGNOTICE )
# place code below this line
urllib2.urlopen('http://localhost:8086/?x10command=DEVICE~sendrf~"A2 ON"')
urllib2.urlopen('http://localhost:8086/?x10command=DEVICE~sendrf~"A2 BRIGHT 30"')
# Feature Presentation Intro
elif trigger ==_L_( 32601 ) and _S_( "ha_fpv_intro" ) == "true":
xbmc.log( "[script.cinema.experience] - [ home_automation.py ] - %s Triggered" % _L_( 32601 ), level=xbmc.LOGNOTICE )
# place code below this line
urllib2.urlopen('http://localhost:8086/?x10command=DEVICE~sendrf~"A1 ON"')
# MPAA Rating
elif trigger ==_L_( 32603 ) and _S_( "ha_mpaa_rating" ) == "true":
xbmc.log( "[script.cinema.experience] - [ home_automation.py ] - %s Triggered" % _L_( 32603 ), level=xbmc.LOGNOTICE )
# place code below this line
urllib2.urlopen('http://localhost:8086/?x10command=DEVICE~sendrf~"A1 OFF"')
# Countdown
elif trigger ==_L_( 32611 ) and _S_( "ha_countdown_video" ) == "true":
xbmc.log( "[script.cinema.experience] - [ home_automation.py ] - %s Triggered" % _L_( 32611 ), level=xbmc.LOGNOTICE )
# place code below this line
urllib2.urlopen('http://localhost:8086/?x10command=DEVICE~sendrf~"A2 OFF"')
# Audio Format
elif trigger ==_L_( 32606 ) and _S_( "ha_audio_format" ) == "true":
xbmc.log( "[script.cinema.experience] - [ home_automation.py ] - %s Triggered" % _L_( 32606 ), level=xbmc.LOGNOTICE )
# place code below this line
urllib2.urlopen('http://localhost:8086/?x10command=DEVICE~sendrf~"A2 ON"')
urllib2.urlopen('http://localhost:8086/?x10command=DEVICE~sendrf~"A2 BRIGHT 100"')
urllib2.urlopen('http://localhost:8086/?x10command=DEVICE~sendrf~"A2 OFF"')
urllib2.urlopen('http://localhost:8086/?x10command=DEVICE~sendrf~"A2 ON"')
urllib2.urlopen('http://localhost:8086/?x10command=DEVICE~sendrf~"A2 BRIGHT 100"')
urllib2.urlopen('http://localhost:8086/?x10command=DEVICE~sendrf~"A2 OFF"')
urllib2.urlopen('http://localhost:8086/?x10command=DEVICE~sendrf~"A2 ON"')
urllib2.urlopen('http://localhost:8086/?x10command=DEVICE~sendrf~"A2 BRIGHT 100"')
# Movie
elif trigger ==_L_( 32616 ) and _S_( "ha_movie" ) == "true":
xbmc.log( "[script.cinema.experience] - [ home_automation.py ] - %s Triggered" % _L_( 32616 ), level=xbmc.LOGNOTICE )
# place code below this line
urllib2.urlopen('http://localhost:8086/?x10command=DEVICE~sendrf~"A2 OFF"')