Skip to main content

XKNX - An asynchronous KNX library written in Python

PyPI - Python Version codecov Checked with mypy prek HA integration usage Discord

Documentation

See documentation at: https://xknx.io/

Help

We need your help for testing and improving XKNX. For questions, feature requests, bug reports either open an issue, join the XKNX chat on Discord or write an email.

Development

You will need at least Python 3.11 in order to use XKNX.

Setting up your local environment:

  1. Install uv
  2. Create the environment: uv sync
  3. Install the git hooks: uv run prek install

Dependencies are declared in pyproject.toml and pinned in uv.lock.

Testing

To run all linters, formatters and the type checker call uv run prek run --all-files

Unit tests are run with uv run pytest Running specific unit tests can be invoked by: uv run pytest -vv test/management_tests/procedures_test.py -k test_nm_individual_address_serial_number_write_fail Testing against another supported Python version: uv run --python 3.11 pytest

Home-Assistant

XKNX is the underlying library for the KNX integration in Home Assistant.

Example

"""Example for switching a light on and off."""

import asyncio

from xknx import XKNX
from xknx.devices import Light


async def main():
    """Connect to KNX/IP bus, switch on light, wait 2 seconds and switch it off again."""
    async with XKNX() as xknx:
        light = Light(
            xknx,
            name="TestLight",
            group_address_switch="1/0/9",
        )
        xknx.devices.async_add(light)

        await light.set_on()
        await asyncio.sleep(2)
        await light.set_off()


asyncio.run(main())

Attributions

Many thanks to Enertex Bayern GmbH, Weinzierl Engineering GmbH and MDT technologies GmbH for providing us a device to support testing and development of xknx.

Metadata

Release files for xknx 4.1.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 xknx 4.1.0
File Size Uploaded Provenance Actions
xknx-4.1.0.tar.gz 268.5 kB With provenance Details for xknx-4.1.0.tar.gz

Built distribution (wheel)

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

Total release size: 671.3 kB

Release files / xknx-4.1.0.tar.gz

Download URL xknx-4.1.0.tar.gz
Size 268.5 kB
Tags Source
SHA-256 checksum
How to use checksums
e229e4d288834231d63641d165ab3792a0eb5e41ae3c52a88fec350bca080629
BLAKE2b-256 checksum
How to use checksums
cff8a0666255434f88967a5558ea02c587942169509e9909865d12c6dd70defc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 2, 2026.

Transparency log

Release files / xknx-4.1.0-py3-none-any.whl

Download URL xknx-4.1.0-py3-none-any.whl
Size 402.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d95ccfdee2f5060b13a540905f31eeca17a32eb0641654933d4023e6a167baba
BLAKE2b-256 checksum
How to use checksums
6728189f97523d49d9cba1d37cebadaa8df2a3eec09b97d95cfcbd4bee6421dd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 2, 2026.

Transparency log

Security for xknx 4.1.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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for xknx-4.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 2, 2026.

Transparency log

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

4.1.0 This release

2 release files Full 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