master^2
Bhaskar 8 months ago
parent a33ed0f743
commit a600c9c3b0

@ -1433,6 +1433,7 @@ eventEmitter.on(
const motorName = `${tankName}-${blockName}-${typeOfWater}`; const motorName = `${tankName}-${blockName}-${typeOfWater}`;
const message = const message =
` MOTOR STARTED \n` +
`🚰 Motor Name: ${motorName}\n` + `🚰 Motor Name: ${motorName}\n` +
`🚰 Tank Name: '${tankName}'\n` + `🚰 Tank Name: '${tankName}'\n` +
`🏢 Block Name: '${blockName}'\n` + `🏢 Block Name: '${blockName}'\n` +
@ -1441,7 +1442,7 @@ eventEmitter.on(
`🕒 Pump started at: ${startTime} \n` + `🕒 Pump started at: ${startTime} \n` +
`Will stop after: '${manual_threshold_time}' mins`; `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) { } catch (error) {
console.error("Error in motorStart event:", error); console.error("Error in motorStart event:", error);
} }
@ -1494,6 +1495,7 @@ eventEmitter.on(
const motorName = `${tankName}-${blockName}-${typeOfWater}`; const motorName = `${tankName}-${blockName}-${typeOfWater}`;
const message = const message =
` MOTOR STOPPED \n` +
`🚰 Motor Name: ${motorName}\n` + `🚰 Motor Name: ${motorName}\n` +
`🛢️ Tank Name: '${tankName}'\n` + `🛢️ Tank Name: '${tankName}'\n` +
`🏢 Block Name: '${blockName}'\n` + `🏢 Block Name: '${blockName}'\n` +
@ -1502,7 +1504,7 @@ eventEmitter.on(
`🕒 Pump stopped at: ${stopTime}\n` + `🕒 Pump stopped at: ${stopTime}\n` +
`💧 Total water pumped: ${totalWaterPumped} liters\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) { } catch (error) {
console.error("Error in motorStop event:", 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) => { eventEmitter.on('sendThresholdTimeNotification', async (customerId, fcmTokens, thresholdTime, hw_Id) => {
try { 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); await sendNotification(hw_Id, customerId, fcmTokens, 'Motor Alert', message);
console.log("Threshold time notification sent successfully."); console.log("Threshold time notification sent successfully.");
} catch (error) { } catch (error) {

Loading…
Cancel
Save