|
|
|
@ -2988,6 +2988,8 @@ exports.motorAction = async (req, reply) => {
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
clearInterval(motorIntervals[motorId]); // Stop the motor if condition met
|
|
|
|
|
delete motorIntervals[motorId]; // Remove from interval object
|
|
|
|
|
|
|
|
|
@ -5933,12 +5935,15 @@ async function processIotData(hw_Id, data) {
|
|
|
|
|
const inputConnection = motorTank.connections.inputConnections.find(conn => conn.motor_id === hw_Id);
|
|
|
|
|
if (inputConnection) {
|
|
|
|
|
inputConnection.motor_status = status;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (inputConnection.motor_stop_status === "1" && status === 2 && inputConnection.motor_on_type !== "forced_manual") {
|
|
|
|
|
const currentTime = moment().tz('Asia/Kolkata').format('DD-MMM-YYYY - HH:mm');
|
|
|
|
|
|
|
|
|
|
const startInstanceId = `${hw_Id}${currentTime}`;
|
|
|
|
|
inputConnection.motor_stop_status = "2";
|
|
|
|
|
inputConnection.motor_on_type = "forced_manual";
|
|
|
|
|
inputConnection.startTime = currentTime;
|
|
|
|
|
inputConnection.start_instance_id = startInstanceId;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (inputConnection.motor_stop_status === "2" && status === 1) {
|
|
|
|
|