How nielsu97/smart-home-dashboard works
Project type and purpose
• This is an embedded full-stack Qt/QML application targeted at a Raspberry Pi.
• Purpose: display and control Home Assistant entities (lights, climate, energy, music) via its REST API.
Top-level file‐structure analysis
• cpp/: C++ “backend” (main.cpp, backend.{cpp,h})
• qml/: QML “frontend” (Main.qml, components/, pane/)
• CMakeLists.txt / .pro: build configuration
• README.md: deployment & run instructions (systemd, eglfs)
Key architectural insights from README
• Qt6 (QNetworkAccessManager, JSON parsing, QML engine)
• Single binary SmartDashboard
• Deployed as a systemd service on Raspberry Pi, using eglfs for direct‐to‐framebuffer output
• Polls or subscribes to Home Assistant via its HTTP API (token + IP)
Main components
a. Hardware & OS layer
• Raspberry Pi (Linux + systemd)
• eglfs (Qt platform plugin)
b. Application layer
• C++ backend
– initializes QML engine
– manages QNetworkAccessManager for REST calls
– parses JSON entities (lights, climate, etc.)
– exposes data & methods to QML via QObject properties & slots
• QML frontend
– Main.qml (root)
– components/ (reusable controls)
– pane/ (feature pages: Home, Climate, Energy, Music)
c. External services
• Home Assistant API (HTTP over LAN)
Relationships & interactions
• On startup, systemd → starts SmartDashboard
• C++ main → sets up QML engine, loads Main.qml
• QML UI triggers C++ slots (e.g., toggle light)
• Backend issues HTTP GET/POST to Home Assistant → receives JSON → updates QML properties → UI refresh
• Data flows: Home Assistant → C++ → QML → user → C++ → Home Assistant
Architectural patterns & design principles
• MVC‐like separation: QML = View, C++ = Model+Controller
• Signal–slot mechanism for decoupling UI and logic
• Single‐process monolith deployed on device
• Systemd for lifecycle management
Essential elements to capture
• Clear, hierarchical layering (Hardware → OS → App → UI)
• All major code modules (cpp/, qml/)
• Data flow direction and trigger points (user actions, polling)
• Deployment & startup sequence (systemd, boot)