Changed endpoints and db queries, chart now shows suggested mins and maxes

This commit is contained in:
Daniel Ledda
2020-11-07 16:32:40 +01:00
parent 286b272af5
commit 6dba158ff0

View File

@@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Ledda's Rooms Climate</title>
<title>Ledda's Room Climate</title>
<script src="/climate/static/Chart.bundle.min.js"></script>
</head>
<body>
@@ -134,14 +134,14 @@
removeExpiredData(chart, snapshot.time);
insertSnapshot(chart, snapshot);
}
}, 10 * 1000);
}, 30 * 1000);
}
function insertSnapshot(chart, snapshot) {
chart.data.datasets[0].data.push({x: snapshot.time, y: snapshot.humidity});
chart.data.datasets[1].data.push({x: snapshot.time, y: snapshot.temp});
chart.data.datasets[2].data.push({x: snapshot.time, y: snapshot.co2});
chart.update(0);
chart.update();
}
function removeExpiredData(chart, latestTime) {