Delay and Then Repeat Automation If Certain Condition Exists

I’m in need of some help in a certain area… I have the following automations:

  • bathroom_off_2300.yaml - If bathroom light is off, turn bathroom light on to 3%, wait 3 seconds, then turn it off.

  • bathroom_sunrise.yaml - If bathroom light is off, turn bathroom light on to 100%, wait 3 seconds, then turn if off.

What I’d like to do is to setup the automations such that if the light is on, the automation is delayed until the light is turned off, then run the automation. Any ideas on how I can achieve this?