I’ve just finished making the surround for my TV after testing it all with sticky tape 🙂 it’s looks awesome.
But the first question I was asked “How do I turn it off?”, Apparently the answer of “You don’t” wasn’t the right one. So a little searching brought me to a fellow blog post http://blog.nadnerb.co.uk/?p=11 which takes you through setting up a remote button in xbmc to disable the service.
While I’d be happy with the remote button option, turning the entire service on and off doesn’t sit well with me, what if I want to set mood lighting from my phone 🙂
So I had a little play with hyperion-remote and thought yeah I can script that. So below is my quick and dirty alternative to disabling the service.
First connect to the PI and create a new file (I called it hyperion_toggle_black.sh)
nano -w hyperion_toggle_black.sh
hyper_check=`hyperion-remote -l | grep -i ""priority" : $priority"`
if [ -z "$hyper_check" ]
hyperion-remote -p $priority -c black
hyperion-remote -p $priority -x
chmod +x hyperion_toggle_black.sh
nano -w /home/pi/.xbmc/userdata/keymaps/remote.xml
Adding the line lines
Within the Home>Remote section, but keeping the Global>Remote as
Reboot the PI and viola. There’s about a 1 second delay between pressing the button and the LED’s going off/on, but I can live with that for now.
I’m not entirely sure if turning the LED’s Black actually turns them off (i.e. no power) so I may in the future expand it with maybe a relay to control the actual power to the LED’s, but this would break the priority thing unless I put in some checks and run the script in the background.
I could also then add a push button to the PI’s GPIO triggering the on/off script at more of a physical level, hey I could even add a few buttons to be able to select an effect. but for now I’m happy to do all of that via my phone, and just have a priority function for XBMC.