version 2025-02-01
This commit is contained in:
parent
ef7817bf22
commit
c052887a1f
11 changed files with 368 additions and 700 deletions
|
|
@ -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
|
||||
|
|
|
@ -32,6 +32,7 @@ exports.html = `<div class="padding">
|
|||
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);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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 = `<div class="padding">
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div data-jc="textbox" data-jc-path="edge" data-jc-config="placeholder:undefined;required:true" class="m">CSV Import</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
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);
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -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"],
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -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é
|
||||
|
|
|
@ -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 = `<div class="padding">
|
||||
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue