There seems to be a minor bug in “Only show today or overdue”. If the task has a time of day set for the due date (as opposed to just “tuesday”) that is later than the current time, it will not get displayed.
I think it could be fixed by changing the following line:
return item.due && (+(new Date()) >= +(new Date(item.due.date)));
to:
return item.due && (+(new Date(new Date().setHours(24,0,0,0))) >= +(new Date(item.due.date)));
FYI…I figured out a work-around for my #1 request above. I just made a second sensor from the first. I guess this solution is probably obvious to the more experienced people here.
template:
- sensor:
- name: "General To-do List"
state: "{{ states('sensor.to_do_list') }}"
attributes:
items: >
{% set data = namespace(values=[]) %}
{% set value = [] %}
{% for item in state_attr('sensor.to_do_list','items') %}
{% if item.section_id == 51654132 %}
{% set data.values = data.values + [item] %}
{% endif %}
{% endfor %}
{{ data.values }}
There is probably a more efficient way to do the template, but templates & jinja (I could add yaml,json,…pretty much everything about home assistant) are new to me.
One more note for anybody looking to do something similar. I used “section_id” in the above since I am using cards in todoist. It could just as easily have been filtered by label or priority.
I messed around with how to display the due date too, but my html/css/js skills are so poor that I couldn’t figure out how to make the formatting look ok. Specifically, I couldn’t figure out how to display the date smaller and on the next line (below the item.content) without making a new row the same size as the existing row.
Again…many thanks for the great card.