|
|
|
|
@ -1715,10 +1715,10 @@ eventEmitter.on(
|
|
|
|
|
const message =
|
|
|
|
|
`🚰 Motor Name: ${motorName}\n` +
|
|
|
|
|
`🚰 Tank Name: '${tankName}'\n` +
|
|
|
|
|
`🚰 Block Name: '${blockName}'\n` +
|
|
|
|
|
`🏢 Block Name: '${blockName}'\n` +
|
|
|
|
|
`👤 Started by: ${userNames}\n` +
|
|
|
|
|
`📱 Mode: '${startMethod}'\n` +
|
|
|
|
|
`🕒 Pump started at: ${startTime} (Time: ${formattedTime} on ${formattedDate})\n` +
|
|
|
|
|
`🕒 Pump started at: ${startTime} \n` +
|
|
|
|
|
`Will stop after: '${manual_threshold_time}' mins`;
|
|
|
|
|
|
|
|
|
|
// Send the notification
|
|
|
|
|
@ -1751,11 +1751,11 @@ eventEmitter.on(
|
|
|
|
|
// Prepare the message
|
|
|
|
|
const message =
|
|
|
|
|
`🚰 Motor Name: ${motorName}\n` +
|
|
|
|
|
`🚰 Tank Name: '${tankName}'\n` +
|
|
|
|
|
`🚰 Block Name: '${blockName}'\n` +
|
|
|
|
|
`🛢️ Tank Name: '${tankName}'\n` +
|
|
|
|
|
`🏢 Block Name: '${blockName}'\n` +
|
|
|
|
|
`👤 Stopped by: ${userNames}\n` +
|
|
|
|
|
`📱 Mode: '${stopMethod}'\n` +
|
|
|
|
|
`🕒 Pump stopped at: ${stopTime} (Time: ${formattedTime} on ${formattedDate})\n` +
|
|
|
|
|
`🕒 Pump stopped at: ${stopTime}\n` +
|
|
|
|
|
`💧 Total water pumped: ${totalWaterPumped} liters\n`; // Ensure this line is properly terminated
|
|
|
|
|
|
|
|
|
|
// Send the notification
|
|
|
|
|
@ -1789,11 +1789,11 @@ eventEmitter.on(
|
|
|
|
|
// Prepare the message
|
|
|
|
|
const message =
|
|
|
|
|
`🚰 Motor Name: ${motorName}\n` +
|
|
|
|
|
`🚰 Tank Name: '${tankName}'\n` +
|
|
|
|
|
`🚰 Block Name: '${blockName}'\n` +
|
|
|
|
|
`🛢️ Tank Name: '${tankName}'\n` +
|
|
|
|
|
`🏢 Block Name: '${blockName}'\n` +
|
|
|
|
|
`👤 Started by: '${startMethod}' \n` +
|
|
|
|
|
`📱 Mode: "Atomatic System" \n` +
|
|
|
|
|
`🕒 Pump started at: ${startTime} (Time: ${formattedTime} on ${formattedDate})\n` +
|
|
|
|
|
`🕒 Pump started at: ${startTime} \n` +
|
|
|
|
|
`Will stop after: '${threshold}' `;
|
|
|
|
|
|
|
|
|
|
// Send the notification
|
|
|
|
|
@ -1975,11 +1975,11 @@ eventEmitter.on(
|
|
|
|
|
// Prepare the notification message
|
|
|
|
|
const message =
|
|
|
|
|
`🚰 Motor Name: ${motorName}\n` +
|
|
|
|
|
`🚰 Tank Name: '${tankName}'\n` +
|
|
|
|
|
`🛢️ Tank Name: '${tankName}'\n` +
|
|
|
|
|
`🏢 Block Name: '${blockName}'\n` +
|
|
|
|
|
`👤 Started by: ${userNames}\n` +
|
|
|
|
|
`📱 Mode: '${startMethod}'\n` +
|
|
|
|
|
`🕒 Pump started at: ${startTime} (Time: ${formattedTime} on ${formattedDate})\n` +
|
|
|
|
|
`🕒 Pump started at: ${startTime} \n` +
|
|
|
|
|
stopConditionMessage; // Add only the relevant stop condition
|
|
|
|
|
|
|
|
|
|
// Send the notification
|
|
|
|
|
@ -2098,10 +2098,10 @@ eventEmitter.on(
|
|
|
|
|
// Prepare the notification message
|
|
|
|
|
const message =
|
|
|
|
|
`🚰 Motor Name: ${motorName}\n` +
|
|
|
|
|
`🚰 Tank Name: '${tankName}'\n` +
|
|
|
|
|
`🛢️ Tank Name: '${tankName}'\n` +
|
|
|
|
|
`🏢 Block Name: '${blockName}'\n` +
|
|
|
|
|
`📱 Mode: '${stopMethod}'\n` +
|
|
|
|
|
`🕒 Pump stopped at: ${stopTime} (Time: ${formattedTime} on ${formattedDate})\n` +
|
|
|
|
|
`🕒 Pump stopped at: ${stopTime}\n` +
|
|
|
|
|
stopConditionMessage;
|
|
|
|
|
|
|
|
|
|
// Send the notification
|
|
|
|
|
@ -2683,7 +2683,7 @@ const monitorWaterLevels = async () => {
|
|
|
|
|
const tankLocation = tank.tankLocation; // Assuming tank has a 'location' field
|
|
|
|
|
|
|
|
|
|
// Call the function to check water levels and send notifications
|
|
|
|
|
await checkWaterLevelsAndNotify(customerId, tankName, tankLocation, fcmTokens);
|
|
|
|
|
//await checkWaterLevelsAndNotify(customerId, tankName, tankLocation, fcmTokens);
|
|
|
|
|
} else {
|
|
|
|
|
//console.log(`No FCM tokens found for customerId ${tank.customerId}`);
|
|
|
|
|
}
|
|
|
|
|
@ -3799,9 +3799,9 @@ const motorActionAuto = async (req, reply) => {
|
|
|
|
|
|
|
|
|
|
const stopMessage =
|
|
|
|
|
`🚰 Motor Name: ${tankName}-${blockName}-${typeOfWater}\n` +
|
|
|
|
|
`🚰 Tank Name: '${tankName}'\n` +
|
|
|
|
|
`🚰 Block Name: '${blockName}'\n` +
|
|
|
|
|
`🕒 Pump stopped at: ${stopTime} (Time: ${formattedTime} on ${formattedDate})\n` +
|
|
|
|
|
`🛢️ Tank Name: '${tankName}'\n` +
|
|
|
|
|
`🏢 Block Name: '${blockName}'\n` +
|
|
|
|
|
`🕒 Pump stopped at: ${stopTime}\n` +
|
|
|
|
|
`⏳ Operation Duration: ${threshold} `;
|
|
|
|
|
|
|
|
|
|
// Send stop notification
|
|
|
|
|
|