Closed wzaatar closed 1 year ago
Hey there @rytilahti, @thegardenmonkey, 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)
Noticed the same problem, seems to be an issue introduced with python-kasa 0.5.2. Rolling that back to 0.5.1 and the problem went away
Noticed the same problem, seems to be an issue introduced with python-kasa 0.5.2. Rolling that back to 0.5.1 and the problem went away
Possible with HA OS?
Which models are the devices that stopped working?
Is it all the same model?
Do some of the same model work and some don't?
In my situation it was both KP115 devices. EP40 and HS300 were not impacted and still functioned. using the kasa-python command line I would get the following errors trying to discover devices:
Discovering devices on 255.255.255.255 for 3 seconds
ERROR Exception in callback _SelectorDatagramTransport._read_ready() base_events.py:1771
handle: <Handle _SelectorDatagramTransport._read_ready()>
Traceback (most recent call last):
File "/usr/local/lib/python3.11/asyncio/events.py", line 80, in _run
self._context.run(self._callback, *self._args)
File "/usr/local/lib/python3.11/asyncio/selector_events.py", line 1169, in _read_ready
self._protocol.datagram_received(data, addr)
File "/usr/local/lib/python3.11/site-packages/kasa/discover.py", line 79, in datagram_received
info = json_loads(TPLinkSmartHomeProtocol.decrypt(data))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
orjson.JSONDecodeError: unexpected end of data: line 1 column 382 (char 381)
ERROR Exception in callback _SelectorDatagramTransport._read_ready() base_events.py:1771
handle: <Handle _SelectorDatagramTransport._read_ready()>
Traceback (most recent call last):
File "/usr/local/lib/python3.11/asyncio/events.py", line 80, in _run
self._context.run(self._callback, *self._args)
File "/usr/local/lib/python3.11/asyncio/selector_events.py", line 1169, in _read_ready
self._protocol.datagram_received(data, addr)
File "/usr/local/lib/python3.11/site-packages/kasa/discover.py", line 79, in datagram_received
info = json_loads(TPLinkSmartHomeProtocol.decrypt(data))
Which models are the devices that stopped working?
Is it all the same model?
Do some of the same model work and some don't?
3rd answer in my case. Some devices of a certain model work, others donât.
Thanks. Ordered a KP115. Should be here early next week. Will see if I can figure out what's going wrong
I bet it's a null/0 byte in the encrypted data and it's prematurely truncating the string in the conversion.
If you can get a wire shark dump of it happening I can probably fix it without waiting for the device
Tcpdump or any type of pcap will work as well
@bdraco This is not only related to KP115. I have other switches that are behaving the same way, specificallyHS100, HS200, HS220.
Just need one to trigger the issue. Any of the ones not working with the same symptom should probably be enough to find the issue
But thanks for answering my original question and providing the model numbers
I have 6 Kasa KP125 smart plugs. After upgrading to 2023.7 one of the plugs stopped working and gave me a setup error in Home Assistant. Works without issue in 2023.6.3. All KP125 are the same with hardware version 1.0 and firmware version 1.0.10
I have 6 Kasa KP125 smart plugs. After upgrading to 2023.7 one of the plugs stopped working and gave me a setup error in Home Assistant. Works without issue in 2023.6.3. All KP125 are the same with hardware version 1.0 and firmware version 1.0.10
If you rename that device in the tplink app does it fix it?
@geekofweek suggested that a rollback to python-kasa 0.5.1 fixed it for him. Maybe a code diff?
It's likely a problem with the encryption library changes. Rolling back should fix it. Ideally we find source the problem instead of reverting it right away because it just means it will come back next time we upgrade the library.
Same problem here, with one HS105 outlet and two separate HS200 switches.
Should be fixed in https://github.com/bdraco/kasa-crypt/pull/3 if someone wants to install that and test
I pushed that change to my production system and all is well. All was well before though.
Can't test it in person since I'm on an airplane still for another few hours
I pushed that change to my production system and all is well. All was well before though.
Can't test it in person since I'm on an airplane still for another few hours
Dedication has no limits! Thanks for your prompt response.
Should be fixed in bdraco/kasa-crypt#3 if someone wants to install that and test
Is there a quick way to pull this into an existing HA docker setup? I have a few broken devices but it is weird, its not affecting all my Kasa devices just two EP10s and ironically I have others that are fine....
Should be fixed in bdraco/kasa-crypt#3 if someone wants to install that and test
Is there a quick way to pull this into an existing HA docker setup? I have a few broken devices but it is weird, its not affecting all my Kasa devices just two EP10s and ironically I have others that are fine....
Check out the PR in the container, and do a pip install on it. You'll need to remount /tmp to allow it to execute first
Should be fixed in bdraco/kasa-crypt#3 if someone wants to install that and test
Is there a quick way to pull this into an existing HA docker setup? I have a few broken devices but it is weird, its not affecting all my Kasa devices just two EP10s and ironically I have others that are fine....
Never mind, I manually brought in the changes and still seeing issues with the SAME two after that. All my other KASA devices are working and reporting. Just not this two...
I'll do a release of the lib after I finish manual testing. Than you can install the wheel in the container. That will be a lot easier
Piggybacking on @pyrodexâs question: Any temporary fix for HA OS installs?
0.2.1 published
You can install it with the advanced ssh addon with protection mode disabled if you are using x86_64
docker exec -it homeassistant /bin/bash
pip3 install --upgrade kasa-crypt==0.2.1
Than restart ha
For other architectures not x86_64
Wait for https://github.com/home-assistant/core/actions/runs/5470867696 to finish and run the below:
docker exec -it homeassistant /bin/bash
pip3 install --find-links=$WHEELS_LINKS --upgrade kasa-crypt==0.2.1
0.2.1 published
You can install it with the advanced ssh addon with protection mode disabled if you are using x86_64
docker exec -it homeassistant /bin/bash pip3 install --upgrade kasa-crypt==0.2.1
Than restart ha
HAOS 10.2 here on Intel Nuc i3 Applied kasa-crypt==0.2.1 and restarted Home Assistant. My three devices are not initializing (still). Log content below
2023-07-05 22:32:11.845 WARNING (MainThread) [homeassistant.config_entries] Config entry 'Cable Modem HS105(US)' for tplink integration not ready yet: Unable to connect to the device: 192.168.1.112: ; Retrying in background
2023-07-05 22:32:11.875 WARNING (MainThread) [homeassistant.config_entries] Config entry 'Front Porch' for tplink integration not ready yet: Unable to connect to the device: 192.168.1.119: ; Retrying in background
2023-07-05 22:32:11.883 WARNING (MainThread) [homeassistant.config_entries] Config entry 'Garage Lights' for tplink integration not ready yet: Unable to connect to the device: 192.168.1.245: ; Retrying in background
Unable to connect to the device: 192.168.1.119
@keith721 That is not the same issue as the OP posted so I wouldn't expect the new library to resolve the problem.
Please start a new issue. It might be the same as https://github.com/home-assistant/core/issues/95028 though
Renaming the device in the uplink app does not fix it. Going back to 2023.6.3 fixes it.
On Jul 5, 2023, at 4:36 PM, J. Nick Koston @.***> wrote:
I have 6 Kasa KP125 smart plugs. After upgrading to 2023.7 one of the plugs stopped working and gave me a setup error in Home Assistant. Works without issue in 2023.6.3. All KP125 are the same with hardware version 1.0 and firmware version 1.0.10
If you rename that device in the tplink app does it fix it?
â Reply to this email directly, view it on GitHub https://github.com/home-assistant/core/issues/95938#issuecomment-1622685806, or unsubscribe https://github.com/notifications/unsubscribe-auth/A5J55L2NDUZKI2X4J2NJFILXOX3AXANCNFSM6AAAAAAZ7QL76M. You are receiving this because you commented.
Understood, but doesn't the encryption/decryption play a role in successfully connecting to these TP-Link devices? They are all on-line, and I can ping them. If my post isn't relevant, please feel free to remove or strike-through it.
Thanks for your speedy efforts!! I'm rolling back to 2023.6.3...
Understood, but doesn't the encryption/decryption play a role in successfully connecting to these TP-Link devices? They are all on-line, and I can ping them. If my post isn't relevant, please feel free to remove or strike-through it.
Thanks for your speedy efforts!! I'm rolling back to 2023.6.3...
The encryption only happens after the connection is established. If the connection cannot be made the encryption can't be the problem
I can confirm that kasa-crypt 0.2.1 works perfectly on HA OS / HA Blue ODROID. All switches are now responding. Kudos @bdraco!
Yea, the pip worked without issues now.
The dep isn't pinned in HA so the next HA release will automatically build with the new version
Thank you for the fix.
Had the same problem on a mix of 15 devices:
HS103(US)
Firmware: 1.1.4 Build 210409 Rel.113427
Hardware: 2.1
HS100(US)
Firmware: 1.2.6 Build 200727 Rel.120528
Hardware: 1.0
HS200(US)
Firmware: 1.1.3 Build 191205 Rel.103557
No problems with the:
KP400(US)
Firmware: 1.0.7 Build 210428 Rel.080330
Hardware: 2.0
HS220(US)
Firmware: 1.0.8 Build 210423 Rel.075507
Hardware: 2.0
Closing this issue as a solution is available and 2023.7.1 is shipping in a few hours via https://github.com/home-assistant/core/pull/96006
Please read before posting
If you are seeing the problem, please capture a wire shark or tcpdump and post it in this issue.
If you have a different model than the ones listed below please post the model
Otherwise give this issue a đ instead of posting to let us know you see the issue.
This will keep the issue nice and clean
The problem
After upgrading to 2023.7.0, the following errors started appearing in the log. Below devices are pingable. I also rebooted them, restarted HA. The same error appears again.
What version of Home Assistant Core has the issue?
core-2023.7.0
What was the last working version of Home Assistant Core?
core-2023.6.x
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
https://www.home-assistant.io/integrations/tplink/
Diagnostics information
No response
Example YAML snippet
No response
Anything in the logs that might be useful for us?
Additional information
No response