# asmaklad/teleview architecture

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

- Interactive diagram: https://gitdiagram.com/asmaklad/teleview
- Repository: https://github.com/asmaklad/teleview

## Overview

TeleView is firmware for ESP32-Camera boards, principally letting users request and configure camera captures through Telegram, with a Wi-Fi configuration portal and optional web capture. The main control path is Telegram commands to camera/photo handling and delivery; web configuration and persistent settings form a parallel management path. README also documents motion alerts, time-lapse, deep sleep, SD saving, OLED/flash controls, and email. The main sketch and several feature paths were not excerpted, so their wiring is not asserted; dashed links mark documented but unverified integrations.

Main entry points: [`telegram_utils.h`](https://github.com/asmaklad/teleview/blob/master/telegram_utils.h) (Bot commands), [`TeleView.ino`](https://github.com/asmaklad/teleview/blob/master/TeleView.ino) (Camera capture), [`webPages.h`](https://github.com/asmaklad/teleview/blob/master/webPages.h) (Config portal), [`camera_pins.h`](https://github.com/asmaklad/teleview/blob/master/camera_pins.h) (Board pins)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_control["Telegram control"]
  node_telegram["Bot commands<br/>[telegram_utils.h]"]
  node_telegram_service["Telegram API"]
end

subgraph group_web["Web configuration"]
  node_web_ui["Config portal<br/>[webPages.h]"]
  node_web_capture["Web capture<br/>[webPages.h]"]
  node_wifi["Wi-Fi setup"]
end

subgraph group_device["Camera and board"]
  node_sketch["Device runtime<br/>[TeleView.ino]"]
  node_camera["Camera capture<br/>[TeleView.ino]"]
  node_camera_board["Board pins<br/>[camera_pins.h]"]
  node_motion["Motion detection<br/>[motionDetect.h]"]
  node_display["OLED display<br/>[display.h]"]
end

subgraph group_state["Settings and delivery"]
  node_settings["Configuration<br/>[persist.h]"]
  node_preferences[("Device preferences<br/>[persist.h]")]
  node_email["SMTP email"]
  node_sdcard[("SD card photos")]
end

node_operator(("Telegram user"))
node_local_user(("Local browser"))

node_operator -->|"sends commands"| node_telegram
node_telegram -->|"requests capture"| node_camera
node_telegram -->|"updates options"| node_settings
node_telegram -->|"sends photos"| node_telegram_service
node_camera -->|"uploads image"| node_telegram_service
node_sketch -.->|"handles bot"| node_telegram
node_sketch -.->|"starts portal"| node_web_ui
node_web_ui -->|"loads and saves"| node_settings
node_settings -->|"reads and writes"| node_preferences
node_local_user -->|"configures device"| node_web_ui
node_web_ui -.->|"configures network"| node_wifi
node_local_user -->|"requests image"| node_web_capture
node_web_capture -.->|"captures image"| node_camera
node_camera_board -.->|"defines pins"| node_camera
node_camera_board -.->|"enables PIR"| node_motion
node_motion -->|"samples frames"| node_camera
node_motion -.->|"triggers alerts"| node_telegram
node_camera_board -.->|"enables OLED"| node_display
node_telegram -.->|"controls display"| node_display
node_camera -.->|"saves photos"| node_sdcard
node_telegram -.->|"sends photo email"| node_email

click node_sketch "https://github.com/asmaklad/teleview/blob/master/TeleView.ino"
click node_telegram "https://github.com/asmaklad/teleview/blob/master/telegram_utils.h"
click node_camera "https://github.com/asmaklad/teleview/blob/master/TeleView.ino"
click node_camera_board "https://github.com/asmaklad/teleview/blob/master/camera_pins.h"
click node_motion "https://github.com/asmaklad/teleview/blob/master/motionDetect.h"
click node_display "https://github.com/asmaklad/teleview/blob/master/display.h"
click node_web_ui "https://github.com/asmaklad/teleview/blob/master/webPages.h"
click node_web_capture "https://github.com/asmaklad/teleview/blob/master/webPages.h"
click node_settings "https://github.com/asmaklad/teleview/blob/master/persist.h"
click node_preferences "https://github.com/asmaklad/teleview/blob/master/persist.h"

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_telegram,node_telegram_service,node_operator,node_local_user toneBlue
class node_web_ui,node_web_capture,node_wifi toneAmber
class node_sketch,node_camera,node_camera_board,node_motion,node_display toneMint
class node_settings,node_preferences,node_email,node_sdcard toneRose
```

## Components

### Telegram control

- [Bot commands](https://github.com/asmaklad/teleview/blob/master/telegram_utils.h): `telegram_utils.h`
- **Telegram API**

### Web configuration

- [Config portal](https://github.com/asmaklad/teleview/blob/master/webPages.h): `webPages.h`
- [Web capture](https://github.com/asmaklad/teleview/blob/master/webPages.h): `webPages.h`
- **Wi-Fi setup**

### Camera and board

- [Device runtime](https://github.com/asmaklad/teleview/blob/master/TeleView.ino): `TeleView.ino`
- [Camera capture](https://github.com/asmaklad/teleview/blob/master/TeleView.ino): `TeleView.ino`
- [Board pins](https://github.com/asmaklad/teleview/blob/master/camera_pins.h): `camera_pins.h`
- [Motion detection](https://github.com/asmaklad/teleview/blob/master/motionDetect.h): `motionDetect.h`
- [OLED display](https://github.com/asmaklad/teleview/blob/master/display.h): `display.h`

### Settings and delivery

- [Configuration](https://github.com/asmaklad/teleview/blob/master/persist.h): `persist.h`
- [Device preferences](https://github.com/asmaklad/teleview/blob/master/persist.h): `persist.h`
- **SMTP email**
- **SD card photos**

### Other components

- **Telegram user**
- **Local browser**

## Connections

- Telegram user → Bot commands: sends commands (evidence: `README.md`)
- Bot commands → Camera capture: requests capture (evidence: `telegram_utils.h`)
- Bot commands → Configuration: updates options (evidence: `telegram_utils.h`)
- Bot commands → Telegram API: sends photos (evidence: `telegram_utils.h`)
- Camera capture → Telegram API: uploads image
- Device runtime → Bot commands: handles bot
- Device runtime → Config portal: starts portal
- Config portal → Configuration: loads and saves (evidence: `webPages.h`)
- Configuration → Device preferences: reads and writes (evidence: `persist.h`)
- Local browser → Config portal: configures device (evidence: `README.md`)
- Config portal → Wi-Fi setup: configures network (evidence: `README.md`)
- Local browser → Web capture: requests image (evidence: `README.md`)
- Web capture → Camera capture: captures image
- Board pins → Camera capture: defines pins (evidence: `README.md`)
- Board pins → Motion detection: enables PIR (evidence: `README.md`)
- Motion detection → Camera capture: samples frames (evidence: `motionDetect.h`)
- Motion detection → Bot commands: triggers alerts
- Board pins → OLED display: enables OLED (evidence: `README.md`)
- Bot commands → OLED display: controls display
- Camera capture → SD card photos: saves photos (evidence: `README.md`)
- Bot commands → SMTP email: sends photo email (evidence: `README.md`)
