Skip to content

fix(sensing-server): detect ESP32 offline after 5s timeout#300

Merged
ruvnet merged 1 commit intomainfrom
fix/esp32-source-timeout
Mar 24, 2026
Merged

fix(sensing-server): detect ESP32 offline after 5s timeout#300
ruvnet merged 1 commit intomainfrom
fix/esp32-source-timeout

Conversation

@ruvnet
Copy link
Owner

@ruvnet ruvnet commented Mar 24, 2026

Summary

  • Added ESP32 frame timeout: tracks last_esp32_frame timestamp; after 5 seconds without a UDP frame, source changes from "esp32" to "esp32:offline"
  • Health endpoint shows degraded: hardware status switches to "degraded" when ESP32 goes offline
  • All 6 status endpoints updated: health, ready, system, info, vitals, and main status all use effective_source()

Fixes #297

What was wrong

The source field was set to "esp32" on the first received UDP frame but never reverted. Powering off all ESP32 nodes left the UI permanently showing "Real hardware connected."

Test plan

  • cargo check -p wifi-densepose-sensing-server --no-default-features — compiles clean
  • With ESP32 nodes running: /api/v1/health shows "source": "esp32"
  • Power off all nodes, wait 5s: /api/v1/health shows "source": "esp32:offline", hardware status "degraded"
  • Power nodes back on: source reverts to "esp32" immediately

🤖 Generated with claude-flow

The source field was set to "esp32" on the first UDP frame but never
reverted when frames stopped arriving. This caused the UI to show
"Real hardware connected" indefinitely after powering off all nodes.

Changes:
- Add last_esp32_frame timestamp to AppStateInner
- Add effective_source() method with 5-second timeout
- Source becomes "esp32:offline" when no frames received within 5s
- Health endpoint shows "degraded" instead of "healthy" when offline
- All 6 status/health/info API endpoints use effective_source()

Fixes #297

Co-Authored-By: claude-flow <ruv@ruv.net>
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.

The streaming healthy clients are wrong

1 participant