What’s so advanced about it? Copy the example to your system and use it. It’s far better than diddling with delays and scripts to create a clumsy version of looping.
If you need help using the suggested python_script, let us know and we’ll walk you through it.
Your example works great after some minor modification. Unfortunately I have found that my light sources need 10 seconds between commands which makes a small step ramp-up of brightness very time consuming, especially if multiple lights are included.
Another question; if I want to do this for say five lights in one automation, do I need to write two scrips per light according to your example or are there better ways not to repeat code over and over? Send the identity ID to the script through template?