My Tuya-controlled lights retain their settings if you turn them on and off via Homey. Have you checked if yours do the same? If they do, you just need to detect the on/off state in the flow and either execute three off/on steps or three off/on steps depending on the state.
How do You determine if lights are on or off before the event starts?
After lights has “blinked” three times the last command is turn off the lamp?
And after that the lamp, if turned on before event, should be turned on again.
Or am I just overthinking this or missing something obvious?