modified: server.js

This commit is contained in:
IrisVega 2024-07-20 17:47:33 +08:00
parent 3d372000c8
commit c23b8b6675

View File

@ -61,17 +61,14 @@ function getLatestSensorData(callback) {
return;
}
const data = results[0];
const timestamps = results.map(row => new Date(row.timestamp).toISOString().slice(0, 19).replace('T', ' '));
const temperatures = results.map(row => row.temperature);
const humidities = results.map(row => row.humidity);
const co2 = results.map(row => row.co2);
const pressure = results.map(row => row.pressure);
callback({
timestamps,
temperatures,
humidities,
co2,
pressure
temperatures: data.temperature,
humidity: data.humidity,
co2: data.co2,
pressure: data.pressure,
timestamps
});
});
}