dswd / OctoPrint-PSUControl-Tapo

Adds TPLink Smart Plug support to OctoPrint-PSUControl as a sub-plugin
GNU Affero General Public License v3.0
7 stars 1 forks source link

V0.3.0 breaks authentication #11

Open gkravecz opened 1 year ago

gkravecz commented 1 year ago

V0.3.0 plugin breaks authentication. I have a P125 Tapo Smart Plug if that matters. It was working with previous v0.1.x version, but with intermittent timeouts. Here are the relevant logs....

2023-10-05 11:36:02,013 - octoprint.plugins.psucontrol_tapo - DEBUG - get_psu_state 2023-10-05 11:36:02,048 - octoprint.plugins.psucontrol - ERROR - Error while executing callback <bound method PSUControl_Tapo.get_psu_state of <octoprint_psucontrol_tapo.PSUControl_Tapo object at 0x7f7ae4f760>> Traceback (most recent call last): File "/home/pi/OctoPrint/lib/python3.9/site-packages/octoprint_psucontrol/__init__.py", line 292, in _check_psu_state r = callback() File "/home/pi/OctoPrint/lib/python3.9/site-packages/octoprint_psucontrol_tapo/__init__.py", line 90, in get_psu_state return self.device.get_status() File "/home/pi/OctoPrint/lib/python3.9/site-packages/octoprint_psucontrol_tapo/tapo.py", line 116, in get_status return self._get_device_info()["device_on"] File "/home/pi/OctoPrint/lib/python3.9/site-packages/octoprint_psucontrol_tapo/tapo.py", line 102, in _get_device_info return self._request("get_device_info") File "/home/pi/OctoPrint/lib/python3.9/site-packages/octoprint_psucontrol_tapo/tapo.py", line 41, in _request self._initialize() File "/home/pi/OctoPrint/lib/python3.9/site-packages/octoprint_psucontrol_tapo/tapo.py", line 92, in _initialize raise Exception("Failed to authenticate") Exception: Failed to authenticate

dswd commented 1 year ago

Okay, that is interesting. I expected that all models now have the new protocol. I can add a fallback to the old one if that helps you.

gkravecz commented 1 year ago

I've reverted back to v0.1.2 to get it working again, but a selectable protocol option would be nice. If it helps, the firmware version of my Tapo P125 is "1.0.6 Build 230504 Rel.135237" which is the latest according to the Tapo app.

dswd commented 1 year ago

Please try the current master branch. It first tries the new protocol and then falls back to the old one. It also runs in a new thread so it should not produce any stutters. Btw: My P100 runs on version 1.2.1. No idea why you don't get an update for your P125.

gkravecz commented 1 year ago

Gave the master branch a try and the protocol fallback seems to be working. Thanks for the quick response!

Mysteoa commented 1 year ago

What I found out is that devices with older HW version don't have the new authentication.