home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
73.2k stars 30.57k forks source link

TP-Link KP125M Incorrect Total usage #121067

Closed 0xEmma closed 3 months ago

0xEmma commented 3 months ago

The problem

image

Total usage is resetting at Midnight everynight, looking at the debug information the proper information shows up atleast within month_energy/power_usage past30, and within the Kasa App.

Plug is connected via IP w/Authentication. No Reboots/Restarts/Powerloss to plug or HA

What version of Home Assistant Core has the issue?

core-2024.6.4

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

TP-Link

Link to integration documentation on our website

https://www.home-assistant.io/integrations/tplink

Diagnostics information

{ "home_assistant": { "installation_type": "Home Assistant OS", "version": "2024.6.4", "dev": false, "hassio": true, "virtualenv": false, "python_version": "3.12.2", "docker": true, "arch": "x86_64", "timezone": "America/Toronto", "os_name": "Linux", "os_version": "6.6.33-haos", "supervisor": "2024.06.2", "host_os": "Home Assistant OS 12.4", "docker_version": "26.1.4", "chassis": "vm", "run_as_root": true }, "custom_components": {}, "integration_manifest": { "domain": "tplink", "name": "TP-Link Smart Home", "codeowners": [ "rytilahti", "thegardenmonkey", "bdraco", "sdb9696" ], "config_flow": true, "dependencies": [ "network" ], "dhcp": [ { "registered_devices": true }, { "hostname": "e[sp]", "macaddress": "3C52A1" }, { "hostname": "e[sp]", "macaddress": "54AF97" }, { "hostname": "e[sp]", "macaddress": "E848B8" }, { "hostname": "e[sp]", "macaddress": "1C61B4" }, { "hostname": "e[sp]", "macaddress": "003192" }, { "hostname": "hs", "macaddress": "B4B024" }, { "hostname": "hs", "macaddress": "9C5322" }, { "hostname": "k[lps]", "macaddress": "5091E3" }, { "hostname": "k[lps]", "macaddress": "9C5322" }, { "hostname": "hs", "macaddress": "1C3BF3" }, { "hostname": "hs", "macaddress": "50C7BF" }, { "hostname": "hs", "macaddress": "68FF7B" }, { "hostname": "hs", "macaddress": "98DAC4" }, { "hostname": "hs", "macaddress": "B09575" }, { "hostname": "hs", "macaddress": "C006C3" }, { "hostname": "lb", "macaddress": "1C3BF3" }, { "hostname": "lb", "macaddress": "50C7BF" }, { "hostname": "lb", "macaddress": "68FF7B" }, { "hostname": "lb", "macaddress": "98DAC4" }, { "hostname": "lb", "macaddress": "B09575" }, { "hostname": "k[lps]", "macaddress": "60A4B7" }, { "hostname": "k[lps]", "macaddress": "005F67" }, { "hostname": "k[lps]", "macaddress": "1027F5" }, { "hostname": "k[lps]", "macaddress": "B0A7B9" }, { "hostname": "k[lps]", "macaddress": "403F8C" }, { "hostname": "k[lps]", "macaddress": "C0C9E3" }, { "hostname": "k[lps]", "macaddress": "909A4A" }, { "hostname": "k[lps]", "macaddress": "E848B8" }, { "hostname": "k[lps]", "macaddress": "003192" }, { "hostname": "k[lps]", "macaddress": "1C3BF3" }, { "hostname": "k[lps]", "macaddress": "50C7BF" }, { "hostname": "k[lps]", "macaddress": "68FF7B" }, { "hostname": "k[lps]", "macaddress": "98DAC4" }, { "hostname": "k[lps]", "macaddress": "B09575" }, { "hostname": "k[lps]", "macaddress": "C006C3" }, { "hostname": "k[lps]", "macaddress": "6C5AB0" }, { "hostname": "k[lps]", "macaddress": "54AF97" }, { "hostname": "l[59]", "macaddress": "54AF97" }, { "hostname": "k[lps]", "macaddress": "AC15A2" }, { "hostname": "k[lps]", "macaddress": "788CB5" }, { "hostname": "k[lps]", "macaddress": "3460F9" }, { "hostname": "k[lps]", "macaddress": "1C61B4" }, { "hostname": "l5", "macaddress": "5CE931" }, { "hostname": "l[59]", "macaddress": "3C52A1" }, { "hostname": "l5", "macaddress": "5C628B" }, { "hostname": "tp", "macaddress": "5C628B" }, { "hostname": "p1", "macaddress": "482254" }, { "hostname": "s5", "macaddress": "482254" }, { "hostname": "p1", "macaddress": "30DE4B" }, { "hostname": "p1", "macaddress": "3C52A1" }, { "hostname": "tp", "macaddress": "3C52A1" }, { "hostname": "s5", "macaddress": "3C52A1" }, { "hostname": "l9", "macaddress": "A842A1" }, { "hostname": "l9", "macaddress": "3460F9" }, { "hostname": "hs", "macaddress": "704F57" }, { "hostname": "k[lps]", "macaddress": "74DA88" }, { "hostname": "p3", "macaddress": "788CB5" }, { "hostname": "p1", "macaddress": "CC32E5" }, { "hostname": "k[lps]", "macaddress": "CC32E5" }, { "hostname": "hs", "macaddress": "CC32E5" }, { "hostname": "k[lps]", "macaddress": "D80D17" }, { "hostname": "k[lps]", "macaddress": "D84732" }, { "hostname": "p1", "macaddress": "F0A731" }, { "hostname": "l9", "macaddress": "F0A731" } ], "documentation": "https://www.home-assistant.io/integrations/tplink", "iot_class": "local_polling", "loggers": [ "kasa" ], "quality_scale": "platinum", "requirements": [ "python-kasa[speedups]==0.6.2.1" ], "is_built_in": true }, "setup_times": { "null": { "setup": 0.00021553199999857497 }, "0a0dc66a64b582823fdf6191ac8784c2": { "wait_import_platforms": -0.4305165959999968, "config_entry_setup": 0.5290477200000012 }, "9a448645f6165eaab4e166d5a80215db": { "wait_import_platforms": -0.42451015000000325, "config_entry_setup": 0.5305225780000029 }, "550d23bbdb47085db87572d0d4668baa": { "wait_import_platforms": -0.32695076299999926, "config_entry_setup": 0.5323505490000002 }, "f17b0ee64baeaf1f6a37e91444bb5b01": { "config_entry_setup": 1.2449041600000044 } }, "data": { "device_last_response": { "components": { "component_list": [ { "id": "device", "ver_code": 2 }, { "id": "firmware", "ver_code": 2 }, { "id": "quick_setup", "ver_code": 3 }, { "id": "time", "ver_code": 1 }, { "id": "wireless", "ver_code": 1 }, { "id": "schedule", "ver_code": 2 }, { "id": "countdown", "ver_code": 2 }, { "id": "antitheft", "ver_code": 1 }, { "id": "account", "ver_code": 1 }, { "id": "synchronize", "ver_code": 1 }, { "id": "sunrise_sunset", "ver_code": 1 }, { "id": "led", "ver_code": 1 }, { "id": "cloud_connect", "ver_code": 1 }, { "id": "iot_cloud", "ver_code": 1 }, { "id": "device_local_time", "ver_code": 1 }, { "id": "default_states", "ver_code": 1 }, { "id": "auto_off", "ver_code": 2 }, { "id": "energy_monitoring", "ver_code": 2 }, { "id": "power_protection", "ver_code": 1 }, { "id": "matter", "ver_code": 2 }, { "id": "current_protection", "ver_code": 1 } ] }, "info": { "device_id": "REDACTED", "fw_ver": "1.2.2 Build 240305 Rel.095128", "hw_ver": "1.0", "type": "SMART.KASAPLUG", "model": "KP125M", "mac": "REDACTED", "hw_id": "REDACTED", "fw_id": "REDACTED", "oem_id": "REDACTED", "ip": "REDACTED", "time_diff": -300, "ssid": "REDACTED", "rssi": -33, "signal_level": 3, "auto_off_status": "off", "auto_off_remain_time": 0, "longitude": "REDACTED", "latitude": "REDACTED", "lang": "en_US", "avatar": "plug", "region": "America/Toronto", "specs": "", "nickname": "REDACTED", "has_set_location_info": true, "device_on": true, "on_time": 143306, "default_states": { "type": "custom", "state": { "on": true } }, "overheat_status": "normal", "power_protection_status": "normal", "overcurrent_status": "normal" }, "usage": { "time_usage": { "today": 534, "past7": 2396, "past30": 2396 }, "power_usage": { "today": 6310, "past7": 31082, "past30": 31082 }, "saved_power": { "today": 0, "past7": 0, "past30": 0 } }, "time": { "time_diff": -300, "timestamp": 1720011269, "region": "America/Toronto" }, "energy": { "today_runtime": 534, "month_runtime": 2396, "today_energy": 6310, "month_energy": 31082, "local_time": "2024-07-03 08:54:29", "electricity_charge": [ 0, 0, 2807 ], "current_power": 774984 }, "emeter": { "current_power": 774 }, "child_info": {} }, "oui": "20:23:51" } }

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

home-assistant[bot] commented 3 months ago

Hey there @rytilahti, @bdraco, @sdb9696, mind taking a look at this issue as it has been labeled with an integration (tplink) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `tplink` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign tplink` Removes the current integration label and assignees on the issue, add the integration domain after the command. - `@home-assistant add-label needs-more-information` Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue. - `@home-assistant remove-label needs-more-information` Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


tplink documentation tplink source (message by IssueLinks)

sdb9696 commented 3 months ago

Can you test again with the 2024.07 version of homeassistant that's just shipped. If the device doesn't support Total usage (which this one doesn't) it should stop being reported.

0xEmma commented 3 months ago

Fixed in 07.01, entity no longer exists. Sucks but oh well - would be nice if the month/year power stats where made avail.

sdb9696 commented 3 months ago

So the newer kasa/tapo devices don't support the historical stats in the same way as the old ones did, but there should a "This month's consumption" now available under diagnostics:

image

0xEmma commented 3 months ago

Noticed monthly after i had posted :) Thanks!

rytilahti commented 3 months ago

he data is there but it is not made accessible so nicely. We could potentially add this, so I created https://github.com/python-kasa/python-kasa/issues/1055