--- id: sonos-websocket version: "0.2.0" license: MIT License license_treatment: permissive maintenance: active --- # sonos-websocket — An asynchronous Python library to communicate with Sonos devices over websockets. License: permissive · Maintenance: active · Downloads: 101.5K/mo ## 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 above — verify before relying. Async Python library for communicating with Sonos devices over WebSocket connections, enabling remote control and audio playback features like audio clips and volume management. 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 pip install sonos-websocket uv add sonos-websocket poetry add sonos-websocket ## Installing sonos-websocket Before you install: Low install friction with a single pure-Python dependency (aiohttp). Actively maintained with recent commits and a Beta stability rating. 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()) Requires Python 3.11 or later; target Sonos device must be reachable on the network and support WebSocket communication. 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_current - Install friction: low - Maintenance: active - Downloads: 101.5K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags sonos device control python, async websocket sonos, sonos audio playback library, sonos home automation, sonos clip overlay playback, sonos remote control api, python sonos integration, home-automation, async-io, sonos [View on SkillFed](https://skillfed.io/packages/sonos-websocket) · [View on PyPI](https://pypi.org/project/sonos-websocket/)