Skip to content

fix: verify MQTT connection requires successful subscription#858

Merged
allenporter merged 3 commits into
Python-roborock:mainfrom
allenporter:fix-mqtt-connection-status
Jul 3, 2026
Merged

fix: verify MQTT connection requires successful subscription#858
allenporter merged 3 commits into
Python-roborock:mainfrom
allenporter:fix-mqtt-connection-status

Conversation

@allenporter

Copy link
Copy Markdown
Contributor

Fixes MQTT connection status reporting by ensuring is_mqtt_connected is only True when the MQTT session is active AND the subscription to the device's topic has succeeded.

References home-assistant/core#159609 (comment)

Copilot AI review requested due to automatic review settings July 2, 2026 20:38

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 fixes MQTT connection status reporting in V1Channel so is_mqtt_connected is only True when the MQTT session is connected and the channel has successfully established an MQTT subscription to the device topic, aligning status behavior with the referenced Home Assistant issue.

Changes:

  • Update V1Channel.is_mqtt_connected to require a successful MQTT subscription (tracked via _mqtt_unsub) in addition to an active MQTT session.
  • Add tests covering MQTT subscription failure with local fallback success, and the case where both local and MQTT connection paths fail.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
roborock/devices/rpc/v1_channel.py Tightens MQTT “connected” status to reflect successful subscription establishment.
tests/devices/rpc/test_v1_channel.py Adds regression tests to validate MQTT subscription failure handling and fallback behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread roborock/devices/rpc/v1_channel.py
Comment thread tests/devices/rpc/test_v1_channel.py
Comment thread tests/devices/rpc/test_v1_channel.py
@allenporter allenporter requested a review from Lash-L July 2, 2026 21:30
@allenporter allenporter merged commit e3c97c6 into Python-roborock:main Jul 3, 2026
7 checks passed
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.

3 participants