|
|
|
|
@ -3036,13 +3036,13 @@ const checkWaterLevel = async (customerId, motorId, fcmToken, receiverTank) => {
|
|
|
|
|
|
|
|
|
|
// Check for low water levels
|
|
|
|
|
if (currentWaterPercentage <= 20 && !notificationSentStatus.lowWater) {
|
|
|
|
|
eventEmitter.emit('sendLowWaterNotification', fcmToken, `Water level has dropped below 20%.`);
|
|
|
|
|
// eventEmitter.emit('sendLowWaterNotification', fcmToken, `Water level has dropped below 20%.`);
|
|
|
|
|
notificationSentStatus.lowWater = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Check for critically low water levels
|
|
|
|
|
if (currentWaterPercentage <= 10 && !notificationSentStatus.criticallyLowWater) {
|
|
|
|
|
eventEmitter.emit('sendCriticalLowWaterNotification', fcmToken, `Water level has dropped below 10%.`);
|
|
|
|
|
// eventEmitter.emit('sendCriticalLowWaterNotification', fcmToken, `Water level has dropped below 10%.`);
|
|
|
|
|
notificationSentStatus.criticallyLowWater = true;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|