Doorbell cam actionable nitification

Blueprint for automation that send actionable notification with photo on doorbell press.
Notification are sending to home assistant companoin app on android or ios.

Automation can triggering by any entity that change state from on to off. i.e. switch, motion sensor, input_boolean, binary_sensor can bee chosen as automation trigger.
You can edit notification title . Message is day and time of automation triggering.
Snapshots are stored in config/www/doorbell folder and can bee used with gallery card.

You can specify mobile_app device or group of devices for notification to be sent to.
For iOS yor can chose notification sound from dropdown list, or set you own sound.
There are three action button in notification. The first one opens dashboard view that specified in blueprint. Next two buttons perform configurable action1 and action2.
You can set the time during which the actions in the notification are active.

Notification on iOS and on Android devices:

blueprint:
  name: Doorbell cam actionable nitification
  description: Blueprint for automation that send actionable notification with photo on doorbell press. 
    Notification are sending to home assistant companoin app on android or ios. 
    Automation can triggering by any entity that change state from <on> to <off>. i.e. switch, motion sensor, 
    input_boolean, binary_sensor can bee chosen as automation trigger.
    You can edit notification title . Message is day and time of automation triggering. 
    Snapshots are stored in <config/www/doorbell> folder and can bee used with gallery card.
    You can specify mobile_app device or group of devices for notification to be sent to.
    For iOS yor can chose notification sound from dropdown list.
    There are three action button in notification. The first one opens dashboard view that specified in blueprint. 
    Next two buttons perform configurable action1 and action2. 
    You can set the time during which the actions in the notification are active.
  domain: automation
  input:
    notification_title:
      name: Notification title (Optional)
      description: 'Default: "Someone at the doorbell ring!"'
      default: Someone at the doorbell ring!
    doorbell_button:
      name: Trigger entity
      description: Changing state of this entity fom <off> to <on> will start doorbell notification automation.
      selector:
        entity: 
    doorbell_cam:
      name: Doorbell Cam
      description: The Camera from wich take photo for notification.
      selector:
        entity:
          domain: camera
    notify_dev:
      name: Device to notify
      description: Device or group of devices for notification through mobile_app notification service. For example
        <notify.mobile_app_iphone>, <notify.all_devices>
      selector:
        text:
          type: search
    ios_sound:
      name: Notification sound
      description: Notification sound for iOS (Optional). Default <US-EN-Morgan-Freeman-Someone-Is-Arriving.wav>
      default: US-EN-Morgan-Freeman-Someone-Is-Arriving.wav
      selector:
        select:
          mode: dropdown
          custom_value: true
          options:
            - US-EN-Morgan-Freeman-Someone-Is-Arriving.wav
            - US-EN-Morgan-Freeman-Wife-Is-Arriving.wav
            - US-EN-Morgan-Freeman-Boss-Is-Arriving.wav
            - US-EN-Morgan-Freeman-Girlfriend-Is-Arriving.wav
            - US-EN-Morgan-Freeman-Welcome-Home.wav
            - US-EN-Morgan-Freeman-Son-Is-Arriving.wav
            - US-EN-Morgan-Freeman-Roommate-Is-Arriving.wav
            - US-EN-Morgan-Freeman-Motion-Detected.wav
            - US-EN-Morgan-Freeman-Motion-In-Wine-Cellar.wav
            - US-EN-Morgan-Freeman-Motion-In-Garage.wav
            - US-EN-Daisy-Back-Door-Motion.wav
            - US-EN-Daisy-Front-Door-Motion.wav
            - US-EN-Alexa-Motion-In-Garage.wav
            - US-EN-Alexa-Motion-In-Back-Yard.wav
            - US-EN-Alexa-Motion-Detected-Generic.wav
    uri_:
      name: Dashboard tab
      description: Dashboard tab to open by click <Dashboard> button. Default </lovelace/default_view>
      default: /lovelace/default_view
    action1_title:
      name: Action 1 title (Optional)
      description: Action to perform on click action 1 button
      default: action1
    action1:
      name: Action 1
      description: Action to run on action button 1 press
      default: []
      selector:
        action:
    action2_title:
      name: Action 2 title (Optional)
      description: Action to perform on click action 1 button
      default: action2
    action2:
      name: Action 2
      description: Action to run on action button 2 press
      default: []
      selector:
        action:     
    delay:
      name: Delay (Optional)
      description: The time during which the actions in the notification are active
      default: '30'
      selector:
        number:
          min: 0.0
          max: 120.0
          unit_of_measurement: seconds
          mode: slider
          step: 1.0      
            
variables:
  button: !input doorbell_button
  image_file: '/local/doorbell/{{ expand(button)[0].last_changed | as_timestamp  | timestamp_custom("%Y-%m-%d_%H-%M-%S") }}.jpg'
  
