Skip to main content
Goal: write a reading to a database table from firmware, then show it on the dashboard.

1. Create a table

In your product’s database, create a schema and a table — say readings with a temperature column. (You can also do this via the Database API.)

2. Insert from firmware

Use insertDatainDatabase, building the row with a lambda:
device.insertDatainDatabase(productId, deviceId, "readings", [](JsonObject &row) {
  row["temperature"] = readTemperature();
  row["humidity"]    = readHumidity();
});
Need the result? Use the …WithResponse variant:
DynamicJsonDocument res =
  device.insertDatainDatabaseWithResponse(productId, deviceId, "readings",
    [](JsonObject &row) { row["temperature"] = readTemperature(); });

3. Read it back

Fetch recent rows from firmware:
device.getDatabaseData(productId, "readings", 20);   // latest 20
Or display them on a dashboard with a Table or Dynamic Repeater widget bound to the table. The Script API’s db.query does the same client-side.
Update and delete are available too: updateDatabaseData(dataId, …) and deleteDatabaseData(dataId) (each with a …WithResponse form). See the API reference.

Next: publish & onboard

Ship it to users.