From e6426a4f3b857378d81df5670cfb20a2cbe732cc Mon Sep 17 00:00:00 2001 From: Przemek Grondek Date: Mon, 12 Dec 2022 20:30:38 +0100 Subject: [PATCH] CCTV scripts --- configuration/automations/camera.yaml | 40 +++++++++++++++++++-------- scripts/10.modes.yaml | 4 +++ scripts/11.cctv.yaml | 25 +++++++++++++++++ 3 files changed, 57 insertions(+), 12 deletions(-) create mode 100644 scripts/11.cctv.yaml diff --git a/configuration/automations/camera.yaml b/configuration/automations/camera.yaml index 938ae69..6678bea 100644 --- a/configuration/automations/camera.yaml +++ b/configuration/automations/camera.yaml @@ -1,30 +1,36 @@ -- id: camera_kitchen_notification - alias: '[Camera] Kitchen notification' - condition: - - condition: state - entity_id: alarm_control_panel.home_alarm - state: armed_away +- id: camera_livingroom_notification + alias: '[Camera] Living room notification' trigger: - platform: state entity_id: binary_sensor.kitchen_motion_sensor from: 'off' to: 'on' + # Use open/close sensors + - platform: state + entity_id: binary_sensor.dining_window_1_open_close + to: 'on' + - platform: state + entity_id: binary_sensor.dining_window_2_open_close + to: 'on' + - platform: state + entity_id: binary_sensor.office_window_open_close + to: 'on' + condition: + - condition: state + entity_id: alarm_control_panel.home_alarm + state: armed_away action: - service: notify.mobile_app_iphone data: - message: Motion Detected in Kitchen! + message: Motion Detected in Living Room! data: - entity_id: camera.kitchen + entity_id: camera.living_room url: _: "/lovelace-tablet/cctv" mode: single - id: camera_hallway_notification alias: '[Camera] Hallway notification' - condition: - - condition: state - entity_id: alarm_control_panel.home_alarm - state: armed_away trigger: - platform: state entity_id: binary_sensor.hallway_motion_sensor @@ -34,6 +40,16 @@ entity_id: binary_sensor.hallway_sensor_2_home_security_motion_detection from: 'off' to: 'on' + - platform: state + entity_id: binary_sensor.front_door_open_close + to: 'on' + - platform: state + entity_id: lock.front_door_lock_doorlock + to: 'unlocked' + condition: + - condition: state + entity_id: alarm_control_panel.home_alarm + state: armed_away action: - service: notify.mobile_app_iphone data: diff --git a/scripts/10.modes.yaml b/scripts/10.modes.yaml index c78eb85..16fcfd6 100644 --- a/scripts/10.modes.yaml +++ b/scripts/10.modes.yaml @@ -1,6 +1,7 @@ good_night: alias: Good Night sequence: + - service: script.cctv_on - service: alarm_control_panel.alarm_arm_home entity_id: alarm_control_panel.home_alarm - service: input_select.select_option @@ -87,6 +88,7 @@ good_night: good_morning: alias: Good Morning sequence: + - service: script.cctv_off - service: cover.open_cover entity_id: - cover.bedroom_blinds @@ -126,6 +128,7 @@ good_morning: leave_home: alias: Leave Home sequence: + - service: script.cctv_on - service: alarm_control_panel.alarm_arm_away entity_id: alarm_control_panel.home_alarm - service: input_select.select_option @@ -208,6 +211,7 @@ leave_home: arrive_home: alias: Arrive Home sequence: + - service: script.cctv_off - service: alarm_control_panel.alarm_disarm entity_id: alarm_control_panel.home_alarm - service: input_select.select_option diff --git a/scripts/11.cctv.yaml b/scripts/11.cctv.yaml new file mode 100644 index 0000000..bd09b8f --- /dev/null +++ b/scripts/11.cctv.yaml @@ -0,0 +1,25 @@ +cctv_on: + alias: CCTV on + sequence: + - service: switch.turn_on + target: + entity_id: + - switch.living_room_recordings + - switch.living_room_snapshots + - switch.living_room_detect + - switch.hallway_recordings + - switch.hallway_snapshots + - switch.hallway_detect + +cctv_off: + alias: CCTV off + sequence: + - service: switch.turn_off + target: + entity_id: + - switch.living_room_recordings + - switch.living_room_snapshots + - switch.living_room_detect + - switch.hallway_recordings + - switch.hallway_snapshots + - switch.hallway_detect