master^2
Varun 7 months ago
parent 5c037fdfef
commit 780d1f4178

@ -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');
@ -2895,7 +2894,7 @@ 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);
//this.publishMotorStopStatus(motorId, motorStopStatus);
reply.code(200).send({ message: "Motor started successfully." });
if (req.body.threshold_type === "time") {

Loading…
Cancel
Save