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”
The remove_item service fires the following event:
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.
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.