This used to update sensor.my_todo_list_items every time the state changed, but now it is updating the sensor only once an hour or at HA reset. Can anyone please help why the template is not triggered when the state of the todo.todo_list increases by 1 when adding a todo item? Thank you.
- trigger:
- platform: state
entity_id: todo.todo_list
- platform: time_pattern
hours: /1
- platform: homeassistant
event: start
action:
- service: todo.get_items
data:
status: needs_action
target:
entity_id: todo.to_do_list
response_variable: my_list
sensor:
- name: My To Do List Items
unique_id: my_todo_list_items
state: >
{{ now().isoformat() }}
attributes:
todo_items: >
{% set tdate = ((now().date()) + timedelta(days=3)) | string %}
{{ my_list['todo.to_do_list']['items']
| selectattr('due','defined')
| selectattr('due','<=',tdate)
| sort(false,attribute='due')
| map(attribute='summary')
| join("<br>")
}}