master^2
Bhaskar 7 months ago
parent c0d38cb06d
commit 40ac93a540

@ -6318,21 +6318,21 @@ client.on('message', async (topic, message) => {
inputConnection.motor_on_type = "forced_manual";
inputConnection.startTime = currentTime;
// Determine stop criteria dynamically
const stopCriteria = inputConnection.motor_stop_status === "1" ? "manual" : "threshold";
eventEmitter.emit(
"sendMotorStartNotification",
customerId, // Pass customerId
fcmTokens, // Pass FCM tokens
hw_Id, // Motor ID
inputConnection.water_level || 0, // Water level
motorTank.blockName || "N/A", // Block name
tankName, // Tank name
inputConnection.motor_on_type, // Motor on type
stopCriteria, // Stop criteria (manual/threshold)
manual_threshold_time // Threshold time (only used for threshold stop)
);
// // Determine stop criteria dynamically
// const stopCriteria = inputConnection.motor_stop_status === "1" ? "manual" : "threshold";
// eventEmitter.emit(
// "sendMotorStartNotification",
// customerId, // Pass customerId
// fcmTokens, // Pass FCM tokens
// hw_Id, // Motor ID
// inputConnection.water_level || 0, // Water level
// motorTank.blockName || "N/A", // Block name
// tankName, // Tank name
// inputConnection.motor_on_type, // Motor on type
// stopCriteria, // Stop criteria (manual/threshold)
// manual_threshold_time // Threshold time (only used for threshold stop)
// );
}
@ -6341,16 +6341,16 @@ client.on('message', async (topic, message) => {
inputConnection.motor_stop_status = "1";
inputConnection.stopTime = currentTime;
eventEmitter.emit(
"sendMotorStopNotification",
customerId, // Pass customerId
fcmTokens, // Pass FCM tokens
hw_Id, // Motor ID
inputConnection.water_level || 0,
motorTank.blockName || "N/A",
tankName,
inputConnection.motor_on_type
);
// eventEmitter.emit(
// "sendMotorStopNotification",
// customerId, // Pass customerId
// fcmTokens, // Pass FCM tokens
// hw_Id, // Motor ID
// inputConnection.water_level || 0,
// motorTank.blockName || "N/A",
// tankName,
// inputConnection.motor_on_type
// );
}
await motorTank.save();

Loading…
Cancel
Save