trigger:
- entity_id: !input doorbell_button
  platform: state
  from: 'off'
  to: 'on'
condition: []
action:
  - alias: Set up variables for the actions
    variables:
      action_1: '{{ ''ACTION_1'' ~ context.id }}'
      action_2: '{{ ''ACTION_2'' ~ context.id }}'
  - data_template:
      entity_id: !input doorbell_cam
      filename: /config/www/doorbell/{{ expand(button)[0].last_changed | as_timestamp  |
        timestamp_custom("%Y-%m-%d_%H-%M-%S") }}.jpg
        
    service: camera.snapshot
  - service: !input notify_dev
    data:
      title: !input notification_title
      message: '{{ as_timestamp(now()) | timestamp_custom(''%d:%m %H:%M'', true) }}'
      data:
        push:
          sound: !input ios_sound
        ttl: 0
        priority: high
        image: '{{ image_file }}'
        actions:
        - action: URI
          title: Dashboard
          uri: !input uri_
        - action: '{{ action_1 }}'
          title: !input action1_title
        - action: '{{ action_2 }}'
          title: !input action2_title
  - alias: Wait for a response
    wait_for_trigger:
    - platform: event
      event_type: mobile_app_notification_action
      event_data:
        action: '{{ action_1 }}'
    - platform: event
      event_type: mobile_app_notification_action
      event_data:
        action: '{{ action_2 }}'
    timeout: !input delay
    continue_on_timeout: true
  - alias: Perform the action
    choose:
    - conditions:
      - condition: template
        value_template: '{{ wait.trigger.event.data.action == action_1 }}'
      sequence: !input action1
    - conditions:
      - condition: template
        value_template: '{{ wait.trigger.event.data.action == action_2 }}'
      sequence: !input action2

Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.

10 Likes

To create notification group add the following to configuration.yaml. Replace given in the example devices names with names of you own devices:

notify:
  - name: ALL_DEVICES
    platform: group
    services:
      - service: mobile_app_iphone
      - service: mobile_app_mi_a3
      - service: mobile_app_nokia_5_3
      - service: mobile_app_pocox3 
3 Likes

Andrii,
I’m trying to get your blueprint to work but for some reason it is not loading the automation that it creates. Also, I assume you are triggering it from a state when it goes from off to on correct and not the other way around?

Regards,
Phdelmac

You should reload automation domain after create automation from blueprint. If new automation doesn’t appear, check HA notification in bottom left corner of web interfaces, it should contain the reference to error that new automation generate.
and yes, automation triggering from entity state change from off to on, and not another way around

I have tried reloading automations and also restarting HA which still did not load it.

I will check my error log to see if there is any clue there with this.

Hi, I tried to import your blueprint but it gives me this error

Invalid blueprint: extra keys not allowed @ data[‘blueprint’][‘input’][‘ios_sound’][‘selector’][‘custom_value’]. Got None extra keys not allowed @ data[‘blueprint’][‘input’][‘ios_sound’][‘selector’][‘mode’]. Got None extra keys not allowed @ data[‘blueprint’][‘input’][‘notify_dev’][‘selector’][‘type’]. Got None

Do you know how to solve this?
Thanks
Matte

Hi Matte. Today I’ve got the same error on HA core 2022.2.3. Update HA to latest version, it should help

It was impossible for me to add multiple notify.zzzzz, notify.xxxxx as suggested in the blueprint description. Once I did that, the automation created disappeared from the automation list but was still showing in the automation.yaml, I guess the coma was a causing an issue.

My workaround was to create a group, work like a charm with the group to notify. Thanks for sharing!

1 Like

Hi,
I updated to the latest version and now it works, thanks!
I have another issue though, with the device setting.
I’m using HA app on an iPhone, what type of entity should I put in there?
Cause probably I’m missing something.

Thanks
Matteo

Edit: don’t worry, I solved it my self :smiley:

Hi,

I have the same error! I create the automation but is not displayed. I have everything up to date!
Can you please check it?

Logger: homeassistant.components.automation
Source: components/automation/init.py:651
Integration: Automation (documentation, issues)
First occurred: 10:38:58 PM (6 occurrences)
Last logged: 10:43:50 PM

  • Blueprint Doorbell cam actionable nitification generated invalid automation with inputs OrderedDict([(‘notification_title’, ‘message!’), (‘doorbell_button’, ‘binary_sensor.7c043d0paje7478_button_pressed’), (‘doorbell_cam’, ‘camera.7c043d0paje7478_main’), (‘notify_dev’, ‘<notify.mobile_app_x_iphone>’), (‘action1’, [OrderedDict([(‘service’, ‘script.1591695912089’), (‘data’, OrderedDict())])]), (‘action2’, [OrderedDict([(‘service’, ‘script.1591695912089’), (‘data’, OrderedDict())])])]): Service <notify.mobile_app_x_iphone> does not match format . for dictionary value @ data[‘action’][2][‘service’]. Got None
  • Blueprint Doorbell cam actionable nitification generated invalid automation with inputs OrderedDict([(‘doorbell_button’, ‘binary_sensor.7c043d0paje7478_button_pressed’), (‘doorbell_cam’, ‘camera.7c043d0paje7478_main_2’), (‘notify_dev’, ‘I’)]): Service I does not match format . for dictionary value @ data[‘action’][2][‘service’]. Got None

