XBMC Lighting Control on Play/Pause/Stop

Chixxi… any news?

A month ago you said, very soon… if you are going to release it do you have an ETA? If you don’t have time for it, it would be great if you could open source the code so others can attempt to finish it :slight_smile:

thx

I created the scripts presented here to control lighting based on play state in XBMC, but I was having a problem with XBMC hanging on exit. This is due to the way that the while loop is called in the scripts. You should change:

while(1):

– TO –

while(not xbmc.abortRequested):

This will allow XBMC to exit normally.

Since these scripts are constantly in a loop waiting for something to happen, running them increases my CPU usage to ~29% on my i3-2105 while XBMC is running. It is normally 6-9% without the playercontrols + idletime running. This is where a plugin in Vera to determine the state of XBMC and to use for triggers would come in handy, rather than running scripts in XBMC.

EDIT: I have discovered that combining these two scripts into one resolves the CPU usage issue. Now, CPU usage stays between 5 and 9% with the script running. Here are the playeractions.py and autoexec.py files if anyone is interested.

No good news, unfortunately:

http://forum.micasaverde.com/index.php/topic,10469.msg76114.html#msg76114

I was looking forward to trying it too. :frowning:

Go here: http://forum.micasaverde.com/index.php/topic,13249.0.html

Hi all,

New to this - so a bit lost.
Firstly using Raspbmc - so no autoexec.py.
Anyway googled and found I need to add to rc.local
Ok - did that.
On running it doesn’t know what xbmc is…

pi@raspbmc:~/.xbmc/userdata$ python autoexec.py
Traceback (most recent call last):
File “autoexec.py”, line 4, in
import xbmc
ImportError: No module named xbmc

Can someone please help?

[quote=“pocster, post:45, topic:169994”]Hi all,

New to this - so a bit lost.
Firstly using Raspbmc - so no autoexec.py.
Anyway googled and found I need to add to rc.local
Ok - did that.
On running it doesn’t know what xbmc is…

pi@raspbmc:~/.xbmc/userdata$ python autoexec.py
Traceback (most recent call last):
File “autoexec.py”, line 4, in
import xbmc
ImportError: No module named xbmc

Can someone please help?[/quote]

Have a look at the last couple of post from this thread: http://forum.micasaverde.com/index.php/topic,13249.0.html

The user “Mic” created a little xbmc plugin which replaces the python scripts. I think it also run’s on the rasberry.

EDIT: I just saw you are already familiar with the other thread.

[quote=“OtisPreslsy, post:42, topic:169994”]I created the scripts presented here to control lighting based on play state in XBMC, but I was having a problem with XBMC hanging on exit. This is due to the way that the while loop is called in the scripts. You should change:

while(1):

– TO –

while(not xbmc.abortRequested):

This will allow XBMC to exit normally.

Since these scripts are constantly in a loop waiting for something to happen, running them increases my CPU usage to ~29% on my i3-2105 while XBMC is running. It is normally 6-9% without the playercontrols + idletime running. This is where a plugin in Vera to determine the state of XBMC and to use for triggers would come in handy, rather than running scripts in XBMC.

EDIT: I have discovered that combining these two scripts into one resolves the CPU usage issue. Now, CPU usage stays between 5 and 9% with the script running. Here are the playeractions.py and autoexec.py files if anyone is interested.[/quote]

This was because I accidentally left a couple spaces out, which I fixed for a commenter on my site a year ago (forgot about this thread, as it stopped emailing me updates)

“To anyone else concerned - I got this resolved. I was missing two spaces in the idletime.py script which left xbmc.sleep(5000) outside of the loop so it ran constantly.”

For anyone wanting to do this XBMC Z-Wave integration, I wrote a step-by-step guide with a video demo…

I hope this helps!