How flaviochaia/iot-estacionamento works
Smart Parking G3 monitors four parking spaces with an ESP32, stores live status and events, and presents occupancy, history, statistics, and gate controls in a web dashboard. The main workflow is sensor readings and device events → MQTT → FastAPI processing and Prisma persistence → REST dashboard; gate commands travel back through MQTT to the device. The repository also contains a separate, older backend in main.py and an MQTT simulator. Relationships for the main workflow are supported by source excerpts or README documentation; unsampled dashboard and schema internals are not inferred.
Main entry points: app/main.py FastAPI service · main.cpp ESP32 MQTT device · index.html Parking dashboard · main.py Legacy backend
Components 12
Parking device
- Sensors and rules
esp32/src/main.cpp - Gate and indicators
esp32/src/main.cpp - ESP32 MQTT device
esp32/src/main.cpp
Backend services
- FastAPI service
app/main.py - Legacy backend
main.py - Device simulator
scripts/simulate.py - REST endpoints
app/main.py
Persistence
- Parking data model
prisma/schema.prisma - SQLite database
Dashboard
- Parking dashboard
static/index.html
Other components
- Dashboard user
- MQTT broker
Connections 15
- Sensors and rules → ESP32 MQTT device: updates state
esp32/src/main.cpp - ESP32 MQTT device → Gate and indicators: drives
esp32/src/main.cpp - ESP32 MQTT device → MQTT broker: publishes status/events
README - MQTT broker → FastAPI service: delivers MQTT
README - FastAPI service → SQLite database: persists and queries
app/main.py - FastAPI service → Parking data model: uses data model
- FastAPI service → REST endpoints: serves
app/main.py - REST endpoints → Parking dashboard: supplies dashboard data
README - Dashboard user → Parking dashboard: views and controls
README - Parking dashboard → REST endpoints: requests API
- REST endpoints → MQTT broker: publishes gate command
app/main.py - MQTT broker → ESP32 MQTT device: delivers command
README - Device simulator → MQTT broker: publishes status/events
scripts/simulate.py - Legacy backend → MQTT broker: subscribes and publishes
main.py - Legacy backend → SQLite database: persists and queries
main.py