diff --git a/src/controllers/tanksController.js b/src/controllers/tanksController.js index 0aae2cee..376385a3 100644 --- a/src/controllers/tanksController.js +++ b/src/controllers/tanksController.js @@ -4796,7 +4796,7 @@ client.on('message', async (topic, message) => { const waterLevel = parseInt(waterLevelHeight * waterCapacityPerCm, 10); // Calculated water level // Update water level in the existing tank - if (waterLevel >= 0) { + if (tankHeight>0 && waterLevel >= 0) { existingTank.waterlevel = waterLevel; await existingTank.save();