Simulation

The whole hardware path in software: ESP32, ESP server and backend, with the same messages and endpoints as the real ones. On sample data the dashboard reads this simulated hardware, so it looks just like a connected ESP32. On real-time data it runs while the real ESP32 is connected, and stays idle otherwise. The hardware simulation never talks to the real API; only the ML test data below writes to the real database.

Dashboard not open Open dashboard ↗

Dashboard data

Remote control: what the dashboard shows

Prediction scenario

The 6-hour history the Prediction page reads (data/prediction.json)

Plant condition

Changes the plant on the dashboard

Data flow

Each dot is a message on its way

Sensors BME280 Ā· fan Ā· valve
I²C · GPIO
ESP32 Fan off Ā· Valve closed
Serial
ESP server Polls /status every 3 s
POST /data
GET /status
Backend Fan off Ā· valve off
/api/sensor
/api/relay
Dashboard Not open
  • Readings
  • Status requests
  • Relay commands

ESP32

esp32.ino Ā· sends a reading every second

BME280 OK
Temperature–BME280
Humidity–BME280
Pressure–hPa
Fan relayGPIO 10
OFF
Valve relayGPIO 11
OFF
Sensor readings
BME280 connected
USB serial connected

Uptime – Ā· last line sent on serial

ESP server

server.py Ā· bridges the ESP32's serial port and the backend

Relay commands
POST/data 0 sent
—
GET/status every 3 s
—

Last command written to serial

—

Recent requests

    Backend

    Backend/app.py, simulated in this tab Ā· same endpoints and rules, never the real API

    connected: false

    Settings

    REQUIRE_DEVICE_KEY

    Like Weisen's script, the simulated ESP server sends no key, so turning this on makes POST /data fail with 401.

    Latest reading GET /api/sensor

    —

    Relays GET /api/relay

    —

    "connected" turns false 10 s after the last reading. Watering is capped at 600 s and the valve turns itself off when time is up.

    Requests

      Serial monitor

      ESP32 ⇄ ESP server at 115200 baud