Skip to content

Add modular configuration system with multi-board support#16

Draft
josefelixh wants to merge 4 commits into
vacuula:mainfrom
josefelixh:feature/modular-configuration
Draft

Add modular configuration system with multi-board support#16
josefelixh wants to merge 4 commits into
vacuula:mainfrom
josefelixh:feature/modular-configuration

Conversation

@josefelixh
Copy link
Copy Markdown

Summary

This PR introduces a flexible, modular ESPHome configuration architecture that makes it easy to switch between different ESP board types and enable/disable optional features without manually editing GPIO pins or framework settings.

Motivation

The current single-file configuration works well but has some limitations:

  • Switching between ESP32-C3, ESP32, and ESP8266 requires manual changes to GPIO pins and framework settings
  • Optional features (like remote logging) clutter the main configuration when not needed
  • First-time USB setup can be challenging for users unfamiliar with serial port detection
  • Cross-platform setup varies between macOS, Linux, and Windows

This modular system addresses these pain points while maintaining full compatibility with all existing Neato robot functionality.

What's New

📦 Modular Configuration Files

  • neato-esp-modular.yaml: Main configuration with simple board/feature selection via comments
  • Board configs (boards/): ESP32-C3 (recommended), ESP32, and ESP8266 with correct GPIO/framework settings
  • Optional features (features/): Captive portal, syslog remote logging, and debug tools
  • secrets.yaml.example: Clear template with examples for all configuration options

🛠️ Cross-Platform Helper Scripts

  • esphome.sh: Bash script for macOS/Linux/Windows (Git Bash) with automatic USB port detection
  • esphome.ps1: Native PowerShell script for Windows users
  • Both scripts support Docker and native ESPHome installations with auto-detection

📚 Documentation

  • CONFIGURATION_GUIDE.md: Comprehensive setup guide with troubleshooting section

Key Features

Easy board switching - Change boards by commenting/uncommenting one line
Modular features - Enable captive portal, syslog, or debug tools independently
Auto USB detection - Scripts automatically find serial ports for first-time uploads
Cross-platform - Works on macOS, Linux, and Windows (Git Bash + PowerShell)
Docker + Native - Supports both Docker and pip-installed ESPHome
Configurable WiFi domain - Set custom mDNS domain via substitution (defaults to .lan)
Fully validated - All features tested together, maintains existing functionality

Example Usage

Switching Boards

packages:
  board: !include boards/esp32c3.yaml    # ✓ Using ESP32-C3
  # board: !include boards/esp32.yaml    # Switch to ESP32
  # board: !include boards/esp8266.yaml  # Switch to ESP8266

Enabling Features

# Uncomment any features you want:
captive_portal: !include
  file: features/captive-portal.yaml
  optional: true

Using Helper Scripts

# First-time USB upload (auto-detects port)
./esphome.sh usb-run

# Subsequent wireless updates
./esphome.sh run

Testing

  • ✅ Validated configuration with all features enabled simultaneously
  • ✅ Tested board config for ESP32-C3 (other configs will need to be tested, confirmed by other users)
  • ✅ Verified script functionality on macOS (bash)

Future Enhancements

Potential additions (not included in this PR):

  • Additional optional features (e.g., web server, Prometheus metrics)
  • Configuration presets for common setups
  • Migration helper script for existing configurations

🤖 Generated with Claude Code

Co-Authored-By: Claude noreply@anthropic.com

josefelixh and others added 4 commits December 18, 2025 20:47
Introduces a flexible, modular ESPHome configuration architecture that
supports multiple ESP board types and optional features.

## New Files

### Core Configuration
- neato-esp-modular.yaml: Main modular configuration file with easy
  board selection and optional feature toggles
- secrets.yaml.example: Template for user secrets with clear examples

### Board Support
- boards/esp32c3.yaml: ESP32-C3 configuration (recommended, ESP-IDF)
- boards/esp32.yaml: Standard ESP32 configuration (ESP-IDF)
- boards/esp8266.yaml: ESP8266 configuration (Arduino framework)

### Optional Features
- features/captive-portal.yaml: WiFi fallback AP with captive portal
- features/syslog.yaml: Remote syslog server logging support
- features/debug-tools.yaml: UART command testing and debugging tools

### Helper Scripts
- esphome.sh: Cross-platform bash script with Docker/native ESPHome
  support and automatic USB port detection (macOS/Linux/Windows Git Bash)
- esphome.ps1: Native PowerShell script for Windows users

### Documentation
- CONFIGURATION_GUIDE.md: Comprehensive setup and troubleshooting guide

## Key Features

- **Multi-board support**: Switch between ESP32-C3, ESP32, and ESP8266
  by commenting/uncommenting one line
- **Optional features**: Enable/disable captive portal, syslog, and
  debug tools independently
- **Cross-platform tooling**: Helper scripts work on macOS, Linux, and
  Windows (both Git Bash and PowerShell)
- **Auto USB detection**: Scripts automatically detect USB serial ports
  for first-time firmware uploads
- **Docker and native**: Scripts support both Docker and native ESPHome
  installations with automatic detection
- **Configurable WiFi domain**: mDNS domain configurable via substitution
  (defaults to .lan)

## Benefits

- Easier board migration without manual GPIO/framework changes
- Modular feature management reduces configuration clutter
- Better developer experience with USB auto-detection and unified CLI
- Maintains all existing Neato robot functionality
- Validated with all features enabled simultaneously

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Add features/web-server.yaml for HTTP web interface
- Web server allows monitoring and controlling device via browser
- Accessible via http://[device-name].local or IP address
- Feature is disabled by default (commented out in packages)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Add diagnostics feature (WiFi signal & uptime sensors)
- Add prometheus feature (metrics endpoint for monitoring)
- Add hardware monitoring feature (ESP32 memory & performance sensors)
- Update main config to include new optional features

All features are optional and disabled by default.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@ostat
Copy link
Copy Markdown

ostat commented Dec 26, 2025

Splitting up the yaml to separate modules is a nice idea.

Could we also put the neato specific config in to its own file? Then we could reference it in our local esphome config with something like this:

packages:
  neato: github://Philip2809/neato-connected/packages/neato-connected.yaml

@Dorikumi
Copy link
Copy Markdown

Looks very nice and would had helped me a lot.
Can you add the esp32-c3 supermini? Several people adviced to not use gpio 20/21 but rather gpio 0/1 on this boards.

There is no mention of Homeassistants ESPHome builder as option for compiling in the readme.

@Philip2809
Copy link
Copy Markdown
Member

sorry for never writing about it here but just in the discord, I want to implement this but want to do in in some specific ways, both splitting up the handling of uart system to cpp files but also the config files to a modular system similar to this one here, but at the same time the end user needs to be able to only input data in one file and it should compile for them. Of course if they want they can get each module as they want/please but a base should work on that simple principle. This is however not my prio task for now, I played a bit with a module config a while ago but was not able to find something that I liked, will revisit this after a ros release.

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.

4 participants