node-red-contrib-knx-ultimate 1.3.11 → 1.3.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1 -1
- package/KNXEngine/protocol/KNXUtils.js +11 -3
- package/nodes/knxUltimate-config.js +0 -13
- package/nodes/knxUltimate.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -16,18 +16,26 @@ const validateKNXAddress = (address, isGroup = false) => {
|
|
|
16
16
|
// 22/12/2021 Supergiovane: https://support.knx.org/hc/en-us/articles/115003188109-Group-Addresses
|
|
17
17
|
if (typeof (address) === 'string') {
|
|
18
18
|
const digits = address.split(/[./]/);
|
|
19
|
-
if (digits.length
|
|
19
|
+
if (digits.length < 2 || digits.length > 3) {
|
|
20
20
|
throw new Error(`Invalid address format: ${address} Only 3 level addresses are allowed`);
|
|
21
21
|
}
|
|
22
|
+
if ((digits.length === 3 && address === "0/0/0") || (digits.length === 1 && address === "0/0")) throw new Error(`Invalid address: ${address}`);
|
|
23
|
+
|
|
22
24
|
let count = 0;
|
|
23
25
|
let newAddress = 0;
|
|
24
26
|
for (let i = digits.length - 1; i >= 0; i--, count++) {
|
|
25
27
|
const digit = Number(digits[i]);
|
|
26
|
-
if (isGroup) {
|
|
28
|
+
if (isGroup && digits.length === 3) {
|
|
27
29
|
// Validating Group Address
|
|
28
30
|
if (isNaN(digit) || (count === 2 && digit > 31) || (count === 1 && digit > 7) || (count === 0 && digit > 255)) {
|
|
29
31
|
// 22/12/2021 Supergiovane disabled digits validation
|
|
30
|
-
throw new Error(`Invalid GA digit ${digit} inside address: ${address}`);
|
|
32
|
+
throw new Error(`Invalid 3 levels GA digit ${digit} inside address: ${address}`);
|
|
33
|
+
}
|
|
34
|
+
} else if (isGroup && digits.length === 2) {
|
|
35
|
+
// Validating Group Address
|
|
36
|
+
if (isNaN(digit) || (count === 1 && digit > 31) || (count === 0 && digit > 2047)) {
|
|
37
|
+
// 22/12/2021 Supergiovane disabled digits validation
|
|
38
|
+
throw new Error(`Invalid 2 levels GA digit ${digit} inside address: ${address}`);
|
|
31
39
|
}
|
|
32
40
|
} else {
|
|
33
41
|
// Validating KNX Device Address
|
|
@@ -425,19 +425,6 @@ return msg;`, "helplink": "https://github.com/Supergiovane/node-red-contrib-knx-
|
|
|
425
425
|
node.addClient = (_Node) => {
|
|
426
426
|
// Check if node already exists
|
|
427
427
|
if (node.nodeClients.filter(x => x.id === _Node.id).length === 0) {
|
|
428
|
-
// Check if the node has a valid topic and dpt
|
|
429
|
-
if (_Node.listenallga === false) {
|
|
430
|
-
if (_Node.topic === undefined || _Node.dpt === undefined) {
|
|
431
|
-
_Node.setNodeStatus({ fill: "red", shape: "dot", text: "Empty Group Addr. or datapoint.", payload: "", GA: "", dpt: "", devicename: "" })
|
|
432
|
-
return;
|
|
433
|
-
} else {
|
|
434
|
-
// topic must be in format x/x/x
|
|
435
|
-
if (_Node.topic.split("\/").length < 3) {
|
|
436
|
-
_Node.setNodeStatus({ fill: "red", shape: "dot", text: "Wrong group address (topic: " + _Node.topic + ") format.", payload: "", GA: "", dpt: "", devicename: "" })
|
|
437
|
-
return;
|
|
438
|
-
}
|
|
439
|
-
}
|
|
440
|
-
}
|
|
441
428
|
// Add _Node to the clients array
|
|
442
429
|
if (node.autoReconnect) {
|
|
443
430
|
_Node.setNodeStatus({ fill: "grey", shape: "ring", text: "Node initialized.", payload: "", GA: "", dpt: "", devicename: "" });
|
package/nodes/knxUltimate.js
CHANGED
|
@@ -67,7 +67,7 @@ module.exports = function (RED) {
|
|
|
67
67
|
try {
|
|
68
68
|
KNXUtils.validateKNXAddress(node.topic, true)
|
|
69
69
|
} catch (error) {
|
|
70
|
-
node.setNodeStatus({ fill: "red", shape: "dot", text:
|
|
70
|
+
node.setNodeStatus({ fill: "red", shape: "dot", text: error.message, payload: "", GA: node.topic, dpt: "", devicename: "" })
|
|
71
71
|
return;
|
|
72
72
|
}
|
|
73
73
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-red-contrib-knx-ultimate",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.12",
|
|
4
4
|
"description": "Control your KNX intallation via Node-Red! Single Node KNX IN/OUT with optional ETS group address importer. Easy to use and highly configurable.",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"fs": "0.0.1-security",
|