The following are required:
- Logitech Media Server, version 7.6 or later.
- iPhone or iPad, running iOS/iPadOS version 13.1 or later.
- Scriptable app, version 1.4 or later.
- Install the script in Scriptable:
- Launch Scriptable and click on the plus symbol in the top-right to create a new script.
- Download the
Squeezebox Control.jsfile from this repository and paste it into the blank Scriptable script.
- Near the start of the script modify the
lmsHostname(and if necessary
lmsPort) constants appropriately for the Logitech Media Server's web server. If the server's Security is set to Password Protection then also change
lmsPasswordto the required credentials.
- Click on the settings icon in the bottom-left, change the Name to
Squeezebox Control, and then Close the window.
(Do NOT use the Add to Siri option within Scriptable; it will fail because Scriptable is blocked from requesting dictation when invoked directly from Siri.)
- Install the Squeezebox Control Shortcut.
(The Allow Untrusted Shortcuts option must be enabled within Shortcut's settings.)
Assuming that both the Shortcut and Scriptable script have been correctly installed, then invoke them by saying Hey Siri, Squeezebox Control. Siri should then prompt for the action to perform.
The script should be able to handle most natural ways of phrasing commands, but here are some examples:
|Turn a player on or off
||Turn Kitchen on
Switch on the Lounge squeezebox
Power off Bedroom
|Ask about the current track
||What is playing in the Office?
What's the Kitchen player doing?
What am I listening to?
What's currently playing?
|Change the volume
||Set Lounge volume to 50%
Change the volume to 70 in the Kitchen
Reduce volume of Office
|Start or stop the current playlist
Stop playing in the Bedroom
|Skip tracks in the playlist
||Skip to previous song
Restart on Lounge squeezebox
Play this track from the beginning
|Load a new playlist
||Lounge play playlist Party Mix
Play genre Country
Artist Queen on Bedroom player
On the Lounge squeezebox play songs by Johnny Cash
Kitchen play album Money For Nothing by Dire Straits
Song Seven Nation Army
Play Kylie Minogue on Bedroom
All commands apply to either a single Squeezebox player or a sync group. If the name of the player is omitted then the script attempts to make a sensible choice based on which players are switched on and whether they are currently playing anything. Only the power on/off commands require the player to be explicitly identified.
Interaction with Siri can be made more organic by creating additional Shortcuts for common interactions. These can have some or all of the command hard-coded, e.g.:
💬Squeezebox Now Playing 🔊Squeezebox Volume ▶️Squeezebox Play ⏹Squeezebox Stop ⏸Squeezebox Pause ⏮Squeezebox Previous ↪️Squeezebox Restart ⏭Squeezebox Next
‡ Use of these shortcuts also requires the Squeezebox Play shortcut to be installed.
None of these shortcuts ask for the player to control, so they are really only suitable when there is a single active sync group.
This script is intended to be invoked from Siri via the Shortcuts app, with the command to perform (e.g. obtained via an Ask action) passed as input. However, it can also be run directly from within the Scriptable app, in which case dictation is used to obtain the command.
If the shortcut is invoked on a HomePod then both the Shortcuts and Scriptable apps actually run on the associated iPhone. Unfortunately it is not currently possible to determine which HomePod is being used, or even that the voice interaction is occurring on a HomePod, so it is not possible to automatically select that player.
The behaviour of this script is affected by various Logitech Media Server settings, especially the Search Within Words option.
If something doesn't work as expected then please try to reproduce the issue by running the script directly within the Scriptable app. If it still fails then please include the contents of the Log window in any report. This includes cases where the script does not understand a command that has been phrased in a natural way.
ISC License (ISC)
Copyright © 2019 Alexander Thoukydides
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.