Use an Alexa Phrase to Toggle Device State?

Hello, I am attempting to use a single phrase with Alexa to both turn on and off devices.

For example: Currently the phrase, “Alexa, lights.” will turn on my lights. But I would like to use the same phrase “Alexa, lights.” and have the lights change state, in this case, change to off.

The only option I see within Alexa settings for personalized phrases that create a special use is to either be able to turn a device on or off but not change state from either on or off depending on the device’s current setting.

Create a virtual switch called “lights”.

If “lights” is on and “my lights” is on then turn off “lights” and turn off “my lights”
If “lights” is on and “my lights” is off, then turn off “lights” and turn on “my lights”

I haven’t put the logic into ST (I’m binging netflix) but I think that it should work.