Repository navigation
Conversation
- Add request timeout (15s) across all HTTP calls - Implement _request_with_retry to recover from dropped sockets and ConnectionResetError - Close dead session pools and recreate session on network drop - Add unit test for retry resilience
|
Thanks for working on this. I ran into the same hang (klejejs/ha-thermia-heat-pump-integration#147) and opened #63 with only the timeout part: a default timeout on the session and fewer retries, about 20 lines. I kept it separate because this PR also retries requests that aren't safe to repeat (the SelfAsserted login POST, the single-use auth-code exchange and register writes, so a write to the heat pump could be sent twice), and it changes |
|
Thanks for the feedback! Looking at your PR #63, using ThermiaSession to set the default timeout and letting urllib3.Retry handle safe GET retries is definitely the cleaner and more idiomatic approach. Let's go ahead with your PR #63 for the timeout fix. I'll close this PR and open a small, separate PR specifically for __set_register_value raising on failure so it can cleanly pair with ha-thermia-heat-pump-integration#146 |
Summary
Resolves unhandled
requests.exceptions.ConnectionError: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))when communicating with Thermia Online cloud during register writes or transient connection drops.Details
_request_with_retrywrapper that catches socket disconnects (ConnectionResetError,ConnectionError,Timeout).test_retry_resilience.py) simulating a socket reset during a POST to ensure it recovers and succeeds.