# iodn/geekmagic-tv-esp8266 architecture

> Architecture diagram of the GitHub repository iodn/geekmagic-tv-esp8266, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-07). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/iodn/geekmagic-tv-esp8266
- Repository: https://github.com/iodn/geekmagic-tv-esp8266

## Overview

This is ESP8266 firmware for a SmallTV weather clock. Its principal workflow is boot and provision WiFi, serve an authenticated browser dashboard, acquire configured feeds, and render the resulting clock, data pages, or temporary images on the display. The graph preserves the documented integrations and device capabilities; connections for subsystems whose implementation was not excerpted are omitted rather than inferred. The README documents LittleFS configuration, EEPROM settings validation, and OTA behavior.

Main entry points: [`src/main.cpp`](https://github.com/iodn/geekmagic-tv-esp8266/blob/master/src/main.cpp) (Firmware lifecycle), [`src/webserver.cpp`](https://github.com/iodn/geekmagic-tv-esp8266/blob/master/src/webserver.cpp) (HTTP routes), [`src/feeds.cpp`](https://github.com/iodn/geekmagic-tv-esp8266/blob/master/src/feeds.cpp) (Feed polling), [`src/display.cpp`](https://github.com/iodn/geekmagic-tv-esp8266/blob/master/src/display.cpp) (Page rendering)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_boot["Boot and connectivity"]
  node_boot["Firmware lifecycle<br/>[main.cpp]"]
  node_wifi["WiFi setup<br/>[main.cpp]"]
  node_mdns["mDNS discovery<br/>[main.cpp]"]
  node_ota["OTA updates<br/>[main.cpp]"]
  node_button["Button controls<br/>[button.cpp]"]
end

subgraph group_management["Dashboard management"]
  node_http["HTTP routes<br/>[webserver.cpp]"]
  node_webui["Browser dashboard<br/>[webui.h]"]
  node_auth["Authentication<br/>[auth.cpp]"]
  node_dashboard["Dashboard config<br/>[dashboard.cpp]"]
end

subgraph group_content["Feeds and display"]
  node_feeds["Feed polling<br/>[feeds.cpp]"]
  node_weather["Open-Meteo"]
  node_markets["Market providers"]
  node_ha["Home Assistant"]
  node_display["Page rendering<br/>[display.cpp]"]
  node_st7789["ST7789 display"]
  node_image["Temporary images<br/>[display.cpp]"]
end

subgraph group_persistence["Configuration and state"]
  node_littlefs[("LittleFS configs<br/>[dashboard.cpp]")]
  node_settings[("EEPROM settings<br/>[settings.cpp]")]
  node_logger[("Device logs<br/>[logger.cpp]")]
end

node_owner(("Device owner"))
node_ntp["NTP time"]

node_owner -->|"configures"| node_wifi
node_owner -->|"uses"| node_http
node_boot -->|"loads"| node_settings
node_boot -->|"initializes"| node_dashboard
node_boot -->|"initializes"| node_feeds
node_boot -->|"initializes"| node_display
node_boot -->|"starts"| node_wifi
node_boot -->|"starts"| node_mdns
node_boot -->|"starts"| node_ota
node_boot -.->|"starts"| node_http
node_boot -->|"configures"| node_ntp
node_button -.->|"cycles pages"| node_display
node_webui -->|"sends requests"| node_http
node_http -->|"verifies login"| node_auth
node_http -->|"applies settings"| node_dashboard
node_http -->|"applies feed config"| node_feeds
node_http -->|"updates display"| node_display
node_http -->|"saves settings"| node_settings
node_http -->|"serves UI"| node_webui
node_feeds -.->|"polls"| node_weather
node_feeds -.->|"polls"| node_markets
node_feeds -.->|"polls REST"| node_ha
node_feeds -->|"updates data"| node_dashboard
node_display -->|"renders data"| node_dashboard
node_display -->|"reads feed data"| node_feeds
node_display -.->|"draws output"| node_st7789
node_display -->|"renders JPEG"| node_image
node_dashboard -->|"persists config"| node_littlefs
node_feeds -->|"persists feed config"| node_littlefs
node_settings -.->|"stores image state"| node_littlefs
node_boot -->|"initializes logging"| node_logger
node_http -.->|"writes logs"| node_logger

click node_boot "https://github.com/iodn/geekmagic-tv-esp8266/blob/master/src/main.cpp"
click node_wifi "https://github.com/iodn/geekmagic-tv-esp8266/blob/master/src/main.cpp"
click node_mdns "https://github.com/iodn/geekmagic-tv-esp8266/blob/master/src/main.cpp"
click node_ota "https://github.com/iodn/geekmagic-tv-esp8266/blob/master/src/main.cpp"
click node_button "https://github.com/iodn/geekmagic-tv-esp8266/blob/master/src/button.cpp"
click node_http "https://github.com/iodn/geekmagic-tv-esp8266/blob/master/src/webserver.cpp"
click node_webui "https://github.com/iodn/geekmagic-tv-esp8266/blob/master/src/webui.h"
click node_auth "https://github.com/iodn/geekmagic-tv-esp8266/blob/master/src/auth.cpp"
click node_dashboard "https://github.com/iodn/geekmagic-tv-esp8266/blob/master/src/dashboard.cpp"
click node_feeds "https://github.com/iodn/geekmagic-tv-esp8266/blob/master/src/feeds.cpp"
click node_display "https://github.com/iodn/geekmagic-tv-esp8266/blob/master/src/display.cpp"
click node_image "https://github.com/iodn/geekmagic-tv-esp8266/blob/master/src/display.cpp"
click node_littlefs "https://github.com/iodn/geekmagic-tv-esp8266/blob/master/src/dashboard.cpp"
click node_settings "https://github.com/iodn/geekmagic-tv-esp8266/blob/master/src/settings.cpp"
click node_logger "https://github.com/iodn/geekmagic-tv-esp8266/blob/master/src/logger.cpp"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_boot,node_wifi,node_mdns,node_ota,node_button toneBlue
class node_http,node_webui,node_auth,node_dashboard toneAmber
class node_feeds,node_weather,node_markets,node_ha,node_display,node_st7789,node_image toneMint
class node_littlefs,node_settings,node_logger toneRose
class node_owner,node_ntp toneIndigo
```

## Components

### Boot and connectivity

- [Firmware lifecycle](https://github.com/iodn/geekmagic-tv-esp8266/blob/master/src/main.cpp): `src/main.cpp`
- [WiFi setup](https://github.com/iodn/geekmagic-tv-esp8266/blob/master/src/main.cpp): `src/main.cpp`
- [mDNS discovery](https://github.com/iodn/geekmagic-tv-esp8266/blob/master/src/main.cpp): `src/main.cpp`
- [OTA updates](https://github.com/iodn/geekmagic-tv-esp8266/blob/master/src/main.cpp): `src/main.cpp`
- [Button controls](https://github.com/iodn/geekmagic-tv-esp8266/blob/master/src/button.cpp): `src/button.cpp`

### Dashboard management

- [HTTP routes](https://github.com/iodn/geekmagic-tv-esp8266/blob/master/src/webserver.cpp): `src/webserver.cpp`
- [Browser dashboard](https://github.com/iodn/geekmagic-tv-esp8266/blob/master/src/webui.h): `src/webui.h`
- [Authentication](https://github.com/iodn/geekmagic-tv-esp8266/blob/master/src/auth.cpp): `src/auth.cpp`
- [Dashboard config](https://github.com/iodn/geekmagic-tv-esp8266/blob/master/src/dashboard.cpp): `src/dashboard.cpp`

### Feeds and display

- [Feed polling](https://github.com/iodn/geekmagic-tv-esp8266/blob/master/src/feeds.cpp): `src/feeds.cpp`
- **Open-Meteo**
- **Market providers**
- **Home Assistant**
- [Page rendering](https://github.com/iodn/geekmagic-tv-esp8266/blob/master/src/display.cpp): `src/display.cpp`
- **ST7789 display**
- [Temporary images](https://github.com/iodn/geekmagic-tv-esp8266/blob/master/src/display.cpp): `src/display.cpp`

### Configuration and state

- [LittleFS configs](https://github.com/iodn/geekmagic-tv-esp8266/blob/master/src/dashboard.cpp): `src/dashboard.cpp`
- [EEPROM settings](https://github.com/iodn/geekmagic-tv-esp8266/blob/master/src/settings.cpp): `src/settings.cpp`
- [Device logs](https://github.com/iodn/geekmagic-tv-esp8266/blob/master/src/logger.cpp): `src/logger.cpp`

### Other components

- **Device owner**
- **NTP time**

## Connections

- Device owner → WiFi setup: configures (evidence: `README.md`)
- Device owner → HTTP routes: uses (evidence: `README.md`)
- Firmware lifecycle → EEPROM settings: loads (evidence: `src/main.cpp`)
- Firmware lifecycle → Dashboard config: initializes (evidence: `src/main.cpp`)
- Firmware lifecycle → Feed polling: initializes (evidence: `src/main.cpp`)
- Firmware lifecycle → Page rendering: initializes (evidence: `src/main.cpp`)
- Firmware lifecycle → WiFi setup: starts (evidence: `src/main.cpp`)
- Firmware lifecycle → mDNS discovery: starts (evidence: `src/main.cpp`)
- Firmware lifecycle → OTA updates: starts (evidence: `src/main.cpp`)
- Firmware lifecycle → HTTP routes: starts
- Firmware lifecycle → NTP time: configures (evidence: `src/main.cpp`)
- Button controls → Page rendering: cycles pages
- Browser dashboard → HTTP routes: sends requests (evidence: `src/webui.h`)
- HTTP routes → Authentication: verifies login (evidence: `src/webserver.cpp`)
- HTTP routes → Dashboard config: applies settings (evidence: `src/webserver.cpp`)
- HTTP routes → Feed polling: applies feed config (evidence: `src/webserver.cpp`)
- HTTP routes → Page rendering: updates display (evidence: `src/webserver.cpp`)
- HTTP routes → EEPROM settings: saves settings (evidence: `src/webserver.cpp`)
- HTTP routes → Browser dashboard: serves UI (evidence: `src/webserver.cpp`)
- Feed polling → Open-Meteo: polls
- Feed polling → Market providers: polls
- Feed polling → Home Assistant: polls REST
- Feed polling → Dashboard config: updates data
- Page rendering → Dashboard config: renders data (evidence: `src/display.cpp`)
- Page rendering → Feed polling: reads feed data (evidence: `src/display.cpp`)
- Page rendering → ST7789 display: draws output
- Page rendering → Temporary images: renders JPEG (evidence: `src/display.cpp`)
- Dashboard config → LittleFS configs: persists config (evidence: `src/dashboard.cpp`)
- Feed polling → LittleFS configs: persists feed config
- EEPROM settings → LittleFS configs: stores image state
- Firmware lifecycle → Device logs: initializes logging (evidence: `src/main.cpp`)
- HTTP routes → Device logs: writes logs
