zigbee-herdsman 0.57.3 → 1.0.0

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.
Files changed (145) hide show
  1. package/.github/workflows/release_please.yml +1 -1
  2. package/.release-please-manifest.json +1 -1
  3. package/CHANGELOG.md +26 -0
  4. package/dist/adapter/adapter.d.ts +1 -1
  5. package/dist/adapter/adapter.d.ts.map +1 -1
  6. package/dist/adapter/adapter.js +2 -1
  7. package/dist/adapter/adapter.js.map +1 -1
  8. package/dist/adapter/deconz/adapter/deconzAdapter.d.ts.map +1 -1
  9. package/dist/adapter/deconz/adapter/deconzAdapter.js +13 -12
  10. package/dist/adapter/deconz/adapter/deconzAdapter.js.map +1 -1
  11. package/dist/adapter/ember/adapter/emberAdapter.d.ts +0 -14
  12. package/dist/adapter/ember/adapter/emberAdapter.d.ts.map +1 -1
  13. package/dist/adapter/ember/adapter/emberAdapter.js +69 -114
  14. package/dist/adapter/ember/adapter/emberAdapter.js.map +1 -1
  15. package/dist/adapter/ember/adapter/oneWaitress.d.ts.map +1 -1
  16. package/dist/adapter/ember/adapter/oneWaitress.js +1 -2
  17. package/dist/adapter/ember/adapter/oneWaitress.js.map +1 -1
  18. package/dist/adapter/ember/ezsp/ezsp.d.ts.map +1 -1
  19. package/dist/adapter/ember/ezsp/ezsp.js +15 -15
  20. package/dist/adapter/ember/ezsp/ezsp.js.map +1 -1
  21. package/dist/adapter/ember/uart/ash.js +2 -2
  22. package/dist/adapter/ember/uart/ash.js.map +1 -1
  23. package/dist/adapter/ezsp/adapter/ezspAdapter.d.ts.map +1 -1
  24. package/dist/adapter/ezsp/adapter/ezspAdapter.js +27 -26
  25. package/dist/adapter/ezsp/adapter/ezspAdapter.js.map +1 -1
  26. package/dist/adapter/ezsp/driver/driver.d.ts +1 -2
  27. package/dist/adapter/ezsp/driver/driver.d.ts.map +1 -1
  28. package/dist/adapter/ezsp/driver/driver.js +33 -11
  29. package/dist/adapter/ezsp/driver/driver.js.map +1 -1
  30. package/dist/adapter/ezsp/driver/ezsp.js +4 -4
  31. package/dist/adapter/ezsp/driver/ezsp.js.map +1 -1
  32. package/dist/adapter/ezsp/driver/uart.js +3 -3
  33. package/dist/adapter/ezsp/driver/uart.js.map +1 -1
  34. package/dist/adapter/serialPort.js +5 -5
  35. package/dist/adapter/serialPort.js.map +1 -1
  36. package/dist/adapter/z-stack/adapter/adapter-backup.d.ts.map +1 -1
  37. package/dist/adapter/z-stack/adapter/adapter-backup.js +9 -9
  38. package/dist/adapter/z-stack/adapter/adapter-backup.js.map +1 -1
  39. package/dist/adapter/z-stack/adapter/manager.d.ts +3 -1
  40. package/dist/adapter/z-stack/adapter/manager.d.ts.map +1 -1
  41. package/dist/adapter/z-stack/adapter/manager.js +5 -6
  42. package/dist/adapter/z-stack/adapter/manager.js.map +1 -1
  43. package/dist/adapter/z-stack/adapter/zStackAdapter.d.ts +1 -2
  44. package/dist/adapter/z-stack/adapter/zStackAdapter.d.ts.map +1 -1
  45. package/dist/adapter/z-stack/adapter/zStackAdapter.js +113 -112
  46. package/dist/adapter/z-stack/adapter/zStackAdapter.js.map +1 -1
  47. package/dist/adapter/z-stack/unpi/frame.js +2 -2
  48. package/dist/adapter/z-stack/unpi/frame.js.map +1 -1
  49. package/dist/adapter/z-stack/znp/buffaloZnp.d.ts +0 -4
  50. package/dist/adapter/z-stack/znp/buffaloZnp.d.ts.map +1 -1
  51. package/dist/adapter/z-stack/znp/buffaloZnp.js +6 -101
  52. package/dist/adapter/z-stack/znp/buffaloZnp.js.map +1 -1
  53. package/dist/adapter/z-stack/znp/definition.d.ts +13 -1
  54. package/dist/adapter/z-stack/znp/definition.d.ts.map +1 -1
  55. package/dist/adapter/z-stack/znp/definition.js +164 -75
  56. package/dist/adapter/z-stack/znp/definition.js.map +1 -1
  57. package/dist/adapter/z-stack/znp/parameterType.d.ts +0 -4
  58. package/dist/adapter/z-stack/znp/parameterType.d.ts.map +1 -1
  59. package/dist/adapter/z-stack/znp/parameterType.js +0 -4
  60. package/dist/adapter/z-stack/znp/parameterType.js.map +1 -1
  61. package/dist/adapter/z-stack/znp/tstype.d.ts +26 -8
  62. package/dist/adapter/z-stack/znp/tstype.d.ts.map +1 -1
  63. package/dist/adapter/z-stack/znp/utils.d.ts +3 -0
  64. package/dist/adapter/z-stack/znp/utils.d.ts.map +1 -0
  65. package/dist/adapter/z-stack/znp/utils.js +11 -0
  66. package/dist/adapter/z-stack/znp/utils.js.map +1 -0
  67. package/dist/adapter/z-stack/znp/znp.d.ts +0 -1
  68. package/dist/adapter/z-stack/znp/znp.d.ts.map +1 -1
  69. package/dist/adapter/z-stack/znp/znp.js +15 -35
  70. package/dist/adapter/z-stack/znp/znp.js.map +1 -1
  71. package/dist/adapter/z-stack/znp/zpiObject.d.ts +7 -7
  72. package/dist/adapter/z-stack/znp/zpiObject.d.ts.map +1 -1
  73. package/dist/adapter/z-stack/znp/zpiObject.js +35 -43
  74. package/dist/adapter/z-stack/znp/zpiObject.js.map +1 -1
  75. package/dist/adapter/zboss/adapter/zbossAdapter.d.ts.map +1 -1
  76. package/dist/adapter/zboss/adapter/zbossAdapter.js +21 -20
  77. package/dist/adapter/zboss/adapter/zbossAdapter.js.map +1 -1
  78. package/dist/adapter/zboss/driver.js +16 -16
  79. package/dist/adapter/zboss/driver.js.map +1 -1
  80. package/dist/adapter/zboss/uart.d.ts.map +1 -1
  81. package/dist/adapter/zboss/uart.js +12 -11
  82. package/dist/adapter/zboss/uart.js.map +1 -1
  83. package/dist/adapter/zigate/adapter/zigateAdapter.d.ts.map +1 -1
  84. package/dist/adapter/zigate/adapter/zigateAdapter.js +20 -19
  85. package/dist/adapter/zigate/adapter/zigateAdapter.js.map +1 -1
  86. package/dist/adapter/zigate/driver/buffaloZiGate.d.ts.map +1 -1
  87. package/dist/adapter/zigate/driver/buffaloZiGate.js +1 -2
  88. package/dist/adapter/zigate/driver/buffaloZiGate.js.map +1 -1
  89. package/dist/adapter/zigate/driver/frame.js +1 -1
  90. package/dist/adapter/zigate/driver/frame.js.map +1 -1
  91. package/dist/adapter/zigate/driver/zigate.d.ts.map +1 -1
  92. package/dist/adapter/zigate/driver/zigate.js +11 -11
  93. package/dist/adapter/zigate/driver/zigate.js.map +1 -1
  94. package/dist/buffalo/buffalo.d.ts +8 -0
  95. package/dist/buffalo/buffalo.d.ts.map +1 -1
  96. package/dist/buffalo/buffalo.js +46 -2
  97. package/dist/buffalo/buffalo.js.map +1 -1
  98. package/dist/controller/controller.js +6 -6
  99. package/dist/controller/controller.js.map +1 -1
  100. package/dist/controller/greenPower.d.ts.map +1 -1
  101. package/dist/controller/greenPower.js +8 -7
  102. package/dist/controller/greenPower.js.map +1 -1
  103. package/dist/controller/helpers/requestQueue.js +1 -1
  104. package/dist/controller/helpers/requestQueue.js.map +1 -1
  105. package/dist/controller/model/device.js +4 -4
  106. package/dist/controller/model/device.js.map +1 -1
  107. package/dist/controller/model/endpoint.d.ts +1 -1
  108. package/dist/controller/model/endpoint.d.ts.map +1 -1
  109. package/dist/controller/model/endpoint.js +12 -13
  110. package/dist/controller/model/endpoint.js.map +1 -1
  111. package/dist/controller/model/group.d.ts.map +1 -1
  112. package/dist/controller/model/group.js +9 -9
  113. package/dist/controller/model/group.js.map +1 -1
  114. package/dist/utils/logger.d.ts +4 -4
  115. package/dist/utils/logger.d.ts.map +1 -1
  116. package/dist/utils/logger.js +4 -4
  117. package/dist/utils/logger.js.map +1 -1
  118. package/dist/zspec/zcl/buffaloZcl.d.ts +0 -14
  119. package/dist/zspec/zcl/buffaloZcl.d.ts.map +1 -1
  120. package/dist/zspec/zcl/buffaloZcl.js +14 -87
  121. package/dist/zspec/zcl/buffaloZcl.js.map +1 -1
  122. package/dist/zspec/zcl/definition/cluster.d.ts.map +1 -1
  123. package/dist/zspec/zcl/definition/cluster.js +1 -0
  124. package/dist/zspec/zcl/definition/cluster.js.map +1 -1
  125. package/dist/zspec/zdo/buffaloZdo.d.ts +199 -85
  126. package/dist/zspec/zdo/buffaloZdo.d.ts.map +1 -1
  127. package/dist/zspec/zdo/buffaloZdo.js +434 -404
  128. package/dist/zspec/zdo/buffaloZdo.js.map +1 -1
  129. package/dist/zspec/zdo/definition/clusters.d.ts +1 -1
  130. package/dist/zspec/zdo/definition/clusters.d.ts.map +1 -1
  131. package/dist/zspec/zdo/definition/clusters.js +1 -1
  132. package/dist/zspec/zdo/definition/clusters.js.map +1 -1
  133. package/dist/zspec/zdo/definition/enums.d.ts +10 -0
  134. package/dist/zspec/zdo/definition/enums.d.ts.map +1 -1
  135. package/dist/zspec/zdo/definition/enums.js +12 -1
  136. package/dist/zspec/zdo/definition/enums.js.map +1 -1
  137. package/dist/zspec/zdo/definition/tstypes.d.ts +7 -5
  138. package/dist/zspec/zdo/definition/tstypes.d.ts.map +1 -1
  139. package/dist/zspec/zdo/index.d.ts +1 -0
  140. package/dist/zspec/zdo/index.d.ts.map +1 -1
  141. package/dist/zspec/zdo/index.js +3 -1
  142. package/dist/zspec/zdo/index.js.map +1 -1
  143. package/dist/zspec/zdo/utils.js +2 -2
  144. package/eslint.config.mjs +2 -2
  145. package/package.json +10 -10
