{"id":24610,"library":"soco","title":"SoCo (Sonos Controller)","description":"SoCo is a Python library for controlling Sonos speakers. It provides a simple interface to discover, query, and control Sonos devices over a local network. Current version 0.31.0 supports Python >=3.6, with releases approximately every few months.","status":"active","version":"0.31.0","language":"python","source_language":"en","source_url":"https://github.com/SoCo/SoCo","tags":["sonos","home-automation","media-control","iot"],"install":[{"cmd":"pip install soco","lang":"bash","label":"Install via pip"}],"dependencies":[{"reason":"HTTP requests to Sonos devices","package":"requests","optional":false},{"reason":"Used internally for HTTP","package":"urllib3","optional":false}],"imports":[{"note":"SoCo is a class, not a module","wrong":"import soco","symbol":"SoCo","correct":"from soco import SoCo"}],"quickstart":{"code":"from soco import SoCo\n\n# Discover a speaker by IP (replace with your speaker's IP)\nspeaker = SoCo('192.168.1.10')\n\n# Play music (e.g., a URI)\nspeaker.play_uri('x-rincon-mp3radio://stream.example.com:8000/stream')\n\n# Adjust volume\nspeaker.volume = 30\n\n# Get current track info\ntrack = speaker.get_current_track_info()\nprint(track.title)","lang":"python","description":"Quickstart: import SoCo, create instance with IP, control playback, volume, and get track info."},"warnings":[{"fix":"Ensure your script runs on a machine connected to the same LAN as the Sonos speakers.","message":"SoCo only works on the same local network as Sonos speakers. It does not support cloud control or remote access.","severity":"gotcha","affected_versions":"all"},{"fix":"Use `discover()` to find speakers dynamically: `from soco import discover; speakers = discover()`","message":"Speaker IP addresses can change (DHCP). It is recommended to use discovery methods like `soco.discover` instead of hardcoding IPs.","severity":"gotcha","affected_versions":"all"},{"fix":"Update calls: `speaker.play_uri(uri, title='My Stream')` instead of `speaker.play_uri(uri, meta=...)`","message":"In v0.30.0, the `play_uri` method signature changed: the `meta` parameter was removed and `title` and `metadata` parameters were added.","severity":"breaking","affected_versions":">=0.30.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use `from soco import SoCo` or `import soco; soco.SoCo`","cause":"Incorrect import: using `import soco` and then `soco.SoCo()` is wrong.","error":"AttributeError: module 'soco' has no attribute 'SoCo'"},{"fix":"Verify the IP address and network connectivity. Use `ping` or discovery methods.","cause":"Speaker IP is wrong or speaker is not reachable on the network.","error":"soco.exceptions.SoCoException: No response from the device"},{"fix":"Replace `meta` with `title` and/or `metadata` keyword arguments.","cause":"Using deprecated `meta` parameter in SoCo v0.30+.","error":"TypeError: play_uri() got unexpected keyword argument 'meta'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}