Iterate objects with key and value
When using the repeat:
command in automations, you can specify two placeholders separated by a comma in the as:
option (key, value
) and they will be set with the respective key and value of each item.
-
start: set: data: 0: label: Red 1: label: Green 2: label: Blue repeat: each@key: data as: index, obj do: log: Index: {{index}} Value: {{obj.label}}
-