Thanks for this as well works great for me.
Don’t suppose you know how to make it a persistent notification with a done button that marks the list complete.
I have a few similar notifications with buttons but they are all done through Node red but I want to try them with the automations instead.
No such thing. There are no actions for a persistent notification.
I wrote that wrong I meant a actionable notification that is persistent.
I think I’ve figured it out now I’ve got the notification to be persistent I’m going to set up the action part later when I’m on my laptop.
Thanks
Just piping in here because this took me a while to figure out (I’m pretty low-level) and this thread helped me a lot. (Thank you @jazzyisj ! )
Specifically, to reference specific items in the list I went with
variables:
Output: "{{ TList['todo.test_list']['items'][-1]['summary'] }}"
Where “Tlist” is the output of the todo.get_tasks call. Grabs the last (newest) item in the list. For checked or unchecked this is the last thing to be changed. Using this in an automation that updates the house group in Teams whenever someone changes the chore and shopping lists. To get the oldest item in the list swap out [-1] for [0]
Is there a way to get the output into a Dashboard Card? I am replacing Google Keep and i want to permanently list the ToDo Action in the Dhasboard.
I think the docs need to be updated, I don’t see the Todo card listed, but it is a thing.
Try this or you can configure the ToDo card in the dashboard edit UI.
type: todo-list
title: Jason Tasks
entity: todo.jasons_tasks
thanks thats exactly what i was looking for
I didn’t find any examples, I’ll add them as an addition to your code. There will be another option
If you use the code that you specified, then the list will go in one line in the message
{%- for item in mylist['todo.hass_ideas']['items'] %}
{{ item.summary }}
{%- endfor %}
I wanted the list in the message to be not in one line, but in a column.
message: >
{% set shop_list = shopping_list['todo.shopping_list']['items'] %}
{%- for item in shop_list -%}
- {{ item.summary ~ "\n" }}
{%- endfor -%}
Probably a newbie question : How to get only the 1st element/item in the todo list ?
How to get only the 1st element/item in the todo list ?
test:
sequence:
- service: todo.get_items
target:
entity_id: todo.hass_ideas
response_variable: mylist
- service: persistent_notification.create
data:
title: "First Item"
message: >
{% if mylist['todo.hass_ideas']['items'][0] is defined %}
{{ mylist['todo.hass_ideas']['items'][0]['summary'] }}
{% endif %}
continue_on_error: true
Thank you all for the inputs! But I’m having some problems, when i run it it only sends a message “agenda.to” with each letter on an own row:
alias: "Test: todo"
description: ""
trigger: []
condition: []
action:
- service: todo.get_items
target:
entity_id: todo.kvantum_apotek
response_variable: mylist
- service: system_log.write
data:
message: >
{% set shop_list = shopping_list['todo.kvantum_apotek']['items'] %}
{%- for item in shop_list -%}
- {{ item.summary ~ "\n" }}
{%- endfor -%}
- service: notify.mobile_app_samsung_s22
data:
title: Daily agenda for {{ now().date() }}
message: >-
Your agenda for today: <p> </p>
{% for itmes in "agenda.todo.kvantum_apotek" %} {{ items }}
{{itmes.summary}} <br> {% endfor %}
mode: single
What have i done wrong?!
Thank you in advance
You used the non working example above.
It should be something like
message: >
Your agenda for today:
{%- for item in mylist['todo.kvantum_apotek']['items'] %}
{{ item.summary }}
{%- endfor %}
if todo.kvantum_apotek is really your entity.
Thank you for the reply!
Sorry, forgot to write that I have tried Jasons and DivanX10s solution and i get the same outcome. Mistakenly pasted an old copy
alias: "Test: todo"
description: ""
trigger: []
condition: []
action:
- service: todo.get_items
target:
entity_id: todo.kvantum_apotek
response_variable: mylist
- service: system_log.write
data:
message: >
{% set shop_list = shopping_list['todo.kvantum_apotek']['items'] %}
{%- for item in shop_list -%}
- {{ item.summary ~ "\n" }}
{%- endfor -%}
mode: single
Yes it is
not sure why you try to create new array (shop_list).
sure this doesn’t work?
alias: "Test: todo"
description: ""
trigger: []
condition: []
action:
- service: todo.get_items
target:
entity_id: todo.kvantum_apotek
response_variable: mylist
- service: system_log.write
data:
message: >
{%- for item in mylist['todo.kvantum_apotek']['items'] -%}
- {{ item.summary ~ "\n" }}
{%- endfor -%}
mode: single
When i wrote my post i had been awake for 23h I thought i understood a little, but now with a clear head I think I understand nothing
I’m trying to get the same outcome as the thread maker, get a message with the items in one of my lists. Does system_log.write
send the list? How does it know where to send it
Sorry, I’m still a beginner and unlucky in thinking
system_log.write
writes into the system log, see here.
The OP used a notification to get notified.
I got it working. I guess why I was so confused was how I should implement Jasons solution into OP’s code. But i figured that out, but it was still not working. The fault was a -
(dash) after message: >
alias: "!Test todo"
description: ""
trigger: []
condition: []
action:
- service: todo.get_items
target:
entity_id: todo.kvantum_apotek
response_variable: mylist
- service: notify.mobile_app_samsung_s22
data:
title: Daily agenda for {{ now().date() }}
message: >
Your agenda for today: <p> </p>
{%- for item in mylist['todo.kvantum_apotek']['items'] %}
{{ item.summary }}
{%- endfor %}
mode: single
Thank you for your help and effort!
Hello everyone,
I’m trying to use automation. Unfortunately I always get the error message:
“Error rendering data template: UndefinedError: ‘mylist’ is undefined”
Do I have to create the “response_variable” somewhere or is it created automatically?
alias: Shoppinglist
description: ""
trigger:
- platform: zone
entity_id: device_tracker.fordpass_tracker_2
zone: zone.einkaufen_aldi
event: enter
id: "1"
condition: []
action:
- service: todo.get_items
target:
entity_id: todo.aldi
response_variable: mylist
data:
status:
- needs_action
- service: notify.hassio808_bot
data:
title: Daily agenda for {{ now().date() }}
message: |
Your agenda for today: <p> </p>
{%- for item in mylist['todo.aldi']['items'] %}
{{ item.summary }}
{%- endfor %}
mode: single
It is created at that moment.
As a first guess: does the entity_id todo.aldi exist under that name?
Is there a way to get the individual tasks to add to my news ticker when they are due? I tried adding sensor.todo_home_assistant_list_task_1 to
- type: custom:html-card
content: |
<div class="ticker-wrap">
<div class="ticker">
<div class="ticker">
<span class="ticker__item" style="color: #39FF14;">Ragweed Pollen Index: [[ sensor.toronto_ragweed_pollen_day_0 ]]</span>
<span class="ticker__item" style="color: #39FF14;">Grass Pollen Index: [[ sensor.toronto_grass_pollen_day_0 ]]</span>
<span class="ticker__item" style="color: #39FF14;">Tree Pollen Index: [[ sensor.toronto_tree_pollen_day_0 ]]</span>
<span class="ticker__item" style="text-transform: uppercase; color: #00E7FF; font-weight: bold;">Forecast: </span>
<span class="ticker__item" style="color: white;">[[ sensor.toronto_summary ]]</span>
<span class="ticker__item" style="text-transform: uppercase; color: #00E7FF; font-weight: bold;">In the news today: </span>
<span class="ticker__item" style="color: white;">
[[ sensor.ctv_news_politics_attributes_0 ]]
<img src="/local/lovelace/overlays/Round Menu/4/CTV News8.png" alt="logo" style="height: 20px; vertical-align: middle;">
</span>
<span class="ticker__item" style="color: white;">
[[ sensor.cbs_news_top_stories_attributes_0 ]]
<img src="/local/lovelace/overlays/Round Menu/4/CBS News2.png" alt="logo" style="height: 20px; vertical-align: middle;">
</span>
<span class="ticker__item" style="text-transform: uppercase; color: #00E7FF; font-weight: bold;">To-Do List: </span>
<span class="ticker__item" style="color: white;">
[[ sensor.todo_home_assistant_list_task_1 ]]
</span>
<span class="ticker__item" style="color: white;">
[[ sensor.todo_list_task_2 ]]
</span>
<span class="ticker__item" style="color: white;">
[[ sensor.todo_home_assistant_list_task_2 ]]
</span>
</div>
</div>
the ticker works, as it did before, however when it gets to the tasks, the sensor name is all that goes across my screen, not the actual task. Is there a different way to label the sensor names other than adding _task_1 or _task_2 at the end of the list’s sensor name?
Any help is most appreciated. Thanks you kindly