blueprint:
name: Send a camera snapshot when doorbell was activated
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: The Doorbell was activated!
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
source_url: https://community.home-assistant.io/t/send-camera-snapshot-when-doorbell-was-activated/123456
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 }}'
I’ve used this camera:
€ 25,48 35% Off | ANRAN Wireless Video IP Camera 1080P HD Outdoor Surveillance Security Camera Two Way Audio IR Bullet Wifi Camera Support Onvif
is it possible to make it work with other notification service?
I have 2 HA (home and office) and on Android i can have only one application (i have the option to run the same app 2 times, but android Auto stops to work).
Ok so I have come up with the following @aceindy thank you for the idea of reading the blueprint code and combining multiple. (as I said still new to this are finding my feet with some of the features).
I could not spot the difference between your code and the template one, but completing the same steps I’m guessing you did and combining elements of different blueprints this seems to work perfectly
blueprint:
name: Send a camera snapshot when doorbell was pressed
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
device_class: 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: "Motion detected!"'
default: Motion detected!
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
source_url:
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 }}'
Hey guys!
Can someone help me adjusting this blueprint to get a template sensor as trigger?
The blueprint should be triggered once the sensors changes to “ready”.
I want to receive a picture of my 3d printer
Thank you!
@sorted file-editor: blueprints/aceindy/.yml , remove “esphome” and on/off to ready/not-ready.
now my question is, if anybody could enhance this script with an “away_mode” trigger to be turned on. because getting a snapshot if already home and hearing the chime seems pointless.
i could, but wouldn’t it be just as easy to create a trigger that turns off the automation (along with other automation(s) you’d like to switch off)?
Btw, that option wouldn’t work for me, after 19:00 my chime turns silent (as it might wake up my kids), so i need the notification even when home…
(and if the tv is on, it will also notify me )
I am trying to use this with an Amcrest doorbell and cannot seem to get it to work as it doesn’t trigger a sensor but an event. Can anyone assist with the code from Amcrest but the action I want is to send the camera snapshot. Thank you in advance for the help!!
oh snap, reviving an old thread. maybe there’s still someone here?
I tried to build all of it this week. So far, it is working but i get ghost activations of the chime.
For now I increased both filter delay times from 25ms to 100ms. This seems to work for now.
I am also a bit concerned because of the relay keeps being activated after a power toggle…
Another “problem” is the notification. I see it on iOS but when I click it, I don’t get a big picture. Any chance to change this?
Also when I click it once - it disappears.