Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kasa KL125 keeps disconnecting (local only) #117057

Closed
patienttruth opened this issue May 8, 2024 · 6 comments
Closed

Kasa KL125 keeps disconnecting (local only) #117057

patienttruth opened this issue May 8, 2024 · 6 comments

Comments

@patienttruth
Copy link

The problem

Hi, I've had ongoing trouble with my KL125 bulbs going unavailable. These bulbs are blocked from the internet with a DNS filter, and it's my understanding that they will reboot to attempt to fix their connection.

At first I thought I fixed it by provisioning a test bulb with python-kasa, but it eventually started the same symptom which is that the bulb goes unresponsive numerous times each day. It's become worse with 2024.5 vs 2024.4. it was tolerable with 2024.4.

I'm guessing that there was an underlying issue that 2024.5 has provoked, but I'm not sure where to start tracking it down.

Here are two log records with different errors pertaining to the bulbs.

Log 1
Logger: homeassistant.components.tplink.coordinator
Source: helpers/update_coordinator.py:347
integration: TP-Link Smart Home (documentation, issues)
First occurred: 19:28:16 (25 occurrences)
Last logged: 21:27:08

Error fetching 192.168.107.27 data: Unable to connect to the device: 192.168.107.27:9999:
Error fetching 192.168.107.28 data: Unable to connect to the device: 192.168.107.28:9999:
Error fetching 192.168.107.26 data: Unable to connect to the device: 192.168.107.26:9999:
Error fetching 192.168.107.26 data: Unable to connect to the device: 192.168.107.26:9999: [Errno 111] Connect call failed ('192.168.107.26', 9999)
Error fetching 192.168.107.27 data: Unable to connect to the device: 192.168.107.27:9999: [Errno 111] Connect call failed ('192.168.107.27', 9999)
Log 2
Logger: homeassistant.core
Source: core.py:2758
First occurred: 20:25:57 (3 occurrences)
Last logged: 20:47:05

