Traceback (most recent call last):
File "/home/ben/.local/lib/python3.10/site-packages/PyP100/PyP100.py", line 32, in _initialize
protocol.Initialize()
File "/home/ben/.local/lib/python3.10/site-packages/PyP100/auth_protocol.py", line 244, in Initialize
result = self._request_raw("handshake", {"key": public_key})
File "/home/ben/.local/lib/python3.10/site-packages/PyP100/auth_protocol.py", line 165, in _request_raw
resp = self.session.post(url, json=payload, timeout=0.5)
File "/home/ben/.local/lib/python3.10/site-packages/requests/sessions.py", line 637, in post
return self.request("POST", url, data=data, json=json, **kwargs)
File "/home/ben/.local/lib/python3.10/site-packages/requests/sessions.py", line 589, in request
resp = self.send(prep, **send_kwargs)
File "/home/ben/.local/lib/python3.10/site-packages/requests/sessions.py", line 703, in send
r = adapter.send(request, **kwargs)
File "/home/ben/.local/lib/python3.10/site-packages/requests/adapters.py", line 507, in send
raise ConnectTimeout(e, request=request)
requests.exceptions.ConnectTimeout: HTTPConnectionPool(host='192.168.3.152', port=80): Max retries exceeded with url: /app (Caused by ConnectTimeoutError(<urllib3.connection.HTTPConnection object at 0x7fd032a0d720>, 'Connection to 192.168.3.152 timed out. (connect timeout=0.5)'))
Traceback (most recent call last):
File "/home/ben/Documents/src.old/tplink_smartplug_to_influxdb/./app/collect.py", line 249, in <module>
main()
File "/home/ben/Documents/src.old/tplink_smartplug_to_influxdb/./app/collect.py", line 75, in main
do_work(config, influxes)
File "/home/ben/Documents/src.old/tplink_smartplug_to_influxdb/./app/collect.py", line 115, in do_work
now_usage_w, today_usage = poll_tapo(tapo['ip'], config["tapo"]["user"], config["tapo"]["passw"])
File "/home/ben/Documents/src.old/tplink_smartplug_to_influxdb/./app/collect.py", line 193, in poll_tapo
p110.handshake() #Creates the cookies required for further methods
File "/home/ben/.local/lib/python3.10/site-packages/PyP100/PyP100.py", line 48, in handshake
self._initialize()
File "/home/ben/.local/lib/python3.10/site-packages/PyP100/PyP100.py", line 39, in _initialize
raise Exception("Failed to initialize protocol")
Exception: Failed to initialize protocol
Just looking at trying to get this working with some plugs running older firmware
Running
Leads to a set of exceptions being thrown
That half-second timeout is hardcoded here.
I've edited
~/.local/lib/python3.10/site-packages/PyP100/auth_protocol.py
to bump the timeout up to a second and no longer get that exception.Might be worth extending the timeout a little (or making it configurable)