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

Unable to setup a session/ handshake with TpLink Tapo bulb #123

Open
Shakthi-Dhar opened this issue Aug 23, 2023 · 19 comments
Open

Unable to setup a session/ handshake with TpLink Tapo bulb #123

Shakthi-Dhar opened this issue Aug 23, 2023 · 19 comments

Comments

@Shakthi-Dhar
Copy link

File "python/site-packages/PyP100/PyP100.py", line 129, in handshake
encryptedKey = r.json()["result"]["key"]
KeyError: 'result'

I checked the response and it happens to be: {'error_code': 1003}

I am trying to set a connection with my TpLink Tapo L530 bulb and run this code to turn it on and off:

from PyP100 import PyL530

l530 = PyL530.L530("IP Address", "Mail ID", "Password")

l530.handshake()
l530.login()

l530.turnOn()
l530.turnOff()
l530.turnOn()

How do I tackle this issue?

@cokeperez
Copy link

cokeperez commented Aug 25, 2023

Same problem here.

2x Tapo L530
Firmware: 1.1.0 Build 230721 Rel.224802
Hardware: 2.0

@OrangeMedia
Copy link

It appears a recent firmware update has broken any integration.

https://www.infosecurity-magazine.com/news/tplink-smart-bulb-wifi-passwords/

@Shakthi-Dhar
Copy link
Author

So there is no way to establish communication with the bulb until there is a new firmware update to fix it?

@timothy-holmes
Copy link

@Shakthi-Dhar
Copy link
Author

Another package has fixed this: https://github.com/petretiandrea/plugp100/blob/main/plugp100/protocol/klap_protocol.py#L96

@timothy-holmes do you have any example code on how I can perform actions like color and brightness change, on and off? Thank you.

@bunbunet
Copy link

I'm new to python and have little experience in coding, however through Tapo L530, a microphone and this libraries I built a system that give light feedback to control the noise generated by the customers of winery. This system represented an important point of equilibrium between the winery and my condo after month of frictions.. but it is now broken! Is there any chance that these libraries will be fixed? Or alternatively can anybody suggest me an alternative? Thank you very much for any help!

@vasishta-kanthi
Copy link

Hi ,

I have the exact same response for the P100 plug device. Until today, 2023/09/12, I was able to utilize the package and create a wrapper class to control the switch. Now I get the same error when executing the handshake() function, as the JSON response I get is:

{'error_code' : 1003}

@fishbigger , I hope it is okay to tag you for this >.<

@timothy-holmes
Copy link

Another package has fixed this: https://github.com/petretiandrea/plugp100/blob/main/plugp100/protocol/klap_protocol.py#L96

@timothy-holmes do you have any example code on how I can perform actions like color and brightness change, on and off? Thank you.

I haven't tested this so may have some errrors, but it would probably go something like:

from plugp100.api.tapo_client import TapoClient, AuthCredential
from plugp100.api.light_device import LightDevice

credential = AuthCredential('<tapo_email>', '<tapo_password>')
client = await TapoClient.connect(credential, '<ip_address>')
light = LightDevice(client, "<device-ip>")
await light.on()
await light.off()
await light.set_hue_saturation(hue=120, saturation=100)

(of course, you'll need to install it beforehand with pip install plugp100)

@bunbunet
Copy link

Dear, @timothy-holmes,
thank you very much for your help! I installed the package and tried your code, the example code on the project page but I'm already stuck at library import. I assume the modules that should be imported may be in some other form or order...
Moreover it is not clear to me why I should indicate two different ip adress, one for the TapoClient and one for Light device, but I suppose it should be the same.
thank you very much for any additional help.. if possible!
Federico

@StephenBerlin
Copy link

Tried getting plugp100 working using the code from @timothy-holmes, but no luck. Do we know if someone is planning to update the existing PyP100 module so that this works again? Thank you!

@manuhakala98
Copy link

Im also interester if someone could fix this issue asap. KeyError result also here.

@istvan73
Copy link

istvan73 commented Sep 30, 2023

Same thing here, getting KeyError, and I've already bought 5 of them to control an escape room :'D Some hero of coding please help us!

@manuhakala98
Copy link

manuhakala98 commented Oct 2, 2023

Same thing here, getting KeyError, and I've already bought 5 of them to control an escape room :'D Some hero of coding please help us!

I got it to work by using this library: https://github.com/petretiandrea/plugp100/tree/main

Just rebember to use python 3.9. And when you get TypeError check 3rd topic from Issues page.

@Cosik
Copy link

Cosik commented Oct 5, 2023

Hi, in general I think that lib is dead, author is not responding, many PRs are hanging without response from @fishbigger

@almottier
Copy link

almottier commented Oct 12, 2023

Hello, I forked the project and added the new auth support.
I tested it with P100 version 1.2.1 and it works great.

Let me know if it works for you.

@m-mihaly
Copy link

Hi @almottier,

Thanks for the great work, but please check again PyL530.py and PyP110.py, it says:

from TapoP100.PyP100.PyP100 import ...

If I install it with pip, there's no TapoP100 package.
When I change it like this, it works:

from PyP100.PyP100 import ...

@almottier
Copy link

Hello @m-mihaly ,
Thanks, it should be fixed now.
I also added support for old firmware using a fallback to the old authentication mechanism.

@StephenBerlin
Copy link

Thank you @almottier!!!

All my P100's are working again... both hw version 1.20.0 + fw 1.5.5, and hw version 2.0 + fw 1.2.1 are all working.

Thank you!!

@kayakingJeff
Copy link

Thank you @almottier for fixing this. I really appreciate it.

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

No branches or pull requests