Sort To-Do Lists

Shopping List has the ability to sort alphabetically. But, To-do lists do not.

It would be great if we can choose sort by name, sort by date or no sort (sort manually as it is now) and of course sort direction. I’m using todos for daily notes, but newest at the bottom is not optimal and every new just moving at top manually also not good.

Since the recent refactorings not anymore, right?

Update: I just realized the shopping_list.sort service action is still there and works as expected. There’s just no UI for this. Thus, I simply created an automation to always sort the shopping list after being edited:

alias: Sort shopping list alphabetically
description: ""
trigger:
  - platform: event
    event_type: shopping_list_updated
condition: []
action:
  - service: shopping_list.sort
    metadata: {}
    data:
      reverse: false
mode: single

Regardless of the above, I totally support this feature request!

Just spent a while searching and am rather surprised that you can’t sort the lists. I thought I just couldnt get it figured out.
So yeah another vote to be able to sort the lists.
Both the to do AND the completed.
For example a shopping list with many completed items that will be reused…would be nice to sort to be able to find something in the completed list to put back on the shopping list.

1 Like

Even better if there is Priority field added to To-Do item, and we can sort by that. That way you could have calendars synced from WebDav (NextCloud for example) sorted properly, too.

This is a good idea, but your automation needs a tweak in order to avoid an endless loop. This is because calling the shopping_list.sort action will fire a shopping_list_updated event itself, which will trigger the automation again and fire another event.

You can fix this by adding a filter to your trigger so that it only triggers in response to an item being added to the shopping list and ignores a sort action.

alias: "Sort shopping list alphabetically"
description: ""
trigger:
  - platform: event
    event_type: shopping_list_updated
    event_data:
      action: add
condition: []
action:
  - data:
      reverse: false
    action: shopping_list.sort
mode: single
1 Like