diff --git a/src/controllers/tanksController.js b/src/controllers/tanksController.js index c244ba51..414a2ba4 100644 --- a/src/controllers/tanksController.js +++ b/src/controllers/tanksController.js @@ -5696,45 +5696,17 @@ 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 - - const tankName = motorTank.tankName; - console.log(tankName,"tankName") if (inputConnection.motor_stop_status === "1" && status === 2 && inputConnection.motor_on_type !== "forced_manual") { - const currentTime = moment().tz('Asia/Kolkata').format('DD-MMM-YYYY - HH:mm'); inputConnection.motor_stop_status = "2"; inputConnection.motor_on_type = "forced_manual"; inputConnection.startTime = currentTime; - // Emit motor start notification with tankName - // eventEmitter.emit( - // "sendMotorStartNotification", - // fcmToken, // FCM tokens - // hw_Id, // Motor ID - // inputConnection.water_level || 0, // Water level - // motorTank.blockName || "N/A", // Block name - // tankName, // Tank name - // inputConnection.motor_on_type, // Motor on type - // "threshold", // Stop criteria - // manual_threshold_time // Threshold time in mins - // ); - } if (inputConnection.motor_stop_status === "2" && status === 1) { - inputConnection.motor_stop_status = "1"; const currentTime = moment().tz('Asia/Kolkata').format('DD-MMM-YYYY - HH:mm'); - inputConnection.stoptTime = currentTime; - - // Emit motor stop notification with tankName - // eventEmitter.emit( - // "sendMotorStopNotification", - // fcmToken, // FCM tokens - // hw_Id, // Motor ID - // inputConnection.water_level || 0, // Water level - // motorTank.blockName || "N/A", // Block name - // tankName, // Tank name - // inputConnection.motor_on_type // Motor on type - // ); + inputConnection.motor_stop_status = "1"; + inputConnection.stopTime = currentTime; } await motorTank.save(); // Save the updated tank