Not sure exactly what you mean? The SmartApp clip that I posted could, indeed, be linked to a preference to trigger from a Virtual Switch.
The timing of the “flash” is likely to be somewhat more reliable if done inside a custom version of the light switch’s Device Handler, though, using the
delayBetween() method, as per above example. Managing custom device handlers is a bit more complicated that attaching a SmartApp, of course.