Skip to content

Siri control of Logitech Media Server (Squeezebox) via Scriptable

License

Notifications You must be signed in to change notification settings

thoukydides/siri-squeezebox-control

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Squeezebox Control

This is a script for Simon Støvring's Scriptable app that provides voice control of Squeezebox players connected to a Logitech Media Server. It can be used from Siri on an iPhone, iPad, or HomePod.

Minimum Requirements

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.

Installation

  1. Install the script in Scriptable:
    1. Launch Scriptable and click on the plus symbol in the top-right to create a new script.
    2. Download the Squeezebox Control.js file from this repository and paste it into the blank Scriptable script.
    3. 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 lmsUsername and lmsPassword to the required credentials.
    4. 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.)
  2. Install the Squeezebox Control Shortcut.
    (The Allow Untrusted Shortcuts option must be enabled within Shortcut's settings.)

Usage

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:

Activity Example Commands
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
Louder
Reduce volume of Office
Start or stop the current playlist
▶️ / ⏹️ / ⏸️
Play
Stop playing in the Bedroom
Kitchen pause
Skip tracks in the playlist
⏮️ / ↪️ / ⏭️
Skip to previous song
Next
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.

Additional Shortcuts

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.:

‡ 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.

Notes

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.

Reporting Problems

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.

License

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.