Development is moving right along, and I can say I’m pretty much there (I’m just polishing things and adding some more features to the component).
I tried going the sensor route, but the more I thought about it, the more I realized that it’s actually a calendar component. Here’s a screenshot of what I’ve done so far (ignore my 40 billion tabs):
You can see that the start time for these calendar events is set to right now. I had to set it to something (the calendar component expects a date and time for things; go figure!), and the more I thought about it, the more I realized that really a task is something you could do now (in most cases). I could do my homework right now, or I could technically pay next month’s rent right now. I can’t do my midterm right now, but a good portion of the time, a task is something that you could do now – which is why I set the tasks to be starting right now, and ending when they’re due.
I can also only give full information about one event at a time – technically, I could display a giant JSON object in there, but none of the other HASS components do that, and ideally I’m trying to make something that could get accepted in a pull request. I wrote a little bit of logic to determine which event is the most important:
Completed events are disregarded; they’re complete.
Events without any due date are selected only if they’re the only things available. If there’s nothing in a project which has a due date, events without a due date will be selected based on their priority.
Events with a closer due date are selected first. If you have a priority 4 event due on the 15th and a priority 1 event due on the 16th, the priority 4 event takes precedence. The logic here is that you still have an extra day to do the priority 1 event if needed.
When 2 events are due on the same day, the higher-priority one comes first. If there’s a priority 4 event due at 12 PM and a priority 1 event due at 9 PM, the priority 1 event would be the one displayed.
If 2 events are due on the same day and have the same priority, the one due earlier in the day wins.
If a task without a due date is the task selected to be the “most important”, the “all_day” attribute gets set to “true”. Otherwise, it’s “false”.
As you can see, though, I did implement a “all tasks” array, which lists all the tasks due in a project. This array is sorted so that the ones which are more important are at the beginning, while the least-important tasks are at the end.
I’m looking to integrate an optional parameter in the configuration file which creates a new “calendar” that only looks at the next n days, where n is a number you specify. As an example, you could have a calendar which only takes into consideration all events due in the next 3 days. Another idea I have is to have an optional array of labels in the configuration file. Each label would get its own calendar, so if you wanted to have a reminder to (as an example) work on homework once you get home any time you have homework, you could. Most likely I’ll find a way to implement both of those together.
I haven’t tested it with overdue events yet, and I’m not sure what will happen, to be honest.
I’d also like to take a look at a project “blacklist” of some kind. Right now, there’s no way to specify that you don’t want to see a particular project at all, and things can get kind of cluttered if you use projects to organize other projects like I do. I don’t generate any new .yaml files or anything, so it would have to be set in the configuration file directly. Alternatively, I’m looking at implementing labels – maybe users can specify labels to blacklist?
Right now, there’s no support for actions. I haven’t even looked into doing anything for that yet; I want to get the actual sensor done first, then I can take a look at adding some actions.
I should hopefully have something up on GitHub in the next day or two. One thing that would be really hard would be listing all your most recent things you added to your to-do list; I don’t think I get that data from the API at all, so it would be guesswork, essentially. An easy thing to do would be to give day-of reminders for things that are due that day, or have your text-to-speech tell you everything you need to get done in a particular project. Note that I can only work on actual due dates, not Todoist reminders (although if it reminds you via email, you can get a sensor that detects that).
In the meantime, let me know if you have any ideas for things I can implement!