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
70.89k stars 29.56k forks source link

TP-Link Smart Home - P110 plug not getting all information after product goes offline and comes back online #121889

Closed aravindjaimon closed 3 weeks ago

aravindjaimon commented 1 month ago

The problem

I have 3 P110 plugs available. 2 of them are connected to grid and 1 is connected to battery (always online). The two plugs that are connected to grid goes offline when electricity is gone. Once it comes online, The functionalities are working fine. But the following items are unavailable.

  1. Current consumption
  2. This month's consumption
  3. Today's consumption

To fix the issue we either need to restart home assistant or reload the plugs configuration.

What version of Home Assistant Core has the issue?

core-2024.7.1

What was the last working version of Home Assistant Core?

core-2024.6

What type of installation are you running?

Home Assistant Container

Integration causing the issue

Tplink Smart Home

Link to integration documentation on our website

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

Diagnostics information

Home Assistant TP-Link log July 13 2024.log TPLink config entry (2).json TPLink config entry (1).json TPLink config entry.json

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

Issue explained over a video. https://github.com/user-attachments/assets/75a530b3-dfe2-4666-9294-566f3c8b47ee

home-assistant[bot] commented 1 month 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 1 month ago

Hi @aravindjaimon, is the log file you uploaded from an actual instance of the grid being disconnected? When the grid gets disconnected does the connection to the internet also get interrupted?

applegeeks commented 1 month ago

Happened to me today. What worked for me was to completely power off the smart plug from the mains. Power it back on and then reload the integration in HA.

DarthSonic commented 1 month ago

Same issue for my P110 devices. I tried a workaround that worked for P100 devices (turn off LED in Tapo app and turn on again, then power cycle device). But that workaround did not work for this issue.

PentaSX commented 1 month ago

Hello, I have same issue too since today for P100 / P110 / P115

aravindjaimon commented 1 month ago

Hi @aravindjaimon, is the log file you uploaded from an actual instance of the grid being disconnected? When the grid gets disconnected does the connection to the internet also get interrupted?

Hi, I have uploaded 3 log files where two are the ones that become unavailable.

When the grid is gone, the Internet is still working. All the other peripherals are connected to UPS which comes out through the Battery our plug. Ill recreate the issue once again and share the log file here.

sdb9696 commented 1 month ago

It seems from the previous log that when the devices came back online they initially raised a lot of errors because they were not connected to the cloud and not able to get the device time. That caused a lot of the modules to get disabled. Would they definitely have had full connectivity to the internet as soon as they turned on?

DorwinDT commented 1 month ago

my P110's doesn't work in integration anymore. Although I see them (and can work with them) via stock app

cmgestevao commented 1 month ago

I also have the same issue from this topic, once a P110 gets disconneted for a certain time from the mains power, when they get power again i have to reload the device integration.

cmgestevao commented 1 month ago

my P110's doesn't work in integration anymore. Although I see them (and can work with them) via stock app

I have 3 P110 and today all of then failed the connectivity with the cloud, i have a lot more devices from tuya and those worked ok without problems.

Printscreen of the 3

image

image

image

Ariosinm commented 1 month ago

I'm having same error on P115. Going desconnected and the reconected, the log is showing this error

2024-07-17 21:00:01.285 ERROR (MainThread) [homeassistant.components.tplink.coordinator] Unexpected error fetching 192.168.18.67 data Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 312, in _async_refresh self.data = await self._async_update_data() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/tplink/coordinator.py", line 49, in _async_update_data await self.device.update(update_children=False) File "/usr/local/lib/python3.12/site-packages/kasa/smart/smartdevice.py", line 165, in update self._last_update = resp = await self.protocol.query(req) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/kasa/smartprotocol.py", line 68, in query return await self._query(request, retry_count) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/kasa/smartprotocol.py", line 73, in _query return await self._execute_query( ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/kasa/smartprotocol.py", line 202, in _execute_query return await self._execute_multiple_query(request, retry_count) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/kasa/smartprotocol.py", line 145, in _execute_multiple_query response_step = await self._transport.send(smart_request) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/kasa/klaptransport.py", line 356, in send decrypted_response = self._encryption_session.decrypt(response_data) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/kasa/klaptransport.py", line 491, in decrypt dp = decryptor.update(msg[32:]) + decryptor.finalize() ^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/cryptography/hazmat/primitives/ciphers/base.py", line 184, in finalize data = self._ctx.finalize() ^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/cryptography/hazmat/backends/openssl/ciphers.py", line 223, in finalize raise ValueError(

patfelst commented 1 month ago

For the last two days (approx) I have the same issue with 4x P110.

zqnikals commented 1 month ago

yeah. after each power outage i need to rebbot HA to get current consumption back

imsuperimposed commented 1 month ago

None of my P110s are connecting I have 5 have rebooted HA, the integration and power cycles the unit, this started three days ago.

aravindjaimon commented 1 month ago

Got a work around for the same by making the 2.4Ghz wifi channel to constant. Mine was set to Auto now moved to channel 6. Since today once all devices including router is restarted, Things started working normaly. But there can be a fix inside the integration as well.

sdb9696 commented 1 month ago

None of my P110s are connecting I have 5 have rebooted HA, the integration and power cycles the unit, this started three days ago.

This is not related to this issue. Please upgrade to 2024.7.3 and power cycle the devices to clear this issue.

aravindjaimon commented 1 month ago

@sdb9696 I got why its not working for me, I am using a TPLink mesh system in my home, I am not experiencing any issue once the mesh is turned off. Is there any patch that can be done to the system for this?

sdb9696 commented 1 month ago

So I'm working on a PR in the python-kasa library that could fix this. Any chance you could reach out to me on discord so we can test it with your setup? My username is sdb9696.

sdb9696 commented 3 weeks ago

This issue is fixed in the latest beta 2024.8.0.b0. Please feel free to test this out on the beta and provide any feedback in the homeassistant discord beta channel. (Make sure you have backups enabled in case you need to rollback).