Skip to content

Instantly share code, notes, and snippets.

@andrew-codechimp
Last active March 25, 2024 18:35
Show Gist options
  • Save andrew-codechimp/3fe6863ea7addf939ec80f786cda9093 to your computer and use it in GitHub Desktop.
Save andrew-codechimp/3fe6863ea7addf939ec80f786cda9093 to your computer and use it in GitHub Desktop.
Home Assistant Play Notifications
alias: Assist - Play Notifications
description: Play notifications list
trigger:
- platform: conversation
command:
- (What are my|Play [my]) notifications
condition: []
action:
- service: todo.get_items
target:
entity_id: todo.notifications
data:
status: needs_action
response_variable: mylist
- set_conversation_response: >
{% set list_notifications = mylist['todo.notifications']['items'] |
map(attribute='summary') %} {% if mylist['todo.notifications']['items']
| list | count | int == 0 %}
You have no notifications.
{% elif mylist['todo.notifications']['items'] | list | count | int > 1 %}
You have {{mylist['todo.notifications']['items'] | list | count }} notifications.
{% else %}
You have {{mylist['todo.notifications']['items'] | list | count }} notification.
{% endif %} {% for vm in list_notifications %}
{{ vm }},
{% endfor %}
- repeat:
sequence:
- service: todo.remove_item
metadata: {}
data:
item: |
{{ repeat.item.summary }}
target:
entity_id: todo.notifications
for_each: |
{{ mylist['todo.notifications']['items'] | list }}
mode: single
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment