Repeated tasks under the action part of an automation seem to be a quite common, although complicated, task to script. An example would be to blink a light on and off or to switch between two colors of a light x times. The most basic way of doing this would be to copy the on/off parts x times in the automation. A more advanced way seem to be to make two scripts, and have them call the other script at the end of each of these. Both of these seem to be quite cumbersome solutions to an often occurring task in HA.
Would it be possible to add ‘loop’ as a method in an automation/script? For example like this to repeat the corresponding tasks five times:
action: loop: 5 - service: light.turn_on entity_id: light.livingroom - service: light.turn_off entity_id: light.livingroom
Perhaps also with the possible addition of a condition to the loop, which will break the loop if no longer met:
action: loop: 100 - condition: numeric_state entity_id: sensor.temperature below: '4' - service: light.turn_on entity_id: light.livingroom - service: light.turn_off entity_id: light.livingroom
My apologies if a request for this feature already exists, but I could not find one.