ESPSmartHome
ESPSmartHome is a self-hosted, ESP32-first smart home platform designed as a high-performance modular monolith in V (v0.5.2). It delivers a sub-15MB RAM footprint suitable for...
Get ESPSmartHome
Build 12 · 13 Oct 2026 · Newest test build, not an official version
ESPSmartHome: V-First Distributed ESP32 Smart Hub & Embedded SDK
ESPSmartHome is a self-hosted, ESP32-first smart home platform designed as a high-performance modular monolith in V (v0.5.2). It delivers a sub-15MB RAM footprint suitable for low-power edge gateways and legacy embedded routers (such as the Netgear R6300v2 running Buildroot Linux), coupled with a compiled Nuxt 3 static frontend, a cryptographic physical-presence pairing protocol, and the vhome embedded V-to-C SDK toolchain for building native ESP-IDF firmware.
1. System Architecture
┌────────────────────────────────────────┐
│ Nuxt 3 Static Frontend (Vue 3) │
│ - Dashboard & Device Controls │
│ - Secure 120s Pairing Modal │
│ - Virtual Proxy Devices Visualizer │
│ - Automation Rule Builder │
│ - Embedded V-Studio (Web IDE) │
│ - Matter & Google Home Inspector │
└───────────────────▲────────────────────┘
│ Static Assets / REST
▼
┌────────────────────────────────────────┐
│ ESPSmartHome Hub (V Core) │
│ - VEB HTTP & Static Server (:8080) │
│ - Pairing Manager (120s HMAC Token) │
│ - SQLite WAL Database (WAL Mode) │
│ - Virtual Proxy Engine │
│ - Event-Driven Automation Engine │
│ - Google Home & Matter Bridge Adapters│
└───────────────────▲────────────────────┘
│ Authenticated UDP/TCP
▼
┌──────────────────────────────────────────────────────────────┐
│ ESP32 Physical Nodes │
│ - ESP32 (Xtensa LX6): Dual Relay Controller │
│ - ESP32-S3 (Xtensa LX7): WS2812B RGB Strip (RMT) │
│ - ESP32-C3 (RISC-V): Garage Monotonic Pulse (500ms Timer) │
│ - ESP32-C6 (RISC-V): Si7021 I2C Temperature & Humidity │
└──────────────────────────────────────────────────────────────┘
2. Key Capabilities & Deliverables
A. Core V Backend (src/)
- Single Native Binary: Built with
v -path "src:@vlib" -o espsmarthome src/server.v. - Low Memory Consumption: Capped under 15 MB RAM, enabling deployment on embedded Linux gateways.
- SQLite with WAL Mode: Atomic persistence for devices, entities, proxy mappings, and pairing credentials.
- VEB Micro-Framework Integration: Ultra-fast routing for static assets and REST endpoints (
/api/status,/api/devices,/api/pairing/*,/api/virtual/*,/api/automations/*,/api/sdk/*).
B. Nuxt 3 Static Frontend (web/)
- Static Generation: Compiled with
npm run generateintoweb/dist/(.output/public). Zero runtime Node.js process required in production. - Cybernetic Glassmorphism Design: Inter & Outfit typography, dark mode, live telemetry gauges, glowing toggles, and terminal console.
- Embedded V-Studio: In-browser firmware code editor with preloaded templates, real-time hardware pin conflict and strapping pin validation, and transpiler console.
C. Cryptographic Device Pairing & Mutual Trust Protocol
- Time-Bounded Window: Pairing window is closed by default. Opening it creates an admin-authorized 120-second session nonce (
hub_nonce). - Physical Presence Verification: User presses and holds the hardware BOOT button (GPIO 0 or 9) on the ESP32 for ≥ 3 seconds. The ESP blinks its status LED and broadcasts an ephemeral discovery beacon.
- Mutual Proof (HMAC-SHA256):
- ESP calculates
HMAC_SHA256(DEV_KEY, HUB_NONCE || DEV_NONCE). - Hub validates the cryptographic proof against the active window.
- ESP calculates
- Durable Token Enrollment: Hub issues a permanent
esp_auth_*token, atomically recorded into SQLite. The ESP saves the token to Non-Volatile Storage (NVS). - Immediate Revocation: Deleting a device in the UI immediately blacklists the token hash, terminates sessions, and denies reconnects.
D. Embedded V SDK (vhome-sdk)
Write native firmware purely in idiomatic V without hand-writing C or C++:
module main
import vhome.device
import vhome.gpio
import vhome.timer
fn main() {
mut app := device.new(name: "Garage Opener", model: "vhome-pulse-v1") or { return }
mut relay := gpio.output(pin: 10) or { return }
mut tm := timer.new_timer()
// 500ms momentary pulse executed locally on the ESP microcontroller
app.on_command("pulse", fn (_ string) {
relay.on()
tm.after(500, fn () {
relay.off()
})
})
app.run()
}
E. Hardware Target Matrix & Pin Validation (src/sdk_manager/chip_matrix.v)
| Chip Family | CPU Architecture | Max Clock | RAM | Hardware Peripherals & Notes |
|---|---|---|---|---|
| ESP32 | Xtensa LX6 Dual-Core | 240 MHz | 520 KB | Strapping: GPIO 0, 2, 5, 12, 15. Input-only: GPIO 34–39. 2x I2C. |
| ESP32-S2 | Xtensa LX7 Single-Core | 240 MHz | 320 KB | Strapping: GPIO 0, 45, 46. USB OTG, RMT peripheral. |
| ESP32-S3 | Xtensa LX7 Dual-Core | 240 MHz | 512 KB | Strapping: GPIO 0, 3, 45, 46. Vector extensions, high-speed RMT for WS2812B. |
| ESP32-C3 | RISC-V RV32IMC Single | 160 MHz | 400 KB | Strapping: GPIO 2, 8, 9. 22 programmable GPIOs. Wi-Fi 4 + BLE 5. |
| ESP32-C6 | RISC-V RV32IMAC Single | 160 MHz | 512 KB | Strapping: GPIO 8, 9, 15. Wi-Fi 6 (802.11ax), BLE 5.3, 802.15.4 (Thread/Zigbee). |
3. Command Line Interface (vhome)
The vhome CLI manages the complete embedded development cycle:
# Check toolchains, V compiler, and system dependencies
./vhome doctor
# Display supported ESP32 chip targets and hardware matrix
./vhome targets
# Create a new V firmware project starter
./vhome new my_sensor_node
# Run SDK unit test suites (GPIO safety, Debounce, Pulse, WS2812B, Si7021, HMAC handshake)
./vhome test
# Transpile V source to freestanding C and build firmware
./vhome build --target esp32s3
# Flash binary over serial
./vhome flash --port /dev/ttyUSB0
# Open live serial monitor
./vhome monitor --port /dev/ttyUSB0
4. Building and Running
Prerequisites
- V Compiler (
vv0.5.2+) - Node.js (v24.x) & npm
- GCC and SQLite3 (
libsqlite3-dev)
Step 1: Build Frontend Static Bundle
cd web
npm run generate
cd ..
Step 2: Compile and Run the V Backend
# Compile standalone server
v -path "src:@vlib" -o espsmarthome src/server.v
# Start the server on port 8080
./espsmarthome
Visit http://localhost:8080/ in your browser to access the complete web interface.
5. Verification & Automated Test Suites
All tests run locally on the host without requiring physical hardware:
# Run SDK unit tests
./vhome test
# Run backend integration tests
for f in tests/*.v; do v -path "src:@vlib" run "$f"; done
Verified Test Matrix:
tests/test_pairing.v: 120s window lifecycle, discovery beacon processing, HMAC handshake proof, durable token generation, immediate token revocation, rejection when window is closed.tests/test_virtual.v: Aggregated light/switch dispatching, capability-aware routing (color sent only to RGB nodes), cyclic self-membership guard.tests/test_automation.v: Event-driven trigger evaluation, Si7021 sensor threshold checks (>24.0°C), monotonic action dispatching, execution duration telemetry.tests/test_si7021.v: Si7021 I2C temperature and relative humidity conversion according to Silicon Labs datasheet formula, CRC-8 polynomial0x131validation.tests/test_chip_matrix.v: ESP32 input-only pin rejection (GPIO 34-39), boot-strapping pin warnings (GPIO 0, 2, 9), target matrix configuration.tests/test_integrations.v: Google Home Cloud-to-CloudSYNCandQUERYfulfillment payloads, Matter Bridge endpoints and cluster mapping (0x0006 OnOff,0x0008 LevelControl,0x0300 ColorControl,0x0402 TemperatureMeasurement).