sonos-websocket
An asynchronous Python library to communicate with Sonos devices over websockets.
Decision gist · record as of 2026-08-14
Yes, if you need to control Sonos devices from Python and want async/await support. The library is actively maintained, has low install friction, carries a permissive MIT license, and has no known vulnerabilities. Beta status and small community (6 stars) mean you may encounter edge cases or limited documentation, but the core functionality is straightforward and the dependency footprint is minimal.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.11 or later; target Sonos device must be reachable on the network and support WebSocket communication.
- Low install friction with a single pure-Python dependency (aiohttp).
- Actively maintained with recent commits and a Beta stability rating.
License · maintenance · safety
MIT License (permissive) — MIT License permits unrestricted use, modification, and distribution with minimal restrictions—suitable for both commercial and open-source projects.
last release 2026-06-12 (63 days) · last repo commit 2026-08-14 · 6 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 101,468 downloads/mo, #12,932 on PyPI
Alternatives
Verify before relying
pip install sonos-websocket
import asyncio
from sonos_websocket import SonosWebsocket
async def main():
async with SonosWebsocket('192.168.1.88') as sonos:
await sonos.play_audio_clip('https://example.com/audio.mp3', volume=15)
asyncio.run(main())- Which Sonos device models and firmware versions are supported by this library.
- Whether audio clip playback works with all Sonos speaker types or only specific models.
- Performance characteristics and latency when controlling multiple devices simultaneously.
What it is and what it does
sonos-websocket is an asynchronous Python library that lets you control Sonos speakers programmatically over WebSocket connections. It wraps the Sonos WebSocket API to provide async/await-friendly methods for tasks like playing audio clips, adjusting volume, and managing playback. The library depends only on aiohttp for HTTP communication and is designed for Python 3.11+.
A key feature is audio clip playback, which overlays new audio on top of currently playing music while automatically lowering the background volume and restoring it when the clip finishes—useful for alerts and text-to-speech integration. The library can be used as a standalone script (passing device IP, audio URI, and volume parameters) or integrated into larger home automation or notification systems.
Use it for
- Overlay text-to-speech alerts or notifications on Sonos speakers without interrupting music playback.
- Build home automation routines that trigger audio clips on Sonos devices in response to events.
- Programmatically control Sonos speaker volume and playback from Python applications or services.
- Create multi-room audio coordination scripts that manage playback across multiple Sonos devices.
- Integrate Sonos control into IoT or smart home platforms that use async Python.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you need to control Sonos devices from Python and want async/await support.
The library is actively maintained, has low install friction, carries a permissive MIT license, and has no known vulnerabilities. Beta status and small community (6 stars) mean you may encounter edge cases or limited documentation, but the core functionality is straightforward and the dependency footprint is minimal.
Install
sonos-websocket on PyPI
Before you install
Low install friction with a single pure-Python dependency (aiohttp). Actively maintained with recent commits and a Beta stability rating.
Requires Python 3.11 or later; target Sonos device must be reachable on the network and support WebSocket communication.
License in practice
MIT License permits unrestricted use, modification, and distribution with minimal restrictions—suitable for both commercial and open-source projects.
Quickstart
pip install sonos-websocket
import asyncio
from sonos_websocket import SonosWebsocket
async def main():
async with SonosWebsocket('192.168.1.88') as sonos:
await sonos.play_audio_clip('https://example.com/audio.mp3', volume=15)
asyncio.run(main())
Verify before relying
- Which Sonos device models and firmware versions are supported by this library.
- Whether audio clip playback works with all Sonos speaker types or only specific models.
- Performance characteristics and latency when controlling multiple devices simultaneously.
Package facts
| License | MIT License permissive |
| Python support | Supports the current Python release >=3.11 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 1 packageaiohttp |
| Maintenance | Actively maintained 63 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 101,468 / month, #12,932 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 4 - BetaIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3Topic :: Home AutomationTopic :: Multimedia :: Sound/AudioTopic :: Multimedia :: Sound/Audio :: PlayersTopic :: Software Development :: Libraries :: Python Modules |
Evidence: sonos_websocket-0.2.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “sonos device control python”
- sonos-websocketAsync Python library for communicating with Sonos devices over…
- socoSoCo is a Python library for programmatic control of Sonos speakers…
- PlexAPIUnofficial Python bindings for the Plex API that let you…
Give your agent the search over MCP, or paste the wish link into any chat.
More Python Modules packages
Converts domain names between Unicode and ASCII-compatible encoding (Punycode) according to IDNA 2008 and Unicode Technical Standard 46, with security validation and broader script coverage than the standard library.
Install it if you work with internationalized domain names, need to validate domains, or use HTTP clients that depend on it transitively.
Setuptools is a Python build backend and package management tool that handles building, distributing, and installing Python packages, including support for C/C++ extension modules.
PyYAML parses and emits YAML 1.1 data format, enabling serialization and deserialization of configuration files and Python objects to and from human-readable YAML text.
Pydantic validates Python data structures against type hints, coercing and checking input at runtime to ensure it matches a declared schema.
Provides reusable metadata objects for use with PEP-593 `typing.Annotated` to express common constraints like bounds, collection sizes, and predicates on types.
Install it if you use or build libraries that need to express type constraints in a standardized, inspectable way—or if you want to annotate your own types with…
Provides runtime tools to inspect and introspect Python type annotations, enabling programmatic examination of type hints at execution time.
See also playsound · roonapi · soco · wiim · plexwebsocket · pulsectl · libsoundtouch · python-songpal · python-osc · pyblu