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.22k stars 30.58k forks source link

Kasa energy meter "Total consumption" sensor should be qualified #69828

Closed madbrain76 closed 1 year ago

madbrain76 commented 2 years ago

The problem

I am using Kasa TP125 smartplugs. For each smartplug, there is a sensor in HomeAssistant called "Total Consumption" in kWh . There is no qualifier for this sensor, so I assumed that it was the total consumption of all data ever recorded by that device. That is not the case, however.

If power is cut off to the smartplug and it reboots, either by being physically unplugged, or due to a power outage, the value of this sensor resets to zero . Here is what happened when I unplugged the KP125 measuring my mini fridge's power consumption, and then plugged it back in, due to some networking issue that could only be resolved this way unfortunately.

image

Ideally, the "Total consumption" sensor should be monotonic, and continuously increase. It should never reset to zero.

If that can't be achieved, there should be some some qualifier in the name of the sensor to make it clear what the "total" really represents - the total since the smartplug booted up. I'm not certain what would be best , so I'll leave that to UI/UX designers.

Other sensors for other devices don't behave the same way. The value does not reset to zero when power is lost.

For example, here is the "Total Meter Energy Delivered" from my Rainforest Eagle, model RFA-Z109 (not Eagle-200 as the sensor name states) .

image

The lows at 0 are the times during which I have HomeAssistant reboot the device through a smartplug, every 3 hours, due to device instability. The sensor comes back to the previous meter value after it reboots, unlike the TP-Link "Total consumption" sensor.

What version of Home Assistant Core has the issue?

core-2022.4.1

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-Lin Kasa

Link to integration documentation on our website

No response

Diagnostics information

{ "home_assistant": { "installation_type": "Home Assistant OS", "version": "2022.4.1", "dev": false, "hassio": true, "virtualenv": false, "python_version": "3.9.9", "docker": true, "arch": "aarch64", "timezone": "America/Los_Angeles", "os_name": "Linux", "os_version": "5.10.103-v8", "supervisor": "2022.03.5", "host_os": "Home Assistant OS 7.6", "docker_version": "20.10.9", "chassis": "embedded", "run_as_root": true }, "custom_components": { "hacs": { "version": "1.24.3", "requirements": [ "aiogithubapi>=21.11.0" ] } }, "integration_manifest": { "domain": "tplink", "name": "TP-Link Kasa Smart", "config_flow": true, "documentation": "https://www.home-assistant.io/integrations/tplink", "requirements": [ "python-kasa==0.4.3" ], "codeowners": [ "@rytilahti", "@thegardenmonkey" ], "dependencies": [ "network" ], "quality_scale": "platinum", "iot_class": "local_polling", "dhcp": [ { "registered_devices": true }, { "hostname": "k[lp]", "macaddress": "60A4B7" }, { "hostname": "k[lp]", "macaddress": "005F67" }, { "hostname": "k[lp]", "macaddress": "1027F5" }, { "hostname": "k[lp]", "macaddress": "403F8C" }, { "hostname": "k[lp]", "macaddress": "C0C9E3" }, { "hostname": "ep", "macaddress": "E848B8" }, { "hostname": "k[lp]", "macaddress": "E848B8" }, { "hostname": "k[lp]", "macaddress": "909A4A" }, { "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": "ep", "macaddress": "003192" }, { "hostname": "k[lp]", "macaddress": "003192" }, { "hostname": "k[lp]", "macaddress": "1C3BF3" }, { "hostname": "k[lp]", "macaddress": "50C7BF" }, { "hostname": "k[lp]", "macaddress": "68FF7B" }, { "hostname": "k[lp]", "macaddress": "98DAC4" }, { "hostname": "k[lp]", "macaddress": "B09575" }, { "hostname": "k[lp]", "macaddress": "C006C3" }, { "hostname": "lb", "macaddress": "1C3BF3" }, { "hostname": "lb", "macaddress": "50C7BF" }, { "hostname": "lb", "macaddress": "68FF7B" }, { "hostname": "lb", "macaddress": "98DAC4" }, { "hostname": "lb", "macaddress": "B09575" } ], "loggers": [ "kasa" ], "is_built_in": true }, "data": { "device_last_response": { "system": { "get_sysinfo": { "sw_ver": "1.0.6 Build 210928 Rel.185924", "hw_ver": "1.0", "model": "KP125(US)", "deviceId": "REDACTED", "oemId": "REDACTED", "hwId": "REDACTED", "rssi": -66, "latitude_i": "REDACTED", "longitude_i": "REDACTED", "alias": "REDACTED", "status": "configured", "obd_src": "tplink", "mic_type": "IOT.SMARTPLUGSWITCH", "feature": "TIM:ENE", "mac": "REDACTED", "updating": 0, "led_off": 0, "relay_state": 1, "on_time": 89393, "icon_hash": "", "dev_name": "Smart Wi-Fi Plug Mini", "active_mode": "none", "next_action": { "type": -1 }, "ntc_state": 0, "err_code": 0 } }, "emeter": { "get_realtime": { "current_ma": 712, "voltage_mv": 122417, "power_mw": 48730, "total_wh": 1200, "err_code": 0 }, "get_monthstat": { "month_list": [ { "year": 2022, "month": 4, "energy_wh": 6200 } ], "err_code": 0 }, "get_daystat": { "day_list": [ { "year": 2022, "month": 4, "day": 3, "energy_wh": 65 }, { "year": 2022, "month": 4, "day": 4, "energy_wh": 603 }, { "year": 2022, "month": 4, "day": 5, "energy_wh": 688 }, { "year": 2022, "month": 4, "day": 6, "energy_wh": 1184 }, { "year": 2022, "month": 4, "day": 7, "energy_wh": 1157 }, { "year": 2022, "month": 4, "day": 8, "energy_wh": 1157 }, { "year": 2022, "month": 4, "day": 9, "energy_wh": 1161 }, { "year": 2022, "month": 4, "day": 10, "energy_wh": 185 } ], "err_code": 0 } } } } }

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

