Electricity meter blink counter nodemcu lua code for ESP8266.
- Upon starting it establishes connection to provided wifi ssid
- It counts electricity meter flashes and stores them in counter variable
- It opens a socket and exposes counter.
- Once prometheus scrapes the value, counter gets reset to 0.
- I use this site to build custom nodemcu firmware: nodency-build.com
$ esptool.py --port /dev/ttyUSB0 --baud 115200 write_flash --flash_size=detect 0 /path/to/nodemcu.bin
- You can get it at Esplorer site
- Extract and launch with java 1.7+
$ java -jar ESPlorer.jar
- move location_example.lua to location.lua and change to your ssid/psk
- upload files through esplorer.
thanks to vonneudeck.
Used his way of connecting to wifi/exposing stats for prometheus