Skip to content

setup: auto-detect FTDI + Victron serial devices at install time - #74

Merged
urucoder merged 2 commits into
mainfrom
setup-auto-detect-devices
Jul 28, 2026
Merged

setup: auto-detect FTDI + Victron serial devices at install time#74
urucoder merged 2 commits into
mainfrom
setup-auto-detect-devices

Conversation

@Clamps251

Copy link
Copy Markdown
Collaborator

Summary

  • sparrow_setup.sh currently hardcodes two per-unit device paths from the reference deployment: an FTDI serial (usb-FTDI_FT231X_USB_UART_DU0D4EKZ-if00-port0 in docker-compose.yml) and a Victron cable name (usb-VictronEnergy_VE.Direct_cable-if00-port0 in sparrow.env / starlink.env). Every FTDI adapter has a globally-unique serial burned into its EEPROM, and different Victron cable variants (e.g. the "BV" cable) enumerate under a completely different by-id name. Any new SPARROW built on different hardware fails with docker: error gathering device information ... no such file or directory and logs recurring VE.Direct port not open warnings.
  • This PR adds detect_and_patch_local_devices(), called between onboard_device and the container build. It scans /dev/serial/by-id/ for the local FTDI adapter and patches docker-compose.yml, then scans for the local Victron cable and patches VE_DIRECT_PORT= in both env files. Both scans are graceful: missing FTDI → comment out the XBee device mapping so containers still start; missing Victron → leave the setting alone.
  • No behavioral change for the reference Pi (existing paths already match its hardware, so the script is a no-op there).

The repo bakes in the FTDI serial from the reference deployment
(usb-FTDI_FT231X_USB_UART_DU0D4EKZ-if00-port0) and a generic Victron
name (usb-VictronEnergy_VE.Direct_cable-if00-port0). Every FTDI adapter
has a unique serial burned into its EEPROM, and some Victron cables
(e.g. the "BV" variant) enumerate under a different by-id name entirely.
On any Pi whose hardware doesn't match those two strings verbatim,
`docker-compose up` fails with "no such file or directory" and rest_client
logs recurring "VE.Direct port not open" warnings.

Add detect_and_patch_local_devices() to sparrow_setup.sh: after onboarding
and before the container build, scan /dev/serial/by-id/ for the local
FTDI adapter and patch docker-compose.yml, then scan for the local
Victron cable and patch VE_DIRECT_PORT in both sparrow.env and starlink.env.
Falls back gracefully when either cable is absent.
Copilot AI review requested due to automatic review settings July 28, 2026 17:39
@Clamps251
Clamps251 requested a review from urucoder July 28, 2026 17:41

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds install-time device auto-detection to make SPARROW setup portable across Raspberry Pis with different FTDI and Victron VE.Direct by-id names, preventing Docker startup failures caused by hardcoded serial paths.

Changes:

  • Introduces detect_and_patch_local_devices() to detect local FTDI and Victron by-id paths under /dev/serial/by-id/.
  • Patches docker-compose.yml to use the detected FTDI path (or comments out the XBee mapping if missing).
  • Patches VE_DIRECT_PORT= in sparrow.env and starlink.env to the detected Victron cable path (or leaves it unchanged if missing).

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

Comment thread setup script/sparrow_setup.sh Outdated
Comment thread setup script/sparrow_setup.sh Outdated
@urucoder
urucoder merged commit 85a9f42 into main Jul 28, 2026
4 checks passed
@Clamps251
Clamps251 deleted the setup-auto-detect-devices branch July 28, 2026 19:28
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