We have moved at community.getvera.com

Author Topic: Squeezebox Server and Vera - Part II: Using the SBS CLI  (Read 6575 times)

Offline Ap15e

  • Beta Testers
  • Hero Member
  • *****
  • Posts: 1998
  • Karma: +12/-0
Squeezebox Server and Vera - Part II: Using the SBS CLI
« on: May 13, 2010, 08:48:03 pm »
Luup/Lua skeleton

socket=require('socket')
local client = socket.connect('<IP address of SBS>', 9090)
client:send("<CLI command>\n")
local result=client:receive()
...

For a list of valid <CLI command> navigate to SBS's Home / Technical Information / Help / Command Line Interface

Some examples for <CLI command>

Displaying text
<MAC address of player> display <line1> <line2> <duration>
client:send("00:04:20:XX:XX:XX display Hello%20World%201 Hello%20World%202 10\n")

Note: IIRC, <duration> does not work for Squeezebox Radio

'Pressing' a button on the Suqeezebox remote
<MAC address of player> button <buttoncode>
client:send("00:04:20:XX:XX:XX button brightness_toggle\n")
client:send("00:04:20:XX:XX:XX button volume_up\n")
client:send("00:04:20:XX:XX:XX button volume_down\n")

<buttoncode> as defined in Default.map;
telnet to your SBS port 9090, type 'subscribe button' (without quotes),
press <RETURN>, press the buttons of the remote to get the buttoncodes

Skipping to the previous/next track
<MAC address of player> playlist index <index|+index|-index|?> <fadeInSecs>
client:send("00:04:20:XX:XX:XX playlist index -1\n")
client:send("00:04:20:XX:XX:XX playlist index +1\n")

Pause/Unpause playing
<MAC address of player> pause <0|1|>  <fadeInSecs>  <suppressShowBriefly>  
client:send("00:04:20:XX:XX:XX pause\n")

Changing the volume level
<MAC address of player> mixer volume <0 .. 100|-100 .. +100|?>
client:send("00:04:20:XX:XX:XX mixer volume +10\n")
client:send("00:04:20:XX:XX:XX mixer volume -10\n")

Switching players (undocumented and untested)
switchplayer from:<MAC address of player1> to:<MAC address of player2>
client:send("switchplayer from:00:00:00:00:00:01 to:00:00:00:00:00:02\n")
[Reference: http://www.mail-archive.com/plugins@lists.slimdevices.com/msg46077.html]

To be continued.
« Last Edit: June 27, 2010, 09:20:55 am by Ap15e »

Offline 325xi

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1101
  • Karma: +0/-0
  • V1, V2, still V2...
Re: Squeezebox Server and Vera - Part II: Using the SBS CLI
« Reply #1 on: May 13, 2010, 10:53:06 pm »
Does it have to be MAC, not IP?

Offline Ap15e

  • Beta Testers
  • Hero Member
  • *****
  • Posts: 1998
  • Karma: +12/-0
Re: Squeezebox Server and Vera - Part II: Using the SBS CLI
« Reply #2 on: May 14, 2010, 05:07:48 am »
The SBS documentation is a bit vague on this point:

Quote
<playerid> is the unique identifier for the player, usually (but not guaranteed to be) the MAC address of the player. Some commands are global to the Squeezebox Server and do not require a <playerid>. For commands requiring it, a random player will be selected by the Squeezebox Server if the <playerid> is omitted, and returned in the server reply. <playerid> may be obtained by using the "player id" or "players" queries.

Software players for SBS (e.g. SqueezePlay) obviously do not have a MAC address, so the IP address must be used. So I think the IP address should work for hardware players, too.

Do you see any drawbacks (besides privacy issues) to using the MAC address?
« Last Edit: May 14, 2010, 05:11:25 am by Ap15e »