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
72.09k stars 30.18k forks source link

TP-Link Smart Home Power Strips Slow Energy Monitoring Polling #113512

Closed kottav closed 2 months ago

kottav commented 6 months ago

The problem

TP-Link HS300 6-plug power strips with energy monitoring are now polling energy monitoring stats once per minute (6(plugs)x10 seconds) per plug. The integration used to poll energy monitoring stats for all plugs every ~10 seconds or so. I think there might be a new loop that goes through the individual plugs and waits 10 seconds on each plug instead of waiting 10 seconds for the whole power strip.

My single outlet TP-Link smart plugs continue to poll energy monitoring every ~10 seconds.

What version of Home Assistant Core has the issue?

core-2024.3.1

What was the last working version of Home Assistant Core?

core-2024.1

What type of installation are you running?

Home Assistant Container

Integration causing the issue

TP-Link Smart Home

Link to integration documentation on our website

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

Diagnostics information

No response

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 6 months ago

Hey there @rytilahti, @thegardenmonkey, @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)

bdraco commented 6 months ago

This is intended behavior as we had too many problems with the power strips getting overloaded and becoming unresponsive from the number of queries.

You can disable automatic polling in the config entry system options and add an automation to poll a frequently as you like

alias: Force Update
description: 'Update a sensor more frequently'
mode: single
trigger:
  - platform: time_pattern
    .... how often you want....
action:
  - service: homeassistant.update_entity
    target:
      entity_id:
        - sensor.XXXXX

If the device becomes unstable, you'll need to pick a longer interval, and likely unplug and replug in the power strip to get it back online

rytilahti commented 6 months ago

Maybe this would be worth adding to the docs?

kottav commented 6 months ago

This is intended behavior as we had too many problems with the power strips getting overloaded and becoming unresponsive from the number of queries.

You can disable automatic polling in the config entry system options and add an automation to poll a frequently as you like

alias: Force Update
description: 'Update a sensor more frequently'
mode: single
trigger:
  - platform: time_pattern
    .... how often you want....
action:
  - service: homeassistant.update_entity
    target:
      entity_id:
        - sensor.XXXXX

If the device becomes unstable, you'll need to pick a longer interval, and likely unplug and replug in the power strip to get it back online

Thank you. That automation example was extremely helpful! I have it working the way I want now with more frequent polling on current wattage. I don't care as much about the other energy monitoring stats so hopefully it is few enough requests for stability which I did not have a problem with in the past.

rct commented 6 months ago

@rytilahti wrote

Maybe this would be worth adding to the docs?

I think this would by very helpful to have in the docs considering a significant reason to purchase these devices for energy monitoring. The power strips are a poor for that application.

It would be helpful to have the workaround @kottav is using mentioned there as well.

rct commented 6 months ago

On a related note, I'm wondering if it is worth tracking 6 voltage sensors for the HS300. Are there actually 6 discrete voltage sensors?

I see small differences in values but that could be differences in when it is being sampled.

issue-triage-workflows[bot] commented 3 months 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.

sdb9696 commented 2 months ago

@home-assistant close

rytilahti commented 2 months ago

On a related note, I'm wondering if it is worth tracking 6 voltage sensors for the HS300. Are there actually 6 discrete voltage sensors?

Just to avoid leaving this unanswered, I don't know if there are discrete sensors for this, but it's exposed by the library as the information is provided along other data.

We could discuss if it's worth exposing that separately, but that discussion would belong to https://github.com/python-kasa/python-kasa/ so feel free to open an issue there if you think we should change the behavior :-)