The following automation, which alerts me with an actionable iOS notification when one of the smoke sensors trips, woks as intended.
- id: smoke_alarm_triggered
alias: 'Smoke Alarm Triggered'
trigger:
- platform: state
entity_id: binary_sensor.smoke_hall, binary_sensor.smoke_lounge,binary_sensor.smoke_rumpus
to: 'on'
action:
- service: switch.turn_on
entity_id: switch.siren_inside
- service: switch.turn_on
entity_id: switch.strobe_inside
- service: notify.ios_iphone
data:
message: Smoke Alarm has TRIGGERED!!!
data:
push:
badge: 0
category: "silencealarm"
action_data:
entity_id: group.alarm_outputs
However as soon as I add the following template to indicate which sensor has triggered the alarm I get no message:
- id: smoke_alarm_triggered
alias: 'Smoke Alarm Triggered'
trigger:
- platform: state
entity_id: binary_sensor.smoke_hall, binary_sensor.smoke_lounge,binary_sensor.smoke_rumpus
to: 'on'
action:
- service: switch.turn_on
entity_id: switch.siren_inside
- service: switch.turn_on
entity_id: switch.strobe_inside
- service: notify.ios_iphone
data_template:
message: "The {{ trigger.entity_id.attributes.friendly_name }} Smoke Alarm has TRIGGERED!!!"
data:
push:
badge: 0
category: "silencealarm"
action_data:
entity_id: group.alarm_outputs
Any idea what I am doing wrong? I’ve tried encasing the message in single, double or no quotes without success.
Similarly, using data: instead of data_template: does not work.
Each sensor does have a correctly defined friendly name.
Other’s have indicated the {{ trigger.entity_id.attributes.friendly_name }} works for their notifications.
It may be something blindingly obvious as I am new to this.