Add device triggers to ISY994 integration#169694
Add device triggers to ISY994 integration#169694shbatm wants to merge 6 commits intohome-assistant:devfrom
Conversation
Exposes Insteon button-press events (on/off, fast on/off, fade up/down/stop) as device triggers for SwitchLinc, KeypadLinc loads, and KeypadLinc secondary buttons. Triggers are wired to the existing isy994_control event bus so automations fire on physical device presses independent of state changes.
|
Hey there @bdraco, mind taking a look at this pull request as it has been labeled with an integration ( Code owner commandsCode owners of
|
There was a problem hiding this comment.
Pull request overview
This PR adds device-trigger support to the ISY994 integration so automations can react to raw Insteon control events such as fast on/off and fade actions, not just entity state changes. It extends the integration’s existing event emission path and adds tests around trigger discovery and firing behavior.
Changes:
- Added a new
isy994device trigger platform that maps supported node types to Insteon control-event triggers. - Moved the
isy994_controlevent name to a shared constant and reused it from both the entity event emitter and the trigger platform. - Added user-facing trigger translations and a new test module covering trigger enumeration and automation firing.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
tests/components/isy994/test_device_trigger.py |
Adds tests for trigger discovery, matching, and button isolation behavior. |
homeassistant/components/isy994/strings.json |
Adds localized labels for the new device trigger types. |
homeassistant/components/isy994/entity.py |
Switches event emission to the shared event-name constant. |
homeassistant/components/isy994/device_trigger.py |
Implements ISY994 device trigger discovery and event-based attachment. |
homeassistant/components/isy994/const.py |
Defines the shared EVENT_ISY994_CONTROL constant. |
| SUPPORTED_NODE_DEF_IDS: Final = frozenset( | ||
| { | ||
| "BallastRelayLampSwitch_ADV", | ||
| "DimmerLampSwitch_ADV", | ||
| "DimmerSwitchOnly_ADV", | ||
| "KeypadButton_ADV", | ||
| "KeypadDimmer_ADV", | ||
| "KeypadRelay_ADV", | ||
| "RelayLampOnly_ADV", | ||
| "RelayLampSwitch_ADV", | ||
| "RelaySwitchOnlyPlusQuery_ADV", | ||
| } |
There was a problem hiding this comment.
Non-_ADV devices are older generation and I do not have any to test that they emit the same control events. This subset was chosen to represent the intitial "known working" set of device types within insteon and can be expanded later.
…uttons - async_attach_trigger now rejects subtypes whose node_def_id is not in SUPPORTED_NODE_DEF_IDS, preventing hand-written YAML from attaching to unsupported ISY nodes that share the unique-id prefix. - Tests now register KeypadButton child entities under the sensor domain to match how the integration actually classifies them.
Adds tests for unknown/unloaded device lookups, entity-skip paths, empty trigger capabilities, and the three InvalidDeviceAutomationConfig error paths in async_attach_trigger. Brings coverage of device_trigger.py to 100%.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Proposed change
Adds a device-trigger platform to the ISY994 integration so users can build automations that react to physical Insteon button presses (on, off, fast on, fast off, fade up, fade down, fade stop) instead of just state changes. This distinction matters for KeypadLinc secondary buttons, which emit control events without changing any HA entity state, and for differentiating fast/fade presses on dimmers from regular on/off.
Historically, this has required custom event trigger automations to catch the
isy994_controlcommand events (e.g.DONDFONDOFDFOF) which is not very user frendly and frequently a pain point in Insteon discussions.Triggers are exposed for entities whose underlying ISY node has a supported
node_def_id(SwitchLinc dimmers/relays, KeypadLinc loads, andKeypadButton_ADVsecondary buttons). They piggyback on the existingisy994_controlevent bus emit inISYEntity.async_on_control— no changes to the event payload — and filter via the standard event-trigger machinery onentity_id+controlcode. NOTE: This is a deliberate subset of "known to work" devices that emit these controls and also represents the most common Insteon devices that take physical input (KeypadLincs, DimmerLincs, and On/Off SwitchLincs). Support for additional device types can be added in a future PR.The hardcoded
"isy994_control"string inentity.pyis lifted to a newEVENT_ISY994_CONTROLconstant inconst.pyso the device-trigger module and the entity emit stay in sync.Coexists with the built-in
light/switchdomain device triggers (which are state-change based) — both are useful and address different use cases. The strings used are deliberately using<x> was switched <command>which both distinguishes from the normal "turned on/off" status change triggers and matches the language used in the Universal Devices Admin Console which is used for programming the controller. TheFast OnandFast Offalso matches Insteon-specific language (as opposed toKeyPressedandKeyPressed2Xtypical for Z-Wave).Type of change
Additional information
Checklist
ruff format homeassistant tests)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest.requirements_all.txt.Updated by running
python3 -m script.gen_requirements_all.To help with the load of incoming pull requests: