Sitelet https://github.com/python-kasa/python-kasa/issues/1730
Skip to content

Support for Reset Energy Usage and Runtime on TP-Link Kasa Smart Plugs (KP115/HS110) ? #1730

Description

@whitedavidp

Hello. I have been trying to use the approach shown here. It uses the repo shown here. That repo has commands "energy_reset" and "runtime_reset" for clearing the counters on HS110 (and similar, I guess).

Sadly, while the other commands I have tried seem to work as expected, the two commands I really want/need to use execute but seem to have no actual effect. The info command returns this partial result:

“err_code”:0,”sw_ver”:”1.1.1 Build 160725 Rel.164033″,”hw_ver”:”1.0″,”type”:”IOT.SMARTPLUGSWITCH”,”model”:”HS110(US)”

But, while I get expected result codes from the energy_reset and runtime_reset commands:

python3 TpLink-Switch/tplink_smartplug.py -t 192.168.1.192 -c energy_reset
B64 Encoded Cmd: b’AAAAI9Dyl/qf64783uSfvdiqy7jdgueK75v+jNOg1LXB49mi36Lf’
Sent: {“emeter”:{“erase_emeter_stat”:{}}}
Received: {“emeter”:{“erase_emeter_stat”:{“err_code”:0}}}]

and

python3 TpLink-Switch/tplink_smartplug.py -t 192.168.1.192 -c runtime_reset
B64 Encoded Cmd: b’AAAAJtDygeKK74v+kvfV75S206HAs9aJ+47glP2Q9arZrcy4mqDbptum’
Sent: {“schedule”:{“erase_runtime_stat”:{}}}
Received: {“schedule”:{“erase_runtime_stat”:{“err_code”:0}}}

I do not see any effect in the output of the energy_realtime command:

python3 TpLink-Switch/tplink_smartplug.py -t 192.168.1.192 -c energy_realtime
B64 Encoded Cmd: b’AAAAHtDyl/qf64783uSfvdq/y5Tmg+KO+pP+m7mD+IX4hQ==’
Sent: {“emeter”:{“get_realtime”:{}}}
Received: {“emeter”:{“get_realtime”:{“current”:1.226932,”voltage”:122.326724,”power”:130.908250,”total”:4.196000,”err_code”:0}}}

I expected the total to change to 0, yet it does not.

So I am hoping that there is something I can use to accomplish this from this repo. I looked at the results from "feature" and get this:

$ kasa --host 192.168.1.192 feature
Discovering device 192.168.1.192 for 10 seconds
== Primary features ==
State (state): True
Current consumption (current_consumption): 137.6 W
Voltage (voltage): 123.1 V
Current (current): 1.28 A

== Information ==
On since (on_since): 1969-12-31 16:00:04-08:00
Today's consumption (consumption_today): 0.0 kWh
This month's consumption (consumption_this_month): 0.0 kWh
Total consumption since reboot (consumption_total): 16.675 kWh
Cloud connection (cloud_connection): False

== Configuration ==
LED (led): True

== Debug ==
RSSI (rssi): -62 dBm
Reboot (reboot): <Action>

Can anyone tell me if/how it is possible to reset these counters using this repo?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions