diff --git a/src/controllers/tanksController.js b/src/controllers/tanksController.js index d04ba32e..714c6375 100644 --- a/src/controllers/tanksController.js +++ b/src/controllers/tanksController.js @@ -6319,20 +6319,20 @@ client.on('message', async (topic, message) => { inputConnection.startTime = currentTime; // // Determine stop criteria dynamically - // const stopCriteria = inputConnection.motor_stop_status === "1" ? "manual" : "threshold"; - - // eventEmitter.emit( - // "sendMotorStartNotification", - // customerId, // Pass customerId - // fcmTokens, // Pass 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 - // stopCriteria, // Stop criteria (manual/threshold) - // manual_threshold_time // Threshold time (only used for threshold stop) - // ); + const stopCriteria = inputConnection.motor_stop_status === "1" ? "manual" : "threshold"; + + eventEmitter.emit( + "sendMotorStartNotification", + customerId, // Pass customerId + fcmTokens, // Pass 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 + stopCriteria, // Stop criteria (manual/threshold) + manual_threshold_time // Threshold time (only used for threshold stop) + ); } @@ -6341,16 +6341,16 @@ client.on('message', async (topic, message) => { inputConnection.motor_stop_status = "1"; inputConnection.stopTime = currentTime; - // eventEmitter.emit( - // "sendMotorStopNotification", - // customerId, // Pass customerId - // fcmTokens, // Pass FCM tokens - // hw_Id, // Motor ID - // inputConnection.water_level || 0, - // motorTank.blockName || "N/A", - // tankName, - // inputConnection.motor_on_type - // ); + eventEmitter.emit( + "sendMotorStopNotification", + customerId, // Pass customerId + fcmTokens, // Pass FCM tokens + hw_Id, // Motor ID + inputConnection.water_level || 0, + motorTank.blockName || "N/A", + tankName, + inputConnection.motor_on_type + ); } await motorTank.save();