Cross-implementation contracts (golden fixtures + reference algorithms) shared by aiohomematic and py-openccu-loom-client.
Project description
aiohomematic-contract
Cross-implementation contracts shared by
aiohomematic and
py-openccu-loom-client.
When more than one backend has to reproduce the same behaviour bit-for-bit, a prose description in one repo drifts the moment a rule changes. This package is the single source of truth for those shared behaviours, so the contract lives in exactly one place and every consumer runs it.
Each contract ships as:
- a golden fixture (
data/<name>_golden.json) — the canonicalinput -> expectedcases, the authoritative artifact every consumer runs; - a dependency-free reference implementation that the package's own tests validate against that fixture.
Contracts
unique_id — Home Assistant value-change routing key
The unique_id is the routing key for every Home Assistant value-change
subscription. aiohomematic derives it from device/channel addresses
(aiohomematic/model/support.py:generate_unique_id); py-openccu-loom-client
rebuilds it independently. The two must produce bit-identical output, or
events route to the wrong (or no) entity.
Format rules:
:and-both fold to_.- An optional
parameteris appended as_{parameter}. - An optional
prefixis prepended as{prefix}_(events, buttons). - Hub-like addresses (
hub,install_mode,program,sysvar), internal addresses (INT000*) and virtual-remote addresses are prefixed with thecentral_id; all other addresses are not. - The whole result is lowercased last (note:
-/:folding applies to the address only — a-inside theparametersurvives, e.g.ccu3_sysvar_aussen-temperatur).
See aiohomematic_contract/unique_id.py for the reference implementation and
aiohomematic/docs/drop-in-optimizations.md for the background.
hub_slug — hub data-point name slug rule
Hub data points (system variables, programs, connectivity, metrics) build their
unique_id as generate_unique_id(parameter=hub_slug(legacy_name)), where
hub_slug is python-slugify with default settings (dash separator, Unicode
transliteration, lowercased). A naive replace()-based cleaner diverges on
non-ASCII names — "Außen Temperatur" → aussen-temperatur (ä→a, ß→ss), not
außen_temperatur — producing a different unique_id and lost HA entities on
cutover. Reference: aiohomematic_contract/slug.py; golden: data/hub_slug_golden.json.
generate_channel_unique_id — channel/device routing key
aiohomematic's second routing key (Channel._unique_id). No parameter, and
the central_id is prepended only for virtual-remote addresses (not for
hub/internal). Reference: aiohomematic_contract/unique_id.py; golden:
data/channel_unique_id_golden.json.
DataPointCategory / DataPointType / CommandPriority enums
The enums HA filters on (and the command-priority levels). aiohomematic imports
them from this package; an alternative client keeps its own copy. The
data/category_golden.json and data/command_golden.json fixtures pin the
name → value maps so both sides can assert against them and cannot drift.
Usage
from aiohomematic_contract import generate_unique_id, load_golden_cases
# Reference algorithm:
generate_unique_id(central_id="ccu3", address="VCU1234567:1", parameter="STATE")
# -> "vcu1234567_1_state"
# Drive your own implementation against the canonical cases:
for case in load_golden_cases("unique_id"):
assert my_impl(case) == case["expected"]
A consumer that vendors a copy of data/unique_id_golden.json should keep it
byte-identical to the canonical file here and pin the aiohomematic-contract
version it was copied from.
Development
pip install -e ".[dev]"
pytest
Versioning & releasing
This is a foundational runtime package: aiohomematic (and
homematicip_local, py-openccu-loom-client) import its symbols, so it must be
released before the consumers that use a new symbol.
- Version scheme:
YYYY.MM.NN. Single source of truth:aiohomematic_contract/const.py:VERSION;pyproject.tomlreads it via setuptools dynamicattr. Bump it on every published change to the shared surface. - This package must never import
aiohomematic(it is the bottom of the stack).
The full contract-first release order, pinning rules and local-dev workflow
live in the aiohomematic repo:
docs/contributor/contract_release_process.md.
License
MIT — see LICENSE.
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 aiohomematic_contract-2026.6.1.tar.gz.
File metadata
- Download URL: aiohomematic_contract-2026.6.1.tar.gz
- Upload date:
- Size: 14.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9da25590dee9fb068c245725a171fd058330b24e32cd5bb2f10a5b211703b6ba
|
|
| MD5 |
0ace66ea3e29ef8c98b8260c52fa2944
|
|
| BLAKE2b-256 |
c1122ed4af6b0174bdaf2c2fd8dae47914f06cc3d4f19ea5849d693105b6c07a
|
Provenance
The following attestation bundles were made for aiohomematic_contract-2026.6.1.tar.gz:
Publisher:
publish.yml on SukramJ/aiohomematic-contract
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
aiohomematic_contract-2026.6.1.tar.gz -
Subject digest:
9da25590dee9fb068c245725a171fd058330b24e32cd5bb2f10a5b211703b6ba - Sigstore transparency entry: 1711911175
- Sigstore integration time:
-
Permalink:
SukramJ/aiohomematic-contract@c3d44b45dbdac9be9fe72fb092ec4e599a80aab4 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/SukramJ
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@c3d44b45dbdac9be9fe72fb092ec4e599a80aab4 -
Trigger Event:
repository_dispatch
-
Statement type:
File details
Details for the file aiohomematic_contract-2026.6.1-py3-none-any.whl.
File metadata
- Download URL: aiohomematic_contract-2026.6.1-py3-none-any.whl
- Upload date:
- Size: 15.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
510a14f032009a571cd6ff0041aaf1cb50b5470a117d1eca124f57ca176089db
|
|
| MD5 |
6108dfe332f13711302a15297566ffa2
|
|
| BLAKE2b-256 |
41b146947327f3417e10b2f82a0ca8501a4b1d9bbf4bd1d483ae7966f6b7e56a
|
Provenance
The following attestation bundles were made for aiohomematic_contract-2026.6.1-py3-none-any.whl:
Publisher:
publish.yml on SukramJ/aiohomematic-contract
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
aiohomematic_contract-2026.6.1-py3-none-any.whl -
Subject digest:
510a14f032009a571cd6ff0041aaf1cb50b5470a117d1eca124f57ca176089db - Sigstore transparency entry: 1711911199
- Sigstore integration time:
-
Permalink:
SukramJ/aiohomematic-contract@c3d44b45dbdac9be9fe72fb092ec4e599a80aab4 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/SukramJ
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@c3d44b45dbdac9be9fe72fb092ec4e599a80aab4 -
Trigger Event:
repository_dispatch
-
Statement type: