Lovelace Custom Card: Todoist-List

Many thanks, friend. You’ve made me a happy little geek.

1 Like

Although this post was completely ignored (which is highly unusual when somebody asks “does anybody want new features?”, eh eh), I have made a lot of progress and will soon be releasing a Power-Todoist card (a fork from the current card) which adds a ton of features.

It’s highly configurable with practically all Todoist actions available from buttons that are fully customizable. You can add and remove labels, filter your tasks with a bunch of criteria, move tasks between sections and projects, etc.

Some of the stuff looks really cool, like a swiper-card to swipe between different Todoist sections, which is a nice way to get a working Kanban into HA.

I allow for a handful of variable substitutions, so I can filter the card with a “dynamic” label that is the user name, for example. With that, I can keep separate lists for separate HA users in a single Todoist managed centrally. Very powerful and practical.

2 Likes

I at least am looking forward to seeing this!

@pgr , another question for you, if you don’t mind.

I’ve got two Todoist accounts, and these tasks I’m currently trying to add to HA are on the account that wasn’t previously associated with HA. So I added this (as an example) to my configuration.yaml:

  - platform: rest
    name: Kitchen (Personal)
    method: GET
    resource: 'https://api.todoist.com/sync/v9/projects/get_data'
    params:
      project_id: xxxxxxxxxx
    headers:
      Authorization: !secret todoist_api_token2
    value_template: '{{ value_json[''project''][''id''] }}'
    json_attributes:
      - project
      - items
    scan_interval: 300

and then modified this:

rest_command:
  todoist:
    method: post
    url: 'https://api.todoist.com/sync/v9/{{ url }}'
    payload: '{{ payload }}'
    headers:
      Authorization: 
        - !secret todoist_api_token
        - !secret todoist_api_token2
    content_type: 'application/x-www-form-urlencoded'

and my secrets.yaml has the appropriate info for those 2 api tokens. This doesn’t seem to be the right way to do this, however, as when trying to check and restart, I get the following error:

Invalid config for [rest_command]: template value should be a string for dictionary value @ data['rest_command']['todoist']['headers']['Authorization']. Got ['Bearer xxxx', 'Bearer yyyyy']. (See /config/configuration.yaml, line 327).

Any suggestions on how to accomplish this? I mean I can always move these tasks over to the Todoist that IS connected to HA, but I’d prefer not to if I can help it.

Don’t put two secrets in one request.

You need to duplicate the entire rest_command section so that you have both a “todoist” and a “todoist2” rest commands, each with its own method, url, payload, secret, etc

1 Like

Perfect, that did the trick, and once I fixed the template in my automation to reflect that it was Todoist2, the button press completed the task. Huzzah!

You’re a hero, sir.

Ah heck, I spoke too soon.

The template code you provided didn’t just complete the task as done for that day, it marked it as done, period.

I just went looking for that task and it was nowhere to be seen.

Ideas?

In Todoist, there is an option to “show completed tasks”, turn that on.

Todoist only restarts tasks if you created them as recurring. To do this I think you need to create them with a “quick add” saying something like “Take medication every day”. These tasks will have a due date, and when you close them, instead of being marked as done, they get assigned a new due date for tomorrow.

I just noticed there are peculiarities for those tasks when completing them through the API. But they seem to provide a facilitated route which is the close_item command.

So try just changing that command type from item_complete to close_item, it should work for recurring tasks.

1 Like

Unfortunately, making this change doesn’t seem to have any effect on the tasks at all. I tried with one automation this morning to no avail, and just tried a few minutes ago with another automation, with the same results.

My bad - it’s item_close instead of close_item. I just tested it and it works.

Keep you eye on Todoist website when trying these things - first you need to get it operational there, only afterwards see if the todoist-card in HA is showing you what you want.

Yep, I had the Todoist app open on my phone. That did the trick, thank you. I can see that task in tomorrow’s list, so mission accomplished.

Very much appreciate your help - do you have a ko-fi or something I can donate to?

I’m glad to hear it’s working!

If you really want to buy me a coffee you can head over to my GitHub sponsorships page that I have for work related to another project. You can use the “one-time amount” option. I appreciate it, thanks. :+1:

1 Like

I know I’m probably late, but the thing I miss the most is the option to change the order of the items directly from the home assistant ui. Two arrows “up” and “down” would be enough, so that when the list is complete I can more or less order the items regarding the place in the shop where I know I’ll find them. I see that you can easily do this via Todoist website, while the only option in HA is to remove the items and add them in the correct order

Thank you, I look forward to seeing this!!

Hi. I’m afraid the ordering feature is not something that had even occurred to me yet. It should be possible (there’s a “reorder items” API function available), but it’s not the most straight-forward feature to build, requires a bit of work. I’ll make a note of it, but I don’t promise anything soon.

The rest of the stuff, I only get a few moments each week to advance this side-project, but it’s advancing. The code is good enough for an alpha version, I’ve put it on Github and I tried to get it approved for HACS but their tests are failing to even run. I don’t think their sample action files for Github workflows are even working, but I haven’t had time to ask them about it.

I still have to write a bit of Documentation, this isn’t usable without documentation, you have to know what to write in the YAML configuration files…

1 Like

Ok, so I released my first Alpha version today, please have a look and help me test.

@cosimop @chicknlil25

Have a look at the documentation on Github to see all the new options available :smiley:

2 Likes

@SPESINO you seem to be using PowerTodoist-card configurations.

This thread where we are now is for the original Todoist-card.

Head over to this one for PowerTodoist-card.

You can check if your sensors are correctly configured and pulling data in Developer Tools, States. When you got that right, then you can play with custom:powertodoist-card settings in a dashboard (not custom: todoist-card).

Please reply in the other thread, we shouldn’t hijack this one. Thanks.

Ok, thanks, i remove this.

Is this card still supported? I’m unable to add/delete any new items to the HA Card. It appears to work through Amazon Alexa but the Card just seems to hang. I received the follow log errors:

Logger: homeassistant.components.rest_command
Source: components/rest_command/init.py:136
Integration: RESTful Command (documentation, issues)
First occurred: 7:34:25 AM (7 occurrences)
Last logged: 7:38:24 AM
Error. Url: https://api.todoist.com/sync/v9/. Status code 404. Payload: b’’

Logger: homeassistant.helpers.template
Source: helpers/template.py:568
First occurred: 7:34:25 AM (14 occurrences)
Last logged: 7:38:23 AM
Template variable warning: ‘payload’ is undefined when rendering ‘{{ payload }}’
Template variable warning: ‘url’ is undefined when rendering ‘https://api.todoist.com/sync/v9/{{ url }}’

Logger: homeassistant.components.template.template_entity
Source: components/template/template_entity.py:424
Integration: Template (documentation, issues)
First occurred: September 9, 2023 at 9:35:49 PM (20 occurrences)
Last logged: 7:35:25 AM

I’m running the latest HA Build:
Home Assistant 2023.9.1
Supervisor 2023.08.3
Operating System 10.5
Frontend 20230908.0 - latest

I’m still searching the forum for the answer, but it looks like after the last update to HA ‘some’ of the custom cards don’t show anymore; I have an issue with my custom:grocy-chores-card at the moment; it shows fine in HACS but HA proper does not see that custom card. Other people have issues with other custom cards, but it does not seem to be consistent between cards on different installations.

1 Like