SensorCube-Firmware/data/htdocs/index.html

67 lines
1.2 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>SensorCube</title>
<script type="text/javascript" src="utils.js"></script>
<script type="text/javascript">
function updateSensorTable(sensordata)
{
elements = ['temperature', 'humidity', 'co2'];
elements.forEach(function(item, index) {
elem = document.getElementById('scd30_' + item);
val = sensordata['scd30'][item];
elem.textContent = val.toFixed(2);
});
}
function setup()
{
getSensorData(updateSensorTable);
setInterval(function() { getSensorData(updateSensorTable) }, 60000);
}
</script>
<style>
th, td {
border: 1px solid black;
padding: 0.5em;
}
td.value {
text-align: right;
}
table {
border-collapse: collapse;
}
</style>
</head>
<body onLoad="setup()">
<h1>SensorCube</h1>
<table>
<tr>
<th>Sensor</th>
<th>Messwert</th>
<th>Einheit</th>
</tr>
<tr>
<td>SCD30 CO₂</td>
<td class="value" id="scd30_co2">----,--</td>
<td>ppm</td>
</tr>
<tr>
<td>SCD30 Temperatur</td>
<td class="value" id="scd30_temperature">-,--</td>
<td>°C</td>
</tr>
<tr>
<td>SCD30 Luftfeuchtigkeit</td>
<td class="value" id="scd30_humidity">-,--</td>
<td>%rH</td>
</tr>
</table>
</body>
</html>