#!/usr/bin/env bash # homeai-esp32/setup.sh — P6: ESPHome firmware for ESP32-S3-BOX-3 # # Components: # - ESPHome — firmware build + flash tool # - base.yaml — shared device config # - voice.yaml — Wyoming Satellite + microWakeWord # - display.yaml — LVGL animated face # - Per-room configs — s3-box-living-room.yaml, etc. # # Prerequisites: # - P1 (homeai-infra) — Home Assistant running # - P3 (homeai-voice) — Wyoming STT/TTS running (ports 10300/10301) # - Python 3.10+ # - USB-C cable for first flash (subsequent updates via OTA) # - On Linux: ensure user is in the dialout group for USB access set -euo pipefail SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" REPO_DIR="$(cd "${SCRIPT_DIR}/.." && pwd)" source "${REPO_DIR}/scripts/common.sh" log_section "P6: ESP32 Firmware (ESPHome)" detect_platform # ─── Prerequisite check ──────────────────────────────────────────────────────── log_info "Checking prerequisites..." if ! command_exists python3; then log_warn "python3 not found — required for ESPHome" fi if ! command_exists esphome; then log_info "ESPHome not installed. To install: pip install esphome" fi if [[ "$OS_TYPE" == "linux" ]]; then if ! groups "$USER" | grep -q dialout; then log_warn "User '$USER' not in 'dialout' group — USB flashing may fail." log_warn "Fix: sudo usermod -aG dialout $USER (then log out and back in)" fi fi # Check P3 dependency if ! curl -sf http://localhost:8123 -o /dev/null 2>/dev/null; then log_warn "Home Assistant (P1) not reachable — ESP32 units won't auto-discover" fi # ─── TODO: Implementation ────────────────────────────────────────────────────── cat <<'EOF' ┌─────────────────────────────────────────────────────────────────┐ │ P6: homeai-esp32 — NOT YET IMPLEMENTED │ │ │ │ Implementation steps: │ │ 1. pip install esphome │ │ 2. Create esphome/secrets.yaml (gitignored) │ │ 3. Create esphome/base.yaml (WiFi, API, OTA) │ │ 4. Create esphome/voice.yaml (Wyoming Satellite, wakeword) │ │ 5. Create esphome/display.yaml (LVGL face, 5 states) │ │ 6. Create esphome/animations.yaml (face state scripts) │ │ 7. Create per-room configs (s3-box-living-room.yaml, etc.) │ │ 8. First flash via USB: esphome run esphome/.yaml │ │ 9. Subsequent OTA: esphome upload esphome/.yaml │ │ 10. Add to Home Assistant → assign Wyoming voice pipeline │ │ │ │ Quick flash (once esphome/ is ready): │ │ esphome run esphome/s3-box-living-room.yaml │ │ esphome logs esphome/s3-box-living-room.yaml │ └─────────────────────────────────────────────────────────────────┘ EOF log_info "P6 is not yet implemented. See homeai-esp32/PLAN.md for details." exit 0