Refactor updatePumpFlow method to improve flow measurement validation and logging

This commit is contained in:
2025-09-22 13:59:21 +02:00
parent a34bf6ee1e
commit 3350eeb86a

View File

@@ -21,7 +21,13 @@ class liquidFlowHandler {
}
updatePumpFlow() {
this.flow = this.pump.measurements.type("flow").variant("measured").position("downstream").getCurrentValue() || 0;
const measuredFlow = this.pump.measurements.type("flow").variant("measured").position("downstream").getCurrentValue();
if (!measuredFlow) {
this.logger.warn(`Invalid flow value provided: ${measuredFlow}`);
this.flow = 0;
return;
}
this.flow = measuredFlow;
}
getOutput() {