zigbee-herdsman 0.34.2 → 0.34.4

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.
@@ -64,7 +64,7 @@ var EzspEvents;
64
64
  /** params => type: EmberOutgoingMessageType, indexOrDestination: number, apsFrame: EmberApsFrame, messageTag: number */
65
65
  EzspEvents["MESSAGE_SENT_DELIVERY_FAILED"] = "MESSAGE_SENT_DELIVERY_FAILED";
66
66
  //-- ezspGpepIncomingMessageHandler
67
- /** params => sender: number | EmberEUI64, gpdCommandId: number, gpdLink: number, sequenceNumber: number, deviceId?: number, options?: number, key?: EmberKeyData, counter?: number */
67
+ /** params => sequenceNumber: number, commandIdentifier: number, sourceId: number, frameCounter: number, gpdCommandId: number, gpdCommandPayload: Buffer, gpdLink: number */
68
68
  EzspEvents["GREENPOWER_MESSAGE"] = "GREENPOWER_MESSAGE";
69
69
  })(EzspEvents || (exports.EzspEvents = EzspEvents = {}));
70
70
  /* eslint-enable max-len */
@@ -6119,36 +6119,25 @@ class Ezsp extends events_1.default {
6119
6119
  */
6120
6120
  ezspGpepIncomingMessageHandler(status, gpdLink, sequenceNumber, addr, gpdfSecurityLevel, gpdfSecurityKeyType, autoCommissioning, bidirectionalInfo, gpdSecurityFrameCounter, gpdCommandId, mic, proxyTableIndex, gpdCommandPayload) {
6121
6121
  debug(`ezspGpepIncomingMessageHandler(): callback called with: [status=${enums_1.EmberStatus[status]}], [gpdLink=${gpdLink}], `
6122
- + `[sequenceNumber=${sequenceNumber}], [addr=${addr}], [gpdfSecurityLevel=${gpdfSecurityLevel}], `
6122
+ + `[sequenceNumber=${sequenceNumber}], [addr=${JSON.stringify(addr)}], [gpdfSecurityLevel=${gpdfSecurityLevel}], `
6123
6123
  + `[gpdfSecurityKeyType=${gpdfSecurityKeyType}], [autoCommissioning=${autoCommissioning}], [bidirectionalInfo=${bidirectionalInfo}], `
6124
6124
  + `[gpdSecurityFrameCounter=${gpdSecurityFrameCounter}], [gpdCommandId=${gpdCommandId}], [mic=${mic}], `
6125
- + `[proxyTableIndex=${proxyTableIndex}], [gpdCommandPayload=${gpdCommandPayload}]`);
6126
- // TODO: triple-checking required here
6127
- if (gpdCommandPayload.length) {
6128
- const gpdBuffalo = new buffalo_1.EzspBuffalo(gpdCommandPayload, 0);
6129
- switch (gpdCommandId) {
6130
- case 0xE0: {
6131
- // commissioning notification
6132
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
6133
- const st = gpdBuffalo.readUInt8();
6134
- const deviceId = gpdBuffalo.readUInt8();
6135
- const options = gpdBuffalo.readUInt8();
6136
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
6137
- const extOptions = gpdBuffalo.readUInt8();
6138
- const key = gpdBuffalo.readEmberKeyData();
6139
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
6140
- const mic = gpdBuffalo.readUInt32();
6141
- const counter = gpdBuffalo.readUInt32();
6142
- this.emit(EzspEvents.GREENPOWER_MESSAGE, (addr.applicationId === enums_1.EmberGpApplicationId.SOURCE_ID) ? addr.sourceId : addr.gpdIeeeAddress, gpdCommandId, gpdLink, sequenceNumber, deviceId, options, key, counter);
6143
- break;
6144
- }
6145
- default: {
6146
- // notification
6147
- this.emit(EzspEvents.GREENPOWER_MESSAGE, (addr.applicationId === enums_1.EmberGpApplicationId.SOURCE_ID) ? addr.sourceId : addr.gpdIeeeAddress, gpdCommandId, gpdLink, sequenceNumber, null, null, null, null);
6148
- break;
6149
- }
6125
+ + `[proxyTableIndex=${proxyTableIndex}], [gpdCommandPayload=${gpdCommandPayload.toString('hex')}]`);
6126
+ if (addr.applicationId === enums_1.EmberGpApplicationId.IEEE_ADDRESS) {
6127
+ // XXX: don't bother parsing for upstream for now, since it will be rejected
6128
+ console.error(`<=== [GP] Received IEEE address type in message. Support not implemented upstream. Dropping.`);
6129
+ return;
6130
+ }
6131
+ let commandIdentifier = cluster_1.default.greenPower.commands.notification.ID;
6132
+ if (gpdCommandId === 0xE0) {
6133
+ if (!gpdCommandPayload.length) {
6134
+ // XXX: seem to be receiving duplicate commissioningNotification from some devices, second one with empty payload?
6135
+ // this will mess with the process no doubt, so dropping them
6136
+ return;
6150
6137
  }
6138
+ commandIdentifier = cluster_1.default.greenPower.commands.commissioningNotification.ID;
6151
6139
  }
6140
+ this.emit(EzspEvents.GREENPOWER_MESSAGE, sequenceNumber, commandIdentifier, addr.sourceId, gpdSecurityFrameCounter, gpdCommandId, gpdCommandPayload, gpdLink);
6152
6141
  }
6153
6142
  /**
6154
6143
  * Retrieves the proxy table entry stored at the passed index.