I do this personally:
trigger:
platform: template
value_template: >-
{{ is_state('switch.some_switch', 'on')
and now() >= today_at('06:30')
and now().minute % 30 == 0 and now().second == 0 }}
action:
service: switch.turn_on
data:
entity_id: switch.some_switch
Replace the some_switch
bit with whatever your condition is. Runs the automation at your specified time and then every half an hour for the rest of the day until the switch changes.
EDIT: OH “after x runs”, duh. I thought x meant an entity, like a retry loop to ensure an entity turns on