Good morning all.
First thanks for the script! It’s absolutely fantastic and it’s been a smash hit with everyone who has experienced it.
I’m trying to enhance the experience with a little lighting, built from what I have hanging around. At the moment that’s an arduino UNO board and a short length of RGB LED strip. The arduino end of things is all sorted out and I have it set up to respond to three serial commands. 0 - the default - is black out, 1 is full red and 2 is a dimmed red.
I’m trying to get cinema experience to send a 0, 1 or 2 down the serial line at the appropriate time.
I’m running Eden and have installed pyserial and can issue commands from the python prompt that the arduino responds too so the basic setup works. I have hit a small problem when it comes to automating that function with the home_automation.py script.
Here’s what I’ve done.
- I have imported serial into the script.
- I setup the serial port with ser = serial.Serial(‘/dev/ttyACM0’,9600)
- And then at the appropriate trigger further down I issue ser.write(‘1’)
I made a mistake the first time, as I copied and pasted from the test script I was using on my windows machine and that mistake has haunted ever since! On windows I addressed the arduino’s serial port as ‘10’ and that worked fine. Over on my linux box the port is ‘/dev/ttyACM0’ I quickly spotted that in the error log when the script refused to run and corrected it in the script.
However even with the correction in place the scrip bombs out with the same error each time; that it can’t find the device ‘10’. I know I have corrected it, and I have rebooted the system a couple of times into the bargain, checking back after the reboot to make sure the change to home_automation.py is persistent.
Latest log from last night is here:
http://xbmclogs.com/show.php?id=3628
You can see the line that is no longer in the script being called at line 133.
This is the top of the script:
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, serial
ser = serial.Serial('/dev/ttyACM0', 9600)
_A_ = xbmcaddon.Addon('script.cinema.experience')
_L_ = _A_.getLocalizedString
_S_ = _A_.getSetting
def activate_on( trigger = "None" ):
etc, then
Code:
if trigger == _L_( 32613 ) and _S_( "ha_script_start" ) == "true":
xbmc.log( "[script.cinema.experience] - [ home_automation.py ] - %s Triggered" % _L_( 32613 ), l$
# place code below this line
ser.write('1')
So my question is ‘Am I missing something?’
Is the script cached somewhere? Do I need to make changes in more than one place? At the moment I can’t even get into the scrip config so I’m at a bit of a loss.
Just to complicate things a bit, the whole setup is running on a Raspberry Pi! I don’t think that will make any difference to this problem as at the end of the day it’s just a linux box.
Anything anyone can suggest would be gratefully received.
Many thanks
Tom