There is no built-in function like you ask for. HA smallest time interval is one second. You can basically create a timing loop utilizing two scripts but the results are less than you would hope for. Basically the way it would work is your automation would call the first script. It would turn the lights on, delay and then call the second script which would turn the lights off delay and call the first script again. It kind of works. Of course you would need a way of stopping the loop as well. You can search the forum and find implementation examples.