New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

node-red-contrib-knx-ultimate

Package Overview
Dependencies
Maintainers
1
Versions
461
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-red-contrib-knx-ultimate - npm Package Compare versions

Comparing version

to
1.0.6

4

CHANGELOG.md
# node-red-contrib-knx-ultimate
<p>
<b>Version 1.0.5</b><br/>
- Fixed the fix for the typo error causing a mess<br/>
</p>
<p>
<b>Version 1.0.5</b><br/>
- Fixed a typo error causing a mess<br/>

@@ -5,0 +9,0 @@ </p>

96

knxUltimate-config.js

@@ -62,3 +62,3 @@ const knx = require('knx')

node.port = config.port
node.csv = toJsonCSV(config.csvincollato); // Array from ETS CSV Group Addresses
node.csv = readCSV(); // Array from ETS CSV Group Addresses

@@ -258,54 +258,56 @@ // Entry point for reading csv from the other nodes

function toJsonCSV(_csvText) {
var ajsonOutput = new Array(); // Array: qui va l'output totale con i nodi per node-red
if (_csvText == "") {
RED.log.info('knxUltimate: no csv ETS found');
return ajsonOutput;
} else {
RED.log.info('knxUltimate: csv ETS found !');
// Read and decode the CSV in an Array containing: "group address", "DPT", "Device Name"
let fileGA = _csvText.split("\n");
// Controllo se le righe dei gruppi contengono il separatore di tabulazione
if (fileGA[0].search("\t") == -1) {
RED.log.error('knxUltimate: ERROR: the csv ETS file must have the tabulation as separator')
function readCSV() {
try {
var ajsonOutput = []; // Array: qui va l'output totale con i nodi per node-red
var _csvText = config.csvincollato;
if (_csvText == "") {
RED.log.info('knxUltimate: no csv ETS found');
return ajsonOutput;
}
for (let index = 0; index < fileGA.length; index++) {
const element = fileGA[index].replace(/\"/g, ""); // Rimuovo le virgolette
if (element !== "") {
if (element.split("\t")[1].search("-") == -1 && element.split("\t")[1].search("/") !== -1) {
// Ho trovato una riga contenente un GA valido, cioè con 2 "/"
if (element.split("\t")[5] == "") {
RED.log.error("knxUltimate: ERROR: Datapoint not set in ETS CSV. Please set the datapoint with ETS and export the group addresses again. ->" + element.split("\t")[0] + " " + element.split("\t")[1])
return ajsonOutput;
} else {
RED.log.info('knxUltimate: csv ETS found !');
// Read and decode the CSV in an Array containing: "group address", "DPT", "Device Name"
let fileGA = _csvText.split("\n");
// Controllo se le righe dei gruppi contengono il separatore di tabulazione
if (fileGA[0].search("\t") == -1) {
RED.log.error('knxUltimate: ERROR: the csv ETS file must have the tabulation as separator')
return ajsonOutput;
}
for (let index = 0; index < fileGA.length; index++) {
const element = fileGA[index].replace(/\"/g, ""); // Rimuovo le virgolette
if (element !== "") {
if (element.split("\t")[1].search("-") == -1 && element.split("\t")[1].search("/") !== -1) {
// Ho trovato una riga contenente un GA valido, cioè con 2 "/"
if (element.split("\t")[5] == "") {
RED.log.error("knxUltimate: ERROR: Datapoint not set in ETS CSV. Please set the datapoint with ETS and export the group addresses again. ->" + element.split("\t")[0] + " " + element.split("\t")[1])
return ajsonOutput;
}
var DPTa = element.split("\t")[5].split("-")[1];
var DPTb = "";
try {
DPTb = element.split("\t")[5].split("-")[2];
} catch (error) {
DPTb = "001"; // default
}
if (!DPTb) {
RED.log.warn("knxUltimate: WARNING: Datapoint not fully set (there is only the first part on the left of the '.'). I applied a default .001, but please set the datapoint with ETS and export the group addresses again. ->" + element.split("\t")[0] + " " + element.split("\t")[1] + " Datapoint: " + element.split("\t")[5]);
DPTb = "001"; // default
}
// Trailing zeroes
if (DPTb.length == 1) {
DPTb = "00" + DPTb;
} else if (DPTb.length == 2) {
DPTb = "0" + DPTb;
} if (DPTb.length == 3) {
DPTb = "" + DPTb; // stupid, but for readability
}
ajsonOutput.push({ ga: element.split("\t")[1], dpt: DPTa + "." + DPTb, devicename: element.split("\t")[0] });
}
var DPTa = element.split("\t")[5].split("-")[1];
var DPTb = "";
try {
DPTb = element.split("\t")[5].split("-")[2];
} catch (error) {
DPTb = "001"; // default
}
if (!DPTb) {
RED.log.warn("knxUltimate: WARNING: Datapoint not fully set (there is only the first part on the left of the '.'). I applied a default .001, but please set the datapoint with ETS and export the group addresses again. ->" + element.split("\t")[0] + " " + element.split("\t")[1] + " Datapoint: " + element.split("\t")[5]);
retLog += "knxUltimate: WARNING: Datapoint not fully set (there is only the first part on the left of the '.'). I applied a default .001, but please set the datapoint with ETS and export the group addresses again. ->" + element.split("\t")[0] + " " + element.split("\t")[1] + " Datapoint: " + element.split("\t")[5] + "<br />"
DPTb = "001"; // default
}
// Trailing zeroes
if (DPTb.length == 1) {
DPTb = "00" + DPTb;
} else if (DPTb.length == 2) {
DPTb = "0" + DPTb;
} if (DPTb.length == 3) {
DPTb = "" + DPTb; // stupid, but for readability
}
ajsonOutput.push({ ga: element.split("\t")[1], dpt: DPTa + "." + DPTb, devicename: element.split("\t")[0] });
}
}
return ajsonOutput;
}
return ajsonOutput;
} catch (error) {
}
}

@@ -312,0 +314,0 @@

{
"name": "node-red-contrib-knx-ultimate",
"version": "1.0.5",
"version": "1.0.6",
"description": "Single Node KNX IN/OUT with optional ETS group address importer.",

@@ -5,0 +5,0 @@ "dependencies": {