How emsesp/ems-esp works
Project Type and Purpose
• This is a full-stack embedded firmware project for ESP8266/ESP32 (EMS-ESP v2).
• It combines:
• A native microcontroller “backend” (C++ firmware) talking to EMS-bus equipment over UART.
• A multi-user secure web “frontend” (React/TypeScript served by ESPAsyncWebServer).
• External integrations: MQTT (for Home Assistant), Telnet/Serial console, NTP, OTA updates.
File-Structure Analysis
• Top-level:
• src/ ← Core firmware source (device drivers, services, web API)
• interface/ ← React web UI (REST+WebSocket client)
• lib/, lib_standalone/ ← Embedded libraries (ArduinoJson, AsyncTCP/WebServer, UUID console, etc.)
• scripts/, makefile, platformio.ini ← Build & deployment helpers (Python scripts, PlatformIO config).
• Patterns:
• “framework” services under lib/framework implement StatefulService pattern.
• REST/WebSocket controllers in src/ expose internal services.
• React “components”, “authentication”, “api”, “mqtt” folders → client-side MVC.
README Insights
• Emphasizes:
• Web UI for settings/status.
• MQTT Discovery for Home Assistant.
• Standalone AP or join network.
• Console via Serial/Telnet.
• Libraries: esp8266-react, AsyncMqttClient, ESPAsyncWebServer/TCP.