master^2
Bhaskar 9 months ago
parent d8f8f0ed2f
commit a1f518fdf2

@ -2201,7 +2201,7 @@ console.log(fcmToken)
motorIntervals[motorId] = setTimeout(async () => { motorIntervals[motorId] = setTimeout(async () => {
try { try {
// Perform threshold time logic (e.g., notification, motor stop) // Perform threshold time logic (e.g., notification, motor stop)
console.log(`Threshold time of ${manualThresholdTime} minutes reached for motor ${motorId}`); console.log(`Threshold time of ${manual_threshold_time} minutes reached for motor ${motorId}`);
await Tank.updateOne( await Tank.updateOne(
{ customerId, "connections.inputConnections.motor_id": motorId }, { customerId, "connections.inputConnections.motor_id": motorId },
{ $set: { "connections.inputConnections.$.motor_stop_status": "1" } } { $set: { "connections.inputConnections.$.motor_stop_status": "1" } }
@ -2248,8 +2248,8 @@ console.log(fcmToken)
} }
); );
const startMessage = `Motor supplying water to '${tankName}' in block '${blockName}' started manually at ${startTime}.`; // const startMessage = `Motor supplying water to '${tankName}' in block '${blockName}' started manually at ${startTime}.`;
eventEmitter.emit('sendMotorStartNotification', fcmToken, startMessage); // eventEmitter.emit('sendMotorStartNotification', fcmToken, startMessage);
// Schedule threshold check // Schedule threshold check
// const thresholdTimeMs = manual_threshold_time * 60 * 1000; // const thresholdTimeMs = manual_threshold_time * 60 * 1000;
@ -2336,8 +2336,8 @@ console.log(fcmToken)
} }
); );
const stopMessage = `Motor supplying water to '${tankName}' in block '${blockName}' stopped manually at ${stopTime}.`; // const stopMessage = `Motor supplying water to '${tankName}' in block '${blockName}' stopped manually at ${stopTime}.`;
eventEmitter.emit('sendMotorStopNotification', fcmToken, stopMessage); // eventEmitter.emit('sendMotorStopNotification', fcmToken, stopMessage);
if (motorIntervals[motorId]) { if (motorIntervals[motorId]) {
clearTimeout(motorIntervals[motorId]); clearTimeout(motorIntervals[motorId]);

Loading…
Cancel
Save