Notification Alarm Which Device Triggered

I have created an automation to play media and send a notification when an alarm is triggered.

How can I include the device’s friendly name in the notification instead of “Entry at home!” ?

alias: 'Alarm: Armed Away'
description: ''
trigger:
  - platform: state
    entity_id: binary_sensor.office_window_2
    to: 'on'
condition:
  - condition: state
    entity_id: alarm_control_panel.ha_alarm
    state: armed_away
action:
  - service: notify.mobile_app_stavros_phone
    data:
      message: ALARM TRIGGERED! Entry at home!
  - service: media_player.volume_set
    data:
      volume_level: 1
    entity_id: media_player.office_display
  - service: tts.cloud_say
    data:
      entity_id: media_player.office_display
      message: You are captured on camera and the police have been called.
mode: single
      message: 'ALARM TRIGGERED! Entry at {{ trigger.to_state.attributes.friendly_name }}'

Spot on @123 Thank you!

1 Like