About this project

Priority Command Arbitration for Home Assistant is a custom integration that introduces a five-level priority system for controlling entities. It solves the common problem where an automation and a manual action fight over the same device, with the last command always winning. Instead, every command can carry a priority level (1 to 5), and the lowest-numbered occupied level drives the device. Levels include Manual Emergency, Automatic Emergency, Manual, Automatic, and Default. Commands at the same level replace each other; when a higher level is released, control falls to the next occupied level and that command is re-issued as it stands at that moment, not as a stale snapshot. The integration wraps supported domain services (light, switch, fan, cover, climate, water_heater, humidifier, lock, valve, media_player, input_boolean, input_number) and adds optional `priority` and `priority_ttl` fields to service calls. These fields appear as real form fields in the automation editor, script editor, Developer Tools, and button tap actions. It also provides four dedicated services: `priority.set`, `priority.relinquish`, `priority.relinquish_all`, and `priority.get` (a response service). Temporary overrides can be set with a lease (`priority_ttl`), which survives restarts and expires cleanly, landing on whatever Default currently wants. Physical switch changes are detected and recorded at Default without re-asserting the override. UI surfaces include a more-info dialog row, a tile card feature (`custom:priority-feature`), an overrides card (`custom:priority-overrides-card`), and a control card (`custom:priority-control-card`). An `Active overrides` sensor reports the number of held levels. Configuration options allow scoping arbitration to selected entities, excluding entities, and setting default priorities for users and automations (both default to 5, preserving existing behavior). The integration is installed via HACS or manual copy, requires Home Assistant 2026.8.1 or newer, and is licensed under Apache 2.0. Caveats: it rewrites the service registry using internal APIs, which may break on core updates (mitigated by contract tests and weekly CI). Suppressed commands report success even when not dispatched, which is important for locks and valves. Overrides at levels 1–4 are restored across restarts, with level 1–2 re-issued once after startup. The project is new but in daily production use with a test suite.