I believe its because you are required to set a action1 and action2… I am trying to cut it out of the template but having to learn blueprints… It would probably be easier to just cut out the code and use an automation. I will let everyone know if I get to that point.

1 Like

Awesome blueprint! Thank you very much.

Could you please point in the right direction for adding my own notification sound? I currently use /local/doorbell.mp3 for media players but not sure how to format it for your blueprint.

Thank you!

Hello,

having issues with implementig automation blueprint. I get notification but without snapshoot. I get error “Failed to load attachment, Response status code was unnacceptable:404”
Any hints…

Hi, has anyone tried to setup one of the actions to open a separate app (Like Amcrest, Ring, etc.)? I am having a difficult time with getting it setup. Looks like the format of the blueprint may be incompatible with what I’m trying to do. Not sure if it’s possible with it’s current state or if I need to look at coding up my own automation instead.

In my config, I set the action for opening a different app to YAML mode and put in the following:

action: URI
uri: app://com.mm.android.amcrestsmarthome

and this is what is generated in the automation YAML:

- id: '1663020437637'
  alias: 'Door Auto: Doorbell cam actionable notification'
  description: ''
  use_blueprint:
    path: AndreiRadchenko/doorbell-cam-actionable-nitification.yaml
    input:
      doorbell_button: binary_sensor.doorbell_button_pressed
      doorbell_cam: camera.doorbell_main_2
      notify_dev: notify.mobile_app_sm_n986u
      uri_: /lovelace-home/cameras
      action1_title: Unlock Door
      action1:
      - service: lock.unlock
        data: {}
        target:
          entity_id: lock.front_door_deadbolt
      action2_title: Open Amcrest Doorbell
      action2: 
      - action: URI
        uri: app://com.mm.android.amcrestsmarthome

Here is what I see in my log when I save the automation:

Logger: homeassistant.components.automation
Source: components/automation/__init__.py:274
Integration: Automation (documentation, issues)
First occurred: 1:43:15 PM (1 occurrences)
Last logged: 1:43:15 PM

Blueprint Doorbell cam actionable nitification generated invalid automation with inputs OrderedDict([('doorbell_button', 'binary_sensor.doorbell_button_pressed'), ('doorbell_cam', 'camera.doorbell_main_2'), ('notify_dev', 'notify.mobile_app_sm_n986u'), ('uri_', '/lovelace-home/cameras'), ('action1_title', 'Unlock Door'), ('action1', [OrderedDict([('service', 'lock.unlock'), ('data', OrderedDict()), ('target', OrderedDict([('entity_id', 'lock.front_door_deadbolt')]))])]), ('action2', [OrderedDict([('action', 'URI'), ('uri', 'app://com.mm.android.amcrestsmarthome')])]), ('action2_title', 'Open Amcrest')]): Unable to determine action @ data['action'][4]['choose'][1]['sequence'][0]. Got None

I’ve also tried to add in a separate title within the URI action code block, but that doesn’t get me anywhere either.

Evertyhing seems to work, however I get no image on the notification, it does save an image to www/doorbell/

Nothing to see in the log.
Anyone else facing the same issue?

If you are still needing to make this work, I just made a modified version of this blueprint that allows you to just enter your app://com.mm.android.amcrestsmarthome (or any other app) for this purpose: Doorbell cam actionable notification with app launcher - Blueprints Exchange - Home Assistant Community - https://community.home-assistant.io/

Thanks. I wound up modifying a couple different blueprints to get what I needed.

1 Like

Excellent, this blueprint works well. Thanks very much for developing this.

For the actions, has anyone got the reolink quick reply messages going and opening up the video stream with audio?

I would like to be able to have the two actions as either send a quick reply or the second action is to open up the video stream in HA in some manner rather than the reolink app.

Any assistance or ideas on achieving this would be useful.

need som help, I have that in config.ymal but im getting error.
in the blueprint under Device to notify i have:
notify.all_devices
What am i missing?

  - name: all_devices
    platform: group
    services:
      - service: mobile_app_min_lur
      - service: media_player_galaxy_tab_a8
      - service: media_player_sovrum
      - service: mobile_app_mumman_iphone