From 59dc066efc04d1bd8915dd2311d2467ec5d7331a Mon Sep 17 00:00:00 2001 From: "J.P. Krauss" Date: Mon, 2 Sep 2024 16:51:40 -0700 Subject: [PATCH] feat: Add armed_night configuration hooks --- packages/notification/notification.yaml | 10 +++--- packages/security/security.yaml | 44 ++++++++++++++++++++----- 2 files changed, 40 insertions(+), 14 deletions(-) diff --git a/packages/notification/notification.yaml b/packages/notification/notification.yaml index 5bc58f1..d9d77d5 100644 --- a/packages/notification/notification.yaml +++ b/packages/notification/notification.yaml @@ -27,11 +27,6 @@ notify: push: interruption-level: time-sensitive - - name: general - platform: group - services: - - action: iphone_jp - # `notify.status` used for simple status reporting (e.g. washer done) # Keeps these notifications separated from security alerts - name: status @@ -46,6 +41,11 @@ notify: data: group: 'status-notification-group' + - name: general + platform: group + services: + - action: iphone_jp + - name: everyone platform: group services: diff --git a/packages/security/security.yaml b/packages/security/security.yaml index d98f02d..583a009 100644 --- a/packages/security/security.yaml +++ b/packages/security/security.yaml @@ -39,15 +39,29 @@ input_text: # ----------------------------------------------------------------------------- # Alarm Settings input_boolean: - auto_arm_alarm: + auto_arm_alarm_presence: name: Automatically Arm Alarm on Presence Change - auto_disarm_alarm: + auto_disarm_alarm_presence: name: Automatically Disarm Alarm on Presence Change + auto_arm_alarm_night: + name: Automatically Arm/Disarm Alarm at Night disable_camera_events: name: Disable Camera Events guest_mode: name: Guest Mode +input_datetime: + alarm_auto_arm_night_start: + name: Auto-Arm Night Start + initial: '21:00' + has_date: false + has_time: true + alarm_auto_arm_night_end: + name: Auto-Arm Night Start + initial: '05:00' + has_date: false + has_time: true + binary_sensor: # ----------------------------------------------------------------------------- @@ -134,6 +148,15 @@ template: mdi:garage {% endif %} + - name: Security Night + state: > + {% set now = states('sensor.time') %} + {{ + states('alarm_auto_arm_night_start') <= time <= '23:59' + or + '00:00' <= time <= states('alarm_auto_arm_night_end') + }} + # ----------------------------------------------------------------------------- # Garage Door Button input_button: @@ -215,12 +238,12 @@ automation: target: entity_id: switch.garage_door_relay_1 - - alias: Auto-Arm Alarm + - alias: Auto-Arm Alarm (Presence) trigger: - platform: state entity_id: sensor.house_presence_status to: Away - condition: "{{ is_state('input_boolean.auto_arm_alarm', 'on') }}" + condition: "{{ is_state('input_boolean.auto_arm_alarm_presence', 'on') }}" action: - service: alarm_control_panel.alarm_arm_away target: @@ -228,12 +251,12 @@ automation: data: code: !secret alarm_code - - alias: Auto-Disarm Alarm + - alias: Auto-Disarm Alarm (Presence) trigger: - platform: state entity_id: sensor.house_presence_status to: Just Arrived - condition: "{{ is_state('input_boolean.auto_disarm_alarm', 'on') }}" + condition: "{{ is_state('input_boolean.auto_disarm_alarm_presence', 'on') }}" action: - service: alarm_control_panel.alarm_disarm target: @@ -308,6 +331,7 @@ automation: state: - 'armed_away' - 'armed_home' + - 'armed_night' - 'armed_vacation' action: - service: input_text.set_value @@ -320,7 +344,7 @@ automation: target: entity_id: alarm_control_panel.ha_alarm - - alias: Trigger Alarm on Motion + - alias: Trigger Alarm on Interior Motion trigger: - platform: state entity_id: binary_sensor.all_motion_sensors @@ -351,6 +375,7 @@ automation: condition: state entity_id: alarm_control_panel.ha_alarm state: + - 'armed_night' - 'armed_away' - 'armed_vacation' action: @@ -491,6 +516,7 @@ automation: payload: new value_template: "{{ value_json.type }}" condition: + - condition: "{{ not is_state('alarm_control_panel.ha_alarm', 'disarmed') }}" - condition: template value_template: "{{ trigger.payload_json.after.has_clip }}" action: @@ -537,7 +563,7 @@ automation: - if: "{{ event_data['status'] == 200 }}" then: - - service: notify.everyone + - service: notify.security data: title: 'Doorbell' message: 'Home Doorbell Rang' @@ -563,7 +589,7 @@ automation: [View Clip](/api/frigate/notifications/{{ event_data['content']['event_id'] }}/clip.mp4) else: - - service: notify.everyone + - service: notify.security data: title: "Doorbell" message: "Home Doorbell Rang but could not create event: {{ event_data['content']['message'] }}"