Help please: dictionary model for triggered events

BLUF: how does one leverage the data payload that is generated by an event trigger?

I’ve spent hours searching documentation and various discussion forums for help on this, and I’m stuck. I’ve spent 40 years in software development, so it is particularly frustrating that I can’t figure this out.

Here’s what I’m trying to do:

  1. create an automation triggered by an integration event
  2. display information from the event data in a notification

This is such a basic thing to do and should be “simple” but none of my attempts have been successful.

Here’s an example of what I’ve tried.

alias: Abode event test
trigger:
  - platform: event
    event_type:
      - abode_arm
action:
  - service: notify.mobile_app_bobs_iphone_se
    data:
      message: Event name - "{{ event_name }}"

When I arm the Abode system, the automation triggers, the notification is delivered, but the text string is empty.

Through the Developer Tools > Events I can see the data response:

event_type: abode_arm
data:
  device_id: ""
  device_name: Gateway
  device_type: Panel
  event_code: "3758"
  event_name: Gateway Armed - Home
  event_type: Armed - Home
  event_utc: 1668212578
  user_name: Bob
  app_type: iOS
  event_by: ""
  date: 11/11/2022
  time: 06:22 PM
origin: LOCAL
time_fired: "2022-11-12T00:22:57.840910+00:00"
context:
  id: 01GHMKFNHGEFRX6TTA4FZM56DN
  parent_id: null
  user_id: null

I’ve tried other forms for the template syntax, but have been unsuccessful.

Can anyone point me in the right direction to find clear documentation on how to use the data dictionary delivered by an event?

Try this:

message: Event name - "{{ trigger.event.data.event_name }}"

@tom_l that worked. Thanks!

But that doesn’t answer my question for future reference: where can I find documentation that gives me guidance on deciphering the data dictionary?

1 Like