This commit is contained in:
2024-05-05 21:27:17 +02:00
parent c3b6952017
commit 8acb6bfaf1
5 changed files with 79 additions and 48 deletions
+3 -6
View File
@@ -58,17 +58,14 @@ def dashboard():
def history():
data = fetch_all_sensor()
disp_data = []
sensors_name = []
for mac, name in data:
disp_data += [fetch_data_by_sensor(name)]
sensors_name.append[name]
""" S1 = fetch_data_by_sensor("DEMO1")
S2 = fetch_data_by_sensor("DEMO2")
S3 = fetch_data_by_sensor("DEMO3") """
return render_template('history.html', S1=disp_data[0], S2=disp_data[1], S3=disp_data[2])
return render_template('history.html', S1=disp_data[0], S2=disp_data[1], S3=disp_data[2], sensor=sensors_name)
@app.route('/adm', methods=['GET'])
def admin():
+2 -1
View File
@@ -13,13 +13,14 @@ def BltDataScrap():
#print("Begin device scan")
devices = scanner.scan(timeout=3.0)
for device in devices:
if device.addr in SENSORS :
if device.addr in sensor_dict :
#print(
#f"Device found {device.addr} ({device.addrType}), "
#f"RSSI={device.rssi} dB"
#)
for adtype, description, value in device.getScanData():
if adtype == 22:
#print(value)
temp = int(value[24:28], 16) / 100
HR = int(value[28:32], 16) / 100
Bat = int(value[20:22], 16)
+3 -3
View File
@@ -60,7 +60,7 @@ tr:hover {
<a href="/adm" class="btn">Admin</a>
</div>
<h1>Database Contents</h1>
<h2>Sensor 1</h2>
<h2>{{ sensor[0] }}</h2>
<table border="1">
<tr>
<th>Id</th>
@@ -81,7 +81,7 @@ tr:hover {
</tr>
{% endfor %}
</table>
<h2>Sensor 2</h2>
<h2>{{ sensor[1] }}</h2>
<table border="1">
<tr>
<th>Id</th>
@@ -102,7 +102,7 @@ tr:hover {
</tr>
{% endfor %}
</table>
<h2>Sensor 3</h2>
<h2>{{ sensor[2] }}</h2>
<table border="1">
<tr>
<th>Id</th>
+1 -1
View File
@@ -98,7 +98,7 @@
Plotly.newPlot('graph_hr', HR_graphData.data, HR_graphData.layout);
</script>
<script>
// Refresh the page every 10 seconds
// Refresh the page every 20 seconds
setTimeout(function(){
location.reload();
}, 20000);