Kasa/TP-link devices constantly losing connection for less than a second

I just installed a bunch of Kasa smart lights. They’re working great, and openHAB is controlling them just fine… however, when I check my log, it’s filled with errors saying that a TP-link device has lost connection (timed out), followed in less than a second by a reconnection status. And of course, any associate item goes to “UNDEF” during the connection loss, and then back to its proper state.

If I didn’t look at my logs, I wouldn’t even know there was an issue, but my logs are seriously overrrun by these errors. I went all in on Kasa lights for my outdoor lighting area and some indoor lamps, so I currently have 13 kasa bulbs and it seems like most of them throw this error every couple of minutes.

Here’s an example disconnect/reconnect pair of lines from the log:

2021-12-21 16:19:32.716 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'tplinksmarthome:kl125:C6840B' changed from ONLINE to OFFLINE (COMMUNICATION_ERROR): Read timed out

2021-12-21 16:19:33.132 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'tplinksmarthome:kl125:C6840B' changed from OFFLINE (COMMUNICATION_ERROR): Read timed out to ONLINE

Has anyone else had this issue? Is there a way to suppress these particular types of log events? Or to figure out why the lights keep timing out?

I was thinking it might be an issue with poor wifi signal strength, but I have a mesh router with really good coverage, and the RSI in all locations should be more than adequate.

Maybe the binding has an ever-so-slightly shorter time-out on communications than the polling cycle of the bulbs?

Yep, I get that happening with my Kasas every once in awhile, but I don’t worry about it as there’s no real-world impact. It usually sorts itself out after awhile, and sometimes I reboot my router (which puts an end to it).

I don’t have bulbs, just switches and plugs. What’s interesting is that I also have a mesh router, and I can’t remember if this happened before that was the case. Maybe a Kasa decides to hop back and forth between the APs every once in awhile (even though that shouldn’t happen).

I don’t think that would be the case, or else it would happen with all of them constantly and never-endingly. @hilbrand, have you heard of this before?

The timeout is 3 seconds. What refresh cycle time did you set on the bulbs? Or did you use the default of 30 seconds? Because I wouldn’t expect that it comes online directly after the timeout.

Interested to hear a fix for this one also. I discovered a few months back that the newest patch to my router causes all my TP-Link light switches/smart plugs to start flapping as you describe. After some research I tried a number of settings changes with no effect before rolling back the patch.

No fault of openhab but definitely an annoyance.

I left the refresh cycle on the default 30 seconds.

I also have about 60 devices on the router, so maybe my router just can’t keep up… but most of the devices are just IoT things that shouldn’t have much traffic, and the router should theoretically handle upwards of 200 devices. It’s an Orbi RBR750 with two satellites. Not super high-end, but certainly better than most home wifi routers.

The plot thickens: my router is an Orbi RBR40. If @pleedell also has an Orbi, then we have a correlation.

It happened early this morning with one of my switches that’s only about 15ft from the router. Over the course of an hour, it disconnected and reconnected seven times (usually after two seconds), and then just went back to normal. Is this similar to what you’re seeing?

2021-12-22 00:00:38.919 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Switch_Office' changed from OFF to UNDEF
2021-12-22 00:00:40.155 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Switch_Office' changed from UNDEF to OFF

2021-12-22 00:26:35.794 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Switch_Office' changed from OFF to UNDEF
2021-12-22 00:26:37.740 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Switch_Office' changed from UNDEF to OFF

2021-12-22 00:37:04.674 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Switch_Office' changed from OFF to UNDEF
2021-12-22 00:37:06.167 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Switch_Office' changed from UNDEF to OFF

2021-12-22 00:37:36.274 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Switch_Office' changed from OFF to UNDEF
2021-12-22 00:37:38.699 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Switch_Office' changed from UNDEF to OFF

2021-12-22 00:53:38.754 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Switch_Office' changed from OFF to UNDEF
2021-12-22 00:53:40.658 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Switch_Office' changed from UNDEF to OFF

2021-12-22 00:56:42.834 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Switch_Office' changed from OFF to UNDEF
2021-12-22 00:56:44.222 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Switch_Office' changed from UNDEF to OFF

2021-12-22 01:02:21.071 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Switch_Office' changed from OFF to UNDEF
2021-12-22 01:02:22.467 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Switch_Office' changed from UNDEF to OFF

Huh. Someone on the TP-Link forum solved their problem by switching to an Orbi router.

Whatever the case, it’s almost certainly an issue between the router and Kasas.

Yeah, that’s similar.

I’m beginning to wonder if it has something to do with the mixed 2.4 and 5 GHz SSID, and the band auto-steering that Orbi uses. The kasa lights are 2.4 GHz only, so perhaps the Orbi is trying to push them to the 5GHz radio, and when that fails, it switches back to 2.4 and they reconnect? It could even be as simple as channel-switching, if the router is set to automatically select a channel

I’m out of the house at the moment, but when I get back I will do some experimenting with router settings and see what happens.

I don’t think the Orbi would try to push them to 5G, since they don’t have that capability. But I could see the switches jumping between access points.

Note that for me, it’s only ever one Kasa at a time. It’s not always the same Kasas, but I feel like some of my switches/plugs have never done it at all.

I’m curious about this paragraph from the first link I posted:

After looking at the router logs I saw that all of my HS105 plugs and my HS200 switch were constantly disconnecting and reconnecting to the router every few seconds. All of that activity seemed to be causing the outages I was having because once I isolated the problem and unplugged the plugs and blocked the switch, the outages have stopped. I blocked the switch using Wireless > Wireless MAC Filter on the 2.4GHz band which rendered it unusable in the Kasa app and also stopped it from trying to reconnect to the router every 5 seconds or so. I should note that the wifi signal to the switch was excellent -28db so that isn’t the issue.

