diff --git a/src/controllers/tanksController.js b/src/controllers/tanksController.js index 13a12322..c25a8a6b 100644 --- a/src/controllers/tanksController.js +++ b/src/controllers/tanksController.js @@ -6072,6 +6072,7 @@ client.on('message', async (topic, message) => { } }); + client.on('error', (err) => console.error('❌ MQTT Error:', err)); client.on('close', () => console.log('⚠️ MQTT Connection Closed.')); client.on('offline', () => console.log('⚠️ MQTT Broker Offline.')); @@ -6234,7 +6235,7 @@ const sendMotorNotifications = async () => { // 🔹 Motor Start Condition if ( - inputConnection.motor_stop_status === "2" && status ===1 && inputConnection.motor_on_type === "forced_manual" && + inputConnection.motor_stop_status === "2" && inputConnection.motor_on_type === "forced_manual" && !motorTank.motor_start_notified ) { console.log("✅ Sending Motor Start Notification..."); @@ -6259,7 +6260,7 @@ const sendMotorNotifications = async () => { // 🔹 Motor Stop Condition if ( - inputConnection.motor_stop_status === "1" && inputConnection.motor_on_type === "forced_manual" && status ===2 && + inputConnection.motor_stop_status === "1" && !motorTank.motor_stop_notified ) { console.log("✅ Sending Motor Stop Notification...");