Last active
June 4, 2022 13:20
-
-
Save huizebruin/586355dd9085c1c159c484bbe425e0d4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
blueprint: | |
name: stuur foto bij drukken deurbel | |
description: 'This automation blueprint creates a camera snapshot when the doorbell was activated and | |
sends a notification to your phone with the picture. | |
' | |
domain: automation | |
input: | |
binary_sensor: | |
name: Push button | |
description: | |
Entity representing a physical push button (which restores its position | |
when released). It must emit a square signal on press. | |
This automation is triggered by its falling edge. | |
selector: | |
entity: | |
domain: binary_sensor | |
integration: esphome | |
camera: | |
name: Camera | |
description: The camera which creates the snapshot | |
selector: | |
entity: | |
domain: camera | |
notify_device: | |
name: Device to notify | |
description: Device needs to run the official Home Assistant app to receive | |
notifications | |
selector: | |
device: | |
integration: mobile_app | |
is_ios: | |
name: Is it an iOS device? | |
description: Toggle if your selected device runs iOS, default is Android | |
selector: | |
boolean: {} | |
default: false | |
notification_title: | |
name: Notification title (Optional) | |
description: 'Default: "DingDong!"' | |
default: Er staat iemand bij de voordeur! | |
notification_message: | |
name: Notification message (Optional) | |
description: 'Default: "{{ binary_sensor_name }} was activated!"' | |
default: '{{ binary_sensor_name }} was activated!' | |
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' | |
binary_sensor_name: '{{ states[binary_sensor].name }}' | |
camera: !input 'camera' | |
notify_device: !input 'notify_device' | |
is_ios: !input 'is_ios' | |
notification_title: !input 'notification_title' | |
notification_message: !input 'notification_message' | |
delay: !input 'delay' | |
snapshot_create_file_path: /config/www/tmp/snapshot_{{ states[camera].object_id | |
}}.jpg | |
snapshot_access_file_path: '{{ snapshot_create_file_path | replace(''/config/www'',''/local'') | |
}}' | |
action: | |
- delay: '{{ delay }}' | |
- service: camera.snapshot | |
entity_id: !input 'camera' | |
data: | |
filename: '{{ snapshot_create_file_path }}' | |
- device_id: !input 'notify_device' | |
domain: mobile_app | |
type: notify | |
title: '{{ notification_title }}' | |
message: '{{ notification_message }}' | |
data: '{% set android_data = {"image": "%s"} | format(snapshot_access_file_path) | |
%} {% set ios_data = {"attachment": {"url": "%s", "content_type": "JPEG"}} | format(snapshot_access_file_path) | |
%} {{ ios_data if is_ios else android_data }}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment