This blueprint takes a snapshot of a camera when an input boolean is turned on. You can add additional actions afterwards.
For example, you can send a notification to your phone using the variable {{ snapshot_file_path }}
as the image URL.
blueprint:
name: Camera snapshot and actions when input boolean is turned on
description: >-
Creates a snapshot and triggers a subsequent action when an input boolean is turned on
domain: automation
input:
input_boolean:
name: Input Boolean
description: The sensor wich triggers the snapshot creation
selector:
entity:
domain: input_boolean
camera:
name: Camera
description: The camera which creates the snapshot
selector:
entity:
domain: camera
delay:
name: 'Snapshot Delay (Optional)'
description: 'Wait before creating camera snapshot'
default: 0.0
selector:
number:
min: 0.0
max: 60.0
unit_of_measurement: seconds
mode: slider
step: 1.0
additional_actions:
name: 'Additional Actions'
description: >-
Actions after taking snapshot. (Optional)
Example: A notification using {{ snapshot_file_path }} as the image.
default: []
selector:
action:
source_url: https://community.home-assistant.io/t/camera-snapshot-and-additional-actions-when-input-boolean-is-triggered/313008
mode: restart
variables:
input_boolean: !input 'input_boolean'
input_boolean_name: '{{ states[input_boolean].name }}'
camera: !input 'camera'
delay: !input 'delay'
snapshot_create_file_path: '/config/www/tmp/snapshot_{{ states[camera].object_id }}.jpg'
snapshot_file_path: '{{ snapshot_create_file_path | replace(''/config/www'', ''/local'') }}'
trigger:
platform: state
entity_id: !input 'input_boolean'
from: 'off'
to: 'on'
action:
- delay: '{{ delay }}'
- service: camera.snapshot
entity_id: !input 'camera'
data:
filename: '{{ snapshot_create_file_path }}'
- choose:
default: !input additional_actions
Based on this which was based on this blueprint. Thanks to vorion for the original blueprint.