Executing action on multiple entities depending on its attributes

Hi there,

I have several window covers in my house which I want to position depending on the sun brightness and position (azimuth).
I found out that I can give custom attributes to my covers in configuration.yaml. This way, I can split the cover configuration from the actual rules being executed later:

homeassistant:
  customize:
    cover.cover1:
      azimuth_min: 100 # minimum azimuth to set cover position
      azimuth_max: 170 # maximum azimuth to set cover position
      target_position: 80 # target cover position
      excludes: 100 # don't change cover position if it is currently completely down

When programming (as pseudo code), I would do something like this:

for each cover in [cover1, cover2, cover3]:
  if sun.azimuth between cover.azimuth_min and cover.azimuth_max:
    if cover.current_position not in cover.exclude:
      cover.set_position(cover.target_position)

How can I achieve this in an automation? I couldn’t find something similar to a for loop, which iterates over all covers in a list (idealy in parallel, not sequentially).

Best regards,
Michael

How can a for-loop, which processes each list item in sequence, be able to “iterate” all of them in parallel?

Home Assistant’s scripting language offers repeat.