# edwardtfn/nspanel-easy architecture

> Architecture diagram of the GitHub repository edwardtfn/nspanel-easy, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-23). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/edwardtfn/nspanel-easy
- Repository: https://github.com/edwardtfn/nspanel-easy

## Overview

NSPanel Easy is ESPHome firmware for a Sonoff NSPanel, configured through a Home Assistant Blueprint and presenting controls on a Nextion TFT. The principal workflow is Blueprint-provided entity/settings data reaching the panel, which renders interactive pages and hardware feedback; users interact with those pages to control Home Assistant entities. The repository also includes climate relay control, weather, display management, and hardware support. The README describes the Blueprint/TFT integration, while sampled sources show subscription dispatch and page/display implementation; links between unsampled subsystems are omitted where their wiring is not evidenced.

Main entry points: [`components/nspanel_easy/api_subscriptions.cpp`](https://github.com/edwardtfn/nspanel-easy/blob/main/components/nspanel_easy/api_subscriptions.cpp) (Entity Subscriptions), [`components/nspanel_easy/page_home.cpp`](https://github.com/edwardtfn/nspanel-easy/blob/main/components/nspanel_easy/page_home.cpp) (Home & Weather), [`components/nspanel_easy/page_buttons.cpp`](https://github.com/edwardtfn/nspanel-easy/blob/main/components/nspanel_easy/page_buttons.cpp) (Button Pages), [`components/nspanel_easy/page_climate.cpp`](https://github.com/edwardtfn/nspanel-easy/blob/main/components/nspanel_easy/page_climate.cpp) (Climate Page)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_integration["Configuration &amp; API"]
  node_blueprint["HA Blueprint"]
  node_firmware["ESPHome Firmware<br/>[__init__.py]"]
  node_subscriptions["Entity Subscriptions"]
  node_snapshots["Entity Snapshots"]
  node_base["Runtime State<br/>[base.h]"]
end

subgraph group_rendering["Display &amp; Pages"]
  node_pages["Page Navigation<br/>[pages.h]"]
  node_nextion["Nextion Components"]
  node_icon_rules["Icon Rules<br/>[icon_rules.h]"]
  node_text["Text Formatting<br/>[text.cpp]"]
end

subgraph group_domain["Entity Experiences"]
  node_home["Home &amp; Weather<br/>[page_home.cpp]"]
  node_buttons["Button Pages<br/>[page_buttons.cpp]"]
  node_entities["Entity Pages<br/>[page_entities.h]"]
  node_climate["Climate Page<br/>[page_climate.cpp]"]
  node_cover["Cover Controls<br/>[page_cover.h]"]
  node_lights["Light Controls<br/>[page_light.cpp]"]
  node_media["Media Controls"]
  node_security["Alarm Controls<br/>[page_alarm.h]"]
  node_utilities["Utilities Dashboard<br/>[page_utilities.h]"]
  node_weather["Forecast Data<br/>[weather.h]"]
end

subgraph group_hardware["Panel Hardware"]
  node_display["Display Control<br/>[hw_display.cpp]"]
  node_climate_addon["Climate Relay<br/>[addon_climate.cpp]"]
  node_temperature["Temperature Sensor<br/>[hw_temperature.cpp]"]
  node_tft_upload["TFT Upload"]
end

node_ha(("Home Assistant"))

node_ha -->|"provides configuration"| node_blueprint
node_blueprint -->|"configures"| node_firmware
node_ha -.->|"sends entity updates"| node_subscriptions
node_subscriptions -->|"dispatches renders"| node_home
node_subscriptions -->|"dispatches renders"| node_buttons
node_subscriptions -->|"dispatches renders"| node_climate
node_snapshots -->|"reads entity state"| node_subscriptions
node_home -->|"uses forecast"| node_weather
node_home -->|"renders on"| node_nextion
node_buttons -->|"updates components"| node_nextion
node_climate -->|"uses navigation"| node_pages
node_climate_addon -->|"supports thermostat"| node_climate
node_display -->|"manages display pages"| node_pages
node_temperature -->|"uses runtime state"| node_base
node_icon_rules -->|"resolves icons"| node_subscriptions
node_buttons -->|"wraps labels"| node_text

click node_firmware "https://github.com/edwardtfn/nspanel-easy/blob/main/components/nspanel_easy/__init__.py"
click node_subscriptions "https://github.com/edwardtfn/nspanel-easy/blob/main/components/nspanel_easy/api_subscriptions.cpp"
click node_snapshots "https://github.com/edwardtfn/nspanel-easy/blob/main/components/nspanel_easy/entity_snapshot.cpp"
click node_base "https://github.com/edwardtfn/nspanel-easy/blob/main/components/nspanel_easy/base.h"
click node_pages "https://github.com/edwardtfn/nspanel-easy/blob/main/components/nspanel_easy/pages.h"
click node_nextion "https://github.com/edwardtfn/nspanel-easy/blob/main/components/nspanel_easy/nextion_components.h"
click node_display "https://github.com/edwardtfn/nspanel-easy/blob/main/components/nspanel_easy/hw_display.cpp"
click node_home "https://github.com/edwardtfn/nspanel-easy/blob/main/components/nspanel_easy/page_home.cpp"
click node_buttons "https://github.com/edwardtfn/nspanel-easy/blob/main/components/nspanel_easy/page_buttons.cpp"
click node_entities "https://github.com/edwardtfn/nspanel-easy/blob/main/components/nspanel_easy/page_entities.h"
click node_climate "https://github.com/edwardtfn/nspanel-easy/blob/main/components/nspanel_easy/page_climate.cpp"
click node_climate_addon "https://github.com/edwardtfn/nspanel-easy/blob/main/components/nspanel_easy/addon_climate.cpp"
click node_cover "https://github.com/edwardtfn/nspanel-easy/blob/main/components/nspanel_easy/page_cover.h"
click node_lights "https://github.com/edwardtfn/nspanel-easy/blob/main/components/nspanel_easy/page_light.cpp"
click node_media "https://github.com/edwardtfn/nspanel-easy/blob/main/components/nspanel_easy/page_media_player.h"
click node_security "https://github.com/edwardtfn/nspanel-easy/blob/main/components/nspanel_easy/page_alarm.h"
click node_utilities "https://github.com/edwardtfn/nspanel-easy/blob/main/components/nspanel_easy/page_utilities.h"
click node_weather "https://github.com/edwardtfn/nspanel-easy/blob/main/components/nspanel_easy/weather.h"
click node_temperature "https://github.com/edwardtfn/nspanel-easy/blob/main/components/nspanel_easy/hw_temperature.cpp"
click node_tft_upload "https://github.com/edwardtfn/nspanel-easy/blob/main/components/nspanel_easy/addon_upload_tft.cpp"
click node_icon_rules "https://github.com/edwardtfn/nspanel-easy/blob/main/components/nspanel_easy/icon_rules.h"
click node_text "https://github.com/edwardtfn/nspanel-easy/blob/main/components/nspanel_easy/text.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_blueprint,node_firmware,node_subscriptions,node_snapshots,node_base toneBlue
class node_pages,node_nextion,node_icon_rules,node_text toneAmber
class node_home,node_buttons,node_entities,node_climate,node_cover,node_lights,node_media,node_security,node_utilities,node_weather toneMint
class node_display,node_climate_addon,node_temperature,node_tft_upload toneRose
class node_ha toneIndigo
```

## Components

### Configuration & API

- **HA Blueprint**
- [ESPHome Firmware](https://github.com/edwardtfn/nspanel-easy/blob/main/components/nspanel_easy/__init__.py): `components/nspanel_easy/__init__.py`
- [Entity Subscriptions](https://github.com/edwardtfn/nspanel-easy/blob/main/components/nspanel_easy/api_subscriptions.cpp): `components/nspanel_easy/api_subscriptions.cpp`
- [Entity Snapshots](https://github.com/edwardtfn/nspanel-easy/blob/main/components/nspanel_easy/entity_snapshot.cpp): `components/nspanel_easy/entity_snapshot.cpp`
- [Runtime State](https://github.com/edwardtfn/nspanel-easy/blob/main/components/nspanel_easy/base.h): `components/nspanel_easy/base.h`

### Display & Pages

- [Page Navigation](https://github.com/edwardtfn/nspanel-easy/blob/main/components/nspanel_easy/pages.h): `components/nspanel_easy/pages.h`
- [Nextion Components](https://github.com/edwardtfn/nspanel-easy/blob/main/components/nspanel_easy/nextion_components.h): `components/nspanel_easy/nextion_components.h`
- [Icon Rules](https://github.com/edwardtfn/nspanel-easy/blob/main/components/nspanel_easy/icon_rules.h): `components/nspanel_easy/icon_rules.h`
- [Text Formatting](https://github.com/edwardtfn/nspanel-easy/blob/main/components/nspanel_easy/text.cpp): `components/nspanel_easy/text.cpp`

### Entity Experiences

- [Home & Weather](https://github.com/edwardtfn/nspanel-easy/blob/main/components/nspanel_easy/page_home.cpp): `components/nspanel_easy/page_home.cpp`
- [Button Pages](https://github.com/edwardtfn/nspanel-easy/blob/main/components/nspanel_easy/page_buttons.cpp): `components/nspanel_easy/page_buttons.cpp`
- [Entity Pages](https://github.com/edwardtfn/nspanel-easy/blob/main/components/nspanel_easy/page_entities.h): `components/nspanel_easy/page_entities.h`
- [Climate Page](https://github.com/edwardtfn/nspanel-easy/blob/main/components/nspanel_easy/page_climate.cpp): `components/nspanel_easy/page_climate.cpp`
- [Cover Controls](https://github.com/edwardtfn/nspanel-easy/blob/main/components/nspanel_easy/page_cover.h): `components/nspanel_easy/page_cover.h`
- [Light Controls](https://github.com/edwardtfn/nspanel-easy/blob/main/components/nspanel_easy/page_light.cpp): `components/nspanel_easy/page_light.cpp`
- [Media Controls](https://github.com/edwardtfn/nspanel-easy/blob/main/components/nspanel_easy/page_media_player.h): `components/nspanel_easy/page_media_player.h`
- [Alarm Controls](https://github.com/edwardtfn/nspanel-easy/blob/main/components/nspanel_easy/page_alarm.h): `components/nspanel_easy/page_alarm.h`
- [Utilities Dashboard](https://github.com/edwardtfn/nspanel-easy/blob/main/components/nspanel_easy/page_utilities.h): `components/nspanel_easy/page_utilities.h`
- [Forecast Data](https://github.com/edwardtfn/nspanel-easy/blob/main/components/nspanel_easy/weather.h): `components/nspanel_easy/weather.h`

### Panel Hardware

- [Display Control](https://github.com/edwardtfn/nspanel-easy/blob/main/components/nspanel_easy/hw_display.cpp): `components/nspanel_easy/hw_display.cpp`
- [Climate Relay](https://github.com/edwardtfn/nspanel-easy/blob/main/components/nspanel_easy/addon_climate.cpp): `components/nspanel_easy/addon_climate.cpp`
- [Temperature Sensor](https://github.com/edwardtfn/nspanel-easy/blob/main/components/nspanel_easy/hw_temperature.cpp): `components/nspanel_easy/hw_temperature.cpp`
- [TFT Upload](https://github.com/edwardtfn/nspanel-easy/blob/main/components/nspanel_easy/addon_upload_tft.cpp): `components/nspanel_easy/addon_upload_tft.cpp`

### Other components

- **Home Assistant**

## Connections

- Home Assistant → HA Blueprint: provides configuration (evidence: `README.md`)
- HA Blueprint → ESPHome Firmware: configures (evidence: `README.md`)
- Home Assistant → Entity Subscriptions: sends entity updates
- Entity Subscriptions → Home & Weather: dispatches renders (evidence: `components/nspanel_easy/api_subscriptions.cpp`)
- Entity Subscriptions → Button Pages: dispatches renders (evidence: `components/nspanel_easy/api_subscriptions.cpp`)
- Entity Subscriptions → Climate Page: dispatches renders (evidence: `components/nspanel_easy/api_subscriptions.cpp`)
- Entity Snapshots → Entity Subscriptions: reads entity state (evidence: `components/nspanel_easy/entity_snapshot.cpp`)
- Home & Weather → Forecast Data: uses forecast
- Home & Weather → Nextion Components: renders on (evidence: `components/nspanel_easy/page_home.cpp`)
- Button Pages → Nextion Components: updates components (evidence: `components/nspanel_easy/page_buttons.cpp`)
- Climate Page → Page Navigation: uses navigation (evidence: `components/nspanel_easy/page_climate.cpp`)
- Climate Relay → Climate Page: supports thermostat
- Display Control → Page Navigation: manages display pages
- Temperature Sensor → Runtime State: uses runtime state (evidence: `components/nspanel_easy/hw_temperature.cpp`)
- Icon Rules → Entity Subscriptions: resolves icons (evidence: `components/nspanel_easy/api_subscriptions.cpp`)
- Button Pages → Text Formatting: wraps labels (evidence: `components/nspanel_easy/page_buttons.cpp`)
