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:
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)
controller = HeaterController(backend=backend)
await controller.refresh()
print(controller.heater_mode) # Access registry-defined settings as attributes
# controller.heater_mode = "manual" # Modify (if writable)
# await controller.save() # Write pending changes to the device
asyncio.run(main())
For offline development or tests, use the YAML backend (no HTTP):
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
kospel_cmi_lib-0.1.0a2.tar.gz
(16.8 kB
view details)
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.0a2.tar.gz.
File metadata
- Download URL: kospel_cmi_lib-0.1.0a2.tar.gz
- Upload date:
- Size: 16.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.23
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
55b1472085b73de6b62f40f60a3f2f7f9c3fd4553cfad5c145b096d443f0f620
|
|
| MD5 |
b49de2dc01539156589eb00aa1dfbc0f
|
|
| BLAKE2b-256 |
9ef1a49f935fb24caa4f896b564943d7281425edb2169d82d16a6d0d6a033349
|
File details
Details for the file kospel_cmi_lib-0.1.0a2-py3-none-any.whl.
File metadata
- Download URL: kospel_cmi_lib-0.1.0a2-py3-none-any.whl
- Upload date:
- Size: 22.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.23
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
529aa97bfa85e44c701cbcf52569fdbdcb3ef78ef8aae431de1641d1cc2b69d1
|
|
| MD5 |
7f348ecff3006cc17da9e456809a0a4f
|
|
| BLAKE2b-256 |
ec21d70219e8d7fe5ae013ac4711e39a4efe93bb7cad544f26a6f086e446b900
|