I’m trying to iterate over all items from a todo list using a for each loop.
In the automation I use the get_items service and used the response variable “dummy”
Use the for-each repeat option and used “{{dummy}}” as the list.
However, this gives an error: Error: Repeat ‘for_each’ must be a list of items
The variable contains:
dummy:
todo.notifications:
items:
- summary: Test
uid: c230fe7c-9d0e-11ee-8a07-e63b88907365
status: needs_action
due: '2023-12-17T20:17:00+01:00'
description: Some long descrtiption
- summary: Test2
uid: ee5a735c-9d0e-11ee-8a07-e63b88907365
status: needs_action
due: '2023-12-17T20:18:00+01:00'
description: Some long descrtiption2
Let’s say I want an automation to announce every descrption using TTS from every item on the list that is due for today. I feel this must be possible, but I’m lacking the advanced skills here.
As you can see it is in fact not a list when you just pass {{ dummy }} because the service call can return multiple entities in one call - so you need to specify WHICH entity you want to use:
{{ dummy['todo.notifications']['items'] }}
That is the list.
{{ dummy }} and {{ dummy['todo.notifications'] }} are both dicts, because they contain another level below them. The list is the bit that starts - summary