With state-based triggers, we can do things like this:
- platform: state
entity_id: sensor.remote
and the trigger will fire whenever the sensor.remote
entity changes state, independent of the from:
or to:
state in that transition. Thus, one trigger can cover many different types of state changes.
Is there anything similar available for device triggers? e.g., with the current core integrations for Hue and Lutron Caseta, the only available triggers for the remotes are device triggers, as there are no entities created for these devices.
Thus, the trigger:
section for an automation/blueprint that contains all the functionality (for all buttons) for that remote would end up looking like this:
- device_id: xxxxxxxxxxxxxxxxxxxxxxxxxxxx
domain: hue
platform: device
type: remote_button_short_release
subtype: turn_on
- device_id: xxxxxxxxxxxxxxxxxxxxxxxxxxxx
domain: hue
platform: device
type: remote_button_short_release
subtype: turn_off
[...]
- device_id: xxxxxxxxxxxxxxxxxxxxxxxxxxxx
domain: hue
platform: device
type: remote_button_long_release
subtype: dim_down
Enumerating all the triggers results in a lot of repeated code when you consider button presses, button releases, short presses, long presses, double presses, etc.
I tried omitting the sub-type:
entry in hopes that it would accept any sub-type:
, but HA won’t even load that code. Same for omitting the type:
field.
- device_id: xxxxxxxxxxxxxxxxxxxxxxxxxxxx
domain: hue
platform: device
type: remote_button_short_release
Any better ideas vs. enumerating all the possible triggers in the trigger:
section?