View Full Version : Detect player on/off state from server?

2008-07-10, 15:48
Is there a way to determine the on/off state of a player (Squeezebox v3) from a script on the SqueezeCenter server?

Server OS: CentOS 5.2 (linux)
SqueezeCenter: 7.0.1

Can I find the state by a query to the MySQL databbase or are there any other ways to determine this? Simple ways is better then complicated :-)

Why do I need this?

I want to turn on/off the power to my amplifier when my player is on or off. This is done remote with the help of:

1) USB/Tellstick ( http://www.telldus.se/ )
2) NEXA Remote controlled power switch
( http://www.nexa.se/SYCR3500WExtramottagare.htm ) (Text in swedish)


2008-07-10, 16:13
You want not only to tell if the player is currently on or off, but also when the state changes. I'd suggest you look at modifying the Power Switch plugins to do what you want. You could try tweaking my PowerCenter plugin, but it's gotten rather bloated and I've not yet found the time to rework the APIs for dealing with different systems, or do some other code cleanup. Currently the code is very hackish, especially the later versions that include 'heyu' support on Linux. If you *only* want to control power to your amp, I imagine you would be happier starting with Power Switch. Oh, and you might want to measure the power draw of your amp. Many are quite efficient, drawing less than 1-2 watts when nothing is playing. It might not be worth the trouble.

But if you want to control multiple devices, some independent of the Squeezebox power status, you might want to look at PowerCenter (nee BottleRocket).


2008-07-11, 06:10
You can also use the CLI to check power status (and I think get notifications of changes) if you want to do it remotely from the SC. The docs are in the help section of SC.