Can I save event_data as some sort of alias somewhere to make it reusable?

I’ve got an automation with a couple of triggers from Philip’s Hue switches where I’ve had to use the “zha_event” event_type and some event_data.

It works perfectly; but as I roll out more automation for those switches it’s not very human-readable or reusable in the current form.

alias: Office on
description: ""
trigger:
  - platform: event
    event_data:
      device_ieee: 00:17:88:01:08:f0:a5:9d
      endpoint_id: 1
      command: "on"
    event_type: zha_event
condition: []
action:
  - service: scene.turn_on
    target:
      entity_id: scene.office_on
    metadata: {}
mode: single

Where would I save something like the below so I can re-use it time and time again?

  - platform: event
    event_data:
      device_ieee: 00:17:88:01:09:a5:be:40
      endpoint_id: 1
      command: on_press
    event_type: zha_event

In pseudo-code I guess what I’m hoping to end up with is something closer to this

  - platform: event
    event_type: alias
    event_data:
     command: office_switch_turned_on

I’m not sure quite what the terminology is - but I’m guessing I should be able to save that bundle of event-data as a reusable snippet somewhere… can anyone guide me in the right direction? Thanks!

Probably the best option would be to consider using a a Trigger-based Template Sensor with an event trigger.

1 Like

Amazing - thanks @rossk - that looks like it’s probably what I was after :slight_smile:

I’ll have a play later!