Last active
March 25, 2024 18:35
-
-
Save andrew-codechimp/3fe6863ea7addf939ec80f786cda9093 to your computer and use it in GitHub Desktop.
Home Assistant Play Notifications
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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