Skip to main content

Canonical media-control vocabulary + Flipper-IRDB name→canonical mapping.

Project description

ir-canonical

A canonical media-control vocabulary and a Flipper-IRDB name → canonical mapping, published as a small Python library so both the ESPHome codegen (esphome-ir-codegen) and Concerto can resolve remote buttons semantically instead of matching raw strings.

Why

Flipper-IRDB has no enforced button naming — 54,415 distinct names over 301,921 occurrences. "Volume up" alone appears as VOL+, Vol_up, VOLUME_UP, VOL_^, TV_Vol+, AMP_VOL+, … So you cannot match a control by raw name.

Use it

pip install homeops-ir-canonical
from ir_canonical import resolve, canonical, MAP

resolve("VOL+")        # -> "volume_up"  (curated lookup, baked at build time)
resolve("TV_Power")    # -> "power_toggle"
canonical("Ch_prev")   # -> "channel_down"  (rule engine; maps unseen spellings)
canonical("HDMI_1")    # -> "input_hdmi_1"
MAP["vol+"]            # the flat {alias: canonical} dict, lower-cased keys
  • resolve(name) — fast curated lookup via the bundled, human-maintained controls/ tree (compiled to control_map.json at build time).
  • canonical(name) — the broad rule-based engine; resolves spellings the curated tree hasn't enumerated yet, and the full vocabulary (not just the core).

Both are case-insensitive.

The curated controls tree (edit this by hand)

src/ir_canonical/controls/ is the human-owned source of truth for the core controls that matter for driving activities (power / volume / channel / transport / navigation / digits / source — a curated subset):

src/ir_canonical/controls/
  Volume_Up/aliases.json     ["VOL+", "Vol_up", "VOLUME_UP", "AMP_VOL+", ...]
  Power_Toggle/aliases.json  ["POWER", "STANDBY", "TV_POWER", "PWR", ...]
  ...

Edit any aliases.json to prune or extend a control. The build bakes the tree into control_map.json (so installs get an instant lookup); CI fails the build if two controls claim the same alias.

Layout

Path What
src/ir_canonical/normalize.py the rule-based canonical() engine + vocabulary
src/ir_canonical/controls/ the curated tree (edit by hand)
src/ir_canonical/compile.py tree → {alias: canonical} compiler
hatch_build.py build hook that bakes control_map.json into the wheel
seed.py dev tool: seed the tree + data/ reports from a Flipper-IRDB clone
data/ full auto-derived map + unmapped tail (reference, not shipped)

Develop

python -m build --wheel --no-isolation     # build (bakes the map)
pip install dist/*.whl && pytest -q         # test as a consumer
python seed.py /path/to/Flipper-IRDB-clone  # re-seed the tree (won't clobber edits)

Release & publish

Versioning is managed by release-please (Conventional Commits). Merging the release PR tags a GitHub Release, which triggers publish.yaml to upload the wheel to PyPI via trusted publishing.

One-time PyPI setup: create the homeops-ir-canonical project and add a trusted publisher → owner HomeOps, repo ir-canonical, workflow publish.yaml, environment pypi.

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

homeops_ir_canonical-0.1.0.tar.gz (241.4 kB view details)

Uploaded Source

Built Distribution

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

homeops_ir_canonical-0.1.0-py3-none-any.whl (34.3 kB view details)

Uploaded Python 3

File details

Details for the file homeops_ir_canonical-0.1.0.tar.gz.

File metadata

  • Download URL: homeops_ir_canonical-0.1.0.tar.gz
  • Upload date:
  • Size: 241.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for homeops_ir_canonical-0.1.0.tar.gz
Algorithm Hash digest
SHA256 3d613bb701b64dfd9354b87763c55ff2451b0e8f2fd83f88d794b698ef055108
MD5 01370c0e0d3ce02068b72bf0466cb0fc
BLAKE2b-256 b6d07d84168df1dde4ec08f033d2ad20d1f8aeaa31b511200e8c03f1319e11cb

See more details on using hashes here.

Provenance

The following attestation bundles were made for homeops_ir_canonical-0.1.0.tar.gz:

Publisher: publish.yaml on HomeOps/ir-canonical

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

File details

Details for the file homeops_ir_canonical-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for homeops_ir_canonical-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6e5103b6cb03f488052175c5c46ff9997fa49edc70632746105d5234b095e407
MD5 cd881509a4c4f8d2912bc8fb0f65338e
BLAKE2b-256 dd79505773d13859a7220dd808a4a521114d9a682038ed6ceac630f735385a86

See more details on using hashes here.

Provenance

The following attestation bundles were made for homeops_ir_canonical-0.1.0-py3-none-any.whl:

Publisher: publish.yaml on HomeOps/ir-canonical

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