node-red-contrib-knx-ultimate 1.3.0 → 1.3.1

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 CHANGED
@@ -4,9 +4,9 @@
4
4
 
5
5
  <br/>
6
6
  <p>
7
- <b>Version 1.3.0</b> - December 2021<br/>
7
+ <b>Version 1.3.1</b> - December 2021<br/>
8
8
  ---- MAJOR VERSION WITH TOTALLY REWRITTEN KNX API, IN PURE JAVASCRIPT ----<br/>
9
- ---- IF YOU ENCOUNTER ISSUES, JUST INSTALL THE LAST OLD VERSION WITH:npm install node-red-knx-ultimate@1.2.57 ----<br/>
9
+ ---- IF YOU ENCOUNTER ISSUES, JUST INSTALL THE LAST OLD VERSION WITH: npm install node-red-contrib-knx-ultimate@1.2.57 ----<br/>
10
10
  ---- PLEASE BE AWARE THAT ALL PREVIOULSY KNX SECURE OPTIONS HAVE BEEN HIDDEN UNTIL READY TO BE RELEASED, TO AVOID CONFUSIONS ----<br/>
11
11
  - KNX-Secure: not ready yet. I think not before the 1° quarter of 2022 because i'm learning the MANY cryptograhics algorithms of this Secure thing. Already done are the loading/checking against password of the ETS Keyring file, the new TCP stack (will come toghether with the already present UDP stack) and the first connection handshake between KNX-Ultimate and a KNX/IP Interface via TCP tunnel, using the DH Curve25519 algorythm. SOMEONE INTERESTED HELPING ME WITH THE DEVELOPMENT (FOR FREE)?<br/>
12
12
  - NEW: new KNX API developed in these months. This new API is more speedy, more mantainable (get rid of the old "machina" framework) and ready to accomodate the natively supports KNX-Secure.<br/>
@@ -224,6 +224,7 @@ class KNXClient extends EventEmitter {
224
224
  }
225
225
  }
226
226
 
227
+ // Real send to KNX wires
227
228
  if (this._options.hostProtocol === "Multicast" || this._options.hostProtocol === "TunnelUDP") {
228
229
  // UDP
229
230
  try {
@@ -234,8 +235,8 @@ class KNXClient extends EventEmitter {
234
235
  this.emit(KNXClientEvents.error, err);
235
236
  } catch (error) {
236
237
  }
237
-
238
238
  }
239
+
239
240
  });
240
241
  } catch (error) {
241
242
  if (this.sysLogger !== undefined && this.sysLogger !== null) this.sysLogger.debug("Sending KNX packet via TCP: " + typeof (knxPacket) + " seqCounter:" + knxPacket.seqCounter);
@@ -253,6 +254,7 @@ class KNXClient extends EventEmitter {
253
254
  if (this.sysLogger !== undefined && this.sysLogger !== null) this.sysLogger.error("KNXClient: Send TCP: " + err.message || "Undef error");
254
255
  this.emit(KNXClientEvents.error, err);
255
256
  }
257
+
256
258
  });
