Nodemcu script that logs power consumption pushes metrics to prometheus.io pushgateway.
elog.lua is inspired by/modified code from Power Meter pulse logger with ESP8266 running NodeMCU.
-
prometheus.io
-
prometheus pushgateway
-
NodeMCU module
- firmware 1.5.1 newer than 2016/01/15 - float, with modules: node, file, gpio, wifi, net, tmr, http - http://nodemcu-build.com/
-
Analog Light Intensity Sensor Module 5528 Photo Resistor for AVR Arduino UNO (or similar) on ebay
-
Connect sensor to nodemcu, GND<->GND, VCC<->3V, SIG<->D1.
-
modify
config.default.lua
a file and save it asconfig.lua
-
PIN
- pin number default 1 for D1 -
MIN_PW
- minimum wait time (in ms) till script registers new impulse (prevents logging light echo) -
SSID
- your WiFi SSID -
PASSWORD
- your WiFi password -
GATEWAYIP
- your network gateway (IP address of router) -
IP
- static IP you want to set for nodemcu (connects faster without using DHCP) -
REFRESHINTERVAL
- in seconds how often should logger detect if logging is still working, if counter doesn't increase value for X seconds nodemcu pushes last metrics and restarts -
PUSHGATEWAY
- url of pushgateway server -
PUSHINTERVAL
- how often should metrics be pushed (in seconds) -
DEBUG
- debug flag true or false
-
-
Upload all
.lua
files to nodemcu and restart
GNU GPLv3