Closed jibincj closed 3 years ago
Sounds like a network problem, but maybe related to other recent changes? Ping @TheGardenMonkey
Are you also controlling the devices from the Kasa app? Are they showing a strong wifi signal? Is it all of the devices or just some? I also have a mesh and the only time I see issues is when a device is connected to a wifi point further away than expected. When that happens I either restart the device itself and it goes to a closer one.
I am able to control from Kasa App without any issues. I am sending sample screenshots from HA and Kasa app of the same device. The device is a smart switch HS200. HA shows it as unavailable while Kasa shows it as available with a signal strength of -48dBm.
I have the exact same everything...same hs200 (a bunch of them) / hw version 2.0 and even my signal on most show around -44dBm. I haven't had mine ever go unavailable. I am also on an rpi 4 connected via ethernet directly to my google wifi mesh main puck. Do you see retry attempts in your logs? It should show a bunch of attempts before going unavailable. I am working on a PR that will allow you to configure the time it takes before becoming unavailable which could hep this issue.
More devices became unavailable today...
Here are some logs...
Logger: homeassistant.components.light Source: helpers/entity_platform.py:602 Integration: Light (documentation, issues) First occurred: 8:19:01 AM (6016 occurrences) Last logged: 4:43:05 PM
Updating tplink light took longer than the scheduled update interval 0:00:05
2. Logger: homeassistant.components.switch Source: helpers/entity_platform.py:602 Integration: Switch (documentation, issues) First occurred: 2:12:20 PM (298 occurrences) Last logged: 4:42:51 PM
Updating tplink switch took longer than the scheduled update interval 0:00:30
3. Logger: homeassistant.components.tplink.light Source: components/tplink/light.py:485 Integration: TP-Link Kasa Smart (documentation, issues) First occurred: 8:34:39 AM (1 occurrences) Last logged: 8:34:39 AM
Could not read state for 192.168.0.144|Master Bed Lamp
4. Logger: homeassistant.components.tplink.switch Source: components/tplink/switch.py:194 Integration: TP-Link Kasa Smart (documentation, issues) First occurred: 2:46:53 PM (1 occurrences) Last logged: 2:46:53 PM
Could not read state for 192.168.0.127|Loft Light
You should also have some entries that look like "Retrying in 2 seconds for 192.168.0.127|Loft Light due to: SOME_ERROR". Can you enable debug logging:
logger:
default: warning
logs:
homeassistant.components.tplink: debug
pyHS100: debug
I enabled the logger in config file and restarted HA. I have 25 TP Link devices out of which 19 are showing as available. As per logs, I can see..
2021-02-09 20:23:02 DEBUG (MainThread) [homeassistant.components.tplink] Got 4 lights: <4 ip addresses> 2021-02-09 20:23:02 DEBUG (MainThread) [homeassistant.components.tplink] Got 15 switches: <15 ip addresses>
The logs now show nothing about the unavailable devices. I tried searching with the name of the unavailable devices and nothing came back.
Should I be looking for something else?
So I got a pretty big log file of more than 375K lines that appeared to be produced by "pyHS100.protocol". I really could not find any errors. Please let me know if there is a specific keyword you would like me to lookup for?
From the log, I removed entries that had keyword "err_code":0 (assuming these are entries with no errors), then I was left with half the size of log entries. I am attaching the log file for reference. Please take a look. pyHS100.txt
Did that log include times of when they went unavailable? There should be entries showing that there was an error connecting and then that there was a retry and then a giving up....I don't see any of that in the log.
Got some of those logs today.
FYI, there were few lines writing out the device ID, MAC, etc., these were for devices showing as available and hence I removed them from the log.
Did any of those go "unavailable" or did it just keep warning?
The only time I have seen this is when I had some hung hass process...I would restart HA, but the previous running instance would not exit properly and then a new hass process would start and I assume it meant that there were multiple polls of my devices happening and that would cause the devices to be less responsive (but I never confirmed).
A few times I did find it was due to some custom integration hanging up HA...I would end up just rebooting my PI and everything would work fine. Even other errors like those google api ones you have could cause it.
I am not saying this the cause in your case, but just putting it out there in case it could help (do a ps -ef | grep hass and make sure only one is returned). I am not sure if there is a way to work around that...I am working on another update not related to this but so far I can't think of what else could cause the issue you are seeing. (technically the change I am making would allow you to configure how long before the devices become "unavailable" so it could help your issue but it really is just a band aid).
The logs was just printing warnings.
I kind of gave up for time being and for just the TP-Link devices, I rolled back to my old router. Now my old router is working as an additional Access point to my mesh network. Created a new SSID for the mesh network while maintaining the old SSID for the old router just for TP-Link devices. For time being, the TP-Link devices are all showing as available. I will post an update here after couple of days usage.
Update after 10 days. With the devices now connected to non mesh network, everything seems to be working fine. There were certain times when devices became unavailable. However, after I did a reload of the integration, it became available. I found myself doing this one or two times only.
I am curious as to which mesh you have. Just yesterday I switched to Fios and gave up my google wifi 3 puck mesh (the 2016 model) for their default single node wifi 6 router. Most of my devices would fail to connect / become unavailable...but this was even in the kasa app and just overall on my network. I just purchased the asus wifi 6 - 2 node mesh and I am hoping for better results.
I guess do you feel confident that you had the pucks placed in good spots? Just a few feet makes a huge a difference.
A few times when I had my google wifi pucks, i noticed that a few misbehaving devices were not connected to the closest one. I don't have any meaningful knowledge of why that happened though.
I have a TPLink Deco M9 Plus tri pack. I have placed the routers in best possible configuration. One in Basement, one in ground floor and other in first floor. The way they connected to the devices sometimes confused me. A puck would be sitting right next to the TpLink switch but switch would be connected to a distant puck. I even tried to force the device to connect to nearest puck. Even then I was facing issues with device becoming unavailable in HA.
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.
The problem
I recently added mesh wifi routers (Deco M9 plus) I've observed that TP Link devices becoming sporadically unavailable... They come back online (occasionally) either with a Host System reboot or after an update of HA to the next release.
I'm running HA on Pi4 and is connected via ethernet.
This is not a new issue with latest version of HA Core. This has been going on for about 1-2 months
What is version of Home Assistant Core has the issue?
core-2021.2.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
tplink
Link to integration documentation on our website
https://www.home-assistant.io/integrations/tplink/
Example YAML snippet
Anything in the logs that might be useful for us?