Open BettySwallocks opened 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!
(message by CodeOwnersMention)
tplink documentation tplink source (message by IssueLinks)
No updates at all then?
I have seen this error when the wrong encryption parameters are used (klap instead of AES). Maybe this IP address was previously used by another device? However, the parameters should be updated if discovery is working. Is that the case?
You could try to add a new tplink device or restart homeassistant to trigger the discovery, if you haven't done that already.
I've retried the device by removing and it pops up as a new discovery, but fails every time when adding. I've now seen this happen for other Tapo devices including L510B bulbs, they are now unusable through HA and this integration. Similar errors, always 'handshake' errors, unable to query the device and responses with XML including '200 OK' values. It's a real mess. I do thing the Klap protocol thing is connected. Does it simply not work with some strip/bulb firmware versions?
It is hard to say without more information, but yes, it's feels related to a firmware update that changes the used encryption method. It is rather hard to debug inside homeassistant, so you could try following these instructions I wrote in another issue to help debugging using the kasa tool: https://github.com/home-assistant/core/issues/123651#issuecomment-2293387915
After you have discovered the IP address, you can try changing the encryption method like this:
kasa --host 192.168.123.123 --type smart -e AES # for aes encryption
kasa --host 192.168.123.123 --type smart -e KLAP # for klap encryption
here's what happens if I try klap on my test device that requires AES:
Raised error: Device 192.168.123.123 responded with unexpected klap response b'<html><body><center>200 OK</center></body></html>' to handshake1
Could you please attach the diagnostics file from the device page of one of those devices that is not working? Or at least look inside of it and paste the contents of the connection_type
object which contains the encryption parameters.
I haven't installed or run the kasa library commands yet as I need to work out how & where to install (as I have HAOS on my Raspi and not a more open version). However this is some log content from a non-working L510 bulb with IP .59 and a working L510 bulb with IP of .71:
2024-08-16 14:43:20.547 DEBUG (MainThread) [kasa.klaptransport] Created KLAP transport for 192.168.0.59
2024-08-16 14:43:20.548 DEBUG (MainThread) [kasa.device] Initializing 192.168.0.59 of type <class 'kasa.smart.smartdevice.SmartDevice'>
2024-08-16 14:43:20.549 DEBUG (MainThread) [kasa.smartprotocol] 192.168.0.59 multi-request-batch-1-of-1 >> '{"method":"multipleRequest","request_time_milis":1723815800549,"terminal_uuid":"82f5K84n+716KMRC2vyovg==","params":{"requests":[{"method":"component_nego"},{"method":"get_device_info"},{"method":"get_connect_cloud_state"}]}}'
2024-08-16 14:43:20.549 DEBUG (MainThread) [kasa.klaptransport] Starting handshake with 192.168.0.59
2024-08-16 14:43:20.550 DEBUG (MainThread) [kasa.httpclient] Posting to http://192.168.0.59:80/app/handshake1
2024-08-16 14:43:20.579 DEBUG (MainThread) [kasa.klaptransport] Handshake1 posted at 2024-08-16 14:43:20.578998. Host is 192.168.0.59, Responsestatus is 200, Request was a38b9de54c01f914f0fa2a4b590bfdf3
2024-08-16 14:43:20.579 DEBUG (MainThread) [kasa.smartprotocol] Unable to query the device: 192.168.0.59, not retrying: Device 192.168.0.59 responded with unexpected klap response b'<html><body><center>200 OK</center></body></html>' to handshake1
2024-08-16 14:43:23.270 DEBUG (MainThread) [kasa.smart.smartdevice] Querying 192.168.0.71 for modules: Cloud, DeviceModule, LightPreset, Time
2024-08-16 14:43:23.271 DEBUG (MainThread) [kasa.smartprotocol] 192.168.0.71 multi-request-batch-1-of-2 >> '{"method":"multipleRequest","request_time_milis":1723815803271,"terminal_uuid":"cxhbBK42/g1ZfMJk1/3yGg==","params":{"requests":[{"method":"get_connect_cloud_state"},{"method":"get_device_info"},{"method":"get_device_usage"},{"method":"get_preset_rules"},{"method":"get_device_time"}]}}'
2024-08-16 14:43:23.271 DEBUG (MainThread) [kasa.httpclient] Posting to http://192.168.0.71:80/app/request
2024-08-16 14:43:23.465 DEBUG (MainThread) [kasa.klaptransport] Device 192.168.0.71 query posted Host is 192.168.0.71, Sequence is -1928573160, Response status is 200, Request was {"method":"multipleRequest","request_time_milis":1723815803271,"terminal_uuid":"cxhbBK42/g1ZfMJk1/3yGg==","params":{"requests":[{"method":"get_connect_cloud_state"},{"method":"get_device_info"},{"method":"get_device_usage"},{"method":"get_preset_rules"},{"method":"get_device_time"}]}}
2024-08-16 14:43:23.465 DEBUG (MainThread) [kasa.klaptransport] Device 192.168.0.71 query response received
2024-08-16 14:43:23.470 DEBUG (MainThread) [kasa.smartprotocol] 192.168.0.71 multi-request-batch-1-of-2 << {'error_code': 0,
'result': {'responses': [{'error_code': 0,
'method': 'get_connect_cloud_state',
'result': {'status': 0}},
{'error_code': 0,
'method': 'get_device_info',
'result': {'avatar': 'bulb',
'brightness': 50,
'default_states': {'brightness': {'type': 'last_states',
'value': 50}},
'device_id': 'REDACTED_43224458A4C51EC9340376D1E2CB1A8',
'device_on': False,
'fw_id': '7BECA9DC454565672FEC87D1104F9972',
'fw_ver': '1.3.1 Build 20240630 Rel. '
'64117',
'has_set_location_info': True,
'hw_id': '93F94D88DA9499F43B929DD38EBDF09A',
'hw_ver': '1.0',
'ip': '192.168.0.71',
'lang': 'en_US',
'latitude': 0,
'longitude': 0,
'mac': '00-31-92-00-00-00',
'model': 'L510 Series',
'nickname': 'I01BU0tFRF9OQU1FIw==',
'oem_id': 'REDACTED_CE8019B59D9E81CEDD371BD',
'on_time': 0,
'overheated': False,
'region': 'Europe/London',
'rssi': -52,
'signal_level': 2,
'specs': 'EU',
'ssid': 'I01BU0tFRF9TU0lEIw=',
'time_diff': 0,
'type': 'SMART.TAPOBULB'}},
{'error_code': 0,
'method': 'get_device_usage',
'result': {'power_usage': {'past30': 293,
'past7': 49,
'today': 0},
'saved_power': {'past30': 3731,
'past7': 634,
'today': 0},
'time_usage': {'past30': 4024,
'past7': 683,
'today': 0}}},
{'error_code': 0,
'method': 'get_preset_rules',
'result': {'brightness': [100, 75, 50, 25, 5]}},
{'error_code': 0,
'method': 'get_device_time',
'result': {'region': 'Europe/London',
'time_diff': 0,
'timestamp': 1723815803}}]}}
2024-08-16 14:43:23.471 DEBUG (MainThread) [kasa.smart.smartdevice] Update completed 192.168.0.71: ['get_connect_cloud_state', 'get_device_info', 'get_device_usage', 'get_preset_rules', 'get_device_time']
2024-08-16 14:43:23.471 DEBUG (MainThread) [homeassistant.components.tplink.coordinator] Finished fetching 192.168.0.71 data in 0.202 seconds (success: True)
The two bulbs were bought at different times, one from Amazon, one from a UK Argos type store.
If you have Linux or OSX available, you can run those commands directly inside the terminal after having everything set like described in that linked comment.
The same commands, except for virtualenv, should work on Windows as long as you have python installed (which can be obtained from the windows store or python.org).
To create and active virtualenv on Windows, run (using here kasa
as a name of the environment, but it can be chosen however you like):
python -m venv kasa
.\kasa\Scripts\activate
The virtualenv is used to keep everything neatly contained, so you can simply remove the directory after you don't need it anymore.
The problem
After update to HA 2024.8 the L900 TP-Link Kasa smart light strip will not authenticate or operate in HA
What version of Home Assistant Core has the issue?
core-2024.8.0
What was the last working version of Home Assistant Core?
core-2024.7.3
What type of installation are you running?
Home Assistant OS
Integration causing the issue
TP-Link Smart Home
Link to integration documentation on our website
No response
Diagnostics information
home-assistant_tplink_2024-08-08T20-37-10.115Z.log
Example YAML snippet
No response
Anything in the logs that might be useful for us?
Additional information
No response