skillfed

python-songpal

Python library for interfacing with Sony's Songpal devices

python-songpal v0.16.2 87.5K downloads/30d#13,791 on PyPI77
Copyleft license GPL-3.0 DORMANT released

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-songpal

uv

uv add python-songpal

poetry

poetry add python-songpal

Installing 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

License :: OSI Approved :: GNU General Public License v3 (GPLv3)Programming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9

Tags

sony soundbar control pythonsongpal protocol librarysony audio device apiupnp device controlsony receiver remote control
home-automationdevice-controlasync-io

More Utilities packages