I am trying to create a list of todo items that are due tomorrow or earlier, to be displayed with a markdown card In the template file when I hard code the date for the filter, it works. Doesn’t work when I substitute 2024-10-02 with the variable tdate. Thank you for any help
- trigger:
- platform: state
entity_id: todo.to_do_list
action:
- service: todo.get_items
data:
status: needs_action
target:
entity_id: todo.to_do_list
response_variable: my_list
sensor:
- name: My To Do List Items
unique_id: my_todo_list_items
state: "{{ now().isoformat() }}"
attributes:
todo_items: >
{% set tdate = (now().date()) + timedelta(days=1) %}
{{ my_list['todo.to_do_list']['items']
| selectattr('due','defined')
| selectattr('due','lt','2024-10-02')
| map(attribute='summary')
| list }}