K4CZP3R/tapo-p100-python

Error -1501

Closed this issue · 8 comments

Hi K4CZP3R I've tried your code with my Tapo Firmware 1.3.3 and then upgraded to latest one 1.3.4
but when I try to change state I get this error

{'error_code': -1501}

[p100.py:155 - login_request() ] Device responded with: {'error_code': 0, 'result': {'response': 'lBe2rQH+HuHmAEOwomudrfx7T5UohKMAEf4+tURA2X4='}}
[p100.py:165 - login_request() ] Device inner response: {'error_code': -1501}
Traceback (most recent call last):
File "main.py", line 25, in
my_bulb.login_request(args.tplink_email, args.tplink_password)
File "..../tapo-p100-python/p100.py", line 167, in login_request
self.token = decrypted_inner_response['result']['token']
KeyError: 'result'

any idea about it ?

thanks lot

I have the same error.

same error for me

I solved it by changing the password to 8 characters, in my case only letters, some uppercase, some lowercase. It's still an issue but try that.

I solved it by changing the password to 8 characters, in my case only letters, some uppercase, some lowercase. It's still an issue but try that.

Changing password works, it could be a security issue for sure. but now I've a new error

"Traceback (most recent call last):
File "main.py", line 25, in
my_bulb.login_request(args.tplink_email, args.tplink_password)
File "/home/pi/Desktop/Github/tapo-p100/tapo-p100-python/p100.py", line 145, in login_request
ldm_encrypted = self.tp_link_cipher.encrypt(jsons.dumps(login_device_method))
File "/home/pi/Desktop/Github/tapo-p100/tapo-p100-python/tp_link_cipher.py", line 16, in encrypt
cipher = AES.new(self.key, AES.MODE_CBC, self.iv)
File "/home/pi/Desktop/Github/tapo-p100/tapo-p100-python/env/lib/python3.7/site-packages/Crypto/Cipher/AES.py", line 95, in new
return AESCipher(key, *args, **kwargs)
File "/home/pi/Desktop/Github/tapo-p100/tapo-p100-python/env/lib/python3.7/site-packages/Crypto/Cipher/AES.py", line 59, in init
blockalgo.BlockAlgo.init(self, _AES, key, *args, **kwargs)
File "/home/pi/Desktop/Github/tapo-p100/tapo-p100-python/env/lib/python3.7/site-packages/Crypto/Cipher/blockalgo.py", line 141, in init
self._cipher = factory.new(key, *args, **kwargs)
TypeError: argument 1 must be read-only bytes-like object, not bytearray"

did you had the same ?

No.

@caprasilana what python version are you running?

still got this error with password 8 chars only letters uppercase/lowercase any hints ?

[connectionpool.py:433 - _make_request() ] http://192.168.1.252:80 "POST /app HTTP/1.1" 200 85
[p100.py:154 - login_request() ] Device responded with: {'error_code': 0, 'result': {'response': '7BrLjCD3AxQ/Ehw7HCtHl4n69JTEXobFmYzMFltLcIo='}}
[p100.py:164 - login_request() ] Device inner response: {'error_code': -1501}
Traceback (most recent call last):
File "/Users/syn/tapo-p100-python/main.py", line 25, in
my_bulb.login_request(args.tplink_email, args.tplink_password)
File "/Users/syn/tapo-p100-python/p100.py", line 166, in login_request
self.token = decrypted_inner_response['result']['token']
KeyError: 'result'

As this repo is just focused on proof-of-concept, I won't provide any additional functionality. There are peoples working on libraries based on this PoC, and you could get more help there.

https://github.com/fishbigger/HomeAssistant-Tapo-P100-Control one of libraries which is active