core: Tp-link Kasa devices stopped working

The problem

Hi,

I have been using Tp-link Kasa integration for a long time. It has suddenly stopped working.

What version of Home Assistant Core has the issue?

2023.8.4

What was the last working version of Home Assistant Core?

Not Sure

What type of installation are you running?

Home Assistant OS

Integration causing the issue

TP-Link Kasa Smart

Link to integration documentation on our website

No response

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

Logger: homeassistant.config_entries
Source: config_entries.py:1250
First occurred: 31 August 2023 at 16:46:45 (175 occurrences)
Last logged: 08:23:19

Config entry 'Living Room Lights KS220M(US)' for tplink integration not ready yet: Unable to connect to the device: 192.168.1.63:9999: [Errno 104] Connect call failed ('192.168.1.63', 9999); Retrying in background
Config entry 'Master Bedroom 2 KL125(US)' for tplink integration not ready yet: Unable to query the device 192.168.1.33:9999: Connection lost; Retrying in background
Config entry 'Living Room Lights KS220M(US)' for tplink integration not ready yet: Unable to query the device 192.168.1.63:9999: [Errno 104] Connection reset by peer; Retrying in background
Config entry 'Fan HS103(US)' for tplink integration not ready yet: Unable to query the device 192.168.1.96:9999: [Errno 104] Connection reset by peer; Retrying in background
Config entry 'Master Bedroom 2 KL125(US)' for tplink integration not ready yet: Unable to query the device 192.168.1.33:9999: [Errno 104] Connection reset by peer; Retrying in background

Additional information

No response

About this issue

  • Original URL
  • State: closed
  • Created 10 months ago
  • Reactions: 4
  • Comments: 20 (9 by maintainers)

Most upvoted comments

This should be fixed in the latest HA release 2024.02

I’m seeing a similar issue, but I don’t know if it’s the same. I recently updated my docker container from 2023.10 to 2023.11.2 and now the Kasa integration broke. The devices are in “Failed setup, will retry” state.

I can see, in the debug logs, that get_sysinfo is being successful (I’ve masked some data)

023-11-12 10:31:45.877 DEBUG (MainThread) [kasa.discover] [DISCOVERY] ('tpplug1.spuddy.org', 9999) >> {'system': {'get_sysinfo': None}}
2023-11-12 10:31:45.883 DEBUG (MainThread) [kasa.discover] Waiting a total of 10 seconds for responses...
2023-11-12 10:31:45.886 DEBUG (MainThread) [kasa.discover] [DISCOVERY] 10.100.200.10 << {'system': {'get_sysinfo': {'sw_ver': '1.5.6 Build 191114 Rel.104204', 'hw_ver': '1.0', 'type': 'IOT.SMARTPLUGSWITCH', 'model': 'HS105(US)', 'mac': 'XXXX', 'dev_name': 'Smart Wi-Fi Plug Mini', 'alias': 'Office Light', 'relay_state': 0, 'on_time': 0, 'active_mode': 'none', 'feature': 'TIM', 'updating': 0, 'icon_hash': '', 'rssi': -37, 'led_off': 0, 'longitude_i': XXXXXX, 'latitude_i': XXXXX, 'hwId': 'XXXX', 'fwId': '00000000000000000000000000000000', 'deviceId': 'XXXX', 'oemId': 'XXX', 'next_action': {'type': -1}, 'err_code': 0}}}
2023-11-12 10:31:45.886 DEBUG (MainThread) [kasa.smartdevice] Initializing 10.100.200.10 of type <class 'kasa.smartplug.SmartPlug'>
2023-11-12 10:31:45.887 DEBUG (MainThread) [kasa.smartdevice] Adding module <Module Schedule (schedule) for 10.100.200.10>
2023-11-12 10:31:45.887 DEBUG (MainThread) [kasa.smartdevice] Adding module <Module Usage (schedule) for 10.100.200.10>
2023-11-12 10:31:45.888 DEBUG (MainThread) [kasa.smartdevice] Adding module <Module Antitheft (anti_theft) for 10.100.200.10>
2023-11-12 10:31:45.888 DEBUG (MainThread) [kasa.smartdevice] Adding module <Module Time (time) for 10.100.200.10>
2023-11-12 10:31:45.889 DEBUG (MainThread) [kasa.smartdevice] Adding module <Module Cloud (cnCloud) for 10.100.200.10>

I can also see UDP traffic being successful:

12:10:10.132824 IP hass.spuddy.org.36424 > tpplug1.spuddy.org.distinct: UDP, length 31
12:10:10.136609 IP hass.spuddy.org.36424 > tpplug1.spuddy.org.commtact-http: UDP, length 16
12:10:10.137874 IP hass.spuddy.org.36424 > tpplug1.spuddy.org.distinct: UDP, length 31
12:10:10.139021 IP hass.spuddy.org.36424 > tpplug1.spuddy.org.commtact-http: UDP, length 16
12:10:10.142032 IP hass.spuddy.org.36424 > tpplug1.spuddy.org.distinct: UDP, length 31
12:10:10.143133 IP hass.spuddy.org.36424 > tpplug1.spuddy.org.commtact-http: UDP, length 16
12:10:10.156699 IP tpplug1.spuddy.org.distinct > hass.spuddy.org.36424: UDP, length 595
12:10:10.156906 IP tpplug1.spuddy.org.distinct > hass.spuddy.org.36424: UDP, length 595
12:10:10.157277 IP tpplug1.spuddy.org.distinct > hass.spuddy.org.36424: UDP, length 595

