I recently acquired a few TP-Link Kasa KP115 smart plugs with energy metering. It was a bit disappointing to find that they barely show any data. There are no graphs, no voltage or current, just instantaneous power and summary energy stats and runtime:


I wanted to find the daily energy consumption of various appliances, so I needed a way to reset the energy counter to zero. Believe it or not, TP-Link doesn’t provide a way to reset the energy. TP-Link support says that you have to delete the plug from Kasa, factory reset, and then add it back to Kasa.
The most ridiculous part is, the smart plugs actually have a command to reset the energy without resetting the whole device! They’re just too lazy to add it to their app!
I found a github repo with a list of the commands available in the TP-Link protocol. It turns out that there’s a command to reset the energy monitor!
Erase All EMeter Statistics
{"emeter":{"erase_emeter_stat":null}}
The repo contains a Python3 script that can query the energy stats, but it doesn’t have an option to send the emeter reset command. Fortunately, it has a command line option to send an arbitrary JSON command to the plug. I tried sending the above to my KP115, and the energy meter was instantly reset to 0!
# python3 ./tplink-smartplug.py -t <ipaddr> -j {\"emeter\":{\"erase_emeter_stat\":{}}}
Although I don’t have one, the same command should also work on the older HS110 smart plug.
For your convenience, I have forked the github repo, and added a command to reset the emeter, so you don’t have to type the ugly JSON command.
Here’s how to reset your energy meter:
- Download and install Python 3.x: Python Downloads
- Download tplink_smartplug.py
- Next you need to know the IP address of the smart plug you want to reset. If you don’t know how to find it from your WiFi router, you can scan for it with an IP scanner, such as Fing. Look for a device named KP115 (or HS110).
- open up a command shell and type:
python3 ./tplink_smartplug.py -t <ipaddr> -c energy_reset
substituting the IP address of your smart plug for “<ipaddr>.”
Example:
# python3 ./tplink_smartplug.py -t 192.168.1.36 -c energy_reset
Sent: {"emeter":{"erase_emeter_stat":{}}}
Received: {"emeter":{"erase_emeter_stat":{"err_code":0}}}
The Python script returns “err_code: 0” if it’s successful. Next, open up your Kasa app, and check to see if the energy meter was reset successfully.
Just got a KP115 and this is totally what I needed. Thanks for writing this up!
cool glad you found it useful. i was really pissed when TP-Link wanted me to do a factory reset every time!
It worked! Thank you for sharing this.
Doesn’t work for me.
I get “Received: {}” but the plug data doesn’t reset 🙁
Which model/hardware version/firmware version did you try it on?
Just tried this on KP115 (hardware1.0 / firmware 1.0.16) and got the same results
I have updated the post above. It turns out that you need to escape the ” characters or Python3 will strip them out.
To make things easier, I added an energy_reset command to tplink_smartplug.py. Please download the new version, and follow the revised instructions above.
Thanks. It worked as advertised.
Thank you, works now
Many thanks for this. Absolutely incredible that this isn’t included in the app among other things.
These work well in HomeAssistant too, which will then get you the cumulative kWh usage (as well as watts, volts, amps and on/off control) to graph in daily chunks, without having to reset the plug
thanks. yes, i’m familiar with HA. But I wanted to use the plug to measure the exact energy usage of the plug over a specific time interval. it’s a lot easier to just reset the plug than to go digging through graphs and data logs. I’m actually using Prometheus/Grafana rather than HA to log the data