node-red-contrib-knx-ultimate 1.3.6 → 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 CHANGED
@@ -4,7 +4,12 @@
4
4
 
5
5
  <br/>
6
6
  <p>
7
- <b>Version 1.3.5</b> - December 2021<br/>
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/>
8
13
  - New KNX Engine has been enabled again, after fixing some glitches.<br/>
9
14
  </p>
10
15
  <p>
@@ -205,7 +205,7 @@ class KNXClient extends EventEmitter {
205
205
  let adpu = {};
206
206
  DPTLib.populateAPDU(_data, adpu, _dptid);
207
207
  let iDatapointType = parseInt(_dptid.substr(0, _dptid.indexOf(".")));
208
- let isSixBits = adpu.bitlength <= 6;
208
+ let isSixBits = adpu.bitlength <= 6;
209
209
  //let isSixBits = [1,2,3,5,9,10,11,14,18].includes(iDatapointType);
210
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
211
  try {
@@ -248,10 +248,16 @@ class KNXClient extends EventEmitter {
248
248
  if (knxPacket.cEMIMessage.npdu.isGroupRead) sTPCI = "Read";
249
249
  if (knxPacket.cEMIMessage.npdu.isGroupResponse) sTPCI = "Response";
250
250
  if (knxPacket.cEMIMessage.npdu.isGroupWrite) sTPCI = "Write";
251
- this.sysLogger.debug("Sending KNX packet: " + knxPacket.constructor.name + " 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);
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);
252
259
  }
253
260
  } catch (error) {
254
- this.sysLogger.debug("Sending KNX packet error " + error.message || "");
255
261
  }
256
262
  }
257
263
 
