Doorbell - Notify Alexa and/or Google and send camera snapshot to app

UPDATED: Now supports Alexa and Google devices.And updated to tts.google_translate_say

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 echo device or google 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 or Google and send camera snapshot to app
  description: 'Make an announcement over Alexa and/or Google 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: ""
    google_device:
      name: Google
      description: The Google 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/294db1010ba4e27e0cd8889ef110eb24

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
  - service: tts.google_translate_say
    data:
      entity_id:
        - !input 'google_device'
      message: !input message

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

6 Likes

hello,
this is great, I am looking for this but that will work with google home. do you have anything like that?

Sorry for the delayed response.

I will have a look and see if I can modify it.

I have updated this blueprint to do both Alexa and Google.

Let me know how you get on with it.

I don’t use Alexa and I get an “unable to find service notify.alexa_media” How do you just use the Google notify?

Sorry, Just realised that it will give you that error as you don’t have that service without the Alexa media Player custom integration.

I will make a google only one as well.

That is a google only one up now.

Let me know if you have any problems.

Are you able to add priority to this? My notifications to Android disappear into a black hole without this code.

data:
  ttl: 0
  priority: high

Sorry, i can’t see how to do that at the minute.

Thank you. It works great with 1 google speaker. But, I was unable to get it to work with multiple google speakers using a comma delimited list. I may be doing something wrong but the error I am getting is:

Logger: homeassistant.components.automation.doorbell_notify_google_and_send_camera_snapshot_to_app_3
Source: core.py:1399
Integration: Automation (documentation, issues)
First occurred: 1:50:33 PM (2 occurrences)
Last logged: 1:52:22 PM

While executing automation automation.doorbell_notify_google_and_send_camera_snapshot_to_app_3
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/automation/__init__.py", line 404, in async_trigger
    await self.action_script.async_run(
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1026, in async_run
    await asyncio.shield(run.async_run())
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 242, in async_run
    await self._async_step(log_exceptions=False)
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 250, in _async_step
    await getattr(
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 457, in _async_call_service_step
    await service_task
  File "/usr/src/homeassistant/homeassistant/core.py", line 1399, in async_call
    processed_data = handler.schema(service_data)
  File "/usr/local/lib/python3.8/site-packages/voluptuous/schema_builder.py", line 272, in __call__
    return self._compiled([], data)
  File "/usr/local/lib/python3.8/site-packages/voluptuous/schema_builder.py", line 594, in validate_dict
    return base_validate(path, iteritems(data), out)
  File "/usr/local/lib/python3.8/site-packages/voluptuous/schema_builder.py", line 432, in validate_mapping
    raise er.MultipleInvalid(errors)
voluptuous.error.MultipleInvalid: not a valid value for dictionary value @ data['entity_id']

I have started having issues today, so I changed the selector back to media player and it seems to work better, but not sure if something has change with the supervisor update.

great thank you so much, i’ll try it and let you know.

thx for the blueprint!

Is it possible to just send an notification to my iphone without the need of a camera?

maybe its possible to set a volume level to the selected echo devices?
so for example when my echo is at a very low volume level before the dorbell ring?

best regards

Unfortunately I can’t get the ios notifications to work. I’m actually having trouble clarifying path names in general, which seems to be the problem here. And defining what to add to the the allowlist as well. Any input would be appreciated for my pi installation.

this does not work for me. I get an error that alexa devices cannot be found, which makes sense because I dont have any. I left the alexa device field blank and only filled in the google device as I am attempting to cast to a chromecast only, it does not appear to skip the Alexa part…?

Hi there,

could I play a locally hosted mp3 instead of TTS? I would like to just play a simple doorbell chime,
instead of just having the Google Speaker say “Ding Dong!”

1 Like

Would also love to see this have an option for “silence” via a boolean

1 Like

Works perfectly!

Funny note: I had a battle getting the MP3 to work here on some other doorbell solution.
But the Wife wanted the TTS Ding Dong, Ding Dong, Ding Dong voice back…
She finds it funny and now opens the door with a big smile :wink:

Actually, same here. The kids find it actually fun to keep hearing the TTS ding dong. I managed to solve my problem with a wireless ESP Relay. Just ring the normal door Gong trough the relay on button press. The TTS ding dong is still played though.

1 Like