I'm emulating Belkin WeMo instead for my lights with a raspberry pi. No Amazon dev account required and it has native support.
https://github.com/n8henrie/fauxmo
(Not my project.)
The one thing I've learned about smart home is if you come up with a cool idea of how to do it DIY, someone's done it similarly and better. Wrote my own code for everything and ended up ditching it all for HomeAssistant.