|
|
|
@ -2866,10 +2866,18 @@ exports.motorAction = async (req, reply) => {
|
|
|
|
|
|
|
|
|
|
if (action === "start") {
|
|
|
|
|
|
|
|
|
|
if (motorIntervals[motorId]) {
|
|
|
|
|
clearInterval(motorIntervals[motorId]);
|
|
|
|
|
delete motorIntervals[motorId];
|
|
|
|
|
}
|
|
|
|
|
if (motorIntervals[motorId]) {
|
|
|
|
|
console.log(`🛑 Clearing interval for motorId: ${motorId}`);
|
|
|
|
|
clearInterval(motorIntervals[motorId]);
|
|
|
|
|
delete motorIntervals[motorId];
|
|
|
|
|
|
|
|
|
|
// Confirm deletion
|
|
|
|
|
if (!motorIntervals[motorId]) {
|
|
|
|
|
console.log(`✅ Interval for motorId: ${motorId} successfully deleted.`);
|
|
|
|
|
} else {
|
|
|
|
|
console.error(`❌ Failed to delete interval for motorId: ${motorId}`);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const startTime = moment().tz('Asia/Kolkata').format('DD-MMM-YYYY - HH:mm');
|
|
|
|
|
|
|
|
|
@ -5971,14 +5979,14 @@ async function processIotData(hw_Id, data) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// function logSets() {
|
|
|
|
|
// console.log("Subscribed Topics:", Array.from(subscribedTopics));
|
|
|
|
|
// console.log("Active Devices:", Array.from(activeDevices));
|
|
|
|
|
// console.log("motorIntervals:", motorIntervals);
|
|
|
|
|
// }
|
|
|
|
|
function logSets() {
|
|
|
|
|
console.log("Subscribed Topics:", Array.from(subscribedTopics));
|
|
|
|
|
console.log("Active Devices:", Array.from(activeDevices));
|
|
|
|
|
console.log("motorIntervals:", motorIntervals);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// // Call logSets every 30 seconds
|
|
|
|
|
// setInterval(logSets, 30000);
|
|
|
|
|
// Call logSets every 30 seconds
|
|
|
|
|
setInterval(logSets, 30000);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|