The Almottier fork of PyP100 contains some hardcoded timeouts for the old authentication mechanism. These are problematic for some of my plugs (those that are in slightly marginal wifi coverage are particularly impacted by this).
Once #7 is merged, I'd like to make the docker container use the Almottier fork of PyP100
by default, but I can't if that's going to result in polls regularly failing.
Although there's an upstream issue open, I want to see whether we can override the timeouts in the meantime.
Activity
22-Dec-23 11:40
assigned to @btasker
22-Dec-23 11:51
The timeout is passed into
requests.session.post()
:So there are two possible ways to go at this
requests
to ignore/change the timeoutThe call that we need is a couple of classes deep, so if we went the inheriting route we'd need to create
PyP100.Device._initialize()
- an exact copy other than referencing our amended auth classPyP100.auth_protocol.OldProtocol._request_raw()
Both those functions contain a reasonable number of LOC, leaving us at risk of breakage if something changes in the upstream library. The risk of that is exceptionally high because the current install approach involves passing
pip
a reference to the master branch of the package's git repo.We'd be taking on a hell of a maintenance burden.
I think it might be better to take aim at
requests
instead22-Dec-23 12:18
With credit to stackoverflow for pointing me in the right direction:
This checks what timeout has been supplied:
Polling now works reliably
Hopefully, though, it won't be long before we can revert this.
22-Dec-23 12:20
Upstream PR 5 raised and merged.
22-Dec-23 12:21
mentioned in issue #7
22-Dec-23 12:27
Almost inevitably, just after merging this, I checked my inbox and saw that the maintainer of the upstream module had replied to say they're happy to accept a PR to increase the timeout.
Raised upstream https://github.com/almottier/TapoP100/pull/15. Will look at reverting this once that's been merged.
22-Dec-23 17:16
Re-opening for the revert.
I've upgraded to the latest upstream commit
Then, after reverting the commit
Ran the script
22-Dec-23 17:20
PR 6 raised and merged.
Closing this as done and reverted
04-Aug-24 09:25
mentioned in commit github-mirror/tplink_to_influxdb@479a1dace56c136f6b961d5e9e5234cfd1606277
Message
fix: monkeypatch requests to raise overly short timeouts (utilities/tp-link-to-influxdb#9)
This'll raise any timeout below 3 seconds to 3, and set a default timeout of 5 seconds for anything provided without a timeout
04-Aug-24 09:25
mentioned in commit github-mirror/tplink_to_influxdb@2afa795dbcda4126f3a8ba924aaa42baf1ae7266
Message
Revert "fix: monkeypatch requests to raise overly short timeouts (utilities/tp-link-to-influxdb#9)"
This reverts commit 479a1dace56c136f6b961d5e9e5234cfd1606277.
Upstream fix has been merged, so this is no longer required