Skip to main content

pykefcontrol

Python library to control KEF wireless speakers (W2 platform) over the local network.

It provides an asyncio client and a blocking client with the same API, and covers power, sources, volume, playback, EQ/DSP settings, speaker settings and live updates pushed by the speaker.

Version 1.0 is a full rewrite with breaking changes: upgrading from 0.9? See the migration guide. It has been validated on an LS50 Wireless II (firmware 4.1.192); reports for other models are welcome.

Supported speakers

LS50 Wireless II, LS60 Wireless, LSX II, LSX II LT, XIO and LS LUXE. Other W2-platform speakers should work in a generic mode.

Not supported: Coda W and Muo (Bluetooth only), first generation LS50 Wireless and LSX (see aiokef).

Installation

pip install pykefcontrol
pip install "pykefcontrol[discovery]"   # with network discovery (mDNS)

Requires Python 3.12 or newer.

Usage

from pykefcontrol import KefClient

with KefClient("192.168.1.20") as speaker:
    speaker.power_on()
    speaker.set_volume(30)
    print(speaker.get_player_state().track)
from pykefcontrol import KefAsyncClient

async def main():
    async with KefAsyncClient("192.168.1.20") as speaker:
        await speaker.set_volume(30)
        async for state in speaker.watch():   # pushed by the speaker on every change
            print(state)

A command line tool is included: pykefcontrol --help.

Features

  • Power, source selection, volume and mute
  • Playback control, track information, shuffle and repeat
  • Full EQ / DSP profile (desk and wall modes, treble, bass extension, subwoofer settings...)
  • Typed catalogue of speaker settings (standby, LEDs, remote, volume limits...)
  • Live updates through the speaker's event queue, with automatic reconnection
  • HTTPS API of recent firmware (signed requests, KEF certificate) with fallback to HTTP
  • Model and firmware capabilities, device and network information
  • Speaker discovery (mDNS) and raw access to the speaker's API

Documentation

For Home Assistant, see hass-kef-connector.

Development

uv sync
uv run pytest
uv run ruff check . && uv run mypy

The blocking client (pykefcontrol/_sync/) is generated from the async one (pykefcontrol/_async/) by scripts/gen_sync.py; edit the async code and regenerate.

License

MIT. pykefcontrol is an independent project and is not affiliated with KEF.

Metadata

Release files for pykefcontrol 1.0.0

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

Source distribution (sdist)

Source distribution for pykefcontrol 1.0.0
File Size Uploaded Provenance Actions
pykefcontrol-1.0.0.tar.gz 106.5 kB Without provenance Details for pykefcontrol-1.0.0.tar.gz

Built distribution (wheel)

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

Total release size: 182.4 kB

Release files / pykefcontrol-1.0.0.tar.gz

Download URL pykefcontrol-1.0.0.tar.gz
Size 106.5 kB
Tags Source
SHA-256 checksum
How to use checksums
68387c156e8941f1b02e2322240da12249baf3492dedb80882808603d339df6c
BLAKE2b-256 checksum
How to use checksums
19c392f38ba22f3f61741fea28db21fc45103ae14aed05271f7f84ec64b2529a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"NixOS","version":"26.11","id":"zokor","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / pykefcontrol-1.0.0-py3-none-any.whl

Download URL pykefcontrol-1.0.0-py3-none-any.whl
Size 76.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6c2c0335ddd67a3bcf173b33b62b7b771283de7dc8c149fc4314eca57c779f6f
BLAKE2b-256 checksum
How to use checksums
80f9df6f76e361034ac9992eb171eca92f480d20e4f77c4e119ab8730f19135e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"NixOS","version":"26.11","id":"zokor","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for pykefcontrol 1.0.0

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.

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