Check if To Do list is Empty

Hello,

I have an automation that I think can be easily simplified. The automation searches my to do list for specific unfinished tasks and then flips a helper if there were any that matched. But then I realized I ended up using the automation more generally. There must be an easier way then searching for each task to see if the list is empty. Is there a way to check if there are any unfinished tasks in a To Do list not just a specific task?

Thank you in advance,

alias: "To Do List: Before Bed Check (Dan)"
description: ""
trigger: []
condition: []
action:
  - service: input_boolean.turn_off
    target:
      entity_id: input_boolean.unfinished_daily_tasks
    data: {}
  - service: todo.get_items
    target:
      entity_id: todo.before_bed
    data:
      status: needs_action
    response_variable: todo
  - if:
      - condition: template
        value_template: >-
          {{
          todo['todo.before_bed']['items']|selectattr('summary','search','Make
          Bed')|list|count > 0 }}
    then:
      - service: input_boolean.turn_on
        target:
          entity_id: input_boolean.unfinished_daily_tasks
        data: {}
  - if:
      - condition: template
        value_template: >-
          {{
          todo['todo.before_bed']['items']|selectattr('summary','search','Roberto:
          Empty Bin')|list|count > 0 }}
    then:
      - service: input_boolean.turn_on
        target:
          entity_id: input_boolean.unfinished_daily_tasks
        data: {}
  - if:
      - condition: template
        value_template: >-
          {{
          todo['todo.before_bed']['items']|selectattr('summary','search','Fill
          Humidifiers')|list|count > 0 }}
    then:
      - service: input_boolean.turn_on
        target:
          entity_id: input_boolean.unfinished_daily_tasks
        data: {}
  - alias: Scoop Litter Box
    if:
      - condition: template
        value_template: >-
          {{
          todo['todo.before_bed']['items']|selectattr('summary','search','Scoop
          Litter Box')|list|count > 0 }}
    then:
      - service: input_boolean.turn_on
        target:
          entity_id: input_boolean.unfinished_daily_tasks
        data: {}
  - if:
      - condition: template
        value_template: >-
          {{
          todo['todo.before_bed']['items']|selectattr('summary','search','Dishes')|list|count
          > 0 }}
    then:
      - service: input_boolean.turn_on
        target:
          entity_id: input_boolean.unfinished_daily_tasks
        data: {}
  - if:
      - condition: template
        value_template: >-
          {{ todo['todo.before_bed']['items']|selectattr('summary','search','Set
          Up Plata')|list|count > 0 }}
    then:
      - service: input_boolean.turn_on
        target:
          entity_id: input_boolean.unfinished_daily_tasks
        data: {}
  - if:
      - condition: template
        value_template: >-
          {{ todo['todo.before_bed']['items']|selectattr('summary','search','Add
          water to Urn')|list|count > 0 }}
    then:
      - service: input_boolean.turn_on
        target:
          entity_id: input_boolean.unfinished_daily_tasks
        data: {}
  - if:
      - condition: template
        value_template: >-
          {{ todo['todo.before_bed']['items']|selectattr('summary','search','Run
          Garbage Disposal')|list|count > 0 }}
    then:
      - service: input_boolean.turn_on
        target:
          entity_id: input_boolean.unfinished_daily_tasks
        data: {}
  - if:
      - condition: template
        value_template: >-
          {{
          todo['todo.before_bed']['items']|selectattr('summary','search','Clean
          From Shabbat')|list|count > 0 }}
    then:
      - service: input_boolean.turn_on
        target:
          entity_id: input_boolean.unfinished_daily_tasks
        data: {}
  - if:
      - condition: template
        value_template: >-
          {{
          todo['todo.before_bed']['items']|selectattr('summary','search','Open
          Mail')|list|count > 0 }}
    then:
      - service: input_boolean.turn_on
        target:
          entity_id: input_boolean.unfinished_daily_tasks
        data: {}
  - if:
      - condition: template
        value_template: >-
          {{
          todo['todo.before_bed']['items']|selectattr('summary','search','Fold
          Laundry')|list|count > 0 }}
    then:
      - service: input_boolean.turn_on
        target:
          entity_id: input_boolean.unfinished_daily_tasks
        data: {}
  - if:
      - condition: template
        value_template: >-
          {{ todo['todo.before_bed']['items']|selectattr('summary','search','Put
          Away Sous Vide')|list|count > 0 }}
    then:
      - service: input_boolean.turn_on
        target:
          entity_id: input_boolean.unfinished_daily_tasks
        data: {}
  - if:
      - condition: template
        value_template: >-
          {{ todo['todo.before_bed']['items']|selectattr('summary','search','Put
          Away Plata')|list|count > 0 }}
    then:
      - service: input_boolean.turn_on
        target:
          entity_id: input_boolean.unfinished_daily_tasks
        data: {}
  - if:
      - condition: template
        value_template: >-
          {{ todo['todo.before_bed']['items']|selectattr('summary','search','Cat
          Food')|list|count > 0 }}
    then:
      - service: input_boolean.turn_on
        target:
          entity_id: input_boolean.unfinished_daily_tasks
        data: {}
  - if:
      - condition: template
        value_template: >-
          {{
          todo['todo.before_bed']['items']|selectattr('summary','search','Fill
          Seltzer Bottles')|list|count > 0 }}
    then:
      - service: input_boolean.turn_on
        target:
          entity_id: input_boolean.unfinished_daily_tasks
        data: {}
  - if:
      - condition: template
        value_template: >-
          {{
          todo['todo.before_bed']['items']|selectattr('summary','search','Roberto:
          Clean Floor')|list|count > 0 }}
    then:
      - service: input_boolean.turn_on
        target:
          entity_id: input_boolean.unfinished_daily_tasks
        data: {}
  - if:
      - condition: template
        value_template: >-
          {{
          todo['todo.before_bed']['items']|selectattr('summary','search','Roberto:
          Clean Filters')|list|count > 0 }}
    then:
      - service: input_boolean.turn_on
        target:
          entity_id: input_boolean.unfinished_daily_tasks
        data: {}
  - if:
      - condition: template
        value_template: >-
          {{
          todo['todo.before_bed']['items']|selectattr('summary','search','Empty
          Small Trash (Bathroom, Office, Bedroom)')|list|count > 0 }}
    then:
      - service: input_boolean.turn_on
        target:
          entity_id: input_boolean.unfinished_daily_tasks
        data: {}
  - if:
      - condition: template
        value_template: >-
          {{
          todo['todo.before_bed']['items']|selectattr('summary','search','Cat:
          Replace Water Bowl')|list|count > 0 }}
    then:
      - service: input_boolean.turn_on
        target:
          entity_id: input_boolean.unfinished_daily_tasks
        data: {}
  - if:
      - condition: template
        value_template: >-
          {{
          todo['todo.before_bed']['items']|selectattr('summary','search','Confirm
          Wake up Time ')|list|count > 0 }}
    then:
      - service: input_boolean.turn_on
        target:
          entity_id: input_boolean.unfinished_daily_tasks
        data: {}
  - if:
      - condition: template
        value_template: >-
          {{
          todo['todo.before_bed']['items']|selectattr('summary','search','Wipe
          Counter with old Sponges')|list|count > 0 }}
    then:
      - service: input_boolean.turn_on
        target:
          entity_id: input_boolean.unfinished_daily_tasks
        data: {}
  - if:
      - condition: template
        value_template: >-
          {{
          todo['todo.before_bed']['items']|selectattr('summary','search','Replace
          Kippah')|list|count > 0 }}
    then:
      - service: input_boolean.turn_on
        target:
          entity_id: input_boolean.unfinished_daily_tasks
        data: {}
  - if:
      - condition: template
        value_template: >-
          {{
          todo['todo.before_bed']['items']|selectattr('summary','search','Replace
          Towel')|list|count > 0 }}
    then:
      - service: input_boolean.turn_on
        target:
          entity_id: input_boolean.unfinished_daily_tasks
        data: {}
  - if:
      - condition: template
        value_template: >-
          {{
          todo['todo.before_bed']['items']|selectattr('summary','search','Hang
          Talis Bag')|list|count > 0 }}
    then:
      - service: input_boolean.turn_on
        target:
          entity_id: input_boolean.unfinished_daily_tasks
        data: {}
  - if:
      - condition: template
        value_template: >-
          {{
          todo['todo.before_bed']['items']|selectattr('summary','search','Count
          the Omar')|list|count > 0 }}
    then:
      - service: input_boolean.turn_on
        target:
          entity_id: input_boolean.unfinished_daily_tasks
        data: {}
mode: single
alias: "To Do List: Before Bed Check (Dan)"
description: ""
trigger: []
condition: []
action:
  - service: input_boolean.turn_off
    target:
      entity_id: input_boolean.unfinished_daily_tasks
    data: {}
  - service: todo.get_items
    target:
      entity_id: todo.before_bed
    data:
      status: needs_action
    response_variable: todo
  - if:
      - condition: template
        value_template: >-
          {{
          todo['todo.before_bed']['items']|selectattr('summary','search','Make
          Bed')|list|count > 0 }}
    then:
      - service: input_boolean.turn_on
        target:
          entity_id: input_boolean.unfinished_daily_tasks
        data: {}
  - if:
      - condition: template
        value_template: >-
          {{
          todo['todo.before_bed']['items']|selectattr('summary','search','Roberto:
          Empty Bin')|list|count > 0 }}
    then:
      - service: input_boolean.turn_on
        target:
          entity_id: input_boolean.unfinished_daily_tasks
        data: {}
  - if:
      - condition: template
        value_template: >-
          {{
          todo['todo.before_bed']['items']|selectattr('summary','search','Fill
          Humidifiers')|list|count > 0 }}
    then:
      - service: input_boolean.turn_on
        target:
          entity_id: input_boolean.unfinished_daily_tasks
        data: {}
  - alias: Scoop Litter Box
    if:
      - condition: template
        value_template: >-
          {{
          todo['todo.before_bed']['items']|selectattr('summary','search','Scoop
          Litter Box')|list|count > 0 }}
    then:
      - service: input_boolean.turn_on
        target:
          entity_id: input_boolean.unfinished_daily_tasks
        data: {}
  - if:
      - condition: template
        value_template: >-
          {{
          todo['todo.before_bed']['items']|selectattr('summary','search','Dishes')|list|count
          > 0 }}
    then:
      - service: input_boolean.turn_on
        target:
          entity_id: input_boolean.unfinished_daily_tasks
        data: {}
  - if:
      - condition: template
        value_template: >-
          {{ todo['todo.before_bed']['items']|selectattr('summary','search','Set
          Up Plata')|list|count > 0 }}
    then:
      - service: input_boolean.turn_on
        target:
          entity_id: input_boolean.unfinished_daily_tasks
        data: {}
  - if:
      - condition: template
        value_template: >-
          {{ todo['todo.before_bed']['items']|selectattr('summary','search','Add
          water to Urn')|list|count > 0 }}
    then:
      - service: input_boolean.turn_on
        target:
          entity_id: input_boolean.unfinished_daily_tasks
        data: {}
  - if:
      - condition: template
        value_template: >-
          {{ todo['todo.before_bed']['items']|selectattr('summary','search','Run
          Garbage Disposal')|list|count > 0 }}
    then:
      - service: input_boolean.turn_on
        target:
          entity_id: input_boolean.unfinished_daily_tasks
        data: {}
  - if:
      - condition: template
        value_template: >-
          {{
          todo['todo.before_bed']['items']|selectattr('summary','search','Clean
          From Shabbat')|list|count > 0 }}
    then:
      - service: input_boolean.turn_on
        target:
          entity_id: input_boolean.unfinished_daily_tasks
        data: {}
  - if:
      - condition: template
        value_template: >-
          {{
          todo['todo.before_bed']['items']|selectattr('summary','search','Open
          Mail')|list|count > 0 }}
    then:
      - service: input_boolean.turn_on
        target:
          entity_id: input_boolean.unfinished_daily_tasks
        data: {}
  - if:
      - condition: template
        value_template: >-
          {{
          todo['todo.before_bed']['items']|selectattr('summary','search','Fold
          Laundry')|list|count > 0 }}
    then:
      - service: input_boolean.turn_on
        target:
          entity_id: input_boolean.unfinished_daily_tasks
        data: {}
  - if:
      - condition: template
        value_template: >-
          {{ todo['todo.before_bed']['items']|selectattr('summary','search','Put
          Away Sous Vide')|list|count > 0 }}
    then:
      - service: input_boolean.turn_on
        target:
          entity_id: input_boolean.unfinished_daily_tasks
        data: {}
  - if:
      - condition: template
        value_template: >-
          {{ todo['todo.before_bed']['items']|selectattr('summary','search','Put
          Away Plata')|list|count > 0 }}
    then:
      - service: input_boolean.turn_on
        target:
          entity_id: input_boolean.unfinished_daily_tasks
        data: {}
  - if:
      - condition: template
        value_template: >-
          {{ todo['todo.before_bed']['items']|selectattr('summary','search','Cat
          Food')|list|count > 0 }}
    then:
      - service: input_boolean.turn_on
        target:
          entity_id: input_boolean.unfinished_daily_tasks
        data: {}
  - if:
      - condition: template
        value_template: >-
          {{
          todo['todo.before_bed']['items']|selectattr('summary','search','Fill
          Seltzer Bottles')|list|count > 0 }}
    then:
      - service: input_boolean.turn_on
        target:
          entity_id: input_boolean.unfinished_daily_tasks
        data: {}
  - if:
      - condition: template
        value_template: >-
          {{
          todo['todo.before_bed']['items']|selectattr('summary','search','Roberto:
          Clean Floor')|list|count > 0 }}
    then:
      - service: input_boolean.turn_on
        target:
          entity_id: input_boolean.unfinished_daily_tasks
        data: {}
  - if:
      - condition: template
        value_template: >-
          {{
          todo['todo.before_bed']['items']|selectattr('summary','search','Roberto:
          Clean Filters')|list|count > 0 }}
    then:
      - service: input_boolean.turn_on
        target:
          entity_id: input_boolean.unfinished_daily_tasks
        data: {}
  - if:
      - condition: template
        value_template: >-
          {{
          todo['todo.before_bed']['items']|selectattr('summary','search','Empty
          Small Trash (Bathroom, Office, Bedroom)')|list|count > 0 }}
    then:
      - service: input_boolean.turn_on
        target:
          entity_id: input_boolean.unfinished_daily_tasks
        data: {}
  - if:
      - condition: template
        value_template: >-
          {{
          todo['todo.before_bed']['items']|selectattr('summary','search','Cat:
          Replace Water Bowl')|list|count > 0 }}
    then:
      - service: input_boolean.turn_on
        target:
          entity_id: input_boolean.unfinished_daily_tasks
        data: {}
  - if:
      - condition: template
        value_template: >-
          {{
          todo['todo.before_bed']['items']|selectattr('summary','search','Confirm
          Wake up Time ')|list|count > 0 }}
    then:
      - service: input_boolean.turn_on
        target:
          entity_id: input_boolean.unfinished_daily_tasks
        data: {}
  - if:
      - condition: template
        value_template: >-
          {{
          todo['todo.before_bed']['items']|selectattr('summary','search','Wipe
          Counter with old Sponges')|list|count > 0 }}
    then:
      - service: input_boolean.turn_on
        target:
          entity_id: input_boolean.unfinished_daily_tasks
        data: {}
  - if:
      - condition: template
        value_template: >-
          {{
          todo['todo.before_bed']['items']|selectattr('summary','search','Replace
          Kippah')|list|count > 0 }}
    then:
      - service: input_boolean.turn_on
        target:
          entity_id: input_boolean.unfinished_daily_tasks
        data: {}
  - if:
      - condition: template
        value_template: >-
          {{
          todo['todo.before_bed']['items']|selectattr('summary','search','Replace
          Towel')|list|count > 0 }}
    then:
      - service: input_boolean.turn_on
        target:
          entity_id: input_boolean.unfinished_daily_tasks
        data: {}
  - if:
      - condition: template
        value_template: >-
          {{
alias: "To Do List: Before Bed Check (Dan)"
description: ""
trigger: []
condition: []
action:
  - service: input_boolean.turn_off
    target:
      entity_id: input_boolean.unfinished_daily_tasks
    data: {}
  - service: todo.get_items
    target:
      entity_id: todo.before_bed
    data:
      status: needs_action
    response_variable: todo
  - if:
      - condition: template
        value_template: >-
          {{
          todo['todo.before_bed']['items']|selectattr('summary','search','Make
          Bed')|list|count > 0 }}
    then:
      - service: input_boolean.turn_on
        target:
          entity_id: input_boolean.unfinished_daily_tasks
        data: {}
  - if:
      - condition: template
        value_template: >-
          {{
          todo['todo.before_bed']['items']|selectattr('summary','search','Roberto:
          Empty Bin')|list|count > 0 }}
    then:
      - service: input_boolean.turn_on
        target:
          entity_id: input_boolean.unfinished_daily_tasks
        data: {}
  - if:
      - condition: template
        value_template: >-
          {{
          todo['todo.before_bed']['items']|selectattr('summary','search','Fill
          Humidifiers')|list|count > 0 }}
    then:
      - service: input_boolean.turn_on
        target:
          entity_id: input_boolean.unfinished_daily_tasks
        data: {}
  - alias: Scoop Litter Box
    if:
      - condition: template
        value_template: >-
          {{
          todo['todo.before_bed']['items']|selectattr('summary','search','Scoop
          Litter Box')|list|count > 0 }}
    then:
      - service: input_boolean.turn_on
        target:
          entity_id: input_boolean.unfinished_daily_tasks
        data: {}
  - if:
      - condition: template
        value_template: >-
          {{
          todo['todo.before_bed']['items']|selectattr('summary','search','Dishes')|list|count
          > 0 }}
    then:
      - service: input_boolean.turn_on
        target:
          entity_id: input_boolean.unfinished_daily_tasks
        data: {}
  - if:
      - condition: template
        value_template: >-
          {{ todo['todo.before_bed']['items']|selectattr('summary','search','Set
          Up Plata')|list|count > 0 }}
    then:
      - service: input_boolean.turn_on
        target:
          entity_id: input_boolean.unfinished_daily_tasks
        data: {}
  - if:
      - condition: template
        value_template: >-
          {{ todo['todo.before_bed']['items']|selectattr('summary','search','Add
          water to Urn')|list|count > 0 }}
    then:
      - service: input_boolean.turn_on
        target:
          entity_id: input_boolean.unfinished_daily_tasks
        data: {}
  - if:
      - condition: template
        value_template: >-
          {{ todo['todo.before_bed']['items']|selectattr('summary','search','Run
          Garbage Disposal')|list|count > 0 }}
    then:
      - service: input_boolean.turn_on
        target:
          entity_id: input_boolean.unfinished_daily_tasks
        data: {}
  - if:
      - condition: template
        value_template: >-
          {{
          todo['todo.before_bed']['items']|selectattr('summary','search','Clean
          From Shabbat')|list|count > 0 }}
    then:
      - service: input_boolean.turn_on
        target:
          entity_id: input_boolean.unfinished_daily_tasks
        data: {}
  - if:
      - condition: template
        value_template: >-
          {{
          todo['todo.before_bed']['items']|selectattr('summary','search','Open
          Mail')|list|count > 0 }}
    then:
      - service: input_boolean.turn_on
        target:
          entity_id: input_boolean.unfinished_daily_tasks
        data: {}
  - if:
      - condition: template
        value_template: >-
          {{
          todo['todo.before_bed']['items']|selectattr('summary','search','Fold
          Laundry')|list|count > 0 }}
    then:
      - service: input_boolean.turn_on
        target:
          entity_id: input_boolean.unfinished_daily_tasks
        data: {}
  - if:
      - condition: template
        value_template: >-
          {{ todo['todo.before_bed']['items']|selectattr('summary','search','Put
          Away Sous Vide')|list|count > 0 }}
    then:
      - service: input_boolean.turn_on
        target:
          entity_id: input_boolean.unfinished_daily_tasks
        data: {}
  - if:
      - condition: template
        value_template: >-
          {{ todo['todo.before_bed']['items']|selectattr('summary','search','Put
          Away Plata')|list|count > 0 }}
    then:
      - service: input_boolean.turn_on
        target:
          entity_id: input_boolean.unfinished_daily_tasks
        data: {}
  - if:
      - condition: template
        value_template: >-
          {{ todo['todo.before_bed']['items']|selectattr('summary','search','Cat
          Food')|list|count > 0 }}
    then:
      - service: input_boolean.turn_on
        target:
          entity_id: input_boolean.unfinished_daily_tasks
        data: {}
  - if:
      - condition: template
        value_template: >-
          {{
          todo['todo.before_bed']['items']|selectattr('summary','search','Fill
          Seltzer Bottles')|list|count > 0 }}
    then:
      - service: input_boolean.turn_on
        target:
          entity_id: input_boolean.unfinished_daily_tasks
        data: {}
  - if:
      - condition: template
        value_template: >-
          {{
          todo['todo.before_bed']['items']|selectattr('summary','search','Roberto:
          Clean Floor')|list|count > 0 }}
    then:
      - service: input_boolean.turn_on
        target:
          entity_id: input_boolean.unfinished_daily_tasks
        data: {}
  - if:
      - condition: template
        value_template: >-
          {{
          todo['todo.before_bed']['items']|selectattr('summary','search','Roberto:
          Clean Filters')|list|count > 0 }}
    then:
      - service: input_boolean.turn_on
        target:
          entity_id: input_boolean.unfinished_daily_tasks
        data: {}
  - if:
      - condition: template
        value_template: >-
          {{
          todo['todo.before_bed']['items']|selectattr('summary','search','Empty
          Small Trash (Bathroom, Office, Bedroom)')|list|count > 0 }}
    then:
      - service: input_boolean.turn_on
        target:
          entity_id: input_boolean.unfinished_daily_tasks
        data: {}
  - if:
      - condition: template
        value_template: >-
          {{
          todo['todo.before_bed']['items']|selectattr('summary','search','Cat:
          Replace Water Bowl')|list|count > 0 }}
    then:
      - service: input_boolean.turn_on
        target:
          entity_id: input_boolean.unfinished_daily_tasks
        data: {}
  - if:
      - condition: template
        value_template: >-
          {{
          todo['todo.before_bed']['items']|selectattr('summary','search','Confirm
          Wake up Time ')|list|count > 0 }}
    then:
      - service: input_boolean.turn_on
        target:
          entity_id: input_boolean.unfinished_daily_tasks
        data: {}
  - if:
      - condition: template
        value_template: >-
          {{
          todo['todo.before_bed']['items']|selectattr('summary','search','Wipe
          Counter with old Sponges')|list|count > 0 }}
    then:
      - service: input_boolean.turn_on
        target:
          entity_id: input_boolean.unfinished_daily_tasks
        data: {}
  - if:
      - condition: template
        value_template: >-
          {{
          todo['todo.before_bed']['items']|selectattr('summary','search','Replace
          Kippah')|list|count > 0 }}
    then:
      - service: input_boolean.turn_on
        target:
          entity_id: input_boolean.unfinished_daily_tasks
        data: {}
  - if:
      - condition: template
        value_template: >-
          {{
          todo['todo.before_bed']['items']|selectattr('summary','search','Replace
          Towel')|list|count > 0 }}
    then:
      - service: input_boolean.turn_on
        target:
          entity_id: input_boolean.unfinished_daily_tasks
        data: {}
mode: single

Since you are already selecting for items that need action in the service call, you can check if there are any items with:

{{ todo['todo.before_bed']['items'] | list | count > 0 }}

or even more simply:

{{ todo['todo.before_bed']['items'] != [] }}

I think that it is working! Thank you!