From c052887a1fffca7d0bb8d007d90ff1980580586c Mon Sep 17 00:00:00 2001 From: rasta5man Date: Tue, 7 Jan 2025 15:30:46 +0100 Subject: [PATCH] version 2025-02-01 --- databases/notifications.table | 4 +- flow/audit_test_panel.csv | 48 --- flow/cloudmqttconnect.js | 67 +--- flow/cmd_manager.js | 2 - flow/csv_import.js | 175 --------- flow/db_init.js | 2 +- flow/designer.json | 700 ++++++++++++++++------------------ flow/notifikacie.csv | 31 -- flow/variables.txt | 0 flow/wsmqttpublish.js | 38 +- package.json | 1 + 11 files changed, 368 insertions(+), 700 deletions(-) delete mode 100644 flow/audit_test_panel.csv delete mode 100644 flow/csv_import.js delete mode 100644 flow/notifikacie.csv delete mode 100644 flow/variables.txt diff --git a/databases/notifications.table b/databases/notifications.table index 8e3788f..9dbe047 100644 --- a/databases/notifications.table +++ b/databases/notifications.table @@ -1,5 +1,5 @@ key:string|weight:string|sk:string|en:string -+|switching_profile_point_applied_to_line|INFORMATIONAL|Aplikovaný bod spínacieho profilu na línií č. ${line} : ${value}|Switching profile point applied to line no. ${line} : ${value}|............... ++|switching_profile_point_applied_to_line|INFORMATIONAL|Aplikovaný bod spínacieho profilu na línií č. ${line} : ${value}|Switching profile point applied to line no. ${line} : ${value}|............... +|dusk_has_occured|INFORMATIONAL|Nastal súmrak: ${value}|Dusk has occured: ${value}|............... +|dawn_has_occured|INFORMATIONAL|Nastal úsvit: ${value}|Dawn has occured: ${value}|............... +|dimming_profile_was_successfully_received_by_node|NOTICE|Stmievací profil bol úspešne prijatý nodom č. ${node}|Dimming profile was successfully received by node no. ${node}|............... @@ -22,7 +22,7 @@ key:string|weight:string|sk:string|en:string +|battery_level_is_ok|NOTICE|Batéria má správnu úroveň napätia|Battery level is OK|............... +|door_opened|NOTICE|Dvere boli otvorené|Door has been opeed|............... +|door_closed|NOTICE|Dvere boli zatvorené|Door has been closed|............... -+|door_opened_without_permission|WARNING|Dvere boli otvorené bez povoeania - zapnutá siréna|Door has been oed without permision - alarm is on|............... ++|door_opened_without_permission|WARNING|Dvere boli otvorené bez povolenia - zapnutá siréna|Door opened without permision - alarm is on|............... +|state_of_contactor_for_line|INFORMATIONAL|Stav stýkača pre líniu č. ${line} je ${value}|State of contactor for line no. ${line} is ${value}|............... +|local_database_is_corrupted|CRITICAL|||............... +|electrometer_nok|ERROR|Elektromer neodpovedá|Electrometer is not responding|............... diff --git a/flow/audit_test_panel.csv b/flow/audit_test_panel.csv deleted file mode 100644 index 907a6a9..0000000 --- a/flow/audit_test_panel.csv +++ /dev/null @@ -1,48 +0,0 @@ -LumDimm;NODE (HEX);NODE (DEC);Line;TB name -1;299;665;3;gbv4nzqxW0XGAPKVNk8kr25ZQ2l3O6LRBprM97ew -2;28A;650;3;0XYElWeKBNJn1gdoMG8lYdDALkPvj4V3xra2q6mO -3;296;662;3;gbv4nzqxW0XGAPKVNk8kW48ZQ2l3O6LRBprM97ew -4;297;663;1;LpkVlmq4b3jMwJQxBZ8akayrXAP6o97Ke0aOYEg2 -5;29C;668;3;lekrmdvO0BQG1ZW4AV8jeZ5M39xnN2wEbRgPjXLp -6;2B1;689;3;q0rElBPdL6kxMAjnzVDRl95emNZY7oOv2wK9gb31 -7;2AB;683;3;XKQbz3WAwY21dGa0R453rWyJm9PZOjqlvpr6Nkeo -8;2B0;688;3;PaGbQ3wBAZWOmRvK9VDpvz5endLJYopEqlkzNMxX -9;2B9;697;3;joqRYBVL30k9eQWOlZ5qwpD2KJpNEmA6gPxXzwaM -10;293;659;3;Ymn9oleRxJ0vw17WzAyGwdyEBk4ObdMXj2VgpNLG -11;294;660;3;gj7zbKV46oQ1p2e0AJ8XqZDG3YNWaRrlOEXvBxmM -12;295;661;3;laYK7Pomn2bNZXEpedDxAqyOJkQ3WwV49gqxLrAR -13;2A0;672;2;0XYElWeKBNJn1gdoMG8lON5ALkPvj4V3xra2q6mO -14;2B4;692;2;l9YkRpoB2vVa0mKqEO8ZGGDjW43eXnJML6GxzbwQ -15;2B2;690;2;wGjQobgOK0n2YqBZmVDVR3DR9ep6EXA1ka3vzlP7 -16;27C;636;2;M6ogKQW09bOXewAYvZyvJqyJrV1aRnPGE37p42Nx -17;27B;635;2;Vq2JaWpw1OdBKmNeoj8w605XE40l3kgL76Azb9QP -18;2B6;694;2;Jm32GR1qpwQxlZza0N5mE15AP96YbOKLogrXVW4e -19;2B5;693;2;KjbN4q7JPZmexgdnz2yKdn5YAWwO0Q3BMX6ERLoV -20;2B3;691;1;lekrmdvO0BQG1ZW4AV8jzq8M39xnN2wEbRgPjXLp -21;27F;639;3;BOjEzGRZ46bnp9wa2A8z76D0JkmW1QPNdrqevXVL -22;27E;638;3;9xgzG4Op1BrKZPmoQkDrmj8E73ndJNMjavAwX2Re -23;27D;637;3;koW06PeGrLlBp2YJQE5Ogw5RmMaXKzj3wOAZg9n7 -24;28F;655;2;RMgnK93rkoAazbqdQ4yBYpDZ1YXGx6pmwBeVEP2O -25;288;648;2;gaMGN4x1e9JlZz0QPRDd9Rym6dVr3OpvqKnoWBbk -26;298;664;1;oGVzxNWP9lrjaQ7vKODQ7g51gqp62YZREmdw3XBM -27;29F;671;3;AvVdgzYJZaPx3oMqeED4Oj8NnmKkw716bRO90jLB -28;280;640;2;WjBL12pg63eX4N9P7zy0XYyEJKmlbkGwZMx0avQV -29;28B;651;2;qaAOzENGrvpbe0VoK7D6Ld519PZmdg3nl24JLQMk -30;27A;634;2;NGWamnYqlP1wbgrZQxDAWm5e2X7OVAK69koR04vL -31;29E;670;2;dlE1VQjYrNx9gZRmb38g1YyoLBO4qaAk2M6JPnG7 -32;281;641;2;vnmG4kJxaXWNBgMQq0D7Mz5e9oZzOAlr6LdR3w2V -33;278;632;2;LpkVlmq4b3jMwJQxBZ8aM78rXAP6o97Ke0aOYEg2 -34;29D;669;3;Y9aLW03wOZkABvKXbMyL0lyV1xdNj72r4egqGRzJ -35;2A8;680;1;KL2jNOVpdARa9XvoeJDPga8bkmPBxqn7Ww3gzGQ1 -36;2BA;698;1;mYnBzbeGaAL62jowRv59M35Xq9QpZ0K7O1dg4xVl -37;29B;667;1;MzXBoWbEZjO0lrpqnRyoJ4DkmVeaNAGdL9g4QKxP -38;289;649;1;0p2rwdP7aGoOQLJNgAynJNy6xWXbmMe3nvZqlzkV -39;290;656;1;BrQx3NGKgVMRaXYAo9y1GE8ZzkWnj1le6bdOLE20 -40;2AA;682;1;vnreBJ6PMqgz20pYEL82XQyG1jkWwdQxZVNAOlmK -41;285;645;1;jklN4JpQAx362o9XYZDN6wDgrWw1P7GEbdBM0vRV -42;283;643;1;oZmYXEbw9lVWRv1jLxDe9bDdgAMz4PKQnNJ6eB23 -43;282;642;1;pEonaKBOGbj9034MgJ8W3G8qXvxNWVkAPQz21R6L -44;287;647;1;BLQal6Pn9oz1KmNgek5Yqd50vd2MAbqG3OV7Rp4j -45;286;646;1;4agVJ9dPQkmp1R2X3EDJKxyrK6ZlNoM0n7qxBOev -46;29A;666;1;9PpgLEnvk4WMV6RmOJybMGDaeAXzo2BQNG3K17Zw -47;28E;654;1;Mmp93b2nvd7OoqgBeEyEZq5kjlAV1Y4ZNXwW0zLG diff --git a/flow/cloudmqttconnect.js b/flow/cloudmqttconnect.js index 85acfdc..d619784 100644 --- a/flow/cloudmqttconnect.js +++ b/flow/cloudmqttconnect.js @@ -32,6 +32,7 @@ exports.html = `
const { promisifyBuilder } = require('./helper/db_helper'); const fs = require('fs'); const mqtt = require('mqtt'); +const nosql = NOSQL('tbdatacloud'); const SEND_TO = { debug: 0, @@ -56,9 +57,6 @@ let lastRestoreTime = 0; let sendClientError = true; -const nosql = NOSQL('tbdatacloud'); - - exports.install = function(instance) { var client; @@ -112,11 +110,6 @@ exports.install = function(instance) { }); client.on('reconnect', function() { - client.subscribe(`${o.topic}_backward`, (err) => { - if (!err) { - console.log("MQTT subscribed"); - } - }); instance.status("Reconnecting", "yellow"); clientReady = false; }); @@ -139,18 +132,11 @@ exports.install = function(instance) { instance.send(SEND_TO.rpcCall, {"topic":o.topic, "content":message }); }); - client.on('close', function(err) { + client.on('close', function() { clientReady = false; - if (err && err.toString().indexOf('Error')) { - instance.status("Err: "+err.code, "red"); - instance.send(SEND_TO.debug, {"message":"Client CLOSE signal received !", "error":err, "opt":opts }); - } else { - instance.status("Disconnected", "red"); - instance.send(SEND_TO.debug, {"message":"Client CLOSE signal received !", "error":err, "opt":opts }); - } - - client.reconnect(); + instance.status("Disconnected", "red"); + instance.send(SEND_TO.debug, {"message":"Client CLOSE signal received !"}); }); client.on('error', function(err) { @@ -170,46 +156,30 @@ exports.install = function(instance) { if(clientReady) { - //do we have some data in backup file? - //if any, process data from database + //do we have some data in backup file? if any, process data from database if(saveTelemetryOnError) { //read telemetry data and send back to server if(!processingData) processDataFromDatabase(); } - } - - if(clientReady) - { - client.publish(`${o.topic}_forward`, data.data, {qos: 1}); - //console.log("ondata..",data.data) - - - // Pokad ten error na 38 chápem tak tento parameter MUSÍ byt string... - // Tak to musim dekódovat na strane Cloudu zas - + + let stringifiedJson = JSON.stringify(data.data) + client.publish(`${o.topic}_forward`, stringifiedJson, {qos: 1}); } else { - //logger.debug("Client unavailable. Data not sent !", JSON.stringify(data.data)); instance.send(SEND_TO.debug, {"message":"Client unavailable. Data not sent !", "data": data.data }); if(saveTelemetryOnError) { - try { - let d = JSON.parse(data.data); - //create new file from tbdata.nosql, if file size exceeds given limit, and clear tbdata.nosql - makeBackupFromDbFile(); + //create new file from tbdata.nosql, if file size exceeds given limit, and clear tbdata.nosql + makeBackupFromDbFile(); - //write to tb - d.id = UID(); - nosql.insert(d); - } catch(e) { - console.log("cloudconnect - unable to parse data from wsmqtt"); - } + //write to tb + data.data.id = UID(); + nosql.insert(data.data); } - } }); @@ -358,12 +328,10 @@ exports.install = function(instance) { try { - let o = JSON.parse(JSON.stringify(item)); - delete o.id; - let message = JSON.stringify(o); - - client.publish(`${o.topic}_forward`, message, {qos:1}); - //console.log("db...", message) + let message = JSON.parse(JSON.stringify(item)); + delete message.id; + client.publish(`${o.topic}_forward`, JSON.stringify(message), {qos:1}); + //remove from database await promisifyBuilder(nosql.remove().where("id", id)); @@ -372,7 +340,6 @@ exports.install = function(instance) { console.log("processDataFromDatabase", error); } - } } diff --git a/flow/cmd_manager.js b/flow/cmd_manager.js index a63185f..a9376a5 100644 --- a/flow/cmd_manager.js +++ b/flow/cmd_manager.js @@ -1512,8 +1512,6 @@ exports.install = function(instance) { const value = params.value; let date = new Date(); - let hour = date.getHours(); - date.setDate(date.getDate() + 1);//next day let sunCalcResult; diff --git a/flow/csv_import.js b/flow/csv_import.js deleted file mode 100644 index 5ae1e68..0000000 --- a/flow/csv_import.js +++ /dev/null @@ -1,175 +0,0 @@ -exports.id = 'csv_import'; -exports.title = 'CsvImport'; -exports.version = '1.0.0'; -exports.group = 'Worksys'; -exports.color = '#2134B0'; -exports.input = 1; -exports.output = ["red", "white"]; -exports.click = false; -exports.author = 'Daniel Segeš'; -exports.icon = 'file-import'; -exports.options = { edge: "undefined" }; - -exports.html = `
-
-
-
CSV Import
-
-
-
`; - -exports.readme = `# load csv to table db`; - -//config -let delimiter = ";"; -let uniqueColumn = "node"; -let path = "flow/audit_test_panel.csv"; -let startFrom = 1; -let table = "nodes"; -let mapImport = { - 2: "node", - 4: "tbname", - 3: "line" -}; - -//10.0.0.62 -delimiter = ";"; -uniqueColumn = "node"; -path = "flow/audit_rvo14_lampy.csv"; -startFrom = 1; -table = "nodes"; -mapImport = { - 1: "node", - 3: "tbname", - 2: "line" -}; - -//notification -delimiter = ";"; -uniqueColumn = undefined; -path = "flow/notifikacie.csv"; -startFrom = 1; -table = "notifications"; -mapImport = { - 0: "key", - 1: "weight", - 2: "en", - 3: "sk" -}; - -const fs = require('fs'); - -exports.install = function(instance) { - - //console.log("csv import installed"); - - instance.on("close", () => { - - }) - - - instance.on("data", (flowdata) => { - - instance.send(0, "start import"); - console.log("csv import", flowdata.data); - - //{table: "nodes", startFrom: 1, delimiter: ";", uniqueColumn: "node", path: "flow/audit_rvo14_lampy.csv", mapImport: {1: "node", 3: "tbname", 2: "line"}} - - - if(typeof flowdata.data === 'object') - { - console.log("*******************", flowdata.data); - - if(!flowdata.data.hasOwnProperty("table")) - { - instance.send(0, "!!!!csv import - nedefinovana tabulka"); - return; - } - - if(!flowdata.data.hasOwnProperty("uniqueColumn")) - { - //instance.send(0, "!!!!csv import - nedefinovane uniqueColumn"); - //return; - } - - if(!flowdata.data.hasOwnProperty("path")) - { - instance.send(0, "!!!!csv import - nedefinovana cesta k suboru"); - return; - } - - if(!flowdata.data.hasOwnProperty("mapImport")) - { - instance.send(0, "!!!!csv import - nedefinovany mapImport"); - return; - } - - table = flowdata.data.table; - uniqueColumn = flowdata.data.uniqueColumn; - if(uniqueColumn === "") uniqueColumn = undefined; - - path = flowdata.data.path; - mapImport = flowdata.data.mapImport; - - if(flowdata.data.hasOwnProperty("delimiter")) delimiter = flowdata.data.delimiter; - if(flowdata.data.hasOwnProperty("startFrom")) startFrom = flowdata.data.startFrom; - } - - - var db = TABLE(table); - db.clear(); - - let keys = Object.keys(mapImport); - - try { - const data = fs.readFileSync(path, 'utf8') - - let lines = data.split("\n"); - - for(let i = startFrom; i < lines.length; i++) - { - let line = lines[i]; - if(line === "") continue; - - let data = line.split(delimiter); - if(data.length == 0) continue; - - let insertData = {}; - - keys.map(function(key){ - let k = mapImport[key]; - - //console.log("importineg", i, key, k); - - if(data[key] != undefined) insertData[k] = data[key].trim(); - else{ - console.log("undefined", key, data); - } - }); - - console.log("insertData", insertData); - - if(uniqueColumn != undefined) - { - db.insert(insertData, true).where(uniqueColumn, insertData[uniqueColumn]); - } - else - { - db.insert(insertData); - } - - - } - - console.log("csv import finished"); - instance.send(0, "csv import finished"); - - } catch (err) { - console.error(err) - instance.send(0, err); - } - }) - -} - - diff --git a/flow/db_init.js b/flow/db_init.js index 76408c8..c43e4a2 100644 --- a/flow/db_init.js +++ b/flow/db_init.js @@ -64,7 +64,7 @@ exports.install = async function(instance) { if(dbs.nodesData.hasOwnProperty("0")) delete dbs.nodesData["0"]; dbs.settings = { - edge_fw_version : "2024-11-04", //rok-mesiac-den + edge_fw_version : "2025-01-02", //rok-mesiac-den language : responseSettings[0]["lang"], rvo_name : responseSettings[0]["rvo_name"], project_id : responseSettings[0]["project_id"], diff --git a/flow/designer.json b/flow/designer.json index e960086..fbdda76 100644 --- a/flow/designer.json +++ b/flow/designer.json @@ -36,21 +36,21 @@ "text": "Enabled", "color": "gray" }, + "color": "#DA4453", + "notes": "", "options": { "type": "data", "repository": false, "enabled": true - }, - "color": "#DA4453", - "notes": "" + } }, { "id": "1612776786008", "component": "wsmqttpublish", "tab": "1612772287426", "name": "WS MQTT publish", - "x": 310.75, - "y": 263, + "x": 304.75, + "y": 237, "connections": { "0": [ { @@ -82,10 +82,6 @@ { "index": "0", "id": "1731068754606" - }, - { - "index": "0", - "id": "1733574445563" } ] }, @@ -94,25 +90,25 @@ "output": [] }, "state": { - "text": "Connected", - "color": "green" + "text": "Reconnecting", + "color": "yellow" }, + "color": "#888600", + "notes": "", "options": { "username": "", "clientid": "", "port": "1883", "host": "" - }, - "color": "#888600", - "notes": "" + } }, { "id": "1612778461252", "component": "virtualwirein", "tab": "1612772287426", "name": "tb-push", - "x": 85.75, - "y": 352, + "x": 86.75, + "y": 375, "connections": { "0": [ { @@ -122,6 +118,10 @@ { "index": "1", "id": "1612776786008" + }, + { + "index": "0", + "id": "1731068754606" } ] }, @@ -133,19 +133,19 @@ "text": "tb-push", "color": "gray" }, + "color": "#303E4D", + "notes": "", "options": { "wirename": "tb-push" - }, - "color": "#303E4D", - "notes": "" + } }, { "id": "1612783322136", "component": "debug", "tab": "1612772287426", "name": "to TB", - "x": 312.75, - "y": 426, + "x": 306.75, + "y": 371, "connections": {}, "disabledio": { "input": [ @@ -157,21 +157,21 @@ "text": "Enabled", "color": "gray" }, + "color": "#967ADC", + "notes": "", "options": { "type": "data", "repository": false, "enabled": true - }, - "color": "#967ADC", - "notes": "" + } }, { "id": "1615551060773", "component": "debug", "tab": "1612772287426", "name": "errors from MQTT Broker", - "x": 743, - "y": 65, + "x": 650, + "y": 76, "connections": {}, "disabledio": { "input": [ @@ -183,13 +183,13 @@ "text": "Enabled", "color": "gray" }, + "color": "#DA4453", + "notes": "", "options": { "type": "data", "repository": false, "enabled": true - }, - "color": "#DA4453", - "notes": "" + } }, { "id": "1615563373927", @@ -209,13 +209,13 @@ "text": "Enabled", "color": "gray" }, + "color": "#DA4453", + "notes": "", "options": { "type": "data", "repository": false, "enabled": true - }, - "color": "#DA4453", - "notes": "" + } }, { "id": "1615566865233", @@ -233,11 +233,11 @@ "text": "tb-push", "color": "gray" }, + "color": "#303E4D", + "notes": "", "options": { "wirename": "tb-push" - }, - "color": "#303E4D", - "notes": "" + } }, { "id": "1615798582262", @@ -257,13 +257,13 @@ "text": "Enabled", "color": "gray" }, + "color": "#967ADC", + "notes": "", "options": { "type": "data", "repository": false, "enabled": true - }, - "color": "#967ADC", - "notes": "" + } }, { "id": "1615802995322", @@ -281,13 +281,13 @@ "text": "Disabled", "color": "gray" }, + "color": "#967ADC", + "notes": "", "options": { "type": "data", "repository": false, "enabled": false - }, - "color": "#967ADC", - "notes": "" + } }, { "id": "1615809128443", @@ -305,13 +305,13 @@ "text": "Enabled", "color": "gray" }, + "color": "#967ADC", + "notes": "", "options": { "type": "data", "repository": false, "enabled": true - }, - "color": "#967ADC", - "notes": "" + } }, { "id": "1615809595184", @@ -329,11 +329,11 @@ "text": "tb-push", "color": "gray" }, + "color": "#303E4D", + "notes": "", "options": { "wirename": "tb-push" - }, - "color": "#303E4D", - "notes": "" + } }, { "id": "1616165795916", @@ -362,6 +362,9 @@ "text": "Listening", "color": "green" }, + "color": "#5D9CEC", + "notes": "### Configuration\n\n- __POST /terminal__\n- flags: \n- maximum request data length: __5 kB__\n- empty response: __false__\n- cache policy: __no cache__\n- cache expire: __5 minutes__", + "cloning": false, "options": { "timeout": 10, "cachepolicy": 0, @@ -376,10 +379,7 @@ 10000 ], "emptyresponse": false - }, - "color": "#5D9CEC", - "notes": "### Configuration\n\n- __POST /terminal__\n- flags: \n- maximum request data length: __5 kB__\n- empty response: __false__\n- cache policy: __no cache__\n- cache expire: __5 minutes__", - "cloning": false + } }, { "id": "1616165824813", @@ -397,11 +397,11 @@ "text": "", "color": "gray" }, + "color": "#5D9CEC", + "notes": "", "options": { "datatype": "json" - }, - "color": "#5D9CEC", - "notes": "" + } }, { "id": "1617104731852", @@ -421,13 +421,13 @@ "text": "Enabled", "color": "gray" }, + "color": "#967ADC", + "notes": "", "options": { "type": "data", "repository": false, "enabled": true - }, - "color": "#967ADC", - "notes": "" + } }, { "id": "1617114651703", @@ -452,12 +452,12 @@ "text": "", "color": "gray" }, - "options": { - "data": "{line: 3, command: \"turnOff\", force: true}", - "datatype": "object" - }, "color": "#F6BB42", - "notes": "" + "notes": "", + "options": { + "datatype": "object", + "data": "{line: 3, command: \"turnOff\", force: true}" + } }, { "id": "1617115013095", @@ -475,11 +475,11 @@ "text": "tb-push", "color": "gray" }, + "color": "#303E4D", + "notes": "", "options": { "wirename": "tb-push" - }, - "color": "#303E4D", - "notes": "" + } }, { "id": "1617284749681", @@ -504,12 +504,12 @@ "text": "", "color": "gray" }, - "options": { - "datatype": "string", - "data": "profile_nodes" - }, "color": "#F6BB42", - "notes": "" + "notes": "", + "options": { + "data": "profile_nodes", + "datatype": "string" + } }, { "id": "1618235171399", @@ -534,19 +534,19 @@ "text": "", "color": "gray" }, + "color": "#F6BB42", + "notes": "", "options": { "data": "run" - }, - "color": "#F6BB42", - "notes": "" + } }, { "id": "1618300858252", "component": "debug", "tab": "1612772287426", "name": "wsmqtt-exit1", - "x": 742.8833312988281, - "y": 153, + "x": 650.8833312988281, + "y": 160, "connections": {}, "disabledio": { "input": [], @@ -556,21 +556,21 @@ "text": "Enabled", "color": "gray" }, + "color": "#967ADC", + "notes": "", "options": { "type": "data", "repository": false, "enabled": true - }, - "color": "#967ADC", - "notes": "" + } }, { "id": "1618300863816", "component": "debug", "tab": "1612772287426", "name": "wsmqtt-exit2", - "x": 1064.8833312988281, - "y": 292, + "x": 845.8833312988281, + "y": 320, "connections": {}, "disabledio": { "input": [ @@ -582,13 +582,13 @@ "text": "Enabled", "color": "gray" }, + "color": "#967ADC", + "notes": "", "options": { "type": "data", "repository": false, "enabled": true - }, - "color": "#967ADC", - "notes": "" + } }, { "id": "1618393583970", @@ -606,11 +606,11 @@ "text": "from-dido-controller", "color": "gray" }, + "color": "#303E4D", + "notes": "", "options": { "wirename": "from-dido-controller" - }, - "color": "#303E4D", - "notes": "" + } }, { "id": "1618393674428", @@ -635,11 +635,11 @@ "text": "platform-rpc-call", "color": "gray" }, + "color": "#303E4D", + "notes": "", "options": { "wirename": "platform-rpc-call" - }, - "color": "#303E4D", - "notes": "" + } }, { "id": "1618393759854", @@ -668,11 +668,11 @@ "text": "cmd_to_dido", "color": "gray" }, + "color": "#303E4D", + "notes": "", "options": { "wirename": "cmd_to_dido" - }, - "color": "#303E4D", - "notes": "" + } }, { "id": "1618393827655", @@ -690,18 +690,18 @@ "text": "cmd_to_dido", "color": "gray" }, + "color": "#303E4D", + "notes": "", "options": { "wirename": "cmd_to_dido" - }, - "color": "#303E4D", - "notes": "" + } }, { "id": "1618558465485", "component": "virtualwireout", "tab": "1612772287426", "name": "platform-rpc-call", - "x": 739.8833312988281, + "x": 649.8833312988281, "y": 246, "connections": {}, "disabledio": { @@ -712,11 +712,11 @@ "text": "platform-rpc-call", "color": "gray" }, + "color": "#303E4D", + "notes": "", "options": { "wirename": "platform-rpc-call" - }, - "color": "#303E4D", - "notes": "" + } }, { "id": "1618572059773", @@ -741,12 +741,12 @@ "text": "", "color": "gray" }, - "options": { - "datatype": "object", - "data": "{line: 1, command: \"turnOn\", force: true}" - }, "color": "#F6BB42", - "notes": "" + "notes": "", + "options": { + "data": "{line: 1, command: \"turnOn\", force: true}", + "datatype": "object" + } }, { "id": "1619515097737", @@ -799,9 +799,9 @@ "text": "", "color": "gray" }, - "options": {}, "color": "#5D9CEC", - "notes": "" + "notes": "", + "options": {} }, { "id": "1619605019281", @@ -830,6 +830,9 @@ "text": "Listening", "color": "green" }, + "color": "#5D9CEC", + "notes": "### Configuration\n\n- __GET /db__\n- flags: undefined\n- maximum request data length: __5 kB__\n- empty response: __undefined__\n- cache policy: __no cache__\n- cache expire: __5 minutes__", + "cloning": false, "options": { "timeout": 5, "cachepolicy": 0, @@ -843,10 +846,7 @@ "get", 5000 ] - }, - "color": "#5D9CEC", - "notes": "### Configuration\n\n- __GET /db__\n- flags: undefined\n- maximum request data length: __5 kB__\n- empty response: __undefined__\n- cache policy: __no cache__\n- cache expire: __5 minutes__", - "cloning": false + } }, { "id": "1619784672383", @@ -871,12 +871,12 @@ "text": "", "color": "gray" }, - "options": { - "data": "{command: \"turnOnAlarm\"}", - "datatype": "object" - }, "color": "#F6BB42", - "notes": "" + "notes": "", + "options": { + "datatype": "object", + "data": "{command: \"turnOnAlarm\"}" + } }, { "id": "1619784812964", @@ -901,12 +901,12 @@ "text": "", "color": "gray" }, - "options": { - "data": "{command: \"turnOffAlarm\"}", - "datatype": "object" - }, "color": "#F6BB42", - "notes": "" + "notes": "", + "options": { + "datatype": "object", + "data": "{command: \"turnOffAlarm\"}" + } }, { "id": "1621340721628", @@ -924,11 +924,11 @@ "text": "modbus_to_dido", "color": "gray" }, + "color": "#303E4D", + "notes": "", "options": { "wirename": "modbus_to_dido" - }, - "color": "#303E4D", - "notes": "" + } }, { "id": "1622640022885", @@ -953,6 +953,9 @@ "text": "Listening", "color": "green" }, + "color": "#5D9CEC", + "notes": "### Configuration\n\n- __POST /db_connector__\n- flags: \n- maximum request data length: __5 kB__\n- empty response: __undefined__\n- cache policy: __no cache__\n- cache expire: __5 minutes__", + "cloning": false, "options": { "timeout": 5, "cachepolicy": 0, @@ -965,10 +968,7 @@ "post", 5000 ] - }, - "color": "#5D9CEC", - "notes": "### Configuration\n\n- __POST /db_connector__\n- flags: \n- maximum request data length: __5 kB__\n- empty response: __undefined__\n- cache policy: __no cache__\n- cache expire: __5 minutes__", - "cloning": false + } }, { "id": "1622640073521", @@ -993,11 +993,11 @@ "text": "", "color": "gray" }, + "color": "#2134B0", + "notes": "", "options": { "edge": "undefined" - }, - "color": "#2134B0", - "notes": "" + } }, { "id": "1622641420685", @@ -1015,9 +1015,9 @@ "text": "", "color": "gray" }, - "options": {}, "color": "#5D9CEC", - "notes": "" + "notes": "", + "options": {} }, { "id": "1634303504177", @@ -1039,15 +1039,15 @@ "output": [] }, "state": { - "text": "870.85 MB / 985.68 MB", + "text": "776.75 MB / 987.80 MB", "color": "gray" }, + "color": "#F6BB42", + "notes": "", "options": { "enabled": true, "interval": 30000 - }, - "color": "#F6BB42", - "notes": "" + } }, { "id": "1634303533779", @@ -1069,16 +1069,16 @@ "output": [] }, "state": { - "text": "5.78 GB / 7.26 GB", + "text": "5.79 GB / 7.26 GB", "color": "gray" }, + "color": "#F6BB42", + "notes": "", "options": { "enabled": true, "path": "/", "interval": 30000 - }, - "color": "#F6BB42", - "notes": "" + } }, { "id": "1634303595494", @@ -1107,11 +1107,11 @@ "text": "send-to-services", "color": "gray" }, + "color": "#303E4D", + "notes": "", "options": { "wirename": "send-to-services" - }, - "color": "#303E4D", - "notes": "" + } }, { "id": "1634303602169", @@ -1129,19 +1129,19 @@ "text": "send-to-services", "color": "gray" }, + "color": "#303E4D", + "notes": "", "options": { "wirename": "send-to-services" - }, - "color": "#303E4D", - "notes": "" + } }, { "id": "1634303685503", "component": "virtualwireout", "tab": "1612772287426", "name": "send-to-services", - "x": 740.8833312988281, - "y": 341.5, + "x": 650.8833312988281, + "y": 355.5, "connections": {}, "disabledio": { "input": [], @@ -1151,11 +1151,11 @@ "text": "send-to-services", "color": "gray" }, + "color": "#303E4D", + "notes": "", "options": { "wirename": "send-to-services" - }, - "color": "#303E4D", - "notes": "" + } }, { "id": "1634303743260", @@ -1181,13 +1181,13 @@ "text": "", "color": "gray" }, - "options": { - "stringify": "json", - "method": "POST", - "url": "http://192.168.252.2:8004/sentmessage" - }, "color": "#5D9CEC", - "notes": "" + "notes": "", + "options": { + "url": "http://192.168.252.2:8004/sentmessage", + "method": "POST", + "stringify": "json" + } }, { "id": "1634463186563", @@ -1207,13 +1207,13 @@ "text": "Enabled", "color": "gray" }, + "color": "#967ADC", + "notes": "", "options": { "type": "data", "repository": false, "enabled": true - }, - "color": "#967ADC", - "notes": "" + } }, { "id": "1634464580289", @@ -1242,13 +1242,13 @@ "text": "", "color": "gray" }, + "color": "#656D78", + "notes": "", "options": { "keepmessage": true, "code": "let response = {};\nresponse.cpu = value.cpu;\nresponse.uptime = value.uptime;\n\nsend(0, response);", "outputs": 1 - }, - "color": "#656D78", - "notes": "" + } }, { "id": "1634465243324", @@ -1268,13 +1268,13 @@ "text": "Enabled", "color": "gray" }, + "color": "#967ADC", + "notes": "", "options": { "type": "data", "repository": false, "enabled": true - }, - "color": "#967ADC", - "notes": "" + } }, { "id": "1634465281992", @@ -1303,13 +1303,13 @@ "text": "", "color": "gray" }, + "color": "#656D78", + "notes": "", "options": { "keepmessage": true, "code": "value.sender = \"ram\";\n//let total = value.total/1024/1024;\n//let free = value.free/1024/1024;\n//let used = value.used/1024/1024;\nlet response = {};\n//value.memory_total = (total).toFixed(0) + ' MB';\n//value.memory_free = (free).toFixed(0) + ' MB';\n//value.memory_used = (used).toFixed(0) + ' MB';\n\nresponse.memory_total = value.total;\nresponse.memory_free = value.free;\nresponse.memory_used = value.used;\n\nsend(0, response);", "outputs": 1 - }, - "color": "#656D78", - "notes": "" + } }, { "id": "1634465338103", @@ -1329,13 +1329,13 @@ "text": "Enabled", "color": "gray" }, + "color": "#967ADC", + "notes": "", "options": { "type": "data", "repository": false, "enabled": true - }, - "color": "#967ADC", - "notes": "" + } }, { "id": "1634465821120", @@ -1364,13 +1364,13 @@ "text": "", "color": "gray" }, + "color": "#656D78", + "notes": "", "options": { "keepmessage": true, "code": "value.sender = \"hdd\";\n//let total = value.total/1024/1024;\n//let free = value.free/1024/1024;\n//let used = value.used/1024/1024;\nlet response = {};\n//value.hdd_total = (total).toFixed(0) + ' MB';\n//value.hdd_free = (free).toFixed(0) + ' MB';\n//value.used = (used).toFixed(0) + ' MB';\n\nresponse.hdd_total = value.total;\nresponse.hdd_free = value.free;\nresponse.hdd_used = value.used;\n\nsend(0, response);", "outputs": 1 - }, - "color": "#656D78", - "notes": "" + } }, { "id": "1634465892500", @@ -1390,13 +1390,13 @@ "text": "Enabled", "color": "gray" }, + "color": "#967ADC", + "notes": "", "options": { "type": "data", "repository": false, "enabled": true - }, - "color": "#967ADC", - "notes": "" + } }, { "id": "1634484067516", @@ -1416,13 +1416,13 @@ "text": "Enabled", "color": "gray" }, + "color": "#967ADC", + "notes": "", "options": { "type": "data", "repository": false, "enabled": true - }, - "color": "#967ADC", - "notes": "" + } }, { "id": "1634488120710", @@ -1451,11 +1451,11 @@ "text": "", "color": "gray" }, + "color": "#2134B0", + "notes": "", "options": { "edge": "undefined" - }, - "color": "#2134B0", - "notes": "" + } }, { "id": "1635327431236", @@ -1475,13 +1475,13 @@ "text": "Enabled", "color": "gray" }, + "color": "#967ADC", + "notes": "", "options": { "type": "data", "repository": false, "enabled": true - }, - "color": "#967ADC", - "notes": "" + } }, { "id": "1635936391935", @@ -1499,11 +1499,11 @@ "text": "send-to-services", "color": "gray" }, + "color": "#303E4D", + "notes": "", "options": { "wirename": "send-to-services" - }, - "color": "#303E4D", - "notes": "" + } }, { "id": "1637069803394", @@ -1525,9 +1525,11 @@ "output": [] }, "state": { - "text": "12.8% / 71.62 MB", + "text": "1.5% / 72.32 MB", "color": "gray" }, + "color": "#967ADC", + "notes": "", "options": { "monitorfiles": true, "monitorconnections": true, @@ -1535,9 +1537,7 @@ "monitorconsumption": true, "enabled": true, "interval": 30000 - }, - "color": "#967ADC", - "notes": "" + } }, { "id": "1683664161036", @@ -1557,13 +1557,13 @@ "text": "Enabled", "color": "gray" }, + "color": "#967ADC", + "notes": "", "options": { "type": "data", "repository": false, "enabled": true - }, - "color": "#967ADC", - "notes": "" + } }, { "id": "1683981346282", @@ -1592,11 +1592,11 @@ "text": "from-dido-controller", "color": "gray" }, + "color": "#303E4D", + "notes": "", "options": { "wirename": "from-dido-controller" - }, - "color": "#303E4D", - "notes": "" + } }, { "id": "1684055037116", @@ -1616,13 +1616,13 @@ "text": "Enabled", "color": "gray" }, + "color": "#967ADC", + "notes": "", "options": { "type": "data", "repository": false, "enabled": true - }, - "color": "#967ADC", - "notes": "" + } }, { "id": "1684060205000", @@ -1642,13 +1642,13 @@ "text": "Enabled", "color": "gray" }, + "color": "#967ADC", + "notes": "", "options": { "type": "data", "repository": false, "enabled": true - }, - "color": "#967ADC", - "notes": "" + } }, { "id": "1684179110403", @@ -1666,13 +1666,13 @@ "text": "Enabled", "color": "gray" }, + "color": "#967ADC", + "notes": "", "options": { "type": "data", "repository": false, "enabled": true - }, - "color": "#967ADC", - "notes": "" + } }, { "id": "1699963668903", @@ -1713,11 +1713,11 @@ "text": "", "color": "gray" }, + "color": "#2134B0", + "notes": "", "options": { "edge": "undefined" - }, - "color": "#2134B0", - "notes": "" + } }, { "id": "1699964678894", @@ -1746,11 +1746,11 @@ "text": "modbus_to_dido", "color": "gray" }, + "color": "#303E4D", + "notes": "", "options": { "wirename": "modbus_to_dido" - }, - "color": "#303E4D", - "notes": "" + } }, { "id": "1699964793925", @@ -1770,13 +1770,13 @@ "text": "Enabled", "color": "gray" }, + "color": "#967ADC", + "notes": "", "options": { "type": "data", "repository": false, "enabled": true - }, - "color": "#967ADC", - "notes": "" + } }, { "id": "1699965957410", @@ -1825,9 +1825,9 @@ "text": "", "color": "gray" }, - "options": {}, "color": "#2134B0", - "notes": "" + "notes": "", + "options": {} }, { "id": "1700411878636", @@ -1872,9 +1872,9 @@ "text": "", "color": "gray" }, - "options": {}, "color": "#5CB36D", - "notes": "" + "notes": "", + "options": {} }, { "id": "1714752862828", @@ -1892,13 +1892,13 @@ "text": "Enabled", "color": "gray" }, + "color": "#967ADC", + "notes": "", "options": { "type": "data", "repository": false, "enabled": true - }, - "color": "#967ADC", - "notes": "" + } }, { "id": "1717441414646", @@ -1927,13 +1927,13 @@ "text": "", "color": "gray" }, + "color": "#656D78", + "notes": "", "options": { "keepmessage": true, "code": "if(value.hasOwnProperty(\"status\"))\n{\n\tif(value.status.includes(\"-em\"))\n\t{\n\t\tsend(0, {\"em_status\": \"NOK\"});\n\t}\n\telse if(value.status.includes(\"twilight\"))\n\t{\n\t\tsend(0, {\"lux_sensor\": \"NOK\"});\n\t}\n}\n\nif(value.hasOwnProperty(\"values\"))\n{\n\tif(value.values.hasOwnProperty(\"twilight_sensor\"))\n\t{\n\t\tsend(0, {\"lux_sensor\": \"OK\"});\n\t}\n\telse if(value.values.hasOwnProperty(\"Phase_1_power\") ||\n\t\t\tvalue.values.hasOwnProperty(\"Phase_1_voltage\") ||\n\t\t\tvalue.values.hasOwnProperty(\"Total_power\") ||\n\t\t\tvalue.values.hasOwnProperty(\"Phase_1_current\"))\n\t{\n\t\tsend(0, {\"em_status\": \"OK\"});\n\t}\n}", "outputs": 1 - }, - "color": "#656D78", - "notes": "" + } }, { "id": "1717442627834", @@ -1953,13 +1953,13 @@ "text": "Enabled", "color": "gray" }, + "color": "#967ADC", + "notes": "", "options": { "type": "data", "repository": false, "enabled": true - }, - "color": "#967ADC", - "notes": "" + } }, { "id": "1717442631338", @@ -1977,11 +1977,11 @@ "text": "send-to-services", "color": "gray" }, + "color": "#303E4D", + "notes": "", "options": { "wirename": "send-to-services" - }, - "color": "#303E4D", - "notes": "" + } }, { "id": "1718016045116", @@ -2006,11 +2006,11 @@ "text": "tb-push", "color": "gray" }, + "color": "#303E4D", + "notes": "", "options": { "wirename": "tb-push" - }, - "color": "#303E4D", - "notes": "" + } }, { "id": "1718016052341", @@ -2039,15 +2039,15 @@ "text": "Running", "color": "gray" }, + "color": "#30E193", + "notes": "", "options": { "slack_channel": "C071KN2Q8SK", "tag_on_include": "[{\"user_id\":\"U072JE5JUQG\", \"includes\":[\"Electrometer\", \"Twilight sensor\"]}]", "message_includes": "[\"is responding again\", \"Lamps have turned\", \"Flow has been restarted\", \"Node db has changed\"]", "types": "[\"emergency\", \"critical\", \"error\", \"alert\"]", - "name": "rvo_senica_35_10.0.0.129" - }, - "color": "#30E193", - "notes": "" + "name": "al_shariff_10.0.0.38" + } }, { "id": "1718016073501", @@ -2072,13 +2072,13 @@ "text": "", "color": "gray" }, - "options": { - "stringify": "json", - "method": "POST", - "url": "http://192.168.252.2:8004/slack" - }, "color": "#5D9CEC", - "notes": "" + "notes": "", + "options": { + "url": "http://192.168.252.2:8004/slack", + "method": "POST", + "stringify": "json" + } }, { "id": "1718016086212", @@ -2098,13 +2098,13 @@ "text": "Enabled", "color": "gray" }, + "color": "#967ADC", + "notes": "", "options": { "type": "data", "repository": false, "enabled": true - }, - "color": "#967ADC", - "notes": "" + } }, { "id": "1718016094070", @@ -2129,20 +2129,20 @@ "text": "", "color": "gray" }, - "options": { - "datatype": "object", - "data": "{ \"g9OxBZ5KRwNznlY6pAppqEAWXvjdEL4eGQobMDy2\": [ { \"ts\": 1716289039281, \"values\": { \"_event\": { \"type\": \"alert\", \"status\": \"new\", \"source\": { \"func\": \"CMD Manager: process cmd\", \"component\": \"1619515097737\", \"component_name\": \"CMD Manager\", \"edge\": \"g9OxBZ5KRwNznlY6pAppqEAWXvjdEL4eGQobMDy2\" }, \"message\": \"NOW CONNECTED TO SLACK !\", \"message_data\": \"\" } } } ] }" - }, "color": "#F6BB42", - "notes": "" + "notes": "", + "options": { + "data": "{ \"g9OxBZ5KRwNznlY6pAppqEAWXvjdEL4eGQobMDy2\": [ { \"ts\": 1716289039281, \"values\": { \"_event\": { \"type\": \"alert\", \"status\": \"new\", \"source\": { \"func\": \"CMD Manager: process cmd\", \"component\": \"1619515097737\", \"component_name\": \"CMD Manager\", \"edge\": \"g9OxBZ5KRwNznlY6pAppqEAWXvjdEL4eGQobMDy2\" }, \"message\": \"NOW CONNECTED TO SLACK !\", \"message_data\": \"\" } } } ] }", + "datatype": "object" + } }, { "id": "1729855334955", "component": "virtualwireout", "tab": "1612772287426", "name": "platform-rpc-call", - "x": 1062.933334350586, - "y": 532.3500061035156, + "x": 649.9333343505859, + "y": 541.3500061035156, "connections": {}, "disabledio": { "input": [], @@ -2152,19 +2152,19 @@ "text": "platform-rpc-call", "color": "gray" }, + "color": "#303E4D", + "notes": "", "options": { "wirename": "platform-rpc-call" - }, - "color": "#303E4D", - "notes": "" + } }, { "id": "1729855371093", "component": "debug", "tab": "1612772287426", "name": "rpc cloud", - "x": 1063.933334350586, - "y": 442.3500061035156, + "x": 650.9333343505859, + "y": 451.3500061035156, "connections": {}, "disabledio": { "input": [], @@ -2174,13 +2174,13 @@ "text": "Enabled", "color": "gray" }, + "color": "#967ADC", + "notes": "", "options": { "type": "data", "repository": false, "enabled": true - }, - "color": "#967ADC", - "notes": "" + } }, { "id": "1731068658334", @@ -2188,7 +2188,7 @@ "tab": "1612772287426", "name": "db-init", "x": 90.75, - "y": 247, + "y": 250, "connections": { "0": [ { @@ -2205,19 +2205,19 @@ "text": "db-init", "color": "gray" }, + "color": "#303E4D", + "notes": "", "options": { "wirename": "db-init" - }, - "color": "#303E4D", - "notes": "" + } }, { "id": "1731068754606", "component": "cloudmqttconnect", "tab": "1612772287426", "name": "MQTT client - to senica-prod01", - "x": 742.75, - "y": 520, + "x": 304.75, + "y": 474, "connections": { "1": [ { @@ -2235,18 +2235,18 @@ "output": [] }, "state": { - "text": "Connected", - "color": "green" + "text": "Reconnecting", + "color": "yellow" }, + "color": "#888600", + "notes": "", "options": { "username": "", "clientid": "", "port": "2764", "host": "192.168.252.2", - "topic": "u129" - }, - "color": "#888600", - "notes": "" + "topic": "" + } }, { "id": "1731069001548", @@ -2271,9 +2271,9 @@ "text": "", "color": "gray" }, - "options": {}, "color": "#888600", - "notes": "" + "notes": "", + "options": {} }, { "id": "1731069033416", @@ -2291,11 +2291,11 @@ "text": "db-init", "color": "gray" }, + "color": "#303E4D", + "notes": "", "options": { "wirename": "db-init" - }, - "color": "#303E4D", - "notes": "" + } }, { "id": "1731069059135", @@ -2320,9 +2320,9 @@ "text": "", "color": "gray" }, - "options": {}, "color": "#888600", - "notes": "" + "notes": "", + "options": {} }, { "id": "1731069079243", @@ -2340,13 +2340,13 @@ "text": "Enabled", "color": "gray" }, + "color": "#967ADC", + "notes": "", "options": { "type": "data", "repository": false, "enabled": true - }, - "color": "#967ADC", - "notes": "" + } }, { "id": "1731069116691", @@ -2371,9 +2371,9 @@ "text": "", "color": "gray" }, - "options": {}, "color": "#F6BB42", - "notes": "" + "notes": "", + "options": {} }, { "id": "1731069131637", @@ -2398,9 +2398,9 @@ "text": "", "color": "gray" }, - "options": {}, "color": "#F6BB42", - "notes": "" + "notes": "", + "options": {} }, { "id": "1731069137374", @@ -2425,9 +2425,9 @@ "text": "", "color": "gray" }, - "options": {}, "color": "#F6BB42", - "notes": "" + "notes": "", + "options": {} }, { "id": "1731069179846", @@ -2452,9 +2452,9 @@ "text": "", "color": "gray" }, - "options": {}, "color": "#F6BB42", - "notes": "" + "notes": "", + "options": {} }, { "id": "1731069192937", @@ -2479,9 +2479,9 @@ "text": "", "color": "gray" }, - "options": {}, "color": "#F6BB42", - "notes": "" + "notes": "", + "options": {} }, { "id": "1731069264443", @@ -2506,11 +2506,11 @@ "text": "db-init", "color": "gray" }, + "color": "#303E4D", + "notes": "", "options": { "wirename": "db-init" - }, - "color": "#303E4D", - "notes": "" + } }, { "id": "1731069334626", @@ -2535,11 +2535,11 @@ "text": "db-init", "color": "gray" }, + "color": "#303E4D", + "notes": "", "options": { "wirename": "db-init" - }, - "color": "#303E4D", - "notes": "" + } }, { "id": "1731069548145", @@ -2564,11 +2564,11 @@ "text": "db-init", "color": "gray" }, + "color": "#303E4D", + "notes": "", "options": { "wirename": "db-init" - }, - "color": "#303E4D", - "notes": "" + } }, { "id": "1731069567152", @@ -2593,11 +2593,11 @@ "text": "db-init", "color": "gray" }, + "color": "#303E4D", + "notes": "", "options": { "wirename": "db-init" - }, - "color": "#303E4D", - "notes": "" + } }, { "id": "1731070156936", @@ -2622,11 +2622,11 @@ "text": "db-init", "color": "gray" }, + "color": "#303E4D", + "notes": "", "options": { "wirename": "db-init" - }, - "color": "#303E4D", - "notes": "" + } }, { "id": "1731234189516", @@ -2651,9 +2651,9 @@ "text": "", "color": "gray" }, - "options": {}, "color": "#F6BB42", - "notes": "" + "notes": "", + "options": {} }, { "id": "1731234189551", @@ -2678,9 +2678,9 @@ "text": "", "color": "gray" }, - "options": {}, "color": "#F6BB42", - "notes": "" + "notes": "", + "options": {} }, { "id": "1732700042559", @@ -2709,9 +2709,9 @@ "text": "", "color": "gray" }, - "options": {}, "color": "#888600", - "notes": "" + "notes": "", + "options": {} }, { "id": "1732700057052", @@ -2736,11 +2736,11 @@ "text": "db-init", "color": "gray" }, + "color": "#303E4D", + "notes": "", "options": { "wirename": "db-init" - }, - "color": "#303E4D", - "notes": "" + } }, { "id": "1732700071298", @@ -2758,13 +2758,13 @@ "text": "Enabled", "color": "gray" }, + "color": "#967ADC", + "notes": "", "options": { "type": "data", "repository": false, "enabled": true - }, - "color": "#967ADC", - "notes": "" + } }, { "id": "1732700642917", @@ -2782,11 +2782,11 @@ "text": "tb-push", "color": "gray" }, + "color": "#303E4D", + "notes": "", "options": { "wirename": "tb-push" - }, - "color": "#303E4D", - "notes": "" + } }, { "id": "1732889185927", @@ -2804,21 +2804,21 @@ "text": "Enabled", "color": "gray" }, + "color": "#967ADC", + "notes": "", "options": { "type": "data", "repository": false, "enabled": true - }, - "color": "#967ADC", - "notes": "" + } }, { "id": "1733574412965", "component": "virtualwirein", "tab": "1612772287426", "name": "db-init", - "x": 557.75, - "y": 574, + "x": 86.75, + "y": 495, "connections": { "0": [ { @@ -2835,38 +2835,12 @@ "text": "db-init", "color": "gray" }, + "color": "#303E4D", + "notes": "", "options": { "wirename": "db-init" - }, - "color": "#303E4D", - "notes": "" - }, - { - "id": "1733574445563", - "component": "debug", - "tab": "1612772287426", - "name": "toCloudRado", - "x": 740.75, - "y": 435, - "connections": {}, - "disabledio": { - "input": [ - 0 - ], - "output": [] - }, - "state": { - "text": "Enabled", - "color": "gray" - }, - "options": { - "type": "data", - "repository": false, - "enabled": true - }, - "color": "#967ADC", - "notes": "" + } } ], - "version": 615 -} \ No newline at end of file + "version": 618 +} diff --git a/flow/notifikacie.csv b/flow/notifikacie.csv deleted file mode 100644 index 520c997..0000000 --- a/flow/notifikacie.csv +++ /dev/null @@ -1,31 +0,0 @@ -key;weight;en;sk -switching_profile_point_applied_to_line;INFO;Switching profile point applied to line no. ${line} : ${value};Aplikovaný bod spínacieho profilu na línií č. ${line} : ${value} -dusk_has_occured;INFO;Dusk has occured;Nastal súmrak -dawn_has_occured;INFO;Dawn has occured;Nastal úsvit -dimming_profile_was_successfully_received_by_node;NOTICE;Dimming profile was successfully received by node no. ${node};Stmievací profil bol úspešne prijatý nodom č. ${node} -master_node_is_responding_again;NOTICE;Master node is responding again;Master node začal znovu odpovedať -command_was_sent_from_terminal_interface;DEBUG;A command was sent from terminal interface;Z terminálu bol odoslaný príkaz -master_node_is_not_responding;ALERT;Master node is not responding;Master node neodpovedá -configuration_of_dimming_profile_to_node_failed;ALERT;Configuration of dimming profile to node no. ${node} has failed;Konfigurácia stmievacieho profilu pre node č. ${node} zlyhala -circuit_breaker_was_turned_on_line;NOTICE;Circuit breaker was turned on - line no. ${line};Zapnutie ističa na línii č. ${line} -circuit_breaker_was_turned_off_line;ERROR;Circuit breaker was turned off - line no. ${line};Vypnutie ističa na línií č. ${line} -dimming_profile_was_processed_for_node;INFO;Dimming profile was processed for node no. ${node};Stmievací profil bol spracovaný pre node č. ${node} -switching_profile_was_processed_for_line;INFO;Switching profile was processed for line no. ${line};Spínací profil bol spracovaný pre líniu č. ${line} -thermometer_is_not_responding;WARNING;Thermometer is not responding;Teplomer neodpovedá -thermometer_is_responding_again;NOTICE;Thermometer is responding again;Teplomer znovu odpovedá -thermometer_sends_invalid_data;WARNING;Thermometer sends invalid data;Teplomer posiela neplatné hodnoty -main_switch_has_been_turned_off;CRITICAL;Main switch has been turned off;Hlavný vypínač bol vypnutý -main_switch_has_been_turned_on;NOTICE;Main switch has been turned on;Hlavný vypínač bol zapnutý -power_supply_has_disconnected_input;ALERT;Power supply has disconnected input;Napájací zdroj nemá napätie na vstupe -power_supply_works_correctly;NOTICE;Power supply works correctly ;Napájací zdroj pracuje správne -battery_level_is_low;ERROR;Battery level is low;Batéria má nízku úroveň napätia -battery_level_is_ok;NOTICE;Battery level is OK;Batéria má správnu úroveň napätia -door_has_been_open;NOTICE;Door has been open;Dvere boli otvorené -door_has_been_closed;NOTICE;Door has been closed;Dvere boli zatvorené -door_has_been_open_without_permision_alarm_is_on;WARNING;Door has been open without permision - alarm is on;Dvere boli otvorené bez povolania - zapnutá siréna -state_of_contactor_for_line;INFO;State of contactor for line no. ${line} is ${value};Stav stýkača pre líniu č. ${line} je ${value} -local_database_is_corrupted;CRITICAL;; -electrometer_is_not_responding;ERROR;Electrometer is not responding;Elektromer neodpovedá -no_voltage_detected_on_phase;CRITICAL;No voltage detected on phase no. ${phase};Na fáze č. ${phase} nie je napätie -electrometer_is_responding_again;NOTICE;Electrometer is responding again;Elektromer znovu odpovedá -voltaga_on_phase_has_been_restored;NOTICE;Voltaga on phase no. ${phase} has been restored;Napätie na fáze č. ${phase} bolo obnovené diff --git a/flow/variables.txt b/flow/variables.txt deleted file mode 100644 index e69de29..0000000 diff --git a/flow/wsmqttpublish.js b/flow/wsmqttpublish.js index e11d9eb..b2a218d 100644 --- a/flow/wsmqttpublish.js +++ b/flow/wsmqttpublish.js @@ -5,7 +5,7 @@ exports.color = '#888600'; exports.version = '1.0.2'; exports.icon = 'sign-out'; exports.input = 2; -exports.output = 4; +exports.output = 3; exports.options = { host: 'tb-stage.worksys.io', port: 1883, clientid: "", username: "" }; exports.html = `
@@ -209,19 +209,12 @@ exports.install = function(instance) { instance.send(SEND_TO.rpcCall, {"topic":topic, "content":message }); }); - client.on('close', function(err) { + client.on('close', function() { clientReady = false; wsmqtt_status = 'disconnected'; - - if (err && err.toString().indexOf('Error')) { - instance.status("Err: "+err.code, "red"); - instance.send(SEND_TO.debug, {"message":"Client CLOSE signal received !", "error":err, "opt":opts }); - } else { - instance.status("Disconnected", "red"); - instance.send(SEND_TO.debug, {"message":"Client CLOSE signal received !", "error":err, "opt":opts }); - } - - client.reconnect(); + + instance.status("Disconnected", "red"); + instance.send(SEND_TO.debug, {"message":"Client CLOSE signal received !"}); }); client.on('error', function(err) { @@ -247,22 +240,16 @@ exports.install = function(instance) { if(clientReady) { - //do we have some data in backup file? - //if any, process data from database + //do we have some data in backup file? if any, process data from database if(saveTelemetryOnError) { //read telemetry data and send back to server if(!processingData) processDataFromDatabase(); } - } - - if(clientReady) - { + let stringifiedJson = JSON.stringify(data.data); client.publish("v1/gateway/telemetry", stringifiedJson, {qos: 1}); - instance.send(3, stringifiedJson); - //backup telemetry if(createTelemetryBackup) { @@ -285,7 +272,6 @@ exports.install = function(instance) { } else { - //logger.debug("Client unavailable. Data not sent !", JSON.stringify(data.data)); instance.send(SEND_TO.debug, {"message":"Client unavailable. Data not sent !", "data": data.data }); @@ -298,7 +284,6 @@ exports.install = function(instance) { data.data.id = UID(); nosql.insert(data.data); } - } }); @@ -445,12 +430,10 @@ exports.install = function(instance) { try { - let o = JSON.parse(JSON.stringify(item)); - delete o.id; - let message = JSON.stringify(o); + let message = JSON.parse(JSON.stringify(item)); + delete message.id; - client.publish("v1/gateway/telemetry", message, {qos:1}); - instance.send(3, message); + client.publish("v1/gateway/telemetry", JSON.stringify(message), {qos:1}); //remove from database await promisifyBuilder(nosql.remove().where("id", id)); @@ -460,7 +443,6 @@ exports.install = function(instance) { console.log("processDataFromDatabase", error); } - } } diff --git a/package.json b/package.json index e524d7c..7f7c795 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,7 @@ "easy-crc": "0.0.2", "jsmodbus": "^4.0.6", "log4js": "^6.3.0", + "moment": "^2.30.1", "mqtt": "^4.2.6", "nodemailer": "^6.9.7", "serialport": "^9.2.8",