I’m having a bit of trouble sending a notification using a template from multiple todo list entities. I’ve got the following so far but it only adds item from the first list defined. I’ve scoured everywhere I can think of and tried lots of different variations but still can’t get it to work! Any pointers?
alias: File Daily Summary
description: ""
triggers:
- trigger: time
at: "05:30:00"
conditions: []
actions:
- variables:
task_entities:
- todo.tasks
- todo.weekly_reminders
- todo.aquarium
notify_entity: notify.file
enabled: true
- action: todo.get_items
data:
status: needs_action
target:
entity_id: "{{ task_entities }}"
response_variable: tasks_today
- action: notify.send_message
data:
message: |-
{{ "Tasks due:" }}
{%- set ns = namespace(tasks=[]) %}
{%- set ns.tasks = tasks_today.values()| list %}
{%- for task in ns.tasks[0]['items'] -%}
{%- set due = task['due']| as_datetime | as_local %}
{%- if due <= today_at("23:59") %}
- {{ task['summary']}}
{%- endif -%}
{%- endfor -%}
target:
entity_id: "{{ notify_entity }}"
mode: single
I’m looking to end up with the following:
Tasks due:
- task1 from list1
- task2 from list1
- task1 from list2
etc.
Thanks in advance!
EDIT: The due section of the message is because one of the todo lists has weekly recurring items, and i only want to show items due that day or overdue!