Skip to content

Instantly share code, notes, and snippets.

@DamianFlynn
Created January 22, 2021 13:55
Show Gist options
  • Select an option

  • Save DamianFlynn/aca5b15c133cc7d372c943fa1e2c5f71 to your computer and use it in GitHub Desktop.

Select an option

Save DamianFlynn/aca5b15c133cc7d372c943fa1e2c5f71 to your computer and use it in GitHub Desktop.
Notification Blueprint
blueprint:
name: Doorbell - Notify Google and send camera snapshot to app
description: Make an announcement over 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
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.0
max: 60.0
unit_of_measurement: seconds
mode: slider
step: 1.0
volume:
name: Volume (Optional)
description: Volume for announcement
default: ''
selector:
number:
min: 0
max: 100
unit_of_measurement: "%"
mode: slider
step: 5
source_url: https://community.home-assistant.io/t/doorbell-notify-google-and-send-camera-snapshot-to-app/257953
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'
volume: !input 'volume'
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: media_player.turn_on
data:
entity_id:
- !input 'google_device'
- delay:
seconds: 1
- service: scene.create
data:
scene_id: before
snapshot_entities:
- !input 'google_device'
- service: media_player.volume_set
data:
entity_id:
- !input 'google_device'
volume_set: '{{ volume }}'
- 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 }}'
- service: scene.turn_on
data:
entity_id: scene.before
transition: 2.5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment