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