459 lines
16 KiB
YAML
459 lines
16 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: 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:
|
|
- binary_sensor:
|
|
- name: Living Room Windows
|
|
unique_id: fb4ab414-3ceb-44d2-8276-66027a936329
|
|
device_class: window
|
|
state: >
|
|
{% set windows_open = states.binary_sensor |
|
|
selectattr('entity_id','in',area_entities('living_room')) |
|
|
selectattr('attributes.device_class','eq','window') |
|
|
selectattr('state','eq','on') |
|
|
map(attribute='attributes.friendly_name') |
|
|
list | count %}
|
|
{{ windows_open > 0 }}
|
|
attributes:
|
|
windows_open: >
|
|
{% set windows_open = states.binary_sensor |
|
|
selectattr('entity_id','in',area_entities('living_room')) |
|
|
selectattr('attributes.device_class','eq','window') |
|
|
selectattr('state','eq','on') |
|
|
map(attribute='attributes.friendly_name') |
|
|
list %}
|
|
{{ windows_open }}
|
|
- name: Security Faults
|
|
unique_id: fe4e7867-6abb-43c5-adde-67971b64cc08
|
|
device_class: problem
|
|
state: >
|
|
{% set faults = states('sensor.total_faults') | int %}
|
|
{{ faults > 0 }}
|
|
- sensor:
|
|
- name: "Bypassed Sensors"
|
|
unique_id: 612f1314-494b-40f8-8c20-d5310aa17ab4
|
|
state: >-
|
|
{{ states.select |
|
|
selectattr('state','in',['Faulted','Always']) |
|
|
map(attribute='entity_id') |
|
|
map('device_id') |
|
|
list }}
|
|
- name: "Window Faults"
|
|
unique_id: 79b8ffe8-3f7c-4d4e-9809-b2023da1d497
|
|
unit_of_measurement: 'faults'
|
|
state: >-
|
|
{% set bypass = states('sensor.bypassed_sensors') %}
|
|
{% set window_sensors = states.binary_sensor |
|
|
selectattr('attributes.device_class','eq','window') |
|
|
selectattr('attributes.entity_id','eq',null) |
|
|
rejectattr('entity_id','search','windows') |
|
|
list %}
|
|
{% set windows_open = window_sensors |
|
|
selectattr('state','eq','on') |
|
|
map(attribute='entity_id') |
|
|
map('device_id') |
|
|
list %}
|
|
{% set id = namespace(devices=[]) %}
|
|
{% for device_id in windows_open %}
|
|
{% if device_id in bypass %}
|
|
{% set id.devices = id.devices + [device_id] %}
|
|
{% endif %}
|
|
{% endfor %}
|
|
{% set window_faults = windows_open |
|
|
reject('in',id.devices) |
|
|
list |
|
|
count %}
|
|
{{ window_faults }}
|
|
attributes:
|
|
faulted: >
|
|
{% set bypass = states('sensor.bypassed_sensors') %}
|
|
{% set window_sensors = states.binary_sensor |
|
|
selectattr('attributes.device_class','eq','window') |
|
|
selectattr('attributes.entity_id','eq',null) |
|
|
rejectattr('entity_id','search','windows') |
|
|
list %}
|
|
{% set windows_open = window_sensors |
|
|
selectattr('state','eq','on') |
|
|
map(attribute='entity_id') |
|
|
map('device_id') |
|
|
list %}
|
|
{% set id = namespace(devices=[]) %}
|
|
{% for device_id in windows_open %}
|
|
{% if device_id in bypass %}
|
|
{% set id.devices = id.devices + [device_id] %}
|
|
{% endif %}
|
|
{% endfor %}
|
|
{% set device_list = windows_open |
|
|
reject('in',id.devices) |
|
|
list %}
|
|
{% set fn = namespace(friendly=[]) %}
|
|
{% for device_id in device_list %}
|
|
{% if device_id in device_list %}
|
|
{% set name = device_attr(device_id,'name') %}
|
|
{% set fn.friendly = fn.friendly + [name] %}
|
|
{% endif %}
|
|
{% endfor %}
|
|
{{ fn.friendly }}
|
|
icon: >-
|
|
{% if states('sensor.window_faults') | int > 0 %}
|
|
mdi:window-open
|
|
{% else %}
|
|
mdi:window-closed
|
|
{% endif %}
|
|
- name: "Door Faults"
|
|
unique_id: 22421a5a-e650-409d-8ec7-53ca06ca8c0c
|
|
unit_of_measurement: faults
|
|
state: >-
|
|
{% set bypass = states('sensor.bypassed_sensors') %}
|
|
{% set door_sensors = states.binary_sensor |
|
|
selectattr('attributes.device_class','eq','door') |
|
|
selectattr('attributes.entity_id','eq',null) |
|
|
rejectattr('entity_id','search','doors') |
|
|
list %}
|
|
{% set doors_open = door_sensors |
|
|
selectattr('state','eq','on') |
|
|
map(attribute='entity_id') |
|
|
map('device_id') |
|
|
list %}
|
|
{% set id = namespace(devices=[]) %}
|
|
{% for device_id in doors_open %}
|
|
{% if device_id in bypass %}
|
|
{% set id.devices = id.devices + [device_id] %}
|
|
{% endif %}
|
|
{% endfor %}
|
|
{% set door_faults = doors_open |
|
|
reject('in',id.devices) |
|
|
list |
|
|
count %}
|
|
{{ door_faults }}
|
|
attributes:
|
|
faulted: >
|
|
{% set bypass = states('sensor.bypassed_sensors') %}
|
|
{% set door_sensors = states.binary_sensor |
|
|
selectattr('attributes.device_class','eq','door') |
|
|
selectattr('attributes.entity_id','eq',null) |
|
|
rejectattr('entity_id','search','doors') |
|
|
list %}
|
|
{% set doors_open = door_sensors |
|
|
selectattr('state','eq','on') |
|
|
map(attribute='entity_id') |
|
|
map('device_id') |
|
|
list %}
|
|
{% set id = namespace(devices=[]) %}
|
|
{% for device_id in doors_open %}
|
|
{% if device_id in bypass %}
|
|
{% set id.devices = id.devices + [device_id] %}
|
|
{% endif %}
|
|
{% endfor %}
|
|
{% set device_list = doors_open |
|
|
reject('in',id.devices) |
|
|
list %}
|
|
{% set fn = namespace(friendly=[]) %}
|
|
{% for device_id in device_list %}
|
|
{% if device_id in device_list %}
|
|
{% set name = device_attr(device_id,'name') %}
|
|
{% set fn.friendly = fn.friendly + [name] %}
|
|
{% endif %}
|
|
{% endfor %}
|
|
{{ fn.friendly }}
|
|
icon: >-
|
|
{% if states('sensor.door_faults') | int > 0 %}
|
|
mdi:door-open
|
|
{% else %}
|
|
mdi:door-closed
|
|
{% endif %}
|
|
- name: "Windows Open"
|
|
unique_id: 780770d2-8b5a-4c96-aee4-459281cc3471
|
|
unit_of_measurement: 'open'
|
|
state: >-
|
|
{% set windows = states.binary_sensor |
|
|
selectattr('attributes.device_class','eq','window') |
|
|
selectattr('attributes.entity_id','eq',null) |
|
|
rejectattr('entity_id','search','windows') %}
|
|
{% set windows_open = windows |
|
|
selectattr('state','eq','on') |
|
|
list |
|
|
count %}
|
|
{{ windows_open }}
|
|
attributes:
|
|
open: >
|
|
{% set windows = states.binary_sensor |
|
|
selectattr('attributes.device_class','eq','window') |
|
|
selectattr('attributes.entity_id','eq',null) |
|
|
rejectattr('entity_id','search','windows') %}
|
|
{% set window_names = windows |
|
|
selectattr('state','eq','on') |
|
|
map(attribute='attributes.friendly_name') |
|
|
list %}
|
|
{{ window_names }}
|
|
icon: >-
|
|
{% if states('sensor.windows_open') | int == 0 %}
|
|
mdi:window-closed
|
|
{% else %}
|
|
mdi:window-open
|
|
{% endif %}
|
|
- name: "Front Windows Open"
|
|
unique_id: ff8a0e1b-806d-44c5-a5b9-2be0b4c0f893
|
|
unit_of_measurement: 'open'
|
|
state: >-
|
|
{% set windows = [
|
|
states.binary_sensor.front_window_1,
|
|
states.binary_sensor.front_window_2
|
|
] %}
|
|
{% set windows_open = windows | selectattr('state','eq','on') | list | count %}
|
|
{{ windows_open }}
|
|
attributes:
|
|
open: >
|
|
{% set windows = [
|
|
states.binary_sensor.front_window_1,
|
|
states.binary_sensor.front_window_2
|
|
] %}
|
|
{% set window_names = windows |
|
|
selectattr('state','eq','on') |
|
|
map(attribute='attributes.friendly_name') |
|
|
list %}
|
|
{{ window_names }}
|
|
icon: >-
|
|
{% if states('sensor.front_windows_open') | int == 0 %}
|
|
mdi:window-closed
|
|
{% else %}
|
|
mdi:window-open
|
|
{% endif %}
|
|
- name: "Living Room Windows Open"
|
|
unique_id: d7b12353-3017-4640-b871-323425ea62d1
|
|
unit_of_measurement: 'open'
|
|
state: >-
|
|
{% set windows_open = states.binary_sensor |
|
|
selectattr('entity_id','in',area_entities('living_room')) |
|
|
selectattr('attributes.device_class','eq','window') |
|
|
selectattr('state','eq','on') |
|
|
map(attribute='entity_id') |
|
|
list | count %}
|
|
{{ windows_open }}
|
|
attributes:
|
|
open: >
|
|
{% set windows_open = states.binary_sensor |
|
|
selectattr('entity_id','in',area_entities('living_room')) |
|
|
selectattr('attributes.device_class','eq','window') |
|
|
selectattr('state','eq','on') |
|
|
map(attribute='entity_id') |
|
|
list | count %}
|
|
{{ windows_open }}
|
|
icon: >
|
|
{% if states('sensor.living_room_windows_open') | int == 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 = expand('binary_sensor.exterior_doors') %}
|
|
{% set doors_open = doors |
|
|
selectattr('state','eq','on') |
|
|
list |
|
|
count %}
|
|
{{ doors_open }}
|
|
attributes:
|
|
open: >
|
|
{% set doors = expand('binary_sensor.exterior_doors') %}
|
|
{% set door_names = doors |
|
|
selectattr('state','eq','on') |
|
|
map(attribute='attributes.friendly_name') |
|
|
list %}
|
|
{{ door_names }}
|
|
icon: >-
|
|
{% if states('sensor.doors_open') | int == 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 exterior = expand('binary_sensor.exterior_doors') |
|
|
map(attribute='entity_id') |
|
|
list %}
|
|
{% set interior = states.binary_sensor |
|
|
selectattr('attributes.device_class','eq','door') |
|
|
rejectattr('entity_id','in',exterior) |
|
|
rejectattr('entity_id','eq','binary_sensor.exterior_doors') |
|
|
selectattr('state','eq','on') |
|
|
list |
|
|
count %}
|
|
{{ interior }}
|
|
attributes:
|
|
open: >
|
|
{% set exterior = expand('binary_sensor.exterior_doors') |
|
|
map(attribute='entity_id') |
|
|
list %}
|
|
{% set interior = states.binary_sensor |
|
|
selectattr('attributes.device_class','eq','door') |
|
|
rejectattr('entity_id','in',exterior) |
|
|
rejectattr('entity_id','eq','binary_sensor.exterior_doors') |
|
|
selectattr('state','eq','on') |
|
|
map(attribute='attributes.friendly_name') |
|
|
list %}
|
|
{{ interior }}
|
|
icon: >-
|
|
{% if states('sensor.interior_doors') | int == 0 %}
|
|
mdi:door-closed
|
|
{% else %}
|
|
mdi:door-open
|
|
{% endif %}
|
|
- name: Faults
|
|
unique_id: 1629a83a-a46c-4041-9e49-8e54c5195388
|
|
unit_of_measurement: 'faults'
|
|
state: >-
|
|
{% set window_faults = states('sensor.window_faults') | int %}
|
|
{% set door_faults = states('sensor.door_faults') | int %}
|
|
{{ door_faults + window_faults }}
|
|
attributes:
|
|
faulted: >
|
|
{% set windows = state_attr('sensor.window_faults','faulted') %}
|
|
{% set doors = state_attr('sensor.door_faults','faulted') %}
|
|
{{ doors + windows }}
|
|
icon: >-
|
|
{% if states('sensor.total_faults') | int == 0 %}
|
|
mdi:shield-home
|
|
{% else %}
|
|
mdi:shield-off
|
|
{% endif %}
|
|
- name: Air Leaks
|
|
unique_id: e0a7b343-1d67-447c-a543-85a4b93d3d93
|
|
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: >-
|
|
{% if states('sensor.air_leaks') | int == 0 %}
|
|
mdi:leak-off
|
|
{% else %}
|
|
mdi:leak
|
|
{% endif %}
|