PDA

View Full Version : Turning SB on or off and controlling volume from timers?



mskvarenina
2008-10-10, 19:30
I'd like to be able to turn my SB receiver on at a certain time of the day and turn it off at a certain time. I'd also like to regulate the volume based on the time of day.

Can this be done and if so how?

peterw
2008-10-10, 20:03
I'd like to be able to turn my SB receiver on at a certain time of the day and turn it off at a certain time. I'd also like to regulate the volume based on the time of day.

Can this be done and if so how?

With some work, sure. SqueezeCenter and your Receiver can be controlled by any of the following:
- Perl "plugins" running inside SqueezeCenter
- applications on your server or network using the telnet-like Command Line Interface
- applications on your server or network using the simple HTTP interface
- applications on your server or network using the Comet/JSON interface used by the Controller and SqueezePlay apps
- applications on your server or network using the xPL interface

The simple HTTP interface is probably easiest -- one quick wget/WebRequest per command (power on, volume to NNN) in a script run as a cron job / scheduled task.

mskvarenina
2008-10-11, 04:20
peterw,

Would you mind posting a small working example. I'm sure if I see it once I'll be able to modify it to meet my need.

For example purposes, let's say I wanted to turn on RECEIVER1, set volume to 50(%) and set the playlist to PLAYLIST1.

From what you said earlier I'd setup a PERL script and have the Windows scheduler run it at a specific time.

bpa
2008-10-11, 05:15
WHy not use alarms ? It may not be quite the functionality you need but no coding.

An alarm to turn it on with a long duration.

An alarm which plays a short track of silence to turn it off.

mskvarenina
2008-10-11, 05:28
I'm a programmer/software developer by trade. I just don't know the commands or parameters for the SB so a simple example would be great.

Don't know much about alarms, if they can select a playlist at a certain volume at a certain time then they may work but you can always do more with direct programming.

mskvarenina
2008-10-11, 05:51
How about the srvrpowerctrl plugin? It looks at first glace like this plugin can do all of this???

peterw
2008-10-11, 08:02
peterw,

Would you mind posting a small working example. I'm sure if I see it once I'll be able to modify it to meet my need.

For example purposes, let's say I wanted to turn on RECEIVER1, set volume to 50(%) and set the playlist to PLAYLIST1.

From what you said earlier I'd setup a PERL script and have the Windows scheduler run it at a specific time.

One relatively easy route is this: open the web interface in Classic mode (http://yourip:9000/Classic/). Look at the right-hand pane. Copy the URL associated with the Power On link, e.g.

http://noir:9000/Classic/status_header.html?p0=power&p1=1&player=00%3A04%3A20%3A11%3A22%3A33

Request that URL in a new window. You'll probably see an error that displays a longer URL like

http://noir:9000/Classic/status_header.html?p0=power&p1=1&player=00%3A04%3A20%3A11%3A22%3A33;cauth=bigstring here

It's that latter URL that your script should request. In Perl you could use the LWP module to do it. In Linux you'd just use 'wget'. In Windows I'd probably install PowerShell and use a .Net object in a PS1 script (be sure to set the execution policy for powershell to allow unsigned local scripts).

Figure out each such URL you need, string 'em together, schedule it.

rfreedman
2008-10-11, 12:02
If you are programmer, then the CLI (command line interface) should be pretty easy to work with.

The documentation is on your slimserver - you can get to it at yourserver:9000/html/docs/cli-api.html

You can test your commands by using telnet to connect to your server on port 9090.

I wrote a Java program a while back that used this interface to put caller id on the SB display.

mskvarenina
2008-10-11, 20:54
If you are programmer, then the CLI (command line interface) should be pretty easy to work with.

The documentation is on your slimserver - you can get to it at yourserver:9000/html/docs/cli-api.html



Wow, this sounds and looks perfect! Thanks for the tip.

Now for the troubleshooting. I've tried to Telnet to the server, port 9090 and I cannot connect. I've confirmed through the plugin page that CLI is enabled and the port is 9090. What am I doing wrong?

mherger
2008-10-12, 23:54
> Now for the troubleshooting. I've tried to Telnet to the server, port
> 9090 and I cannot connect. I've confirmed through the plugin page that
> CLI is enabled and the port is 9090. What am I doing wrong?

Make sure your firewall doesn't block port 9090

--

Michael

mskvarenina
2008-10-13, 18:45
Michael,

"That was easy".... I didn't think I had the MS firewall enabled but sure enough it was and port 9090 was not enabled. Enabling it gave me instant access to the slimserver. Thanks for the tip.

While researching the CLI I came across an article which describes controlling slimserver from a VB program. The article is here -->
http://www.pcw.co.uk/personal-computer-world/features/2204179/hands-controlling-slimserver-vb

The VB program is available here -->

http://www.itwriting.com/slimserver.php


I can program VB and with port 9090 enabled this program connects right up to my slimserver so I can use it as a guide to build my own time based controlling program.

Thanks everyone for the initial information...I'm sure I'll have some CLI questions as I get into it.

jwka
2008-10-29, 05:28
Hi,

I am having trouble to connect to the squeezecenter also.

I have disabled the firewall completely (for the tests).

I am having trouble from remote (other pc) as well as from the pc running squeezecenter.

Sorry to tell that the PC hosting squeezecenter is a Vista machine ...

The error number in Telnet by the way is "Could not ... on Port 23 (???) I entered "o xxx.xxx.xxx.xxx:9090" in the Telnet command line on the remote pc and "o localhost:9090" on the pc hosting squeezecenter.

And I do get the exact same error ... strange!