Update Security Scripts

This commit is contained in:
2023-11-21 14:41:36 -07:00
parent 9db36a217d
commit 2488c9965d

View File

@@ -144,6 +144,57 @@ input_button:
shell_command: shell_command:
doorbell_camera_set_online: !secret doorbell_camera_online_command doorbell_camera_set_online: !secret doorbell_camera_online_command
# -----------------------------------------------------------------------------
# Security Scripts
script:
pause_camera_events:
alias: Pause Exterior Camera Event Detection
sequence:
- service: mqtt.publish
data:
topic: frigate/backyard/detect/set
payload: 'OFF'
- service: mqtt.publish
data:
topic: frigate/doorbell/detect/set
payload: 'OFF'
resume_camera_events:
alias: Resume Exterior Camera Event Detection
sequence:
- service: mqtt.publish
data:
topic: frigate/backyard/detect/set
payload: 'ON'
- service: mqtt.publish
data:
topic: frigate/doorbell/detect/set
payload: 'ON'
# Run as a script so it can be cancelled by the helper turning back off
auto_resume_camera_events:
alias: Automatically Resume Exterior Camera Event Detection (timed)
data:
minutes:
name: Minutes
description: "The amount of time to wait before resuming detection"
default: 60
selector:
number:
min: 0
max: 240
step: 10
unit_of_measurement: minutes
mode: slider
mode: restart
sequence:
- delay:
minutes: "{{ minutes }}"
- service: input_boolean.turn_off
target:
entity_id: input_boolean.disable_camera_events
- service: script.resume_camera_events
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# Security Automations # Security Automations
automation: automation:
@@ -311,26 +362,12 @@ automation:
entity_id: input_boolean.disable_camera_events entity_id: input_boolean.disable_camera_events
to: 'on' to: 'on'
action: action:
- service: mqtt.publish - service: script.pause_camera_events
data: - service: script.turn_on
topic: frigate/backyard/detect/set
payload: 'OFF'
- service: mqtt.publish
data:
topic: frigate/doorbell/detect/set
payload: 'OFF'
- delay: 3600
- service: input_boolean.turn_off
target: target:
entity_id: input_boolean.disable_camera_events entity_id: script.auto_resume_camera_events
- service: mqtt.publish
data: data:
topic: frigate/backyard/detect/set minutes: 60
payload: 'ON'
- service: mqtt.publish
data:
topic: frigate/doorbell/detect/set
payload: 'ON'
- alias: Resume Camera Event Detection - alias: Resume Camera Event Detection
trigger: trigger:
@@ -338,14 +375,10 @@ automation:
entity_id: input_boolean.disable_camera_events entity_id: input_boolean.disable_camera_events
to: 'off' to: 'off'
action: action:
- service: mqtt.publish - service: script.turn_off
data: target:
topic: frigate/backyard/detect/set entity_id: script.auto_resume_camera_events
payload: 'ON' - service: script.resume_camera_events
- service: mqtt.publish
data:
topic: frigate/doorbell/detect/set
payload: 'ON'
- alias: Pause Doorbell Event Detection on Arrival or Departure - alias: Pause Doorbell Event Detection on Arrival or Departure
trigger: trigger:
@@ -362,6 +395,7 @@ automation:
condition: state condition: state
entity_id: input_boolean.disable_camera_events entity_id: input_boolean.disable_camera_events
state: 'off' state: 'off'
mode: restart
action: action:
- service: mqtt.publish - service: mqtt.publish
data: data:
@@ -382,6 +416,7 @@ automation:
condition: state condition: state
entity_id: alarm_control_panel.ha_alarm entity_id: alarm_control_panel.ha_alarm
state: disarmed state: disarmed
mode: restart
action: action:
- service: mqtt.publish - service: mqtt.publish
data: data:
@@ -400,6 +435,7 @@ automation:
condition: state condition: state
entity_id: input_boolean.disable_camera_events entity_id: input_boolean.disable_camera_events
state: 'off' state: 'off'
mode: restart
action: action:
- delay: 60 - delay: 60
- service: mqtt.publish - service: mqtt.publish