How to Reset Energy Usage and Runtime on TP-Link Kasa Smart Plugs (KP115/HS110)

20221212: Tapo Users, update from reader Roman below: The Tapo app on Android now has a software/firmware update that lets you reset the energy consumption from the app. Hopefully, iOS is the same.

20220914: Note: If you have an Apple device, you no longer have to use my laborious procedure documented below. The Watt for Smart Devices app can reset the energy and usage stats of both Kasa and Tapo devices.

WARNING: This method DOES NOT work the Tapo devices. They use an entirely different API. I wrote some code to try sending reset_energy_usage to a Tapo plug, but it rejected the command. If anyone knows the command to reset the energy usage of a Tapo, please leave a message below. Also, I might be able to find the correct command if someone can send me a firmware file for a Tapo plug with energy monitoring.

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

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 ./ -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:

  1. Download and install Python 3.x: Python Downloads
  2. Download
  3. 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).
  4. open up a command shell and type:
python3 ./ -t <ipaddr> -c energy_reset

substituting the IP address of your smart plug for “<ipaddr>.”


# python3 ./ -t -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.

To erase runtime statistics, use runtime_reset instead of energy_reset.

50 thoughts on “How to Reset Energy Usage and Runtime on TP-Link Kasa Smart Plugs (KP115/HS110)”

    1. 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 Please download the new version, and follow the revised instructions above.

  1. 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

    1. 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

  2. It does not seem to work with the P110 .i get no answer at all,no error …nothing!
    i don’t much about python but i made sure the script was in the working directory and that the ip was correct but despite this …zilch !

  3. I have installed Python, downloaded the to the python folder but when typing the command (python3 ./ -t -c energy_reset) into a command shell window I get invalid syntax at the start of the ./ (the error indicator is under the /) was replaced with IP address. Anyone any ideas what I’m doing wrong?

      1. i seem to have the same issue – see below:

        Python 3.10.7 (tags/v3.10.7:6cc6b13, Sep 5 2022, 14:08:36) [MSC v.1933 64 bit (AMD64)] on win32
        Type “help”, “copyright”, “credits” or “license” for more information.
        >>> python3 ./ -t 192.168.215 -c energy_reset
        File “”, line 1
        python3 ./ -t 192.168.215 -c energy_reset
        SyntaxError: invalid syntax

        1. The problem is that you’re invoking Python, and then trying to typing the command line into Python.
          What we want to do is to have Python execute the script. So want to type the line
          python3 ./ -t 192.168.215 -c energy_reset
          in the Windows Command Prompt or Powershell. Don’t type python first.

          1. Sorry for not replying to my issue earlier, but you are correct. I tried again the following morning and realised I wasn’t typing in a DOS command window. It worked once doing that, although I didn’t actually have the plug at the time, I was just checking it looked like it would work. I now ended up with a Tapo P110 so probably won’t work but will give it a go hopefully later on today.

  4. energy_reset works on plug 1 of the TP-Link Kasa Smart Plug HS300 (6 plug power strip). Resets power stats, but not runtime. Thank you for your work!

    1. I was looking to do the same thing, add the following command in the python script (on line 66 in the current version):
      ‘runtime_reset’ : ‘{“schedule”:{“erase_runtime_stat”:null}}’

      And then you’ll be able to run the following to reset the runtime data:
      python3 ./ -t -c runtime_reset

  5. Thanks for sharing this script, works like a charm. It did fail for me initially with a connection error on the default port, I tried from another (non-work) computer and it worked straight away. Thanks again!

  6. I have tried on the P110 but get ‘Could not connect to host’ I know the ip is correct but don’t know what port it is on. Is this simply not going to work or could adding the port to the command line help or has it detected the port as 9999 ?

  7. Hello, this is exactly what I need, thank you, but I get an error when i run the script.

    PS C:\Users\darre\Documents\PythonProjects> python3 ./ -t -c energy_reset
    File “C:\Users\darre\Documents\PythonProjects\”, line 133
    print(“Received: “, decrypted)
    SyntaxError: expected ‘except’ or ‘finally’ block

    I’m not experience in Python so cant seem to debug the issue.

    1. It looks like the file got corrupted when you downloaded it. Try downloading it again with a different web browser. Python is very sensitive to white space. It looks like when you downloaded it, some of the spaces got changed to tabs, or something weird like that

      1. Hi, so downloaded again and it went further so thank you for that. However, I now get the following error
        “Could not connect to host”
        The IP address is correct, I doubled checked, but then it dawned on me that I have the TP-Link Tapo P110 and not KASA HS110. Unless you know differently.

        1. Sorry, I don’t think this method works w/ Tapo, from what others are saying. But I found some code for Tapo plugs. I don’t have one myself, but if someone who has Tapo is willing to test, I can try to make it work. I found a library that works w/ Tapo, but it doesn’t have a reset energy command. So what i want to do is try adding that command, and seeing if Tapo will accept it

  8. Thanks for this worked great for me (hs110) and I have now added some more commands (I found amongst the info you provided) to some python scripts, to retrieve data for my power monitoring solution at home. A small 5 min fix you provided led to hours of me playing around with python, json, Grafana etc:)

    I wonder if you have come across an issue of incorrect values in the power consumption figures on the Kasa? I just erased the hs110 and ran the Emeter command and got this? the total power figure doesn’t match up with anything on the Kasa app as I just erased the counters??

    EmeterStatus power=0.0 voltage=247.633 current=0.016 total=9.553>

    PS For anyone that maybe interested and doesn’t already know, I just found some Kasa library that you can add to raspberry pi which lets you run commands from shell and also (I think) python scripts. “pip install python-kasa”

    Thanks once again for helping me sort the counter reset issue & inspiring me to dust off my raspberry pi and do something useful with it:)

  9. For those that are interested about TAPO devices.
    To delete data is now available in the lates firmware P110 1.1.2 Build 220930 Rel. 144500
    when looking at one of the monitoring graphs click on the 3 dots menu top right of the screen to show a “Delete All Data” option. It works!!

  10. Guess some are not compatible ?

    python3 ./ -t -c energy_reset
    Sent: {“emeter”:{“erase_emeter_stat”:{}}}
    Received: {“emeter”:{“err_code”:-2001,”err_msg”:”module not support”}}

    Kasa KL420 RGBIC Strips… (have 5 of them), bought as used from AMZ, so wanted to reset them for homeassistant.

  11. I am completely ignorant about python and only basics from pc. I am trying to use this script but no luck. I have installed python 311 on pc and saved the in the same folder as the python 311. When I enter “python” in CMD it does tell me the version, but when I enter the script “python3 ./ -t -c energy_reset” it says the system cannot find the file specified. What am I doing wrong? Can someone help me please by providing exact steps. Thank you

    1. you need to put the into the the current directory of the command prompt to use the command I specified.
      if it’s in your python directory instead, put in the full path to the file, e.g.
      python3 c:\python311\ -t -c energy_reset”

        1. I finally managed to reset the runtime stats. For anyone that is interested, this how I did it. I opened the with notepad saved it as txt and then I added the following line in the Predefined Smart Plug Commands section, before the ‘energy_reset’ line.

          ‘runtime_reset’ : ‘{“schedule”:{“delete_all_rules”:null,”erase_runtime_stat”:null}}’,

          Next I saved it as and replaced with it, the old one.
          So in the command, python3 ./ -t -c energy_reset , just replaced the word reset with runtime. So the new command is
          python3 ./ -t -c runtime_reset.

  12. Good news for android users for the tp-link tapo p110:
    The software on the smartphone and the firmware of the plug have been updated .So if you upgrade to the latest
    software and firmware you’ll now have ernergy reset included in the software with more detail on consumption.
    you can even add your Kwh rate in your currency . 😉

  13. I downloaded Python 3.11 to my Macintosh, and downloaded the “tplink_smartplug” script into the Python folder. I entered the Terminal command “cd ” && ‘/usr/local/bin/python3′ ‘\ -t -c energy_reset’ && echo Exit status: $? && exit 1″ and the reply was “/Library/Frameworks/Python.framework/Versions/3.11/Resources/ can’t open file ‘/Users/Macintosh/‘’: [Errno 2] No such file or directory”

    What am I doing wrong? Thanks…

      1. Which I have done, and now the Terminal reply is “-bash: cd: ”: No such file or directory
        Macintoshs-Pro:~ Macintosh$”

        Please note that “Macintosh” is also the name of the “User”.

  14. This worked perfectly for TP-Link HS103 and HS105 Plugs thank you! Added into a batch script for easily resetting them all at once 🙂

  15. Thank you for this! It took a little bit to get this to work but finally got it. I have never used or ran python commands and what I had learned following these directions is you cant use the python cmd to run the exact code and I was always getting errors and syntax errors. A little more digging and I found that the code is using power shell commands and once I used that code in powershell and had the script in the correct directory, it worked perfectly.

Leave a Reply