JurajNyiri / pytapo

Python library for communication with Tapo Cameras
MIT License
277 stars 58 forks source link

Tapo C210 firmware 1.3.11 Invalid authentication data #86

Closed Pytoune closed 9 months ago

Pytoune commented 9 months ago

Hi and thank you for your project.

I try to test it with the simple next script named "test.PY" :

from pytapo import Tapo
user = "admin"
password = "tapo_password"
host = "192.168.1.20"
tapo = Tapo(host, user, password)
print(tapo.getBasicInfo())

But I have the following errors :

python3 test.PY
Traceback (most recent call last):
  File "test.PY", line 7, in <module>
    tapo = Tapo(host, user, password)
  File "/usr/local/lib/python3.7/dist-packages/pytapo/__init__.py", line 34, in __init__
    self.basicInfo = self.getBasicInfo()
  File "/usr/local/lib/python3.7/dist-packages/pytapo/__init__.py", line 221, in getBasicInfo
    {"method": "get", "device_info": {"name": ["basic_info"]}}
  File "/usr/local/lib/python3.7/dist-packages/pytapo/__init__.py", line 85, in performRequest
    self.ensureAuthenticated()
  File "/usr/local/lib/python3.7/dist-packages/pytapo/__init__.py", line 51, in ensureAuthenticated
    return self.refreshStok()
  File "/usr/local/lib/python3.7/dist-packages/pytapo/__init__.py", line 70, in refreshStok
    raise Exception("Invalid authentication data")
Exception: Invalid authentication data

It seems like tapo c210 new firmware does not permit to login with the API as before ?

I have tested many couples user/password :

Thank you for your help.

JurajNyiri commented 9 months ago

For firmwares that use encryption you need to use admin and your tplink account password for control.

Pytoune commented 9 months ago

Thank you first for your reactivity but it does not work, maybe it's me. tplink account password = tapo password = tplin community password ? I have modified it to try a more simple password without specials characters but it is the same. I use "admin" as user and "tplink/tapo/..." password.

Pytoune commented 9 months ago

Thank you JurajNyiri, it is solved by using last Pytapo version (3.3.18) with recent Python version (3.9). Thank you for your project which help a lot of people.