Assumes your power meter has a flashing LED that flashes every e.g 1/1000th of a kWh and that you can place an optotransistor over the LED to trigger a pulse on a pin on the ESP8266.
Features
/
to get and set the kWh remaining on your prepaid electricity meter/metrics
endpoint to get details about power usage for display in Grafanapowermeter
topicTested with
https://learn.sparkfun.com/tutorials/how-to-install-ch340-drivers/all
From https://docs.micropython.org/en/latest/esp8266/tutorial/intro.html Downloaded latest MicroPython 1.13: esp8266-20200911-v1.13.bin pip3 install esptool
esptool.py --help
esptool.py erase_flash
esptool.py --port /dev/tty.wchusbserial1410 --baud 460800 write_flash --flash_size=detect 0 ~/Downloads/esp8266-20200911-v1.13.bin
http://micropython.org/webrepl/#10.0.0.146:8266
Command line tool for upload/download of files. Installation instructions at https://github.com/scientifichackers/ampy
ampy -p /dev/tty.wchusbserial1410 -b 115200 ls
ampy -p /dev/tty.wchusbserial1410 -b 115200 run main.py
ampy -p /dev/tty.wchusbserial1410 -b 115200 put main.py
boot.py
, main.py
, config.json
, index.html
, metrics
config_example.json
to suit your requirements, and save as config.json
screen /dev/tty.wchusbserial1410 115200
CTRL+A
CTRL+\
CTRL+C
CTRL+D
I made a full presentation on Home Automation with MicroPython, the ESP8266 and Google Home at Google DevFest 2020. It includes my slides and YouTube presentation for building this Power Meter, as well as a short intro to MicroPython.