Posts: 34
Joined: Aug 2010
Reputation:
0
2012-05-03, 13:10
(This post was last modified: 2012-05-09, 02:01 by dynamis_dk.)
So as part of a media centre I'm building I'd like to have a few LEDs which I can have controlled via the current state of what XBMC is doing.
As an example I'd like to have a Blue LED light on when I'm playing back / off when playback stopped, a Red LED when its not doing anything, a Green LED when the library is updating in the background etc.
Is there anything out there which could help me with this? I'm not familiar with any which specifically do this but Ive seen there is some dealing with ambient light so not sure if this could be tweaked.
I've basic skills in coding and electronics but don't know much about how the XBMC system works to provide usable things in the background.
Posts: 31,445
Joined: Jan 2011
You could probably do something with the
JSON-RPC API (wiki) or even the older
Web Server HTTP API (wiki) to get the status of XBMC.
Posts: 16,946
Joined: Feb 2011
Reputation:
256
Mhh sounds like the job for an python addon.
AppleTV4/iPhone/iPod/iPad: HowTo find debug logs and everything else which the devs like so much:
click here
HowTo setup NFS for Kodi:
NFS (wiki)
HowTo configure avahi (zeroconf):
Avahi_Zeroconf (wiki)
READ THE IOS FAQ!:
iOS FAQ (wiki)
Posts: 34
Joined: Aug 2010
Reputation:
0
I've had a quick look over the JSON-RPC API details and there a few notification things which may work.
Afraid I've no python experience so might be a steep learning curve for me so I'm going to have to get some more examples.
Any suggestions on options how to link in a python addon to external LEDs? Still not sure what functionality the arduino systems may give.
I thought something along the lines of Addon talked to XBMC to get status --> this tells the arduno the status --> this uses the status to enable / disable the LEDs
Posts: 7,256
Joined: Nov 2008
Reputation:
121
You can write a Python script that receives notifications when playback starts, stops, etc. I've got a template lying around somewhere that you could easily hack. This seems to be the easiest way to get started. You just need some way to interface with your LEDs from Python.
Posts: 34
Joined: Aug 2010
Reputation:
0
jhsrennie - did you managed to lay your hands on the template you thought you may have?
Thanks GomezAddams - nice idea but this is only part of the solutions I'm after. Without giving too much away I'm also going to be controlling other actions if I use a arduino and the main downside is hte itx board I have, no LTP port :p
I've done a little digging work and should be able to use an arduino controlled via serial using python to update the arduino with the current media state and control what the external LED's are doing for any given state in XBMC.
I'm a little confused on addon vs scripts. By the looks of it, I can create a addon and have it run as a xbmc service so its 'always on' in the background checking with xbmc for its current status. This correct? Having a addon constantly looping with a 'if mediaplayback = true then updateLED' (<-- just to show example - not code), would it have any possible side effects to performance?
Afraid you'll have to excuse any questions of obvious nature, only coded VB/SBScript and pascal in my college days so not to familiar with python.
Would be really useful if there was something build into xbmc which allowed a 'run script on action' type situation so I could say on Media Playback, run LEDupdate.py etc.
Posts: 15
Joined: Oct 2015
Reputation:
0
I do similar, but i dim the house lights when movie starts.
i send a http command to a self build small delphi server so i can receive commands from more then one device.
the delphi server sends the commands to the arduino.