I would like to create a loop to perform the same action multiple times. Is this possible in HA? If so, how?
You can do it with two scripts.
One does the work i.e. it does whatever you want the loop to do. Then the last thing it does is call another script which simply maintains a ‘loop index’ and then calls the first one again.
Maintain a ‘loop index’ between the two and have a suitable condition in either script to prevent it continuing when the limit is reached.