Skip to content

[codex] fix local endpoint recovery after IP changes#1270

Merged
copystring merged 9 commits into
mainfrom
codex/local-ip-endpoint-recovery
May 19, 2026
Merged

[codex] fix local endpoint recovery after IP changes#1270
copystring merged 9 commits into
mainfrom
codex/local-ip-endpoint-recovery

Conversation

@copystring
Copy link
Copy Markdown
Owner

Summary

Fixes local TCP recovery when a Roborock device receives a new LAN IP address. The local IP is now handled as dynamic local transport endpoint state inside localApi, instead of being treated as a one-time startup discovery result.

Root Cause

localApi.localDevices[duid].ip was populated from startup discovery/probing and TCP reconnects kept retrying that stored IP. If DHCP moved a robot from one address to another, reconnects could keep targeting the stale address indefinitely and log repeated EHOSTUNREACH warnings.

Changes

  • Keep UDP discovery as a persistent endpoint feed and merge discovered endpoints per device.
  • Reset only the affected TCP socket, nonces, and pending TCP requests when a discovered endpoint changes.
  • Mark unreachable TCP endpoints stale for connect-time network failures and trigger a throttled endpoint refresh instead of looping against the same stale IP.
  • Add MQTT fallback endpoint refresh via get_network_info / service.get_net_info.
  • Add a slow-poll background refresh for local endpoints that are known but currently disconnected, without blocking fast polling.
  • Add README WORK IN PROGRESS changelog entry using the existing ioBroker schema.

Validation

  • cmd /c npx vitest run src/lib/localApi.test.ts test/unit/device_online_homedata_sync.test.ts
  • cmd /c npm run typecheck
  • cmd /c npm run test:unit

@copystring copystring force-pushed the codex/local-ip-endpoint-recovery branch from d982b8b to 098c13d Compare May 18, 2026 15:41
@copystring copystring force-pushed the codex/local-ip-endpoint-recovery branch from 098c13d to 0d2a935 Compare May 18, 2026 15:47
@copystring copystring marked this pull request as ready for review May 18, 2026 15:53
dependabot Bot and others added 7 commits May 18, 2026 17:57
Bumps [protobufjs](https://github.com/protobufjs/protobuf.js) from 7.5.4 to 8.2.0.
- [Release notes](https://github.com/protobufjs/protobuf.js/releases)
- [Changelog](https://github.com/protobufjs/protobuf.js/blob/master/CHANGELOG.md)
- [Commits](protobufjs/protobuf.js@protobufjs-v7.5.4...protobufjs-v8.2.0)

---
updated-dependencies:
- dependency-name: protobufjs
  dependency-version: 8.2.0
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Bumps [zod](https://github.com/colinhacks/zod) from 4.3.6 to 4.4.3.
- [Release notes](https://github.com/colinhacks/zod/releases)
- [Commits](colinhacks/zod@v4.3.6...v4.4.3)

---
updated-dependencies:
- dependency-name: zod
  dependency-version: 4.4.3
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Bumps [@napi-rs/canvas](https://github.com/Brooooooklyn/canvas) from 0.1.100 to 1.0.0.
- [Release notes](https://github.com/Brooooooklyn/canvas/releases)
- [Changelog](https://github.com/Brooooooklyn/canvas/blob/main/CHANGELOG.md)
- [Commits](Brooooooklyn/canvas@v0.1.100...v1.0.0)

---
updated-dependencies:
- dependency-name: "@napi-rs/canvas"
  dependency-version: 1.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
@copystring copystring merged commit ad1a660 into main May 19, 2026
7 checks passed
@copystring copystring deleted the codex/local-ip-endpoint-recovery branch May 19, 2026 00:41
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