Skip to content

Instantly share code, notes, and snippets.

@nikosthanos
Last active December 19, 2020 11:20
Show Gist options
  • Save nikosthanos/02eae81594748586da64c9c08f8a58f4 to your computer and use it in GitHub Desktop.
Save nikosthanos/02eae81594748586da64c9c08f8a58f4 to your computer and use it in GitHub Desktop.
Save from two camera snapshots when one binary_sensor change state to on is detected with adjustable delay TESTED OK
blueprint:
name: Save two camera snapshots when binary_sensor state to on is detected
description: Save from two camera snapshots when one binary_sensor change state to on is detected with adjustable delay
domain: automation
source_url: https://gist.github.com/nikosthanos/02eae81594748586da64c9c08f8a58f4
input:
binary_sensor:
name: sensor
description: The sensor wich triggers the snapshot creation
selector:
entity:
domain: binary_sensor
camera:
name: Camera
description: The camera which creates the snapshot
selector:
entity:
domain: camera
camera1:
name: Camera1
description: The camera1 which creates the snapshot
selector:
entity:
domain: camera
file:
name: File Path
description: The file path to store the most current snapshot.
default: '/media/CAMERA_NAME/last_motion.jpg'
archive_file:
name: Archive File Path
description: The file path to store the snapshot in an archive folder.
default: '/media/CAMERA_NAME/archive/motion_{{ now().strftime("%Y%m%d-%H%M%S") }}.jpg'
delay:
name: Delay (Optional)
description: Wait before creating camera snapshot
default: ''
selector:
number:
min: 0.0
max: 60.0
unit_of_measurement: seconds
mode: slider
step: 1.0
trigger:
platform: state
entity_id: !input binary_sensor
from: 'off'
to: 'on'
variables:
binary_sensor: !input 'binary_sensor'
camera: !input 'camera'
camera1: !input 'camera1'
file: !input file
archive_file: !input archive_file
delay: !input 'delay'
action:
- delay: '{{ delay }}'
- service: camera.snapshot
entity_id: !input 'camera'
data:
filename: !input file
- service: camera.snapshot
entity_id: !input 'camera'
data:
filename: !input archive_file
- delay: '{{ delay }}'
- service: camera.snapshot
entity_id: !input 'camera1'
data:
filename: !input file
- service: camera.snapshot
entity_id: !input 'camera1'
data:
filename: !input archive_file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment