From 18543c268ce7e0152fd1394afb93636eaa675450 Mon Sep 17 00:00:00 2001 From: Przemek Grondek Date: Tue, 7 Feb 2023 14:10:00 +0100 Subject: [PATCH] Add camera snapshot --- configuration/automations/alarm.yaml | 14 ++++++-- configuration/automations/info-leak.yaml | 13 ++++--- configuration/automations/ups.yaml | 2 +- scripts/11.cctv.yaml | 44 ++++++++++++++++++++++++ 4 files changed, 64 insertions(+), 9 deletions(-) diff --git a/configuration/automations/alarm.yaml b/configuration/automations/alarm.yaml index f6615e9..12da4c1 100644 --- a/configuration/automations/alarm.yaml +++ b/configuration/automations/alarm.yaml @@ -113,7 +113,7 @@ data: filename: /config/www/cctv/living_room.jpg target: - entity_id: camera.hallway + entity_id: camera.living_room - service: notify.home_assistant data: message: > @@ -161,9 +161,9 @@ entity_id: alarm_control_panel.home_alarm - service: camera.snapshot data: - filename: /config/www/cctv/living_room.jpg + filename: /config/www/cctv/bedroom.jpg target: - entity_id: camera.hallway + entity_id: camera.bedroom - service: notify.home_assistant data: message: > @@ -181,6 +181,14 @@ filename: /config/www/cctv/bedroom.mp4 target: entity_id: camera.bedroom + - service: notify.home_assistant + data: + message: > + Motion recording + target: [ "1070507369164984372" ] + data: + images: + - "/config/www/cctv/bedroom.mp4" - id: alarm-away-remaining alias: '[Alarm] Trigger alarm when not at home' diff --git a/configuration/automations/info-leak.yaml b/configuration/automations/info-leak.yaml index 946f40c..3b1570d 100644 --- a/configuration/automations/info-leak.yaml +++ b/configuration/automations/info-leak.yaml @@ -23,7 +23,7 @@ action: - service: notify.mobile_app_iphone data: - title: "Leak detection" + title: "Leak detection ⚠️" message: > Leak detected: {{ state_attr(trigger.entity_id, 'friendly_name') }} data: @@ -39,6 +39,7 @@ {{ state_attr(trigger.entity_id, 'friendly_name') }} @everyone target: [ "1071801716070154240" ] + - service: script.cctv_snapshot_all - id: info-leak-cleared-notice alias: '[INFO] Leak cleared notice' @@ -65,13 +66,13 @@ action: - service: notify.mobile_app_iphone data: - title: "Leak cleared" + title: "Leak cleared ✅" message: > Leak cleared: {{ state_attr(trigger.entity_id, 'friendly_name') }} - service: notify.home_assistant data: message: > - Leak cleared! ✅ + Leak cleared! ✅ {{ state_attr(trigger.entity_id, 'friendly_name') }} target: [ "1071801716070154240" ] @@ -88,7 +89,7 @@ action: - service: notify.mobile_app_iphone data: - title: "Smoke detection" + title: "Smoke detection ⚠️" message: > Smoke detected: {{ state_attr(trigger.entity_id, 'friendly_name') }} data: @@ -104,6 +105,7 @@ {{ state_attr(trigger.entity_id, 'friendly_name') }} @everyone target: [ "1071801716070154240" ] + - service: script.cctv_snapshot_all - id: info-smoke-cleared-notice alias: '[INFO] Smoke notice' @@ -118,7 +120,7 @@ action: - service: notify.mobile_app_iphone data: - title: "Smoke cleared" + title: "Smoke cleared ✅" message: > Smoke cleared: {{ state_attr(trigger.entity_id, 'friendly_name') }} - service: notify.home_assistant @@ -127,3 +129,4 @@ Smoke cleared! ✅ {{ state_attr(trigger.entity_id, 'friendly_name') }} target: [ "1071801716070154240" ] + - service: script.cctv_snapshot_all diff --git a/configuration/automations/ups.yaml b/configuration/automations/ups.yaml index b8d6481..151424d 100644 --- a/configuration/automations/ups.yaml +++ b/configuration/automations/ups.yaml @@ -35,7 +35,7 @@ - service: notify.home_assistant data: message: > - UPS Alert ✅ + UPS Alert ✅ UPS is charging @everyone target: [ "1071801716070154240" ] diff --git a/scripts/11.cctv.yaml b/scripts/11.cctv.yaml index 05497a1..573250b 100644 --- a/scripts/11.cctv.yaml +++ b/scripts/11.cctv.yaml @@ -1,5 +1,6 @@ cctv_on: alias: CCTV on + icon: mdi:cctv sequence: - service: switch.turn_on target: @@ -21,6 +22,7 @@ cctv_on: cctv_off: alias: CCTV off + icon: mdi:cctv-off sequence: - service: switch.turn_off target: @@ -35,3 +37,45 @@ cctv_off: - switch.hallway_recordings - switch.hallway_snapshots - switch.hallway_detect + +cctv_snapshot_all: + alias: CCTV snapshot all + icon: mdi:cctv + sequence: + - service: camera.snapshot + data: + filename: /config/www/cctv/hallway.jpg + target: + entity_id: camera.hallway + - service: camera.snapshot + data: + filename: /config/www/cctv/living_room.jpg + target: + entity_id: camera.living_room + - service: camera.snapshot + data: + filename: /config/www/cctv/bedroom.jpg + target: + entity_id: camera.bedroom + - service: camera.snapshot + data: + filename: /config/www/cctv/3d_printer.jpg + target: + entity_id: camera.3d_printer + - service: camera.snapshot + data: + filename: /config/www/cctv/balcony.jpg + target: + entity_id: camera.balcony + - service: notify.home_assistant + data: + message: > + All camera snapshot + target: [ "1070507369164984372" ] + data: + images: + - "/config/www/cctv/hallway.jpg" + - "/config/www/cctv/living_room.jpg" + - "/config/www/cctv/bedroom.jpg" + - "/config/www/cctv/3d_printer.jpg" + - "/config/www/cctv/balcony.jpg"