Refactor updatePumpFlow method to improve flow measurement validation and logging
This commit is contained in:
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user