Github Link
Alfred Sonos Controller
Installation
Download
Download and open the alfredworkflow file to install the workflow
Features
Play, Pause, Next, Previous
Set/Change Volume
View Queue
Play Songs from Queue (only tested on Spotify playing through Sonos app)
Switch to line-in playback (if supported on device)
Control Shuffle/Repeat
Usage
Type soco into Alfred, select or search your device, and then control it on the following screen
Hotkeys
Hotkeys are added by adding a hotkey trigger on the workflow flowchart (open Alfred Preferences -> Workflows -> Sonos Controller, then right click in the empty space -> Triggers -> Hotkey) and connecting it to the run script block with a text argument that follows the following syntax. You can also edit the preset hotkey triggers by right clicking them and selecting configure object.
(sonosName); (command)
ex:
Bedroom; next
Commands:
plpau - Play/Pause Sonos device
play - Play Sonos device
pause - Pause Sonos device
volpcg [value] - Set volume to specified value (ex. Bedroom; volpcg 50)
chvol [value] - Change volume by a specified value
next - Go to the next song
previous - Go to the previous song
linein - Switch playback to line-in
enshuffle - Enable shuffle and disable repeat
disshuffle - Disable shuffle and disable repeat
enrepeat - Enable repeat and disable shuffle
enshuffrep - Enable shuffle and repeat
plque [position in queue] - Play a song in a certain position in queue (only tested on Spotify playing through Sonos app)
Troubleshooting
If you find yourself getting the No Speakers Found error, it may be due to an incorrect interface address. This can be caused by having a VPN active, which unfortunatley Sonos does not support.
If you are still recieving this error, you can try manually setting the interface address to your local IP address on your machine (which can be found under your Network settings) by doing the following:
Open Alfred Preferences -> Workflows -> SonosController and press the [x] button in the top right corner
This screen should appear:
Double click under the value column on interface_address and enter in the address of your local IP
Acknowledgements
This workflow was built using deanishe's Alfred-Workflow
Huge shoutout to the team behind SoCo which this workflow uses heavily
License
This workflow is released under the MIT license