Can’t loop per se, but using the virtual switch and an accumulated timer, you can get a similar effect. I do this to announce that a door or gate is open every 15 minutes until the door/gate sensor closes.
First, install the Edge Timer Utility found here and create a timer with the appropriate time interval. Next create Routines:
If Switch on (pre-condition)
Virtual Switch Turns on
Turn on light
Delay 15 seconds
Turn off Light
Turn on timer
If Virtual Switch on (pre-condition)
Switch on (pre-condition)
Timer duration equal or above 15 seconds
Turn on light
Delay 15 seconds
Turn off Light
Reset timer
If Virtual Switch turns off
Turn off timer