|
|
@ -2953,23 +2953,6 @@ exports.motorAction = async (req, reply) => {
|
|
|
|
|
|
|
|
|
|
|
|
const totalWaterPumped = await calculateTotalPumpedWater(customerId, motorId, start_instance_id);
|
|
|
|
const totalWaterPumped = await calculateTotalPumpedWater(customerId, motorId, start_instance_id);
|
|
|
|
|
|
|
|
|
|
|
|
const lowWaterThreshold = 5; // Adjust as needed
|
|
|
|
|
|
|
|
const thresholdTime = new Date(manual_threshold_time); // Convert threshold time
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (new Date() >= thresholdTime || currentWaterPercentage <= lowWaterThreshold) {
|
|
|
|
|
|
|
|
console.log("Motor stopping because it entered this condition");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
eventEmitter.emit(
|
|
|
|
|
|
|
|
"sendThresholdTimeNotification",
|
|
|
|
|
|
|
|
customerId,
|
|
|
|
|
|
|
|
fcmToken,
|
|
|
|
|
|
|
|
manual_threshold_time,
|
|
|
|
|
|
|
|
motorId
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
console.log("Motor stopped");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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,);
|
|
|
|
|
|
|
|
|
|
|
|