No turnOff on startup; reportOfflineNodeStatus function fix

This commit is contained in:
rasta5man 2025-01-15 22:17:14 +01:00
parent 75bb2794d2
commit fad53c9c01
3 changed files with 49 additions and 68 deletions

View file

@ -767,8 +767,6 @@ exports.install = function(instance) {
const date = Date.now();
// it happens, that some data did not get to tb after sending
// we setTimeout to make more time for db to process telemetry (eg 150 messages at once)
Object.keys(nodesData).forEach((node, index) => {
setTimeout(function() {
@ -776,10 +774,20 @@ exports.install = function(instance) {
//potrebujem nody k danej linii
if (line == nodesData[node].line || line == undefined) {
let tbname = nodesData[node].tbname;
sendTelemetry(values, tbname, date)
const dataToTb = {
[tbname]: [
{
"ts": date,
"values": values
}
]
}
//NOTE: we can not use sendTelemetry function, as it modifies input data (values object)
instance.send(SEND_TO.tb, dataToTb);
}
}, (index + 1) * 1000);
}, (index + 1) * 300);
})
}