Best way to program physical switches for Always Powered lighting setup?

Does anyone have any Blueprints or examples of how to best program my physical switch logic for supporting always-powered lights? Here’s what I am working with:

  • My switches are IOTTY which are cloud-based
  • My lights are Tuya
  • When the switch is flipped, I have an automation to turn the lights on or off based on the switch state

Unfortunately, due to the cloud delays, if you tap the switch rapidly, Home Assistant starts bugging out and going on a loop, eventually crashing.

What is the best way to handle my switches? Thanks!