node-red-contrib-knx-ultimate 1.3.2 → 1.3.7
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 +13 -0
- package/KNXEngine/KNXClient.js +89 -42
- package/KNXEngine/protocol/KNXDataBuffer.js +2 -1
- package/KNXEngine/protocol/KNXHeader.js +7 -7
- package/KNXEngine/protocol/KNXProtocol.js +1 -1
- package/KNXEngine/protocol/KNXRoutingIndication.js +0 -5
- package/KNXEngine/protocol/cEMI/CEMIFactory.js +20 -2
- package/KNXEngine/protocol/cEMI/CEMIMessage.js +1 -1
- package/KNXEngine/protocol/cEMI/LDataInd.js +1 -1
- package/KNXEngine/protocol/cEMI/NPDU.js +2 -1
- package/knxultimate-api2/src/Connection.js +1 -0
- package/nodes/knxUltimate-config API2.js +8 -17
- package/package.json +1 -1
- package/KNXEngine/a.json +0 -49296
- package/_config.yml +0 -1
- package/examples/Switch a Light ON and OFF.json +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,19 @@
|
|
|
4
4
|
|
|
5
5
|
<br/>
|
|
6
6
|
<p>
|
|
7
|
+
<b>Version 1.3.7</b> - December 2021<br/>
|
|
8
|
+
- FIX: fixed a stupid "Disconnected by Message length mismatch 8/16" error due to a dumb find/replace error in the code.<br/>
|
|
9
|
+
- Added some more log to help resolving issues.<br/>
|
|
10
|
+
</p>
|
|
11
|
+
<p>
|
|
12
|
+
<b>Version 1.3.5 - REMOVED FROM REPO due to "Disconnected by Message length mismatch 8/16" error</b> - December 2021<br/>
|
|
13
|
+
- New KNX Engine has been enabled again, after fixing some glitches.<br/>
|
|
14
|
+
</p>
|
|
15
|
+
<p>
|
|
16
|
+
<b>Version 1.3.4</b> - December 2021<br/>
|
|
17
|
+
- Temporary reverted to old API, due to some little glitches.<br/>
|
|
18
|
+
</p>
|
|
19
|
+
<p>
|
|
7
20
|
<b>Version 1.3.2</b> - December 2021<br/>
|
|
8
21
|
- NEW: config node: you can now gather debug info (there is a button for that) to be sent to the developer to help resolving your issue. Then, please paste the debug infos in your gitHub issue.<br/>
|
|
9
22
|
</p>
|
package/KNXEngine/KNXClient.js
CHANGED
|
@@ -178,14 +178,45 @@ class KNXClient extends EventEmitter {
|
|
|
178
178
|
get channelID() {
|
|
179
179
|
return this._channelID;
|
|
180
180
|
}
|
|
181
|
-
// Transform the plain value "data" into a KNXDataBuffer
|
|
181
|
+
// Transform the plain value "data" into a KNXDataBuffer. The datapoints without "null" are SixBits
|
|
182
|
+
// dataPointsSixBits = {
|
|
183
|
+
// DPT1,
|
|
184
|
+
// DPT2,
|
|
185
|
+
// DPT3,
|
|
186
|
+
// DPT4: null,
|
|
187
|
+
// DPT5,
|
|
188
|
+
// DPT6: null,
|
|
189
|
+
// DPT7: null,
|
|
190
|
+
// DPT8: null,
|
|
191
|
+
// DPT9,
|
|
192
|
+
// DPT10,
|
|
193
|
+
// DPT11,
|
|
194
|
+
// DPT12: null,
|
|
195
|
+
// DPT13: null,
|
|
196
|
+
// DPT14,
|
|
197
|
+
// DPT15: null,
|
|
198
|
+
// DPT16: null,
|
|
199
|
+
// DPT17: null,
|
|
200
|
+
// DPT18,
|
|
201
|
+
// DPT19: null,
|
|
202
|
+
// DPT20: null
|
|
203
|
+
// };
|
|
182
204
|
getKNXDataBuffer(_data, _dptid) {
|
|
183
205
|
let adpu = {};
|
|
184
206
|
DPTLib.populateAPDU(_data, adpu, _dptid);
|
|
207
|
+
let iDatapointType = parseInt(_dptid.substr(0, _dptid.indexOf(".")));
|
|
208
|
+
let isSixBits = adpu.bitlength <= 6;
|
|
209
|
+
//let isSixBits = [1,2,3,5,9,10,11,14,18].includes(iDatapointType);
|
|
210
|
+
//console.log("isSixBits", isSixBits, "Includes (should be = isSixBits)", [1, 2, 3, 5, 9, 10, 11, 14, 18].includes(iDatapointType), "ADPU BitLenght", adpu.bitlength);
|
|
211
|
+
try {
|
|
212
|
+
if (this.sysLogger !== undefined && this.sysLogger !== null) this.sysLogger.trace("isSixBits:" + isSixBits + " Includes (should be = isSixBits):" + [1, 2, 3, 5, 9, 10, 11, 14, 18].includes(iDatapointType) + " ADPU BitLenght:" + adpu.bitlength);
|
|
213
|
+
} catch (error) { }
|
|
214
|
+
|
|
185
215
|
let IDataPoint = {
|
|
186
216
|
id: "",
|
|
187
217
|
value: "any",
|
|
188
|
-
type: { type: adpu.bitlength.toString() || null },
|
|
218
|
+
//type: { type: adpu.bitlength.toString() || null },
|
|
219
|
+
type: { type: isSixBits },
|
|
189
220
|
bind: null,
|
|
190
221
|
read: () => null,
|
|
191
222
|
write: null
|
|
@@ -212,15 +243,21 @@ class KNXClient extends EventEmitter {
|
|
|
212
243
|
if (this.sysLogger !== undefined && this.sysLogger !== null) {
|
|
213
244
|
try {
|
|
214
245
|
if (knxPacket.constructor.name !== undefined && knxPacket.constructor.name.toLowerCase() === "knxconnectrequest") this.sysLogger.debug("Sending KNX packet: " + knxPacket.constructor.name + " Host:" + this._peerHost + ":" + this._peerPort);
|
|
215
|
-
if (knxPacket.constructor.name !== undefined && knxPacket.constructor.name.toLowerCase() === "knxtunnelingrequest") {
|
|
246
|
+
if (knxPacket.constructor.name !== undefined && (knxPacket.constructor.name.toLowerCase() === "knxtunnelingrequest" || knxPacket.constructor.name.toLowerCase() === "knxroutingindication")) {
|
|
216
247
|
let sTPCI = ""
|
|
217
248
|
if (knxPacket.cEMIMessage.npdu.isGroupRead) sTPCI = "Read";
|
|
218
249
|
if (knxPacket.cEMIMessage.npdu.isGroupResponse) sTPCI = "Response";
|
|
219
250
|
if (knxPacket.cEMIMessage.npdu.isGroupWrite) sTPCI = "Write";
|
|
220
|
-
|
|
251
|
+
// Composing debug string
|
|
252
|
+
let sDebugString = "???";
|
|
253
|
+
try {
|
|
254
|
+
sDebugString = "Data: " + JSON.stringify(knxPacket.cEMIMessage.npdu);
|
|
255
|
+
sDebugString += " srcAddress: " + knxPacket.cEMIMessage.srcAddress.toString();
|
|
256
|
+
sDebugString += " dstAddress: " + knxPacket.cEMIMessage.dstAddress.toString();
|
|
257
|
+
} catch (error) { }
|
|
258
|
+
this.sysLogger.debug("Sending KNX packet: " + knxPacket.constructor.name + " " + sDebugString + " Host:" + this._peerHost + ":" + this._peerPort + " channelID:" + knxPacket.channelID + " seqCounter:" + knxPacket.seqCounter + " Dest:" + knxPacket.cEMIMessage.dstAddress.toString(), " Data:" + knxPacket.cEMIMessage.npdu.dataValue.toString("hex") + " TPCI:" + sTPCI);
|
|
221
259
|
}
|
|
222
260
|
} catch (error) {
|
|
223
|
-
this.sysLogger.debug("Sending KNX packet error " + error.message || "");
|
|
224
261
|
}
|
|
225
262
|
}
|
|
226
263
|
|
|
@@ -230,16 +267,16 @@ class KNXClient extends EventEmitter {
|
|
|
230
267
|
try {
|
|
231
268
|
this._clientSocket.send(knxPacket.toBuffer(), this._peerPort, this._peerHost, err => {
|
|
232
269
|
if (err) {
|
|
233
|
-
if (this.sysLogger !== undefined && this.sysLogger !== null) this.sysLogger.error("
|
|
270
|
+
if (this.sysLogger !== undefined && this.sysLogger !== null) this.sysLogger.error("Sending KNX packet: Send UDP sending error: " + err.message || "Undef error");
|
|
234
271
|
try {
|
|
235
272
|
this.emit(KNXClientEvents.error, err);
|
|
236
273
|
} catch (error) {
|
|
237
274
|
}
|
|
238
275
|
}
|
|
239
|
-
|
|
276
|
+
|
|
240
277
|
});
|
|
241
278
|
} catch (error) {
|
|
242
|
-
if (this.sysLogger !== undefined && this.sysLogger !== null) this.sysLogger.
|
|
279
|
+
if (this.sysLogger !== undefined && this.sysLogger !== null) this.sysLogger.error("Sending KNX packet: Send UDP Catch error: " + error.message + " " + typeof (knxPacket) + " seqCounter:" + knxPacket.seqCounter);
|
|
243
280
|
try {
|
|
244
281
|
//this.emit(KNXClientEvents.error, error);
|
|
245
282
|
} catch (error) {
|
|
@@ -251,13 +288,13 @@ class KNXClient extends EventEmitter {
|
|
|
251
288
|
try {
|
|
252
289
|
this._clientSocket.write(knxPacket.toBuffer(), err => {
|
|
253
290
|
if (err) {
|
|
254
|
-
if (this.sysLogger !== undefined && this.sysLogger !== null) this.sysLogger.error("
|
|
291
|
+
if (this.sysLogger !== undefined && this.sysLogger !== null) this.sysLogger.error("Sending KNX packet: Send TCP sending error: " + err.message || "Undef error");
|
|
255
292
|
this.emit(KNXClientEvents.error, err);
|
|
256
293
|
}
|
|
257
|
-
|
|
294
|
+
|
|
258
295
|
});
|
|
259
296
|
} catch (error) {
|
|
260
|
-
if (this.sysLogger !== undefined && this.sysLogger !== null) this.sysLogger.error("
|
|
297
|
+
if (this.sysLogger !== undefined && this.sysLogger !== null) this.sysLogger.error("Sending KNX packet: Send TCP Catch error: " + error.message || "Undef error");
|
|
261
298
|
try {
|
|
262
299
|
//this.emit(KNXClientEvents.error, error);
|
|
263
300
|
} catch (error) {
|
|
@@ -287,7 +324,7 @@ class KNXClient extends EventEmitter {
|
|
|
287
324
|
|
|
288
325
|
if (this._options.hostProtocol === "Multicast") {
|
|
289
326
|
// Multicast
|
|
290
|
-
const cEMIMessage = CEMIFactory.CEMIFactory.
|
|
327
|
+
const cEMIMessage = CEMIFactory.CEMIFactory.newLDataIndicationMessage("write", srcAddress, dstAddress, data);
|
|
291
328
|
cEMIMessage.control.ack = 0;
|
|
292
329
|
cEMIMessage.control.broadcast = 1;
|
|
293
330
|
cEMIMessage.control.priority = 3;
|
|
@@ -295,12 +332,7 @@ class KNXClient extends EventEmitter {
|
|
|
295
332
|
cEMIMessage.control.hopCount = 6;
|
|
296
333
|
const knxPacketRequest = KNXProtocol.KNXProtocol.newKNXRoutingIndication(cEMIMessage);
|
|
297
334
|
this.send(knxPacketRequest);
|
|
298
|
-
// 06/12/2021
|
|
299
|
-
try {
|
|
300
|
-
this.emit(KNXClientEvents.indication, knxPacketRequest, true, null);
|
|
301
|
-
} catch (error) {
|
|
302
|
-
}
|
|
303
|
-
|
|
335
|
+
// 06/12/2021 Multivast automaticalli echoes telegrams
|
|
304
336
|
} else {
|
|
305
337
|
// Tunneling
|
|
306
338
|
const cEMIMessage = CEMIFactory.CEMIFactory.newLDataRequestMessage("write", srcAddress, dstAddress, data);
|
|
@@ -335,7 +367,7 @@ class KNXClient extends EventEmitter {
|
|
|
335
367
|
|
|
336
368
|
if (this._options.hostProtocol === "Multicast") {
|
|
337
369
|
// Multicast
|
|
338
|
-
const cEMIMessage = CEMIFactory.CEMIFactory.
|
|
370
|
+
const cEMIMessage = CEMIFactory.CEMIFactory.newLDataIndicationMessage("response", srcAddress, dstAddress, data);
|
|
339
371
|
cEMIMessage.control.ack = 0;
|
|
340
372
|
cEMIMessage.control.broadcast = 1;
|
|
341
373
|
cEMIMessage.control.priority = 3;
|
|
@@ -343,11 +375,7 @@ class KNXClient extends EventEmitter {
|
|
|
343
375
|
cEMIMessage.control.hopCount = 6;
|
|
344
376
|
const knxPacketRequest = KNXProtocol.KNXProtocol.newKNXRoutingIndication(cEMIMessage);
|
|
345
377
|
this.send(knxPacketRequest);
|
|
346
|
-
// 06/12/2021
|
|
347
|
-
try {
|
|
348
|
-
if (this._options.localEchoInTunneling) this.emit(KNXClientEvents.indication, knxPacketRequest, true, null);
|
|
349
|
-
} catch (error) {
|
|
350
|
-
}
|
|
378
|
+
// 06/12/2021 Multivast automaticalli echoes telegrams
|
|
351
379
|
|
|
352
380
|
} else {
|
|
353
381
|
// Tunneling
|
|
@@ -380,7 +408,7 @@ class KNXClient extends EventEmitter {
|
|
|
380
408
|
|
|
381
409
|
if (this._options.hostProtocol === "Multicast") {
|
|
382
410
|
// Multicast
|
|
383
|
-
const cEMIMessage = CEMIFactory.CEMIFactory.
|
|
411
|
+
const cEMIMessage = CEMIFactory.CEMIFactory.newLDataIndicationMessage("read", srcAddress, dstAddress, null);
|
|
384
412
|
cEMIMessage.control.ack = 0;
|
|
385
413
|
cEMIMessage.control.broadcast = 1;
|
|
386
414
|
cEMIMessage.control.priority = 3;
|
|
@@ -388,11 +416,7 @@ class KNXClient extends EventEmitter {
|
|
|
388
416
|
cEMIMessage.control.hopCount = 6;
|
|
389
417
|
const knxPacketRequest = KNXProtocol.KNXProtocol.newKNXRoutingIndication(cEMIMessage);
|
|
390
418
|
this.send(knxPacketRequest);
|
|
391
|
-
// 06/12/2021
|
|
392
|
-
try {
|
|
393
|
-
if (this._options.localEchoInTunneling) this.emit(KNXClientEvents.indication, knxPacketRequest, true, null);
|
|
394
|
-
} catch (error) {
|
|
395
|
-
}
|
|
419
|
+
// 06/12/2021 Multivast automaticalli echoes telegrams
|
|
396
420
|
|
|
397
421
|
} else {
|
|
398
422
|
// Tunneling
|
|
@@ -432,7 +456,7 @@ class KNXClient extends EventEmitter {
|
|
|
432
456
|
let srcAddress = this._options.physAddr;
|
|
433
457
|
if (this._options.hostProtocol === "Multicast") {
|
|
434
458
|
// Multicast
|
|
435
|
-
const cEMIMessage = CEMIFactory.CEMIFactory.
|
|
459
|
+
const cEMIMessage = CEMIFactory.CEMIFactory.newLDataIndicationMessage("write", srcAddress, dstAddress, data);
|
|
436
460
|
cEMIMessage.control.ack = 0;
|
|
437
461
|
cEMIMessage.control.broadcast = 1;
|
|
438
462
|
cEMIMessage.control.priority = 3;
|
|
@@ -440,11 +464,7 @@ class KNXClient extends EventEmitter {
|
|
|
440
464
|
cEMIMessage.control.hopCount = 6;
|
|
441
465
|
const knxPacketRequest = KNXProtocol.KNXProtocol.newKNXRoutingIndication(cEMIMessage);
|
|
442
466
|
this.send(knxPacketRequest);
|
|
443
|
-
// 06/12/2021
|
|
444
|
-
try {
|
|
445
|
-
this.emit(KNXClientEvents.indication, knxPacketRequest, true, null);
|
|
446
|
-
} catch (error) {
|
|
447
|
-
}
|
|
467
|
+
// 06/12/2021 Multivast automaticalli echoes telegrams
|
|
448
468
|
|
|
449
469
|
} else {
|
|
450
470
|
// Tunneling
|
|
@@ -676,6 +696,7 @@ class KNXClient extends EventEmitter {
|
|
|
676
696
|
}, KNXConstants.KNX_CONSTANTS.TUNNELING_REQUEST_TIMEOUT * 1000));
|
|
677
697
|
}
|
|
678
698
|
_processInboundMessage(msg, rinfo) {
|
|
699
|
+
|
|
679
700
|
try {
|
|
680
701
|
const { knxHeader, knxMessage } = KNXProtocol.KNXProtocol.parseMessage(msg);
|
|
681
702
|
|
|
@@ -752,8 +773,16 @@ class KNXClient extends EventEmitter {
|
|
|
752
773
|
|
|
753
774
|
if (knxTunnelingRequest.cEMIMessage.msgCode === CEMIConstants.CEMIConstants.L_DATA_IND) {
|
|
754
775
|
|
|
776
|
+
// Composing debug string
|
|
777
|
+
let sDebugString = "???";
|
|
778
|
+
try {
|
|
779
|
+
sDebugString = "Data: " + JSON.stringify(knxTunnelingRequest.cEMIMessage.npdu);
|
|
780
|
+
sDebugString += " srcAddress: " + knxTunnelingRequest.cEMIMessage.srcAddress.toString();
|
|
781
|
+
sDebugString += " dstAddress: " + knxTunnelingRequest.cEMIMessage.dstAddress.toString();
|
|
782
|
+
} catch (error) { }
|
|
783
|
+
|
|
755
784
|
try {
|
|
756
|
-
if (this.sysLogger !== undefined && this.sysLogger !== null) this.sysLogger.debug("Received KNX packet:
|
|
785
|
+
if (this.sysLogger !== undefined && this.sysLogger !== null) this.sysLogger.debug("Received KNX packet: TUNNELING: L_DATA_IND, " + sDebugString + " ChannelID:" + this._channelID + " seqCounter:" + knxTunnelingRequest.seqCounter + " Host:" + this._options.ipAddr + ":" + this._options.ipPort);
|
|
757
786
|
} catch (error) { }
|
|
758
787
|
|
|
759
788
|
try {
|
|
@@ -765,7 +794,7 @@ class KNXClient extends EventEmitter {
|
|
|
765
794
|
else if (knxTunnelingRequest.cEMIMessage.msgCode === CEMIConstants.CEMIConstants.L_DATA_CON) {
|
|
766
795
|
|
|
767
796
|
try {
|
|
768
|
-
if (this.sysLogger !== undefined && this.sysLogger !== null) this.sysLogger.debug("Received KNX packet:
|
|
797
|
+
if (this.sysLogger !== undefined && this.sysLogger !== null) this.sysLogger.debug("Received KNX packet: TUNNELING: L_DATA_CON, ChannelID:" + this._channelID + " seqCounter:" + knxTunnelingRequest.seqCounter + " Host:" + this._options.ipAddr + ":" + this._options.ipPort);
|
|
769
798
|
} catch (error) { }
|
|
770
799
|
|
|
771
800
|
}
|
|
@@ -780,7 +809,7 @@ class KNXClient extends EventEmitter {
|
|
|
780
809
|
}
|
|
781
810
|
|
|
782
811
|
try {
|
|
783
|
-
if (this.sysLogger !== undefined && this.sysLogger !== null) this.sysLogger.debug("Received KNX packet: TUNNELING_ACK, ChannelID:" + this._channelID + " seqCounter:" + knxTunnelingAck.seqCounter + " Host:" + this._options.ipAddr + ":" + this._options.ipPort);
|
|
812
|
+
if (this.sysLogger !== undefined && this.sysLogger !== null) this.sysLogger.debug("Received KNX packet: TUNNELING: TUNNELING_ACK, ChannelID:" + this._channelID + " seqCounter:" + knxTunnelingAck.seqCounter + " Host:" + this._options.ipAddr + ":" + this._options.ipPort);
|
|
784
813
|
} catch (error) { }
|
|
785
814
|
|
|
786
815
|
this._incSeqNumber(knxTunnelingAck.seqCounter);
|
|
@@ -789,7 +818,7 @@ class KNXClient extends EventEmitter {
|
|
|
789
818
|
if (this._tunnelReqTimer.get(knxTunnelingAck.seqCounter) !== null) clearTimeout(this._tunnelReqTimer.get(knxTunnelingAck.seqCounter));
|
|
790
819
|
this._tunnelReqTimer.delete(knxTunnelingAck.seqCounter);
|
|
791
820
|
try {
|
|
792
|
-
if (this.sysLogger !== undefined && this.sysLogger !== null) this.sysLogger.debug("
|
|
821
|
+
if (this.sysLogger !== undefined && this.sysLogger !== null) this.sysLogger.debug("Received KNX packet: TUNNELING: DELETED_TUNNELING_ACK FROM PENDING ACK's, ChannelID:" + this._channelID + " seqCounter:" + knxTunnelingAck.seqCounter + " Host:" + this._options.ipAddr + ":" + this._options.ipPort);
|
|
793
822
|
} catch (error) { }
|
|
794
823
|
}
|
|
795
824
|
else {
|
|
@@ -797,23 +826,41 @@ class KNXClient extends EventEmitter {
|
|
|
797
826
|
// Avoid warning if the KNXEngine is set to ignore ACK's telegrams
|
|
798
827
|
if (!this._options.suppress_ack_ldatareq) {
|
|
799
828
|
try {
|
|
800
|
-
if (this.sysLogger !== undefined && this.sysLogger !== null) this.sysLogger.error("
|
|
829
|
+
if (this.sysLogger !== undefined && this.sysLogger !== null) this.sysLogger.error("Received KNX packet: TUNNELING: Unexpected Tunnel Ack with seqCounter = " + knxTunnelingAck.seqCounter);
|
|
801
830
|
} catch (error) { }
|
|
802
831
|
//this.emit(KNXClientEvents.error, `Unexpected Tunnel Ack ${knxTunnelingAck.seqCounter}`);
|
|
803
832
|
}
|
|
804
833
|
}
|
|
805
834
|
|
|
806
835
|
} else if (knxHeader.service_type === KNXConstants.KNX_CONSTANTS.ROUTING_INDICATION) {
|
|
836
|
+
|
|
807
837
|
// 07/12/2021 Multicast routing indication
|
|
808
838
|
const knxRoutingInd = knxMessage;
|
|
809
839
|
if (knxRoutingInd.cEMIMessage.msgCode === CEMIConstants.CEMIConstants.L_DATA_IND) {
|
|
840
|
+
|
|
841
|
+
// Composing debug string
|
|
842
|
+
let sDebugString = "???";
|
|
843
|
+
try {
|
|
844
|
+
sDebugString = "Data: " + JSON.stringify(knxRoutingInd.cEMIMessage.npdu);
|
|
845
|
+
sDebugString += " srcAddress: " + knxRoutingInd.cEMIMessage.srcAddress.toString();
|
|
846
|
+
sDebugString += " dstAddress: " + knxRoutingInd.cEMIMessage.dstAddress.toString();
|
|
847
|
+
} catch (error) { }
|
|
848
|
+
|
|
810
849
|
try {
|
|
811
|
-
this.
|
|
850
|
+
if (this.sysLogger !== undefined && this.sysLogger !== null) this.sysLogger.debug("Received KNX packet: ROUTING: L_DATA_IND, " + sDebugString + " Host:" + this._options.ipAddr + ":" + this._options.ipPort);
|
|
851
|
+
} catch (error) { }
|
|
852
|
+
|
|
853
|
+
try {
|
|
854
|
+
this.emit(KNXClientEvents.indication, knxRoutingInd, false, msg.toString("hex"));
|
|
812
855
|
} catch (error) {
|
|
813
856
|
}
|
|
814
857
|
}
|
|
815
858
|
else if (knxRoutingInd.cEMIMessage.msgCode === CEMIConstants.CEMIConstants.L_DATA_CON) {
|
|
816
859
|
|
|
860
|
+
try {
|
|
861
|
+
if (this.sysLogger !== undefined && this.sysLogger !== null) this.sysLogger.debug("Received KNX packet: ROUTING: L_DATA_CON, Host:" + this._options.ipAddr + ":" + this._options.ipPort);
|
|
862
|
+
} catch (error) { }
|
|
863
|
+
|
|
817
864
|
}
|
|
818
865
|
|
|
819
866
|
} else if (knxHeader.service_type === KNXConstants.KNX_CONSTANTS.ROUTING_LOST_MESSAGE) {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.KNXHeader = void 0;
|
|
4
|
-
const
|
|
4
|
+
const KNXConstants = require("./KNXConstants");
|
|
5
5
|
class KNXHeader {
|
|
6
6
|
constructor(type, length) {
|
|
7
|
-
this._headerLength =
|
|
8
|
-
this._version =
|
|
7
|
+
this._headerLength = KNXConstants.KNX_CONSTANTS.HEADER_SIZE_10;
|
|
8
|
+
this._version = KNXConstants.KNX_CONSTANTS.KNXNETIP_VERSION_10;
|
|
9
9
|
this.service_type = type;
|
|
10
|
-
this.length =
|
|
10
|
+
this.length = KNXConstants.KNX_CONSTANTS.HEADER_SIZE_10 + length;
|
|
11
11
|
}
|
|
12
12
|
get headerLength() {
|
|
13
13
|
return this._headerLength;
|
|
@@ -16,16 +16,16 @@ class KNXHeader {
|
|
|
16
16
|
return this._version;
|
|
17
17
|
}
|
|
18
18
|
static createFromBuffer(buffer, offset = 0) {
|
|
19
|
-
if (buffer.length <
|
|
19
|
+
if (buffer.length < KNXConstants.KNX_CONSTANTS.HEADER_SIZE_10) {
|
|
20
20
|
throw new Error('Incomplete buffer');
|
|
21
21
|
}
|
|
22
22
|
const header_length = buffer.readUInt8(offset);
|
|
23
|
-
if (header_length !==
|
|
23
|
+
if (header_length !== KNXConstants.KNX_CONSTANTS.HEADER_SIZE_10) {
|
|
24
24
|
throw new Error(`Invalid buffer length ${header_length}`);
|
|
25
25
|
}
|
|
26
26
|
offset += 1;
|
|
27
27
|
const version = buffer.readUInt8(offset);
|
|
28
|
-
if (version !==
|
|
28
|
+
if (version !== KNXConstants.KNX_CONSTANTS.KNXNETIP_VERSION_10) {
|
|
29
29
|
throw new Error(`Unknown version ${version}`);
|
|
30
30
|
}
|
|
31
31
|
offset += 1;
|
|
@@ -94,7 +94,7 @@ class KNXProtocol {
|
|
|
94
94
|
static newKNXTunnelingRequest(channelID, seqCounter, cEMIMessage) {
|
|
95
95
|
return new KNXTunnelingRequest.KNXTunnelingRequest(channelID, seqCounter, cEMIMessage);
|
|
96
96
|
}
|
|
97
|
-
static newKNXRoutingIndication(cEMIMessage) {
|
|
97
|
+
static newKNXRoutingIndication(cEMIMessage) { // 18/12/2021
|
|
98
98
|
return new KNXRoutingIndication.KNXRoutingIndication(cEMIMessage);
|
|
99
99
|
}
|
|
100
100
|
static newKNXSecureSessionRequest(cri, hpaiData = HPAI.HPAI.NULLHPAI) {
|
|
@@ -24,11 +24,6 @@ class KNXRoutingIndication extends KNXPacket.KNXPacket {
|
|
|
24
24
|
return new KNXRoutingIndication(cEMIMessage);
|
|
25
25
|
}
|
|
26
26
|
toBuffer() {
|
|
27
|
-
const buffer = Buffer.alloc(4);
|
|
28
|
-
buffer.writeUInt8(4, 0);
|
|
29
|
-
buffer.writeUInt8(0, 1);
|
|
30
|
-
buffer.writeUInt8(0, 2);
|
|
31
|
-
buffer.writeUInt8(0, 3);
|
|
32
27
|
return Buffer.concat([this.header.toBuffer(), this.cEMIMessage.toBuffer()]);
|
|
33
28
|
}
|
|
34
29
|
}
|
|
@@ -21,9 +21,9 @@ class CEMIFactory {
|
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
static newLDataRequestMessage(requestType, srcAddress, dstAddress, data) {
|
|
24
|
-
|
|
24
|
+
|
|
25
25
|
const controlField = new ControlField.ControlField();
|
|
26
|
-
|
|
26
|
+
|
|
27
27
|
const npdu = new NPDU.NPDU();
|
|
28
28
|
npdu.tpci = NPDU.NPDU.TPCI_UNUMBERED_PACKET;
|
|
29
29
|
|
|
@@ -36,6 +36,24 @@ class CEMIFactory {
|
|
|
36
36
|
return new LDataReq.LDataReq(null, controlField, srcAddress, dstAddress, npdu);
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
+
// 18/12/2021 New
|
|
40
|
+
static newLDataIndicationMessage(requestType, srcAddress, dstAddress, data) {
|
|
41
|
+
|
|
42
|
+
const controlField = new ControlField.ControlField();
|
|
43
|
+
|
|
44
|
+
const npdu = new NPDU.NPDU();
|
|
45
|
+
npdu.tpci = NPDU.NPDU.TPCI_UNUMBERED_PACKET;
|
|
46
|
+
|
|
47
|
+
// 06/12/2021
|
|
48
|
+
if (requestType === "write") npdu.action = NPDU.NPDU.GROUP_WRITE; // 2
|
|
49
|
+
if (requestType === "response") npdu.action = NPDU.NPDU.GROUP_RESPONSE; // 1
|
|
50
|
+
if (requestType === "read") npdu.action = NPDU.NPDU.GROUP_READ; // 0
|
|
51
|
+
|
|
52
|
+
npdu.data = data;
|
|
53
|
+
return new LDataInd.LDataInd(null, controlField, srcAddress, dstAddress, npdu);
|
|
54
|
+
|
|
55
|
+
}
|
|
56
|
+
|
|
39
57
|
}
|
|
40
58
|
exports.CEMIFactory = CEMIFactory;
|
|
41
59
|
//# sourceMappingURL=CEMIFactory.js.map
|
|
@@ -22,7 +22,7 @@ class CEMIMessage {
|
|
|
22
22
|
return buffer;
|
|
23
23
|
}
|
|
24
24
|
static GetLength(additionalInfo, control, srcAddress, dstAddress, npdu) {
|
|
25
|
-
const length = additionalInfo
|
|
25
|
+
const length = additionalInfo === null ? 1 : additionalInfo.length;
|
|
26
26
|
const npduLength = npdu == null ? 0 : npdu.length;
|
|
27
27
|
return 1 + length + control.length + srcAddress.length + dstAddress.length + npduLength;
|
|
28
28
|
}
|
|
@@ -31,7 +31,7 @@ class LDataInd extends CEMIMessage.CEMIMessage {
|
|
|
31
31
|
return new LDataInd(additionalInfo, controlField, srcAddress, dstAddress, npdu);
|
|
32
32
|
}
|
|
33
33
|
toBuffer() {
|
|
34
|
-
const buffer = Buffer.alloc(
|
|
34
|
+
const buffer = Buffer.alloc(2);
|
|
35
35
|
const msgBuffer = [buffer];
|
|
36
36
|
let offset = 0;
|
|
37
37
|
buffer.writeUInt8(this.msgCode, offset++);
|
|
@@ -45,12 +45,13 @@ class NPDU {
|
|
|
45
45
|
if (!(data instanceof KNXDataBuffer.KNXDataBuffer)) {
|
|
46
46
|
throw new Error('Invalid data Buffer');
|
|
47
47
|
}
|
|
48
|
+
|
|
48
49
|
if (data.sixBits() && data.length === 1 && data.value.readUInt8(0) < 0x3F) {
|
|
49
50
|
this.apci = (this.apci & 0xC0) | data.value.readUInt8(0);
|
|
50
51
|
this._data = null;
|
|
51
52
|
return;
|
|
52
53
|
}
|
|
53
|
-
|
|
54
|
+
|
|
54
55
|
this._data = data;
|
|
55
56
|
}
|
|
56
57
|
get length() {
|
|
@@ -1109,24 +1109,15 @@ return msg;`, "helplink": "https://github.com/Supergiovane/node-red-contrib-knx-
|
|
|
1109
1109
|
// 24/09/2019 Autorespond to BUS
|
|
1110
1110
|
if (input.notifyreadrequestalsorespondtobus === true) {
|
|
1111
1111
|
if (typeof input.currentPayload === "undefined" || input.currentPayload === "" || input.currentPayload === null) { // 14/08/2021 Added || input.currentPayload === null
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
} catch (error) {
|
|
1117
|
-
console.log("BANANA ERRORE RESPOND", error.message);
|
|
1118
|
-
}
|
|
1119
|
-
|
|
1120
|
-
}, 200);
|
|
1112
|
+
node.writeQueueAdd({ grpaddr: _dest, payload: input.notifyreadrequestalsorespondtobusdefaultvalueifnotinitialized, dpt: input.dpt, outputtype: "response", nodecallerid: input.id });
|
|
1113
|
+
|
|
1114
|
+
input.setNodeStatus({ fill: "blue", shape: "ring", text: "Read & Autorespond with default", payload: input.notifyreadrequestalsorespondtobusdefaultvalueifnotinitialized, GA: input.topic, dpt: msg.knx.dpt, devicename: "" });
|
|
1115
|
+
|
|
1121
1116
|
} else {
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
} catch (error) {
|
|
1127
|
-
console.log("BANANA ERRORE RESPOND2", error.message);
|
|
1128
|
-
}
|
|
1129
|
-
}, 200);
|
|
1117
|
+
node.writeQueueAdd({ grpaddr: _dest, payload: input.currentPayload, dpt: input.dpt, outputtype: "response", nodecallerid: input.id });
|
|
1118
|
+
|
|
1119
|
+
input.setNodeStatus({ fill: "blue", shape: "ring", text: "Read & Autorespond", payload: input.currentPayload, GA: input.topic, dpt: msg.knx.dpt, devicename: "" });
|
|
1120
|
+
|
|
1130
1121
|
};
|
|
1131
1122
|
} else {
|
|
1132
1123
|
input.setNodeStatus({ fill: "grey", shape: "dot", text: "Read", payload: msg.payload, GA: input.topic, dpt: msg.knx.dpt, devicename: "" });
|
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.7",
|
|
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",
|