(yeah, the timestamps are different 'cos I captured them at different times).

So I’m not sure if I’m seeing the same problem or if this is new.

I have the same problem as you (@sweharris), but I believe the issue is different from this issue’s OP. I have created a new issue for this: #103977

I’m seeing a similar issue, but I don’t know if it’s the same. I recently updated my docker container from 2023.10 to 2023.11.2 and now the Kasa integration broke. The devices are in “Failed setup, will retry” state.

I can see, in the debug logs, that get_sysinfo is being successful (I’ve masked some data)

023-11-12 10:31:45.877 DEBUG (MainThread) [kasa.discover] [DISCOVERY] ('tpplug1.spuddy.org', 9999) >> {'system': {'get_sysinfo': None}}
2023-11-12 10:31:45.883 DEBUG (MainThread) [kasa.discover] Waiting a total of 10 seconds for responses...
2023-11-12 10:31:45.886 DEBUG (MainThread) [kasa.discover] [DISCOVERY] 10.100.200.10 << {'system': {'get_sysinfo': {'sw_ver': '1.5.6 Build 191114 Rel.104204', 'hw_ver': '1.0', 'type': 'IOT.SMARTPLUGSWITCH', 'model': 'HS105(US)', 'mac': 'XXXX', 'dev_name': 'Smart Wi-Fi Plug Mini', 'alias': 'Office Light', 'relay_state': 0, 'on_time': 0, 'active_mode': 'none', 'feature': 'TIM', 'updating': 0, 'icon_hash': '', 'rssi': -37, 'led_off': 0, 'longitude_i': XXXXXX, 'latitude_i': XXXXX, 'hwId': 'XXXX', 'fwId': '00000000000000000000000000000000', 'deviceId': 'XXXX', 'oemId': 'XXX', 'next_action': {'type': -1}, 'err_code': 0}}}
2023-11-12 10:31:45.886 DEBUG (MainThread) [kasa.smartdevice] Initializing 10.100.200.10 of type <class 'kasa.smartplug.SmartPlug'>
2023-11-12 10:31:45.887 DEBUG (MainThread) [kasa.smartdevice] Adding module <Module Schedule (schedule) for 10.100.200.10>
2023-11-12 10:31:45.887 DEBUG (MainThread) [kasa.smartdevice] Adding module <Module Usage (schedule) for 10.100.200.10>
2023-11-12 10:31:45.888 DEBUG (MainThread) [kasa.smartdevice] Adding module <Module Antitheft (anti_theft) for 10.100.200.10>
2023-11-12 10:31:45.888 DEBUG (MainThread) [kasa.smartdevice] Adding module <Module Time (time) for 10.100.200.10>
2023-11-12 10:31:45.889 DEBUG (MainThread) [kasa.smartdevice] Adding module <Module Cloud (cnCloud) for 10.100.200.10>

I can also see UDP traffic being successful:

12:10:10.132824 IP hass.spuddy.org.36424 > tpplug1.spuddy.org.distinct: UDP, length 31
12:10:10.136609 IP hass.spuddy.org.36424 > tpplug1.spuddy.org.commtact-http: UDP, length 16
12:10:10.137874 IP hass.spuddy.org.36424 > tpplug1.spuddy.org.distinct: UDP, length 31
12:10:10.139021 IP hass.spuddy.org.36424 > tpplug1.spuddy.org.commtact-http: UDP, length 16
12:10:10.142032 IP hass.spuddy.org.36424 > tpplug1.spuddy.org.distinct: UDP, length 31
12:10:10.143133 IP hass.spuddy.org.36424 > tpplug1.spuddy.org.commtact-http: UDP, length 16
12:10:10.156699 IP tpplug1.spuddy.org.distinct > hass.spuddy.org.36424: UDP, length 595
12:10:10.156906 IP tpplug1.spuddy.org.distinct > hass.spuddy.org.36424: UDP, length 595
12:10:10.157277 IP tpplug1.spuddy.org.distinct > hass.spuddy.org.36424: UDP, length 595

(yeah, the timestamps are different 'cos I captured them at different times).

So I’m not sure if I’m seeing the same problem or if this is new.

With https://github.com/python-kasa/python-kasa/pull/528 I’m able to break UDP and/or move the device to the edge of wifi range and still connect the devices successfully

Still no luck with this. Some of the devices came back on their own last week intermittently and now back to none of them working.

In both cases, nothing changed except HA updates being applied to latest versions as applicable.