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.

Beyond IR: app and gamepad families

Two families extend the vocabulary past classic IR remotes so one control language spans IR, BLE, and native transports:

  • app_* — video-app launch hotkeys (app_netflix, app_youtube, app_prime_video, app_disney_plus, …). These appear on real IR remotes, so both resolve() and canonical() map their Flipper spellings.
  • pad_* — gamepad controller inputs (pad_a, pad_up, pad_l1, pad_start, …). These have no IR source — they exist purely as cross-transport canonical vocabulary, so resolve()/canonical() only match the namespaced pad_* spellings, not arbitrary remote names.

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.1.tar.gz (244.5 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.1-py3-none-any.whl (42.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: homeops_ir_canonical-0.1.1.tar.gz
  • Upload date:
  • Size: 244.5 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.1.tar.gz
Algorithm Hash digest
SHA256 38ccb555d92e53b9a3dbec0ececa8a09f86dd8df2bddfefb6a1c99f73fcff1b1
MD5 bcb67716cc8c2931013c5f9574ce47c0
BLAKE2b-256 cf34bb03b9ef8fb34fe9fd47bd281166d126a0a72f260d38df0e9214e18b6229

See more details on using hashes here.

Provenance

The following attestation bundles were made for homeops_ir_canonical-0.1.1.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.1-py3-none-any.whl.

File metadata

File hashes

Hashes for homeops_ir_canonical-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 32a91901f77802bb493bfa5bbb1f08ade869a2f823a6c4338e9eb8fb2379e8e2
MD5 13204e9f629a273f5a8ff7da22df8fc0
BLAKE2b-256 530cb8cb1d94c5b9320f3cbf761c872794dcef60dad96e3d40593b0239ff82ac

See more details on using hashes here.

Provenance

The following attestation bundles were made for homeops_ir_canonical-0.1.1-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