Then you flash the binary: http://nodemcu.readthedocs.io/en/latest/en/flash/
Then you use the ADC module to retrieve the information you need: http://nodemcu.readthedocs.io/en/latest/en/modules/adc/
- ESP8266 Internal ADC
- ESP8266 - Internal ADC 2 - the easy way example - Voltage divider example
Available on Tindie: https://www.tindie.com/products/nEXT_EVO1/universal-ac-mains-dimmer-mpdmv41/