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

Failed to initialize protocol AuthProtocol #11

Open
OreoOba opened this issue Nov 26, 2023 · 2 comments
Open

Failed to initialize protocol AuthProtocol #11

OreoOba opened this issue Nov 26, 2023 · 2 comments

Comments

@OreoOba
Copy link

OreoOba commented Nov 26, 2023

Thanks for solving the problem
Just a small add to your comments
Be carefull if you combine devices with the old protocol and the new one.

  1. Add the preferred_protocol="old" at the inital statement of each old device
  2. Don't delete the p100.handshake() and p100.login() for the devices that keep the old protocol
@almottier
Copy link
Owner

Hello,

  1. Yes you need to add preferred_protocol="old" for all old devices individually
  2. You should not need handshake() or login() , even for old devices. Please share the error if you still have an issue without it.

@raucal
Copy link

raucal commented Dec 20, 2023

I still get this error even though I add the "old" argument.
MY code:

from PyP100 import PyP110
p110 = PyP110.P110("192.168.1.84", "xxx", "yyy",preferred_protocol="old" )
p110.getEnergyUsage()

Error:

Error: {'error_code': 1003}
Failed to initialize protocol OldProtocol
Traceback (most recent call last):
File "c:\Users\34652\Documents\Python\Domótica\PyP100\PyP100.py", line 32, in _initialize
protocol.Initialize()
File "c:\Users\34652\Documents\Python\Domótica\PyP100\auth_protocol.py", line 244, in Initialize
result = self._request_raw("handshake", {"key": public_key})
File "c:\Users\34652\Documents\Python\Domótica\PyP100\auth_protocol.py", line 173, in _request_raw
raise Exception(f"Error code: {data['error_code']}")
Exception: Error code: 1003
Traceback (most recent call last):
File "c:\Users\34652\Documents\Python\Domótica\prueba.py", line 4, in
p110.getEnergyUsage()
File "c:\Users\34652\Documents\Python\Domótica\PyP100\PyP100.py", line 106, in getEnergyUsage
return self.request("get_energy_usage")
File "c:\Users\34652\Documents\Python\Domótica\PyP100\PyP100.py", line 43, in request
self._initialize()
File "c:\Users\34652\Documents\Python\Domótica\PyP100\PyP100.py", line 39, in _initialize
raise Exception("Failed to initialize protocol")
Exception: Failed to initialize protocol

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

3 participants