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
74.08k stars 31.09k forks source link

TP-Link Kasa KL125 bulbs unreliable within HA since 2024.10.2 #128677

Open welborn opened 1 month ago

welborn commented 1 month ago

I have 11 kasa KL125 bulbs and since 2024.10.2 (I skipped 2024.10.0 and 2024.10.1 releases) they've been going offline in HA. In the app they are always online and consistently immediately responsive. The fact that the app works instantly on all bulbs that show offline in HA tells me that this is definitely a HA integration thing.

One person in another thread mentioned changing IPs in dhcp, but I've since migrated all to static IPs.

This is what I see in home assistant. Again, all of these have solid signal to the access point, and are available in the kasa app and instantly respond to changes from kasa.

image

Some of the behavior I see when using the homeassistant is:

When turning on or off a group of 4 bulbs I see the following behavior

Not all will toggle usually 2 or 3 out of 4 One may blink at full brightness for about a tenth of a second every 3 to 4 seconds Sometimes they come on a different brightnesses When adjusting individual bulbs Long delays before responding Bulb immediately reporting offline Bulb coming on at partial brightness when instructed to turn on at 100%

Code for my toggle call

metadata: {}
data:
  brightness_pct: 100
target:
  area_id: office
  entity_id: light.office_lights
action: light.toggle

light.office_lights is a group entity containing office light 1-4

Adding log entries - I see a bunch of this over and over with all of my bulbs:

2024-10-18 12:13:17.806 ERROR (MainThread) [homeassistant.components.tplink.coordinator] Error fetching 10.1.11.19 data: Unable to query the device 10.1.11.19:9999:
2024-10-18 12:13:17.807 WARNING (MainThread) [homeassistant.components.group.sensor] Unable to use state. Only numerical states are supported, entity sensor.office_light_1_current_consumption with value unavailable excluded from calculation in sensor.lights_current_energy_usage
2024-10-18 12:13:17.807 WARNING (MainThread) [homeassistant.components.group.sensor] Unable to use state. Only numerical states are supported, entity sensor.office_light_1_today_s_consumption with value unavailable excluded from calculation in sensor.lights_today_s_usage
2024-10-18 12:13:18.005 ERROR (MainThread) [homeassistant.components.tplink.coordinator] Error fetching 10.1.11.10 data: Unable to query the device 10.1.11.10:9999:
2024-10-18 12:13:18.007 WARNING (MainThread) [homeassistant.components.group.sensor] Unable to use state. Only numerical states are supported, entity sensor.office_light_4_current_consumption with value unavailable excluded from calculation in sensor.lights_current_energy_usage
2024-10-18 12:13:18.007 WARNING (MainThread) [homeassistant.components.group.sensor] Unable to use state. Only numerical states are supported, entity sensor.office_light_4_today_s_consumption with value unavailable excluded from calculation in sensor.lights_today_s_usage
2024-10-18 12:13:27.946 ERROR (MainThread) [homeassistant.components.tplink.coordinator] Error fetching 10.1.11.11 data: Unable to query the device 10.1.11.11:9999:
2024-10-18 12:13:27.947 WARNING (MainThread) [homeassistant.components.group.sensor] Unable to use state. Only numerical states are supported, entity sensor.bedroom_light_2_current_consumption with value unavailable excluded from calculation in sensor.lights_current_energy_usage
2024-10-18 12:13:27.947 WARNING (MainThread) [homeassistant.components.group.sensor] Unable to use state. Only numerical states are supported, entity sensor.bedroom_light_2_today_s_consumption with value unavailable excluded from calculation in sensor.lights_today_s_usage

more logs from logbook

