donnib
July 5, 2017, 12:43pm
1
Hi,
I would like to send a notification when the alarm is triggered and in that knowing which sensor triggered the alarm so i have following :
#################################################
# Trigger alarm while armed.... #
#################################################
- alias: 'Trigger alarm while armed away'
initial_state: true
trigger:
- platform: mqtt
topic: "home/433toMQTT"
payload: 12345
- platform: mqtt
topic: "home/433toMQTT"
payload: 123456
condition:
- condition: state
entity_id: alarm_control_panel.alarm
state: armed_away
action:
- service: alarm_control_panel.alarm_trigger
entity_id: alarm_control_panel.alarm
- service: notify.pushbullet
data_template:
message: >
{% if trigger.payload | string == '12345'%}
"main door"
{% elif trigger.payload | string == '123456%}
"kitchen door"
{% endif %}
The problem is that the notification is sent right away when the alarm is triggered but i have 45sec to turn it off before it’s really triggered when i enter the house so essentially only in the case the alarm is really triggered it should send a notification. How can i accomplish that ?
I could make a automation that looks at the alarm_control_panel for it’s status triggered but i don’t know if i can get the triggered sensor to know.
any ideas would be appreciated.
keithh666
(Keith Hull)
July 5, 2017, 2:55pm
2
Can’t you put a mins delay in the start of the action and have another automation that cancels the alarm one if the alarm is successfully deactivated?
1 Like
donnib
July 11, 2017, 11:44am
3
I am not sure exactly how to do that, do you have an example ?
keithh666
(Keith Hull)
July 11, 2017, 4:37pm
4
#################################################
# Trigger alarm while armed.... #
#################################################
- alias: 'Trigger alarm while armed away'
initial_state: true
trigger:
- platform: mqtt
topic: "home/433toMQTT"
payload: 12345
- platform: mqtt
topic: "home/433toMQTT"
payload: 123456
condition:
- condition: state
entity_id: alarm_control_panel.alarm
state: armed_away
action:
- delay: '00:00:45' # Add a delay for the time you are disarming
- service: alarm_control_panel.alarm_trigger
entity_id: alarm_control_panel.alarm
- service: notify.pushbullet
data_template:
message: >
{% if trigger.payload | string == '12345'%}
"main door"
{% elif trigger.payload | string == '123456%}
"kitchen door"
{% endif %}
#################################################
# Trigger when alarm disarmed... #
#################################################
- alias: 'Trigger when alarm disarmed'
initial_state: true
trigger:
<on disarmed>
action:
- service: automation.turn_off
entity_id: automation.trigger_alarm_while_armed_away
- delay: '00:00:45' # assuming it can take 45s to disarm
- service: automation.turn_on
entity_id: automation.trigger_alarm_while_armed_away
Something like that should do it I think You’ll have to figure out how to get the disarmed trigger working.
lambtho
(Lambtho)
July 11, 2017, 5:42pm
5
I do not use this component, but something like this may work as a trigger for the disarming
trigger:
- platform: state
entity_id: alarm_control_panel.ha_alarm
from: armed_away
to: disarmed
RezzZ
(ReneS)
November 26, 2018, 1:06pm
6
I shared my solution here, where I can pass the trigger to the actual automation that fires when the alarm is triggered, honouring timeouts:
although this is already an old topic, here my solution that works with HA 0.82.1:
Create an input_text for your triggered devices.
I use a separate input_text.yaml and enabled it in my configuration.yaml with the line
input_text: !include input_texts/input_text.yaml
My input_text.yaml:
alarm_trigger:
name: Alarm Trigger
initial: ""
My automation that triggers the alarm, alarm_triggers.yaml:
alias: 'Alarm Triggers'
trigger:
- platform: state
entity_id: binary_sensor.motion_living
…