Move incomplete items between todo lists

Here is a script to move incomplete items from one todo list to another.
It accepts as parameters the source and destination lists.

I can’t get the import blueprint link to work properly.
I keep getting errors when trying to import.
It says it can’t find a blueprint in the post although the code has yaml header, and other errors if I try to change the embedded code in different ways.
Any help would be appreciated.

Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.

todo_list_move_incomplete_items:
  fields:
    source_list:
      description: "Source list to copy from"
    dest_list:
      description: "Destination list to copy to"
  sequence:
    - service: todo.get_items
      data:
        status:
          - needs_action
      response_variable: items
      target:
        entity_id: "{{ source_list }}"
    - repeat:
        for_each: >
          {% set list_name = items.keys() | list %}
          {{ items[list_name[0]]['items'] }}
        sequence:
          - service: todo.add_item
            data:
              item: >
                {{ repeat.item.summary }}
            target:
              entity_id: "{{ dest_list }}"
          - service: todo.remove_item
            data:
              item: >
                {{ repeat.item.summary }}
            target:
              entity_id: "{{ source_list }}"

Example usage with 2 buttons to move items back and forth between 2 lists:

  • type: custom:stack-in-card
    mode: horizontal
    cards:
    • type: custom:mushroom-template-card
      icon: mdi:chevron-right
      tap_action:
      action: call-service
      service: script.todo_list_move_incomplete_items
      service_data:
      source_list: todo.shopping_list
      dest_list: todo.another_list
    • type: custom:mushroom-template-card
      icon: mdi:chevron-left
      tap_action:
      action: call-service
      service: script.todo_list_move_incomplete_items
      service_data:
      source_list: todo.another_list
      dest_list: todo.shopping_list
4 Likes

This is great, thank you @tidharmor! I’m using this script to transfer items from Google Keep to Todoist, which allows me to add back functionality which Google previously took away: “Hey Google, add X to my todo/shopping list” and having it show up in Todoist.

Here’s my setup: