SmaRI is an ESP32-based smart remote intercom / relay controller designed to be securely accessible over the internet via DDNS and HTTP, with a clean modular architecture and a simple web UI.
The project is built with maintainability, safety, and long‑term reliability in mind.
- ESP32-based controller
- Non-blocking relay control
- Web UI (mobile-friendly, dark mode)
- HTTP JSON API
- HTTP Basic Authentication
- Optional API Token authentication
- Audit log (ring buffer, fixed memory usage)
- Static IP support
- DDNS-ready (router-based)
- Secrets isolated from repository
- OOP-style modular architecture
The project is structured to keep responsibilities clearly separated:
SmaRI/
├── SmaRI.ino # Arduino entry point
├── SmaRiApp.{h,cpp} # Application orchestration
├── SmaRiWifi.{h,cpp} # Wi-Fi connection & state
├── SmaRiWebServer.{h,cpp} # HTTP server & routing
├── SmaRiRelayController.{h,cpp} # Relay timing & GPIO control
├── SmaRiAuditLog.{h,cpp} # Fixed-size audit log (ring buffer)
├── SmaRiDisplay.{h,cpp} # OLED UI
├── SmaRiLed.{h,cpp} # Status LED
├── Config.h # Non-secret configuration
├── Secrets.h.example # Example secrets (committed)
└── Secrets.h # Real secrets (NOT committed)
- Web UI: HTTP Basic Auth
- API endpoints: API token OR Basic Auth
- No credentials committed to GitHub
- Fixed relay duration enforced by firmware
- Audit logging for relay actions
- Non-blocking logic (no
delay())
For internet exposure, use VPN or HTTPS reverse proxy.
Secrets are never committed.
- Copy:
Secrets.h.example → Secrets.h - Fill in your credentials.
Secrets.h
#define SMARI_WIFI_SSID "YOUR_SSID"
#define SMARI_WIFI_PASS "YOUR_PASSWORD"
#define SMARI_WEB_USER "admin"
#define SMARI_WEB_PASS "change-me"
#define SMARI_API_TOKEN "change-me-long-random"SmaRI does not implement DDNS in firmware.
DDNS must be handled by:
- Your router
- A NAS / home server
- A PC running a DDNS client
- Public DNS:
http://yourname.ddns.net - Router forwards WAN port → ESP32 local IP (port 80)
Example:
WAN TCP 1987 → 192.168.1.87:80
Then access:
http://yourname.ddns.net:1987/
GET /health
GET /api/status
Returns JSON:
{
"uptime_ms": 123456,
"wifi_state": "connected",
"ip": "192.168.1.87",
"rssi": -55,
"relay_busy": false,
"relay_remaining_ms": 0
}GET /api/relay?id=1
- Relay duration is enforced by firmware
- Client-provided duration is ignored or clamped
GET /api/log
Returns a JSON array (most recent first).
- Non-blocking timing using
millis() - Fixed maximum duration (safety)
- Busy state prevents overlapping activations
- Relay controller never blocks the main loop
- Embedded HTML (no external assets)
- Dark mode
- Auto-refresh status
- Buttons disabled only while relay is busy
- Works on mobile and desktop
- No dynamic memory growth
- Fixed-size audit log
- No blocking delays
- Designed for 24/7 uptime
- OTA firmware updates
- Persistent configuration (NVS)
- mDNS (
smari.local) - HTTPS via reverse proxy
- VPN-only access (recommended)
MIT License
Created by micBar0ne
Project: SmaRI – Smart Remote Intercom