Skip to content

Instantly share code, notes, and snippets.

@seamus65
Last active May 7, 2024 20:14
Show Gist options
  • Save seamus65/66ec3d2ac935686684c95fe79bbf309a to your computer and use it in GitHub Desktop.
Save seamus65/66ec3d2ac935686684c95fe79bbf309a to your computer and use it in GitHub Desktop.
blueprint tutorial
blueprint:
name: Doorbell - Notify Alexa
description: "Make an announcement over Amazon Echo devices when the doorbell is pushed."
domain: automation
input:
doorbell:
name: Doorbell
description: This is the doorbell binary sensor
selector:
entity:
domain: binary_sensor
echo_device1:
name: First Alexa
description: The First Alexa device to make the announcement on. Make a comma seperated list to announce on multiple devices.
selector:
entity:
domain: media_player
echo_device2:
name: Second Alexa
description: The Second Alexa device to make the announcement on. Make a comma seperated list to announce on multiple devices.
selector:
entity:
domain: media_player
default: ""
echo_device3:
name: Third Alexa
description: The Third Alexa device to make the announcement on. Make a comma seperated list to announce on multiple devices.
selector:
entity:
domain: media_player
default: ""
echo_device4:
name: Fourth Alexa
description: The Fourth Alexa device to make the announcement on. Make a comma seperated list to announce on multiple devices.
selector:
entity:
domain: media_player
default: ""
echo_device5:
name: Fifth Alexa
description: The Fifth Alexa device to make the announcement on. Make a comma seperated list to announce on multiple devices.
selector:
entity:
domain: media_player
default: ""
announcement_volume:
name: Announcement Volume
description: The volume the Alexa devices will be changed to for the announcement. Set to zero (0) for no change.
default: 0.5
selector:
number:
min: 0
max: 1
step: 0.1
mode: slider
repeat_after:
name: Repeat Timer
description: Set a time delay to repeat the message. Set to zero (0) for no repeat.
default: 0
selector:
number:
min: 0
max: 10
step: 1
mode: slider
message:
name: Message (Optional)
description: 'Default: "There is Somebody at the Door!"'
default: There is Somebody at the Door
source_url: https://gist.github.com/seamus65/66ec3d2ac935686684c95fe79bbf309a
mode: single
variables:
echo_device1: !input echo_device1
echo_device2: !input echo_device2
echo_device3: !input echo_device3
echo_device4: !input echo_device4
echo_device5: !input echo_device5
inputs:
"{% if (echo_device1 and echo_device2 and echo_device3 and echo_device4 and echo_device5) %}
{{ echo_device1 }}, {{ echo_device2 }}, {{ echo_device3 }}, {{ echo_device4 }}, {{ echo_device5 }}
{% elif (echo_device1 and echo_device2 and echo_device3 and echo_device4) %}
{{ echo_device1 }}, {{ echo_device2 }}, {{ echo_device3 }}, {{ echo_device4 }}
{% elif (echo_device1 and echo_device2 and echo_device3) %}
{{ echo_device1 }}, {{ echo_device2 }}, {{ echo_device3 }}
{% elif (echo_device1 and echo_device2) %}
{{ echo_device1 }}, {{ echo_device2 }}
{% elif (echo_device1) %}
{{ echo_device1 }}
{% endif %}"
volume1: "{% if (echo_device1) %} {{ state_attr(echo_device1, 'volume_level') }} {% endif %}"
volume2: "{% if (echo_device2) %} {{ state_attr(echo_device2, 'volume_level') }} {% endif %}"
volume3: "{% if (echo_device3) %} {{ state_attr(echo_device3, 'volume_level') }} {% endif %}"
volume4: "{% if (echo_device4) %} {{ state_attr(echo_device4, 'volume_level') }} {% endif %}"
volume5: "{% if (echo_device5) %} {{ state_attr(echo_device5, 'volume_level') }} {% endif %}"
announcement_volume: !input announcement_volume
repeat_after: !input repeat_after
trigger:
- platform: state
entity_id: !input "doorbell"
from: "off"
to: "on"
action:
- choose:
- conditions:
- condition: and
conditions:
- condition: template
value_template: "{{ announcement_volume > 0 }}"
- condition: template
value_template: "{{ echo_device1 != '' }}"
- condition: template
value_template: "{{ echo_device2 != '' }}"
- condition: template
value_template: "{{ echo_device3 != '' }}"
- condition: template
value_template: "{{ echo_device4 != '' }}"
- condition: template
value_template: "{{ echo_device5 != '' }}"
- condition: template
value_template: "{{ repeat_after > 0 }}"
sequence:
- service: media_player.volume_set
data:
volume_level: !input announcement_volume
target:
entity_id: "{{ inputs }}"
- delay: 0.5
- service: notify.alexa_media
data:
target: "{{ inputs }}"
message: !input message
data:
type: tts
- delay: !input repeat_after
- service: notify.alexa_media
data:
target: "{{ inputs }}"
message: !input message
data:
type: tts
- delay: 3
- service: media_player.volume_set
data:
volume_level: "{{ volume1 }}"
target:
entity_id: "{{ echo_device1 }}"
- delay: 0.5
- service: media_player.volume_set
data:
volume_level: "{{ volume2 }}"
target:
entity_id: "{{ echo_device2 }}"
- delay: 0.5
- service: media_player.volume_set
data:
volume_level: "{{ volume3 }}"
target:
entity_id: "{{ echo_device3 }}"
- delay: 0.5
- service: media_player.volume_set
data:
volume_level: "{{ volume4 }}"
target:
entity_id: "{{ echo_device4 }}"
- delay: 0.5
- service: media_player.volume_set
data:
volume_level: "{{ volume5 }}"
target:
entity_id: "{{ echo_device5 }}"
- conditions:
- condition: and
conditions:
- condition: template
value_template: "{{ announcement_volume > 0 }}"
- condition: template
value_template: "{{ echo_device1 != '' }}"
- condition: template
value_template: "{{ echo_device2 != '' }}"
- condition: template
value_template: "{{ echo_device3 != '' }}"
- condition: template
value_template: "{{ echo_device4 != '' }}"
- condition: template
value_template: "{{ repeat_after > 0 }}"
sequence:
- service: media_player.volume_set
data:
volume_level: !input announcement_volume
target:
entity_id: "{{ inputs }}"
- delay: 0.5
- service: notify.alexa_media
data:
target: "{{ inputs }}"
message: !input message
data:
type: tts
- delay: !input repeat_after
- service: notify.alexa_media
data:
target: "{{ inputs }}"
message: !input message
data:
type: tts
- delay: 3
- service: media_player.volume_set
data:
volume_level: "{{ volume1 }}"
target:
entity_id: "{{ echo_device1 }}"
- delay: 0.5
- service: media_player.volume_set
data:
volume_level: "{{ volume2 }}"
target:
entity_id: "{{ echo_device2 }}"
- delay: 0.5
- service: media_player.volume_set
data:
volume_level: "{{ volume3 }}"
target:
entity_id: "{{ echo_device3 }}"
- delay: 0.5
- service: media_player.volume_set
data:
volume_level: "{{ volume4 }}"
target:
entity_id: "{{ echo_device4 }}"
- conditions:
- condition: and
conditions:
- condition: template
value_template: "{{ announcement_volume > 0 }}"
- condition: template
value_template: "{{ echo_device1 != '' }}"
- condition: template
value_template: "{{ echo_device2 != '' }}"
- condition: template
value_template: "{{ echo_device3 != '' }}"
- condition: template
value_template: "{{ repeat_after > 0 }}"
sequence:
- service: media_player.volume_set
data:
volume_level: !input announcement_volume
target:
entity_id: "{{ inputs }}"
- delay: 0.5
- service: notify.alexa_media
data:
target: "{{ inputs }}"
message: !input message
data:
type: tts
- delay: !input repeat_after
- service: notify.alexa_media
data:
target: "{{ inputs }}"
message: !input message
data:
type: tts
- delay: 3
- service: media_player.volume_set
data:
volume_level: "{{ volume1 }}"
target:
entity_id: "{{ echo_device1 }}"
- delay: 0.5
- service: media_player.volume_set
data:
volume_level: "{{ volume2 }}"
target:
entity_id: "{{ echo_device2 }}"
- delay: 0.5
- service: media_player.volume_set
data:
volume_level: "{{ volume3 }}"
target:
entity_id: "{{ echo_device3 }}"
- conditions:
- condition: and
conditions:
- condition: template
value_template: "{{ announcement_volume > 0 }}"
- condition: template
value_template: "{{ (echo_device1 != '') }}"
- condition: template
value_template: "{{ (echo_device2 != '') }}"
- condition: template
value_template: "{{ repeat_after > 0 }}"
sequence:
- service: media_player.volume_set
data:
volume_level: !input announcement_volume
target:
entity_id: "{{ inputs }}"
- delay: 0.5
- service: notify.alexa_media
data:
target: "{{ inputs }}"
message: !input message
data:
type: tts
- delay: !input repeat_after
- service: notify.alexa_media
data:
target: "{{ inputs }}"
message: !input message
data:
type: tts
- delay: 3
- service: media_player.volume_set
data:
volume_level: "{{ volume1 }}"
target:
entity_id: "{{ echo_device1 }}"
- delay: 0.5
- service: media_player.volume_set
data:
volume_level: "{{ volume2 }}"
target:
entity_id: "{{ echo_device2 }}"
- conditions:
- condition: and
conditions:
- condition: template
value_template: "{{ announcement_volume > 0 }}"
- condition: template
value_template: "{{ echo_device1 != '' }}"
- condition: template
value_template: "{{ repeat_after > 0 }}"
sequence:
- service: media_player.volume_set
data:
volume_level: !input announcement_volume
target:
entity_id: "{{ inputs }}"
- delay: 0.5
- service: notify.alexa_media
data:
target: "{{ inputs }}"
message: !input message
data:
type: tts
- delay: !input repeat_after
- service: notify.alexa_media
data:
target: "{{ inputs }}"
message: !input message
data:
type: tts
- delay: 3
- service: media_player.volume_set
data:
volume_level: "{{ volume1 }}"
target:
entity_id: "{{ echo_device1 }}"
- conditions:
- condition: and
conditions:
- condition: template
value_template: "{{ announcement_volume > 0 }}"
- condition: template
value_template: "{{ echo_device1 != '' }}"
- condition: template
value_template: "{{ echo_device2 != '' }}"
- condition: template
value_template: "{{ echo_device3 != '' }}"
- condition: template
value_template: "{{ echo_device4 != '' }}"
- condition: template
value_template: "{{ echo_device5 != '' }}"
sequence:
- service: media_player.volume_set
data:
volume_level: !input announcement_volume
target:
entity_id: "{{ inputs }}"
- delay: 0.5
- service: notify.alexa_media
data:
target: "{{ inputs }}"
message: !input message
data:
type: tts
- delay: 3
- service: media_player.volume_set
data:
volume_level: "{{ volume1 }}"
target:
entity_id: "{{ echo_device1 }}"
- delay: 0.5
- service: media_player.volume_set
data:
volume_level: "{{ volume2 }}"
target:
entity_id: "{{ echo_device2 }}"
- delay: 0.5
- service: media_player.volume_set
data:
volume_level: "{{ volume3 }}"
target:
entity_id: "{{ echo_device3 }}"
- delay: 0.5
- service: media_player.volume_set
data:
volume_level: "{{ volume4 }}"
target:
entity_id: "{{ echo_device4 }}"
- delay: 0.5
- service: media_player.volume_set
data:
volume_level: "{{ volume5 }}"
target:
entity_id: "{{ echo_device5 }}"
- conditions:
- condition: and
conditions:
- condition: template
value_template: "{{ announcement_volume > 0 }}"
- condition: template
value_template: "{{ echo_device1 != '' }}"
- condition: template
value_template: "{{ echo_device2 != '' }}"
- condition: template
value_template: "{{ echo_device3 != '' }}"
- condition: template
value_template: "{{ echo_device4 != '' }}"
sequence:
- service: media_player.volume_set
data:
volume_level: !input announcement_volume
target:
entity_id: "{{ inputs }}"
- delay: 0.5
- service: notify.alexa_media
data:
target: "{{ inputs }}"
message: !input message
data:
type: tts
- delay: 3
- service: media_player.volume_set
data:
volume_level: "{{ volume1 }}"
target:
entity_id: "{{ echo_device1 }}"
- delay: 0.5
- service: media_player.volume_set
data:
volume_level: "{{ volume2 }}"
target:
entity_id: "{{ echo_device2 }}"
- delay: 0.5
- service: media_player.volume_set
data:
volume_level: "{{ volume3 }}"
target:
entity_id: "{{ echo_device3 }}"
- delay: 0.5
- service: media_player.volume_set
data:
volume_level: "{{ volume4 }}"
target:
entity_id: "{{ echo_device4 }}"
- conditions:
- condition: and
conditions:
- condition: template
value_template: "{{ announcement_volume > 0 }}"
- condition: template
value_template: "{{ echo_device1 != '' }}"
- condition: template
value_template: "{{ echo_device2 != '' }}"
- condition: template
value_template: "{{ echo_device3 != '' }}"
sequence:
- service: media_player.volume_set
data:
volume_level: !input announcement_volume
target:
entity_id: "{{ inputs }}"
- delay: 0.5
- service: notify.alexa_media
data:
target: "{{ inputs }}"
message: !input message
data:
type: tts
- delay: 3
- service: media_player.volume_set
data:
volume_level: "{{ volume1 }}"
target:
entity_id: "{{ echo_device1 }}"
- delay: 0.5
- service: media_player.volume_set
data:
volume_level: "{{ volume2 }}"
target:
entity_id: "{{ echo_device2 }}"
- delay: 0.5
- service: media_player.volume_set
data:
volume_level: "{{ volume3 }}"
target:
entity_id: "{{ echo_device3 }}"
- conditions:
- condition: and
conditions:
- condition: template
value_template: "{{ announcement_volume > 0 }}"
- condition: template
value_template: "{{ (echo_device1 != '') }}"
- condition: template
value_template: "{{ (echo_device2 != '') }}"
sequence:
- service: media_player.volume_set
data:
volume_level: !input announcement_volume
target:
entity_id: "{{ inputs }}"
- delay: 0.5
- service: notify.alexa_media
data:
target: "{{ inputs }}"
message: !input message
data:
type: tts
- delay: 3
- service: media_player.volume_set
data:
volume_level: "{{ volume1 }}"
target:
entity_id: "{{ echo_device1 }}"
- delay: 0.5
- service: media_player.volume_set
data:
volume_level: "{{ volume2 }}"
target:
entity_id: "{{ echo_device2 }}"
- conditions:
- condition: and
conditions:
- condition: template
value_template: "{{ announcement_volume > 0 }}"
- condition: template
value_template: "{{ echo_device1 != '' }}"
sequence:
- service: media_player.volume_set
data:
volume_level: !input announcement_volume
target:
entity_id: "{{ inputs }}"
- delay: 0.5
- service: notify.alexa_media
data:
target: "{{ inputs }}"
message: !input message
data:
type: tts
- delay: 3
- service: media_player.volume_set
data:
volume_level: "{{ volume1 }}"
target:
entity_id: "{{ echo_device1 }}"
default:
- service: notify.alexa_media
data:
target: "{{ inputs }}"
message: !input message
data:
type: tts
- delay: !input repeat_after
- service: notify.alexa_media
data:
target: "{{ inputs }}"
message: !input message
data:
type: tts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment