|
|
|
@ -2868,18 +2868,17 @@ exports.motorAction = async (req, reply) => {
|
|
|
|
|
if (action === "start") {
|
|
|
|
|
|
|
|
|
|
if (motorIntervals[motorId]) {
|
|
|
|
|
console.log(`🛑 Clearing interval for motorId: ${motorId}`);
|
|
|
|
|
console.log(`🛑 Clearing old interval for motorId: ${motorId}`);
|
|
|
|
|
clearInterval(motorIntervals[motorId]);
|
|
|
|
|
delete motorIntervals[motorId];
|
|
|
|
|
|
|
|
|
|
// Confirm deletion
|
|
|
|
|
if (!motorIntervals[motorId]) {
|
|
|
|
|
console.log(`✅ Interval for motorId: ${motorId} successfully deleted.`);
|
|
|
|
|
console.log(`✅ Old interval successfully deleted.`);
|
|
|
|
|
} else {
|
|
|
|
|
console.error(`❌ Failed to delete interval for motorId: ${motorId}`);
|
|
|
|
|
console.error(`❌ Failed to delete old interval.`);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const startTime = moment().tz('Asia/Kolkata').format('DD-MMM-YYYY - HH:mm');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -2894,8 +2893,8 @@ exports.motorAction = async (req, reply) => {
|
|
|
|
|
}}
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
eventEmitter.emit("motorStart", customerId, fcmToken, tankName, blockName, startTime, "Mobile APP", manual_threshold_time, typeOfWater, motorId, loggedInUser.phone);
|
|
|
|
|
this.publishMotorStopStatus(motorId, motorStopStatus);
|
|
|
|
|
eventEmitter.emit("motorStart", customerId, fcmToken, tankName, blockName, startTime, "Mobile APP", manual_threshold_time, typeOfWater, motorId, loggedInUser.phone);
|
|
|
|
|
//this.publishMotorStopStatus(motorId, motorStopStatus);
|
|
|
|
|
reply.code(200).send({ message: "Motor started successfully." });
|
|
|
|
|
|
|
|
|
|
if (req.body.threshold_type === "time") {
|
|
|
|
|