I find that ToDo items can persist large state (i.e. > 255 chars) and so are invaluable for certain automations, state machine operations, configurations.
(I also wanted to share this because there is so much old, misinformation out there to search, such as platform: template, and using conditions when they are not necessary, etc.. If you treat entity_id as a singleton instead of array, it won't match even if there's only one id.)
I use the following in my watchdogs to trigger when large state items change:
triggers:
- event_type: call_service
event_data:
domain: todo
service: update_item
service_data:
item: Switch States # my specific to do list item name
entity_id:
- todo.gallipot # my specific to do list name
trigger: event
conditions: []
actions:
- variables:
desc: "{{ trigger.event.data.service_data.description }}"
# the above captures the to do list description contents
# which I usually populate with pseudo json text
# and convert to json object for subsequent use as follows:
- variables:
descobj: |-
{{
desc |
regex_replace("([\+\-a-zA-Z0-9_\.\'\%\’]+)", "\"\\1\"") |
regex_replace("\" \"", " ") |
replace("'", '') |
from_json
}}
fyi, my pseudo json looks like this:
{ tapo_plug_d9b8_outlet: on, tapo_plug_0955_outlet: off }
(no quotes for anything).