Skip to content

Instantly share code, notes, and snippets.

@andersonimes
Last active October 11, 2024 20:39
Show Gist options
  • Save andersonimes/1a7aa4771c4ab994a0b95822abdde7f5 to your computer and use it in GitHub Desktop.
Save andersonimes/1a7aa4771c4ab994a0b95822abdde7f5 to your computer and use it in GitHub Desktop.
Blueprint for a Home Assistant voicemail automation for Technithusiast
blueprint:
name: Voicemail Reminder Automation
description: If you have uncompleted items on a to-do list when occupancy is detected, announce it on a speaker.
domain: automation
input:
occupancy_sensor:
name: Occupancy Binary Sensor
description: You can use any sensor as an occupancy sensor as long as it's a binary sensor
selector:
entity:
filter:
- domain: binary_sensor
todo_voicemail:
name: Urgent Todo List
description: Select the todo list that contains items you want read to you
selector:
entity:
filter:
- domain: todo
announce_player:
name: Media Player
description: What device do you want your todo items read to you on?
selector:
entity:
filter:
- domain: media_player
announcement_volume:
name: Announcement Volume
description: Set the volume of the device used for announcements
default: 0.4
selector:
number:
min: 0.00
max: 1.00
step: 0.05
mode: slider
variables:
voicemail_name: !input todo_voicemail
trigger:
- platform: state
entity_id:
- !input occupancy_sensor
from: null
to: "On"
condition:
- condition: template
value_template: "{{ states(voicemail_name) | int > 0 }}"
action:
- service: scene.create
metadata: {}
data:
scene_id: tempscene
snapshot_entities:
- !input announce_player
- service: media_player.volume_set
metadata: {}
data:
volume_level: !input announcement_volume
target:
entity_id: !input announce_player
- service: todo.get_items
target:
entity_id: !input todo_voicemail
data:
status: needs_action
response_variable: the_todos
- service: tts.cloud_say
metadata: {}
data:
cache: false
message: >
{% set list_voicemail = the_todos[voicemail_name]['items'] |
map(attribute='summary') %}
You have {{the_todos[voicemail_name]['items'] | list | count }}
{% if the_todos[voicemail_name]['items'] | list | count | int > 1 %}
messages.
{% else %}
message.
{% endif %}
{% for vm in list_voicemail %}
{{ loop.index }}: {{ vm }}
{% endfor %}
End of messages.
entity_id: !input announce_player
- wait_for_trigger:
- platform: state
entity_id:
- !input announce_player
from: null
to: idle
- service: scene.turn_on
metadata: {}
target:
entity_id: scene.tempscene
mode: single
@Anon666333
Copy link

Hi! I don't know if you can do pull requests on a repository....but I've amended to your blueprint and thought I'd share.

blueprint:
  name: Voicemail Reminder Automation
  description: If you have uncompleted items on a to-do list when occupancy is detected,
    announce it on a speaker.
  domain: automation
  input:
    occupancy_sensor:
      name: Occupancy Binary Sensor
      description: You can use any sensor as an occupancy sensor as long as it's a
        binary sensor
      selector:
        entity:
          filter:
          - domain:
            - binary_sensor
          multiple: false
    todo_voicemail:
      name: Urgent Todo List
      description: Select the todo list that contains items you want read to you
      selector:
        entity:
          filter:
          - domain:
            - todo
          multiple: false
    announce_player:
      name: Media Player
      description: What device do you want your todo items read to you on?
      selector:
        entity:
          filter:
          - domain:
            - media_player
          multiple: false
    announcement_volume:
      name: Announcement Volume
      description: Set the volume of the device used for announcements
      default: 0.4
      selector:
        number:
          min: 0.0
          max: 1.0
          step: 0.05
          mode: slider
    intro_message:
      name: Intro Message
      description: The words to be used before voicemail items are listed
      default: ' '
      selector:
        select:
          options:
          - Good morning
          - Good afternoon
          - Good evening
          multiple: true
          custom_value: true
    random_intro:
      name: Randomize Intro Message
      description: You can choose to have the intro message randomally chosen to spice up the message every time you hear it!
      default: true
      selector:
        boolean: {}          
  source_url: https://gist.github.com/andersonimes/1a7aa4771c4ab994a0b95822abdde7f5
variables:
  voicemail_name: !input todo_voicemail
  intro_variable: !input intro_message
  intro_random: '{{ intro_variable | list | random }}'
  intro_list: '{{ intro_variable | list }}'
  random: !input random_intro
trigger:
- platform: state
  entity_id:
  - !input occupancy_sensor
  from:
  to: 'on'
condition:
- condition: template
  value_template: '{{ states(voicemail_name) | int > 0 }}'
action:
- service: scene.create
  metadata: {}
  data:
    scene_id: tempscene
    snapshot_entities:
    - !input announce_player
- service: media_player.volume_set
  metadata: {}
  data:
    volume_level: !input announcement_volume
  target:
    entity_id: !input announce_player
- service: todo.get_items
  target:
    entity_id: !input todo_voicemail
  data:
    status: needs_action
  response_variable: the_todos
- service: tts.amazon_polly_say
  metadata: {}
  data:
    cache: false
    message: "{% set list_voicemail = the_todos[voicemail_name]['items'] | map(attribute='summary')
      %} {% if random == true %}\n {{intro_random}} \n{% else %}\n {{intro_list}}\n {% endif %} you have {{the_todos[voicemail_name]['items'] | list | count }}    {% if
      the_todos[voicemail_name]['items'] | list | count | int > 1 %}\n  items that need your attention.\n{%
      else %}\n  item that needs your attention.\n{% endif %}  {% for vm in list_voicemail %}\n  {{ loop.index
      }}: {{ vm }}\n{% endfor %}   End of messages.\n"
    entity_id: !input announce_player
- wait_for_trigger:
  - platform: state
    entity_id:
    - !input announce_player
    from:
    to: idle
- service: scene.turn_on
  metadata: {}
  target:
    entity_id: scene.tempscene
mode: single

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment