master^2
Bhaskar 8 months ago
parent 985e3c75df
commit 31b0a12068

@ -2945,15 +2945,7 @@ exports.motorAction = async (req, reply) => {
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
if (new Date() >= thresholdTime || currentWaterPercentage <= lowWaterThreshold) {
@ -2969,6 +2961,14 @@ exports.motorAction = async (req, reply) => {
}
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,
loggedInUser.phone,);

Loading…
Cancel
Save