Files
Home-Assistant-Configs/packages/security.yaml

213 lines
7.4 KiB
YAML

input_boolean:
# Main security switch. If this is on, the security is armed.
sentry_mode:
name: Sentry Mode
icon: mdi:security
# Vacation mode is automagically set when we are 3 hours from the house, and turns off when we return.
# This is used to modify some of the normal automations.
vacation_mode:
name: Vacation Mode
icon: mdi:airplane-takeoff
# Guest mode is use to modify automations when we have guests.
# In some cases this prevents security from being set to prevent security alarm going off
guest_mode:
name: Guest Mode
icon: mdi:account-multiple
# This switch powers the security alarm and gives an easy way to kill the alarm.
# When it is on, the alarm is going off
security_alarm:
name: Security Alarm
icon: mdi:speaker-wireless
# This switch powers the fire alarm.
# When on the fire alarm is going off.
fire_alarm:
name: Fire Alarm
icon: mdi:speaker-wireless
# This switch turns on if the security system checks that fire when someone tries to arm the system
# finds a door open, or another condition that would prevent the system from being able to monitor properly.
lockdown_issue:
name: Lockdown Issue
icon: mdi:lock-reset
# This switch is turned on if there is a security breach. Turning on this switch starts the countdown to the alarm.
security_issue:
name: Security Issue
icon: mdi:alert-circle-outline
skip_disarm:
name: Skip Disarm
icon: mdi:security
skip_rearm:
name: Skip Rearm
icon: mdi:security
input_datetime:
morning_alarm_disarm:
name: Morning Alarm Disarm
icon: mdi:shield-off
has_date: false
has_time: true
morning_alarm_rearm:
name: Morning Alarm Rearm
icon: mdi:shield-home
has_date: false
has_time: true
alarm_control_panel:
- platform: template
panels:
nerdhome_alarm_panel:
name: Nerd Home Alarm Panel
unique_id: d7eb8335-4998-49bf-957e-231aeed35179
value_template: "{{ states('alarm_control_panel.stratton_ave_alarm') }}"
code_arm_required: false
arm_away:
- if:
- condition: state
entity_id: binary_sensor.security_faults
state: 'off'
then:
- service: alarm_control_panel.alarm_arm_away
target:
entity_id: alarm_control_panel.stratton_ave_alarm
data:
code: !secret ring_alarm_code
- service: input_boolean.turn_off
target:
entity_id:
- input_boolean.lockdown_issue
else:
- service: input_boolean.turn_on
target:
entity_id: input_boolean.lockdown_issue
arm_home:
- if:
- condition: state
entity_id: binary_sensor.security_faults
state: 'off'
then:
- service: alarm_control_panel.alarm_arm_home
target:
entity_id: alarm_control_panel.stratton_ave_alarm
data:
code: !secret ring_alarm_code
- service: input_boolean.turn_off
target:
entity_id:
- input_boolean.lockdown_issue
- if:
- condition: template
value_template: "{{ silent != 1 and is_state('input_boolean.vacation_mode','off') }}"
then:
- service: script.status_annc
data:
who: living_room
call_security_armed: 1
else:
- service: input_boolean.turn_on
target:
entity_id: input_boolean.lockdown_issue
disarm:
- service: alarm_control_panel.alarm_disarm
target:
entity_id: alarm_control_panel.stratton_ave_alarm
data:
code: !secret ring_alarm_code
- service: alarm_control_panel.alarm_disarm
target:
entity_id: alarm_control_panel.alexa_guard_9ee3b
- service: input_boolean.turn_off
target:
entity_id: input_boolean.lockdown_issue
- if:
- condition: template
value_template: "{{ silent != 1 and is_state('input_boolean.vacation_mode','off') }}"
then:
- service: script.status_annc
data:
who: living_room
call_security_not_armed: 1
template:
- sensor:
- name: "Windows"
unique_id: 780770d2-8b5a-4c96-aee4-459281cc3471
unit_of_measurement: 'open'
state: >-
{% set windows = [
states.binary_sensor.front_window_near,
states.binary_sensor.kitchen_big_window,
states.binary_sensor.mud_room_window,
states.binary_sensor.stairway_window_lower,
] %}
{% set windows_open = windows | selectattr('state','eq','on') | list | count %}
{{ windows_open }}
icon: >-
{% set windows = [
states.binary_sensor.front_window_near,
states.binary_sensor.kitchen_big_window,
states.binary_sensor.mud_room_window,
states.binary_sensor.stairway_window_lower,
] %}
{% set windows_open = windows | selectattr('state','eq','on') | list | count %}
{% if windows_open == 0 %}
mdi:window-closed
{% else %}
mdi:window-open
{% endif %}
- name: "Doors" #! This sensor is only for exterior doors, and interior doors that are NOT excluded from security protocols
unique_id: 61b1a98a-51a4-4faa-947d-7883de2430c0
unit_of_measurement: 'open'
state: >-
{% set doors = [
states.binary_sensor.front_door,
states.binary_sensor.back_door,
] %}
{% set doors_open = doors | selectattr('state','eq','on') | list | count %}
{{ doors_open }}
icon: >-
{% set doors = [
states.binary_sensor.front_door,
states.binary_sensor.back_door,
] %}
{% set doors_open = doors | selectattr('state','eq','on') | list | count %}
{% if doors_open == 0 %}
mdi:door-closed
{% else %}
mdi:door-open
{% endif %}
- name: "Interior Doors" # This sensor is not used for security purposes, only for information
unique_id: 772aa056-881a-4778-ba5b-19e46afc107a
unit_of_measurement: 'open'
state: >-
{% set doors = [
states.binary_sensor.basement_studio_door,
states.binary_sensor.downstairs_bathroom_door,
] %}
{% set doors_open = doors | selectattr('state','eq','on') | list | count %}
{{ doors_open }}
icon: >-
{% set doors = [
states.binary_sensor.basement_studio_door,
states.binary_sensor.downstairs_bathroom_door,
] %}
{% set doors_open = doors | selectattr('state','eq','on') | list | count %}
{% if doors_open == 0 %}
mdi:door-closed
{% else %}
mdi:door-open
{% endif %}
- name: Faults
unique_id: 1629a83a-a46c-4041-9e49-8e54c5195388
unit_of_measurement: 'open'
state: >-
{% set windows_open = states('sensor.windows_open') | int %}
{% set doors_open = states('sensor.doors_open') | int %}
{{ doors_open + windows_open }}
icon: >-
{% set windows_open = states('sensor.windows_open') | int %}
{% set doors_open = states('sensor.doors_open') | int %}
{% set faults = ( doors_open + windows_open ) %}
{% if faults == 0 %}
mdi:shield-home
{% else %}
mdi:shield-off
{% endif %}