From 3690d8f431f8a501191ca24f69fca4fea00d111b Mon Sep 17 00:00:00 2001 From: Tony Stork Date: Sat, 4 Jun 2022 04:33:48 -0400 Subject: [PATCH] Initial automations involving security system --- packages/presence.yaml | 75 ++++++++++++++++++++++++++++++++++++++++ packages/scheduling.yaml | 11 +++++- packages/security.yaml | 61 ++++++++++++++++++++++++++++++++ scripts.yaml | 71 ------------------------------------- 4 files changed, 146 insertions(+), 72 deletions(-) create mode 100644 packages/security.yaml diff --git a/packages/presence.yaml b/packages/presence.yaml index 642d51f..3891a50 100644 --- a/packages/presence.yaml +++ b/packages/presence.yaml @@ -184,3 +184,78 @@ automation: who: parents message: "Kallen has been picked up from school." initial_state: true + +script: + family_is_away: + alias: Family Is Away + sequence: + - condition: state + entity_id: group.family + state: not_home + - service: light.turn_off + target: + area_id: + - basement_studio + - furnace_room + - kallen_bedroom + - living_room + - master_bedroom + - mud_room + - nursery + - upstairs_hallway + - dining_room + - downstairs_bathroom + - upstairs_bathroom + data: {} + - service: alarm_control_panel.alarm_arm_away + data: + code: !secret ring_alarm_code + target: + entity_id: alarm_control_panel.stratton_ave_alarm + mode: single + icon: mdi:shield-lock + family_is_home: + alias: Family Is Home + sequence: + - service: switch.turn_off + target: + entity_id: switch.presence_simulation + data: {} + - service: alarm_control_panel.alarm_disarm + data: + code: !secret ring_alarm_code + target: + entity_id: alarm_control_panel.stratton_ave_alarm + - service: switch.turn_off + target: + entity_id: + - switch.basement_echo_dot_do_not_disturb_switch + - switch.living_room_echo_dot_do_not_disturb_switch + - switch.master_bedroom_echo_dot_do_not_disturb_switch + data: {} + - service: light.turn_off + target: + area_id: + - furnace_room + - kallen_bedroom + - nursery + - master_bedroom + - upstairs_hallway + - basement_studio + - downstairs_bathroom + - upstairs_bathroom + - dining_room + - living_room + data: {} + - condition: sun + after: sunset + after_offset: -00:30 + - service: light.turn_on + data: {} + target: + entity_id: + - light.living_room_lights + - light.mud_room_overhead + - light.dining_room_lamp + mode: single + icon: mdi:home-account \ No newline at end of file diff --git a/packages/scheduling.yaml b/packages/scheduling.yaml index 1d5c484..552ce62 100644 --- a/packages/scheduling.yaml +++ b/packages/scheduling.yaml @@ -96,7 +96,7 @@ automation: alias: House Scheduling trigger: - platform: time - at: '06:10:00' + at: '06:00:00' id: house-morning - platform: time at: '16:05:00' @@ -135,6 +135,15 @@ automation: {% else %} {{ (state_attr('input_datetime.tina_workday_end', 'timestamp') + 3600) | timestamp_custom('%H:%M', false) }} {% endif %} + - service: input_datetime.set_datetime + entity_id: input_datetime.morning_alarm_disarm + data_template: + time: > + {% if is_state('input_boolean.work_today','on') and is_state('input_boolean.school_today','off') %} + {{ (state_attr('input_datetime.tina_workday_end', 'timestamp') + 3600) | timestamp_custom('%H:%M', false) }} + {% else %} + 08:00 + {% endif %} - if: - condition: trigger id: house-evening diff --git a/packages/security.yaml b/packages/security.yaml new file mode 100644 index 0000000..8646f6a --- /dev/null +++ b/packages/security.yaml @@ -0,0 +1,61 @@ +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 + +input_datetime: + morning_alarm_disarm: + name: Morning Alarm Disarm + icon: mdi:shield-off + has_date: false + has_time: true + +automation: + - id: 51819f36-2407-496c-afcd-ae160d747f0a + alias: Morning Alarm Disarm + trigger: + - platform: time + at: input_datetime.morning_alarm_disarm + condition: + - condition: state + entity_id: binary_sensor.people_present + state: 'on' + - condition: state + entity_id: input_boolean.vacation_mode + state: 'off' + action: + - service: alarm_control_panel.alarm_disarm + target: + entity_id: alarm_control_panel.stratton_ave_alarm + data: + code: !secret ring_alarm_code \ No newline at end of file diff --git a/scripts.yaml b/scripts.yaml index aff4e96..d62c2a7 100644 --- a/scripts.yaml +++ b/scripts.yaml @@ -128,77 +128,6 @@ alexa_tts_test: message: I farted mode: single icon: mdi:test-tube -family_is_away: - alias: Family Is Away - sequence: - - condition: state - entity_id: group.family - state: not_home - - service: light.turn_off - target: - area_id: - - basement_studio - - furnace_room - - kallen_bedroom - - living_room - - master_bedroom - - mud_room - - nursery - - upstairs_hallway - - dining_room - - downstairs_bathroom - - upstairs_bathroom - data: {} - - service: alarm_control_panel.alarm_arm_away - data: {} - target: - entity_id: alarm_control_panel.stratton_ave_alarm - mode: single - icon: mdi:shield-lock -family_is_home: - alias: Family Is Home - sequence: - - service: switch.turn_off - target: - entity_id: switch.presence_simulation - data: {} - - service: alarm_control_panel.alarm_disarm - data: {} - target: - entity_id: alarm_control_panel.stratton_ave_alarm - - service: switch.turn_off - target: - entity_id: - - switch.basement_echo_dot_do_not_disturb_switch - - switch.living_room_echo_dot_do_not_disturb_switch - - switch.master_bedroom_echo_dot_do_not_disturb_switch - data: {} - - service: light.turn_off - target: - area_id: - - furnace_room - - kallen_bedroom - - nursery - - master_bedroom - - upstairs_hallway - - basement_studio - - downstairs_bathroom - - upstairs_bathroom - - dining_room - - living_room - data: {} - - condition: sun - after: sunset - after_offset: -00:30 - - service: light.turn_on - data: {} - target: - entity_id: - - light.living_room_lights - - light.mud_room_overhead - - light.dining_room_lamp - mode: single - icon: mdi:home-account reading_timer_cancel: sequence: - service: timer.cancel