@@ -261,7 +267,7 @@ class KNXClient extends EventEmitter {
261
267
  try {
262
268
  this._clientSocket.send(knxPacket.toBuffer(), this._peerPort, this._peerHost, err => {
263
269
  if (err) {
264
- if (this.sysLogger !== undefined && this.sysLogger !== null) this.sysLogger.error("KNXClient: Send UDP: " + err.message || "Undef error");
270
+ if (this.sysLogger !== undefined && this.sysLogger !== null) this.sysLogger.error("Sending KNX packet: Send UDP sending error: " + err.message || "Undef error");
265
271
  try {
266
272
  this.emit(KNXClientEvents.error, err);
267
273
  } catch (error) {
@@ -270,7 +276,7 @@ class KNXClient extends EventEmitter {
270
276
 
271
277
  });
272
278
  } catch (error) {
273
- if (this.sysLogger !== undefined && this.sysLogger !== null) this.sysLogger.debug("Sending KNX packet via UDP ERROR: " + error.message + " " + typeof (knxPacket) + " seqCounter:" + knxPacket.seqCounter);
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);
274
280
  try {
275
281
  //this.emit(KNXClientEvents.error, error);
276
282
  } catch (error) {
@@ -282,13 +288,13 @@ class KNXClient extends EventEmitter {
282
288
  try {
283
289
  this._clientSocket.write(knxPacket.toBuffer(), err => {
284
290
  if (err) {
285
- if (this.sysLogger !== undefined && this.sysLogger !== null) this.sysLogger.error("KNXClient: Send TCP: " + err.message || "Undef error");
291
+ if (this.sysLogger !== undefined && this.sysLogger !== null) this.sysLogger.error("Sending KNX packet: Send TCP sending error: " + err.message || "Undef error");
286
292
  this.emit(KNXClientEvents.error, err);
287
293
  }
288
294
 
289
295
  });
290
296
  } catch (error) {
291
- if (this.sysLogger !== undefined && this.sysLogger !== null) this.sysLogger.error("KNXClient: Send TCP Catch: " + error.message || "Undef error");
297
+ if (this.sysLogger !== undefined && this.sysLogger !== null) this.sysLogger.error("Sending KNX packet: Send TCP Catch error: " + error.message || "Undef error");
292
298
  try {
293
299
  //this.emit(KNXClientEvents.error, error);
294
300
  } catch (error) {
@@ -767,8 +773,16 @@ class KNXClient extends EventEmitter {
767
773
 
768
774
  if (knxTunnelingRequest.cEMIMessage.msgCode === CEMIConstants.CEMIConstants.L_DATA_IND) {
769
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
+
770
784
  try {
771
- if (this.sysLogger !== undefined && this.sysLogger !== null) this.sysLogger.debug("Received KNX packet: TUNNELING_REQUEST L_DATA_IND, ChannelID:" + this._channelID + " seqCounter:" + knxTunnelingRequest.seqCounter + " Host:" + this._options.ipAddr + ":" + this._options.ipPort);
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);
772
786
  } catch (error) { }
773
787
 
774
788
  try {
@@ -780,7 +794,7 @@ class KNXClient extends EventEmitter {
780
794
  else if (knxTunnelingRequest.cEMIMessage.msgCode === CEMIConstants.CEMIConstants.L_DATA_CON) {
781
795
 
782
796
  try {
783
- if (this.sysLogger !== undefined && this.sysLogger !== null) this.sysLogger.debug("Received KNX packet: TUNNELING_REQUEST L_DATA_CON, ChannelID:" + this._channelID + " seqCounter:" + knxTunnelingRequest.seqCounter + " Host:" + this._options.ipAddr + ":" + this._options.ipPort);
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);
784
798
  } catch (error) { }
785
799
 
786
800
  }
@@ -795,7 +809,7 @@ class KNXClient extends EventEmitter {
795
809
  }
796
810
 
797
811
  try {
798
- 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);
799
813
  } catch (error) { }
800
814
 
801
815
  this._incSeqNumber(knxTunnelingAck.seqCounter);
@@ -804,7 +818,7 @@ class KNXClient extends EventEmitter {
804
818
  if (this._tunnelReqTimer.get(knxTunnelingAck.seqCounter) !== null) clearTimeout(this._tunnelReqTimer.get(knxTunnelingAck.seqCounter));
805
819
  this._tunnelReqTimer.delete(knxTunnelingAck.seqCounter);
806
820
  try {
807
- if (this.sysLogger !== undefined && this.sysLogger !== null) this.sysLogger.debug("_processInboundMessage: DELETED_TUNNELING_ACK FROM PENDING ACK's, ChannelID:" + this._channelID + " seqCounter:" + knxTunnelingAck.seqCounter + " Host:" + this._options.ipAddr + ":" + this._options.ipPort);
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);
808
822
  } catch (error) { }
809
823
  }
810
824
  else {
@@ -812,16 +826,30 @@ class KNXClient extends EventEmitter {
812
826
  // Avoid warning if the KNXEngine is set to ignore ACK's telegrams
813
827
  if (!this._options.suppress_ack_ldatareq) {
814
828
  try {
815
- if (this.sysLogger !== undefined && this.sysLogger !== null) this.sysLogger.error("_processInboundMessage: Unexpected Tunnel Ack with seqCounter = " + knxTunnelingAck.seqCounter);
829
+ if (this.sysLogger !== undefined && this.sysLogger !== null) this.sysLogger.error("Received KNX packet: TUNNELING: Unexpected Tunnel Ack with seqCounter = " + knxTunnelingAck.seqCounter);
816
830
  } catch (error) { }
817
831
  //this.emit(KNXClientEvents.error, `Unexpected Tunnel Ack ${knxTunnelingAck.seqCounter}`);
818
832
  }
819
833
  }
820
834
 
821
835
  } else if (knxHeader.service_type === KNXConstants.KNX_CONSTANTS.ROUTING_INDICATION) {
836
+
822
837
  // 07/12/2021 Multicast routing indication
823
838
  const knxRoutingInd = knxMessage;
824
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
+
849
+ try {
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
+
825
853
  try {
826
854
  this.emit(KNXClientEvents.indication, knxRoutingInd, false, msg.toString("hex"));
827
855
  } catch (error) {
@@ -829,6 +857,10 @@ class KNXClient extends EventEmitter {
829
857
  }
830
858
  else if (knxRoutingInd.cEMIMessage.msgCode === CEMIConstants.CEMIConstants.L_DATA_CON) {
831
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
+
832
864
  }
833
865
 
834
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 KNXConstants_1 = require("./KNXConstants");
4
+ const KNXConstants = require("./KNXConstants");
5
5
  class KNXHeader {
6
6
  constructor(type, length) {
7
- this._headerLength = KNXConstants_1.KNX_CONSTANTS.HEADER_SIZE_10;
8
- this._version = KNXConstants_1.KNX_CONSTANTS.KNXNETIP_VERSION_10;
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 = KNXConstants_1.KNX_CONSTANTS.HEADER_SIZE_10 + 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 < KNXConstants_1.KNX_CONSTANTS.HEADER_SIZE_10) {
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 !== KNXConstants_1.KNX_CONSTANTS.HEADER_SIZE_10) {
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 !== KNXConstants_1.KNX_CONSTANTS.KNXNETIP_VERSION_10) {
28
+ if (version !== KNXConstants.KNX_CONSTANTS.KNXNETIP_VERSION_10) {
29
29
  throw new Error(`Unknown version ${version}`);
30
30
  }
31
31
  offset += 1;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-red-contrib-knx-ultimate",
3
- "version": "1.3.6",
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",
package/_config.yml DELETED
@@ -1 +0,0 @@
1
- theme: jekyll-theme-hacker