Skip to content

Keep API available when MQTT fails#392

Merged
MTrab merged 15 commits into
masterfrom
fix/mqtt-api-fallback
Jun 3, 2026
Merged

Keep API available when MQTT fails#392
MTrab merged 15 commits into
masterfrom
fix/mqtt-api-fallback

Conversation

@MTrab
Copy link
Copy Markdown
Owner

@MTrab MTrab commented Jun 3, 2026

Summary

Keep the cloud API usable when MQTT cannot connect, expose MQTT connection state, and reduce aggressive MQTT reconnect behavior that could contribute to broker rate limits.

Changes

This keeps authentication and API refresh working even when the initial MQTT connection fails, then retries MQTT quietly in the background. MQTT reconnect timing is slowed down, paho reconnect backoff is increased, and token refresh no longer forces immediate MQTT reconnects while disconnected.

The MQTT connection state is exposed on both the cloud object and devices, MQTT commands now fail with a clear connection error when MQTT is unavailable, and paho reconnect callbacks resubscribe existing topics so recovered connections remain usable. Legacy unused MQTT resume code and unused private state were removed.

Testing

  • git status: clean before PR creation
  • poetry run ruff format pyworxcloud tests
  • poetry run ruff check pyworxcloud tests
  • poetry run pytest tests/test_mqtt_runtime.py tests/test_mqtt_lifecycle.py tests/test_mqtt_commands.py tests/test_api_lifecycle.py tests/test_connect_cleanup.py
  • poetry run pytest

Notes

Proposed semver label: patch. This label has not been set yet and should be explicitly approved before merge.

@github-actions github-actions Bot added bug Something isn't working patch Patch version labels Jun 3, 2026
@MTrab MTrab merged commit e11740c into master Jun 3, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working patch Patch version

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant