Timer Name in event for Notification Template

I have a very simple set of timers which all trigger with different events. I’d like to get a notification when any of them fire the timer.finished event. I could create an automation for each one of them, but I’d rather use a template in the notification which shows the name of the timer. I have all of that working, but can’t extract the name from the ‘trigger’ object in the template for the notification message.
To simplify things I reduced the bigger problem to a simple example which behaves identically:
The timer looks like this:

   name: "TestingTimer"
   duration: "00:00:10"

The automation looks like this: ( the message template is basic to see the trigger object, I know this won’t give me the name like that ) done via the UI, shown as YAML

alias: TestTimer
description: ''
  - platform: event
    event_type: timer.finished
      entity_id: timer.testtimer
condition: []
  - service: notify.mobile_app_pixel3a
      message: '{{ trigger }}'
mode: single

Listening for the event I get this:

    "event_type": "timer.finished",
    "data": {
        "entity_id": "timer.testtimer"
    "origin": "LOCAL",
    "time_fired": "2021-02-07T13:13:23.001892+00:00",
    "context": {
        "id": "ff10b6cde697fff949cafcd6eb2bf47e",
        "parent_id": null,
        "user_id": null

But for the notification I get:

{'platform': 'event', 'event': , 'description': "event 'timer.finished'"}

I can’t figure out how to get the entity_id so I can access the ‘name’. The ‘event’ object is empty, there is no ‘to/from_state’. The ‘data’ object is empty in the notification template as well.
Running version 2021.1.5 in a docker container.

Based on the documentation for Event Trigger, try this:

      message: '{{ trigger.event.data.entity_id }}'

If you want the entity’s object_id (“testtimer”) you can use this:

      message: '{{ trigger.event.data.entity_id.split('.')[1] }}'

Thanks, I did try something similar as both should have worked. But the “trigger.event” object is empty, once it gets to the notify.
Which I can’t figure out why, as the trigger event_data “entity_id” matches correctly.
No error is thrown in the log, but I get a blank message as the template works out to be an empty string.

That’s odd. I tested the following automation and entity_id is present in the Trigger Object.

- alias: Short Timer Finished
  - platform: event
    event_type: timer.finished
      entity_id: timer.timer_short
  - service: persistent_notification.create
      title: '{{ trigger.event.data.entity_id }}'
      message: '{{ trigger }}'

Screenshot from 2021-02-07 10-04-33

Interesting. I get the same results as you for persistent_notification. Both with the “create” as you’ve done and with notify.persistent_notification.
Using notify.mobile_app_XX the event object is empty. So there is clearly a difference between the notify.mobile_app and notify.persistent_notification in how the field are populated.

Sounds like a bug … or an undocumented “feature”.

As far I know, the Trigger Object should be consistent in what it returns from the Event Trigger. Changing the action’s service call shouldn’t affect what the Trigger Object contains (at least not in my opinion).

You may want to post this as an Issue in the Core repository. Be sure to mention the two examples where it works in one but not the other.

Thanks for your help narrowing this down.
It looks to be an artifact with the Android notification, as the iOS one works the same as the persistant one.
Even with the entity extracted I can’t get the common or friendly name out of the timer object. I just get “None” for any attributes.
In my more expanded need I only need this 4 times, so I’ve just created an automation for each.
Perhaps someone could explain how to go from {{trigger.event.data.entity_id}} in a timer event to the ‘name’ as defined at the begining.

If you mean ‘TestingTimer’, that’s in the timer entity’s friendly_name attribute.

{{ state_attr(trigger.event.data.entity_id, 'friendly_name') }}

Thanks! That does work. and that works for the Android too… Even though earlier it was empty.
It seems the order might matter, calling the iOS first. But then changing it back, still has it work.

Some non-repeatable weirdness. boo.