# iotmanagerproject/iotmanager architecture

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

- Interactive diagram: https://gitdiagram.com/iotmanagerproject/iotmanager
- Repository: https://github.com/iotmanagerproject/iotmanager

## Overview

IoTManager is ESP8266/ESP32 smart-home firmware: it connects peripherals to Wi-Fi, exposes local browser control and optional MQTT-based remote app control, and runs user-defined device scenarios. The graph preserves the documented sensor/actuator, display, and integration capabilities. Source excerpts show startup and scenario dependencies; several subsystem links are documented at product level because their implementation files were not sampled.

Main entry points: [`src/Main.cpp`](https://github.com/iotmanagerproject/iotmanager/blob/ver4stable/src/Main.cpp) (Firmware startup), [`src/MqttClient.cpp`](https://github.com/iotmanagerproject/iotmanager/blob/ver4stable/src/MqttClient.cpp) (MQTT client), [`src/classes/IoTScenario.cpp`](https://github.com/iotmanagerproject/iotmanager/blob/ver4stable/src/classes/IoTScenario.cpp) (Scenarios), [`src/classes/IoTItem.cpp`](https://github.com/iotmanagerproject/iotmanager/blob/ver4stable/src/classes/IoTItem.cpp) (Device items)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Firmware runtime"]
  node_main["Firmware startup<br/>[Main.cpp]"]
  node_global["Shared state<br/>[Global.h]"]
  node_scheduler["Periodic tasks<br/>[PeriodicTasks.cpp]"]
  node_config["Configuration"]
  node_filesystem[("Persistent files<br/>[EspFileSystem.cpp]")]
end

subgraph group_connectivity["Connectivity and control"]
  node_wifi["Wi-Fi connection<br/>[WiFiUtils.h]"]
  node_mqtt["MQTT client<br/>[MqttClient.cpp]"]
  node_web["Local web server<br/>[StandWebServer.cpp]"]
  node_websocket["WebSocket control<br/>[WsServer.cpp]"]
end

subgraph group_devices["Device logic"]
  node_items["Device items<br/>[IoTItem.cpp]"]
  node_scenarios["Scenarios<br/>[IoTScenario.cpp]"]
  node_sensors["Sensor modules"]
  node_executors["Actuator modules"]
end

subgraph group_extensions["Product extensions"]
  node_discovery["Home discovery<br/>[IoTDiscovery.cpp]"]
  node_displays["Display modules"]
  node_firmware["Firmware upgrade<br/>[UpgradeFirm.cpp]"]
  node_clock["Time service<br/>[NTP.cpp]"]
end

node_owner(("Home operator"))
node_app(("Mobile app"))
node_broker{{"MQTT broker"}}
node_peripherals{{"Peripherals"}}

node_owner -->|"connects"| node_peripherals
node_main -->|"initializes"| node_filesystem
node_main -->|"initializes"| node_web
node_main -->|"initializes"| node_websocket
node_main -->|"schedules"| node_scheduler
node_main -->|"owns"| node_scenarios
node_main -.->|"initializes"| node_config
node_main -.->|"connects"| node_wifi
node_wifi -->|"connects"| node_broker
node_app -->|"connects"| node_broker
node_app -->|"controls through"| node_mqtt
node_mqtt -->|"publishes and subscribes"| node_broker
node_owner -->|"controls locally"| node_web
node_peripherals -->|"provide readings"| node_sensors
node_executors -->|"controls"| node_peripherals
node_scenarios -->|"uses"| node_items
node_items -.->|"represents"| node_peripherals
node_scenarios -->|"reads and writes"| node_filesystem
node_mqtt -->|"uses"| node_discovery
node_displays -.->|"presents"| node_items
node_main -.->|"initializes"| node_clock
node_websocket -.->|"supports upgrade"| node_firmware

click node_main "https://github.com/iotmanagerproject/iotmanager/blob/ver4stable/src/Main.cpp"
click node_global "https://github.com/iotmanagerproject/iotmanager/blob/ver4stable/include/Global.h"
click node_scheduler "https://github.com/iotmanagerproject/iotmanager/blob/ver4stable/src/PeriodicTasks.cpp"
click node_config "https://github.com/iotmanagerproject/iotmanager/blob/ver4stable/src/ESPConfiguration.cpp"
click node_filesystem "https://github.com/iotmanagerproject/iotmanager/blob/ver4stable/src/EspFileSystem.cpp"
click node_wifi "https://github.com/iotmanagerproject/iotmanager/blob/ver4stable/include/utils/WiFiUtils.h"
click node_mqtt "https://github.com/iotmanagerproject/iotmanager/blob/ver4stable/src/MqttClient.cpp"
click node_web "https://github.com/iotmanagerproject/iotmanager/blob/ver4stable/src/StandWebServer.cpp"
click node_websocket "https://github.com/iotmanagerproject/iotmanager/blob/ver4stable/src/WsServer.cpp"
click node_items "https://github.com/iotmanagerproject/iotmanager/blob/ver4stable/src/classes/IoTItem.cpp"
click node_scenarios "https://github.com/iotmanagerproject/iotmanager/blob/ver4stable/src/classes/IoTScenario.cpp"
click node_sensors "https://github.com/iotmanagerproject/iotmanager/tree/ver4stable/src/modules/sensors"
click node_executors "https://github.com/iotmanagerproject/iotmanager/tree/ver4stable/src/modules/exec"
click node_discovery "https://github.com/iotmanagerproject/iotmanager/blob/ver4stable/src/classes/IoTDiscovery.cpp"
click node_displays "https://github.com/iotmanagerproject/iotmanager/tree/ver4stable/src/modules/display"
click node_firmware "https://github.com/iotmanagerproject/iotmanager/blob/ver4stable/src/UpgradeFirm.cpp"
click node_clock "https://github.com/iotmanagerproject/iotmanager/blob/ver4stable/src/NTP.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_main,node_global,node_scheduler,node_config,node_filesystem toneBlue
class node_wifi,node_mqtt,node_web,node_websocket toneAmber
class node_items,node_scenarios,node_sensors,node_executors toneMint
class node_discovery,node_displays,node_firmware,node_clock toneRose
class node_owner,node_app,node_broker,node_peripherals toneIndigo
```

## Components

### Firmware runtime

- [Firmware startup](https://github.com/iotmanagerproject/iotmanager/blob/ver4stable/src/Main.cpp): `src/Main.cpp`
- [Shared state](https://github.com/iotmanagerproject/iotmanager/blob/ver4stable/include/Global.h): `include/Global.h`
- [Periodic tasks](https://github.com/iotmanagerproject/iotmanager/blob/ver4stable/src/PeriodicTasks.cpp): `src/PeriodicTasks.cpp`
- [Configuration](https://github.com/iotmanagerproject/iotmanager/blob/ver4stable/src/ESPConfiguration.cpp): `src/ESPConfiguration.cpp`
- [Persistent files](https://github.com/iotmanagerproject/iotmanager/blob/ver4stable/src/EspFileSystem.cpp): `src/EspFileSystem.cpp`

### Connectivity and control

- [Wi-Fi connection](https://github.com/iotmanagerproject/iotmanager/blob/ver4stable/include/utils/WiFiUtils.h): `include/utils/WiFiUtils.h`
- [MQTT client](https://github.com/iotmanagerproject/iotmanager/blob/ver4stable/src/MqttClient.cpp): `src/MqttClient.cpp`
- [Local web server](https://github.com/iotmanagerproject/iotmanager/blob/ver4stable/src/StandWebServer.cpp): `src/StandWebServer.cpp`
- [WebSocket control](https://github.com/iotmanagerproject/iotmanager/blob/ver4stable/src/WsServer.cpp): `src/WsServer.cpp`

### Device logic

- [Device items](https://github.com/iotmanagerproject/iotmanager/blob/ver4stable/src/classes/IoTItem.cpp): `src/classes/IoTItem.cpp`
- [Scenarios](https://github.com/iotmanagerproject/iotmanager/blob/ver4stable/src/classes/IoTScenario.cpp): `src/classes/IoTScenario.cpp`
- [Sensor modules](https://github.com/iotmanagerproject/iotmanager/tree/ver4stable/src/modules/sensors): `src/modules/sensors`
- [Actuator modules](https://github.com/iotmanagerproject/iotmanager/tree/ver4stable/src/modules/exec): `src/modules/exec`

### Product extensions

- [Home discovery](https://github.com/iotmanagerproject/iotmanager/blob/ver4stable/src/classes/IoTDiscovery.cpp): `src/classes/IoTDiscovery.cpp`
- [Display modules](https://github.com/iotmanagerproject/iotmanager/tree/ver4stable/src/modules/display): `src/modules/display`
- [Firmware upgrade](https://github.com/iotmanagerproject/iotmanager/blob/ver4stable/src/UpgradeFirm.cpp): `src/UpgradeFirm.cpp`
- [Time service](https://github.com/iotmanagerproject/iotmanager/blob/ver4stable/src/NTP.cpp): `src/NTP.cpp`

### Other components

- **Home operator**
- **Mobile app**
- **MQTT broker**
- **Peripherals**

## Connections

- Home operator → Peripherals: connects
- Firmware startup → Persistent files: initializes (evidence: `src/Main.cpp`)
- Firmware startup → Local web server: initializes (evidence: `src/Main.cpp`)
- Firmware startup → WebSocket control: initializes (evidence: `src/Main.cpp`)
- Firmware startup → Periodic tasks: schedules (evidence: `src/Main.cpp`)
- Firmware startup → Scenarios: owns (evidence: `src/Main.cpp`)
- Firmware startup → Configuration: initializes
- Firmware startup → Wi-Fi connection: connects
- Wi-Fi connection → MQTT broker: connects
- Mobile app → MQTT broker: connects
- Mobile app → MQTT client: controls through
- MQTT client → MQTT broker: publishes and subscribes
- Home operator → Local web server: controls locally
- Peripherals → Sensor modules: provide readings
- Actuator modules → Peripherals: controls
- Scenarios → Device items: uses (evidence: `src/classes/IoTScenario.cpp`)
- Device items → Peripherals: represents
- Scenarios → Persistent files: reads and writes (evidence: `src/classes/IoTScenario.cpp`)
- MQTT client → Home discovery: uses (evidence: `src/MqttClient.cpp`)
- Display modules → Device items: presents
- Firmware startup → Time service: initializes
- WebSocket control → Firmware upgrade: supports upgrade
