How to stop repeat function when focus mode is turned off

Hello, I have an automation that is set to turn on when I turn on a focus mode. When it turns on it is set to repeat for a long time (on purpose because I want it to run until the focus mode is turned off. Can someone show me how this is done?

This is what I have and I have it so enable I enable my focus mode it turns on. But I need it to a turn off once the focus mode is disabled. I have the wait set to 10 seconds for testing.

Please help. I think I need a code or something I just don’t know what to do.

How long are you talking about?

Do keep in mind that the OS will terminate background Shortcuts activity after a while.

Also what is it you are trying to “do” *exactly? *I assume playing a beep is just a test and not what you actually want to do - otherwise I would just suggest triggering an audio track to play when you enable the focus mode and to to stop it when you enable any of your other focus modes.