All my away/home and alarm arm/disarm is done by a combination of phone tracking and motion detection. This works really wel.
However I had no way to arm/disarm in the case of a guest so I have added a RFID reader to my setup but this will only be used by for instance the cleaning lady.
Now I want to add a delay to my arm and disarm in the case the panel is used. So more concreet:
Normally when nobody home and alarm is in away mode; Any sensor triggers a notitification (and sirene which is still disabled for now).
However now I want to give the cleaning lady the time to disarm the alarm with the RFID tag (let’s say 60 sec). In case of success I disarm the alarm, if no success the alarm sounds/notification start.
I’m struggling with how to build in the 60 sec ‘pauze’ that gives the time to disarm or, if nothing being dis-armed, actually sounds the alarm.
#the automation that defines if the alarm is in away mode or not
- alias: “Someone home”
trigger:
- platform: state
entity_id: group.all_devices
from: “not_home”
to: “home”
action:
- service: input_select.select_option
data:
entity_id: input_select.Occupancy
option: “Home”
- service: input_select.select_option
data:
entity_id: input_select.alarm
option: “None”
The automation that kicks in when there is motion & alarm is in away mode
It’s really not that much different than what you are doing with your automations, Ty - check into it. Here’s the automations I am using associated with it - the only real difference between yours and mine is that I am setting the arming state manually.
# Alarm based automations
- alias: 'Armed away'
trigger:
- platform: state
entity_id: binary_sensor.kitchen_entry
state: 'on'
- platform: state
entity_id: binary_sensor.side_door
state: 'on'
- platform: state
entity_id: binary_sensor.office_motion
state: 'on'
- platform: state
entity_id: binary_sensor.tearoom_motion
state: 'on'
- platform: state
entity_id: binary_sensor.second_floor_motion
state: 'on'
- platform: state
entity_id: binary_sensor.tea_room_slider
state: 'on'
- platform: state
entity_id: binary_sensor.dining_room_1
state: 'on'
- platform: state
entity_id: binary_sensor.dining_room_2
state: 'on'
- platform: state
entity_id: binary_sensor.tea_room_slider
state: 'on'
condition:
condition: state
entity_id: alarm_control_panel.ha_alarm
state: armed_away
action:
- service: alarm_control_panel.alarm_trigger
entity_id: alarm_control_panel.ha_alarm
- service: notify.pushbullet
data:
message: 'Robert, the alarm has been triggered while you were away.'
- alias: 'Armed home'
trigger:
- platform: state
entity_id: binary_sensor.kitchen_entry
state: 'on'
- platform: state
entity_id: binary_sensor.side_door
state: 'on'
- platform: state
entity_id: binary_sensor.second_floor_motion
state: 'on'
- platform: state
entity_id: binary_sensor.tearoom_motion
state: 'on'
- platform: state
entity_id: binary_sensor.office_motion
state: 'on'
- platform: state
entity_id: binary_sensor.tea_room_slider
- platform: state
entity_id: binary_sensor.dining_room_1
state: 'on'
- platform: state
entity_id: binary_sensor.dining_room_2
state: 'on'
- platform: state
entity_id: binary_sensor.tea_room_slider
state: 'on'
condition:
condition: state
entity_id: alarm_control_panel.ha_alarm
state: armed_home
action:
- service: alarm_control_panel.alarm_trigger
entity_id: alarm_control_panel.ha_alarm
- service: notify.pushbullet
data:
message: 'Robert, the alarm has been triggered.'
I haven’t updated it since I bought my siren/strobe and added some sensors but will be doing that soon.
Bit busy with work so only had time to follow up now. Finally added the alarm component but still not sure how to use it in the context of giving you the time to disarm.
I get the trigger (any sensor to ‘on’) and the condition ('only if alarm panel is armed_away). But then; How to you avoid the notification is send immediate when trigger and condition is true (instead of 'pauzing and giving someone time to disarm the alarm) ? Or does the first action create some kind of pauze, evaluates if the alarm is disarmed > if yes quites the automatoon, if no continues.
Thanks, your a patient guy! I actually read the documentation but still not sure how this works. Are you sure your automation is implemented correctly? I think actions in an automation always get executed immediately and in sequence (or you need to use -delay- but still they would continue after the delay is over.
In other words with your automation I would expect; independent of the trigger time (in your case 60 sec) you will get the notification immidiately (and not after 60 sec) when a sensor is tripped (and alarm panel is armed)
Should your automation not end after below and have another automation that uses the alarm trigger as a the trigger or condition, which would then allow for the 60 sec to disarm time , and if not disarmed, would excute any alarm actions?
I’ve tested it and it seems to work reliably. I haven’t really used it for a long time since I created it because I haven’t been going out much lately but I do remember having to play with the two timing parameter to get it to notify me in a reasonable time when tripped while still allowing me to set the alarm and leave without tripping it or feeling rushed out the door.
I’ll try playing with it again after adding my new sensors and updating some entity names and let you know.