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.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 pykefcontrol 1.0.1
File Size Uploaded Provenance Actions
pykefcontrol-1.0.1.tar.gz 107.1 kB Without provenance Details for pykefcontrol-1.0.1.tar.gz

Built distribution (wheel)

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

Total release size: 183.5 kB

Release files / pykefcontrol-1.0.1.tar.gz

Download URL pykefcontrol-1.0.1.tar.gz
Size 107.1 kB
Tags Source
SHA-256 checksum
How to use checksums
23f2b2b0beba20822a0fac008df07f704ceae72904c8b6756232027a8260f639
BLAKE2b-256 checksum
How to use checksums
a0b9a63d190b548197d748bf19d34a8a0c8d45a89e121097373a0ae3b8d904bb
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.1-py3-none-any.whl

Download URL pykefcontrol-1.0.1-py3-none-any.whl
Size 76.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d2afee3d33ef6b147668528ff64e892366b440c4dc572a1612f0209391777124
BLAKE2b-256 checksum
How to use checksums
dd9198d9d864570739da8c93b60a23af91c2f0305ce7d507a0f09203ba3de456
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.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.

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