# jtenniswood/esphome-lvgl architecture

> Architecture diagram of the GitHub repository jtenniswood/esphome-lvgl, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-21). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/jtenniswood/esphome-lvgl
- Repository: https://github.com/jtenniswood/esphome-lvgl

## Overview

##### Project type and purpose
- This is an ESPHome-based IoT firmware package for an ESP32-S3 with a 7” touch LCD, called “office-panel.”

##### File structure
- Top-level directories:
- device: board-specific YAML (ESP32-S3 touch LCD)
- addon: reusable service modules (network/Wi-Fi, NTP time sync, backlight)
- theme: UI style definitions (button)
- office: app-specific logic (LVGL UI screen layouts, sensor definitions)
- esphome: entry point (office.yaml) that pulls in all packages
- Patterns:
- Modular “packages” approach—each logical concern in its own YAML file.
- Configuration-driven, no custom code—ESPHome compiles these into C++ firmware.

##### README
- Shows how to include this repository as an ESPHome “packages” URL.
- Confirms the high-level flow: esphome/office.yaml references device, addons, assets, theme, and office modules.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Hardware Layer
    subgraph "Hardware Layer"
        Device["device/esp32-s3-touch-lcd-7.yaml"]:::hardware
    end

    %% ESPhome Engine
    ESPhome["ESPhome Engine"]:::engine

    %% Addons
    subgraph "Addon Modules"
        Network["addon/network.yaml"]:::addon
        Time["addon/time.yaml"]:::addon
        Backlight["addon/backlight.yaml"]:::addon
    end

    %% Assets
    subgraph "Assets"
        Fonts["assets/fonts.yaml"]:::asset
        Icons["assets/icons.yaml"]:::asset
        ImagesDef["assets/images.yaml"]:::asset
        ImagesBin["Asset Binaries"]:::asset
    end

    %% Theme
    subgraph "Theme Modules"
        ButtonTheme["theme/button.yaml"]:::theme
    end

    %% Office Logic
    subgraph "Office Modules"
        Sensors["office/sensors.yaml"]:::office
        LVGL["office/lvgl.yaml"]:::office
    end

    %% Output Firmware
    BIN["Firmware BIN Image"]:::output

    %% Connections
    ESPhome --> Device
    ESPhome --> Network
    ESPhome --> Time
    ESPhome --> Backlight
    ESPhome --> Fonts
    ESPhome --> Icons
    ESPhome --> ImagesDef
    ESPhome --> ButtonTheme
    ESPhome --> Sensors
    ESPhome --> LVGL

    %% Assets and Theme feed UI
    Fonts --> LVGL
    Icons --> LVGL
    ImagesDef --> LVGL
    ImagesBin --> LVGL
    ButtonTheme --> LVGL

    %% Sensors feed UI and UI events
    Sensors --> LVGL
    LVGL --> Sensors

    %% UI renders to hardware
    LVGL --> Device

    %% Addon services
    Network --> ESPhome
    Time --> ESPhome
    Backlight --> Device

    %% Firmware build and flash
    ESPhome --> BIN
    BIN -->|"flash"| Device

    %% Click Events
    click ESPhome "https://github.com/jtenniswood/esphome-lvgl/blob/main/esphome/office.yaml"
    click Device "https://github.com/jtenniswood/esphome-lvgl/blob/main/device/esp32-s3-touch-lcd-7.yaml"
    click Network "https://github.com/jtenniswood/esphome-lvgl/blob/main/addon/network.yaml"
    click Time "https://github.com/jtenniswood/esphome-lvgl/blob/main/addon/time.yaml"
    click Backlight "https://github.com/jtenniswood/esphome-lvgl/blob/main/addon/backlight.yaml"
    click Fonts "https://github.com/jtenniswood/esphome-lvgl/blob/main/assets/fonts.yaml"
    click Icons "https://github.com/jtenniswood/esphome-lvgl/blob/main/assets/icons.yaml"
    click ImagesDef "https://github.com/jtenniswood/esphome-lvgl/blob/main/assets/images.yaml"
    click ImagesBin "https://github.com/jtenniswood/esphome-lvgl/tree/main/assets/images/"
    click ButtonTheme "https://github.com/jtenniswood/esphome-lvgl/blob/main/theme/button.yaml"
    click Sensors "https://github.com/jtenniswood/esphome-lvgl/blob/main/office/sensors.yaml"
    click LVGL "https://github.com/jtenniswood/esphome-lvgl/blob/main/office/lvgl.yaml"

    %% Styles
    classDef hardware fill:#dddddd,stroke:#333,stroke-width:1px
    classDef engine fill:#aaddff,stroke:#333,stroke-width:1px
    classDef addon fill:#ccffcc,stroke:#333,stroke-width:1px
    classDef asset fill:#ffdd99,stroke:#333,stroke-width:1px
    classDef theme fill:#ff9999,stroke:#333,stroke-width:1px
    classDef office fill:#d9ccff,stroke:#333,stroke-width:1px
    classDef output fill:#aaffaa,stroke:#333,stroke-width:1px
```
