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)

1 Like

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: