almottier / TapoP100

A module for controlling the TP-Link Tapo P100 Plugs
MIT License
82 stars 24 forks source link

Tapo L520 HW 1.0 FW 1.1.0 - Failed to initialize protocol #6

Closed ossnoser closed 1 year ago

ossnoser commented 1 year ago

After the breaking update Tapo released, I can't control my L520 light bulbs locally... I'm trying to use this library but got the following error.

Devices: Tapo L520 HW 1.0 and 1.2 FW 1.1.0.

Are these devices supported?

from PyP100 import PyL530
l530 = PyL530.L530("xxx", "yyy", "zzz")
l530.turnOn()
(.venv) o@o-MacBook-Pro tapo-library-test %  cd /Users/o/Documents/prj/python/tapo-library-test ; /us
r/bin/env /Users/o/Documents/prj/python/tapo-library-test/.venv/bin/python /Users/o/.vscode/extensions/ms-py
thon.python-2023.18.0/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher 52792 -- /Users/o/Documents/prj
/python/tapo-library-test/tapo_test.py 
Failed to initialize protocol AuthProtocol
Traceback (most recent call last):
  File "/Users/o/Documents/prj/python/tapo-library-test/.venv/lib/python3.9/site-packages/PyP100/PyP100.py", line 32, in _initialize
    protocol.Initialize()
  File "/Users/o/Documents/prj/python/tapo-library-test/.venv/lib/python3.9/site-packages/PyP100/auth_protocol.py", line 110, in Initialize
    raise Exception("Failed to authenticate")
Exception: Failed to authenticate
Error: {'error_code': 1003}
Failed to initialize protocol OldProtocol
Traceback (most recent call last):
  File "/Users/o/Documents/prj/python/tapo-library-test/.venv/lib/python3.9/site-packages/PyP100/PyP100.py", line 32, in _initialize
    protocol.Initialize()
  File "/Users/o/Documents/prj/python/tapo-library-test/.venv/lib/python3.9/site-packages/PyP100/auth_protocol.py", line 244, in Initialize
    result = self._request_raw("handshake", {"key": public_key})
  File "/Users/o/Documents/prj/python/tapo-library-test/.venv/lib/python3.9/site-packages/PyP100/auth_protocol.py", line 173, in _request_raw
    raise Exception(f"Error code: {data['error_code']}")
Exception: Error code: 1003
almottier commented 1 year ago

Hello, could you send the full stack trace, you should have this line too:

Failed to initialize protocol AuthProtocol

Also, check your credentials, you may have this error if they are incorrect.

ossnoser commented 1 year ago

The Credential was incorrect. Sorry about that. It works. Thank you.