Need some help tuning a DIY energy monitor reading blinks


I’ve set up two ESPs to read blinks from my power meter.

The first version counted the time from one blink to the next and report via MQTT (for each blink). This gives me nice graphs like this: Screenshot of grafana

But I fear it may not be accurate, and it’s hard to list up i.e. how much power was used during one day.

My second version counts blinks and on every ten blinks sends the count via MQTT. I think this will work better if there are network problems. And the rate of blinks should allow for calculating current energy use.

But I’m not sure how to use the data from this version 2 in hass or grafana to show current use.

(All code I write for this will be published at when it works)

Edit: My meter blinks once per kWh used.

When I think about it, the ESP can just return both values (count of blinks and time between blinks). Makes everything easier, and perhaps I can figure out more math to use the values later.

Edit: current test graph Both graphs

Check my approach Here
Let me know what do you think about it …

Looks ok, and much easier than writing from scratch in µPython.

I’ve been using my solution since I wrote this forum post, and still works fine. =)