The webserver is now using flask instead of python http server. This is

due to its incapability to easily render images or graphs.
The program now also uses a new class called 'Sensor' instead of a
very long for loop to correctly format the data from the json file.
Added LICENSE file
Added favicon
Added Flask HTML
This commit is contained in:
mia 2025-05-27 11:25:37 +02:00
parent 9a48f52845
commit 4c654ec969
13 changed files with 932 additions and 115 deletions

View file

@ -0,0 +1,34 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link
rel="shortcut icon"
href="{{ url_for('static', filename='favicon.ico') }}"
/>
<title>Sensor Data</title>
<style>
* {
font-family: "Caskaydia Cove NF";
font-size: 18px;
color: white;
background: #1c1c1c;
}
</style>
</head>
<body>
<h1>Sensor Readings</h1>
<h2>{% for sensor in data.items() %}</h2>
<h2>{{ sensor[1].getId() }}[{{ sensor[1].getType() }}]</h2>
<ul>
{% for key,value in sensor[1].getReadingsTimeDate().items() %}
<li>{{ key }}» {{ value }}{{ sensor[1].getUnit() }}</li>
{% endfor %}
<img
src="{{ url_for('static', filename='plots/' + sensor[1].getId() + '.png') }}"
alt="Graph"
/>
</ul>
{% endfor %}
</body>
</html>