From f29ed4325d99f12dd7ae06f577ed4cafe3bcedfa Mon Sep 17 00:00:00 2001 From: Przemek Grondek Date: Sun, 5 Jun 2022 21:55:50 +0200 Subject: [PATCH] Alarm door relock --- .../automations/alarm-door-relock.yaml | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 configuration/automations/alarm-door-relock.yaml diff --git a/configuration/automations/alarm-door-relock.yaml b/configuration/automations/alarm-door-relock.yaml new file mode 100644 index 0000000..a192f9a --- /dev/null +++ b/configuration/automations/alarm-door-relock.yaml @@ -0,0 +1,42 @@ +- id: vacation-door-lock + alias: "[Alarm] Door relock" + trigger: + - platform: state + entity_id: + - lock.front_door_25f246fe_door_lock + to: unlocked + condition: + - condition: not + conditions: + - condition: state + entity_id: alarm_control_panel.home_alarm + state: disarmed + action: + - service: notify.mobile_app_iphone_pg + data: + title: "Door unlocked!" + message: Front door was unlocked, trying to lock it back + - choose: + - conditions: + - condition: state + entity_id: binary_sensor.front_door_open_close + state: 'on' + sequence: + - wait_for_trigger: + - platform: state + entity_id: binary_sensor.front_door_open_close + to: 'off' + - repeat: + until: + - condition: state + entity_id: lock.front_door_25f246fe_door_lock + state: locked + sequence: + - service: lock.lock + target: + entity_id: lock.front_door_25f246fe_door_lock + - service: notify.mobile_app_iphone_pg + data: + title: "Door locked back" + message: Front door was successfully locked + mode: single