Automation Templating - add support for trigger platform:device

As per device trigger templating is not supported, could you add the possibilities the use template with trigger platform device.

device_id: 2e850d2b0cf24a1fa092ce2b77e4b4b2
domain: zha
platform: device
type: remote_button_short_press
subtype: turn_on

service_template: “light.{{trigger.subtype}}”

Thanks for your help!
Newby enthusiastic HA user.

So you are telling me that my switches won’t come on ?

  - alias: au_switch_a1_ontime1
      - platform: template
        value_template: "{{ states('sensor.time') == states('input_datetime.id_switch_a1_tmeslt1_on') [0:5] }}"
      - condition: state
        entity_id: input_boolean.ib_switch_a1_timeslot1_enable
        state: 'on'
      - service: switch.turn_on
        entity_id: switch.switch_aeon_a01

If you mean something else you havn’t explained it very well.
What are you trying to achieve ?

If you look at the doc (link) you’ll see that platform: device is not supported for templating.
In your case you are using platform: template with state condition

In my case, the trigger is a device (Ikea On/Off Switch or remote control?) which doesn’t have states (except for battery power).
I want to call different scripts depending on the trigger.type/subtype values.

for now my work around is to listen to zha_event and interpret the commands (platform: event) but it’s a hack that work only for zha device

Thank you.

The event trigger is not a hack.

Device automations were introduced as a simple automation method meant to be configured via the UI. It is aimed at people starting out with home assistant. Introducing templates to this would make it considerably more complicated. It seems unlikely to me that this will ever happen. If you want templates use yaml automations.

1 Like

Math, you are the owner of the thread, you get a notification any time someone posts to it, I’m not, I don’t. You’d have to reply to me, so I get a notice.

@tom_l (math, this is another way of notifying someone, use it sparingly) sorry but you are pointing him at ‘normal’ automations, what the hell is he using then ?
I’m going to have to set up a development HA instance just to keep track of the AE and UI editors. I assume this is a sub-set from the AE ?
It seems I may have to back away from helping newbies if I can’t get my head round the new editors.

Thats just the AE isn’t it ? (it’s still got the stupid device id and domain bits but it actually seems to be in a reasonable order unlike some other recent output we’ve been dealing with)
Hmmm !
Yeah, I’ll have to build a newbie help instance and populate it with some cheap zigbee stuff

Okay, another time commitment I can’t afford :sob: