- Logitech Media Server 7.8
- Download Logitech Media Server Qpkg Software Free
- Download Logitech Media Server Software
Docker image for Logitech Media Server (SqueezeCenter, SqueezeboxServer, SlimServer)
Free logitech media server update download software at UpdateStar. Download Logitech Media Server software today and start listening to your personal music collection on a Squeezebox in any room in your home. Home of the Squeezebox™ & Transporter® network music players. QNAP NAS and Squeezebox Server. To use the NAS only to hold the files and to run the server software on another machine (cheap and cheerful and effective, like a. Open the Logitech Media Server Control Panel by double-clicking either the desktop or taskbar icon. Click the Library tab. Select the check box next to Use iTunes, and then click Apply. If Logitech Media Server doesn't automatically scan your iTunes database, go to the Status tab and, in the Media Scan Details section, click Rescan.
The Docker updates the system on restart to apply security and Linux updates.
To run LMS on Unraid:
docker run -d --name='LogitechMediaServer'
--net='bridge'
-p 3483:3483/tcp
-p 9000:9000/tcp
-p 9090:9090/tcp
-e PUID='99'
-e PGID='100'
-e TZ='America/New_York'
-v '/mnt/user/appdata/LogitechMediaServer':'/config':rw
-v '/mnt/user/Music':'/music':rw
logitechmediaserver
--net='bridge'
-p 3483:3483/tcp
-p 9000:9000/tcp
-p 9090:9090/tcp
-e PUID='99'
-e PGID='100'
-e TZ='America/New_York'
-v '/mnt/user/appdata/LogitechMediaServer':'/config':rw
-v '/mnt/user/Music':'/music':rw
logitechmediaserver
Changes:
2019-08-24
- Update to latest Nightly Build (7.9.2).
2019-04-21
- Update to latest Nightly Build (7.9.2).
2019-03-02
- Update to latest Nightly Build (7.9.2).
2018-12-08
- Update to latest Nightly Build (7.9.2).
2018-10-27
- Update to latest Nightly Build (7.9.2).
2018-08-11
- Update to latest Nightly Build (7.9.2).
2018-05-13
- Update to latest Nightly Build.
2018-03-03
- Update to latest Nightly Build.
- Update to phusion 10.0.
2017-12-31
- Update to latest Nightly Build.
2017-11-30
- Update base image.
2017-09-26
- Change to dlandon/baseimage - phusion 9.22.
2017-09-25
- Added pv (pipeview) required for latest Spotty.
2017-09-24
- Modifications to dockerfile for auto build.
2017-07-12
- Add perl OpenSSL packages.
2017-07-11
- Add OpenSSL package.
2017-07-09
- Add perl packages for IO::Socket::SSL.
2017-05-19
- Fix time zone.
2017-05-12
- Update 7.9.1 to latest.
2017-05-07
- Upgrade LMS to 7.9.1.
- Some organizational changes.
2017-04-23
- Organization and code cleanup.
2017-04-22
- Added PUID and PGID for proper appdata ownership settings for Unraid.
Documentation for Logitech Media Server
- 2Logitech Media Server in Domoticz
- 2.2Adding Hardware
- 6Audio Alerts via Squeezebox Players
- 6.3Setup process
- 7Using Ambient Light Sensor in SB-Radio and SB-Touch
- 8Transfer Playlist Among Players
- 9Sync/Unsync a Group of Players from Domoticz
- 10Spoken Now-Playing using Amazon Polly TTS
Introduction
Logitech Media Server (formerly SlimServer, SqueezeCenter and Squeezebox Server) is a streaming audio server supported by Logitech (formerly Slim Devices), developed in particular to support their Squeezebox range of digital audio receivers. Logitech EOL'd the product line in 2012 but the open-source LMS software is still actively developed in a so-called community effort. The latest version can be downloaded here - http://downloads.slimdevices.com/nightly. Synology provides updates to a fairly recent community build from time to time on their beta channel.
Logitech Media Server in Domoticz
Logitech Media Server Settings
Your Logitech Media Server must be configured to allow Domoticz to control the attached players. Default port for Web Server connections is 9000 or 9002.
Adding Hardware
Add the Logitech Media Server via the Hardware page under Settings. Fill in the IP of your Logitech Media Server and the port you specified.
Domoticz Settings
Click 'Setup' to see the detected/connected players.
- Poll interval controls how often Domoticz will attempt to reconnect to the Logitech Media Server to poll the player's status.
- Ping timeout controls how long Domoticz will try to contact the Logitech Media Server.
Detected Players
If you entered the correct IP & port of your Logitech Media Server, your players will be detected and displayed under Devices.It displays names and MAC-addresses.
Supported Models
The supported models are:
- Squeezebox 1
- Squeezebox 2
- Squeezebox 3
- Squeezebox Receiver
- Squeezebox Boom
- Squeezebox Controller
- SqueezePlay
- Squeezebox Radio
- Squeezebox Touch
- iPeng iOS App (iPhone & iPad)
- Max2Play SqueezePlug
- PiCoreplayer based on Squeezelite software
Troubleshooting
If your player model is not supported, it will be reported in the logfile. The logfile also reports detected players when starting the Logitech Media Server hardware.
Events and Notifications
Domoticz device events work for Logitech Media Players using both Blockly and LUA.
Events and notifications are triggered for:
On |
Off/Disconnected |
Play |
Pause |
Stop |
The following actions can be performed by using 'Set' on a Logitech Media Player.
On or Group On | Will turn the device on. |
Off or Group Off | Will turn the device off. |
Play | Will send a Play command. |
Pause | Will toggle between Play and Pause. |
Stop | Will send a Stop command. |
Set Volume <0-100> | Will set the volume of the player-output. |
Play Playlist <name> | Will play the playlist with name <name>. |
Play Favorites | Will play the favorites. |
Example:
commandArray['SqueezeBox']='On'
commandArray['SqueezeBox']='Play'
commandArray['SqueezeBox']='Set Volume 30'
commandArray['SqueezeBox']='Play Playlist WakeUpList1'
commandArray['SqueezeBox']='Play Favorites
On Screen Notifications
Domoticz can display notification messages on the screens of certain Logitech Media Players. This is configured via the Notifications tab on the Settings page as shown here:
Fill in the MAC-address (separated by a semicolon) and the duration that the message will be displayed on the screen (in seconds)The MAC-address of your player(s) can be found in the Hardware-settings of your Logitech Media Server hardware.
Known Issues
- (Song-)Titles with special characters will show wrong symbols in the logfile.
Work in Progress
- Add support for Timers (schedule your player to play playlists)
Audio Alerts via Squeezebox Players
The Squeezebox radio and boom players can be used to play audio alerts from Domoticz via the following perl scripts. The concept will work with any type of player (including software players) but the radio and boom are well-suited as they have their own amplifier and can therefore act autonomously.
Logitech Media Server 7.8
Two different approaches are shown. The first one uses a script that's multi-threaded and will play alerts on multiple players around your home at more or less the same time (but not truly synced). This has the advantage of not interfering with any syncgroups you may habitually use. The second approach assembles/disassembles a temporary syncgroup from the players in question, meaning no echo around the house if you deploy alerts to a lot of players at the same time. You can try both approaches and see which one works best for you. One thing worth knowing about syncgroups is that they often start out with a small time-difference between players which is then quickly corrected by LMS (it speeds up a lagging player to catch up). Cara install corel video studio x6. If this happens when playing an audio alert then part of the speech will be skipped over as the sync progresses. YMMV but if it happens a lot in your situation then it's best to use the multi-threaded version.
How it works
The basic idea (with both approaches) is to first retrieve and save several current parameters from each player: power state (on/off), play-mode (play/pause/stop), repeat-mode (none/song/playlist), current-playlist (if any), current time-position within currently-playing song (if any), plus the current volume setting. Next we play the desired alert audio clips - first a 'pre-chime' to get our attention, then the actual alert message MP3 audio file (you can pre-generate a series of these using e.g. text-to-speech software). In doing this we power-on each player if it was off, pause the current song if the player was active, set repeat to 'none' so we don't play an infinite loop of alerts, and set the desired volume-level. When we see the alert has come to an end, we return everything back the way it was prior to the alert. In the case of the second approach which builds temporary syncgroups, the group is also disassembled.
The heavy-lifting is done by a perl subroutine called &squeezeAlert which is contained in a perl script squeezealert.pl. In use, we will call this from a tiny bash script sqalert.sh which takes care of running the perl job as a background process so we return immediately to Domoticz and there's no waiting. This bash pre-script also allows us to use ssh to execute the perl on a remote machine if we need to (see below).
In the on-action / off-action fields of a Domoticz switch, you can now use a construct along the lines of
See the comments in the code for an exact description of the 4 parameters (players, prechime, ttsfile, volume). If it doesn't work for you, try specifying the full path to the bash file with a triple-slash
Tip: You can copy some of the audio clip files in a Windows /media folder over to your alerts directory as pre-alert chimes (the RingXX.wav ones are nice for this purpose). The spoken messages alerting for things like 'Motion detected in Hallway' or 'Garage door has been left open longer than 10 minutes' can be saved to mp3 files using an online service like Amazon Polly.
Setup Considerations
With all the perl scripts in this LMS wiki, some modules from CPAN (Comprehensive Perl Archive Network) need to be installed. This is no problem on Linux and on Windows, but is a major problem on Synology NAS devices which have a rather stripped-down Linux under the hood with no build environment. There is a simple workaround for this using remote scripting, but let's first get something clear about where/what needs to be installed. When any one of the perl scripts here are active, 3 different pieces of software are ultimately involved:
These 3 can all run on the same computer but they can also be run on 3 different computers with no problems whatsoever. Synology users can run both LMS and Domoticz e.g. on their Synology, but run the perl script(s) on a separate perl-friendly machine such as a spare RPi. This is possible because we can get a Domoticz on/off action to run a script on a remote machine by using ssh (explained below) with Public-Key Authentication. You also only need one instance of Domoticz running, so if you are using a separate machine for the perl-scripts then it does not need to have a slave Domoticz instance installed on it. Please keep this in mind when deciding on what machine(s) to run these packages. Also note that the ssh remote-scripting option is only needed when the perl-script is remote to the Domoticz machine - it doesn't matter if LMS is remote or not.
Setup process
Note: The temporary now-playing playlist saved for restoring after the alert is played will be stored in your regular LMS playlists folder as defined in your LMS configuration. You must define a playlists folder (even if you use Spotify) or else resuming the current song after the alert plays will go wrong and Spotty will just stop after the alert. In the LMS web interface, go to settings --> basic settings --> playlists folder. Also, please ensure that the folder has read/write permissions set correctly (on Linux, chmod 666).
For the local audio files, it's best to create a subfolder in your LMS music folder called alerts and to put all your pre-chimes and alert-TTS files in there.
First make sure perl is installed (it very likely is on a linux-based OS) and then install the modules from CPAN that we need (note: Parallel::Loops is not needed for the syncgroup version):
Create a bash script called sqalert.sh with the following content. Substitute the ../domoticz/scripts for the path to the directory that Domoticz accesses by default when you use the on/off actions for a switch (on a pi that would nominally be /home/pi/domoticz/scripts, on Synology /volume1/homes/USERNAME/domoticz/scripts)
Put it in that ../domoticz/scripts directory on whichever machine in your setup runs Domoticz and of course do a chmod +x afterwards.
If you are using the remote script option (i.e. Domoticz and perl-script on separate machines), use this version of sqalert.sh instead (note: it is still installed in the ../domoticz/scripts directory on the local machine running Domoticz):
where 192.168.xxx.yyy is the IP address of the remote machine that the perl script will actually run on, the -p specifies the port to use for ssh on the remote machine (usually 22), privatekey is the keyfile in the local ~/.ssh directory (on the Domoticz machine) allowing ssh login to the remote machine without specifying a password, and /path/to/remote/scriptdir is the arbitrary path to the directory your perl scripts are stored in on that remote machine.
If you plan on using the remote-scripting option and you haven't already set up ssh for non-interactive login on the target/remote machine, use the command ssh-keygen -t rsa to generate the two files with public/private keys and put the public key in the ~/.ssh directory on the target/remote machine and the private key in ~/.ssh on the local machine where Domoticz is running. You will also have to do a chmod 700 on the ~/.ssh directory itself and chmod 600 on the key files themselves or it won't work.
Next, create a perl script called squeezealert.pl in the directory/machine pointed to by the path you just used in the bash script, with the following content (and do a chmod +x afterwards). Note: You will need to edit the parameters for player-mac's, the URL of your LMS instance, plus the full linux pathname to your alerts directory after creating this script (all parameters are case-sensitive too).
First variant of squeezealert.pl, not using syncgroups but using threading
This script implements semi-synchronised alerts on multiple players through multi-threading using the Parallel::Loops module. You can use either this one or the next script below (second variant):
Second variant of squeezealert.pl, using temporary syncgroups
This script assembles/disassembles temporary syncgroups when alerts are played on multiple players (note: you should use either this script or the first variant above, but not both!):
Testing
To test either script first (outside Domoticz), you should cd to the directory where you placed the bash script and issue the following command (assuming you have a player called livingroom, plus files called Ring06.wav and garageDoorOpen.mp3 in your alerts folder - change as appropriate to your setup):
If that works OK and you hear the pre-chime and message, you should then be good to go to use the script within Domoticz. If you have issues getting the remote (ssh) scripting working, you can first verify that the remote-login keys are working by typing
from the command line on the local machine. If it works then you will just silently receive a terminal-prompt from the remote machine (you might have to accept the remote machine as trusted the first time this is done - just go ahead and do it). If it doesn't work then check the permissions (not higher than 600 on the keyfiles!) and check that the keyfiles are in the home directory for the correct user (are you going to run Domoticz as root, pi, another user.. ?). At a minimum, you should already be able to login via ssh to the remote machine using a username and password - if that's not working then this certainly won't work (e.g. check port 22 open, check that the ssh service is started).
Using Ambient Light Sensor in SB-Radio and SB-Touch
Both the SB Radio and SB Touch have an internal sensor to detect the ambient light level and dim the display when the room is darker or to brighten it when it's light. It's possible to install a background-running script on the player that will regularly update Domoticz with this measured light level (don't worry - it still operates when the player is in standby). This only works meaningfully for a player located in a normally-dark room such as a bathroom with no windows. It can then be used to check if the bathroom is occupied because the light will usually be on when somebody is in there. Use this info e.g. to change the colour of a Hue lamp downstairs so you know when the toilet is occupied upstairs, to start a ventilator if the light in the bathroom is on for a while, or even to autoplay music on the player when somebody turns on the light in the room.
Setup
First of all, you should enable ssh login on the SB in question. On the player's own UI, go to:
Now use a program such as putty or smarTTY to ssh into the player, using username root and default password 1234. This will log you into the /root home directory on the SB. IF you have problems with ssh, try ssh -oKexAlgorithms=+diffie-hellman-group1-sha1 -c 3des-cbc [email protected] instead. Use smarTTY or a program like Cyberduck to upload the following shell script to that /root directory. Call this file domosb.sh and make sure you have Unix file-endings in it (LF) if you copy/paste from here. When it's copied to the SB, don't forget to chmod +x to make it executable.
The i2c sensor in the SB-Radio produces a value of 100,000 in (almost) darkness and a value of ~100 - ~500 when the lights in the room are on. This script makes sure that Domoticz only gets updated if there is a meaningful change in light level (>20) to mask tiny fluctuations and keep network traffic down. It sends something at least every 30 minutes just to make sure Domoticz doesn't mark it as an offline sensor if it hears nothing for too long.
Testing
![Media Media](/uploads/1/2/4/7/124706462/227674962.jpg)
After transferring the script into the /root folder on the SB you can play around with it first interactively (command: ./domosb.sh) to make sure you got it all set up right and also that the thresholds work for you. I created a Lux sensor-type in Domoticz (via Setup-->Hardware-->Dummy-->Create Virtual Sensors) to display the raw sensor data (in the example above it had an idx of LEVEL) and also an on/off switch (with idx of SWITCH) to act as a toggled occupancy-sensor. When you are satisfied that the script works OK you can get it to autostart upon booting of the SB by adding a line to the very end of the /etc/init.d/rcS file (vi was the only editor on my SB - there was no nano editor).
Don't forget that & at the end or it won't run in the background. The load of running this script makes the SB user interface a tiny bit laggy but does not affect audio playback. You can type reboot to restart the player and get the script auto-running. Of course the data produced by this script is not really a lux value (due to the inversion and high non-linearity) but for our purposes here that's irrelevant.
Transfer Playlist Among Players
As you move around a house with multiple Squeezebox players, it can be useful to transfer the parameters of the currently-playing player (in a room you are about to leave, for example) to a player in a room you are about to go to. For example, you were listening to music on the SB-Touch in the livingroom and now you're going to take a shower so you want to transfer to the SB-Radio in the bathroom. The following script achieves that by saving the state of the source player and restoring those parameters to the target player before powering off the source. If the source player was not playing anything at that time then nothing happens because there's nothing to transfer. The volume-level and repeat-mode of the source are also transferred to the target. This script can be used e.g. with Alexa/HA-Bridge or it can be linked to a Domoticz switch-event such as an occupancy-sensor.
In the on-action / off-action fields of a Domoticz switch, you can use a construct along the lines of
If it doesn't work for you, try specifying the full path to the bash file with a triple-slash
Setup Considerations
With all the perl scripts in this LMS wiki, some modules from CPAN (Comprehensive Perl Archive Network) need to be installed. This is no problem on Linux and on Windows, but is a major problem on Synology NAS devices which have a rather stripped-down Linux under the hood with no build environment. There is a simple workaround for this using remote scripting, but let's first get something clear about where/what needs to be installed. When any one of the perl scripts here are active, 3 different pieces of software are ultimately involved:
These 3 can all run on the same computer but they can also be run on 3 different computers with no problems whatsoever. Synology users can run both LMS and Domoticz e.g. on their Synology, but run the perl script(s) on a separate perl-friendly machine such as a spare RPi. This is possible because we can get a Domoticz on/off action to run a script on a remote machine by using ssh (explained below) with Public-Key Authentication. You also only need one instance of Domoticz running, so if you are using a separate machine for the perl-scripts then it does not need to have a slave Domoticz instance installed on it. Please keep this in mind when deciding on what machine(s) to run these packages. Also note that the ssh remote-scripting option is only needed when the perl-script is remote to the Domoticz machine - it doesn't matter if LMS is remote or not.
Setup
First make sure perl is installed (it very likely is on a linux-based OS) and then install the 2 modules from CPAN that we need:
Create a bash script called sqxfer.sh with the following content. Substitute the ../domoticz/scripts for the path to the directory that Domoticz accesses by default when you use the on/off actions for a switch (on a pi that would nominally be /home/pi/domoticz/scripts, on Synology /volume1/homes/USERNAME/domoticz/scripts)
Put it in that ../domoticz/scripts directory on whichever machine in your setup runs Domoticz and of course do a chmod +x afterwards.
If you are using the remote script option (i.e. Domoticz and perl-script on separate machines), use this version of sqxfer.sh instead (note: it is still installed in the ../domoticz/scripts directory on the local machine running Domoticz):
where 192.168.xxx.yyy is the IP address of the remote machine that the perl script will actually run on, the -p specifies the port to use for ssh on the remote machine (usually 22), privatekey is the keyfile in the local ~/.ssh directory (on the Domoticz machine) allowing ssh login to the remote machine without specifying a password, and /path/to/remote/scriptdir is the arbitrary path to the directory your perl scripts are stored in on that remote machine.
Download Logitech Media Server Qpkg Software Free
If you plan on using the remote-scripting option and you haven't already set up ssh for non-interactive login on the target/remote machine, use the command ssh-keygen -t rsa to generate the two files with public/private keys and put the public key in the ~/.ssh directory on the target/remote machine and the private key in ~/.ssh on the local machine where Domoticz is running. You will also have to do a chmod 700 on the ~/.ssh directory itself and chmod 600 on the key files themselves or it won't work.
Next, create a perl script called sqxfer.pl in the directory/machine pointed to by the path you just used in the bash script, with the following content (and do a chmod +x afterwards). If you are using the remote-script option, the file is placed in the /path/to/remote/scriptdir directory on the remote machine. Note: You will need to edit the parameters for player-mac's and the URL of your LMS instance after creating this script (all parameters are case-sensitive too):
Note that the temporary playlist generated from the source for restoring on the target is automatically deleted upon transfer due to the wipePlaylist:1 in the code.
Download Logitech Media Server Software
Testing
To test the script first outside Domoticz, cd to the directory where you placed the bash script and issue the following command (assuming you have players called kitchen and livingroom - change as appropriate to your setup). Make sure something is also actually playing on the source player or the script will just quietly exit.
The song playing on kitchen should transfer to livingroom at exactly the same moment in the same song and then power off kitchen for you. Note that the script will wait for an alert (see section 6 above) to finish playing if one accidentally commences just as you requested the transfer. If you have issues getting the remote (ssh) scripting working, you can first verify that the remote-login keys are working by typing
from the command line on the local machine. If it works then you will just silently receive a terminal-prompt from the remote machine (you might have to accept the remote machine as trusted the first time this is done - just go ahead and do it). If it doesn't work then check the permissions (not higher than 600 on the keyfiles!) and check that the keyfiles are in the home directory for the correct user (are you going to run Domoticz as root, pi, another user.. ?). At a minimum, you should already be able to login via ssh to the remote machine using a username and password - if that's not working then this certainly won't work (e.g. check port 22 open, check that the ssh service is started).
Sync/Unsync a Group of Players from Domoticz
A cool feature of Squeezeboxes is their ability to play multi-room synchronised music, whereby a group of players all plays the same song at the exact same timestamp. The web UI for LMS allows assembling and disassembling groups, as does e.g. the iPeng app. However, the concept really flies when you can assemble and disassemble sync-groups at the flick of a switch. This script can be used e.g. with Alexa/HA-Bridge or it can be linked to a bunch of Domoticz switches that setup different groups for you for different purposes. We need to first provide a sync or unsync parameter, next define a player as master, and finally list the other players in the group that will become slaves. If only one slave is involved, no quotes are needed around the slave-name. If multiple slaves are desired then place names in quotes and separate with commas (see example). When done, anything that happens on the master is mirrored on the slaves.
In the on-action / off-action fields of a Domoticz switch, you can use a construct along the lines of
If it doesn't work for you, try specifying the full path to the bash file with a triple-slash
Setup Considerations
With all the perl scripts in this LMS wiki, some modules from CPAN (Comprehensive Perl Archive Network) need to be installed. This is no problem on Linux and on Windows, but is a major problem on Synology NAS devices which have a rather stripped-down Linux under the hood with no build environment. There is a simple workaround for this using remote scripting, but let's first get something clear about where/what needs to be installed. When any one of the perl scripts here are active, 3 different pieces of software are ultimately involved:
These 3 can all run on the same computer but they can also be run on 3 different computers with no problems whatsoever. Synology users can run both LMS and Domoticz e.g. on their Synology, but run the perl script(s) on a separate perl-friendly machine such as a spare RPi. This is possible because we can get a Domoticz on/off action to run a script on a remote machine by using ssh (explained below) with Public-Key Authentication. You also only need one instance of Domoticz running, so if you are using a separate machine for the perl-scripts then it does not need to have a slave Domoticz instance installed on it. Please keep this in mind when deciding on what machine(s) to run these packages. Also note that the ssh remote-scripting option is only needed when the perl-script is remote to the Domoticz machine - it doesn't matter if LMS is remote or not.
Setup
First make sure perl is installed (it very likely is on a linux-based OS) and then install the 2 modules from CPAN that we need:
Create a bash script called sqsync.sh with the following content. Substitute the ../domoticz/scripts for the path to the directory that Domoticz accesses by default when you use the on/off actions for a switch (on a pi that would nominally be /home/pi/domoticz/scripts, on Synology /volume1/homes/USERNAME/domoticz/scripts)
Put it in that ../domoticz/scripts directory on whichever machine in your setup runs Domoticz and of course do a chmod +x afterwards.
If you are using the remote script option (i.e. Domoticz and perl-script on separate machines), use this version of sqsync.sh instead (note: it is still installed in the ../domoticz/scripts directory on the local machine running Domoticz):
where 192.168.xxx.yyy is the IP address of the remote machine that the perl script will actually run on, the -p specifies the port to use for ssh on the remote machine (usually 22), privatekey is the keyfile in the local ~/.ssh directory (on the Domoticz machine) allowing ssh login to the remote machine without specifying a password, and /path/to/remote/scriptdir is the arbitrary path to the directory your perl scripts are stored in on that remote machine.
If you plan on using the remote-scripting option and you haven't already set up ssh for non-interactive login on the target/remote machine, use the command ssh-keygen -t rsa to generate the two files with public/private keys and put the public key in the ~/.ssh directory on the target/remote machine and the private key in ~/.ssh on the local machine where Domoticz is running. You will also have to do a chmod 700 on the ~/.ssh directory itself and chmod 600 on the key files themselves or it won't work.
Next, create a perl script called sqsync.pl in the directory/machine pointed to by the path you just used in the bash script, with the following content (and do a chmod +x afterwards). If you are using the remote-script option, the file is placed in the /path/to/remote/scriptdir directory on the remote machine. Note: You will need to edit the parameters for player-mac's and the URL of your LMS instance after creating this script (all parameters are case-sensitive too):
Testing
To test the script first outside Domoticz, cd to the directory where you placed the bash script and issue the following command (assuming you have players called livingroom and kitchen - change as appropriate to your setup).
Both the livingroom and kitchen players should now start playing in sync, with whatever was playing before on the master (here, livingroom) also playing on the slave: kitchen. It does not matter if livingroom was already playing or not as it will just start playing if it wasn't. Next, try
and both players will pause, unsync and finally power-off. If you have issues getting the remote (ssh) scripting working, you can first verify that the remote-login keys are working by typing
from the command line on the local machine. If it works then you will just silently receive a terminal-prompt from the remote machine (you might have to accept the remote machine as trusted the first time this is done - just go ahead and do it). If it doesn't work then check the permissions (not higher than 600 on the keyfiles!) and check that the keyfiles are in the home directory for the correct user (are you going to run Domoticz as root, pi, another user.. ?). At a minimum, you should already be able to login via ssh to the remote machine using a username and password - if that's not working then this certainly won't work (e.g. check port 22 open, check that the ssh service is started).
Spoken Now-Playing using Amazon Polly TTS
The following perl script allows your Squeezebox players to literally tell you what song is currently playing using a female English-language voice. It queries all active players in your system for their currently-playing artist and title information and sends this off to the Amazon Polly TTS (Text-to-Speech) cloud service to generate mp3 files containing each player's artist/title information in spoken form. Just as with the audio-alerts script above, the current song is temporarily paused, the TTS information mp3 is played audibly on each active player, and the player(s) then resume playing as they were before the query, with the temporary mp3 being deleted when finished. Kicking it off can be linked e.g. to a Domoticz switch event or to HA-Bridge so that you can ask Alexa to tell you what's currently playing (although Alexa won't answer - her sister Polly will answer through your Squeezebox rather than through the Echo). The following example video demonstrates the principle via a command 'Tell Me' through Alexa to HA-Bridge to a Domoticz switch:
Amazon reserves the utterance Now Playing for music played via Alexa herself so that's why I chose 'Tell Me' as the utterance, but you can use whatever you like that's not reserved. After you have re-created all this in your own setup, in the on-action / off-action fields of a Domoticz switch, you can use
If it doesn't work for you, try specifying the full path to the bash file with a triple-slash, e.g.
Setup Considerations
With all the perl scripts in this LMS wiki, some modules from CPAN (Comprehensive Perl Archive Network) need to be installed. This is no problem on Linux and on Windows, but is a major problem on Synology NAS devices which have a rather stripped-down Linux under the hood with no build environment. There is a simple workaround for this using remote scripting, but let's first get something clear about where/what needs to be installed. When any one of the perl scripts here are active, 3 different pieces of software are ultimately involved:
These 3 can all run on the same computer but they can also be run on 3 different computers with no problems whatsoever. Synology users can run both LMS and Domoticz e.g. on their Synology, but run the perl script(s) on a separate perl-friendly machine such as a spare RPi. This is possible because we can get a Domoticz on/off action to run a script on a remote machine by using ssh (explained below) with Public-Key Authentication. You also only need one instance of Domoticz running, so if you are using a separate machine for the perl-scripts then it does not need to have a slave Domoticz instance installed on it. Please keep this in mind when deciding on what machine(s) to run these packages. Also note that the ssh remote-scripting option is only needed when the perl-script is remote to the Domoticz machine - it doesn't matter if LMS is remote or not.
Setup
First of all, you will need a (free) account with the AWS Amazon Polly service because you need to provide login details for the perl script (AWS_ACCESS_KEY and AWS_SECRET_KEY). The following Getting Started article will guide you through that process:
Next, make sure perl is installed (it very likely is on a linux-based OS) and then install the 4 modules from CPAN that we need:
Because our heavy-lifter Paws::Polly has a lot of dependencies, it's best to install it via cpanminus which you should install first if you don't have it already:
Warning: Installing Paws:Polly will take a long time (139 dependencies) so be patient and let it finish its course.
Now create a bash script called sqnowplaying.sh with the following content. Substitute the ../domoticz/scripts for the path to the directory that Domoticz accesses by default when you use the on/off actions for a switch (on a pi that would nominally be /home/pi/domoticz/scripts, on Synology /volume1/homes/USERNAME/domoticz/scripts)
Put it in that ../domoticz/scripts directory on whichever machine in your setup runs Domoticz and of course do a chmod +x afterwards.
If you are using the remote script option (i.e. Domoticz and perl-script on separate machines), use this version of sqnowplaying.sh instead (note: it is still installed in the ../domoticz/scripts directory on the local machine running Domoticz):
where 192.168.xxx.yyy is the IP address of the remote machine that the perl script will actually run on, the -p specifies the port to use for ssh on the remote machine (usually 22), privatekey is the keyfile in the local ~/.ssh directory (on the Domoticz machine) allowing ssh login to the remote machine without specifying a password, and /path/to/remote/scriptdir is the arbitrary path to the directory your perl scripts are stored in on that remote machine.
If you plan on using the remote-scripting option and you haven't already set up ssh for non-interactive login on the target/remote machine, use the command ssh-keygen -t rsa to generate the two files with public/private keys and put the public key in the ~/.ssh directory on the target/remote machine and the private key in ~/.ssh on the local machine where Domoticz is running. You will also have to do a chmod 700 on the ~/.ssh directory itself and chmod 600 on the key files themselves or it won't work.
Next, create a perl script called sqnowplaying.pl in the directory/machine pointed to by the path you just used in the bash script, with the following content (and do a chmod +x afterwards). If you are using the remote-script option, the file is placed in the /path/to/remote/scriptdir directory on the remote machine. Note: You will need to provide your AWS login credentials, edit the parameters for your player-mac's, provide the URL of your LMS instance, plus define the path to your LMS playlists directory after creating this script (all parameters are case-sensitive too):
Testing
![Ickstream Ickstream](/uploads/1/2/4/7/124706462/998147095.png)
To test the script first outside Domoticz, cd to the directory where you placed the bash script and issue the following command. Make sure something is also actually playing on one or more of your players or the script will just quietly exit.
After a slight delay (due to going up and back to the cloud for Polly), all active players (active meaning 'powered on' and in 'play' mode) should have their current song temporarily paused, the name of the song and the artist should be called out through the relevant player at a slightly-higher volume than the music was at, and then the song(s) that were playing should finally continue where they were at before the pause.
If you have issues getting the remote (ssh) scripting working, you can first verify that the remote-login keys are working by typing
from the command line on the local machine. If it works then you will just silently receive a terminal-prompt from the remote machine (you might have to accept the remote machine as trusted the first time this is done - just go ahead and do it). If it doesn't work then check the permissions (not higher than 600 on the keyfiles!) and check that the keyfiles are in the home directory for the correct user (are you going to run Domoticz as root, pi, another user.. ?). At a minimum, you should already be able to login via ssh to the remote machine using a username and password - if that's not working then this certainly won't work (e.g. check port 22 open, check that the ssh service is started).
Resources
The HTML documentation for all possible JSON RPC interactions with LMS is included in every LMS install so you already have it. Browse in the UI of your LMS instance to Help down in the bottom left corner, then click on Technical Information, then on The Logitech Media Server Command Line Interface. The perl scripts above were built entirely on the basis of the information there. There is also plenty of information on how to interact with LMS using JSON from e.g. a web-browser or a UserAgent online. See tutoriels.domotique, for example.
If you want to read more on the subject of Public-Key Authentication and the use of ssh-keygen, consult ssh-keygen or for details on editing the sshd_config file, see digitalocean
As mentioned in the section Setup Considerations above, a big issue with trying to use the above perl scripts natively on Synology is the lack of CPAN support for installing/building the JSON::RPC::Client and JSON::XS modules (Synology uses a rather stripped Linux variant). A simple workaround (detailed above) is for LMS (and your music) to be on your Synology (with Domoticz too) and to have only the perl scripts running on a different Linux machine in the network. However, if you really want to run things on your Synology natively because you don't want the overhead/cost of an additional machine, the JSON RPC calls can be made from bash using curl without having to install anything special, although the scripts will of course need total modification. Here's an example of what the calls look like in bash:
Retrieved from 'https://www.domoticz.com/wiki/index.php?title=Logitech_Media_Server&oldid=12493'