Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save skippengs/877ba6e178d7877bb416549eba0e87f5 to your computer and use it in GitHub Desktop.
Save skippengs/877ba6e178d7877bb416549eba0e87f5 to your computer and use it in GitHub Desktop.
Send a camera snapshot when motion/person/visitor is detected Reolink video doorbell
blueprint:
name: Send a camera snapshot when motion/person/visitor is detected
author: Skippy
description: >
This blueprint creates a camera snapshot if motion/person/visitor is detected
and sends a notification to your phone with the picture.
domain: automation
input:
motion_sensor:
name: Motion sensor
description: The sensor which triggers the snapshot creation. For reolink doorbell search for motion/person/visitor
selector:
entity:
domain: binary_sensor
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
notification_title:
name: Notification title (Optional)
description: 'Default: "Motion detected!"'
default: "Motion detected!"
notification_message:
name: Notification message (Optional)
description: 'Default: "{{ motion_sensor_name }} detected movement!"'
default: "{{ motion_sensor_name }} detected movement!"
notification_channel:
name: Notification channel name
description: Notification channel name, allows you to set seperate notification sounds per entry (Android only, only works one time per notification channel, so choose wisely)
default: ""
#action_1_title:
# name: Name for first button
# description: Name of the first button
# default: ""
delay:
name: Delay (Optional)
description: Wait before creating camera snapshot
default: ""
selector:
number:
min: 0
max: 60
unit_of_measurement: seconds
mode: slider
trigger:
platform: state
entity_id: !input motion_sensor
from: "off"
to: "on"
variables:
motion_sensor: !input motion_sensor
motion_sensor_name: "{{ states[motion_sensor].name }}"
camera: !input camera
notify_device: !input notify_device
notification_title: !input notification_title
notification_message: !input notification_message
notification_channel: !input notification_channel
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
#device_id: notify.ALL_DEVICES
domain: mobile_app
type: notify
title: "{{ notification_title }}"
message: "{{ notification_message }}"
data: >
{% set android_data = {"channel": notification_channel, "clickAction": "app://com.mcu.reolink", "ttl": 0, "priority": "high", "image": "%s"} | format(snapshot_access_file_path) %}
{{ android_data }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment