This requires the FauxmoESP library here: https://bitbucket.org/xoseperez/fauxmoesp/src/master/
For the ESP8266, this library is needed: https://github.com/me-no-dev/ESPAsyncTCP
For the ESP32, this library is needed: https://github.com/me-no-dev/AsyncTCP
Here is the schematic I am using: (in my setup there are lots of resistors and led's together, not just one, but that would be annoying to put into a schematic)