probot-home-assistant[bot] commented 2 years ago

tplink documentation tplink source (message by IssueLinks)

probot-home-assistant[bot] commented 2 years ago

Hey there @rytilahti, @thegardenmonkey, 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! (message by CodeOwnersMention)

madbrain76 commented 2 years ago

This should not be closed. The issue is still present. It just hasn't been looked at. This is a prime example of why bots should not be used to close issues.

rytilahti commented 2 years ago

Feel free to reopen issues in such cases, alas, I don't currently have time to dig into this so I hope someone else could take a look what it takes to fix it (if necessary).

madbrain76 commented 2 years ago

Teemu, thanks for reopening the issue.

I totally understand you haven't had time to dig into the issue.

I looked for an option to try to reopen the issue myself, but couldn't find one. Could you point me to where it is ? There is another issue I would like to reopen as well : https://github.com/home-assistant/core/issues/68603

I spent a lot of time collecting details about it, and painstakingly reporting the problem. It was very frustrating to see the bot auto-close it for being stale, and for me to have no way to reopen it.

Thanks ! Julien

rytilahti commented 2 years ago

Hi Julien,

I suppose there has been some changes in github or I just misrecall that it was possible to reopen an issue with a button just underneath the comment box. I reopened the issue you linked just in case someone wants to contribute fixing, your comprehensive bug descriptions are definitely appreciated by any developer willing to look into fixing those issues, so thanks for that! :-)

madbrain76 commented 2 years ago

Teemu, Thanks for reopening my other issue. I haven't been using github for very long. But I checked for a few other bugs I reported on other projects that were also closed by bots for inactivity, and the box to reopen the issue does not appear. It's possible github made changes. I don't think it makes sense for a bot to auto-close an issue just for being stale and never having even been looked at by a human. Is the bot configurable per project ?

github-actions[bot] commented 2 years ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

madbrain76 commented 2 years ago

This is still an issue

Rill189 commented 1 year ago

Still an active issue

issue-triage-workflows[bot] commented 1 year ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

madbrain76 commented 1 year ago

This is still an issue.

rytilahti commented 1 year ago

Changing the name of the sensor would be the simplest fix for this, at least for the time being as it doesn't involve any further code changes. Do you happen to have a suggestion on the name? Something like "Consumption since last hard-off" feels off to me, and I cannot think of a better description at the moment.

madbrain76 commented 1 year ago

Maybe "Consumption since last AC outage" ? But obviously it's your call. I just want it to be clear that it's not the same as the total consumption as recorded in the Kasa app, which uses cloud and thus continues to accrue even in the case of an outage.

issue-triage-workflows[bot] commented 1 year ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

Rill189 commented 1 year ago

This needs sorting please