Notification with fiendly name on sensor

I´m trying to get what sensor is triggering the event and send this as a notification to my iphone. I have read some other topic on the forum and they all say I should use {{ trigger.to_state.attributes.friendly_name }} but when I try this then i never get the notification to my phone. If I just change the message to be something else I get the text I sent as message so the notification part is working.

Here is my automation

- id: '1532691377615'
  alias: Test notification
  trigger:
  - entity_id: group.sleeping_room_motion_sensor
    platform: state
    to: 'on'
  condition: []
  action:
  - data:
      message: ' {{ trigger.to_state.attributes.friendly_name }} '
    service: notify.ios_klangens_iphonex

I use Hassio v0.74.2 on a rasp3. Does anyone know what can be the issue?

replace data: with data_template: under action: and that should work

2 Likes

Thanks! That was easy!

1 Like