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, a 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.
You can announce to multiple devices by inputting a comma separated list or a group.
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
max: 60
unit_of_measurement: seconds
mode: slider
source_url: https://gist.github.com/seamus65/fd6d9341f0f8be76d8b81c2e3ef03624
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: 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 }}
Logger: homeassistant.components.automation.doorbell_notify_google_and_send_camera_snapshot_to_app
Source: helpers/script.py:1138
Integration: Automation (documentation, issues)
First occurred: 9:15:59 PM (1 occurrences)
Last logged: 9:15:59 PM
Doorbell - Notify Google and send camera snapshot to app: Error executing script. Service not found for call_service at pos 1: Unable to find service tts.google_say
The default configuration is `tts.google_translate_sayā, so if you are sharing, its best to stick to default naming, otherwise everyone will have the same problem as @luchtgitaar
I have been playing with them since the conference, I am not involved in the creation of blueprints, but it does feel good to be able to give back some to the community.
I think blueprints could be hugely powerful for a lot of people.
Thanks. I am getting a different error now. Also I am not able to select groups or comma separate devices. I have same sort of automation in NodeRed now, so thanks for your hard work settings this up in HA itself.
Logger: homeassistant.components.automation.doorbell_notify_google_and_send_camera_snapshot_to_app
Source: helpers/script.py:1138
Integration: Automation (documentation, issues)
First occurred: 10:22:39 PM (2 occurrences)
Last logged: 10:23:26 PM
Doorbell - Notify Google and send camera snapshot to app: Error executing script. Invalid data for call_service at pos 1: not a valid value for dictionary value @ data['entity_id']
Logger: homeassistant.components.automation.doorbell_notify_google_and_send_camera_snapshot_to_app
Source: core.py:1399
Integration: Automation (documentation, issues)
First occurred: 10:22:39 PM (1 occurrences)
Last logged: 10:22:39 PM
While executing automation automation.doorbell_notify_google_and_send_camera_snapshot_to_app
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']
alias: House Doorbell Button Local Notify
description: >-
CCTV needs to have anonymous viewer enabled or I need to pass the username in
the media_content_id. Note, during testing you need to turn off the
media_player device after each test, else is will not show the video again.
trigger:
- device_id: b03ab12c707340e8849888171a79caed
domain: binary_sensor
entity_id: binary_sensor.doorbell_button
platform: device
type: turned_on
condition:
- condition: or
conditions:
- condition: state
entity_id: person.richard
state: home
- condition: state
entity_id: person.lucy
state: home
action:
- data:
cache: false
entity_id: media_player.living_room_speaker
message: Ding! Dong! Someone is at the door
service: tts.google_translate_say
- data:
media_content_id: 'http://192.168.4.11/axis-cgi/mjpg/video.cgi'
media_content_type: image/jpg
entity_id: media_player.office_display
service: media_player.play_media
- data:
media_content_id: 'http://192.168.4.11/axis-cgi/mjpg/video.cgi'
media_content_type: image/jpg
entity_id: media_player.bedroom_display
service: media_player.play_media
- data:
media_content_id: 'http://192.168.4.11/axis-cgi/mjpg/video.cgi'
media_content_type: image/jpg
entity_id: media_player.kitchen_display
service: media_player.play_media
- data:
cache: false
entity_id: media_player.lucys_room_speaker
message: Ding! Dong! Someone is at the door
service: tts.google_translate_say
- data:
cache: false
entity_id: media_player.garage
message: Ding! Dong! Someone is at the door
service: tts.google_translate_say
mode: single
and
House Doorbell Button External Notify
alias: House Doorbell Button External Notify
description: 'https://github.com/home-assistant/core/issues/32236'
trigger:
- device_id: b03ab12c707340e8849888171a79caed
domain: binary_sensor
entity_id: binary_sensor.doorbell_button
platform: device
type: turned_on
condition: []
action:
- data:
message: Ding Dong! Someone is at the door. Get the biohazard suit out!
title: Doorbell Alertā£ļø
service: notify.pushover_notify_doorbell
- data:
filename: /config/www/tmp/front_door.jpg
service: camera.snapshot
entity_id: camera.front_door_11
- data:
data:
attachment: /config/www/tmp/front_door.jpg
message: Photo of the infectious!
title: Doorbell CCTV Photo
service: notify.pushover_notify_doorbell
mode: single
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
Is there a way that this automation can be setup with the following:
Music player is playing some music like a radio station of spotify.
someone rings de doorbel and google uses TTS to tell that there is someone at the door.
3.Music player goes back to the music services that was playing.