73 lines
1.9 KiB
Markdown
73 lines
1.9 KiB
Markdown
# Financial Aggregator
|
|
|
|
MQTT aggregation server for ESP32 financial dashboards.
|
|
|
|
## Project Structure
|
|
|
|
```
|
|
financial-aggregator/
|
|
├── server/
|
|
│ ├── docker-compose.yml # Main deployment file
|
|
│ ├── caddy/
|
|
│ │ └── Caddyfile # TLS/reverse proxy config
|
|
│ ├── mosquitto/
|
|
│ │ ├── mosquitto.conf # MQTT broker config
|
|
│ │ └── passwd # MQTT credentials (create with mosquitto_passwd)
|
|
│ └── aggregator/
|
|
│ ├── Dockerfile
|
|
│ ├── aggregator.py # Python price fetcher
|
|
│ └── .env # Environment config
|
|
└── firmware/
|
|
├── platformio.ini # ESP32 firmware config
|
|
├── src/
|
|
│ ├── mqtt_module.h
|
|
│ └── mqtt_module.cpp
|
|
└── MQTT_INTEGRATION.md # Integration instructions
|
|
```
|
|
|
|
## Benefits
|
|
|
|
| Metric | Before | After | Improvement |
|
|
|--------|--------|-------|-------------|
|
|
| API calls per refresh | 100+ | 5 | 95% reduction |
|
|
| Data per device | ~50KB | ~2KB | 25x smaller |
|
|
| Devices supported | ~20 | 200+ | 10x scaling |
|
|
| TLS encryption | Per device | Centralized | Simpler certs |
|
|
|
|
## Quick Deploy
|
|
|
|
```bash
|
|
cd server
|
|
|
|
# Configure
|
|
cp aggregator/.env.example aggregator/.env
|
|
nano aggregator/.env
|
|
|
|
# Create MQTT password
|
|
docker run --rm -v $(pwd)/mosquitto:/mosquitto eclipse-mosquitto:2 \
|
|
mosquitto_passwd -c /mosquitto/passwd esp32
|
|
|
|
# Update Caddyfile with your domain
|
|
nano caddy/Caddyfile
|
|
|
|
# Deploy
|
|
docker compose up -d
|
|
```
|
|
|
|
## Documentation
|
|
|
|
- [DEPLOYMENT.md](server/DEPLOYMENT.md) - Full deployment guide
|
|
- [MQTT_INTEGRATION.md](firmware/MQTT_INTEGRATION.md) - ESP32 firmware changes
|
|
|
|
## Requirements
|
|
|
|
### Server
|
|
- Debian 12 VM
|
|
- 1 CPU, 1GB RAM, 10GB disk
|
|
- Domain with DNS pointing to VM
|
|
- Ports 80, 443, 1883, 9001
|
|
|
|
### Firmware
|
|
- ESP32-S3 with PSRAM
|
|
- PlatformIO project
|
|
- WiFi connection
|