Skip to content

fix: time out local connection attempts to unreachable devices - #1077

Merged
allenporter merged 1 commit into
Python-roborock:mainfrom
hCoureau:submit/fix/local-connect-timeout
Nov 23, 2026
Merged

allenporter merged 1 commit into
Python-roborock:mainfrom
hCoureau:submit/fix/local-connect-timeout

Conversation

@hCoureau

Copy link
Copy Markdown
Contributor

Problem

When the robot’s LAN address silently drops packets, the first local TCP connection attempt can wait for the operating system’s timeout. V1 startup is waiting for that attempt, so it cannot fall back to MQTT in the meantime.

Changes

Use the existing local-channel timeout for the TCP connect. The timeout goes through the existing RoborockConnectionException path, so V1 startup can fall back to MQTT and the background task can keep retrying the local connection. This is distinct from #1027, which handles a timeout after an RPC has been sent.

Testing

  • The regression test simulates a connection attempt that never completes and checks that connect() raises RoborockConnectionException and leaves the channel disconnected.
  • 2,681 tests passed on each of Python 3.11 and 3.14 against upstream 321c6d5. The default suite excludes the 11 real-broker tests.
  • Pre-commit, commitlint, and source and wheel builds passed.

Connecting the local channel had no timeout, so when the device's LAN
address was unreachable (packets dropped rather than refused) the TCP
connect blocked until the operating system gave up. Device startup
waits on this first attempt before subscribing over MQTT, so the device
stayed disconnected and traits were not discovered even though MQTT
worked. The connect now uses the existing local timeout, so startup
falls back to MQTT and the background task keeps retrying local.
@allenporter
allenporter merged commit be3a835 into Python-roborock:main Nov 23, 2026
9 checks passed
@hCoureau
hCoureau deleted the submit/fix/local-connect-timeout branch November 23, 2026 22:15
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