That is why I save the calculated Kwh every hour on the ESP module's flash. If I lose power or pull the meter I lose max. 1 hour of Kwh measurements. You can save more times and be more accurate, but that will eventually break your ESP module as the flash can only be written x number of times.littlewouter wrote:The provided code from Kapee sends the average watt value each minutes via MQTT, this could be easily recalculated to kwh consumed in the last minute.
Through MQTT I can also clear the Kwh and reset the ESP if I want measurement to start over, in case of moving the meter to another device I want to monitor.
PS: I'm not using Kapee's code