Kitchen 2 Light preset changed to Not set
1:17:38 PM - Now
Kitchen 2 turned off
1:17:38 PM - Now
Kitchen 2 Cloud connection was connected
1:17:38 PM - Now
Office Light 3 Light preset changed to Not set
1:17:35 PM - Now
Office Light 3 turned on
1:17:35 PM - Now
Office Light 3 Cloud connection was connected
1:17:35 PM - Now
Office Light 4 Light preset became unavailable
1:17:35 PM - Now
Office Light 4 became unavailable
1:17:35 PM - Now
Office Light 4 Cloud connection became unavailable
1:17:35 PM - Now
Kitchen Lights turned off triggered by state of Kitchen 1 turned off
1:17:32 PM - 1 second ago
Kitchen 1 Light preset changed to Not set
1:17:32 PM - 1 second ago
Kitchen 1 turned off
1:17:32 PM - 1 second ago
Kitchen 1 Cloud connection was connected
1:17:32 PM - 1 second ago
Bedroom Light 1 Light preset changed to Not set
1:17:27 PM - 6 seconds ago
Bedroom Light 1 turned off
1:17:27 PM - 6 seconds ago
Bedroom Light 1 Cloud connection was connected
1:17:27 PM - 6 seconds ago
Bedroom Light 3 Light preset changed to Not set
1:17:26 PM - 8 seconds ago
Bedroom Light 3 turned off
1:17:26 PM - 8 seconds ago
Bedroom Light 3 Cloud connection was connected
1:17:26 PM - 8 seconds ago
Bedroom Light 2 Light preset became unavailable
1:17:24 PM - 9 seconds ago
Bedroom Light 2 became unavailable
1:17:24 PM - 9 seconds ago

Originally posted by @welborn in https://github.com/home-assistant/core/issues/128040#issuecomment-2422964545

welborn commented 1 month ago

Additional info:

Confirmed all firmware on all bulbs are up to date.

Confirmed that all bulbs appear online in firewall and that all IPs are static and unchanging.

image

Confirmed signal strength for all bulbs - bulb with the lowest signal (laundry room bulb) gives me the least problems

image
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)

ForTheRush commented 1 month ago

Im experiencing the same issue with both my kasa k125 bulbs. I have 4 and they take turns dropping from home assistant but work perfectly fine from the kasa app.

jchene6253 commented 1 month ago

I too have been experiencing issues with the KL125 bulb. since I went from 2024.10.0 to 2024.10.3. Long latency, sometimes minutes for the build to receive. Other times Home Assistant says the bulb and its' sensor is "unavailable", even though the bulb is connected to the network. Other times Home Assistant will show the state of the bulb as off, but it actually on.

carlosgcabadas commented 1 month ago

Same problem here, have had this issue for a couple of months now. My KL125 bulbs as well as my KL400 light strip constantly appear disconnected on home assistant for seemingly no reason, becoming 'online' and 'offline' at random times for a random duration, despite being connected to their own wireless access point and ssid. The issue has remained even after switching to other access points, setting static addresses, and resetting the lights themselves.

bdraco commented 1 month ago

It sounds like your event loop might be blocked or something also is causing the instability.

https://community.home-assistant.io/t/2024-5-tracking-down-instability-issues-caused-by-integrations/724441?u=bdraco

See the section on Sluggish performance or increased CPU usage

Capture a callgrind when the problem is happening and post it here. The call grind will only show traces of the source code so there is minimal privacy concerns about posting it (unless you are worried about someone knowing which integrations are running)

welborn commented 1 month ago

I can tell you that a fresh reboot does not fix the issue and when I attempt to use the lights the CPU spikes briefly to 100% and returns to it's normal 6 to 7% on my system. The Memory spikes from around 75% to around 95% and does not return to a baseline of 75%.

olddawgpowers commented 3 weeks ago

I have 4 KL125 with the same issue. Most of the time the unavailable is less than 10 minutes in HA but available on the Kasa app.

GLotsapot commented 3 weeks ago

I have several KL125 bulbs with the same issue. They seem to not stay offline for too long (a minute or two) before they come back online in HA. Whole offline in HA they are still working through the app. They don't all go offline at the same time either, and seems to be random.

PantACRO4life commented 2 weeks ago

I also have a few of those KL125 and I experience the same issue