Error executing service: <ServiceCall light.turn_on (c:01HXB3RDD6:al:KNXW:ntrv:2A): entity_id=['light.gena_s_lamp_bulb'], params=transition=3.0, brightness=120>
Error executing service: <ServiceCall light.turn_on (c:01HXB4EEFS:al:KNXW:ntrv:2E): entity_id=['light.master_fan_lightbulb'], params=transition=3.0, brightness=105>
Error executing service: <ServiceCall light.turn_on (c:01HXB4YZ9Q:al:KNXW:ntrv:2H): entity_id=['light.evans_lamp_bulb'], params=transition=3.0, brightness=95>
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/kasa/xortransport.py", line 66, in _connect
    self.reader, self.writer = await task
                               ^^^^^^^^^^
  File "/usr/local/lib/python3.12/asyncio/streams.py", line 48, in open_connection
    transport, _ = await loop.create_connection(
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1102, in create_connection
    sock = await self._connect_sock(
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1005, in _connect_sock
    await self.sock_connect(sock, address)
  File "/usr/local/lib/python3.12/asyncio/selector_events.py", line 641, in sock_connect
    return await fut
           ^^^^^^^^^
asyncio.exceptions.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/kasa/xortransport.py", line 129, in send
    await self._connect(self._timeout)
  File "/usr/local/lib/python3.12/site-packages/kasa/xortransport.py", line 65, in _connect
    async with asyncio_timeout(timeout):
  File "/usr/local/lib/python3.12/site-packages/async_timeout/__init__.py", line 141, in __aexit__
    self._do_exit(exc_type)
  File "/usr/local/lib/python3.12/site-packages/async_timeout/__init__.py", line 228, in _do_exit
    raise asyncio.TimeoutError
TimeoutError

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/kasa/smartdevice.py", line 294, in _query_helper
    response = await self.protocol.query(request=request)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/kasa/iotprotocol.py", line 43, in query
    return await self._query(request, retry_count)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/kasa/iotprotocol.py", line 64, in _query
    raise ex
  File "/usr/local/lib/python3.12/site-packages/kasa/iotprotocol.py", line 48, in _query
    return await self._execute_query(request, retry)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/kasa/iotprotocol.py", line 86, in _execute_query
    return await self._transport.send(request)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/kasa/xortransport.py", line 143, in send
    raise RetryableException(
kasa.exceptions.RetryableException: Unable to connect to the device: 192.168.107.28:9999: 

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/tplink/entity.py", line 34, in _async_wrap
    await func(self, *args, **kwargs)
  File "/usr/src/homeassistant/homeassistant/components/tplink/light.py", line 270, in async_turn_on
    await self._async_turn_on_with_brightness(brightness, transition)
  File "/usr/src/homeassistant/homeassistant/components/tplink/light.py", line 255, in _async_turn_on_with_brightness
    await self.device.set_brightness(brightness, transition=transition)
  File "/usr/local/lib/python3.12/site-packages/kasa/smartdevice.py", line 72, in wrapped
    return await f(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/kasa/smartbulb.py", line 480, in set_brightness
    return await self.set_light_state(light_state, transition=transition)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/kasa/smartbulb.py", line 353, in set_light_state
    light_state = await self._query_helper(
                  ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/kasa/smartdevice.py", line 296, in _query_helper
    raise SmartDeviceException(f"Communication error on {target}:{cmd}") from ex
kasa.exceptions.SmartDeviceException: Communication error on smartlife.iot.smartbulb.lightingservice:transition_light_state

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/core.py", line 2758, in _run_service_call_catch_exceptions
    await coro_or_task
  File "/usr/src/homeassistant/homeassistant/core.py", line 2779, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/adaptive_lighting/hass_utils.py", line 62, in service_func_proxy
    await existing_service.job.target(call)
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 975, in entity_service_call
    single_response = await _handle_entity_call(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1047, in _handle_entity_call
    result = await task
             ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/light/__init__.py", line 627, in async_handle_light_on_service
    await light.async_turn_on(**filter_turn_on_params(light, params))
  File "/usr/src/homeassistant/homeassistant/components/tplink/entity.py", line 55, in _async_wrap
    raise HomeAssistantError(
homeassistant.exceptions.HomeAssistantError: Unable to communicate with the device async_turn_on: Communication error on smartlife.iot.smartbulb.lightingservice:transition_light_state

I have an inquiry out to Kasa to see if there's something on their end that can be fixed as it seems I'm not the only one having issues with blocking Internet. I also have a plug and a power strip that don't have this same issue.

There's also a thread on the community forum with similar symptoms, however they were able to "unbind" their device from cloud whereas that doesn't work when I try it.

I checked docs and it doesn't mention anything about issues with local only devices, so maybe it's on my end.

What version of Home Assistant Core has the issue?

2024.5.2

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

Kasa TP Link

Link to integration documentation on our website

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

Diagnostics information

Here's one of the diagnostic files. I'm happy to post the rest. This is from the bulb that was manually provisioned with kasa-python.

config_entry-tplink-34d15ed4e8bff1f5803778f6f621d154-1.json

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

@home-assistant
Copy link

home-assistant bot commented May 8, 2024

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)

@patienttruth
Copy link
Author

I forgot that I'd read over on kasa-python that this may be due to a programmed function on the firmware. I thought I should post here since after going back to 2024.44 and then back to 2024.5.2 again I can confirm that the symptom is much more of a problem with .5.2.

@jaymunro
Copy link

Possible duplication of #116089

@patienttruth
Copy link
Author

Possible duplication of #116089

Thank you. I just reviewed that, and haven't seen any log entries that are similar. None of my log errors mention authentication. (I'm not sure if this is necessary, but my devices are all those which kasa-python lists as not requiring authentication).

@sdb9696
Copy link
Contributor

sdb9696 commented May 10, 2024

Yeah this isn't a dupe of #116089 as this device does not perform authentication

@rytilahti
Copy link
Member

https://community.tp-link.com/en/smart-home/forum/topic/666612 it's a problem with the firmware and doesn't affect homeassistant only, so there is nothing we can do here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants