SonosCLI
Control Sonos speakers — discover, status, play, volume, group management, favorites, and Spotify search.
Tags: sonos, audio, smart-home, music, speakers
Category: Smart Home
Use Cases
- AI-controlled music: 'Play jazz in the living room' via chat
- Automated routines: morning music, dinner ambience, bedtime silence via cron
- Party mode: group all speakers with one command
- Spotify integration: search and play tracks, albums, playlists
- Volume management: set per-room volumes for different times of day
- Live monitoring: track what's playing across all rooms
- Scene management: save and restore speaker configurations
Tips
- Run `sonos status` first to verify discovery and see all your rooms
- Use `sonos play-uri` to play any URL: internet radio, local HTTP server, or podcast feeds
- Save scenes for common configurations: `sonos scene save 'Morning'` (grouping + volumes)
- Use `--format json` for all automation workflows — pipe to jq for filtering
- The `watch` command is great for building reactive automations: track changes → trigger actions
- Use `sonos favorites` to list and play Sonos Favorites without knowing the exact URI
- Combine with OpenClaw cron for automated routines: morning music, dinner ambience, bedtime wind-down
- For Spotify, just paste share links: `sonos play-uri 'https://open.spotify.com/album/...'`
Known Issues & Gotchas
- Your machine must be on the same network as your Sonos system — no remote control
- Speakers must be reachable on TCP port 1400 — firewall rules or VLAN isolation will break discovery
- Spotify must already be linked in the Sonos app — the CLI doesn't authenticate with Spotify directly
- SMAPI search may require a one-time DeviceLink/AppLink flow: `sonos auth smapi begin|complete`
- Sonos S1 (legacy) systems may not support all UPnP features — S2 recommended
- Discovery can take a few seconds on large networks — use `--timeout` to adjust
- Volume changes are per-room, not per-group by default — be explicit about targeting
- The `watch` command runs indefinitely — it subscribes to events and prints changes until killed
Alternatives
- soco-cli (Python)
- Sonos App
- Home Assistant (Sonos integration)
- node-sonos (npm)
- AirPlay from Mac
Community Feedback
sonoscli is a modern Go CLI to control Sonos speakers over your local network. Reliable discovery, coordinator-aware control, grouping, favorites, Spotify integration, and live events.
— GitHub
I love Soco-Cli — being able to control Sonos from the terminal is incredibly useful for automation. The Go-based alternatives like sonoscli are even faster.
— Reddit r/sonos
SonosCLI ships with steipete's OpenClaw skill collection. Control Sonos speakers — discover, status, play, volume, group management, favorites, and Spotify search.
— LobeHub Skills Marketplace
Command line Sonos control has been a long-requested feature. Tools like soco-cli and sonoscli make it possible to script and automate your entire multi-room setup.
— Sonos Community Forum
Configuration Examples
Install and discover
# Install via Homebrew
brew install steipete/tap/sonoscli
# Discover speakers and show status
sonos status
# List all rooms
sonos roomsPlayback and volume control
# Play/pause
sonos play --room 'Living Room'
sonos pause --room 'Kitchen'
# Set volume
sonos volume --room 'Bedroom' 30
# Play a Spotify album
sonos play-uri 'https://open.spotify.com/album/abc123' --room 'Office'
# Play a favorite
sonos favorites play 'Chill Vibes'Grouping and scenes
# Group speakers
sonos group join --room 'Kitchen' --coordinator 'Living Room'
# Party mode (all speakers)
sonos group party
# Save a scene
sonos scene save 'Movie Night'
# Restore a scene
sonos scene apply 'Movie Night'
# Watch for real-time events
sonos watch --format jsonInstallation
go install github.com/steipete/sonoscli/cmd/sonos@latestHomepage: https://sonoscli.sh
Source: bundled