Doorbell - Notify Alexa and send camera snapshot to app

Blueprint to make a TTS announcement when a binary sensor goes from off to on, e.g. a doorbell sensor and to take a snapshot from a camera and send it to your official home assistant mobile app.

You can select a binary sensor, an Alexa device to make the announcement and customise the announced message, a camera, a mobile device to receive the snapshot as a notification (either android or iOS) and customise the notification title and message.

NOTE: For amazon echo devices you require the alexa media player add-on.

You can announce to multiple devices by inputting a comma separated list or a group.

Blueprint screen:

Blueprint to import:

blueprint:
  name: Doorbell - Notify Alexa and send camera snapshot to app
  description: 'Make an announcement over Amazon Echo devices when the doorbell is pushed and send a camera snapshot to your app.'

  domain: automation
  input:
    doorbell:
      name: Doorbell
      description: This is the doorbell binary sensor
      selector:
        entity:
          domain: binary_sensor
    echo_device:
      name: Alexa
      description: The Alexa device to make the announcement on. Make a comma seperated list to announce on multiple devices.
      selector:
        entity:
          domain: media_player
      default: ""
    message:
      name: Message (Optional)
      description: 'Default: "There is Somebody at the Door!"'
      default: There is Somebody at the Door
    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: "There is Somebody at the Door!"'
      default: "There is Somebody at the Door!"
    notification_message:
      name: Notification message (Optional)
      description: 'Default: "There is Somebody at the Door!"'
      default: "There is Somebody at the Door!"      
    delay:
      name: Delay (Optional)
      description: Wait before creating camera snapshot
      default: ""
      selector:
        number:
            min: 0
            max: 60
            unit_of_measurement: seconds
            mode: slider

  source_url: https://gist.github.com/seamus65/cb4b12c076d0383f24d2f567da12e8ee

mode: single

trigger:
- platform: state
  entity_id: !input 'doorbell'
  from: "off"
  to: "on"

variables:
  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:
  - service: notify.alexa_media
    data:
      target:
        - !input 'echo_device'
      message: !input message
      data:
        type: tts

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

3 Likes

Very nice, thanks for sharing.

Great work here - Is this easy to manipulate for Google Home Speakers?

There is a Google one as well Doorbell - Notify Google and send camera snapshot to app
It should be easy enough to modify as well

1 Like

Hello, this is great blueprint.
Can we use event as a trigger?
I have Sonoff SNZB 01 button as a doorbel and I can use it via zha_event toggle, trigger.
If I could somehow use event instead of entity it would be just great.

Great job. I have a couple of enhancement requests. Would it be possible to …

  • include multiple devices to receive the notification?
  • make the notification actionable? (for example to open the image)

The blueprints are not too difficult to modify.
I am just a home assistant user like everyone else, not a programmer.
You could have a go and let me know how you get on.

Cant seem to get this working and have no idea why?
I dont have any Amazon devices…Havent select the Alexa part in the in the automation… yet i still get this error and nothing playing on my google devices?

Doorbell - Notify Alexa and or Google and send camera snapshot to app: Error executing script. Service not found for call_service at pos 1: Unable to find service notify.alexa_media

This one requires the Alexa notify component.

It has been a long time since I created these and I haven’t had a chance to look at them in a while.

Have you tried the Google one?

Awesome thanks!