How to send notification when item added to a Todo list?

I am trying to “reverse engineer” what @Didgeridrew has done so exploring what happened when you add an item by using the “events” under “Developer tools”

Seeing that the add_item service results in:

What you see in the script
image

uses trigger.event. plus the structure form the event:

The remove_item service fires the following event:
image

So I take it with some modifications to @Didgeridrew code, you can achieve what you want.

For now I am not able to find how do you know that e.g. you need the | title in:
trigger.event.data.service_data.item | title so I am not really in the position to give you the answer.

I am as eager to hear the answer in anyone can provide it.

Apologies for not being of much help.

1 Like
trigger:
  - platform: event
    event_type: call_service
    event_data:
      domain: todo
      service: update_item
    variables:
      list_name: |
        {{ state_attr((trigger.event.data.service_data.entity_id)[0], 'friendly_name') }}
      item: "{{ trigger.event.data.service_data.rename }}"
condition:
  - alias:  Check if event is in the desired todo list
    condition: template
    value_template: "{{ list_name == 'Shopping List' }}"
  - alias:  Check if event is for completing a todo
    condition: template
    value_template: "{{ trigger.event.data.service_data.status == 'completed' }}"
action:
...

AFAIK, there isn’t an event posted when you add a calendar event through the UI, but if it is done through a service call to calendar.create_event, that can be used as a trigger in the same general manner.

The filter title just changes the output string to title case i.e. “this is an example” is returned as “This Is An Example”. It is not functionally necessary, it just looks better.

3 Likes

Thank you so much! This is really such an amazing automation and variation.

I wonder if you have a generalised automation for recurving upcoming calendar events that you use and would be happy to share?

It would be best for you to start a new thread with a specific description of the calendar automation you have in mind.

1 Like