I have this rest sensor here:
- platform: rest
name: ToDoist Activities Completed
resource: https://api.todoist.com/sync/v8/activity/get?page=0&event_type=completed
value_template: '{{ value_json.count }}'
method: POST
json_attributes:
- events
headers:
Authorization: Bearer MYTOKEN
It lists all completed Tasks from my ToDoist List in the actual week. The attributes gives all completed Tasks in a list, so this here
{% for x in states.sensor.todoist_activities_completed.attributes.events %} {{ loop.index }}. {{ x.extra_data.content }} {% endfor %}
would give back
- Cleaning kitchen
- Home Assistant
- Shopping
for example. I want to create a new template sensor that changes the state every time a new item was added. The thing is if I would add another three items in a shorter time then the scan interval of the rest sensor, the state would change to the third, last added item, but I want to have a sensor that “sees” that three new items where added, and for each new item, the state changes - Is that possible?