Send camera snapshot notification with Frenck’s doorbell

Hi
Based on Frenck’s doorbell and Vorion’s motion detection blueprint, i combined both and created this blueprint:
Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.

or use copy/paste:

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

And works like a charm…


(sorry for the mess…doing some rebuilding atm)

5 Likes

Hi, would it please be possible to add a local .mp3 or .wav file streamed to a google speaker/Alexa on button press?

I guess so…
should be a combination of mine with this one?

Since I already combined 2, feel free to combine 3 :wink:

Hi,

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).

This does not seem to work anymore, just set it up and get no images

Does it still work for you? (It may be me doing this wrong)

Small update, the “Send a camera snapshot when motion is detected” blueprint still works.

I’m going to compare the code of both and see if I can understand what isn’t working

Still new to a lot of this I wish me luck :sweat_smile:

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 :blush:

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 }}'

Mine uses the doorbell as trigger instead of motion detection in Vorlon’s blueprint.
But yeah, the are alost identical :wink:

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 :slight_smile:
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.

This doesn’t detect google/nest doorbells as an available entity?

That probably means the camera is not configured properly…it should list all entities within the camera domain🤔

entity:
  domain: camera

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 :yum:)

Is it possible to add to this blueprint to send a notification to a device group? I am having problems figuring that out.

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!!

alias: Doorbell Pressed
description: "Trigger when Amcrest Button Press Event Fires"
trigger:
  - platform: event
    event_type: amcrest
    event_data:
      event: "CallNoAnswered"
      payload:
        action: "Start"
action:
  - type: flash
    entity_id: light.living_room
    domain: light

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.

Cheers!

Erm…not much you can do about the poweloss…
Ghost chimes I’ve seen when cable is long and too close to another power cable. How long is your cable?

And for the notification, push and hold until it shows the picture…

1 Like

oh my god i feel so bad… thanks.

yeah, that could be a good idea. i was about using any kind of ferrites or something like that (maybe any sort of capacity would also help).

thanks for advices and thanks for your blueprint! :slight_smile: