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.motor_on_type = "forced_manual";
inputConnection.startTime = currentTime; inputConnection.startTime = currentTime;
// Determine stop criteria dynamically // // Determine stop criteria dynamically
const stopCriteria = inputConnection.motor_stop_status === "1" ? "manual" : "threshold"; // const stopCriteria = inputConnection.motor_stop_status === "1" ? "manual" : "threshold";
eventEmitter.emit( // eventEmitter.emit(
"sendMotorStartNotification", // "sendMotorStartNotification",
customerId, // Pass customerId // customerId, // Pass customerId
fcmTokens, // Pass FCM tokens // fcmTokens, // Pass FCM tokens
hw_Id, // Motor ID // hw_Id, // Motor ID
inputConnection.water_level || 0, // Water level // inputConnection.water_level || 0, // Water level
motorTank.blockName || "N/A", // Block name // motorTank.blockName || "N/A", // Block name
tankName, // Tank name // tankName, // Tank name
inputConnection.motor_on_type, // Motor on type // inputConnection.motor_on_type, // Motor on type
stopCriteria, // Stop criteria (manual/threshold) // stopCriteria, // Stop criteria (manual/threshold)
manual_threshold_time // Threshold time (only used for threshold stop) // 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.motor_stop_status = "1";
inputConnection.stopTime = currentTime; inputConnection.stopTime = currentTime;
eventEmitter.emit( // eventEmitter.emit(
"sendMotorStopNotification", // "sendMotorStopNotification",
customerId, // Pass customerId // customerId, // Pass customerId
fcmTokens, // Pass FCM tokens // fcmTokens, // Pass FCM tokens
hw_Id, // Motor ID // hw_Id, // Motor ID
inputConnection.water_level || 0, // inputConnection.water_level || 0,
motorTank.blockName || "N/A", // motorTank.blockName || "N/A",
tankName, // tankName,
inputConnection.motor_on_type // inputConnection.motor_on_type
); // );
} }
await motorTank.save(); await motorTank.save();

Loading…
Cancel
Save