257
259
  } catch (error) {
258
260
  if (this.sysLogger !== undefined && this.sysLogger !== null) this.sysLogger.error("KNXClient: Send TCP Catch: " + error.message || "Undef error");
@@ -293,9 +295,9 @@ class KNXClient extends EventEmitter {
293
295
  cEMIMessage.control.hopCount = 6;
294
296
  const knxPacketRequest = KNXProtocol.KNXProtocol.newKNXRoutingIndication(cEMIMessage);
295
297
  this.send(knxPacketRequest);
296
- // 06/12/2021 Echo the sent telegram. Last parameter is the echo true/false
298
+ // 06/12/2021 Echo the sent telegram.
297
299
  try {
298
- this.emit(KNXClientEvents.indication, knxPacketRequest, true, knxPacketRequest.cEMIMessage.toBuffer().toString("hex"));
300
+ this.emit(KNXClientEvents.indication, knxPacketRequest, true, null);
299
301
  } catch (error) {
300
302
  }
301
303
 
@@ -313,7 +315,7 @@ class KNXClient extends EventEmitter {
313
315
  this.send(knxPacketRequest);
314
316
  // 06/12/2021 Echo the sent telegram. Last parameter is the echo true/false
315
317
  try {
316
- if (this._options.localEchoInTunneling) this.emit(KNXClientEvents.indication, knxPacketRequest, true, knxPacketRequest.cEMIMessage.toBuffer().toString("hex"));
318
+ if (this._options.localEchoInTunneling) this.emit(KNXClientEvents.indication, knxPacketRequest, true, null);
317
319
  } catch (error) {
318
320
  }
319
321
 
@@ -343,7 +345,7 @@ class KNXClient extends EventEmitter {
343
345
  this.send(knxPacketRequest);
344
346
  // 06/12/2021 Echo the sent telegram. Last parameter is the echo true/false
345
347
  try {
346
- if (this._options.localEchoInTunneling) this.emit(KNXClientEvents.indication, knxPacketRequest, true, knxPacketRequest.cEMIMessage.toBuffer().toString("hex"));
348
+ if (this._options.localEchoInTunneling) this.emit(KNXClientEvents.indication, knxPacketRequest, true, null);
347
349
  } catch (error) {
348
350
  }
349
351
 
@@ -361,7 +363,7 @@ class KNXClient extends EventEmitter {
361
363
  this.send(knxPacketRequest);
362
364
  // 06/12/2021 Echo the sent telegram. Last parameter is the echo true/false
363
365
  try {
364
- if (this._options.localEchoInTunneling) this.emit(KNXClientEvents.indication, knxPacketRequest, true, knxPacketRequest.cEMIMessage.toBuffer().toString("hex"));
366
+ if (this._options.localEchoInTunneling) this.emit(KNXClientEvents.indication, knxPacketRequest, true, null);
365
367
  } catch (error) {
366
368
  }
367
369
 
@@ -388,7 +390,7 @@ class KNXClient extends EventEmitter {
388
390
  this.send(knxPacketRequest);
389
391
  // 06/12/2021 Echo the sent telegram. Last parameter is the echo true/false
390
392
  try {
391
- if (this._options.localEchoInTunneling) this.emit(KNXClientEvents.indication, knxPacketRequest, true, knxPacketRequest.cEMIMessage.toBuffer().toString("hex"));
393
+ if (this._options.localEchoInTunneling) this.emit(KNXClientEvents.indication, knxPacketRequest, true, null);
392
394
  } catch (error) {
393
395
  }
394
396
 
@@ -406,7 +408,7 @@ class KNXClient extends EventEmitter {
406
408
  this.send(knxPacketRequest);
407
409
  // 06/12/2021 Echo the sent telegram. Last parameter is the echo true/false
408
410
  try {
409
- if (this._options.localEchoInTunneling) this.emit(KNXClientEvents.indication, knxPacketRequest, true, knxPacketRequest.cEMIMessage.toBuffer().toString("hex"));
411
+ if (this._options.localEchoInTunneling) this.emit(KNXClientEvents.indication, knxPacketRequest, true, null);
410
412
  } catch (error) {
411
413
  }
412
414
 
@@ -440,7 +442,7 @@ class KNXClient extends EventEmitter {
440
442
  this.send(knxPacketRequest);
441
443
  // 06/12/2021 Echo the sent telegram. Last parameter is the echo true/false
442
444
  try {
443
- this.emit(KNXClientEvents.indication, knxPacketRequest, true, knxPacketRequest.cEMIMessage.toBuffer().toString("hex"));
445
+ this.emit(KNXClientEvents.indication, knxPacketRequest, true, null);
444
446
  } catch (error) {
445
447
  }
446
448
 
@@ -458,7 +460,7 @@ class KNXClient extends EventEmitter {
458
460
  this.send(knxPacketRequest);
459
461
  // 06/12/2021 Echo the sent telegram. Last parameter is the echo true/false
460
462
  try {
461
- if (this._options.localEchoInTunneling) this.emit(KNXClientEvents.indication, knxPacketRequest, true, knxPacketRequest.cEMIMessage.toBuffer().toString("hex"));
463
+ if (this._options.localEchoInTunneling) this.emit(KNXClientEvents.indication, knxPacketRequest, true, null);
462
464
  } catch (error) {
463
465
  }
464
466
 
@@ -755,7 +757,7 @@ class KNXClient extends EventEmitter {
755
757
  } catch (error) { }
756
758
 
757
759
  try {
758
- this.emit(KNXClientEvents.indication, knxTunnelingRequest, false, msg);
760
+ this.emit(KNXClientEvents.indication, knxTunnelingRequest, false, msg.toString("hex"));
759
761
  } catch (error) {
760
762
  }
761
763
 
@@ -800,13 +802,13 @@ class KNXClient extends EventEmitter {
800
802
  //this.emit(KNXClientEvents.error, `Unexpected Tunnel Ack ${knxTunnelingAck.seqCounter}`);
801
803
  }
802
804
  }
803
-
805
+
804
806
  } else if (knxHeader.service_type === KNXConstants.KNX_CONSTANTS.ROUTING_INDICATION) {
805
807
  // 07/12/2021 Multicast routing indication
806
808
  const knxRoutingInd = knxMessage;
807
809
  if (knxRoutingInd.cEMIMessage.msgCode === CEMIConstants.CEMIConstants.L_DATA_IND) {
808
810
  try {
809
- this.emit(KNXClientEvents.indication, knxRoutingInd, false, msg);
811
+ this.emit(KNXClientEvents.indication, knxRoutingInd, false, msg.toString("hex"));
810
812
  } catch (error) {
811
813
  }
812
814
  }
@@ -822,7 +822,12 @@ return msg;`, "helplink": "https://github.com/Supergiovane/node-red-contrib-knx-
822
822
  // }
823
823
 
824
824
  // _rawValue
825
- _rawValue = _datagram.cEMIMessage.npdu.dataValue;
825
+ try {
826
+ _rawValue = _datagram.cEMIMessage.npdu.dataValue;
827
+ } catch (error) {
828
+ return;
829
+ }
830
+
826
831
 
827
832
  // _evt
828
833
  if (_datagram.cEMIMessage.npdu.isGroupRead) _evt = "GroupValue_Read";
@@ -846,9 +851,19 @@ return msg;`, "helplink": "https://github.com/Supergiovane/node-red-contrib-knx-
846
851
  // #####################################################################
847
852
  let _cemiETS = "";
848
853
  if (_CEMI !== undefined && _CEMI !== null) {
854
+ // I'm receiving a telegram from the BUS
855
+ try {
856
+ var iStart = _datagram._header._headerLength; //+ 4;
857
+ _cemiETS = _CEMI.substring(iStart*2 );
858
+ //_cemiETS = datagram.cEMIMessage.srcAddress.toBuffer().toString("hex") + _datagram.cEMIMessage.dstAddress.toBuffer().toString("hex") + "01" + _datagram.cEMIMessage.npdu._tpci.toString(16)
859
+ } catch (error) { }
860
+
861
+ } else if (_echoed) {
862
+ // I'm sending a telegram to the BUS
849
863
  try {
850
- var iStart = _datagram._header._headerLength + 4;
851
- _cemiETS = _CEMI.toString("hex").substring(iStart * 2);
864
+ let sCemiFromDatagram = _datagram.cEMIMessage.toBuffer().toString("hex");
865
+ let iStartAddress = sCemiFromDatagram.indexOf(_datagram.cEMIMessage.srcAddress.toBuffer().toString("hex"));
866
+ _cemiETS = "2900BCD0" + sCemiFromDatagram.substr(8);
852
867
  } catch (error) { _cemiETS = ""; }
853
868
  }
854
869
  // #####################################################################
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-red-contrib-knx-ultimate",
3
- "version": "1.3.0",
3
+ "version": "1.3.1",
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",