setup: auto-detect FTDI + Victron serial devices at install time - #74
Merged
Conversation
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.
There was a problem hiding this comment.
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.ymlto use the detected FTDI path (or comments out the XBee mapping if missing). - Patches
VE_DIRECT_PORT=insparrow.envandstarlink.envto 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.
…use set_dotenv_kv for VE_DIRECT_PORT
urucoder
approved these changes
Jul 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
sparrow_setup.shcurrently hardcodes two per-unit device paths from the reference deployment: an FTDI serial (usb-FTDI_FT231X_USB_UART_DU0D4EKZ-if00-port0indocker-compose.yml) and a Victron cable name (usb-VictronEnergy_VE.Direct_cable-if00-port0insparrow.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 withdocker: error gathering device information ... no such file or directoryand logs recurringVE.Direct port not openwarnings.detect_and_patch_local_devices(), called betweenonboard_deviceand the container build. It scans/dev/serial/by-id/for the local FTDI adapter and patchesdocker-compose.yml, then scans for the local Victron cable and patchesVE_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.