|
|
@ -2945,14 +2945,6 @@ exports.motorAction = async (req, reply) => {
|
|
|
|
|
|
|
|
|
|
|
|
reply.code(200).send({ message: "Motor started successfully." });
|
|
|
|
reply.code(200).send({ message: "Motor started successfully." });
|
|
|
|
|
|
|
|
|
|
|
|
} else if (action === "stop") {
|
|
|
|
|
|
|
|
motorStopStatus = "1"; // If action is stop, set stop status to "1"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const totalWaterPumped = await calculateTotalPumpedWater(customerId, motorId, start_instance_id);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const lowWaterThreshold = 5; // Adjust as needed
|
|
|
|
const lowWaterThreshold = 5; // Adjust as needed
|
|
|
|
const thresholdTime = new Date(manual_threshold_time); // Convert threshold time
|
|
|
|
const thresholdTime = new Date(manual_threshold_time); // Convert threshold time
|
|
|
|
|
|
|
|
|
|
|
@ -2970,6 +2962,14 @@ exports.motorAction = async (req, reply) => {
|
|
|
|
|
|
|
|
|
|
|
|
console.log("Motor stopped");
|
|
|
|
console.log("Motor stopped");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else if (action === "stop") {
|
|
|
|
|
|
|
|
motorStopStatus = "1"; // If action is stop, set stop status to "1"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const totalWaterPumped = await calculateTotalPumpedWater(customerId, motorId, start_instance_id);
|
|
|
|
|
|
|
|
|
|
|
|
eventEmitter.emit("motorStop", customerId, fcmToken, tankName, blockName, stopTime, "Mobile APP", totalWaterPumped, typeOfWater, motorId,
|
|
|
|
eventEmitter.emit("motorStop", customerId, fcmToken, tankName, blockName, stopTime, "Mobile APP", totalWaterPumped, typeOfWater, motorId,
|
|
|
|
loggedInUser.phone,);
|
|
|
|
loggedInUser.phone,);
|
|
|
|
|
|
|
|
|
|
|
|