Start automation when any Todo-List item is completed

I want to play applause on my smart speaker whenever I completed an item on my todo list. :tada: You somehow need to motivate yourself, right? :upside_down_face:

How can I trigger such an automation?

Thank you for your assistance!

I donā€™t use this myself, but you have a lot of information on how to do it in the documentation To-do list - Home Assistant

Well, I did read the documentation before posting here. I could not find the answer to my question in it.

Have you looked at the entities that the integration provides and what status they give?

Every Todo list has the number of open tasks as its state. I need to trigger an automation whenever this number decreases by one. But how can I do this?

You could use a counter decrease trigger in your automation :slight_smile: You might need to create a counter helper (I use this to trigger my secondary robo vacuum when my primary has cleaned three times).

This works in your robo vacuum use case since in your example you trigger an automation when the counter reaches a certain number. But this could not be used to trigger an automation upon any decrease independent of the current value. Am I wrong?

Try looking into template sensors, I believe that should solve it. Iā€™m not an expert on template sensors so someone else could probably help you out if needed.

The basic way is to use a template condition:

trigger:
  - platform: state
    entity_id: todo.example
    not_from:
      - unavailable
    not_to:
      - unavailable
condition:
  - alias: Check if the new state is less than the old state
    condition: template
    value_template: "{{ trigger.to_state.state | int < trigger.from_state.state | int }}"
action:
  # Your Notification Actions

Just be aware that the example above will also fire if someone deletes an item that has the status ā€œneeds_actionā€. The other way to do it is with an Event trigger, but the way the ToDo-related events work leaves weird edge cases that would also falsely trigger your automationā€¦ so I donā€™t know if itā€™s worth the complication.

1 Like

Thank you, this works! :+1: I didnā€™t know about template conditions until now.