loadRelaysData function removed from rsPort, DataToTbHandler-send data if broker not connected
This commit is contained in:
parent
ca39e1266c
commit
1c131d0b63
4 changed files with 19 additions and 47 deletions
|
|
@ -275,17 +275,19 @@ function processNodeProfile(node)
|
|||
return;
|
||||
}
|
||||
|
||||
let profile = nodeObj.profile;
|
||||
|
||||
logger.debug("processNodeProfile: start - set profile for ", node, profile);
|
||||
|
||||
let nodeProfile;
|
||||
try {
|
||||
nodeProfile = JSON.parse(profile);
|
||||
if(Object.keys(nodeProfile).length === 0) throw ("profile is not defined");
|
||||
} catch (error) {
|
||||
logger.debug("Error parsing node profile", error);
|
||||
}
|
||||
let nodeProfile = nodeObj.profile;
|
||||
if(nodeProfile) {
|
||||
|
||||
try {
|
||||
nodeProfile = JSON.parse(nodeProfile);
|
||||
if(Object.keys(nodeProfile).length === 0) throw ("profile is not defined");
|
||||
} catch (error) {
|
||||
logger.debug("Error parsing node profile", error);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
logger.debug("processNodeProfile", node, line, nodeObj, nodeProfile);
|
||||
|
||||
|
|
@ -293,7 +295,7 @@ function processNodeProfile(node)
|
|||
|
||||
removeTask({type: "set_node_profile", address: node});
|
||||
|
||||
if(nodeProfile === undefined)
|
||||
if(nodeProfile === "")
|
||||
{
|
||||
//vypneme profil nodu, posleme cmd
|
||||
//Pokiaľ je hodnota rovná 1 – Profil sa zapne, ostatné bity sa nezmenia.
|
||||
|
|
@ -1709,33 +1711,6 @@ exports.install = function(instance) {
|
|||
{
|
||||
tasks[0].timestamp = currentTimestamp + tasks[0].addMinutesToTimestamp * 60000;
|
||||
|
||||
//select nespracovane nody
|
||||
//node:number|tbname:string|line:number|profile:string|processed:boolean|status:boolean
|
||||
|
||||
//buildTasks({processLineProfiles: true, line: line});
|
||||
|
||||
/*
|
||||
let keys = Object.keys(nodesData);
|
||||
for(let i = 0; i < keys.length; i++)
|
||||
{
|
||||
let node = keys[i];
|
||||
let line = node.line;
|
||||
|
||||
if(node.processed) continue;
|
||||
|
||||
if(relaysData[line] != undefined)
|
||||
{
|
||||
let relayStatus = relaysData[line].contactor;
|
||||
if(relayStatus == 1)
|
||||
{
|
||||
//linia je zapnuta
|
||||
//await loadRelaysData(flowdata.data.line);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
//vsetky linie kt. su zapnute, a spracuju sa nespracovane profily nodov
|
||||
loadRelaysData();
|
||||
|
||||
|
|
@ -2143,7 +2118,7 @@ exports.install = function(instance) {
|
|||
let register = params.register;
|
||||
let type = params.type;
|
||||
let tbName = params.tbname;
|
||||
tbName && (tbName = nodesData[node].tbname);
|
||||
if(!tbName) return;
|
||||
|
||||
let values = {};
|
||||
|
||||
|
|
@ -2178,7 +2153,7 @@ exports.install = function(instance) {
|
|||
}
|
||||
|
||||
// console.log("------",node, register, type, itIsNodeCommand, updateStatus, saveToTb, values);
|
||||
if(saveToTb && Object.keys(values).length > 0 && tbName)
|
||||
if(saveToTb && Object.keys(values).length > 0)
|
||||
{
|
||||
|
||||
let dataToTb = {
|
||||
|
|
@ -2318,7 +2293,7 @@ exports.install = function(instance) {
|
|||
|
||||
logger.debug("CMD manager - rsPort opened sucess");
|
||||
|
||||
loadRelaysData();
|
||||
//loadRelaysData();
|
||||
|
||||
await runSyncExec(`stty -F /dev/${FLOW.OMS_serial_port} 115200 min 1 time 5 ignbrk -brkint -icrnl -imaxbel -opost -isig -icanon -iexten -echo -echoe -echok -echoctl -echoke`).then(function (status) {
|
||||
instance.send(SEND_TO.debug, "RPC runSyncExec - Promise Resolved:" + status);
|
||||
|
|
@ -2353,7 +2328,6 @@ exports.install = function(instance) {
|
|||
rsPort.close();
|
||||
});
|
||||
|
||||
//loadRelaysData();
|
||||
rsPort.open();
|
||||
|
||||
instance.on("close", () => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue