python-songpal
Python library for interfacing with Sony's Songpal devices
What it is and what it does
python-songpal is a Python 3 library that implements Sony's SongPal protocol, allowing programmatic control of Sony audio devices like soundbars, receivers, and speakers over a network. It uses UPnP discovery to locate devices and communicates via HTTP to their ScalarWebAPI endpoints. The library is built on async I/O (aiohttp and async_upnp_client) and provides both a Python API for integration into scripts or applications and a command-line tool (songpal) for direct device control.
The library supports a range of Sony devices including the HT-XT3, HT-ZF9, HT-ST5000, and STR-series receivers. It can control power, volume, input selection, sound settings (night mode, subwoofer level), zones, and grouping. The project is in alpha stage and dormant—last release was 2024-03-31 with a recent commit in December 2024—meaning it works but receives infrequent updates and may not cover all newer Sony devices.
Use it for:
- Automate power on/off and volume control for a Sony soundbar or receiver from a home automation script.
- Switch audio inputs and manage multi-zone playback programmatically in a networked audio setup.
- Query device status (power state, volume, active input) from a monitoring or dashboard application.
- Create a CLI tool to control Sony audio devices without a remote or mobile app.
- Integrate Sony device control into a larger home theater automation system.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Python library for controlling Sony audio devices (soundbars, receivers, speakers) that implement the SongPal protocol over UPnP, with both programmatic and command-line interfaces.
Yes, if you own a supported Sony audio device and need programmatic control. The library is stable, has no known vulnerabilities, and low install friction. However, maintenance is dormant—expect no active support for new Sony models or breaking changes in dependencies. Verify your device is in the supported list before committing; if it is, the library is reliable for automation and CLI use.
Install
python-songpal on PyPI
pip
pip install python-songpaluv
uv add python-songpalpoetry
poetry add python-songpalInstalling python-songpal
Before you install
Low install friction with a pure-Python wheel. Maintenance is dormant (last release 2024-03-31, last commit 2024-12-17); the project remains functional but receives infrequent updates. Supports Python 3.8 through 3.12.
License in practice
GPL-3.0 copyleft license. Any software that uses this library must also be distributed under a compatible open-source license; proprietary or closed-source applications cannot incorporate it.
Quickstart
pip install python-songpal
from songpal import Device
import asyncio
async def main():
device = Device('http://192.168.1.1:10000/sony')
await device.power.set_power(True)
asyncio.run(main())
Requires the device's SongPal endpoint URL (typically discovered via UPnP); device must be on the same network and support the SongPal protocol.
Verify before relying
- Whether all listed Sony device models (BDV-N9200W, HT-XT3, STR-DN1080, etc.) are still actively supported or if support has regressed.
- Current state of async/await stability and error handling in dormant maintenance state.
- Whether aiohttp and async_upnp_client versions are pinned or have known compatibility issues with modern releases.
Package facts
| License | GPL-3.0 (copyleft) |
| Python support | supports the current Python release (<4.0,>=3.8) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 4 — aiohttp, async_upnp_client, attrs, click |
| Maintenance | dormant — 866 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 87,521/month — #13,791 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: python_songpal-0.16.2-py3-none-any.whl
Tags
More Utilities packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
charset-normalizerDetects and normalizes text encoding from…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
PygmentsPygments is a syntax highlighter that colorizes…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
libsoundtouchControl Bose Soundtouch devices over the…
permissive · top 15,000 on PyPI
pyps4-2ndscreenUnofficial Python library to control…
copyleft · top 15,000 on PyPI
miniupnpcPython binding for MiniUPnPc library that…
permissive · top 15,000 on PyPI
sonos-websocketAsync Python library for communicating with…
permissive · top 15,000 on PyPI
wiimwiim provides a Python API to discover,…
permissive · top 15,000 on PyPI
rxvrxv discovers and controls Yamaha AV receivers…
permissive · top 15,000 on PyPI
socoSoCo is a Python library for programmatic…
permissive · top 15,000 on PyPI
pulsectlProvides a high-level Python interface to…
permissive · top 15,000 on PyPI
async-upnp-clientAsync UPnP client library for discovering,…
permissive · top 15,000 on PyPI
python-oscpython-osc implements Open Sound Control (OSC)…
unclear · top 15,000 on PyPI