#How do I check to see if a to-do list item is checked?

1 messages · Page 1 of 1 (latest)

robust ridge
#

I have a to-do list with an item named "test". If this item is not checked by 10:00am, I want an automation to change the color of a light. What's the best way of going about this?

I have added this script: https://community.home-assistant.io/t/todo-list-check-if-an-item-exists/635275/6 but I have no idea how to check what it returns in an automation to achieve what I'm going for above

forest ether
#
alias: Todo Check
triggers:
  - trigger: time
    at: "10:00:00"
conditions: []
actions:
  - variables:
      todo_list_entity: todo.test
      item_name: Taxes
  - action: todo.get_items
    data:
      status: needs_action
    target:
      entity_id: "{{ todo_list_entity }}"
    response_variable: todo_response
  - condition: template
    value_template: >
      {{ todo_response[todo_list_entity]['items'] | selectattr('summary', 'search', item_name) | list | count > 0 }}
  - action: notify.your_phone
    data:
      message: Task hasn't been checked off yet!
mode: single
#

I put the stuff you might want to change into the variables action just to make it easier. And then you'll want to delete that last action and replace it with changing the color of your light

#

you might also want to ignore case when searching for the item; if so the value template would be modified like this:

    value_template: >
      {{ todo_response[todo_list_entity]['items'] | selectattr('summary', 'search', item_name, ignorecase=True) | list | count > 0 }}
robust ridge
#

thank you so much! this worked perfectly. only issue I'm running into is that if I check off the task in Google Tasks instead of HA, it won't recognize it as being completed until after it polls 30 minutes later https://www.home-assistant.io/integrations/google_tasks#data-updates

it's not a huge deal, but is there any way I can have this integration poll more often than just every 30 minutes?

Home Assistant

Instructions on how to use Google Tasks in Home Assistant.