Get triggering device name in automation

I am trying to get a battery reader to work, but I am having difficulty getting the friendly name inside the email action. It is also seemingly not possible to test with the triggers set up.
I found these snippet, but it errors out now

{{ trigger.from_state.attributes.friendly_name }}

{{ trigger.to_state.name }}

My attempt:

alias: Batteries Low
description: ""
triggers:
  - type: battery_level
    device_id: 77b342ff0ed928ef458e1b344ef01c2f
    entity_id: ace08d40384234f7037e7827ee43a946
    domain: sensor
    trigger: device
    below: 10
    for:
      hours: 1
      minutes: 0
      seconds: 0
  - type: battery_level
    device_id: 3c6ec839e19c43350949799bb2cb64fb
    entity_id: 0b4348e667076362a886aa4a2a3de975
    domain: sensor
    trigger: device
    below: 10
    for:
      hours: 1
      minutes: 0
      seconds: 0
  - type: battery_level
    device_id: fc35a0caeb833609afc4c06ef4c8013e
    entity_id: 6ae22c2d303bce8e5c258fbdc6b530eb
    domain: sensor
    trigger: device
    below: 10
    for:
      hours: 1
      minutes: 0
      seconds: 0
  - type: battery_level
    device_id: 171174bd58518eedce852d1546597ad9
    entity_id: 6adb450218a7f44ada253c7f199257ec
    domain: sensor
    trigger: device
    below: 10
    for:
      hours: 1
      minutes: 0
      seconds: 0
  - type: battery_level
    device_id: 9e05171e4d07320e581f6c049e32a2da
    entity_id: b73db50092c01b07e4376483a66d07dd
    domain: sensor
    trigger: device
    below: 10
    for:
      hours: 1
      minutes: 0
      seconds: 0
conditions: []
actions:
  - action: notify.<my_email_notifier>
    metadata: {}
    data:
      title: Battery Needs Changing
      target: <my_email>
      message: Battery low on {{ trigger.to_state.name }} //this line the problem
mode: single

How are you testing?

The trigger variable is only populated when an actual trigger fires, you cannot use the "Run Action" command or automation.trigger action. You can test it by using the "Set State" tool in the States tab of Developer Tools to set the state to a value that would cause the trigger to fire.

However, the to_state and from_state properties do not have a name attribute. Use the other template:

{{ trigger.from_state.attributes.friendly_name }}

{{ trigger.to_state.attributes.friendly_name }}

Be aware that those will return the entity name, if you want the device name you can derive it from the entity ID:

{{ device_name(trigger.entity_id) }}

That worked! Thank you
THe other ones were throwing errors of dict does not contain to_state, but the last one worked.
Thank you for the the state tester too!