updates
This commit is contained in:
@@ -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():
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user