From 81d6a97e7f88b689e295d488cfe176fd13ea64bc Mon Sep 17 00:00:00 2001 From: Varun Date: Thu, 16 Jan 2025 10:11:01 +0530 Subject: [PATCH 1/3] added physical motor start to mqtt sub data --- src/controllers/tanksController.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/controllers/tanksController.js b/src/controllers/tanksController.js index cb0027be..0aae2cee 100644 --- a/src/controllers/tanksController.js +++ b/src/controllers/tanksController.js @@ -4828,6 +4828,15 @@ client.on('message', async (topic, message) => { const inputConnection = motorTank.connections.inputConnections.find(conn => conn.motor_id === hw_Id); // Updated variable name if (inputConnection) { inputConnection.motor_status = status; // Update motor status + if (inputConnection.motor_stop_status === "1" && status === "2" && inputConnection.motor_on_type !== "forced_manual") { + inputConnection.motor_stop_status = "2"; + inputConnection.motor_on_type = "forced_manual"; + } + + if (inputConnection.motor_stop_status === "2" && status === "1") { + inputConnection.motor_stop_status = "1"; + } + await motorTank.save(); // Save the updated tank } From 587dabdf9f2f84defae5da9514acd22e82dd8a43 Mon Sep 17 00:00:00 2001 From: Varun Date: Thu, 16 Jan 2025 10:16:30 +0530 Subject: [PATCH 2/3] changes in water level updating when tank height received is zero --- src/controllers/tanksController.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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(); From 40eae962e0ad030f52bd84758b5a75397b7342fc Mon Sep 17 00:00:00 2001 From: Varun Date: Thu, 16 Jan 2025 10:18:29 +0530 Subject: [PATCH 3/3] changes --- src/controllers/tanksController.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/controllers/tanksController.js b/src/controllers/tanksController.js index 376385a3..49d74bb5 100644 --- a/src/controllers/tanksController.js +++ b/src/controllers/tanksController.js @@ -4796,6 +4796,7 @@ client.on('message', async (topic, message) => { const waterLevel = parseInt(waterLevelHeight * waterCapacityPerCm, 10); // Calculated water level // Update water level in the existing tank + console.log(tankHeight,"this is located in tank controllers at iot-data mqtt sub ") if (tankHeight>0 && waterLevel >= 0) { existingTank.waterlevel = waterLevel; await existingTank.save();