How cb240002-create/esp32_mc_db works
This repository implements an ESP32 HVAC/SCADA monitor with a PHP web dashboard, HTTP endpoints, and MySQL-backed live readings and history. The main visible workflow is the dashboard issuing a COM1 relay command, which the endpoint validates and stores; the ESP32 reporting sensor and actuator state is also represented by an ingestion endpoint that updates live state and periodically records history. The dashboard excerpt shows live controls and chart/log features, but not all their requests. Device-to-server wiring is therefore unverified; the Arduino source is present in the tree but was not sampled.
Main entry points: database.php PDO connection · updateSCD40data_and_recordtable.php Reading ingestion · updateCOM1.php COM1 command · recordtable.php Audit log view
Components 13
Dashboard
- Web entry redirect
index.php - HVAC dashboard
home.php - Audit log view
recordtable.php
HTTP endpoints
- Live readings API
get_scd40_data.php - Legacy readings API
getdata.php - History API
gethistory.php - Reading ingestion
updateSCD40data_and_recordtable.php - Setpoint updates
updateSetpoints.php - COM1 command
updateCOM1.php
ESP32 firmware
- ESP32 firmware
ESP32_HVAC_SCD40/ESP32_HVAC_SCD40.ino
Persistence
- PDO connection
database.php - MySQL database
Other components
- Operator
Connections 19
- Operator → Web entry redirect: opens
- Web entry redirect → HVAC dashboard: redirects
index.php - HVAC dashboard → COM1 command: posts command
home.php - ESP32 firmware → Reading ingestion: reports readings
- Live readings API → PDO connection: opens connection
get_scd40_data.php - Legacy readings API → PDO connection: opens connection
getdata.php - History API → PDO connection: opens connection
gethistory.php - Reading ingestion → PDO connection: opens connection
updateSCD40data_and_recordtable.php - Setpoint updates → PDO connection: opens connection
updateSetpoints.php - COM1 command → PDO connection: opens connection
updateCOM1.php - Audit log view → PDO connection: opens connection
recordtable.php - PDO connection → MySQL database: connects to
database.php - Reading ingestion → MySQL database: updates and records
updateSCD40data_and_recordtable.php - Live readings API → MySQL database: reads live state
get_scd40_data.php - Legacy readings API → MySQL database: reads device state
getdata.php - History API → MySQL database: reads history
gethistory.php - Setpoint updates → MySQL database: writes setpoints
updateSetpoints.php - COM1 command → MySQL database: writes relay state
updateCOM1.php - Audit log view → MySQL database: reads audit records
recordtable.php