Are you just looking for how to create virtual switches now? Or are you looking for a routine to do the locking?
Here’s the FAQ on virtual switches in the new architecture:
If you’re asking about routines/automations to replace something that went away, see the following
Replace Groovy with Automations—what’s your plan?