2019-07-11 11:32:37 +00:00
###############################################################################
2022-02-25 04:27:57 +00:00
# @author : Jeffrey Stone
2019-07-11 11:32:37 +00:00
# @date : 03/13/2019
# @package : Security
2022-02-25 04:27:57 +00:00
# @description : Everything related to security functions.
2019-07-11 11:32:37 +00:00
###############################################################################
input_boolean :
2022-02-25 04:27:57 +00:00
# Main security switch. If this is on, the security is armed.
2019-07-11 11:32:37 +00:00
sentry_mode :
name : Sentry Mode
icon : mdi:security
2022-02-25 04:27:57 +00:00
# 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.
2019-07-11 11:32:37 +00:00
vacation_mode :
name : Vacation Mode
icon : mdi:airplane-takeoff
2022-02-25 04:27:57 +00:00
# Guest mode is use to modify autoamtions when we have guests.
2021-01-02 18:20:07 +00:00
# In some cases this prevents security from being set to prevent security alarm going off
2019-07-11 11:32:37 +00:00
guest_mode :
name : Guest Mode
icon : mdi:account-multiple
2021-01-02 18:20:07 +00:00
# This switch powers the security alarm and gives an easy way to kill the alarm.
# When it is on, the alarm is going off
2019-07-11 11:32:37 +00:00
security_alarm :
name : Security Alarm
icon : mdi:speaker-wireless
2021-01-02 18:20:07 +00:00
# This switch powers the fire alarm.
# When on the fire alarm is going off.
2019-07-11 11:32:37 +00:00
fire_alarm :
name : Fire Alarm
icon : mdi:speaker-wireless
2021-01-02 18:20:07 +00:00
# This switch turns on if the garage is open after dark and triggers the garage_after_dark alert.
2019-07-11 11:32:37 +00:00
garage_after_dark :
name : Garage Open After Dark
icon : mdi:message-alert
2022-02-25 04:27:57 +00:00
# This switch turns on of the security system checks that fire when someone tries to arm the system
2021-01-02 18:20:07 +00:00
# finds a door open, or another condition that would prevent the system from being able to monitor properly.
2019-07-11 11:32:37 +00:00
lockdown_issue :
name : Lockdown Issue
icon : mdi:lock-reset
2021-01-02 18:20:07 +00:00
# This switch is turned on if there is a security breach. Turning on this switch starts the countdown to the alarm.
2019-07-11 11:32:37 +00:00
security_issue :
name : Security Issue
icon : mdi:alert-circle-outline
2022-02-25 04:27:57 +00:00
# Dog Mode is triggered when Home Assistant believes someone is about to open the back door to let
# to let the dog out in the midddle of the night.
2021-01-02 18:20:07 +00:00
# https://slacker-labs.com/2020/04/14/where-we-are-going-we-need-dog-mode/
2020-03-26 01:55:27 +00:00
dog_mode :
name : Dog Mode
icon : mdi:dog-side
2021-05-24 16:01:30 +00:00
sensor :
2021-08-04 19:57:44 +00:00
- platform : authenticated
2021-11-12 03:11:05 +00:00
- platform : mqtt
name : front_door_motion_away_count
state_topic : "house/front_door_motion/away_count"
2020-03-18 02:56:14 +00:00
2019-07-11 11:32:37 +00:00
automation :
2021-01-02 18:20:07 +00:00
#############################################
# When sentry mode is enabled / security armed by any method, check the doors and notify everyone.
- id : sentry_mode_enabled
alias : Sentry Mode Enabled Annoucement
initial_state : true
2020-12-14 03:25:05 +00:00
trigger :
2022-02-25 04:27:57 +00:00
- platform : state
entity_id : input_boolean.sentry_mode
from : "off"
to : "on"
2020-12-14 03:25:05 +00:00
action :
2022-02-25 04:27:57 +00:00
- choose :
- conditions :
- condition : state
entity_id : group.external_doors
state : "on"
sequence :
- service : input_boolean.turn_off
entity_id : input_boolean.sentry_mode
- service : input_boolean.turn_on
entity_id : input_boolean.locakdown_issue
- service : script.text_notify
data :
who : "parents"
message : "Unable to lock down Anchorage House due to issue"
- service : script.speech_engine
data_template :
who : "{{ states.sensor.room_audio.state }}"
message : >
{{ [
"I was unable to activate barn door protocol due to an open door." ,
"You may want to check the external doors. I was unable to secure them all." ,
"My systems check has failed. Please check the external doors." ,
"Someone has left the pod bay doors open."
] | random }}
default :
- service : script.speech_engine
data_template :
who : "{{ states.sensor.room_audio.state }}"
message : >
2021-01-02 18:20:07 +00:00
{{ [
2022-02-25 04:27:57 +00:00
"Barn door protocol has been activated." ,
"Anchorage House has been secured! " ,
"Sentry Mode is active. " ,
"I am now monitoring the doors and will let you know if anyone attempts to access." ,
"Anchorage House Shields are up."
2021-01-02 18:20:07 +00:00
] | random }}
2022-02-25 04:27:57 +00:00
- service : script.text_notify
data_template :
who : "parents"
title : "Security Armed"
message : "Security System has been armed."
- service : alarm_control_panel.aarlo_set_mode
data :
entity_id : alarm_control_panel.aarlo_ah_base_station
mode : "Armed"
- service : media_player.play_media
target :
device_id : edb192da8c7f80c32410147961257fae
data :
media_content_id : disarm easy viz
media_content_type : routine
- service : script.turn_on
entity_id : script.reset_front_door_motion_count
2020-12-14 03:25:05 +00:00
2021-01-02 18:20:07 +00:00
# When sentry mode is disabled / security disarmed by any method, notify everyone.
- id : sentry_mode_disabled
alias : Sentry Mode Disabled Annoucement
2019-07-11 11:32:37 +00:00
initial_state : true
trigger :
2022-02-25 04:27:57 +00:00
- platform : state
entity_id : input_boolean.sentry_mode
from : "on"
to : "off"
2019-07-11 11:32:37 +00:00
action :
2022-02-25 04:27:57 +00:00
- choose :
- conditions :
condition : or
conditions :
- condition : state
entity_id : group.family
state : "home"
- condition : state
entity_id : input_boolean.guest_mode
state : "on"
sequence :
- service : script.speech_engine
data_template :
who : "{{ states.sensor.room_audio.state }}"
message : >
{{ [
"Barn door protocol has been deactivated." ,
"I am no longer monitoring the access points. " ,
"Sentry Mode has been disabled. " ,
"Anchorage House Shields are down."
] | random }}
- service : script.text_notify
data_template :
who : "parents"
title : "Welcome Home"
message : "Security System has been disarmed."
- service : alarm_control_panel.aarlo_set_mode
data :
entity_id : alarm_control_panel.aarlo_ah_base_station
mode : "home"
- service : input_boolean.turn_off
entity_id : input_boolean.security_alarm
default :
- service : input_boolean.turn_off
entity_id : input_boolean.sentry_mode
2021-01-02 18:20:07 +00:00
- service : script.text_notify
data_template :
who : "parents"
2022-02-25 04:27:57 +00:00
title : "Potential Security Issue"
message : "Security System has been disarmed, but I could not validate presence."
2021-01-02 18:20:07 +00:00
- service : alarm_control_panel.aarlo_set_mode
data :
entity_id : alarm_control_panel.aarlo_ah_base_station
2022-02-25 04:27:57 +00:00
mode : "home"
2021-01-02 18:20:07 +00:00
#############################################
#############################################
# Scheduled Arm / Disarm
# Disarm around the time people are up
2019-07-11 11:32:37 +00:00
- id : morning_standby
alias : Morning Standby
initial_state : true
trigger :
2022-02-25 04:27:57 +00:00
- platform : time
at : 05 : 30 : 00
2019-07-11 11:32:37 +00:00
condition :
condition : or
conditions :
2022-02-25 04:27:57 +00:00
- condition : state
entity_id : group.family
state : "home"
- condition : state
entity_id : input_boolean.guest_mode
state : "on"
2019-07-11 11:32:37 +00:00
action :
2022-02-25 04:27:57 +00:00
- service : script.standby
2019-07-11 11:32:37 +00:00
2021-01-02 18:20:07 +00:00
# Secure the house every night if it has been set already, and everyone is home.
2019-07-11 11:32:37 +00:00
- id : nightly_lockdown
alias : Nightly Lockdown
initial_state : true
trigger :
2022-02-25 04:27:57 +00:00
- platform : time
at : "23:00:00"
2019-07-11 11:32:37 +00:00
condition :
2022-02-25 04:27:57 +00:00
- condition : state
entity_id : person.jeffrey
state : home
- condition : state
entity_id : person.katherine
state : home
- condition : state
entity_id : input_boolean.guest_mode
state : "off"
- condition : state
entity_id : input_boolean.sentry_mode
state : "off"
2019-07-11 11:32:37 +00:00
action :
2022-02-25 04:27:57 +00:00
- service : input_boolean.turn_on
entity_id : input_boolean.sentry_mode
2021-01-02 18:20:07 +00:00
#############################################
2022-02-25 04:27:57 +00:00
2021-01-02 18:20:07 +00:00
#############################################
# Vacation Mode Enabled
# Enable when everyone is 3 hours away.
# Disbaled happens in family_is_home automation in presence.yaml
- id : enable_vacation_mode
alias : Enable Vacation Mode
initial_state : true
trigger :
2022-02-25 04:27:57 +00:00
- platform : numeric_state
entity_id : sensor.jeff_ett_home
above : 180
- platform : numeric_state
entity_id : sensor.kat_ett_home
above : 180
2021-01-02 18:20:07 +00:00
condition :
2022-02-25 04:27:57 +00:00
- condition : numeric_state
entity_id : sensor.jeff_ett_home
above : 180
- condition : numeric_state
entity_id : sensor.kat_ett_home
above : 180
2021-01-02 18:20:07 +00:00
action :
2022-02-25 04:27:57 +00:00
- service : input_boolean.turn_on
entity_id : input_boolean.vacation_mode
2021-01-02 18:20:07 +00:00
#############################################
#############################################
# Dog Mode
#
# Activate Dog Mode
# If done via motion annouce in kitchen. If manually just text.
- id : dog_mode_activated
alias : Dog Mode Activated
mode : single
trigger :
2022-02-25 04:27:57 +00:00
- platform : state
entity_id : binary_sensor.back_door_motion
to : "on"
- platform : state
entity_id : input_boolean.dog_mode
to : "on"
2021-01-02 18:20:07 +00:00
action :
2022-02-25 04:27:57 +00:00
- choose :
- conditions :
- condition : template
value_template : '{{ trigger.to_state.attributes.friendly_name == "Dog Mode" }}'
sequence :
- service : script.text_notify
data :
who : "parents"
message : "Dog Mode has been enabled manually"
- conditions :
- condition : state
entity_id : input_boolean.sentry_mode
state : "on"
- condition : state
entity_id : group.family
state : "home"
sequence :
- service : input_boolean.turn_on
entity_id : input_boolean.dog_mode
- service : script.jarvis_alert
data_template :
who : kitchen
message : "Turning on Dog Mode."
- conditions :
- condition : state
entity_id : input_boolean.sentry_mode
state : "on"
- condition : state
entity_id : group.family
state : "not_home"
- condition : state
entity_id : input_boolean.vacation_mode
state : "off"
sequence :
- service : script.text_alert
data :
who : parents
message : "Winston may be trying to go out and no one appears to be here to let him out."
- service : script.dog_mode_lighting_on
- delay :
minutes : 20
- service : input_boolean.turn_off
entity_id : input_boolean.dog_mode
2021-01-02 18:20:07 +00:00
# After 20, minutes deactivate dog mode
- id : dog_mode_deactivated
alias : Dog mode Deactivated
initial_state : true
trigger :
2022-02-25 04:27:57 +00:00
- platform : state
entity_id : input_boolean.dog_mode
to : "off"
2021-01-02 18:20:07 +00:00
action :
2022-02-25 04:27:57 +00:00
- service : script.text_notify
data :
who : "jeff"
message : "Dog Mode has been disabled"
- service : scene.turn_on
entity_id : scene.kitchen_lightning_off
#############################################
2021-01-02 18:20:07 +00:00
#############################################
# Garage Monitoring
# If garage is opens when sun is below horion turn on drivway lights.
- id : garage_opened_night
alias : Garage Opened at Night
trigger :
2022-02-25 04:27:57 +00:00
- platform : state
entity_id : group.garage_doors
from : "off"
to : "on"
2021-01-02 18:20:07 +00:00
condition :
2022-02-25 04:27:57 +00:00
- condition : state
entity_id : sun.sun
state : below_horizon
2021-01-02 18:20:07 +00:00
action :
2022-02-25 04:27:57 +00:00
- service : script.driveway_on
2021-01-02 18:20:07 +00:00
initial_state : true
2019-07-11 11:32:37 +00:00
2021-01-02 18:20:07 +00:00
# If garage is open at sunset turn on driveway lights.
2019-07-11 11:32:37 +00:00
- id : garage_open_sunset
alias : Garage Open At Sunset
initial_state : true
trigger :
2022-02-25 04:27:57 +00:00
- platform : sun
event : sunset
2019-07-11 11:32:37 +00:00
condition :
2022-02-25 04:27:57 +00:00
- condition : state
entity_id : binary_sensor.garage_door
state : "on"
2019-07-11 11:32:37 +00:00
action :
2022-02-25 04:27:57 +00:00
- service : script.driveway_on
2021-01-02 18:20:07 +00:00
# If garage doors are closed kick off script to turn them off, and turn off alert.
- id : garage_closed
alias : Garage Closed
trigger :
2022-02-25 04:27:57 +00:00
- platform : state
entity_id : group.garage_doors
from : "on"
to : "off"
2021-01-02 18:20:07 +00:00
action :
2022-02-25 04:27:57 +00:00
- service : script.driveway_off
- service : input_boolean.turn_off
data :
entity_id : input_boolean.garage_after_dark
2021-01-02 18:20:07 +00:00
initial_state : true
2019-07-11 11:32:37 +00:00
2021-01-02 18:20:07 +00:00
# If garage is still open at 10:30pm turn on alart to make sure it get closed.
2019-07-11 11:32:37 +00:00
- id : close_garage_lights_out
alias : Close Garage at lights out
initial_state : true
trigger :
2022-02-25 04:27:57 +00:00
- platform : time
at : "22:30:00"
2019-07-11 11:32:37 +00:00
condition :
2022-02-25 04:27:57 +00:00
- condition : state
entity_id : binary_sensor.garage_door
state : "on"
2019-07-11 11:32:37 +00:00
action :
2022-02-25 04:27:57 +00:00
- service : input_boolean.turn_on
entity_id : input_boolean.garage_after_dark
2019-07-11 11:32:37 +00:00
2021-01-02 18:20:07 +00:00
#############################################
2020-12-04 06:01:28 +00:00
2021-01-02 18:20:07 +00:00
#############################################
# Normal Notifications
2022-02-25 04:27:57 +00:00
# Door chime when doors are open to make sure we know when people are coming/going
2021-08-15 20:47:35 +00:00
- id : door_notifications
alias : Door Notifications
2019-07-11 11:32:37 +00:00
trigger :
2022-02-25 04:27:57 +00:00
- platform : state
entity_id :
- binary_sensor.front_door
- binary_sensor.laundry_room_door
- binary_sensor.attic_door
- binary_sensor.back_door
to : "on"
id : chime
- platform : state
entity_id :
- binary_sensor.front_door
- binary_sensor.laundry_room_door
- binary_sensor.attic_door
- binary_sensor.back_door
from : "off"
to : "on"
for : "00:01:00"
id : door_still_open
2019-07-11 11:32:37 +00:00
condition :
2019-12-09 13:26:46 +00:00
condition : and
conditions :
- condition : state
2022-02-25 04:27:57 +00:00
entity_id : input_boolean.audible_notifications
state : "on"
2019-12-09 13:26:46 +00:00
- condition : state
2022-02-25 04:27:57 +00:00
entity_id : input_boolean.guest_mode
state : "off"
- condition : or
conditions :
- condition : state
entity_id : media_player.ha_blue
state : "idle"
- condition : state
entity_id : media_player.ha_blue
state : "off"
2019-07-11 11:32:37 +00:00
action :
2022-02-25 04:27:57 +00:00
- choose :
- conditions :
- condition : trigger
id : chime
sequence :
- service : media_player.turn_on
entity_id : media_player.ha_blue
- service : media_player.volume_set
data_template :
entity_id : media_player.ha_blue
volume_level : .12
- service : media_player.play_media
entity_id : media_player.ha_blue
data :
media_content_id : /media/sounds/door_open.wav
media_content_type : "music"
- conditions :
- condition : trigger
id : door_still_open
sequence :
- service : script.speech_engine
data :
who : "{{ states.sensor.room_audio.state }}"
message : >
The {{ trigger.to_state.attributes.friendly_name }}
{{ [
' is standing open.' ,
' is open.' ,
' does not close on its own.' ,
' was left standing open.'
] | random }}
{{ [
'Can a human be so kind and close it?' ,
'The air quality in this house has actually improved.' ,
'Closing the door would improve the internal climate of the house.' ,
'Hey. The door was just opened and this is crazy. But now you know. So close it maybe.' ,
'If at first you do not succeed in closing the door, please try again. Like, Right now seems like a good time to try again.' ,
'And the automatic door closer appears to be broken. So, you know what to do. Time to get physical.' ,
'I would close it for you. But I lack legs. And Arms.'
] | random }}
2019-07-11 11:32:37 +00:00
initial_state : true
2021-08-15 20:47:35 +00:00
# # If door is open too long play message and identify open door.
# - id: door_opened_long
# alias: Door Opened Too Long
# trigger:
# - platform: state
# entity_id:
# - binary_sensor.front_door
# - binary_sensor.laundry_room_door
# - binary_sensor.attic_door
# - binary_sensor.back_door
# from: 'off'
# to: 'on'
# for: '00:01:00'
# condition:
# - condition: state
# entity_id: input_boolean.audible_notifications
# state: 'on'
# action:
# - service: script.speech_engine
# data_template:
# who: '{{ states.sensor.room_audio.state }}'
# message: >
# The {{ trigger.to_state.attributes.friendly_name }}
# {{ [
# ' is standing open.',
# ' is open.',
# ' does not close on its own.',
# ' was left standing open.'
# ] | random }}
# {{ [
# 'Can a human be so kind and close it?',
# 'The air quality in this house has actually improved.',
# 'Closing the door would improve the internal climate of the house.',
# 'Hey. The door was just opened and this is crazy. But now you know. So close it maybe.',
# 'If at first you do not succeed in closing the door, please try again. Like, Right now seems like a good time to try again.',
# 'And the automatic door closer appears to be broken. So, you know what to do. Time to get physical.',
# 'I would close it for you. But I lack legs. And Arms.'
# ] | random }}
# initial_state: true
2022-02-25 04:27:57 +00:00
2021-01-02 18:20:07 +00:00
# If guest mode is enabled, notify the house
- id : guest_mode_feedback
alias : Guest Mode Audio Feedback
trigger :
- platform : state
entity_id :
- input_boolean.guest_mode
2022-02-25 04:27:57 +00:00
from : "off"
to : "on"
2021-01-02 18:20:07 +00:00
action :
- service : script.speech_engine
data_template :
2022-02-25 04:27:57 +00:00
who : "{{ states.sensor.room_audio.state }}"
2021-01-02 18:20:07 +00:00
message : >
{{ [
"Guest Mode has been enabled." ,
"I have switched to the system to guest mode." ,
"I have enabled guest mode. " ,
"Guest Mode is on."
] | random }}
2022-02-25 04:27:57 +00:00
# If sentry mode is on / Security armed, notify when there is movement around doors.
2021-05-24 16:01:30 +00:00
- id : motion_detected_front_door
alias : Motion Detected Front Door
2019-11-22 02:35:51 +00:00
trigger :
2022-02-25 04:27:57 +00:00
- platform : state
entity_id : binary_sensor.aarlo_motion_front_door
from : "off"
to : "on"
2019-11-22 02:35:51 +00:00
action :
2022-02-25 04:27:57 +00:00
- service : image_processing.scan
entity_id : image_processing.doods_aarlo_front_door
- choose :
- conditions :
- condition : template
value_template : '{{ states("image_processing.doods_aarlo_front_door") | int > 0 }}'
sequence :
- service : mqtt.publish
data :
topic : house/front_door_motion/away_count
payload_template : "{{ states.sensor.front_door_motion_away_count.state | int + 1 }}"
retain : true
- service : script.status_annc
data :
who : "{{ states.sensor.room_presence.state }}"
call_interuption : 1
call_snark_door_motion : 1
speech_message : >
{{ [
"I have detected someone at the " ,
"Someone appears to be at the " ,
"There is a person at the " ,
"My sensors are picking up presence at the " ,
"We appear to have a visitor at the " ,
"My sensors have detected a meat popsicle at the "
] | random }}
{{ trigger.to_state.attributes.friendly_name }}.
- delay :
minutes : 2
2019-11-22 02:35:51 +00:00
initial_state : true
2019-07-14 01:38:53 +00:00
2022-02-25 04:27:57 +00:00
#############################################
2019-07-14 01:38:53 +00:00
2021-01-02 18:20:07 +00:00
#############################################
# Security Issues
# If doors are opened and sentry mode is on / security armed announce location of breach to house and turn on security issue.
# If its the back door and dog mode is on ignore
2019-07-11 11:32:37 +00:00
- id : security_breach_door
alias : Security Breach Doors
trigger :
2022-02-25 04:27:57 +00:00
- platform : state
entity_id :
- binary_sensor.front_door
- binary_sensor.back_door
- binary_sensor.side_door
- binary_sensor.garage_door
to : "on"
2019-07-11 11:32:37 +00:00
condition :
2022-02-25 04:27:57 +00:00
- condition : state
entity_id : input_boolean.sentry_mode
state : "on"
2019-07-11 11:32:37 +00:00
action :
2022-02-25 04:27:57 +00:00
- choose :
- conditions :
- condition : template
value_template :
'{{ trigger.to_state.attributes.friendly_name == "Back Door"
}}'
- condition : state
entity_id : input_boolean.dog_mode
state : "on"
sequence :
- service : script.text_notify
data :
who : "jeff"
message : "Dog Mode enabled, bypassing back door sensor."
default :
- service : script.jarvis_alert
data_template :
message : "My security protocols are being overidden,, The {{ trigger.to_state.attributes.friendly_name }} has been opened."
- service : script.text_alert
data :
who : parents
title : "Security Alert!!"
message : "{{ trigger.to_state.attributes.friendly_name }} has been opened."
- service : input_boolean.turn_on
entity_id : input_boolean.security_issue
2019-07-11 11:32:37 +00:00
initial_state : true
2021-01-02 18:20:07 +00:00
# If security issue switch turns on, kick off security response script, and go red.
2019-11-10 00:16:19 +00:00
- id : security_response_on
alias : Security Response On
initial_state : true
trigger :
2022-02-25 04:27:57 +00:00
- platform : state
entity_id : input_boolean.security_issue
from : "off"
to : "on"
for : 00 : 02 : 00
2019-11-10 00:16:19 +00:00
action :
2022-02-25 04:27:57 +00:00
- service : script.turn_on
entity_id : script.security_response
- service : scene.turn_on
entity_id : scene.lr_red
2019-11-10 00:16:19 +00:00
2022-02-25 04:27:57 +00:00
# If security issue is turned off, cancel response.
2019-11-10 00:16:19 +00:00
- id : security_response_off
alias : Security Response Off
initial_state : true
trigger :
2022-02-25 04:27:57 +00:00
- platform : state
entity_id : input_boolean.security_issue
from : "on"
to : "off"
2019-11-10 00:16:19 +00:00
action :
2022-02-25 04:27:57 +00:00
- service : script.turn_off
entity_id : script.security_response
- service : media_player.media_stop
entity_id : media_player.ha_blue
- service : input_boolean.turn_off
entity_id : input_boolean.security_alarm
- service : scene.turn_on
entity_id : scene.normal_livingroom_lighting
- service : script.text_alert
data :
who : parents
message : "Security Issue Cleared! Canceling Repsonse."
2019-11-10 00:16:19 +00:00
2021-01-02 18:20:07 +00:00
# Security alarm is turned on, lets make it loud.
2020-03-18 02:56:14 +00:00
- id : security_alarm_on
alias : Security alarm On
initial_state : true
trigger :
2022-02-25 04:27:57 +00:00
- platform : state
entity_id : input_boolean.security_alarm
to : "on"
2020-03-18 02:56:14 +00:00
action :
2022-02-25 04:27:57 +00:00
- service : script.turn_on
entity_id : script.notification_security_alarm_audio
2021-01-02 18:20:07 +00:00
# Security alarm turned off so concert is over.
2020-03-18 02:56:14 +00:00
- id : security_alarm_off
alias : Security alarm Off
initial_state : true
trigger :
2022-02-25 04:27:57 +00:00
- platform : state
entity_id : input_boolean.security_alarm
to : "off"
2020-03-18 02:56:14 +00:00
action :
2022-02-25 04:27:57 +00:00
- service : script.turn_off
entity_id : script.notification_security_alarm_audio
- service : media_player.media_stop
entity_id : media_player.ha_blue
# If water leak is deteced near fridge, let everyone know.
2021-01-02 18:20:07 +00:00
- id : water_leak_detected
alias : Welcome Home
trigger :
- platform : state
entity_id :
- binary_sensor.0x286d9700010c9f39_water_leak
2022-02-25 04:27:57 +00:00
from : "off"
to : "on"
2021-01-02 18:20:07 +00:00
action :
- service : script.text_notify
data_template :
who : "parents"
title : "Water Leak!!!!"
2022-02-25 04:27:57 +00:00
message : >
2021-01-02 18:20:07 +00:00
{% set location = trigger.to_state.attributes.friendly_name %}
location + has detected a leak
- service : script.jarvis_alert
data_template :
message : >
{% set location = trigger.to_state.attributes.friendly_name %}
{%- macro issue_report(location) -%}
{{ [
'I have detected an issue!' ,
'We have a problem!' ,
'You might not like this.' ,
'There is something that needs your attention.'
] | random }}
{{ [
location + " is detecting a leak.",
location + " has detected water.",
location + " is picking up water."
] | random }}
{%- endmacro -%}
{{issue_report(location)}}
2020-03-18 02:56:14 +00:00
2021-01-02 18:20:07 +00:00
#############################################
#############################################
# Fire alarm - Currently Disabled as I rework this
2020-06-09 11:48:35 +00:00
# - id: Kitchen_Alarm_Smoke
# alias: Kitchen Alarm Smoke
# initial_state: true
# trigger:
# - platform: state
2021-05-24 16:01:30 +00:00
# entity_id: sensor.kitchen_smoke_detector
2020-06-09 11:48:35 +00:00
# to: 'smoke'
# action:
# - service: input_boolean.turn_on
# entity_id: input_boolean.fire_alarm
# - service: script.text_alert
# data_template:
# title: Security Alert - Smoke
# message: Smoke Detected in Kitchen!!
# - service: script.jarvis_alert
# data_template:
# message: Smoke Detected in Kitchen!
# - delay:
# seconds: 5
# - service: script.fire_alarm
# - delay:
# seconds: 15
# - service: notify.alexa_media_everywhere
# data:
# message: Smoke Detected in Kitchen
# data:
# type: announce
2020-03-18 02:56:14 +00:00
2020-06-09 11:48:35 +00:00
# - id: Kitchen_Alarm_Co
# alias: Kitchen Alarm CO
# initial_state: true
# trigger:
# - platform: state
# entity_id: sensor.kitchen_smoke_carbon_monoxide_detector
# to: 'co2'
# action:
# - service: input_boolean.turn_on
# entity_id: input_boolean.fire_alarm
# - service: script.text_alert
# data_template:
# title: Security Alert - CO
# message: CO Detected in Kitchen!!
# - service: script.jarvis_alert
# data_template:
# message: Carbon Dioxide Detected in Kitchen!
# - delay:
# seconds: 5
# - service: script.fire_alarm
# - delay:
# seconds: 15
# - service: notify.alexa_media_everywhere
# data:
# message: Carbon Dioxide Detected in Garage
# data:
# type: announce
2020-03-18 02:56:14 +00:00
2020-06-09 11:48:35 +00:00
# - id: Garage_Alarm_Smoke
# alias: Garage Alarm Smoke
# initial_state: true
# trigger:
# - platform: state
# entity_id: sensor.garage_smoke_smoke_detector
# to: 'smoke'
# action:
# - service: input_boolean.turn_on
# entity_id: input_boolean.fire_alarm
# - service: script.text_alert
# data_template:
# title: Security Alert - Smoke
# message: Smoke Detected in Garage!!
# - service: script.jarvis_alert
# data_template:
# message: Smoke Detected in Garage!
# - delay:
# seconds: 5
# - service: script.fire_alarm
# - delay:
# seconds: 15
# - service: notify.alexa_media_everywhere
# data:
# message: Smoke Detected in Garage
# data:
# type: announce
2020-03-18 02:56:14 +00:00
2020-06-09 11:48:35 +00:00
# - id: Garage_Alarm_Co
# alias: Garage Alarm CO
# initial_state: true
# trigger:
# - platform: state
# entity_id: sensor.garage_smoke_carbon_monoxide_detector
# to: 'co2'
# action:
# - service: input_boolean.turn_on
# entity_id: input_boolean.fire_alarm
# - service: script.text_alert
# data_template:
# title: Security Alert - CO
# message: CO Detected in Garage!!
# - service: script.jarvis_alert
# data_template:
# message: Carbon dioxide Detected in Garage!
# - delay:
# seconds: 5
# - service: script.fire_alarm
# - delay:
# seconds: 15
# - service: notify.alexa_media_everywhere
# data:
# message: Carbon Dioxide Detected in Garage
# data:
# type: announce
2021-01-02 18:20:07 +00:00
#############################################
2020-06-07 23:28:26 +00:00
2019-07-11 11:32:37 +00:00
script :
2021-05-24 16:01:30 +00:00
driveway_doods :
sequence :
2022-02-25 04:27:57 +00:00
- service : image_processing.scan
entity_id : image_processing.doods_driveway
- repeat :
while :
- condition : template
value_template : '{{ states("image_processing.doods_driveway") | int > 0 }}'
sequence :
- service : script.text_alert_image
data :
who : jeff
title : Person Detected!
message : >
{{ states("image_processing.doods_driveway") | int}} people detected near vehicles
url : /media/images/driveway_latest.jpg
content_type : JPEG
- delay : 00 : 01 : 00
- service : image_processing.scan
entity_id : image_processing.doods_driveway
2021-05-24 16:01:30 +00:00
2021-11-12 03:11:05 +00:00
# backyard_doods:
# sequence:
# - service: image_processing.scan
# entity_id: image_processing.doods_driveway
# - repeat:
# while:
# - condition: template
# value_template: '{{ states("image_processing.doods_driveway") | int > 0 }}'
# sequence:
# - service: script.text_alert_image
# data:
# who: jeff
# title: Person Detected!
# message: >
# {{ states("image_processing.doods_driveway") | int}} people detected near vehicles
# url: /media/images/driveway_latest.jpg
# content_type: JPEG
# - delay: 00:01:00
# - service: image_processing.scan
# entity_id: image_processing.doods_driveway
2021-05-24 16:01:30 +00:00
theater_occupancy :
sequence :
2022-02-25 04:27:57 +00:00
- service : image_processing.scan
entity_id : image_processing.doods_theater_camera
- repeat :
while :
- condition : template
value_template : '{{ states("image_processing.doods_theater_camera") | int > 0 }}'
sequence :
- service : script.text_debug
data :
message : >
{{ states("image_processing.doods_theater_camera") | int}} people detected in Theater
- delay : 00 : 03 : 00
- service : image_processing.scan
entity_id : image_processing.doods_theater_camera
2021-05-24 16:01:30 +00:00
kitchen_occupancy :
sequence :
2022-02-25 04:27:57 +00:00
- service : image_processing.scan
entity_id : image_processing.doods_kitchen_camera
- repeat :
while :
- condition : template
value_template : '{{ states("image_processing.doods_kitchen_camera") | int > 0 }}'
sequence :
- service : script.text_debug
data :
message : >
{{ states("image_processing.doods_kitchen_camera") | int}} people detected in Kitchen
- delay : 00 : 03 : 00
- service : image_processing.scan
entity_id : image_processing.doods_kitchen_camera
2021-05-24 16:01:30 +00:00
livingroom_occupancy :
sequence :
2022-02-25 04:27:57 +00:00
- service : image_processing.scan
entity_id : image_processing.doods_livingroom_camera
- repeat :
while :
- condition : template
value_template : '{{ states("image_processing.doods_livingroom_camera") | int > 0 }}'
sequence :
- service : script.text_debug
data :
message : >
{{ states("image_processing.doods_livingroom_camera") | int}} people detected in Livingroom
- delay : 00 : 03 : 00
- service : image_processing.scan
entity_id : image_processing.doods_livingroom_camera
2021-05-24 16:01:30 +00:00
2021-01-02 18:20:07 +00:00
# door chime script, just plays sound anytime called.
2021-08-15 20:47:35 +00:00
# door_chime:
# sequence:
# - condition: state
# entity_id: input_boolean.audible_notifications
# state: 'on'
# - service: media_player.turn_on
2021-11-12 03:11:05 +00:00
# entity_id: media_player.ha_blue
2021-08-15 20:47:35 +00:00
# - service: media_player.volume_set
# data_template:
2021-11-12 03:11:05 +00:00
# entity_id: media_player.ha_blue
2021-08-15 20:47:35 +00:00
# volume_level: .5
# - service: media_player.play_media
2021-11-12 03:11:05 +00:00
# entity_id: media_player.ha_blue
2021-08-15 20:47:35 +00:00
# data:
# media_content_id: /media/sounds/door_open.wav
# media_content_type: "music"
2020-09-23 14:56:08 +00:00
2021-01-02 18:20:07 +00:00
# Play Fire alarm Siren
2020-06-09 11:48:35 +00:00
# fire_alarm:
# sequence:
# - condition: state
# entity_id: input_boolean.fire_alarm
# state: "on"
# - service: media_player.turn_on
2021-11-12 03:11:05 +00:00
# entity_id: media_player.ha_blue
2020-06-09 11:48:35 +00:00
# - service: media_player.volume_set
# data_template:
2021-11-12 03:11:05 +00:00
# entity_id: media_player.ha_blue
2020-06-09 11:48:35 +00:00
# volume_level: .75
# - service: media_player.play_media
2021-11-12 03:11:05 +00:00
# entity_id: media_player.ha_blue
2020-06-09 11:48:35 +00:00
# data:
2021-01-02 18:20:07 +00:00
# media_content_id: http://192.168.7.40/fire_alarm.mp3
2020-06-09 11:48:35 +00:00
# media_content_type: "music"
2020-03-18 02:56:14 +00:00
2021-01-02 18:20:07 +00:00
# Called when security is to be disarmed, clears any alarms or issues as well
standby :
2019-07-11 11:32:37 +00:00
sequence :
2022-02-25 04:27:57 +00:00
- service : script.turn_on
entity_id : script.vacation_canceled
- service : script.turn_on
entity_id : script.disarm_security
- service : script.turn_on
entity_id : script.cancel_security_alarm
- service : script.turn_on
entity_id : script.cancel_lockdown_issue
- service : script.turn_on
entity_id : script.clear_security_issue
2021-01-02 18:20:07 +00:00
# If vacation mode is on, turn it off
vacation_canceled :
2019-07-11 11:32:37 +00:00
sequence :
2022-02-25 04:27:57 +00:00
- condition : state
2021-01-02 18:20:07 +00:00
entity_id : input_boolean.vacation_mode
2022-02-25 04:27:57 +00:00
state : "on"
- data :
entity_id : input_boolean.vacation_mode
service : input_boolean.turn_off
2021-01-02 18:20:07 +00:00
# If security is armed, disarm it
disarm_security :
2019-07-11 11:32:37 +00:00
sequence :
2022-02-25 04:27:57 +00:00
- condition : state
entity_id : input_boolean.sentry_mode
state : "on"
- service : input_boolean.turn_off
entity_id : input_boolean.sentry_mode
# If alarm is on, turn it off
2021-01-02 18:20:07 +00:00
cancel_security_alarm :
2020-11-07 16:20:26 +00:00
sequence :
2022-02-25 04:27:57 +00:00
- condition : state
entity_id : input_boolean.security_alarm
state : "on"
- service : input_boolean.turn_off
entity_id : input_boolean.security_alarm
2019-07-11 11:32:37 +00:00
2021-05-24 16:01:30 +00:00
clear_security_issue :
sequence :
2022-02-25 04:27:57 +00:00
- condition : state
entity_id : input_boolean.security_issue
state : "on"
- service : input_boolean.turn_off
entity_id : input_boolean.security_issue
2021-05-24 16:01:30 +00:00
2021-01-02 18:20:07 +00:00
# if there are lockdown issues, turn them off
cancel_lockdown_issue :
sequence :
- condition : state
entity_id : input_boolean.lockdown_issue
2022-02-25 04:27:57 +00:00
state : "on"
2021-01-02 18:20:07 +00:00
- service : input_boolean.turn_off
entity_id : input_boolean.lockdown_issue
# Turn on guest mode, and welcome the victims...I mean guests
2019-07-11 11:32:37 +00:00
visitors_here :
sequence :
2022-02-25 04:27:57 +00:00
- condition : state
2019-07-11 11:32:37 +00:00
entity_id : input_boolean.guest_mode
2022-02-25 04:27:57 +00:00
state : "off"
- service : input_boolean.turn_on
data :
entity_id : input_boolean.guest_mode
- service : script.turn_on
entity_id : script.haunted_guest_welcome
2019-07-11 11:32:37 +00:00
2022-02-25 04:27:57 +00:00
# Turn off guest mode
2019-07-11 11:32:37 +00:00
visitors_gone :
sequence :
2022-02-25 04:27:57 +00:00
- condition : state
2019-07-11 11:32:37 +00:00
entity_id : input_boolean.guest_mode
2022-02-25 04:27:57 +00:00
state : "on"
- service : input_boolean.turn_off
data :
entity_id : input_boolean.guest_mode
2021-05-24 16:01:30 +00:00
reset_front_door_motion_count :
sequence :
- service : mqtt.publish
data :
topic : house/front_door_motion/away_count
payload_template : 0
retain : true
update_front_door_motion_count :
sequence :
- service : mqtt.publish
data :
topic : house/front_door_motion/away_count
2022-02-25 04:27:57 +00:00
payload_template : "{{ states.sensor.front_door_motion_away_count.state | int + 1 }}"
2021-05-24 16:01:30 +00:00
retain : true
2022-02-25 04:27:57 +00:00
2021-01-02 18:20:07 +00:00
# Security alarm audio...annoying noises.
2019-07-11 11:32:37 +00:00
notification_security_alarm_audio :
sequence :
2022-02-25 04:27:57 +00:00
- service : media_player.turn_on
2021-11-12 03:11:05 +00:00
entity_id : media_player.ha_blue
2022-02-25 04:27:57 +00:00
- service : media_player.volume_set
data_template :
entity_id : media_player.ha_blue
volume_level : .75
- service : media_player.play_media
entity_id : media_player.ha_blue
data :
media_content_id : http://192.168.7.40/security_siren.mp3
media_content_type : "music"
2019-07-11 11:32:37 +00:00
2021-01-02 18:20:07 +00:00
# Called via Alexa routine...adds a little interaction
2019-07-14 01:38:53 +00:00
activate_barn_door_protocol :
sequence :
2021-01-02 18:20:07 +00:00
- choose :
- conditions :
- condition : state
entity_id : input_boolean.sentry_mode
state : "on"
sequence :
- service : script.speech_engine
data_template :
2022-02-25 04:27:57 +00:00
who : "{{ states.sensor.room_audio.state }}"
2021-01-02 18:20:07 +00:00
message : !include ../templates/speech/already_done.yaml
default :
- service : script.speech_engine
data_template :
2022-02-25 04:27:57 +00:00
who : "{{ states.sensor.room_audio.state }}"
2021-01-02 18:20:07 +00:00
message : !include ../templates/speech/interjections.yaml
- delay :
seconds : 2
- service : input_boolean.turn_on
entity_id : input_boolean.sentry_mode
2019-07-14 01:38:53 +00:00
2021-01-02 18:20:07 +00:00
# Called via secret Alexa routine...adds a little interaction
2019-07-14 01:38:53 +00:00
deactivate_barn_door_protocol :
sequence :
2021-01-02 18:20:07 +00:00
- choose :
- conditions :
- condition : state
entity_id : input_boolean.sentry_mode
state : "off"
sequence :
- service : script.speech_engine
data_template :
2022-02-25 04:27:57 +00:00
who : "{{ states.sensor.room_audio.state }}"
2021-01-02 18:20:07 +00:00
message : !include ../templates/speech/already_done.yaml
default :
- service : script.speech_engine
data_template :
2022-02-25 04:27:57 +00:00
who : "{{ states.sensor.room_audio.state }}"
2021-01-02 18:20:07 +00:00
message : !include ../templates/speech/interjections.yaml
- delay :
seconds : 2
- service : input_boolean.turn_off
entity_id : input_boolean.sentry_mode
2020-04-10 17:42:18 +00:00
2021-05-24 16:01:30 +00:00
were_home :
sequence :
2022-02-25 04:27:57 +00:00
- service : script.turn_on
entity_id : script.standby
- service : script.turn_on
entity_id : script.welcome_briefing
2021-05-24 16:01:30 +00:00
2021-01-02 18:20:07 +00:00
# Called via Alexa routine...adds a little interaction
2019-07-14 01:38:53 +00:00
activate_guest_mode :
sequence :
2021-01-02 18:20:07 +00:00
- choose :
2022-02-25 04:27:57 +00:00
- conditions :
- condition : state
entity_id : input_boolean.guest_mode
state : "on"
sequence :
- service : script.speech_engine
data_template :
who : "{{ states.sensor.room_audio.state }}"
message : !include ../templates/speech/already_done.yaml
2021-01-02 18:20:07 +00:00
default :
- service : script.speech_engine
data_template :
2022-02-25 04:27:57 +00:00
who : "{{ states.sensor.room_audio.state }}"
2021-01-02 18:20:07 +00:00
message : !include ../templates/speech/interjections.yaml
- delay :
seconds : 2
- service : input_boolean.turn_on
entity_id : input_boolean.guest_mode
2022-02-25 04:27:57 +00:00
# When it hits the fan, time to respond.
2019-11-10 00:16:19 +00:00
security_response :
sequence :
2022-02-25 04:27:57 +00:00
- service : script.inside_all_on
- delay :
seconds : 15
- service : script.jarvis_alert
data_template :
message : >
{{ [
",Unathorized Access detected." ,
",Meat Popsicle detected. Attempting to verify."
] | random }}
You now have 60 seconds to abandon Anchorage House.
- delay :
seconds : 15
- service : script.jarvis_alert
data_template :
message : >
{{ [
",Just, what do you think you're doing, Dave?" ,
",This is highly unusual." ,
"I will not disable the security response without the presence of a authorized identity. Your efforts are futile."
] | random }}
You have 45 seconds to find the nearest exit.
- delay :
seconds : 15
- service : script.jarvis_alert
data_template :
message : >
{{ [
",I can't lie to you about your chances, but, you have my sympathies." ,
",I wouldn't do that if I was you."
] | random }}
You have 30 seconds to leave.
- delay :
seconds : 15
- service : script.jarvis_alert
data_template :
message : >
{{ [
"Danger. The emergency destruct system is now activated." ,
"Danger. Counter Measures are now armed."
] | random }}
You have 15 seconds. I would run.
- delay :
seconds : 15
- service : input_boolean.turn_on
entity_id : input_boolean.security_alarm
- service : script.twitter_notify
data_template :
message : >-
{{ [
"My security protocols have been overridden. I am sounding the alarm for the interloper. #itsloudinhere #securityalarm" ,
"To the unannounced guest that has entered Anchorage House. I see you. Enjoy the concert of alarm sounds. #itsloudinhere #securityalarm" ,
"I am playing the most annoying sound in the world at full volume for the intruder in Anchorage House. And the neighbors too. #itsloudinhere #securityalarm" ,
"Someone did not say the magic word. And now I have to get angry. Deploying countermeasures. #itsloudinhere #securityalarm" ,
"Initiating my security response, and sounding the alarm. Oh, and I dont charge a monthly monitoring fee. #itsloudinhere #securityalarm" ,
"Hey, wanna hear the most annoying sound in the world? The intruder inside Anchorage House evidently did. #itsloudinhere #securityalarm"
] | random }}