Open IanJS46 opened 2 months 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)
Here i have the same issue with 1 out of 5 Tapo P100.
With .167 and .191 (and all others) there is no problem.
2024-09-20 12:51:07.437 DEBUG (MainThread) [kasa.smart.smartdevice] Update completed 192.168.0.167: ['get_auto_off_config', 'get_connect_cloud_state', 'get_device_info', 'get_device_usage', 'get_device_time'] 2024-09-20 12:51:07.437 DEBUG (MainThread) [homeassistant.components.tplink.coordinator] Finished fetching 192.168.0.167 data in 0.050 seconds (success: True) 2024-09-20 12:51:08.338 DEBUG (MainThread) [kasa.klaptransport] Created KLAP transport for 192.168.0.205 2024-09-20 12:51:08.340 DEBUG (MainThread) [kasa.device] Initializing 192.168.0.205 of type <class 'kasa.smart.smartdevice.SmartDevice'> 2024-09-20 12:51:08.340 DEBUG (MainThread) [kasa.smartprotocol] 192.168.0.205 multi-request-batch-1-of-1 >> '{"method":"multipleRequest","request_time_milis":1726829468341,"terminal_uuid":"/Tn9BsRBqqqpmbIAvj6JkQ==","params":{"requests":[{"method":"component_nego"},{"method":"get_device_info"},{"method":"get_connect_cloud_state"}]}}' 2024-09-20 12:51:08.341 DEBUG (MainThread) [kasa.klaptransport] Starting handshake with 192.168.0.205 2024-09-20 12:51:08.341 DEBUG (MainThread) [kasa.httpclient] Posting to http://192.168.0.205/app/handshake1 2024-09-20 12:51:08.381 DEBUG (MainThread) [kasa.klaptransport] Handshake1 posted at 2024-09-20 12:51:08.381671. Host is 192.168.0.205, Response status is 200, Request was b2b4d927cd37dbac411b99f1a82a2cc1 2024-09-20 12:51:08.382 DEBUG (MainThread) [kasa.klaptransport] Handshake1 success at 2024-09-20 12:51:08.382062. Host is 192.168.0.205, Server remote_seed is: c2e6e56e9f68e56c9146e76cbf41e76d, server hash is: 4ad31742b8708d0c9e73f514c7967a0d306717aac480795f1f3b3d5480156a12 2024-09-20 12:51:08.382 DEBUG (MainThread) [kasa.klaptransport] Server response doesn't match our challenge on ip 192.168.0.205 2024-09-20 12:51:08.382 DEBUG (MainThread) [kasa.smartprotocol] Unable to authenticate with 192.168.0.205, not retrying: Server response doesn't match our challenge on ip 192.168.0.205 2024-09-20 12:51:08.530 DEBUG (MainThread) [kasa.smart.smartdevice] Querying 192.168.0.191 for modules: AutoOff, DeviceModule, Time
Credentials are definitely correct, Permanent IP is set. This issue is i think after the last core update. All Tapo Devices are on the same firmware..
If you have backups and downgrade to the previous release (2024.9.1 or 2024.9), is it working there? If yes, this might be a regression from #125685 (released part of 2024.9.2).
Restored the Backup from before the 2024.9.2 Update AND from about 2 Weeks ago. No change. It won't work, i can't add any new P100 or any other Tapo Device.
Okay, so it's an unrelated issue then. For some reason the key exchange is not working between the library and the device, but it's unclear why is that.
You could try experimenting with kasa
command-line tool to see if that is working. As this error commonly happens on wrong credentials, have you changed the password of your tapo account since you initially provisioned the devices? If yes, are the devices connected to the cloud?
Just upgraded to core 2024.9.2 and managed to get one more P100 configured; two to go...
Okay, so it's an unrelated issue then. For some reason the key exchange is not working between the library and the device, but it's unclear why is that.
You could try experimenting with
kasa
command-line tool to see if that is working. As this error commonly happens on wrong credentials, have you changed the password of your tapo account since you initially provisioned the devices? If yes, are the devices connected to the cloud?
No, my credentials haven't changed since about 6 month. I changed it to a much safer pw. after that i connected all my 5 P100 to the Tapo app (fresh and new). I was working about these 6 Month with Homebridge without any problems. In the last hour i set up a new homebridge instance and the tapo plugin in homebridge. There are absolutely no issues with the credentials. one of my P100 died on sunday last week. i replaced this one (the problematic one) with a new p100 and set it to the same IP (i like to have fixed IP in my DHCP on UDM) but i also tried it with another IP AND another P100. All have that problem..
But not one have the problem in homebridge with tapo plugin and it is since the core update.. so i think the core update broke something other in hass. what i can do now is to uninstall the tapo integration, but at the end it could be happen that not one of my p100 will work anymore. There are some lights that will be used 20-30 times a day.. can't disconnect them for days. :/
Let me try the thing with python kasa.
Ok, so there must be an issue with the new Tapo Firmware (EDIT: the Protocol to KLAP) because i tried to connect the NEW P100 to the hacs integration "tapo controller" and it failed too. But no issues with the other 4 P100.
But why i can connect all other p100 with the same firmware? Oh lord :(
If you run kasa --target 192.168.0.255 --verbose
, you will get the discovery information printed out. You could check if the encryption parameters (encrypt type, LV, ..) differ between devices that work and that do not work:
Supports IOT Cloud: True
OBD Src: tplink
Factory Default: False
Encrypt Type: KLAP
Supports HTTPS: False
HTTP Port: 80
LV (Login Level): 2
You could also check if the hardware & the firmware versions differ among those devices. The klap protocol has been supported for a long time now, the above is from one of my tapo devices.
Did you verify that the devices are cloud connected? You could try to use your old password, just in case, to see if the devices haven't synchronized the credentials properly.
Found something interesting.
The NEW P100 with Same Firmware:
And one i ordered about 2 Weeks ago with same Firmware: (not more infos on the top, because it is to much for HA Terminal
Devices are synced with the cloud. I can control them without any problem with the tapo app. Tried the login with my old PW, "Wrong Credentials" in the Tapo App.
But there in the screenshots you can see that the first one (the one that is not working in HASS) has no credential hash. Owner hash is the same,
The credential hash is an indicator of successful authentication so it doesn't tell us why it's failing. I notice the ODB Src is different. The one that isn't working is tss
and the working one is amazon
. Did you provision the devices differently? How did you provision them?
EDIT: Also I just noticed you're also using the HACS
tapo integration. There's a slim chance that it could be interfering with the default login that these devices sometimes fall back to. I would try turning off HA completely, then using the device in the TAPO app, then trying the kasa cli again.
If that doesn't do anything please come back on the questions above around how each device was provisioned.
Thanks for your reply!
The other way. The one what is working (with credential hash) is working without problems. The other on without credential hash isn't working.
The HACS tapo integration is now uninstalled an was uninstalled before. This was only a test, if i can get it connected to HA with another Plugin to determite if the Plugin, ha core or the Cloud is the problem.
From now i can say, the cloud should not be the problem, because i can controll it in the tapo app without a problem.
I also resetted the new one to factory defaults and connected it again, but same results.. But yeah, the odb source is different.
I'll try the kasa cli again with turned off HA.
Just finished the tests. Same results with HA powered off.
On every p100 i am able to authenticate, not so on the "new" one with ip .205 in the screenshots. I think the new ones are the problem because the credentials hash is not updating/showing up..
I think i'll order a new one on amazon, becuase the 4 i have not in use, were in a set of 4.. maybe they are all problematic.
I'll order 2 Single one, so i have one extra..
will update here!
Not sure where you’re located but I see you’re in the EU. If you wanted to send the device to me in the UK I could investigate and see what’s going on and maybe save you the cost of new devices. We’d have to connect on discord for me to give you the delivery address.
Thank you very much for that offer, really awesome! But for a device that costs about 8 euros (Matter 10 euros=) its not worth it imo. This would be 50 euros if i replace all my tapo p100. My other network is nearly all on matter and doesn't have any issue, so i will stick on the matter plugs from tapo (the fastest in the market imo^^)
But again, thank you very very much for that offer!
I don't have the ability or knowledge to run Python. I have completely uninstalled both the failing switches then re-configured in the Tapo App OK. Tried to authenticate with HA and that failed. Connected into Alexa OK. Both are HW version 2.0 running the latest firmware 1.2.5 Build 240411 Rel 143808, which is the same as the 4 that are connected to HA. I have two spare switches I can try them.
A very easy way to run the kasa
tool on most PCs with little technical knowledge is to open a command prompt (search cmd
) and just run:
python3 -m pipx install uv
uvx --from python-kasa kasa --username <your-username> --password <your-password>
If you are on windows and the python command errors because it's not installed, just install python
from the Microsoft Store.
I was having a similar issue with my P115 and noticed that if I added the device via the auto add when the Tapo app detects it. It was not letting me sync in HA as it would give me invalid authentication when I tried putting my Tapo clound information , but if i added the device manually via bluetooth I could then add the device to HA.
Hi Jose. Thanks for the advice. I have now successfully got all my P100's into HA. I did everything manually, used bluetooth to get the P100 into TAPO App. Then in HA ignored any auto discovery messages. Manually added using the IP address for the host (IP address is in the TAPO App). As soon as I added the IP address the P100 was found with the Name set in the TAPO App, add the area and bingo it all worked. Cheers Ian
Hi Jose. Thanks for the advice. I have now successfully got all my P100's into HA. I did everything manually, used bluetooth to get the P100 into TAPO App. Then in HA ignored any auto discovery messages. Manually added using the IP address for the host (IP address is in the TAPO App). As soon as I added the IP address the P100 was found with the Name set in the TAPO App, add the area and bingo it all worked. Cheers Ian
This did the trick for me too. Not sure why it has issues but first one i setup via bluetooth worked great, the second one was the same thing till i set it up via bluetooth.
I was having a similar issue with my P115 and noticed that if I added the device via the auto add when the Tapo app detects it. It was not letting me sync in HA as it would give me invalid authentication when I tried putting my Tapo clound information , but if i added the device manually via bluetooth I could then add the device to HA.
@mrj617 could you please give us a bit more information as to how to reproduce this? I've tried looking in my ios tapo app for the "auto add" feature but I just see the usual "Add device" in the top right hand corner that takes me through the workflow to connect to the device via a direct wifi connection. I don't even see an option for configuring via bluetooth. It would be great to get to the bottom of this, thanks.
My feeling is that this is not a TAPO App issue but a problem with the HA Integration. If the Integration detects a new device you get a notification that a new device is detected. If you select configure you get asked your login credentials to the TAPO App, this challenge fails with an authentication failure. So you have to select ignore. If you go to the Integration, select devices under the TAPO logo, you get a list of your devices with an Add Device button; trying to add a device through here fails at the authentication stage as above. If you go back to the first page in the integration; on this page is a list of all your devices, at the bottom of the page there is an Add Entry (Not Add Device) Button; if you go through here the Integration finds the new Switch (with the name configured in the TAPO App) you just configure the Area and that's it all done. No need to authorise the connection. Unfortunately I have written from memory as I don't want to remove a switch and start again as it's all working. Regards Ian
@IanJS46 are you still running 2024.9.1? A change went into 2024.9.2 which should address the issue you describe. @mrj617 seems to be describing something different.
@IanJS46 are you still running 2024.9.1? A change went into 2024.9.2 which should address the issue you describe. @mrj617 seems to be describing something different.
Hi Steven
See my comment a week ago..
"Just upgraded to core 2024.9.2 and managed to get one more P100 configured; two to go.."
So unfortunately 2024.9.2 didn't fix it.
Ian
I was having a similar issue with my P115 and noticed that if I added the device via the auto add when the Tapo app detects it. It was not letting me sync in HA as it would give me invalid authentication when I tried putting my Tapo clound information , but if i added the device manually via bluetooth I could then add the device to HA.
@mrj617 could you please give us a bit more information as to how to reproduce this? I've tried looking in my ios tapo app for the "auto add" feature but I just see the usual "Add device" in the top right hand corner that takes me through the workflow to connect to the device via a direct wifi connection. I don't even see an option for configuring via bluetooth. It would be great to get to the bottom of this, thanks.
I was also on HA 2024.9.2 when I experienced this issue. Basically I would plug in the device, open the Tapo application and it would show the device I plugged in to automatically add. When I did this it would add it to my Tapo, but when I tried configuring the device in HA it would give me an Authentication error whenever inputting the Tapo cloud information. I Then tried to add another device, this time I went to the manual Add Device > P115 and then selecting Bluetooth. (Because I could not detect the device in Wi-fi to add that way) Then It would connect to the device to my Wi-Fi. Then when configuring in HA, it took my Tapo cloud credentials and the device was in HA.
I'm having the same issue. Restarted my Tapo P110M to factory setting due Matter not working. Trying to add plug in HA shows a error "Invalid authentication: Server response doesn't match our challenge on ip 192.168.1.6" I've tried some of the things shown in here but even then nothing works. My other plug which wasn't restarted works correctly
I am seeing the same "Invalid authentication: Server response doesn't match our challenge on ip xxx.xxx.xxx.xxx" error when adding new devices. On two so far I have managed to add the device to HA by:
There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.
Same issue with my 5th plug. Again adding it manually worked for me
There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.
I cannot add any HS200 switches i bought recently. I know it is a different device but same issue. Latest home assistant OS version
@kushki7 your device is using a different communication protocol so it's unlikely related to this issue, so please open a separate issue, and include logs and information about your network configuration to help us to find a solution to your issue.
Not certain if this adds any context to things.
I've got two P100 plug bought at different times.
Device Name | IP Address | Model | Hardware Version | Firmware Version | Connected to Home Assistant |
---|---|---|---|---|---|
Smart Plug | 192.168.2.234 | P100 | 2.0 | 1.2.5 Build 240411 Rel.143808 | Yes |
Lamp 3 | 192.168.6.96 | P100 | 1.20.0 | 1.5.5 Build 20230927 Rel. 40646 | No |
Here is the KASA debug for it, i've redacted the Owner, Device hashes and ODB Src, they match to be certain.
== Authentication failed for device ==
== Discovery Result ==
Device Type: SMART.TAPOPLUG
Device Model: P100
IP: 192.168.6.96
MAC: B4-B0-24-54-93-70
Device Id (hash): bdf
Owner (hash): 6206
Supports IOT Cloud: True
OBD Src: 66206
Encrypt Type: KLAP
HTTP Port: 80
== Authentication failed for device ==
== Discovery Result ==
Device Type: SMART.TAPOPLUG
Device Model: P100(UK)
IP: 192.168.2.234
MAC: 60-83-E7-85-91-37
Device Id (hash): 97b
Owner (hash): 6206
Supports IOT Cloud: True
OBD Src: 66206
Encrypt Type: KLAP
HTTP Port: 80
The error code upon providing the correct cloud user/password is
Connection error: get_device_info not found in {'component_nego': {'component_list': [{'id': 'device', 'ver_code': 2}, {'id': 'firmware', 'ver_code': 1}, {'id': 'quick_setup', 'ver_code': 3}, {'id': 'time', 'ver_code': 1}, {'id': 'wireless', 'ver_code': 1}, {'id': 'schedule', 'ver_code': 2}, {'id': 'countdown', 'ver_code': 2}, {'id': 'antitheft', 'ver_code': 1}, {'id': 'account', 'ver_code': 1}, {'id': 'synchronize', 'ver_code': 1}, {'id': 'sunrise_sunset', 'ver_code': 1}, {'id': 'led', 'ver_code': 1}, {'id': 'cloud_connect', 'ver_code': 1}, {'id': 'iot_cloud', 'ver_code': 1}, {'id': 'default_states', 'ver_code': 1}, {'id': 'auto_off', 'ver_code': 2}]}, 'get_device_info': <SmartErrorCode.JSON_ENCODE_FAIL_ERROR: -1004>, 'get_connect_cloud_state': {'status': 0}} for device 192.168.6.96
@aaronburt looks like that's an upstream issue, so feel free to file that at https://github.com/python-kasa/python-kasa/ - for some reason, the get_device_info
call is failing with an error indicating json encode failure. We have seen some issues with devices which didn't have their clocks synchronized, but never for the main info call.. If you have blocked external accesses for your device, you could try synchronizing the clock manually using kasa --host <ip> time sync
to see if that helps.
The problem
I recently added 6 brand new Tapo P100 smart switches to my home network. I have managed to add 3 to the TPLINK integration but 3 refuse to pass the authentication. I have tried multiple times and user name and password are correct. Switches work fine as they are all connected to my Amazon Alexa.
What version of Home Assistant Core has the issue?
core-2024.9.1
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
TPLINK
Link to integration documentation on our website
https://www.home-assistant.io/integrations/tplink
Diagnostics information
home-assistant_tplink_2024-09-20T06-39-57.411Z.log
Example YAML snippet
No response
Anything in the logs that might be useful for us?
Additional information
No response