Skip to main content

PyPI version CI Python 3.13 License PyPI downloads

WiiM Python SDK

wiim is an asynchronous Python SDK for discovering, monitoring, and controlling WiiM audio devices on a local network.

The SDK communicates directly with devices using UPnP eventing and the LinkPlay HTTP API. It is intended for Home Assistant integrations, automation platforms, and other asyncio-based applications.

Features

  • Validate and create WiiM devices from UPnP description URLs
  • Discover local devices with the included Zeroconf CLI
  • Control playback, volume, mute, seeking, repeat, and shuffle
  • Select supported audio inputs and outputs
  • Read normalized media metadata, playback state, and device information
  • Subscribe to real-time UPnP state changes with HTTP polling as a fallback
  • Inspect presets, the current queue, and transport capabilities
  • Create, update, and disband multiroom groups
  • Support IPv4 and IPv6 event listeners
  • Expose typed models and exceptions for application integrations

Available features can vary by device model, active input source, and firmware version.

Installation

Install the latest release from PyPI:

python -m pip install wiim

The project is currently tested with Python 3.13.

Quick Start

Create a device from its UPnP description URL and send playback commands:

import asyncio

from aiohttp import ClientSession

from wiim import async_create_wiim_device


async def main() -> None:
    async with ClientSession() as session:
        device = await async_create_wiim_device(
            "http://192.168.1.100:49152/description.xml",
            session,
            host="192.168.1.100",
        )

        try:
            await device.async_set_volume(30)
            await device.async_play()

            print(f"Device: {device.name}")
            print(f"State: {device.playing_status}")
            print(f"Media: {device.current_media}")
        finally:
            await device.disconnect()


asyncio.run(main())

Replace the example address with the UPnP description URL and IP address of your device.

Device Discovery

Run the included CLI to discover WiiM devices advertised through Zeroconf and print their current state:

python -m wiim

Applications that already receive discovery information can use async_create_wiim_device() with the discovered UPnP location. This avoids running a second discovery implementation and lets the application manage the device lifecycle explicitly.

Error Handling

All SDK-specific exceptions derive from WiimException:

  • WiimRequestException reports HTTP and network request failures.
  • WiimDeviceException reports device and UPnP action failures.
  • WiimInvalidDataException reports invalid device responses.

Catch a more specific exception when the application needs different recovery behavior for transport failures and invalid data.

from wiim import WiimException

try:
    ...
except WiimException as err:
    print(f"WiiM request failed: {err}")

Development

Clone the repository and install tox:

python -m pip install tox

Run the test suite in the isolated Python 3.13 environment:

python -m tox -e py313

Run all configured test and static-check environments:

python -m tox

License

This project is available under the MIT License.

Support

Report bugs and request features through GitHub Issues. For product support, contact support@wiimhome.com.

Metadata

Release files for wiim 0.4.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for wiim 0.4.1
File Size Uploaded Provenance Actions
wiim-0.4.1.tar.gz 40.6 kB Without provenance Details for wiim-0.4.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for wiim 0.4.1
File Interpreter ABI Platform Actions
wiim-0.4.1-py3-none-any.whl Python 3 none any Details for wiim-0.4.1-py3-none-any.whl

Total release size: 83.2 kB

Release files / wiim-0.4.1.tar.gz

Download URL wiim-0.4.1.tar.gz
Size 40.6 kB
Tags Source
SHA-256 checksum
How to use checksums
8788b13207d8ebafd329403c772445776851099bcf50e8aea1f51077b63f49cc
BLAKE2b-256 checksum
How to use checksums
979efb1cd8e7d9280eb0661f5e65b7cd896251f19364424719dd2c5737bea1b7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / wiim-0.4.1-py3-none-any.whl

Download URL wiim-0.4.1-py3-none-any.whl
Size 42.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9a72eff87bcd9de27aec31889f260852ff95042223138d40fa292c156173ffe8
BLAKE2b-256 checksum
How to use checksums
d197d61a6a41a408e0688606ea9dba1509521787e1200248b1eb3f537473e5b9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Security for wiim 0.4.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.4.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page