Do not send 'switching profile applied to line' notification; Handle nok,ok,offline node status

This commit is contained in:
rasta5man 2025-01-09 14:55:53 +01:00
parent c052887a1f
commit 63504df84d
2 changed files with 277 additions and 363 deletions

View file

@ -140,7 +140,7 @@ exports.install = function(instance) {
//helper container for counting resolved group of commands (commands related to set profile) //helper container for counting resolved group of commands (commands related to set profile)
let cmdCounter = {};//key is node, value is counter let cmdCounter = {};//key is node, value is counter
//if sending of profile to node fails, we send notification and push node into set, so we do not send notification twice //if sending of profile to node fails, we send notification and push node into set, so we do not send notification twice
const nodeProfileSendFail = new Set(); const nodeProfileSendFail = new Set();
@ -1538,7 +1538,7 @@ exports.install = function(instance) {
value == 1 ? onOrOff = "on" : onOrOff = "off"; value == 1 ? onOrOff = "on" : onOrOff = "off";
turnLine(onOrOff, params.line, info); turnLine(onOrOff, params.line, info);
interval = setInterval(runTasks, SHORT_INTERVAL); interval = setInterval(runTasks, SHORT_INTERVAL);
return; return;
} }
@ -1590,27 +1590,35 @@ exports.install = function(instance) {
return; return;
} }
} }
let contactorStatus = 1;
if(relaysData[line] != undefined) contactorStatus = relaysData[line].contactor;
if (line == 0 || contactorStatus == 0) {
interval = setInterval(runTasks, LONG_INTERVAL);
return;
}
//TODO -> status offline for rvo if rotary_switch_state is OFF // TODO: -> status offline for rvo if rotary_switch_state is OFF, this is source of errors
//let relayStatus = 1; //
//if (relaysData[line] != undefined) { // let relayStatus = 1;
// relayStatus = relaysData[line].contactor; // if (relaysData[line] != undefined) {
//} // relayStatus = relaysData[line].contactor;
// }
// if (line == 0) relayStatus = 0;
// if (type == "cmd-terminal") relayStatus = 1;
//if (line == 0) relayStatus = 0; // //check if rotary_switch_state == "Off"
//if (type == "cmd-terminal") relayStatus = 1; // if (relayStatus == 0) {
// console.log("------------------------------------relayStatus", relayStatus, line);
// let values = { "status": "OFFLINE" };
//check if rotary_switch_state == "Off" // if(tbname) sendTelemetry(values, tbname)
//if (relayStatus == 0) {
//console.log("------------------------------------relayStatus", relayStatus, line);
//let values = { "status": "OFFLINE" };
//if(tbname) sendTelemetry(values, tbname) // interval = setInterval(runTasks, SHORT_INTERVAL);
// return;
//interval = setInterval(runTasks, SHORT_INTERVAL); // }
//return;
//}
if (!rsPort.isOpen) { if (!rsPort.isOpen) {
interval = setInterval(runTasks, LONG_INTERVAL); interval = setInterval(runTasks, LONG_INTERVAL);
@ -1806,7 +1814,7 @@ exports.install = function(instance) {
} }
else { else {
if(currentTask.debug) { if (currentTask.debug) {
// currentTask.timestamp <= currentTimestamp && logger.debug("currentTask is not processed - task is in the future", currentTask); // currentTask.timestamp <= currentTimestamp && logger.debug("currentTask is not processed - task is in the future", currentTask);
} }
@ -1844,11 +1852,11 @@ exports.install = function(instance) {
if (type == "set_node_profile") { if (type == "set_node_profile") {
delete cmdCounter[node]; delete cmdCounter[node];
logger.debug("profil nebol úspešne odoslaný na node č. ", params); logger.debug("profil nebol úspešne odoslaný na node č. ", params);
if(!nodeProfileSendFail.has(node)) { if (!nodeProfileSendFail.has(node)) {
sendNotification("CMD Manager: process cmd", tbName, "configuration_of_dimming_profile_to_node_failed", { node: node }, "", SEND_TO.tb, instance); sendNotification("CMD Manager: process cmd", tbName, "configuration_of_dimming_profile_to_node_failed", { node: node }, "", SEND_TO.tb, instance);
nodeProfileSendFail.add(node); nodeProfileSendFail.add(node);
} }
} }
if (itIsNodeCommand) { if (itIsNodeCommand) {

File diff suppressed because it is too large Load diff