Skip to main content

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 canonical input -> expected cases, 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 parameter is appended as _{parameter}.
  • An optional prefix is prepended as {prefix}_ (events, buttons).
  • Hub-like addresses (hub, install_mode, program, sysvar), internal addresses (INT000*) and virtual-remote addresses are prefixed with the central_id; all other addresses are not.
  • The whole result is lowercased last (note: -/: folding applies to the address only — a - inside the parameter survives, 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.toml reads it via setuptools dynamic attr. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aiohomematic_contract-2026.6.1.tar.gz (14.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

aiohomematic_contract-2026.6.1-py3-none-any.whl (15.7 kB view details)

Uploaded Python 3

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

Hashes for aiohomematic_contract-2026.6.1.tar.gz
Algorithm Hash digest
SHA256 9da25590dee9fb068c245725a171fd058330b24e32cd5bb2f10a5b211703b6ba
MD5 0ace66ea3e29ef8c98b8260c52fa2944
BLAKE2b-256 c1122ed4af6b0174bdaf2c2fd8dae47914f06cc3d4f19ea5849d693105b6c07a

See more details on using hashes here.

Provenance

The following attestation bundles were made for aiohomematic_contract-2026.6.1.tar.gz:

Publisher: publish.yml on SukramJ/aiohomematic-contract

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file aiohomematic_contract-2026.6.1-py3-none-any.whl.

File metadata

File hashes

Hashes for aiohomematic_contract-2026.6.1-py3-none-any.whl
Algorithm Hash digest
SHA256 510a14f032009a571cd6ff0041aaf1cb50b5470a117d1eca124f57ca176089db
MD5 6108dfe332f13711302a15297566ffa2
BLAKE2b-256 41b146947327f3417e10b2f82a0ca8501a4b1d9bbf4bd1d483ae7966f6b7e56a

See more details on using hashes here.

Provenance

The following attestation bundles were made for aiohomematic_contract-2026.6.1-py3-none-any.whl:

Publisher: publish.yml on SukramJ/aiohomematic-contract

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page