How haswitchplate/openhasp works
openHASP is firmware for customizable touchscreen home-automation control, using LVGL to drive commodity displays and MQTT to connect with automation systems. The main runtime initializes configuration and first-run setup, starts the device UI and services, then runs periodic work. The product workflow is user interaction with touchscreen pages, with MQTT providing the documented automation connection. The graph also preserves device/display support, network and device services, and persistent configuration. Wiring beyond the sampled main and MQTT excerpts is inferred only at subsystem level; uncertain call relationships are omitted.
Main entry points: main.cpp Firmware runtime · hasp_gui.cpp GUI runtime · hasp_config.cpp Runtime configuration · hasp_mqtt.h MQTT integration
Components 22
Runtime setup
- Firmware runtime
src/main.cpp - First-run setup
src/hasp_oobe.cpp
Touch UI
- GUI runtime
src/hasp_gui.cpp - Pages and objects
src/hasp/hasp_page.cpp - Events and dispatch
src/hasp/hasp_dispatch.cpp - Payload parsing
src/hasp/hasp_parser.cpp - Font loading
src/font/hasp_font_loader.cpp
Connectivity
- MQTT integration
src/mqtt/hasp_mqtt.h - Network connectivity
src/sys/net/hasp_network.cpp - Time service
src/sys/net/hasp_time.cpp - HTTP service
src/sys/svc/hasp_http.cpp - Console service
src/sys/svc/hasp_console.cpp - Firmware updates
src/sys/svc/hasp_ota.cpp
Device platform
- Device integration
src/dev/device.h - Hardware abstraction
src/hal/hasp_hal.cpp - Display drivers
src/drv/tft - Touch drivers
src/drv/touch
Configuration and state
- Runtime configuration
src/hasp_config.cpp - Filesystem
src/hasp_filesystem.cpp - Persistent settings
src/hasp/hasp_nvs.cpp
Other components
- User
- Home automation
Connections 21
- User → GUI runtime: interacts
- GUI runtime → Display drivers: renders through
- Touch drivers → GUI runtime: provides input
- GUI runtime → Pages and objects: manages pages
- Pages and objects → Events and dispatch: emits events
- MQTT integration → Events and dispatch: dispatches commands
- MQTT integration → Home automation: exchanges messages
- Firmware runtime → Runtime configuration: loads configuration
- Firmware runtime → First-run setup: starts setup
- Firmware runtime → Device integration: initializes device
- Firmware runtime → MQTT integration: starts MQTT
- Firmware runtime → Console service: starts service
- Firmware runtime → HTTP service: starts service
- Firmware runtime → Firmware updates: starts service
- Firmware runtime → Network connectivity: uses connectivity
- Firmware runtime → Time service: runs time service
- Device integration → Hardware abstraction: uses hardware
- Runtime configuration → Filesystem: uses storage
- Runtime configuration → Persistent settings: uses settings
- GUI runtime → Font loading: loads fonts
- Payload parsing → Pages and objects: parses page data