Quantcast
Channel: Squeezebox : Community : Forums - 3rd Party Software
Viewing all articles
Browse latest Browse all 2059

IR Blaster Companion App

$
0
0
Hi All,

I've developed a little webpage that sends commands to the irBlaster plugin to allow you to control your hi-fi from any javascript-enabled web browser. It's very much a proof-of-concept idea but I have tried it on my laptop (Vista/ie9) and on my HTC phone (Android ICS) and it works great so I thought I'd share it with you.

What it can do:
  • Use any web browser to send any command to any device that irBlaster is configured to use.
  • Send codes repeatedly (useful for volume changes).
  • Send Macros (eg turn on then select input).
  • There is a little status box at the top that indicates when the command-set has finished.


Pre-requisites:
  • Squeezebox server running the irBlaster plugin.
  • SB2/3/Transporter/Touch with ir emitter.
  • irBlaster plugin correctly configured with a lirc file.
  • (Basically if the irBlaster plugin works then so should this!)


What you need to do to make it work:
  • BEWARE - Javascript is case-sensitive!
  • Download the attached .txt file and save it either locally or to a web site, then rename it to *.html.
  • Open the file in a text editor and modify lines 13-16 to hold the details of your SBS server, the irBlaster enabled player, and the target device (from the lirc file).
  • Edit lines 289-295 to change the sample codes into something that is useful for you. You can add or remove lines here if you wish.
  • Open the file in your web-browser, enable javascript, click a link, and your device should respond!


Technical details:
The page uses javascript and AJAX (I think - I have never done any web programming before) to send asynchronous HTTP GET requests to the irBlaster CLI on a timer.
The function that does this is simply called 'Send()' and it always returns false to prevent migration away from the page every time a command is sent. Send() takes an unlimited number of arguments, each of which is an array with the structure:
Code:

['command1'<, <'device1'><, <count1><, <pause1>>>>], ['command2'<, <'device2'><, <count2><, <pause2>>>>], ...

(<...> denote optional parameters)

device, count and pause are optional.
If device is missing or null then DEFAULT_DEVICE is used (from line 16).
If count is missing or null then 1 is used.
If pause is missing or null then 0 is used.

The first command is sent count times, then the page waits for pause * 150 ms, then the second command is sent and so on.

eg, To turn your default device on, wait 1.5s, change to CD input, and turn the volume up five notches you would use something like this (although the command names may be different in your lirc file):
Code:

return Send(['Power_On',,,10], ['CD'], ['Volume_Up',,5])
Ultimately I would like to get the list of players, devices and commands from the SBS server and use them to populate some drop-downs so it would be usable immediatly (you would still need to enter the server details though) but I haven't figured out how to do this or even if it's possible. I would also like some funky buttons instead of boring hyperlinks - maybe some web guru could skin it but html really isn't my thing!

Enjoy,
Indifference_Engine


PS: There is an android app that is supposed to be able to do the same thing as this page but with a nice GUI (www.coversal.com and look for 'Custom http Plugin') but I can't get it to work on my phone! If anyone wants to give it a go, the configuration prefix to use with it is:
Code:

status?player={playerID}&p0=irblaster&p1=send&p2={device}&p3=
Attached Files

Viewing all articles
Browse latest Browse all 2059

Trending Articles