From 304893ed3cf418dfd167497c103cc12c581d5f2d Mon Sep 17 00:00:00 2001 From: varun Date: Fri, 17 May 2024 06:08:41 -0400 Subject: [PATCH] change in iotdata if tank not found for tankhardwareId4 --- src/controllers/tanksController.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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(