Changes for monitor pages fix

This commit is contained in:
aniketSaha 2025-08-06 11:52:40 +02:00
parent 9ad18a17c8
commit 743aeee130
2 changed files with 11 additions and 9 deletions

View File

@ -296,7 +296,8 @@ async def update_latest_data():
@app.get("/monitor")
async def get_monitor_data():
return JSONResponse(content=latest_data)
return latest_data
# return JSONResponse(content=latest_data)
# LOCAL RECORDER

View File

@ -532,14 +532,6 @@
const dataResponse = await fetch('/monitor');
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)) {
const container = document.getElementById(fieldId);
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) {
console.error('Error fetching monitor data:', error);
}