PythonKebaClient
A Python client library for reading and controlling KEBA KeContact wallboxes (P30 series) over Modbus TCP.
Installation
uv add keba-modbus-client
Requires Python 3.10+. The wallbox's Modbus TCP interface must be enabled (DIP switch DSW1.3 = ON; see the "KEBA KeContact P20/P30 Installation Manual").
Usage
from python_keba_client import KebaModbusClient
client = KebaModbusClient(address="192.168.1.50")
print(client.charging_state)
# {"state": <ChargingState.CHARGING: 3>, "text": "A charging process is active."}
print(client.active_power) # W
print(client.total_energy) # kWh
client.set_charging_current(16) # A
client.enable_chargingstation()
client.disable_chargingstation()
client.todict() returns a single dict with all readings, ready for json.dumps(...).
See examples/ for complete, runnable scripts (reading status, setting the charging current via a CLI, disabling charging).
Configuration via environment variables
Connection settings can also be supplied via KEBA_-prefixed environment variables (KEBA_ADDRESS, KEBA_PORT, KEBA_TIMEOUT, KEBA_SLAVEID, KEBA_DEBUG) instead of constructor arguments, via the underlying pydantic-settings model.
A note on disable_chargingstation()
On some wallboxes/firmware versions, writing to the enable/disable register (5014) over Modbus TCP does not reliably stop a charging session that is already in progress, even though the write is acknowledged without error. If you hit this:
- Check the wallbox's DIP switch DSW2.5 ("communication hub mode"). It should be OFF unless the wallbox is a client behind an x-series master, a KeContact C10 hub, or an OCPP backend — otherwise the wallbox may defer session control to a higher-ranking system that isn't actually present.
- The Modbus TCP and UDP interfaces are mutually exclusive on the wallbox (enabling one disables the other via the same DIP switch), so this cannot be worked around by also speaking the older KEBA UDP protocol without giving up Modbus TCP.
Development
uv sync --all-extras --all-groups
uv run pytest
uvx ruff format .
uvx ruff check .
uvx ty check .
See RELEASING.md for how to publish a new version to PyPI.
License
MIT, see LICENSE.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file keba_modbus_client-0.2.0.tar.gz.
File metadata
- Download URL: keba_modbus_client-0.2.0.tar.gz
- Upload date:
- Size: 9.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0604536d0a5b308a187d8c9646ed4f9f4b56cbc1a8af0af09c4b4046d5a1db09
|
|
| MD5 |
2eff9674e42167c201030f876fffac76
|
|
| BLAKE2b-256 |
4eca39beaf42464ce41a8710b0add7647c27e8cee9645f4d293fab51175a1080
|
File details
Details for the file keba_modbus_client-0.2.0-py3-none-any.whl.
File metadata
- Download URL: keba_modbus_client-0.2.0-py3-none-any.whl
- Upload date:
- Size: 8.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
03a35f8e96798d2d41ad22c6fdd16d8d9fe781d43e5587218cb6be8c5b3fa19a
|
|
| MD5 |
1f6f9605cac0f64a0297c909846aa65e
|
|
| BLAKE2b-256 |
d548449f89d2095e29ae02ae9d3d4883688ba05f3ade360c9dedc8bd1a0f2b73
|