Someone know why i can’t visualise my icons on the list?
Got message:
todoist-card.js?hacstag=xxx:256 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading ‘attributes’)
at HTMLElement.getCardSize (todoist-card.js?hacstag=xxxx:256)
at i (c0f67be7.js:4594)
at HTMLElement.value (76a58ed6.js:937)
@Grinstantin thanks for your work on this card its brilliant. It allows me to simply sync my alexa shopping list to todoist . I was working for ages to link the Alexa shopping to the native shoping list , but this is much simpler.
I have added a second template sensor to extract the todoist list info a simple list which just hold the outstanding list and the number of items in the list.
shop_list:
value_template: >
{{state_attr("sensor.to_do_list","items")|length}}
attribute_templates:
list: >
{% set ns=namespace(list = []) %}
{% for items in state_attr("sensor.to_do_list","items") %}
{% set ns.list = ns.list + [items.content] %}
{% endfor %}
{{ns.list}}
I then use this sensor in a script to send the list via email in nice printable form.
email_shopping_list:
sequence:
- service: notify.gmail
data:
title: Shopping List
message: Your current shopping list contains {{states("sensor.shop_list")}}
items :- {{ '\n' -}}{{ '\n' -}} {% for items in state_attr("sensor.shop_list","list")
%}{{items}}{{ '\n' -}}{% endfor %} {{ '\n' -}} Remember to update the
shopping list on Alexa when complete.
mode: single
alias: Email shopping list
@lonebaggie Thanks for sharing your template sensor…I must be doing something wrong because I keep receive a configuration error when I place it in my .configuration.yaml file. I receive the following when I check the config before rebooting:
Invalid config for [sensor.template]: expected a dictionary for dictionary value @ data[‘sensors’][‘shop_list’][‘attribute_templates’]. Got None
extra keys not allowed @ data[‘sensors’][‘shop_list’][‘list’]. Got ‘{% set ns=namespace(list = []) %} {% for items in state_attr(“sensor.to_do_list”,“items”) %}\n {% set ns.list = ns.list + [items.content] %}\n{% endfor %} {{ns.list}} \n\n \n’. (See ?, line ?).
Here is what I pasted in:
- platform: template
sensors:
shop_list:
value_template: >
{{state_attr("sensor.to_do_list","items")|length}}
attribute_templates:
list: >
{% set ns=namespace(list = []) %}
{% for items in state_attr("sensor.to_do_list","items") %}
{% set ns.list = ns.list + [items.content] %}
{% endfor %}
{{ns.list}}
Can’t thank everyone enough for this card! It’s been a game changer here in the family! I do have another question, is there any sort of HA service that can add or delete all items from the list?
I would love to create an automation that counts how many times the dishwasher has ran and add some new soap pods to the list automatically or be able to create a webhook to clear the list after we are done shopping (my wife wants nothing to do with adding the HA app on her phone…so I have a script that texts her the list)…Again, thanks for all the effort on this great card!
It would be great if the “Quick Add” functionality (See: Sync API Reference | Todoist Developer ) would be used when adding new entries through the card (since the natural language scheduling would work!) Thanks for a great card!
Say nothing more…I can’t even begin to imagine what you and your family are dealing with right now. It times like these that make the rest of us take time to put things into perspective. I appreciate all you’ve done and wish you and your fellow countryman nothing but the best. Stay safe.
Been looking for a “to do” list card for ages and this one is fantastic, thanks for your hard work.
Being a bit new to the YAML, would someone be able to post the code to show multiple lists? Ive created another project, but not sure how to edit the YAML to make a second sensor
@Grinstantin I really love your great work on this card, been looking for this since a long time.
Hope you and your family are safe over there…
I was wondering if there is any way to create different lists (so different rest sensors) filtering out on certain Todoist labels ? I use those labels to identify who of the family needs to perform a task, so would be nice I could create seperate lists in HA.
Finally implemented your request - there is new option use_quick_add (disabled by default). It automatically appends “#YourProjectName” to request, so new tasks will be added to the selected project, but I haven’t tested this with project names that contain spaces or special characters.
New release contains breaking changes, so you need to update your configuration.
@GeertV, thank you for the kind words. Todoist Sync API doesn’t have “label” filter, REST API has it, but I can’t get it to work. The problem is that HA REST Sensor integration writes a response to the sensor value (and not to its attributes), which is limited to 255 characters. We can work around this limitation by using Todoist Sync API since its response is an object, and we can put parts of it to the sensor attributes using json_attributes parameter. But, for now, I can’t figure out how to do the same thing with Todoist REST API response since it’s an array.
You can try to create a template sensor which will filter “main” sensor attributes. But there is another problem - I’m not sure that Jinja2 has something like “contains” test ("[A, B, C] contains A?"). It has “in” test (“is A in [A, B, C]?”), but that’s not quite what we need. There is another way to do this if you use only one label for each task - using selectattr filter and eq test. Or I can add label filtering to the card in the next release.
Thanks for all this work and info.
Template sensor was indeed one of my ideas, but can’t figure out how to make this…
I will only have 1 label on each task, what is your idea with selectattr ?
Replace LABEL with name of your label. Make sure you’re using 9th version of Todoist API (.../sync/v9/... in configuration.yaml, two occurrences). If I’m not mistaken, version 8 returns the label IDs instead of their names. In this case you need to use