Thanks to @Casper and pointing out that I should be doing createEvent and sendEvent with “switch” because that’s the capability of this device and automation/other-apps look for that state not “mainswitch” like I had. Anyway the code has been updated with a simplified way of allowing voice control to run against either the main switch or optionally ON will toggle main switch while the OFF voice command will toggle the custom switch.
BTW, check out @Casper’s IR project with an ESP8266 using this same technique to do an HTTP GET to that tiny wifi Arduino-like board… super-cool implementation and I’ll be messing with a lot more of this for the few buttons on each remote control that are either too far from my lazy reach or lost in the dark. More importantly, I’m looking for Alexa controlled. I bugged him to put this project/post up because it’s way too cool of a project, thanks for doing that buddy and making it easier for a quick start when the toys get here.