PDA

View Full Version : Controlling external Amp



JiMPO
2011-12-26, 13:13
Hi all,

I've recently joined the happy Squeezebox community and must say I'm quite excited about it. For now I only have two devices, a radio which is working like a charm and squeezeslave runnning on my linux box which is working almost fine (but that's another story that will probably require a separate thread if latest version doesn't fix my problem).

Back to the point, I would like to control my external Amp that squeezeslave is sending sound to (ie: power it on and change source) when I do power on/off of the source. I can do that outside the squeezebox environment with my IR transmitter and lirc (irsend) from the command-line. So basically, all I'm missing is a field somewhere where I could say that I want to execute this script automatically (ie: ampon.sh) when I power-on my squeezeslave and another one for the shutdown.

I've looked around quiet a bit but didn't find anything existing that fit my needs.

Two questions here:

1/ Have I missed THE plugin that would do what I'm asking ? (I've found two plugin that are pretty close: IR Blaster and DenonAvpControl but they are both not compliant with my setup)

2/ If there isn't anything existing and I need to write something myself, where should that plugin sit ideally in the picture ? Close to squeezebox server or close to the player (ie: squeezeslave) ? As of now I would say "server" but if others with more experience could give their feedback that would be much appreciated.

Cheers,
JiM.

epoch1970
2011-12-28, 13:46
You probably do not need a plugin.
Have a look at http://localhost:9000/html/docs/help.html (the help pages from the local SBS server), especially "Help > Technical Information > Command Line Interface"
or "Help > Technical Information > Squeezebox Server Web Interface" (looks a bit simpler but I never used that info).
From there you could have ampon.sh send a CLI command to the server in order to power on or set to play your squeezeslave instance
There are many examples of using the CLI on these forums, do a search and you'll find examples, or even scripts.
(Note: I don't see how the CLI could not work with squeezeslave, but I have only used it on hardware players or w/ softsqueeze.)

However, for me I'd put the player as the master of the system. In this case, you would need a plugin. Again, for me, IRBlaster is perfect in this role: when I power on a player (or when an alarm starts it, or when delayed player sleep occurs), IRBlaster sends the codes to switch the power on/off and set the correct source.

Writing or adapting a plugin is more involved than slapping a few CLI (netcat or JSON) commands in a shell script. However if you intend to make your script really smart, you'll end-up writing a lot of semi-reliable code. I'd say start with the CLI and see where it goes.

JiMPO
2011-12-29, 14:48
Thanks for your feedback epoch1970. I went to the docs (didn't notice the link before) but unfortunately the CLI exposed here is to control the server (or a client) what I'm trying to achieve is quiet different.

I'll try to describe it differently.

1/ First action (ie: squeezebox client power on) will be made either on the server web interface or a squeezebox compatible remote control (ie: iPeng)
2/ That first action will then virtually power on my squeezebox playing device (ie: squeezeslave)
3/ And then run my shell script on the server (ie: ampon.sh)
4/ The script will send the IR signals (via lirc) to power-on my amp and chance the source

That's why I think I need a plugin in order to be able to achieve that. Since the script need to run on the box where I've both the players and the server I could implement that either on the server side or on squeezeslave but the server seems to be more "plugin" friendly.

IRBlaster would do exactly what I need except that it can only send IR signals on some specifics squeezebox players (SB classic, transporter or touch) but not squeezeslave w/lirc.

Regards,
JiM.

erland
2011-12-29, 19:18
Sounds like the "ExecuteScript" plugin will do exactly what you want, it will allow you to run a script on power on and power off. Currently it's only marked as compatible with server version 7.6 and earlier, but it might work with 7.7 also but you would have to manually install it.

In 7.6 and earlier you will find it in the "Plugins" tab in SBS/LMS Settings, in 7.7 you will currently have to manually install it by downloading it from the developer site: http://kdfplugins.googlecode.com/files/ExecuteScript-r51.zip

Jackisidore
2012-07-04, 13:38
Sounds like the "ExecuteScript" plugin will do exactly what you want, it will allow you to run a script on power on and power off. Currently it's only marked as compatible with server version 7.6 and earlier, but it might work with 7.7 also but you would have to manually install it.

In 7.6 and earlier you will find it in the "Plugins" tab in SBS/LMS Settings, in 7.7 you will currently have to manually install it by downloading it from the developer site: http://kdfplugins.googlecode.com/files/ExecuteScript-r51.zip

This is exactly what I wanted (trigger a script when a player powers on). Download and installed the plugin. I do see its settings screen, created a script folder and can select the scripts in this folder. My squeezebox classic also displays "running script test.sh" and that's it the script doesn't execute on the Mac