It’s a bigger issue if it’s causing Internet outages, but I haven’t noticed that being a problem.

I had a look at the binding, and made some changes to not set the device directly off-line after a communication error, but retry 2 times before setting the device off-line. The idea is this should suppress setting the device going offline. I’ve put the updated binding in the marketplace here, so you can install it from main ui via the marketplace and try if it helps or if it needs some tweaking.


Thanks, Hilbrand! I haven’t jumped to 3.2 yet, but I’ll keep that in mind.

@Chad_Hadsell, if you want to try experimenting with router settings then I’d be happy to keep looking at it with you.

Thanks, Hilbrand! I’ve managed to tame the issue somewhat by giving each of my kasa devices a static IP, but it still happens.

Russ, have you tried assigning static IPs?

I’ll give this updated version of the binding a try and report back!

EDIT: After an hour of running the updated binding (and having the static IPs for the kasa devices), the disconnect error has been significantly reduced. I’m down to one or two every few minutes, instead of 10-12 every minute. The log is actually readable again! Thanks for the quick work on the updated binding, Hilibrand!

EDIT2: A few more hours later, and things have settled down even more. There were only 8 disconnect errors over the last hour. Seven were time-outs, and one was a “no route to host (Host Unreachable)” error. Also, only four of my kasa devices caused these errors, and one device accounted for half of the errors. I’ll be setting up the RSSI channel for that device to monitor the signal strength moving forward. I may just need to change the placement of my mesh satellites to make sure everything gets a good, strong signal.

I only use static IPs for switches/plugs. I had to do that for the system I was using before openHAB, so I just kept the habit. Perhaps that’s why I wasn’t seeing it as frequently as you.

Keep in mind that the disconnects are still happening even if they show up less frequently in your log due to Hilbrand’s mods. Might be worth keeping an eye on that TP-Link forum.

No orbi here, I use an Asus AX88U on firmware from July 2/2021. With about 70 devices connected I have no issues with the kasa switches or anything else, it is running perfectly. However I’ve attempted to upgrade to every other firmware release since then and each causes the flapping issue with kasa switches and smartplugs. I’ve gone through the vulnerability patches for the subsequent firmware release with the thinking that somewhere in that list is the root cause.

No luck yet however.

I am also seeing this issue. I am on OH 3.2. I have a Netgear router and 2 APs. I currently have 102 active devices on my network. Probably 70 are wireless. I have about 40 Kasa devices, switches, outlets, plugs and a couple bulbs. Most of the devices going offline were connected to my shop AP. Recently I had a problem with the AP and swapped it out for an Ubiquiti NanoStation M2. It is working great as an AP and yes, i do have a separate SSID. But I still have the read timeout issue and it is a mix of devices. I had hoped that upgrading to 3.2 would fix the issue, I also applied all the current updates this last week. So far, no luck. The log is not the issue for me. It is the fact that when it is offline, my rules do not work. The most annoying one is connected to my shop light switch and it controls another 6 or so devices. Turn on the light and it turns on the light over the TV, turns on 2 plugs for my monitors, turns on the heat or AC depending on outside temp, play music on Alexa and turns on my Ham Radio. When I shut it off, it turns off all those things plus anything else I may have turned on including the TV, soldering iron, Radio and Alexa music.

At this point I’ve basically given up. I think it’s just something to do with the kasa devices themselves, either hardware or firmware. They don’t behave well unless they have perfect signal strength and zero interference.
That being said, for me, the disconnect and re-connect are typically fast enough that I don’t notice any problems in everyday life. I just see it in the logs.
Actually, there are a few that have noticable issues, now that I think about it. I have two older smart plugs in my workshop, controlling a light and a shop vac, that sometimes lose connection and don’t reconnect for many minutes. That can be a bit annoying when I start working in there. But once I hit the button to manually control them, they seem to reconnect and stay connected for the duration of my work. These two have the weakest signal of all my kasa devices, so it’s just something I’ll have to live with unless I eventually decide to add an extra satellite or AP for the shop. Or switch to z-wave outlets out something.
All this to say: I’m disappointed with kasa. I’ll continue using the products that I have, but when it comes time to replace them, I’ll probably choose a different brand. (But not Wyze. They’re even worse!)

I could see that being the case, particularly since they only use 2.4Ghz. Sorry to hear it hasn’t gotten better.

I’ve actually switched to dynamic IPs, because I had to reset my router and couldn’t be bothered to set up all of the static assignments again. I haven’t noticed any issues, but I haven’t been looking closely at my log.

I would add that Belkin Wemos are also terrible. Though to be fair, it’s been years since I replaced all of my Wemos with Kasas, so maybe they’ve figured out how to do firmware updates without making things worse.

My real hope is that we’ll be replacing all of our WiFi devices with Matter/Thread devices. I won’t be in a rush to do that, as there are going to be some growing pains, but it’s worth keeping on your radar.

maybe it is just me but that many wifi devices, no matter how many APs, just seems an awful lot

Maybe? Most WiFI APs can handle up to 255 devices, and IoT stuff shouldn’t be very demanding (emphasis on “shouldn’t”). I just counted, and I have about 45 devices on my WiFi network. Most of the time, 70-80% of them aren’t doing anything at all.

I’m more inclined to chalk it up to interference in the 2.4Ghz spectrum…which makes me sound like Bruce Osbourne. :wink:

1 Like

Can confirm. I have about 50 kasa/tp link smart light switches and plugs on a single wifi network (about 75 devices in total) and they generate about 150kb each of traffic daily. Not nothing, but very close to it.