Docs/SMART_HOME_ARCHITECTURE.md
← All docs
MarkdownHTML Render

Smart Home Architecture

Reference architecture covering cloud, edge, and control plane.

Smart Home Architecture

System Overview

Fantom Interio Smart Home is split into five layers:

  1. Ingestion Layer — image upload, floor-plan parse, room extraction.
  2. Planning Layer — smart-home recommendations, wiring, device placement.
  3. Visualization Layer — 3D editor overlays and project dashboards.
  4. Control Layer — command dispatch through protocol adapters.
  5. State Layer — per-project persistence, scenes, automations, energy/security.

Data Flow

Upload → Parse (/parse-floor-plan) → Plan (/smart-home-plan) → 3D View (FloorPlan3D) → Device Control (smartHomeProtocol) → Automation (smartHomeStore)

State Management Design

  • Store: utils/smartHomeStore.ts
  • Keyed per projectId
  • Persists devices, scenes, energy snapshots, and security flags
  • Supports export/import JSON portability

Protocol Abstraction Layer

utils/smartHomeProtocol.ts exposes a mode-agnostic bridge:

  • connect()
  • disconnect()
  • sendCommand(command)
  • subscribe(handler)
  • getState()

Adapters:

  • Demo simulator
  • ESP32 WebSocket adapter
  • MQTT adapter
  • Integration simulator interfaces (Alexa/Siri/Google/Matter)

Adapter Pattern

All adapters normalize payloads to a shared command contract:

{
  "deviceId": "string",
  "action": "on|off|toggle|dim|setTemp|set",
  "value": "optional",
  "timestamp": 0
}

This allows UI and automation logic to remain protocol-independent.