Skip to content

Allow HTTPS-only control and refresh state after portal commands - #96

Draft
scheffield wants to merge 2 commits into
jnimmo:masterfrom
scheffield:https-only-control
Draft

scheffield wants to merge 2 commits into
jnimmo:masterfrom
scheffield:https-only-control

Conversation

@scheffield

@scheffield scheffield commented Oct 25, 2026 •

Copy link
Copy Markdown

When the command socket is unavailable, each command first retries TCP before falling back to HTTPS. Add use_tcp=False to select portal commands directly, while preserving the default TCP-first behavior and the existing read-only meaning of use_socket=False.

Keep portal login cookies and reuse connections for consecutive requests, with a three-second idle timeout to avoid stale connections. Successful portal commands schedule one status refresh three seconds after the last accepted write, allowing cloud state to settle without blocking command completion.

Validation: 108 tests pass, including real HTTP tests for login retention, connection reuse and expiry; Ruff checks and formatting pass; Pylint scores 10/10. Live office tests confirmed and restored the setpoint without command-socket attempts. Reuse reduced consecutive command acceptance from approximately 1.95 s to 1.33 s. The original default pool reproduced ServerDisconnectedError after 4.7 s idle; the bounded pool passed the same gap and longer gaps. Command acceptance is distinct from status confirmation.

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

Successfully merging this pull request may close these issues.

1 participant