diff --git a/src/controllers/tanksController.js b/src/controllers/tanksController.js index 123d0dbb..1f92cff1 100644 --- a/src/controllers/tanksController.js +++ b/src/controllers/tanksController.js @@ -991,7 +991,8 @@ exports.motorAction = async (req, reply) => { // Start monitoring water level based on threshold percentage const intervalId = setInterval(async () => { // Check if water level has reached the threshold percentage - const current_water_level = parseInt(supplier_tank_info.water_level, 10); + const supplier_tank_info1 = await Tank.findOne({ customerId, tankName: req.body.from, tankLocation: req.body.from_type.toLowerCase() }); + const current_water_level = parseInt(supplier_tank_info1.waterlevel, 10); if (current_water_level <= supplier_threshold) { // Stop the motor pump await Tank.updateOne(