The module enables control of a Squeezebox device through the CLI (command line interface) of the Squeezebox server (a.k.a. Logitech Media server).


This module connects to the Squeezebox server through the telnet interface. The following preparations need to be done to get the code up and running:

Create the Squeezebox devices in the mht file or in user code:

Note: [parameters] are optional.

.mht file:

  CODE, require SqueezeboxCLI; #noloop 
  CODE, $squeezecenter = new SqueezeboxCLI_Interface('hostname'); #noloop 
  CODE, $sb_living  = new SqueezeboxCLI_Player('living', $squeezecenter, [coupled_device], [auto_off_time]); #noloop
  CODE, $sb_kitchen = new SqueezeboxCLI_Player('kitchen', $squeezecenter, [coupled_device], [auto_off_time]); #noloop

Optional parameters:

you can add a 'coupled device' to the Squeezebox. You would typically use this when you want to switch the amplifier together with the Squeezebox. Couple a device with: CODE, $sb_living->couple_device($amplifier_living);
you can set an 'auto-off' time in minutes. When the player gets paused, you can define after how many minutes is should be turned off completely. This is useful when you have defined a coupled device to avoid the amplifier to be on for too long after a playlist is paused.

To play a file or URL from your user code you can use this function call:


For additional debugging, add the option squeezeboxcli:3 to the 'debug' entry to your mh.ini.private file.


This module allows to control and to monitor the state over a Squeezebox player through the telnet command line interface of the server. It also allows you to play notifications. Notifications can either be local files or URLs.


  URI::Escape       - The CLI interface uses an escaped format
new(name, interface, amplifier, auto_off_time)

Creates a Squeezebox_Player object. The following parameter are required:

interface: the object that is the CLI interface to assign this player to.

The following parameters are optional

amplifier: the object that needs to be enabled and disabled together with the squeezebox
auto_off_time: the time (in minutes) the squeezebox and the optional attached amplifier should be turned off after a playlist has ended
preheat_time: the time (in seconds) the amplifier should be turned on before a notification is played if the amplifier is off. This enables the amplifier to turn on and enable the speakers before the notification is played.

Interprete the data that is received from the CLI interface. Called from the gateway module.


Handle state changes of the Squeezeboxes


Add states to the device


Couple another MisterHouse object to the Squeezebox device so that this device follows the state of the Squeezebox. This can e.g. be used to switch an amplifier on when the Squeezebox starts playing.

play_notification(notification, <optional_volume)>

Play a notification on this squeezebox. The notification can either be a file or an URL. This function stops the current playback, plays the notification and then returns the Squeezebox to the previous state. Credits to @rudybrian for writing the first version of this code and his permission to re-use it!

You can pass an extra parameter <volume> that is used for the notification.

Note: currently this function does not support multiple notifications being pushed at the same time

play(media, [volume])

Changes the playlist to a new media file

Parameters are the media (a file or an URL) and optionally the volume at which to play the media.

play_playlist(name, [volume])

Changes the playlist to a new playlist.

Parameters are the playlist name and optionally the volume at which to play the media.


Saves the current state of the Squeezebox so that it can be restored later


Resume the Squeezebox state from the previously saved state


Helper function to send a command to the squeezebox over the CLI


Hey! The above document had some coding errors, which are explained below:

Around line 203:

'=item' outside of any '=over'

=over without closing =back