@@ -37,7 +37,6 @@ const logger_1 = require("../../../utils/logger");
37
37
  const ZSpec = __importStar(require("../../../zspec"));
38
38
  const Zcl = __importStar(require("../../../zspec/zcl"));
39
39
  const Zdo = __importStar(require("../../../zspec/zdo"));
40
- const buffaloZdo_1 = require("../../../zspec/zdo/buffaloZdo");
41
40
  const serialPortUtils_1 = __importDefault(require("../../serialPortUtils"));
42
41
  const socketPortUtils_1 = __importDefault(require("../../socketPortUtils"));
43
42
  const consts_1 = require("../consts");
@@ -52,18 +51,6 @@ const math_1 = require("../utils/math");
52
51
  const endpoints_1 = require("./endpoints");
53
52
  const oneWaitress_1 = require("./oneWaitress");
54
53
  const NS = 'zh:ember';
55
- /** Enum to pass strings from numbers up to Z2M. */
56
- var RoutingTableStatus;
57
- (function (RoutingTableStatus) {
58
- RoutingTableStatus[RoutingTableStatus["ACTIVE"] = 0] = "ACTIVE";
59
- RoutingTableStatus[RoutingTableStatus["DISCOVERY_UNDERWAY"] = 1] = "DISCOVERY_UNDERWAY";
60
- RoutingTableStatus[RoutingTableStatus["DISCOVERY_FAILED"] = 2] = "DISCOVERY_FAILED";
61
- RoutingTableStatus[RoutingTableStatus["INACTIVE"] = 3] = "INACTIVE";
62
- RoutingTableStatus[RoutingTableStatus["VALIDATION_UNDERWAY"] = 4] = "VALIDATION_UNDERWAY";
63
- RoutingTableStatus[RoutingTableStatus["RESERVED1"] = 5] = "RESERVED1";
64
- RoutingTableStatus[RoutingTableStatus["RESERVED2"] = 6] = "RESERVED2";
65
- RoutingTableStatus[RoutingTableStatus["RESERVED3"] = 7] = "RESERVED3";
66
- })(RoutingTableStatus || (RoutingTableStatus = {}));
67
54
  var NetworkInitAction;
