I have an automation and push notification working properly that will send a notification when the alarm is triggered. Taking this a step further, how can I modify the message in the notification so it will tell me which binary_sensor was last tripped that caused the alarm to trigger?
What I have so far…
- alias: Alarm Triggered
trigger:
platform: state
entity_id: alarm_control_panel.alarm
to: 'triggered'
action:
- service: notify.ios_iphone
data:
title: "ALARM TRIGGERED!!"
message: |
Home Alarm was triggered.
If you replace your data: section with this, you’ll see which sensors were triggered:
data_template:
title: '*ALARM TRIGGERED!*'
message: >
Alarm was triggered on:
{% for state in states.binary_sensor -%}
{% if state.state == 'on' and state.name not in ['Ignore This one', 'And ignore this one'] %}
{{ state.name }}
{%- endif -%}
{%- endfor -%}
The whole "and state.name not in [..] can be omitted if don’t want to exclude entries.
After doing some testing, the solution proposed looked promising, but unfortunately this won’t work. I believe it’s the way the envisalink plugin for HA is designed.
When alarm is set to ARM and you breach one of the binary sensors (whether it cause the alarm to go off immediately or it is a delayed entry), it never gets reported to Home Assistant for one reason or another. I think that the envisalink module is guarding that information, as the keypad will never show which binary sensor was tripped until AFTER you clear the alarm.
Similarly, if you arm the alarm and bypass a zone, any time that bypassed zone is opened, it will not report it to HA since it is currently being bypassed.