Changes for monitor pages fix
This commit is contained in:
parent
9ad18a17c8
commit
743aeee130
3
main.py
3
main.py
|
|
@ -296,7 +296,8 @@ async def update_latest_data():
|
||||||
|
|
||||||
@app.get("/monitor")
|
@app.get("/monitor")
|
||||||
async def get_monitor_data():
|
async def get_monitor_data():
|
||||||
return JSONResponse(content=latest_data)
|
return latest_data
|
||||||
|
# return JSONResponse(content=latest_data)
|
||||||
|
|
||||||
|
|
||||||
# LOCAL RECORDER
|
# LOCAL RECORDER
|
||||||
|
|
|
||||||
|
|
@ -532,14 +532,6 @@
|
||||||
const dataResponse = await fetch('/monitor');
|
const dataResponse = await fetch('/monitor');
|
||||||
const allData = await dataResponse.json();
|
const allData = await dataResponse.json();
|
||||||
|
|
||||||
// Update Tank Level and Qconso
|
|
||||||
const dsData = allData["DS"];
|
|
||||||
if (dsData) {
|
|
||||||
document.querySelector("#TankLevel .monitor-value").innerHTML = `DS<br>${dsData.TankLevel.toFixed(1)}`;
|
|
||||||
const qconso = dsData.Qinlet - dsData.Qoutlet;
|
|
||||||
document.querySelector("#Qconso .monitor-value").innerHTML = `DS<br>${qconso.toFixed(1)} L/h`;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const [fieldId, unit] of Object.entries(fields)) {
|
for (const [fieldId, unit] of Object.entries(fields)) {
|
||||||
const container = document.getElementById(fieldId);
|
const container = document.getElementById(fieldId);
|
||||||
if (!container) continue;
|
if (!container) continue;
|
||||||
|
|
@ -552,6 +544,15 @@
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Update Tank Level and Qconso
|
||||||
|
const dsData = allData["DS"];
|
||||||
|
if (dsData) {
|
||||||
|
document.querySelector("#TankLevel .monitor-value").innerHTML = `DS<br>${dsData.TankLevel.toFixed(1)}`;
|
||||||
|
const qconso = dsData.Qinlet - dsData.Qoutlet;
|
||||||
|
document.querySelector("#Qconso .monitor-value").innerHTML = `DS<br>${qconso.toFixed(1)} L/h`;
|
||||||
|
}
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error fetching monitor data:', error);
|
console.error('Error fetching monitor data:', error);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user