Skip to content

Wait for MQTT connection during gateway startup#4057

Merged
springfall2008 merged 3 commits into
mainfrom
fix/gateway_connect
Jun 14, 2026
Merged

Wait for MQTT connection during gateway startup#4057
springfall2008 merged 3 commits into
mainfrom
fix/gateway_connect

Conversation

@springfall2008

Copy link
Copy Markdown
Owner

No description provided.

Copilot AI review requested due to automatic review settings June 13, 2026 20:43

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the GatewayMQTT component startup path to wait for the first MQTT connection attempt (success or failure) before declaring the component “started”, and adds focused unit tests to validate that wait behavior.

Changes:

  • Add _first_connection_attempted state and a bounded startup wait loop in GatewayMQTT.run(first=True).
  • Mark _first_connection_attempted on both successful connect and connection-error paths in _mqtt_loop.
  • Add new gateway startup-wait tests and bump PredBat version.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
apps/predbat/gateway.py Adds first-connection-attempt tracking and a startup wait loop before returning success on the first run.
apps/predbat/tests/test_gateway.py Adds TestRunStartupWait to validate the new startup wait/timeout behavior.
apps/predbat/predbat.py Bumps THIS_VERSION to v8.40.8.

Comment thread apps/predbat/gateway.py Outdated
@springfall2008 springfall2008 merged commit b8d9a48 into main Jun 14, 2026
1 check passed
@springfall2008 springfall2008 deleted the fix/gateway_connect branch June 14, 2026 07:49
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.

2 participants