Python client for Kospel C.MI electric heater HTTP API
Project description
kospel-cmi-lib
Python client for the Kospel C.MI electric heater HTTP API.
Features
- Async-first: Built on
asyncioandaiohttpfor non-blocking I/O - Type-safe: Strict type hinting throughout
- Registry-driven: Settings defined declaratively in a central registry; dynamic property access on
HeaterController - Simulator-capable: Full simulator for offline development and testing (no hardware required)
- Protocol-based: Decoder/encoder interfaces via Python
Protocoltypes
Installation
# With uv (recommended)
uv add kospel-cmi-lib
# With pip
pip install kospel-cmi-lib
Usage
Create a register backend (HTTP or YAML), then pass it to HeaterController.
When using HttpRegisterBackend, call aclose() or use the controller as an
async context manager to release the HTTP session when done.
Recommended: async context manager (resources released automatically):
import asyncio
import aiohttp
from kospel_cmi.controller.api import HeaterController
from kospel_cmi.kospel.backend import HttpRegisterBackend, YamlRegisterBackend
async def main() -> None:
api_base_url = "http://192.168.1.1/api/dev/65" # Replace with your heater URL
async with aiohttp.ClientSession() as session:
backend = HttpRegisterBackend(session, api_base_url)
async with HeaterController(backend=backend) as controller:
await controller.refresh()
print(controller.heater_mode) # Access registry-defined settings
# controller.heater_mode = "manual" # Modify (if writable)
# await controller.save() # Write pending changes to the device
# Session and controller resources released here
asyncio.run(main())
Alternative: explicit aclose() (for long-lived integrations like Home Assistant):
controller = HeaterController(backend=HttpRegisterBackend(session, api_base_url))
try:
await controller.refresh()
# ... use controller ...
finally:
await controller.aclose()
For offline development or tests, use the YAML backend (no HTTP, no close needed):
backend = YamlRegisterBackend(state_file="/path/to/state.yaml")
controller = HeaterController(backend=backend)
await controller.refresh()
Documentation
- [Architecture](https://github.com/JanKrl/kospel-cmi-lib/blob/master/docs/architecture.md — layers, components, and data flow
- Technical specifications — data formats, protocols, testing, and coding standards
License
Apache License 2.0
Links
Project details
Release history Release notifications | RSS feed
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 kospel_cmi_lib-0.1.0a3.tar.gz.
File metadata
- Download URL: kospel_cmi_lib-0.1.0a3.tar.gz
- Upload date:
- Size: 17.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
df393a82740a436d5241df46a38497f814fd3ef9ccbf10bfd3d342589c29916e
|
|
| MD5 |
9f66f90032419da70130a68907b243bf
|
|
| BLAKE2b-256 |
985112f0fe200c27bb3ecd9a7ed8bd1e654e6a5c0eba5c5549c9c78e43a3fe85
|
Provenance
The following attestation bundles were made for kospel_cmi_lib-0.1.0a3.tar.gz:
Publisher:
release-pypi.yml on JanKrl/kospel-cmi-lib
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
kospel_cmi_lib-0.1.0a3.tar.gz -
Subject digest:
df393a82740a436d5241df46a38497f814fd3ef9ccbf10bfd3d342589c29916e - Sigstore transparency entry: 928462514
- Sigstore integration time:
-
Permalink:
JanKrl/kospel-cmi-lib@5464fbbacff86d3a22d3b69cabf52c81ffbe28ef -
Branch / Tag:
refs/tags/v0.1.0a3 - Owner: https://github.com/JanKrl
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-pypi.yml@5464fbbacff86d3a22d3b69cabf52c81ffbe28ef -
Trigger Event:
push
-
Statement type:
File details
Details for the file kospel_cmi_lib-0.1.0a3-py3-none-any.whl.
File metadata
- Download URL: kospel_cmi_lib-0.1.0a3-py3-none-any.whl
- Upload date:
- Size: 23.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4914e5b5e7b05e3a7de4700661f9915cfb41540a4345269f9bb741bf2931432c
|
|
| MD5 |
42267c099df28d41db95499fd8ac9cf8
|
|
| BLAKE2b-256 |
b38944b727071bd6ae5e96a4489801033f83abe318063a9acaee046824bf3de7
|
Provenance
The following attestation bundles were made for kospel_cmi_lib-0.1.0a3-py3-none-any.whl:
Publisher:
release-pypi.yml on JanKrl/kospel-cmi-lib
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
kospel_cmi_lib-0.1.0a3-py3-none-any.whl -
Subject digest:
4914e5b5e7b05e3a7de4700661f9915cfb41540a4345269f9bb741bf2931432c - Sigstore transparency entry: 928462515
- Sigstore integration time:
-
Permalink:
JanKrl/kospel-cmi-lib@5464fbbacff86d3a22d3b69cabf52c81ffbe28ef -
Branch / Tag:
refs/tags/v0.1.0a3 - Owner: https://github.com/JanKrl
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-pypi.yml@5464fbbacff86d3a22d3b69cabf52c81ffbe28ef -
Trigger Event:
push
-
Statement type: