From b26f01d8cdf1242e54126a36ade97220557b7790 Mon Sep 17 00:00:00 2001 From: "J.P. Krauss" Date: Tue, 5 Jul 2022 15:58:07 -0700 Subject: [PATCH] Update Security Package --- packages/security/security.yaml | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/packages/security/security.yaml b/packages/security/security.yaml index 5ab7c51..463d89e 100644 --- a/packages/security/security.yaml +++ b/packages/security/security.yaml @@ -68,6 +68,18 @@ binary_sensor: - binary_sensor.bedroom_side_window - binary_sensor.bedroom_back_window +sensor: + - platform: template + name: Open Windows/Doors + unique_id: open_windows_doors + state: > + {{ + expand(state_attr('binary_sensor.all_doors', 'entity_id') + state_attr('binary_sensor.all_windows', 'entity_id')) + | selectattr('state', 'in', ['on']) + | map(attribute='attributes.friendly_name') + | list | join(', ') + }} + # ----------------------------------------------------------------------------- # Security Automations automation: @@ -127,3 +139,24 @@ automation: }} by {{ person.attributes.friendly_name }} + + - alias: Trigger Alarm on Window or Door Open + trigger: + - platform: state + entity_id: binary_sensor.all_doors + to: 'on' + - platform: state + entity_id: binary_sensor.all_windows + to: 'on' + condition: + - or: + - condition: state + entity_id: alarm_control_panel.ha_alarm + state: armed_away + - condition: state + entity_id: alarm_control_panel.ha_alarm + state: armed_vacation + action: + - service: notify.security + data: + message: Alarm triggered by {{ state('sensor.open_windows_doors') }}