525 lines
18 KiB
YAML
525 lines
18 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 }}"
|
|
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 }}"
|
|
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 %}
|
|
|
|
automation:
|
|
- id: 51819f36-2407-496c-afcd-ae160d747f0a
|
|
alias: Scheduled Alarm Disarm
|
|
trigger:
|
|
- platform: time
|
|
at: input_datetime.morning_alarm_disarm
|
|
id: morning
|
|
- platform: time
|
|
at: input_datetime.master_bedroom_wakeup
|
|
id: wakeup
|
|
condition:
|
|
- condition: state
|
|
entity_id: group.adults
|
|
state: 'home'
|
|
- condition: state
|
|
entity_id: input_boolean.vacation_mode
|
|
state: 'off'
|
|
- condition: state
|
|
entity_id: input_boolean.guest_mode
|
|
state: 'off'
|
|
- condition: template
|
|
value_template: "{{ states('alarm_control_panel.stratton_ave_alarm') not in ['disarmed','unavailable','unknown'] }}"
|
|
action:
|
|
- choose:
|
|
- conditions:
|
|
- condition: state
|
|
entity_id: input_boolean.skip_disarm
|
|
state: 'on'
|
|
sequence:
|
|
- service: input_boolean.turn_off
|
|
target:
|
|
entity_id: input_boolean.skip_disarm
|
|
- service: persistent_notification.create
|
|
data:
|
|
title: Security Information
|
|
message: Scheduled security disarm has been skipped
|
|
notification_id: security_disarm_skipped
|
|
- conditions:
|
|
- condition: trigger
|
|
id: morning
|
|
sequence:
|
|
- condition: or
|
|
conditions:
|
|
- condition: state
|
|
entity_id: input_boolean.work_today
|
|
state: 'on'
|
|
- condition: state
|
|
entity_id: input_boolean.kallen_school_today
|
|
state: 'on'
|
|
- service: alarm_control_panel.alarm_disarm
|
|
target:
|
|
entity_id: alarm_control_panel.nerdhome_alarm_panel
|
|
- conditions:
|
|
- condition: trigger
|
|
id: wakeup
|
|
sequence:
|
|
- service: alarm_control_panel.alarm_disarm
|
|
target:
|
|
entity_id: alarm_control_panel.nerdhome_alarm_panel
|
|
|
|
- id: f51eb02f-3f44-4b5d-a389-762b8ca88e2a
|
|
alias: Scheduled Alarm Rearm
|
|
trigger:
|
|
- platform: time
|
|
at: input_datetime.morning_alarm_rearm
|
|
condition:
|
|
- condition: state
|
|
entity_id: group.adults
|
|
state: 'home'
|
|
- condition: state
|
|
entity_id: input_boolean.vacation_mode
|
|
state: 'off'
|
|
- condition: state
|
|
entity_id: input_boolean.guest_mode
|
|
state: 'off'
|
|
- condition: or
|
|
conditions:
|
|
- condition: state
|
|
entity_id: input_boolean.work_today
|
|
state: 'on'
|
|
- condition: state
|
|
entity_id: input_boolean.kallen_school_today
|
|
state: 'on'
|
|
- condition: template
|
|
value_template: >
|
|
{% set rearm = state_attr('input_datetime.morning_alarm_rearm','timestamp') %}
|
|
{% set wake = state_attr('input_datetime.master_bedroom_wakeup','timestamp') %}
|
|
{% set diff = wake - rearm %}
|
|
{{ diff > 1800 }}
|
|
action:
|
|
- if:
|
|
- condition: state
|
|
entity_id: input_boolean.work_today
|
|
state: 'on'
|
|
then:
|
|
- service: script.security_scheduling
|
|
- if:
|
|
- condition: state
|
|
entity_id: input_boolean.skip_rearm
|
|
state: 'on'
|
|
then:
|
|
- service: input_boolean.turn_off
|
|
target:
|
|
entity_id: input_boolean.skip_rearm
|
|
- service: persistent_notification.create
|
|
data:
|
|
title: Security Information
|
|
message: Scheduled security rearm has been skipped
|
|
notification_id: security_rearm_skipped
|
|
- stop: Skipped
|
|
- if:
|
|
- condition: and
|
|
conditions:
|
|
- condition: time
|
|
before: "14:00:00"
|
|
after: "12:00:00"
|
|
weekday:
|
|
- mon
|
|
- tue
|
|
- wed
|
|
- thu
|
|
- fri
|
|
- condition: state
|
|
entity_id: input_boolean.kallen_school_early_release
|
|
state: "on"
|
|
then:
|
|
- stop: School early release
|
|
- if:
|
|
- condition: and
|
|
conditions:
|
|
- condition: state
|
|
entity_id: alarm_control_panel.stratton_ave_alarm
|
|
state: disarmed
|
|
- condition: time
|
|
after: '04:15'
|
|
before: '13:30'
|
|
then:
|
|
- service: alarm_control_panel.alarm_arm_home
|
|
target:
|
|
entity_id: alarm_control_panel.nerdhome_alarm_panel
|
|
|
|
- id: c7927c59-e0fe-48b9-b308-dd90fb774920
|
|
alias: Lockdown Issue
|
|
trigger:
|
|
- platform: state
|
|
entity_id: input_boolean.lockdown_issue
|
|
from: "off"
|
|
to: "on"
|
|
action:
|
|
- service: persistent_notification.create
|
|
data:
|
|
title: Lockdown Issue
|
|
notification_id: lockdown_issue
|
|
message: >-
|
|
{% set extdoors = expand('binary_sensor.exterior_doors') | selectattr('state','eq','on') | map(attribute='name') | list | join(', ') %}
|
|
{% set windows = expand('binary_sensor.windows') | selectattr('state','eq','on') | map(attribute='name') | list | join(', ') %}
|
|
A lockdown issue has been caused by the following sensors:
|
|
|
|
Doors:{% if is_state('binary_sensor.exterior_doors','on') %} {{ extdoors }} {% else %} None {% endif %}
|
|
Windows:{% if is_state('binary_sensor.windows','on') %} {{ windows }} {% else %} None {% endif %}
|
|
- service: script.text_notify
|
|
data:
|
|
type: critical
|
|
who: >-
|
|
{% if states('person.christina_stork') in ['Bob Evans','BobEvans','unavailable','unknown'] %}
|
|
tony
|
|
{% else %}
|
|
parents
|
|
{% endif %}
|
|
title: 'Security Not Armed!'
|
|
tag: lockdown-issue
|
|
message: >-
|
|
{% set extdoors = expand('binary_sensor.exterior_doors') | selectattr('state','eq','on') | map(attribute='name') | list | join(', ') %}
|
|
{% set windows = expand('binary_sensor.windows') | selectattr('state','eq','on') | map(attribute='name') | list | join(', ') %}
|
|
A lockdown issue has been caused by the following sensors:
|
|
|
|
Doors:{% if is_state('binary_sensor.exterior_doors','on') %} {{ extdoors }} {% else %} None {% endif %}
|
|
Windows:{% if is_state('binary_sensor.windows','on') %} {{ windows }} {% else %} None {% endif %}
|
|
- service: scene.create
|
|
data:
|
|
scene_id: light_state_before_lockdown_issue
|
|
snapshot_entities:
|
|
- light.living_room_color_1
|
|
- light.living_room_color_2
|
|
- light.living_room_color_3
|
|
- light.tina_lamp_side
|
|
- light.tina_lamp_top
|
|
- light.tina_desk_strip
|
|
- light.stairwell_led_strip
|
|
- delay:
|
|
seconds: 1
|
|
- service: switch.turn_off
|
|
target:
|
|
entity_id:
|
|
- switch.adaptive_lighting_living_room
|
|
- switch.adaptive_lighting_tina_lamp
|
|
- service: light.turn_on
|
|
target:
|
|
entity_id:
|
|
- light.living_room_lights
|
|
- light.tina_lamp
|
|
- light.tina_desk_strip
|
|
- light.stairwell_led_strip
|
|
data:
|
|
color_name: red
|
|
brightness_pct: 100
|
|
- service: script.status_annc
|
|
data:
|
|
who: common
|
|
call_interruption: 1
|
|
call_lockdown_issue: 1
|
|
- wait_template: "{{ is_state('binary_sensor.security_faults','off') or is_state('input_boolean.lockdown_issue','off') }}"
|
|
timeout:
|
|
minutes: 10
|
|
- service: input_boolean.turn_off
|
|
target:
|
|
entity_id: input_boolean.lockdown_issue
|
|
- delay:
|
|
seconds: 3
|
|
- if:
|
|
- condition: state
|
|
entity_id: binary_sensor.security_faults
|
|
state: 'off'
|
|
then:
|
|
- service: script.text_notify
|
|
data:
|
|
type: alert
|
|
who: all
|
|
message: clear_notification
|
|
tag: lockdown-issue
|
|
- service: persistent_notification.dismiss
|
|
data:
|
|
notification_id: lockdown_issue
|
|
- if:
|
|
- condition: state
|
|
entity_id: group.adults
|
|
state: 'not_home'
|
|
then:
|
|
- service: alarm_control_panel.alarm_arm_away
|
|
target:
|
|
entity_id: alarm_control_panel.nerdhome_alarm_panel
|
|
else:
|
|
- service: alarm_control_panel.alarm_arm_home
|
|
target:
|
|
entity_id: alarm_control_panel.nerdhome_alarm_panel
|
|
else:
|
|
- service: script.speech_engine
|
|
data:
|
|
who: common
|
|
message: 'I am unable to resolve the security issue, so I am giving up. Please report the issue to Tony if applicable.'
|
|
- service: scene.turn_on
|
|
target:
|
|
entity_id: scene.light_state_before_lockdown_issue
|
|
- delay:
|
|
seconds: 3
|
|
- service: switch.turn_on
|
|
target:
|
|
entity_id:
|
|
- switch.adaptive_lighting_living_room
|
|
- switch.adaptive_lighting_tina_lamp
|
|
|
|
- id: 027f6f05-289f-4f3d-925e-54d95226ea34
|
|
alias: Security Schedules Reset
|
|
trigger:
|
|
- platform: time
|
|
at: "00:00:00"
|
|
action:
|
|
- service: automation.turn_on
|
|
target:
|
|
entity_id:
|
|
- automation.scheduled_alarm_rearm
|
|
- automation.scheduled_alarm_disarm
|
|
- service: input_boolean.turn_off
|
|
target:
|
|
entity_id:
|
|
- input_boolean.skip_disarm
|
|
- input_boolean.skip_rearm
|
|
|
|
- id: ea52c580-dcf4-4eec-8d25-adda3b9e7cf4
|
|
alias: Alexa Guard Handling
|
|
description: Sync state of Alexa guard with state of main alarm system
|
|
mode: restart
|
|
trigger:
|
|
- platform: state
|
|
entity_id: alarm_control_panel.stratton_ave_alarm
|
|
to: 'armed_away'
|
|
id: away
|
|
- platform: state
|
|
entity_id: alarm_control_panel.stratton_ave_alarm
|
|
to: 'disarmed'
|
|
id: disarmed
|
|
condition:
|
|
- condition: state
|
|
entity_id: input_boolean.lockdown_issue
|
|
state: 'off'
|
|
action:
|
|
- choose:
|
|
- conditions:
|
|
- condition: trigger
|
|
id: away
|
|
sequence:
|
|
- service: alarm_control_panel.alarm_arm_away
|
|
target:
|
|
entity_id: alarm_control_panel.alexa_guard_9ee3b
|
|
- conditions:
|
|
- condition: trigger
|
|
id: disarmed
|
|
sequence:
|
|
- service: alarm_control_panel.alarm_disarm
|
|
target:
|
|
entity_id: alarm_control_panel.alexa_guard_9ee3b |