|
|
|
@ -1433,6 +1433,7 @@ eventEmitter.on(
|
|
|
|
|
const motorName = `${tankName}-${blockName}-${typeOfWater}`;
|
|
|
|
|
|
|
|
|
|
const message =
|
|
|
|
|
` MOTOR STARTED \n` +
|
|
|
|
|
`🚰 Motor Name: ${motorName}\n` +
|
|
|
|
|
`🚰 Tank Name: '${tankName}'\n` +
|
|
|
|
|
`🏢 Block Name: '${blockName}'\n` +
|
|
|
|
@ -1441,7 +1442,7 @@ eventEmitter.on(
|
|
|
|
|
`🕒 Pump started at: ${startTime} \n` +
|
|
|
|
|
`Will stop after: '${manual_threshold_time}' mins`;
|
|
|
|
|
|
|
|
|
|
await sendNotification(hw_Id, customerId, fcmTokens, "Arminta Water Management", message);
|
|
|
|
|
await sendNotification(hw_Id, customerId, fcmTokens, "Arminta", message);
|
|
|
|
|
} catch (error) {
|
|
|
|
|
console.error("Error in motorStart event:", error);
|
|
|
|
|
}
|
|
|
|
@ -1494,6 +1495,7 @@ eventEmitter.on(
|
|
|
|
|
const motorName = `${tankName}-${blockName}-${typeOfWater}`;
|
|
|
|
|
|
|
|
|
|
const message =
|
|
|
|
|
` MOTOR STOPPED \n` +
|
|
|
|
|
`🚰 Motor Name: ${motorName}\n` +
|
|
|
|
|
`🛢️ Tank Name: '${tankName}'\n` +
|
|
|
|
|
`🏢 Block Name: '${blockName}'\n` +
|
|
|
|
@ -1502,7 +1504,7 @@ eventEmitter.on(
|
|
|
|
|
`🕒 Pump stopped at: ${stopTime}\n` +
|
|
|
|
|
`💧 Total water pumped: ${totalWaterPumped} liters\n`;
|
|
|
|
|
|
|
|
|
|
await sendNotification(hw_Id, customerId, fcmTokens, "Arminta Water Management", message);
|
|
|
|
|
await sendNotification(hw_Id, customerId, fcmTokens, "Arminta", message);
|
|
|
|
|
} catch (error) {
|
|
|
|
|
console.error("Error in motorStop event:", error);
|
|
|
|
|
}
|
|
|
|
@ -1582,7 +1584,7 @@ eventEmitter.on('sendCriticalHighWaterNotification', async (fcmTokens, tankInfo,
|
|
|
|
|
|
|
|
|
|
eventEmitter.on('sendThresholdTimeNotification', async (customerId, fcmTokens, thresholdTime, hw_Id) => {
|
|
|
|
|
try {
|
|
|
|
|
const message = `Motor has reached its time threshold of ${thresholdTime} minutes and will stop.`;
|
|
|
|
|
const message = `Motor Stopped as it completed ${thresholdTime} minutes.`;
|
|
|
|
|
await sendNotification(hw_Id, customerId, fcmTokens, 'Motor Alert', message);
|
|
|
|
|
console.log("Threshold time notification sent successfully.");
|
|
|
|
|
} catch (error) {
|
|
|
|
|