68
55
  (function (NetworkInitAction) {
69
56
  /** Ain't that nice! */
@@ -364,7 +351,7 @@ class EmberAdapter extends __1.Adapter {
364
351
  if (status !== enums_1.SLStatus.OK) {
365
352
  throw new Error(`Failed to register group '${multicastEntry.multicastId}' in multicast table with status=${enums_1.SLStatus[status]}.`);
366
353
  }
367
- logger_1.logger.debug(`Registered multicast table entry (${tableIdx}): ${JSON.stringify(multicastEntry)}.`, NS);
354
+ logger_1.logger.debug(() => `Registered multicast table entry (${tableIdx}): ${JSON.stringify(multicastEntry)}.`, NS);
368
355
  });
369
356
  }
370
357
  catch (error) {
@@ -386,9 +373,9 @@ class EmberAdapter extends __1.Adapter {
386
373
  * @param messageContents The content of the response.
387
374
  */
388
375
  async onZDOResponse(apsFrame, sender, messageContents) {
389
- try {
390
- const payload = buffaloZdo_1.BuffaloZdo.readResponse(apsFrame.clusterId, messageContents);
391
- logger_1.logger.debug(`<~~~ [ZDO ${Zdo.ClusterId[apsFrame.clusterId]} from=${sender} ${payload ? JSON.stringify(payload) : 'OK'}]`, NS);
376
+ const [status, payload] = Zdo.Buffalo.readResponse(this.hasZdoMessageOverhead, apsFrame.clusterId, messageContents);
377
+ if (status === Zdo.Status.SUCCESS) {
378
+ logger_1.logger.debug(() => `<~~~ [ZDO ${Zdo.ClusterId[apsFrame.clusterId]} from=${sender} ${payload ? JSON.stringify(payload) : 'OK'}]`, NS);
392
379
  this.oneWaitress.resolveZDO(sender, apsFrame, payload);
393
380
  if (apsFrame.clusterId === Zdo.ClusterId.NETWORK_ADDRESS_RESPONSE) {
394
381
  this.emit('networkAddress', {
@@ -403,8 +390,8 @@ class EmberAdapter extends __1.Adapter {
403
390
  });
404
391
  }
405
392
  }
406
- catch (error) {
407
- this.oneWaitress.resolveZDO(sender, apsFrame, error);
393
+ else {
394
+ this.oneWaitress.resolveZDO(sender, apsFrame, new Zdo.StatusError(status));
408
395
  }
409
396
  }
410
397
  /**
@@ -563,7 +550,7 @@ class EmberAdapter extends __1.Adapter {
563
550
  }
564
551
  this.networkCache.parameters = parameters;
565
552
  this.networkCache.eui64 = await this.ezsp.ezspGetEui64();
566
- logger_1.logger.debug(`[INIT] Network Ready! ${JSON.stringify(this.networkCache)}`, NS);
553
+ logger_1.logger.debug(() => `[INIT] Network Ready! ${JSON.stringify(this.networkCache)}`, NS);
567
554
  this.watchdogCountersHandle = setInterval(this.watchdogCounters.bind(this), WATCHDOG_COUNTERS_FEED_INTERVAL);
568
555
  return result;
569
556
  }
@@ -621,7 +608,7 @@ class EmberAdapter extends __1.Adapter {
621
608
  if (status !== enums_1.SLStatus.OK) {
622
609
  throw new Error(`Failed to register group '${multicastId}' in multicast table with status=${enums_1.SLStatus[status]}.`);
623
610
  }
624
- logger_1.logger.debug(`Registered multicast table entry (${this.multicastTable.length}): ${JSON.stringify(multicastEntry)}.`, NS);
611
+ logger_1.logger.debug(() => `Registered multicast table entry (${this.multicastTable.length}): ${JSON.stringify(multicastEntry)}.`, NS);
625
612
  this.multicastTable.push(multicastEntry.multicastId);
626
613
  }
627
614
  }
@@ -662,7 +649,7 @@ class EmberAdapter extends __1.Adapter {
662
649
  // network
663
650
  await this.oneWaitress.startWaitingForEvent({ eventName: oneWaitress_1.OneWaitressEvents.STACK_STATUS_NETWORK_UP }, DEFAULT_NETWORK_REQUEST_TIMEOUT, '[INIT TC] Network init');
664
651
  const [npStatus, nodeType, netParams] = await this.ezsp.ezspGetNetworkParameters();
665
- logger_1.logger.debug(`[INIT TC] Current adapter network: nodeType=${enums_1.EmberNodeType[nodeType]} params=${JSON.stringify(netParams)}`, NS);
652
+ logger_1.logger.debug(() => `[INIT TC] Current adapter network: nodeType=${enums_1.EmberNodeType[nodeType]} params=${JSON.stringify(netParams)}`, NS);
666
653
  if (npStatus === enums_1.SLStatus.OK &&
667
654
  nodeType === enums_1.EmberNodeType.COORDINATOR &&
668
655
  this.networkOptions.panID === netParams.panId &&
@@ -813,7 +800,7 @@ class EmberAdapter extends __1.Adapter {
813
800
  nwkUpdateId: 0,
814
801
  channels: ZSpec.ALL_802_15_4_CHANNELS_MASK,
815
802
  };
816
- logger_1.logger.info(`[INIT FORM] Forming new network with: ${JSON.stringify(netParams)}`, NS);
803
+ logger_1.logger.info(() => `[INIT FORM] Forming new network with: ${JSON.stringify(netParams)}`, NS);
817
804
  status = await this.ezsp.ezspFormNetwork(netParams);
818
805
  if (status !== enums_1.SLStatus.OK) {
819
806
  throw new Error(`[INIT FORM] Failed form network request with status=${enums_1.SLStatus[status]}.`);
@@ -938,7 +925,7 @@ class EmberAdapter extends __1.Adapter {
938
925
  * On the other hand, the more often this runs, the more secure the network is...
939
926
  */
940
927
  async broadcastNetworkKeyUpdate() {
941
- return this.queue.execute(async () => {
928
+ return await this.queue.execute(async () => {
942
929
  logger_1.logger.warning(`[TRUST CENTER] Performing a network key update. This might take a while and disrupt normal operation.`, NS);
943
930
  // zero-filled = let stack generate new random network key
944
931
  let status = await this.ezsp.ezspBroadcastNextNetworkKey({ contents: Buffer.alloc(consts_2.EMBER_ENCRYPTION_KEY_SIZE) });
@@ -1081,7 +1068,7 @@ class EmberAdapter extends __1.Adapter {
1081
1068
  if (versionStruct.type !== enums_1.EmberVersionType.GA) {
1082
1069
  logger_1.logger.warning(`Adapter is running a non-GA version (${enums_1.EmberVersionType[versionStruct.type]}).`, NS);
1083
1070
  }
1084
- logger_1.logger.info(`Adapter version info: ${JSON.stringify(this.version)}`, NS);
1071
+ logger_1.logger.info(() => `Adapter version info: ${JSON.stringify(this.version)}`, NS);
1085
1072
  }
1086
1073
  /**
1087
1074
  * This function sets an EZSP config value.
@@ -1139,31 +1126,6 @@ class EmberAdapter extends __1.Adapter {
1139
1126
  const [status, reContext] = await this.ezsp.ezspAesMmoHash(context, true, data);
1140
1127
  return [status, reContext?.result];
1141
1128
  }
1142
- /**
1143
- * Enable local permit join and optionally broadcast the ZDO Mgmt_Permit_Join_req message.
1144
- * This API can be called from any device type and still return EMBER_SUCCESS.
1145
- * If the API is called from an end device, the permit association bit will just be left off.
1146
- *
1147
- * @param duration uint8_t The duration that the permit join bit will remain on
1148
- * and other devices will be able to join the current network.
1149
- * @param broadcastMgmtPermitJoin whether or not to broadcast the ZDO Mgmt_Permit_Join_req message.
1150
- *
1151
- * @returns status of whether or not permit join was enabled.
1152
- * @returns apsFrame Will be null if not broadcasting.
1153
- * @returns messageTag The tag passed to ezspSend${x} function.
1154
- */
1155
- async emberPermitJoining(duration, broadcastMgmtPermitJoin) {
1156
- let status = await this.ezsp.ezspPermitJoining(duration);
1157
- let apsFrame;
1158
- let messageTag;
1159
- logger_1.logger.debug(`Permit joining for ${duration} sec. status=${[status]}`, NS);
1160
- if (broadcastMgmtPermitJoin) {
1161
- // `authentication`: TC significance always 1 (zb specs)
1162
- const zdoPayload = buffaloZdo_1.BuffaloZdo.buildPermitJoining(duration, 1, []);
1163
- [status, apsFrame, messageTag] = await this.sendZDORequest(ZSpec.BroadcastAddress.DEFAULT, Zdo.ClusterId.PERMIT_JOINING_REQUEST, zdoPayload, exports.DEFAULT_APS_OPTIONS);
1164
- }
1165
- return [status, apsFrame, messageTag];
1166
- }
1167
1129
  /**
1168
1130
  * Set the trust center policy bitmask using decision.
1169
1131
  * @param decision
@@ -1185,7 +1147,7 @@ class EmberAdapter extends __1.Adapter {
1185
1147
  break;
1186
1148
  }*/
1187
1149
  }
1188
- return this.emberSetEzspPolicy(enums_2.EzspPolicyId.TRUST_CENTER_POLICY, policy);
1150
+ return await this.emberSetEzspPolicy(enums_2.EzspPolicyId.TRUST_CENTER_POLICY, policy);
1189
1151
  }
1190
1152
  //---- END EZSP wrappers
1191
1153
  //---- START Ember ZDO
@@ -1253,7 +1215,7 @@ class EmberAdapter extends __1.Adapter {
1253
1215
  return false;
1254
1216
  }
1255
1217
  try {
1256
- return serialPortUtils_1.default.is((0, utils_1.RealpathSync)(path), autoDetectDefinitions);
1218
+ return await serialPortUtils_1.default.is((0, utils_1.RealpathSync)(path), autoDetectDefinitions);
1257
1219
  }
1258
1220
  catch (error) {
1259
1221
  logger_1.logger.debug(`Failed to determine if path is valid: '${error}'`, NS);
@@ -1279,7 +1241,7 @@ class EmberAdapter extends __1.Adapter {
1279
1241
  }
1280
1242
  // queued, non-InterPAN
1281
1243
  async getCoordinator() {
1282
- return this.queue.execute(async () => {
1244
+ return await this.queue.execute(async () => {
1283
1245
  this.checkInterpanLock();
1284
1246
  // in all likelihood this will be retrieved from cache
1285
1247
  const ieeeAddr = await this.emberGetEui64();
@@ -1315,7 +1277,7 @@ class EmberAdapter extends __1.Adapter {
1315
1277
  // queued
1316
1278
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
1317
1279
  async backup(ieeeAddressesInDatabase) {
1318
- return this.queue.execute(async () => {
1280
+ return await this.queue.execute(async () => {
1319
1281
  // grab fresh version here, bypass cache
1320
1282
  const [netStatus, , netParams] = await this.ezsp.ezspGetNetworkParameters();
1321
1283
  if (netStatus !== enums_1.SLStatus.OK) {
@@ -1384,7 +1346,7 @@ class EmberAdapter extends __1.Adapter {
1384
1346
  }
1385
1347
  // queued, non-InterPAN
1386
1348
  async getNetworkParameters() {
1387
- return this.queue.execute(async () => {
1349
+ return await this.queue.execute(async () => {
1388
1350
  this.checkInterpanLock();
1389
1351
  // first call will cache for the others, but in all likelihood, it will all be from freshly cached after init
1390
1352
  // since Controller caches this also.
@@ -1400,9 +1362,9 @@ class EmberAdapter extends __1.Adapter {
1400
1362
  }
1401
1363
  // queued
1402
1364
  async changeChannel(newChannel) {
1403
- return this.queue.execute(async () => {
1365
+ return await this.queue.execute(async () => {
1404
1366
  this.checkInterpanLock();
1405
- const zdoPayload = buffaloZdo_1.BuffaloZdo.buildChannelChangeRequest(newChannel, null);
1367
+ const zdoPayload = Zdo.Buffalo.buildRequest(this.hasZdoMessageOverhead, Zdo.ClusterId.NWK_UPDATE_REQUEST, [newChannel], 0xfe, undefined, undefined, undefined);
1406
1368
  const [status] = await this.sendZDORequest(ZSpec.BroadcastAddress.SLEEPY, Zdo.ClusterId.NWK_UPDATE_REQUEST, zdoPayload, exports.DEFAULT_APS_OPTIONS);
1407
1369
  if (status !== enums_1.SLStatus.OK) {
1408
1370
  throw new Error(`[ZDO] Failed broadcast channel change to '${newChannel}' with status=${enums_1.SLStatus[status]}.`);
@@ -1413,7 +1375,7 @@ class EmberAdapter extends __1.Adapter {
1413
1375
  }
1414
1376
  // queued
1415
1377
  async setTransmitPower(value) {
1416
- return this.queue.execute(async () => {
1378
+ return await this.queue.execute(async () => {
1417
1379
  const status = await this.ezsp.ezspSetRadioPower(value);
1418
1380
  if (status !== enums_1.SLStatus.OK) {
1419
1381
  throw new Error(`Failed to set transmit power to ${value} status=${enums_1.SLStatus[status]}.`);
@@ -1443,7 +1405,7 @@ class EmberAdapter extends __1.Adapter {
1443
1405
  logger_1.logger.debug(`[ADD INSTALL CODE] CRC validated for '${ieeeAddress}'.`, NS);
1444
1406
  }
1445
1407
  }
1446
- return this.queue.execute(async () => {
1408
+ return await this.queue.execute(async () => {
1447
1409
  // Compute the key from the install code and CRC.
1448
1410
  const [aesStatus, keyContents] = await this.emberAesHashSimple(key);
1449
1411
  if (aesStatus !== enums_1.SLStatus.OK) {
@@ -1512,11 +1474,11 @@ class EmberAdapter extends __1.Adapter {
1512
1474
  };
1513
1475
  if (networkAddress) {
1514
1476
  // specific device that is not `Coordinator`
1515
- return this.queue.execute(async () => {
1477
+ return await this.queue.execute(async () => {
1516
1478
  this.checkInterpanLock();
1517
1479
  await preJoining();
1518
1480
  // `authentication`: TC significance always 1 (zb specs)
1519
- const zdoPayload = buffaloZdo_1.BuffaloZdo.buildPermitJoining(seconds, 1, []);
1481
+ const zdoPayload = Zdo.Buffalo.buildRequest(this.hasZdoMessageOverhead, Zdo.ClusterId.PERMIT_JOINING_REQUEST, seconds, 1, []);
1520
1482
  const [status, apsFrame] = await this.sendZDORequest(networkAddress, Zdo.ClusterId.PERMIT_JOINING_REQUEST, zdoPayload, exports.DEFAULT_APS_OPTIONS);
1521
1483
  if (status !== enums_1.SLStatus.OK) {
1522
1484
  throw new Error(`[ZDO] Failed permit joining request for '${networkAddress}' with status=${enums_1.SLStatus[status]}.`);
@@ -1529,42 +1491,35 @@ class EmberAdapter extends __1.Adapter {
1529
1491
  });
1530
1492
  }
1531
1493
  else {
1532
- // coordinator-only, or all
1533
- return this.queue.execute(async () => {
1494
+ // coordinator-only (0), or all
1495
+ return await this.queue.execute(async () => {
1534
1496
  this.checkInterpanLock();
1535
1497
  await preJoining();
1536
- // local permit join if `Coordinator`-only requested, else local + broadcast
1537
- const [status] = await this.emberPermitJoining(seconds, networkAddress === ZSpec.COORDINATOR_ADDRESS ? false : true);
1498
+ const status = await this.ezsp.ezspPermitJoining(seconds);
1538
1499
  if (status !== enums_1.SLStatus.OK) {
1539
- throw new Error(`[ZDO] Failed permit joining request with status=${enums_1.SLStatus[status]}.`);
1500
+ throw new Error(`[ZDO] Failed coordinator permit joining request with status=${enums_1.SLStatus[status]}.`);
1501
+ }
1502
+ logger_1.logger.debug(`Permit joining on coordinator for ${seconds} sec.`, NS);
1503
+ // broadcast permit joining ZDO
1504
+ if (networkAddress === undefined) {
1505
+ // `authentication`: TC significance always 1 (zb specs)
1506
+ const zdoPayload = Zdo.Buffalo.buildRequest(this.hasZdoMessageOverhead, Zdo.ClusterId.PERMIT_JOINING_REQUEST, seconds, 1, []);
1507
+ const [bcStatus] = await this.sendZDORequest(ZSpec.BroadcastAddress.DEFAULT, Zdo.ClusterId.PERMIT_JOINING_REQUEST, zdoPayload, exports.DEFAULT_APS_OPTIONS);
1508
+ if (bcStatus !== enums_1.SLStatus.OK) {
1509
+ // don't throw, coordinator succeeded at least
1510
+ logger_1.logger.error(`[ZDO] Failed broadcast permit joining request with status=${enums_1.SLStatus[bcStatus]}.`, NS);
1511
+ }
1540
1512
  }
1541
- // NOTE: because Z2M is refreshing the permit join duration early to prevent it from closing
1542
- // (every 200sec, even if only opened for 254sec), we can't wait for the stack opened status,
1543
- // as it won't trigger again if already opened... so instead we assume it worked
1544
- // NOTE2: with EZSP, 255=forever, and 254=max, but since upstream logic uses fixed 254 with interval refresh,
1545
- // we can't simply bypass upstream calls if called for "forever" to prevent useless NCP calls (3-4 each time),
1546
- // until called with 0 (disable), since we don't know if it was requested for forever or not...
1547
- // TLDR: upstream logic change required to allow this
1548
- // if (seconds) {
1549
- // await this.oneWaitress.startWaitingForEvent(
1550
- // {eventName: OneWaitressEvents.STACK_STATUS_NETWORK_OPENED},
1551
- // DEFAULT_ZCL_REQUEST_TIMEOUT,
1552
- // '[ZDO] Permit Joining',
1553
- // );
1554
- // } else {
1555
- // // NOTE: CLOSED stack status is not triggered if the network was not OPENED in the first place, so don't wait for it
1556
- // // same kind of problem as described above (upstream always tries to close after start, but EZSP already is)
1557
- // }
1558
1513
  });
1559
1514
  }
1560
1515
  }
1561
1516
  // queued, non-InterPAN
1562
1517
  async lqi(networkAddress) {
1563
- return this.queue.execute(async () => {
1518
+ return await this.queue.execute(async () => {
1564
1519
  this.checkInterpanLock();
1565
1520
  const neighbors = [];
1566
1521
  const request = async (startIndex) => {
1567
- const zdoPayload = buffaloZdo_1.BuffaloZdo.buildLqiTableRequest(startIndex);
1522
+ const zdoPayload = Zdo.Buffalo.buildRequest(this.hasZdoMessageOverhead, Zdo.ClusterId.LQI_TABLE_REQUEST, startIndex);
1568
1523
  const [status, apsFrame] = await this.sendZDORequest(networkAddress, Zdo.ClusterId.LQI_TABLE_REQUEST, zdoPayload, exports.DEFAULT_APS_OPTIONS);
1569
1524
  if (status !== enums_1.SLStatus.OK) {
1570
1525
  throw new Error(`[ZDO] Failed LQI request for '${networkAddress}' (index '${startIndex}') with status=${enums_1.SLStatus[status]}.`);
@@ -1597,11 +1552,11 @@ class EmberAdapter extends __1.Adapter {
1597
1552
  }
1598
1553
  // queued, non-InterPAN
1599
1554
  async routingTable(networkAddress) {
1600
- return this.queue.execute(async () => {
1555
+ return await this.queue.execute(async () => {
1601
1556
  this.checkInterpanLock();
1602
1557
  const table = [];
1603
1558
  const request = async (startIndex) => {
1604
- const zdoPayload = buffaloZdo_1.BuffaloZdo.buildRoutingTableRequest(startIndex);
1559
+ const zdoPayload = Zdo.Buffalo.buildRequest(this.hasZdoMessageOverhead, Zdo.ClusterId.ROUTING_TABLE_REQUEST, startIndex);
1605
1560
  const [status, apsFrame] = await this.sendZDORequest(networkAddress, Zdo.ClusterId.ROUTING_TABLE_REQUEST, zdoPayload, exports.DEFAULT_APS_OPTIONS);
1606
1561
  if (status !== enums_1.SLStatus.OK) {
1607
1562
  throw new Error(`[ZDO] Failed routing table request for '${networkAddress}' (index '${startIndex}') with status=${enums_1.SLStatus[status]}.`);
@@ -1614,7 +1569,7 @@ class EmberAdapter extends __1.Adapter {
1614
1569
  for (const entry of result.entryList) {
1615
1570
  table.push({
1616
1571
  destinationAddress: entry.destinationAddress,
1617
- status: RoutingTableStatus[entry.status], // get str value from enum to satisfy upstream's needs
1572
+ status: entry.status,
1618
1573
  nextHop: entry.nextHopAddress,
1619
1574
  });
1620
1575
  }
@@ -1632,9 +1587,9 @@ class EmberAdapter extends __1.Adapter {
1632
1587
  }
1633
1588
  // queued, non-InterPAN
1634
1589
  async nodeDescriptor(networkAddress) {
1635
- return this.queue.execute(async () => {
1590
+ return await this.queue.execute(async () => {
1636
1591
  this.checkInterpanLock();
1637
- const zdoPayload = buffaloZdo_1.BuffaloZdo.buildNodeDescriptorRequest(networkAddress);
1592
+ const zdoPayload = Zdo.Buffalo.buildRequest(this.hasZdoMessageOverhead, Zdo.ClusterId.NODE_DESCRIPTOR_REQUEST, networkAddress);
1638
1593
  const [status, apsFrame] = await this.sendZDORequest(networkAddress, Zdo.ClusterId.NODE_DESCRIPTOR_REQUEST, zdoPayload, exports.DEFAULT_APS_OPTIONS);
1639
1594
  if (status !== enums_1.SLStatus.OK) {
1640
1595
  throw new Error(`[ZDO] Failed node descriptor request for '${networkAddress}' with status=${enums_1.SLStatus[status]}.`);
@@ -1657,9 +1612,9 @@ class EmberAdapter extends __1.Adapter {
1657
1612
  break;
1658
1613
  }
1659
1614
  /* istanbul ignore else */
1660
- if (result.serverMask.stackComplianceResivion < CURRENT_ZIGBEE_SPEC_REVISION) {
1615
+ if (result.serverMask.stackComplianceRevision < CURRENT_ZIGBEE_SPEC_REVISION) {
1661
1616
  // always 0 before rev. 21 where field was added
1662
- const rev = result.serverMask.stackComplianceResivion < 21 ? 'pre-21' : result.serverMask.stackComplianceResivion;
1617
+ const rev = result.serverMask.stackComplianceRevision < 21 ? 'pre-21' : result.serverMask.stackComplianceRevision;
1663
1618
  logger_1.logger.warning(`[ZDO] Device '${networkAddress}' is only compliant to revision '${rev}' of the ZigBee specification (current revision: ${CURRENT_ZIGBEE_SPEC_REVISION}).`, NS);
1664
1619
  }
1665
1620
  return { type, manufacturerCode: result.manufacturerCode };
@@ -1667,9 +1622,9 @@ class EmberAdapter extends __1.Adapter {
1667
1622
  }
1668
1623
  // queued, non-InterPAN
1669
1624
  async activeEndpoints(networkAddress) {
1670
- return this.queue.execute(async () => {
1625
+ return await this.queue.execute(async () => {
1671
1626
  this.checkInterpanLock();
1672
- const zdoPayload = buffaloZdo_1.BuffaloZdo.buildActiveEndpointsRequest(networkAddress);
1627
+ const zdoPayload = Zdo.Buffalo.buildRequest(this.hasZdoMessageOverhead, Zdo.ClusterId.ACTIVE_ENDPOINTS_REQUEST, networkAddress);
1673
1628
  const [status, apsFrame] = await this.sendZDORequest(networkAddress, Zdo.ClusterId.ACTIVE_ENDPOINTS_REQUEST, zdoPayload, exports.DEFAULT_APS_OPTIONS);
1674
1629
  if (status !== enums_1.SLStatus.OK) {
1675
1630
  throw new Error(`[ZDO] Failed active endpoints request for '${networkAddress}' with status=${enums_1.SLStatus[status]}.`);
@@ -1684,9 +1639,9 @@ class EmberAdapter extends __1.Adapter {
1684
1639
  }
1685
1640
  // queued, non-InterPAN
1686
1641
  async simpleDescriptor(networkAddress, endpointID) {
1687
- return this.queue.execute(async () => {
1642
+ return await this.queue.execute(async () => {
1688
1643
  this.checkInterpanLock();
1689
- const zdoPayload = buffaloZdo_1.BuffaloZdo.buildSimpleDescriptorRequest(networkAddress, endpointID);
1644
+ const zdoPayload = Zdo.Buffalo.buildRequest(this.hasZdoMessageOverhead, Zdo.ClusterId.SIMPLE_DESCRIPTOR_REQUEST, networkAddress, endpointID);
1690
1645
  const [status, apsFrame] = await this.sendZDORequest(networkAddress, Zdo.ClusterId.SIMPLE_DESCRIPTOR_REQUEST, zdoPayload, exports.DEFAULT_APS_OPTIONS);
1691
1646
  if (status !== enums_1.SLStatus.OK) {
1692
1647
  throw new Error(`[ZDO] Failed simple descriptor request for '${networkAddress}' endpoint '${endpointID}' with status=${enums_1.SLStatus[status]}.`);
@@ -1707,9 +1662,9 @@ class EmberAdapter extends __1.Adapter {
1707
1662
  }
1708
1663
  // queued, non-InterPAN
1709
1664
  async bind(destinationNetworkAddress, sourceIeeeAddress, sourceEndpoint, clusterID, destinationAddressOrGroup, type, destinationEndpoint) {
1710
- return this.queue.execute(async () => {
1665
+ return await this.queue.execute(async () => {
1711
1666
  this.checkInterpanLock();
1712
- const zdoPayload = buffaloZdo_1.BuffaloZdo.buildBindRequest(sourceIeeeAddress, sourceEndpoint, clusterID, type === 'group' ? Zdo.MULTICAST_BINDING : Zdo.UNICAST_BINDING, destinationAddressOrGroup, // not used with MULTICAST_BINDING
1667
+ const zdoPayload = Zdo.Buffalo.buildRequest(this.hasZdoMessageOverhead, Zdo.ClusterId.BIND_REQUEST, sourceIeeeAddress, sourceEndpoint, clusterID, type === 'group' ? Zdo.MULTICAST_BINDING : Zdo.UNICAST_BINDING, destinationAddressOrGroup, // not used with MULTICAST_BINDING
1713
1668
  destinationAddressOrGroup, // not used with UNICAST_BINDING
1714
1669
  destinationEndpoint ?? 0);
1715
1670
  const [status, apsFrame] = await this.sendZDORequest(destinationNetworkAddress, Zdo.ClusterId.BIND_REQUEST, zdoPayload, exports.DEFAULT_APS_OPTIONS);
@@ -1725,9 +1680,9 @@ class EmberAdapter extends __1.Adapter {
1725
1680
  }
1726
1681
  // queued, non-InterPAN
1727
1682
  async unbind(destinationNetworkAddress, sourceIeeeAddress, sourceEndpoint, clusterID, destinationAddressOrGroup, type, destinationEndpoint) {
1728
- return this.queue.execute(async () => {
1683
+ return await this.queue.execute(async () => {
1729
1684
  this.checkInterpanLock();
1730
- const zdoPayload = buffaloZdo_1.BuffaloZdo.buildUnbindRequest(sourceIeeeAddress, sourceEndpoint, clusterID, type === 'group' ? Zdo.MULTICAST_BINDING : Zdo.UNICAST_BINDING, destinationAddressOrGroup, // not used with MULTICAST_BINDING
1685
+ const zdoPayload = Zdo.Buffalo.buildRequest(this.hasZdoMessageOverhead, Zdo.ClusterId.UNBIND_REQUEST, sourceIeeeAddress, sourceEndpoint, clusterID, type === 'group' ? Zdo.MULTICAST_BINDING : Zdo.UNICAST_BINDING, destinationAddressOrGroup, // not used with MULTICAST_BINDING
1731
1686
  destinationAddressOrGroup, // not used with UNICAST_BINDING
1732
1687
  destinationEndpoint ?? 0);
1733
1688
  const [status, apsFrame] = await this.sendZDORequest(destinationNetworkAddress, Zdo.ClusterId.UNBIND_REQUEST, zdoPayload, exports.DEFAULT_APS_OPTIONS);
@@ -1743,9 +1698,9 @@ class EmberAdapter extends __1.Adapter {
1743
1698
  }
1744
1699
  // queued, non-InterPAN
1745
1700
  async removeDevice(networkAddress, ieeeAddr) {
1746
- return this.queue.execute(async () => {
1701
+ return await this.queue.execute(async () => {
1747
1702
  this.checkInterpanLock();
1748
- const zdoPayload = buffaloZdo_1.BuffaloZdo.buildLeaveRequest(ieeeAddr, Zdo.LeaveRequestFlags.WITHOUT_REJOIN);
1703
+ const zdoPayload = Zdo.Buffalo.buildRequest(this.hasZdoMessageOverhead, Zdo.ClusterId.LEAVE_REQUEST, ieeeAddr, Zdo.LeaveRequestFlags.WITHOUT_REJOIN);
1749
1704
  const [status, apsFrame] = await this.sendZDORequest(networkAddress, Zdo.ClusterId.LEAVE_REQUEST, zdoPayload, exports.DEFAULT_APS_OPTIONS);
1750
1705
  if (status !== enums_1.SLStatus.OK) {
1751
1706
  throw new Error(`[ZDO] Failed remove device request for '${networkAddress}' target '${ieeeAddr}' with status=${enums_1.SLStatus[status]}.`);
@@ -1783,9 +1738,9 @@ class EmberAdapter extends __1.Adapter {
1783
1738
  apsFrame.options &= ~enums_1.EmberApsOption.RETRY;
1784
1739
  }
1785
1740
  const data = zclFrame.toBuffer();
1786
- return this.queue.execute(async () => {
1741
+ return await this.queue.execute(async () => {
1787
1742
  this.checkInterpanLock();
1788
- logger_1.logger.debug(`~~~> [ZCL to=${networkAddress} apsFrame=${JSON.stringify(apsFrame)} header=${JSON.stringify(zclFrame.header)}]`, NS);
1743
+ logger_1.logger.debug(() => `~~~> [ZCL to=${networkAddress} apsFrame=${JSON.stringify(apsFrame)} header=${JSON.stringify(zclFrame.header)}]`, NS);
1789
1744
  for (let i = 1; i <= QUEUE_MAX_SEND_ATTEMPTS; i++) {
1790
1745
  let status = enums_1.SLStatus.FAIL;
1791
1746
  try {
@@ -1850,9 +1805,9 @@ class EmberAdapter extends __1.Adapter {
1850
1805
  sequence: 0, // set by stack
1851
1806
  };
1852
1807
  const data = zclFrame.toBuffer();
1853
- return this.queue.execute(async () => {
1808
+ return await this.queue.execute(async () => {
1854
1809
  this.checkInterpanLock();
1855
- logger_1.logger.debug(`~~~> [ZCL GROUP apsFrame=${JSON.stringify(apsFrame)} header=${JSON.stringify(zclFrame.header)}]`, NS);
1810
+ logger_1.logger.debug(() => `~~~> [ZCL GROUP apsFrame=${JSON.stringify(apsFrame)} header=${JSON.stringify(zclFrame.header)}]`, NS);
1856
1811
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
1857
1812
  const [status, messageTag] = await this.ezsp.send(enums_1.EmberOutgoingMessageType.MULTICAST, apsFrame.groupId, // not used with MULTICAST
1858
1813
  apsFrame, data, 0, // alias
@@ -1877,9 +1832,9 @@ class EmberAdapter extends __1.Adapter {
1877
1832
  sequence: 0, // set by stack
1878
1833
  };
1879
1834
  const data = zclFrame.toBuffer();
1880
- return this.queue.execute(async () => {
1835
+ return await this.queue.execute(async () => {
1881
1836
  this.checkInterpanLock();
1882
- logger_1.logger.debug(`~~~> [ZCL BROADCAST apsFrame=${JSON.stringify(apsFrame)} header=${JSON.stringify(zclFrame.header)}]`, NS);
1837
+ logger_1.logger.debug(() => `~~~> [ZCL BROADCAST apsFrame=${JSON.stringify(apsFrame)} header=${JSON.stringify(zclFrame.header)}]`, NS);
1883
1838
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
1884
1839
  const [status, messageTag] = await this.ezsp.send(enums_1.EmberOutgoingMessageType.BROADCAST, destination, apsFrame, data, 0, // alias
1885
1840
  0);
@@ -1895,7 +1850,7 @@ class EmberAdapter extends __1.Adapter {
1895
1850
  // TODO: check all this touchlink/interpan stuff
1896
1851
  // queued
1897
1852
  async setChannelInterPAN(channel) {
1898
- return this.queue.execute(async () => {
1853
+ return await this.queue.execute(async () => {
1899
1854
  this.interpanLock = true;
1900
1855
  const status = await this.ezsp.ezspSetLogicalAndRadioChannel(channel);
1901
1856
  if (status !== enums_1.SLStatus.OK) {
@@ -1906,7 +1861,7 @@ class EmberAdapter extends __1.Adapter {
1906
1861
  }
1907
1862
  // queued
1908
1863
  async sendZclFrameInterPANToIeeeAddr(zclFrame, ieeeAddress) {
1909
- return this.queue.execute(async () => {
1864
+ return await this.queue.execute(async () => {
1910
1865
  const msgBuffalo = new buffalo_1.EzspBuffalo(Buffer.alloc(consts_1.MAXIMUM_INTERPAN_LENGTH));
1911
1866
  // cache-enabled getters
1912
1867
  const sourcePanId = await this.emberGetPanId();
@@ -1921,7 +1876,7 @@ class EmberAdapter extends __1.Adapter {
1921
1876
  msgBuffalo.writeUInt8(enums_1.EmberInterpanMessageType.UNICAST | consts_1.INTERPAN_APS_FRAME_TYPE); // apsFrameControl
1922
1877
  msgBuffalo.writeUInt16(zclFrame.cluster.ID);
1923
1878
  msgBuffalo.writeUInt16(ZSpec.TOUCHLINK_PROFILE_ID);
1924
- logger_1.logger.debug(`~~~> [ZCL TOUCHLINK to=${ieeeAddress} header=${JSON.stringify(zclFrame.header)}]`, NS);
1879
+ logger_1.logger.debug(() => `~~~> [ZCL TOUCHLINK to=${ieeeAddress} header=${JSON.stringify(zclFrame.header)}]`, NS);
1925
1880
  const status = await this.ezsp.ezspSendRawMessage(Buffer.concat([msgBuffalo.getWritten(), zclFrame.toBuffer()]), enums_1.EmberTransmitPriority.NORMAL, true);
1926
1881
  if (status !== enums_1.SLStatus.OK) {
1927
1882
  throw new Error(`~x~> [ZCL TOUCHLINK to=${ieeeAddress}] Failed to send with status=${enums_1.SLStatus[status]}.`);
@@ -1946,7 +1901,7 @@ class EmberAdapter extends __1.Adapter {
1946
1901
  groupId: ZSpec.BroadcastAddress.SLEEPY,
1947
1902
  sequence: 0, // set by stack
1948
1903
  };
1949
- return this.queue.execute(async () => {
1904
+ return await this.queue.execute(async () => {
1950
1905
  const msgBuffalo = new buffalo_1.EzspBuffalo(Buffer.alloc(consts_1.MAXIMUM_INTERPAN_LENGTH));
1951
1906
  // cache-enabled getters
1952
1907
  const sourcePanId = await this.emberGetPanId();
@@ -1962,7 +1917,7 @@ class EmberAdapter extends __1.Adapter {
1962
1917
  msgBuffalo.writeUInt16(apsFrame.clusterId);
1963
1918
  msgBuffalo.writeUInt16(apsFrame.profileId);
1964
1919
  const data = Buffer.concat([msgBuffalo.getWritten(), zclFrame.toBuffer()]);
1965
- logger_1.logger.debug(`~~~> [ZCL TOUCHLINK BROADCAST header=${JSON.stringify(zclFrame.header)}]`, NS);
1920
+ logger_1.logger.debug(() => `~~~> [ZCL TOUCHLINK BROADCAST header=${JSON.stringify(zclFrame.header)}]`, NS);
1966
1921
  const status = await this.ezsp.ezspSendRawMessage(data, enums_1.EmberTransmitPriority.NORMAL, true);
1967
1922
  if (status !== enums_1.SLStatus.OK) {
1968
1923
  throw new Error(`~x~> [ZCL TOUCHLINK BROADCAST] Failed to send with status=${enums_1.SLStatus[status]}.`);
@@ -1979,7 +1934,7 @@ class EmberAdapter extends __1.Adapter {
1979
1934
  }
1980
1935
  // queued
1981
1936
  async restoreChannelInterPAN() {
1982
- return this.queue.execute(async () => {
1937
+ return await this.queue.execute(async () => {
1983
1938
  const status = await this.ezsp.ezspSetLogicalAndRadioChannel(this.networkOptions.channelList[0]);
1984
1939
  if (status !== enums_1.SLStatus.OK) {
1985
1940
  throw new Error(`Failed to restore InterPAN channel to '${this.networkOptions.channelList[0]}' with status=${enums_1.SLStatus[status]}.`);