zigbee-herdsman 4.1.2 → 4.2.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.
Files changed (173) hide show
  1. package/.release-please-manifest.json +1 -1
  2. package/CHANGELOG.md +22 -0
  3. package/biome.json +14 -5
  4. package/dist/adapter/adapterDiscovery.d.ts +1 -1
  5. package/dist/adapter/adapterDiscovery.d.ts.map +1 -1
  6. package/dist/adapter/adapterDiscovery.js.map +1 -1
  7. package/dist/adapter/deconz/adapter/deconzAdapter.d.ts +5 -2
  8. package/dist/adapter/deconz/adapter/deconzAdapter.d.ts.map +1 -1
  9. package/dist/adapter/deconz/adapter/deconzAdapter.js +394 -330
  10. package/dist/adapter/deconz/adapter/deconzAdapter.js.map +1 -1
  11. package/dist/adapter/deconz/driver/constants.d.ts +122 -63
  12. package/dist/adapter/deconz/driver/constants.d.ts.map +1 -1
  13. package/dist/adapter/deconz/driver/constants.js +122 -40
  14. package/dist/adapter/deconz/driver/constants.js.map +1 -1
  15. package/dist/adapter/deconz/driver/driver.d.ts +66 -38
  16. package/dist/adapter/deconz/driver/driver.d.ts.map +1 -1
  17. package/dist/adapter/deconz/driver/driver.js +983 -435
  18. package/dist/adapter/deconz/driver/driver.js.map +1 -1
  19. package/dist/adapter/deconz/driver/frameParser.d.ts.map +1 -1
  20. package/dist/adapter/deconz/driver/frameParser.js +333 -266
  21. package/dist/adapter/deconz/driver/frameParser.js.map +1 -1
  22. package/dist/adapter/ember/adapter/emberAdapter.d.ts +1 -1
  23. package/dist/adapter/ember/adapter/emberAdapter.d.ts.map +1 -1
  24. package/dist/adapter/ember/adapter/emberAdapter.js +1 -1
  25. package/dist/adapter/ember/adapter/emberAdapter.js.map +1 -1
  26. package/dist/adapter/ember/adapter/tokensManager.d.ts.map +1 -1
  27. package/dist/adapter/ember/enums.d.ts +21 -370
  28. package/dist/adapter/ember/enums.d.ts.map +1 -1
  29. package/dist/adapter/ember/enums.js +20 -383
  30. package/dist/adapter/ember/enums.js.map +1 -1
  31. package/dist/adapter/ember/ezsp/buffalo.d.ts +1 -1
  32. package/dist/adapter/ember/ezsp/buffalo.d.ts.map +1 -1
  33. package/dist/adapter/ember/ezsp/consts.d.ts +1 -1
  34. package/dist/adapter/ember/ezsp/consts.js +1 -1
  35. package/dist/adapter/ember/ezsp/enums.d.ts +29 -3
  36. package/dist/adapter/ember/ezsp/enums.d.ts.map +1 -1
  37. package/dist/adapter/ember/ezsp/enums.js +29 -2
  38. package/dist/adapter/ember/ezsp/enums.js.map +1 -1
  39. package/dist/adapter/ember/ezsp/ezsp.d.ts +31 -6
  40. package/dist/adapter/ember/ezsp/ezsp.d.ts.map +1 -1
  41. package/dist/adapter/ember/ezsp/ezsp.js +66 -3
  42. package/dist/adapter/ember/ezsp/ezsp.js.map +1 -1
  43. package/dist/adapter/ember/uart/ash.js +1 -1
  44. package/dist/adapter/ezsp/adapter/ezspAdapter.d.ts.map +1 -1
  45. package/dist/adapter/ezsp/adapter/ezspAdapter.js +2 -2
  46. package/dist/adapter/ezsp/adapter/ezspAdapter.js.map +1 -1
  47. package/dist/adapter/ezsp/driver/driver.d.ts +1 -1
  48. package/dist/adapter/ezsp/driver/driver.d.ts.map +1 -1
  49. package/dist/adapter/ezsp/driver/driver.js +5 -5
  50. package/dist/adapter/ezsp/driver/driver.js.map +1 -1
  51. package/dist/adapter/ezsp/driver/types/index.d.ts +3 -3
  52. package/dist/adapter/ezsp/driver/types/index.d.ts.map +1 -1
  53. package/dist/adapter/ezsp/driver/types/index.js +6 -6
  54. package/dist/adapter/ezsp/driver/types/index.js.map +1 -1
  55. package/dist/adapter/ezsp/driver/types/named.js +1 -1
  56. package/dist/adapter/ezsp/driver/types/named.js.map +1 -1
  57. package/dist/adapter/serialPort.d.ts.map +1 -1
  58. package/dist/adapter/z-stack/adapter/manager.d.ts.map +1 -1
  59. package/dist/adapter/z-stack/adapter/manager.js +1 -1
  60. package/dist/adapter/z-stack/adapter/manager.js.map +1 -1
  61. package/dist/adapter/z-stack/adapter/zStackAdapter.js +2 -2
  62. package/dist/adapter/z-stack/adapter/zStackAdapter.js.map +1 -1
  63. package/dist/adapter/z-stack/structs/entries/index.d.ts +7 -7
  64. package/dist/adapter/z-stack/structs/entries/index.d.ts.map +1 -1
  65. package/dist/adapter/z-stack/structs/entries/index.js +7 -7
  66. package/dist/adapter/z-stack/structs/entries/index.js.map +1 -1
  67. package/dist/adapter/z-stack/structs/index.d.ts +2 -2
  68. package/dist/adapter/z-stack/structs/index.d.ts.map +1 -1
  69. package/dist/adapter/z-stack/structs/index.js +2 -2
  70. package/dist/adapter/z-stack/structs/index.js.map +1 -1
  71. package/dist/adapter/zboss/adapter/zbossAdapter.d.ts +1 -1
  72. package/dist/adapter/zboss/adapter/zbossAdapter.d.ts.map +1 -1
  73. package/dist/adapter/zboss/adapter/zbossAdapter.js +1 -1
  74. package/dist/adapter/zboss/adapter/zbossAdapter.js.map +1 -1
  75. package/dist/adapter/zboss/driver.d.ts +1 -1
  76. package/dist/adapter/zboss/driver.d.ts.map +1 -1
  77. package/dist/adapter/zboss/driver.js.map +1 -1
  78. package/dist/adapter/zboss/uart.d.ts.map +1 -1
  79. package/dist/adapter/zigate/driver/messageType.js +1 -1
  80. package/dist/adapter/zigate/driver/messageType.js.map +1 -1
  81. package/dist/adapter/zoh/adapter/zohAdapter.js +1 -1
  82. package/dist/adapter/zoh/adapter/zohAdapter.js.map +1 -1
  83. package/dist/buffalo/buffalo.d.ts.map +1 -1
  84. package/dist/buffalo/buffalo.js.map +1 -1
  85. package/dist/controller/controller.d.ts.map +1 -1
  86. package/dist/controller/controller.js +2 -2
  87. package/dist/controller/controller.js.map +1 -1
  88. package/dist/controller/helpers/request.js +2 -2
  89. package/dist/controller/helpers/request.js.map +1 -1
  90. package/dist/controller/model/device.js +1 -1
  91. package/dist/controller/model/device.js.map +1 -1
  92. package/dist/index.d.ts +5 -5
  93. package/dist/index.d.ts.map +1 -1
  94. package/dist/index.js +4 -4
  95. package/dist/index.js.map +1 -1
  96. package/dist/utils/backup.d.ts +1 -1
  97. package/dist/utils/backup.d.ts.map +1 -1
  98. package/dist/utils/backup.js +1 -1
  99. package/dist/utils/backup.js.map +1 -1
  100. package/dist/utils/utils.d.ts.map +1 -1
  101. package/dist/utils/utils.js +0 -1
  102. package/dist/utils/utils.js.map +1 -1
  103. package/dist/zspec/utils.d.ts.map +1 -1
  104. package/dist/zspec/utils.js.map +1 -1
  105. package/dist/zspec/zcl/index.d.ts +3 -3
  106. package/dist/zspec/zcl/index.d.ts.map +1 -1
  107. package/dist/zspec/zcl/index.js +6 -6
  108. package/dist/zspec/zcl/index.js.map +1 -1
  109. package/dist/zspec/zcl/utils.d.ts.map +1 -1
  110. package/dist/zspec/zcl/utils.js +0 -1
  111. package/dist/zspec/zcl/utils.js.map +1 -1
  112. package/dist/zspec/zdo/buffaloZdo.d.ts.map +1 -1
  113. package/dist/zspec/zdo/index.d.ts +3 -3
  114. package/dist/zspec/zdo/index.d.ts.map +1 -1
  115. package/dist/zspec/zdo/index.js +6 -6
  116. package/dist/zspec/zdo/index.js.map +1 -1
  117. package/package.json +4 -4
  118. package/src/adapter/adapterDiscovery.ts +1 -4
  119. package/src/adapter/deconz/adapter/deconzAdapter.ts +474 -369
  120. package/src/adapter/deconz/driver/constants.ts +148 -82
  121. package/src/adapter/deconz/driver/driver.ts +1092 -503
  122. package/src/adapter/deconz/driver/frameParser.ts +351 -272
  123. package/src/adapter/ember/adapter/emberAdapter.ts +2 -3
  124. package/src/adapter/ember/adapter/tokensManager.ts +1 -1
  125. package/src/adapter/ember/enums.ts +20 -397
  126. package/src/adapter/ember/ezsp/buffalo.ts +3 -3
  127. package/src/adapter/ember/ezsp/consts.ts +1 -1
  128. package/src/adapter/ember/ezsp/enums.ts +31 -4
  129. package/src/adapter/ember/ezsp/ezsp.ts +84 -8
  130. package/src/adapter/ember/uart/ash.ts +1 -1
  131. package/src/adapter/ezsp/adapter/ezspAdapter.ts +2 -2
  132. package/src/adapter/ezsp/driver/commands.ts +5 -5
  133. package/src/adapter/ezsp/driver/driver.ts +6 -6
  134. package/src/adapter/ezsp/driver/ezsp.ts +3 -3
  135. package/src/adapter/ezsp/driver/types/index.ts +3 -3
  136. package/src/adapter/ezsp/driver/types/named.ts +1 -1
  137. package/src/adapter/serialPort.ts +1 -1
  138. package/src/adapter/z-stack/adapter/manager.ts +2 -3
  139. package/src/adapter/z-stack/adapter/zStackAdapter.ts +2 -2
  140. package/src/adapter/z-stack/structs/entries/index.ts +7 -7
  141. package/src/adapter/z-stack/structs/index.ts +2 -2
  142. package/src/adapter/zboss/adapter/zbossAdapter.ts +1 -2
  143. package/src/adapter/zboss/driver.ts +2 -3
  144. package/src/adapter/zboss/uart.ts +1 -1
  145. package/src/adapter/zigate/adapter/zigateAdapter.ts +1 -1
  146. package/src/adapter/zigate/driver/messageType.ts +1 -1
  147. package/src/adapter/zigate/driver/zigate.ts +1 -1
  148. package/src/adapter/zoh/adapter/zohAdapter.ts +1 -1
  149. package/src/buffalo/buffalo.ts +1 -2
  150. package/src/controller/controller.ts +2 -2
  151. package/src/controller/helpers/request.ts +2 -2
  152. package/src/controller/model/device.ts +1 -1
  153. package/src/index.ts +5 -5
  154. package/src/utils/backup.ts +1 -1
  155. package/src/utils/utils.ts +0 -1
  156. package/src/zspec/utils.ts +1 -3
  157. package/src/zspec/zcl/index.ts +3 -3
  158. package/src/zspec/zcl/utils.ts +0 -1
  159. package/src/zspec/zdo/buffaloZdo.ts +2 -2
  160. package/src/zspec/zdo/index.ts +3 -3
  161. package/test/adapter/adapter.test.ts +1 -2
  162. package/test/adapter/ember/ash.test.ts +1 -1
  163. package/test/adapter/ember/emberAdapter.test.ts +1 -1
  164. package/test/adapter/ember/ezsp.test.ts +2 -3
  165. package/test/adapter/ezsp/uart.test.ts +3 -3
  166. package/test/adapter/z-stack/znp.test.ts +6 -6
  167. package/test/adapter/zboss/fixZdoResponse.test.ts +1 -1
  168. package/test/adapter/zoh/zohAdapter.test.ts +2 -2
  169. package/test/controller.test.ts +8 -8
  170. package/test/greenpower.test.ts +1 -2
  171. package/test/tsconfig.json +1 -1
  172. package/test/utils.test.ts +1 -1
  173. package/test/zspec/zdo/buffalo.test.ts +1 -1
@@ -50,15 +50,15 @@ import {
50
50
  EmberOutgoingMessageType,
51
51
  type EmberSourceRouteDiscoveryMode,
52
52
  EmberStackError,
53
- type EmberTXPowerMode,
54
53
  type EmberTransmitPriority,
54
+ type EmberTXPowerMode,
55
55
  type EzspNetworkScanType,
56
56
  EzspStatus,
57
57
  type EzspZllNetworkOperation,
58
58
  type IEEE802154CcaMode,
59
- SLStatus,
60
59
  SecManFlag,
61
60
  SecManKeyType,
61
+ SLStatus,
62
62
  } from "../enums";
63
63
  import {EzspError} from "../ezspError";
64
64
  import type {
@@ -80,8 +80,8 @@ import type {
80
80
  EmberInitialSecurityState,
81
81
  EmberKeyData,
82
82
  EmberMessageDigest,
83
- EmberMultiPhyRadioParameters,
84
83
  EmberMulticastTableEntry,
84
+ EmberMultiPhyRadioParameters,
85
85
  EmberMultiprotocolPriorities,
86
86
  EmberNeighborTableEntry,
87
87
  EmberNetworkInitStruct,
@@ -95,10 +95,10 @@ import type {
95
95
  EmberSignature283k1Data,
96
96
  EmberSignatureData,
97
97
  EmberSmacData,
98
- EmberTokTypeStackZllData,
99
- EmberTokTypeStackZllSecurity,
100
98
  EmberTokenData,
101
99
  EmberTokenInfo,
100
+ EmberTokTypeStackZllData,
101
+ EmberTokTypeStackZllSecurity,
102
102
  EmberVersion,
103
103
  EmberZigbeeNetwork,
104
104
  EmberZllAddressAssignment,
@@ -148,6 +148,7 @@ import {
148
148
  type EzspEndpointFlag,
149
149
  EzspExtendedValueId,
150
150
  EzspFrameID,
151
+ type EzspMemoryUsageData,
151
152
  EzspMfgTokenId,
152
153
  type EzspPolicyId,
153
154
  EzspSleepMode,
@@ -646,6 +647,14 @@ export class Ezsp extends EventEmitter<EmberEzspEventMap> {
646
647
  this.ezspCounterRolloverHandler(type);
647
648
  break;
648
649
  }
650
+ case EzspFrameID.MUX_INVALID_RX_HANDLER: {
651
+ if (this.version >= 0x11) {
652
+ const newRxChannel = this.callbackBuffalo.readUInt8();
653
+ const oldRxChannel = this.callbackBuffalo.readUInt8();
654
+ this.ezspMuxInvalidRxHandler(newRxChannel, oldRxChannel);
655
+ }
656
+ break;
657
+ }
649
658
  case EzspFrameID.CUSTOM_FRAME_HANDLER: {
650
659
  const payload = this.callbackBuffalo.readPayload();
651
660
  this.ezspCustomFrameHandler(payload);
@@ -1235,7 +1244,7 @@ export class Ezsp extends EventEmitter<EmberEzspEventMap> {
1235
1244
  * Function for manipulating the endpoints flags on the NCP.
1236
1245
  * Wrapper for `ezspGetExtendedValue`.
1237
1246
  * @param endpoint uint8_t
1238
- * @returns EzspStatus
1247
+ * @returns SLStatus
1239
1248
  * @returns flags
1240
1249
  */
1241
1250
  public async ezspGetEndpointFlags(endpoint: number): Promise<[SLStatus, flags: EzspEndpointFlag]> {
@@ -1254,7 +1263,7 @@ export class Ezsp extends EventEmitter<EmberEzspEventMap> {
1254
1263
  * Wrapper for `ezspGetExtendedValue`.
1255
1264
  * @param NodeId
1256
1265
  * @param destination
1257
- * @returns EzspStatus
1266
+ * @returns SLStatus
1258
1267
  * @returns overhead uint8_t
1259
1268
  */
1260
1269
  public async ezspGetSourceRouteOverhead(destination: NodeId): Promise<[SLStatus, overhead: number]> {
@@ -1269,7 +1278,7 @@ export class Ezsp extends EventEmitter<EmberEzspEventMap> {
1269
1278
 
1270
1279
  /**
1271
1280
  * Wrapper for `ezspGetExtendedValue`.
1272
- * @returns EzspStatus
1281
+ * @returns SLStatus
1273
1282
  * @returns reason
1274
1283
  * @returns nodeId NodeId*
1275
1284
  */
@@ -1283,6 +1292,27 @@ export class Ezsp extends EventEmitter<EmberEzspEventMap> {
1283
1292
  return [status, outVal[0], highLowToInt(outVal[2], outVal[1])];
1284
1293
  }
1285
1294
 
1295
+ /**
1296
+ * Gets memory usage data from sl_memory_manager APIs.
1297
+ * Wrapper for `ezspGetExtendedValue`.
1298
+ * @param type Type of memory usage data to be acquired
1299
+ * @returns SLStatus
1300
+ * @returns Data (in bytes) reflecting current or "boot" memory usage
1301
+ */
1302
+ public async ezspGetMemoryUsageData(type: EzspMemoryUsageData): Promise<[SLStatus, memoryUsageValue: number]> {
1303
+ if (this.version < 0x11) {
1304
+ throw new EzspError(EzspStatus.ERROR_INVALID_FRAME_ID);
1305
+ }
1306
+
1307
+ const [status, outValLen, outVal] = await this.ezspGetExtendedValue(EzspExtendedValueId.MEMORY_USAGE_DATA, type, 4);
1308
+
1309
+ if (outValLen < 4) {
1310
+ throw new EzspError(EzspStatus.ERROR_INVALID_VALUE);
1311
+ }
1312
+
1313
+ return [status, outVal[0] + (outVal[1] << 8) + (outVal[2] << 16) + (outVal[3] << 24)];
1314
+ }
1315
+
1286
1316
  /**
1287
1317
  * Wrapper for `ezspGetValue`.
1288
1318
  * @returns EzspStatus
@@ -2289,6 +2319,16 @@ export class Ezsp extends EventEmitter<EmberEzspEventMap> {
2289
2319
  logger.info(`NCP Counter ${EmberCounterType[type]} rolled over.`, NS);
2290
2320
  }
2291
2321
 
2322
+ /**
2323
+ * Callback
2324
+ * This call is fired when mux detects an invalid rx case, which would be different rx channels for different protocol contexts, when fast channel switching is not enabled
2325
+ * @param newRxChannel uint8_t
2326
+ * @param oldRxChannel uint8_t
2327
+ */
2328
+ ezspMuxInvalidRxHandler(newRxChannel: number, oldRxChannel: number) {
2329
+ logger.debug(`ezspMuxInvalidRxHandler: newRxChannel=${newRxChannel} oldRxChannel=${oldRxChannel}`, NS);
2330
+ }
2331
+
2292
2332
  /**
2293
2333
  * Used to test that UART flow control is working correctly.
2294
2334
  * @param delay uint16_t Data will not be read from the host for this many milliseconds.
@@ -8522,6 +8562,7 @@ export class Ezsp extends EventEmitter<EmberEzspEventMap> {
8522
8562
  * @param mic uint32_t The received MIC of the GPDF.
8523
8563
  * @param proxyTableIndex uint8_tThe proxy table index of the corresponding proxy table entry to the incoming GPDF.
8524
8564
  * @param gpdCommandPayload uint8_t * The GPD command payload.
8565
+ * @param packetInfo Rx packet information.
8525
8566
  */
8526
8567
  ezspGpepIncomingMessageHandler(
8527
8568
  status: EmberGPStatus,
@@ -8645,6 +8686,41 @@ export class Ezsp extends EventEmitter<EmberEzspEventMap> {
8645
8686
  return index;
8646
8687
  }
8647
8688
 
8689
+ /**
8690
+ * Removes the proxy table entry stored at the passed index.
8691
+ * @param proxyIndex The index of the requested proxy table entry.
8692
+ */
8693
+ async ezspGpProxyTableRemoveEntry(proxyIndex: number): Promise<void> {
8694
+ if (this.version < 0x11) {
8695
+ throw new EzspError(EzspStatus.ERROR_INVALID_FRAME_ID);
8696
+ }
8697
+
8698
+ const sendBuffalo = this.startCommand(EzspFrameID.GP_PROXY_TABLE_REMOVE_ENTRY);
8699
+ sendBuffalo.writeUInt8(proxyIndex);
8700
+
8701
+ const sendStatus = await this.sendCommand(sendBuffalo);
8702
+
8703
+ if (sendStatus !== EzspStatus.SUCCESS) {
8704
+ throw new EzspError(sendStatus);
8705
+ }
8706
+ }
8707
+
8708
+ /**
8709
+ * Clear the entire proxy table
8710
+ */
8711
+ async ezspGpClearProxyTable(): Promise<void> {
8712
+ if (this.version < 0x11) {
8713
+ throw new EzspError(EzspStatus.ERROR_INVALID_FRAME_ID);
8714
+ }
8715
+
8716
+ const sendBuffalo = this.startCommand(EzspFrameID.GP_CLEAR_PROXY_TABLE);
8717
+ const sendStatus = await this.sendCommand(sendBuffalo);
8718
+
8719
+ if (sendStatus !== EzspStatus.SUCCESS) {
8720
+ throw new EzspError(sendStatus);
8721
+ }
8722
+ }
8723
+
8648
8724
  /**
8649
8725
  * Retrieves the sink table entry stored at the passed index.
8650
8726
  * @param sinkIndex uint8_t The index of the requested sink table entry.
@@ -159,7 +159,7 @@ const CONFIG_ACK_TIME_MIN = 400;
159
159
  /** " " " " " maximum value */
160
160
  const CONFIG_ACK_TIME_MAX = 2400;
161
161
  /** time allowed to receive RSTACK after ncp is reset */
162
- const CONFIG_TIME_RST = 2500;
162
+ const CONFIG_TIME_RST = 5000;
163
163
  /** time between checks for received RSTACK (CONNECTED status) */
164
164
  const CONFIG_TIME_RST_CHECK = 100;
165
165
  /** if free buffers < limit, host receiver isn't ready, will hold off the ncp from sending normal priority frames */
@@ -52,7 +52,7 @@ export class EZSPAdapter extends Adapter {
52
52
  this.driver.on("incomingMessage", this.processMessage.bind(this));
53
53
  }
54
54
 
55
- private async processMessage(frame: EmberIncomingMessage): Promise<void> {
55
+ private processMessage(frame: EmberIncomingMessage): void {
56
56
  logger.debug(() => `processMessage: ${JSON.stringify(frame)}`, NS);
57
57
 
58
58
  if (frame.apsFrame.profileId === Zdo.ZDO_PROFILE_ID) {
@@ -117,7 +117,7 @@ export class EZSPAdapter extends Adapter {
117
117
  }
118
118
  }
119
119
 
120
- private async handleDeviceJoin(nwk: number, ieee: EmberEUI64): Promise<void> {
120
+ private handleDeviceJoin(nwk: number, ieee: EmberEUI64): void {
121
121
  logger.debug(() => `Device join request received: ${nwk} ${ieee.toString()}`, NS);
122
122
 
123
123
  this.emit("deviceJoined", {
@@ -27,8 +27,8 @@ import {
27
27
  EmberMessageDigest,
28
28
  EmberMultiAddress,
29
29
  EmberMulticastTableEntry,
30
- EmberNeighborTableEntry,
31
30
  EmberNeighbors,
31
+ EmberNeighborTableEntry,
32
32
  EmberNetworkInitStruct /* Structs */,
33
33
  EmberNetworkParameters,
34
34
  EmberNetworkStatus,
@@ -66,17 +66,17 @@ import {
66
66
  EzspStatus,
67
67
  EzspValueId,
68
68
  EzspZllNetworkOperation,
69
+ fixed_list /* Basic Types */,
70
+ int8s,
69
71
  LVBytes,
70
- SLStatus,
71
72
  SecureEzspRandomNumber,
72
73
  SecureEzspSecurityLevel,
73
74
  SecureEzspSecurityType,
74
- WordList,
75
- fixed_list /* Basic Types */,
76
- int8s,
75
+ SLStatus,
77
76
  uint8_t,
78
77
  uint16_t,
79
78
  uint32_t,
79
+ WordList,
80
80
  } from "./types";
81
81
 
82
82
  export interface ParamsDesc {
@@ -11,8 +11,8 @@ import * as ZSpec from "../../../zspec";
11
11
  import {Clusters} from "../../../zspec/zcl/definition/cluster";
12
12
  import * as Zdo from "../../../zspec/zdo";
13
13
  import type {GenericZdoResponse} from "../../../zspec/zdo/definition/tstypes";
14
- import {EZSPAdapterBackup} from "../adapter/backup";
15
14
  import type * as TsType from "./../../tstype";
15
+ import {EZSPAdapterBackup} from "../adapter/backup";
16
16
  import type {ParamsDesc} from "./commands";
17
17
  import {type EZSPFrameData, Ezsp} from "./ezsp";
18
18
  import {Multicast} from "./multicast";
@@ -221,15 +221,15 @@ export class Driver extends EventEmitter {
221
221
  // getting MFG_BOARD_NAME token
222
222
  //const boardName = await ezsp.execCommand('getMfgToken', EzspMfgTokenId.MFG_BOARD_NAME);
223
223
  let verInfo = await this.ezsp.getValue(EzspValueId.VALUE_VERSION_INFO);
224
- // biome-ignore lint/style/useConst: <explanation>
224
+ // biome-ignore lint/style/useConst: legacy
225
225
  let build: number;
226
- // biome-ignore lint/style/useConst: <explanation>
226
+ // biome-ignore lint/style/useConst: legacy
227
227
  let major: number;
228
- // biome-ignore lint/style/useConst: <explanation>
228
+ // biome-ignore lint/style/useConst: legacy
229
229
  let minor: number;
230
- // biome-ignore lint/style/useConst: <explanation>
230
+ // biome-ignore lint/style/useConst: legacy
231
231
  let patch: number;
232
- // biome-ignore lint/style/useConst: <explanation>
232
+ // biome-ignore lint/style/useConst: legacy
233
233
  let special: number;
234
234
  [build, verInfo] = uint16_t.deserialize(uint16_t, verInfo);
235
235
  [major, verInfo] = uint8_t.deserialize(uint8_t, verInfo);
@@ -7,13 +7,13 @@ import {logger} from "../../../utils/logger";
7
7
  import type {SerialPortOptions} from "../../tstype";
8
8
  import {
9
9
  type EZSPFrameDesc,
10
- FRAMES,
11
10
  FRAME_NAMES_BY_ID,
11
+ FRAMES,
12
12
  type ParamsDesc,
13
- ZDOREQUESTS,
14
13
  ZDOREQUEST_NAME_BY_ID,
15
- ZDORESPONSES,
14
+ ZDOREQUESTS,
16
15
  ZDORESPONSE_NAME_BY_ID,
16
+ ZDORESPONSES,
17
17
  } from "./commands";
18
18
  import * as t from "./types";
19
19
  import {
@@ -1,6 +1,6 @@
1
1
  /* v8 ignore start */
2
2
 
3
- import {Bytes, LVBytes, LVList, WordList, fixed_list, int8s, list, uint8_t, uint16_t, uint24_t, uint32_t, uint64_t, uint_t} from "./basic";
3
+ import {Bytes, fixed_list, int8s, LVBytes, LVList, list, uint_t, uint8_t, uint16_t, uint24_t, uint32_t, uint64_t, WordList} from "./basic";
4
4
  import {
5
5
  Bool,
6
6
  EmberApsOption,
@@ -52,11 +52,11 @@ import {
52
52
  EzspValueId,
53
53
  EzspZllNetworkOperation,
54
54
  NcpResetCode,
55
- SLStatus,
56
55
  SecureEzspRandomNumber,
57
56
  SecureEzspSecurityLevel,
58
57
  SecureEzspSecurityType,
59
58
  SecureEzspSessionId,
59
+ SLStatus,
60
60
  } from "./named";
61
61
  import {
62
62
  EmberAesMmoHashContext,
@@ -73,8 +73,8 @@ import {
73
73
  EmberMessageDigest,
74
74
  EmberMultiAddress,
75
75
  EmberMulticastTableEntry,
76
- EmberNeighborTableEntry,
77
76
  EmberNeighbors,
77
+ EmberNeighborTableEntry,
78
78
  EmberNetworkInitStruct,
79
79
  EmberNetworkParameters,
80
80
  EmberNodeDescriptor,
@@ -48,7 +48,7 @@ export class EmberEUI64 extends fixed_list(8, basic.uint8_t) {
48
48
  }
49
49
 
50
50
  static override deserialize(cls: any, data: Buffer): any[] {
51
- // biome-ignore lint/complexity/noThisInStatic: <explanation>
51
+ // biome-ignore lint/complexity/noThisInStatic: legacy
52
52
  const arr = super.deserialize(cls, data);
53
53
  const r = arr[0];
54
54
  data = arr[1] as Buffer;
@@ -1,6 +1,6 @@
1
1
  /* v8 ignore start */
2
2
 
3
- import {type AutoDetectTypes, type OpenOptionsFromBinding, type SetOptions, autoDetect} from "@serialport/bindings-cpp";
3
+ import {type AutoDetectTypes, autoDetect, type OpenOptionsFromBinding, type SetOptions} from "@serialport/bindings-cpp";
4
4
  // This file was copied from https://github.com/serialport/node-serialport/blob/master/packages/serialport/lib/serialport.ts.
5
5
  import {type ErrorCallback, type OpenOptions, SerialPortStream, type StreamOptions} from "@serialport/stream";
6
6
 
@@ -1,17 +1,16 @@
1
1
  import * as crypto from "node:crypto";
2
-
3
- import type {TsType} from "../../";
4
2
  import type * as Models from "../../../models";
5
3
  import {wait} from "../../../utils";
6
4
  import {logger} from "../../../utils/logger";
7
5
  import * as ZSpec from "../../../zspec";
8
6
  import * as Zdo from "../../../zspec/zdo";
7
+ import type {TsType} from "../../";
9
8
  import * as ZnpConstants from "../constants";
10
9
  import {DevStates, NvItemsIds, ZnpCommandStatus} from "../constants/common";
11
10
  import type {StartupOptions} from "../models/startup-options";
12
11
  import * as Structs from "../structs";
13
- import {Subsystem} from "../unpi/constants";
14
12
  import * as UnpiConstants from "../unpi/constants";
13
+ import {Subsystem} from "../unpi/constants";
15
14
  import * as Utils from "../utils";
16
15
  import type {Znp} from "../znp";
17
16
  import {AdapterBackup} from "./adapter-backup";
@@ -226,7 +226,7 @@ export class ZStackAdapter extends Adapter {
226
226
 
227
227
  const payload = lookup[action];
228
228
  if (payload) {
229
- this.znp.request(Subsystem.UTIL, "ledControl", payload, undefined, 500).catch(() => {
229
+ await this.znp.request(Subsystem.UTIL, "ledControl", payload, undefined, 500).catch(() => {
230
230
  // We cannot 100% correctly determine if an adapter supports LED. E.g. the zStack 1.2 20190608
231
231
  // fw supports led on the CC2531 but not on the CC2530. Therefore if a led request fails never thrown
232
232
  // an error but instead mark the led as unsupported.
@@ -809,7 +809,7 @@ export class ZStackAdapter extends Adapter {
809
809
  const debouncer = debounce(
810
810
  () => {
811
811
  this.queue.execute<void>(async () => {
812
- this.discoverRoute(zdoPayload.nwkAddress, false).catch(() => {});
812
+ await this.discoverRoute(zdoPayload.nwkAddress, false).catch(() => {});
813
813
  }, zdoPayload.nwkAddress);
814
814
  },
815
815
  60 * 1000,
@@ -1,16 +1,16 @@
1
+ export * from "./address-manager-entry";
2
+ export * from "./address-manager-table";
3
+ export * from "./aps-link-key-data-entry";
4
+ export * from "./aps-link-key-data-table";
5
+ export * from "./aps-tc-link-key-entry";
6
+ export * from "./aps-tc-link-key-table";
1
7
  export * from "./channel-list";
2
8
  export * from "./has-configured";
3
9
  export * from "./nib";
4
- export * from "./nwk-key-descriptor";
5
10
  export * from "./nwk-key";
11
+ export * from "./nwk-key-descriptor";
6
12
  export * from "./nwk-pan-id";
7
13
  export * from "./nwk-sec-material-descriptor-entry";
8
14
  export * from "./nwk-sec-material-descriptor-table";
9
- export * from "./aps-tc-link-key-entry";
10
- export * from "./aps-tc-link-key-table";
11
- export * from "./aps-link-key-data-entry";
12
- export * from "./aps-link-key-data-table";
13
- export * from "./address-manager-entry";
14
- export * from "./address-manager-table";
15
15
  export * from "./security-manager-entry";
16
16
  export * from "./security-manager-table";
@@ -1,4 +1,4 @@
1
+ export * from "./entries";
2
+ export * from "./serializable-memory-object";
1
3
  export * from "./struct";
2
4
  export * from "./table";
3
- export * from "./serializable-memory-object";
4
- export * from "./entries";
@@ -1,8 +1,6 @@
1
1
  /* v8 ignore start */
2
2
 
3
3
  import assert from "node:assert";
4
-
5
- import {Adapter, type TsType} from "../..";
6
4
  import type {Backup} from "../../../models";
7
5
  import {Queue, Waitress} from "../../../utils";
8
6
  import {logger} from "../../../utils/logger";
@@ -10,6 +8,7 @@ import * as ZSpec from "../../../zspec";
10
8
  import * as Zcl from "../../../zspec/zcl";
11
9
  import * as Zdo from "../../../zspec/zdo";
12
10
  import type * as ZdoTypes from "../../../zspec/zdo/definition/tstypes";
11
+ import {Adapter, type TsType} from "../..";
13
12
  import {WORKAROUND_JOIN_MANUF_IEEE_PREFIX_TO_CODE} from "../../const";
14
13
  import type {ZclPayload} from "../../events";
15
14
  import {ZBOSSDriver} from "../driver";
@@ -4,16 +4,15 @@ import assert from "node:assert";
4
4
  import EventEmitter from "node:events";
5
5
 
6
6
  import equals from "fast-deep-equal/es6";
7
-
8
- import type {TsType} from "..";
9
7
  import type {KeyValue} from "../../controller/tstype";
10
8
  import {Queue, Waitress} from "../../utils";
11
9
  import {logger} from "../../utils/logger";
12
10
  import type * as ZSpec from "../../zspec";
13
11
  import * as Zdo from "../../zspec/zdo";
12
+ import type {TsType} from "..";
14
13
  import {ZDO_REQ_CLUSTER_ID_TO_ZBOSS_COMMAND_ID} from "./commands";
15
14
  import {CommandId, DeviceType, PolicyType, ResetOptions, StatusCodeGeneric} from "./enums";
16
- import {FrameType, type ZBOSSFrame, makeFrame} from "./frame";
15
+ import {FrameType, makeFrame, type ZBOSSFrame} from "./frame";
17
16
  import {ZBOSSUart} from "./uart";
18
17
 
19
18
  const NS = "zh:zboss:driv";
@@ -9,7 +9,7 @@ import {SerialPort} from "../serialPort";
9
9
  import SocketPortUtils from "../socketPortUtils";
10
10
  import type {SerialPortOptions} from "../tstype";
11
11
  import {SIGNATURE, ZBOSS_FLAG_FIRST_FRAGMENT, ZBOSS_FLAG_LAST_FRAGMENT, ZBOSS_NCP_API_HL} from "./consts";
12
- import {type ZBOSSFrame, readZBOSSFrame, writeZBOSSFrame} from "./frame";
12
+ import {readZBOSSFrame, writeZBOSSFrame, type ZBOSSFrame} from "./frame";
13
13
  import {ZBOSSReader} from "./reader";
14
14
  import {crc8, crc16} from "./utils";
15
15
  import {ZBOSSWriter} from "./writer";
@@ -12,7 +12,7 @@ import Adapter from "../../adapter";
12
12
  import type * as Events from "../../events";
13
13
  import type * as TsType from "../../tstype";
14
14
  import type {RawAPSDataRequestPayload} from "../driver/commandType";
15
- import {AddressMode, DeviceType, ZPSNwkKeyState, ZiGateCommandCode, ZiGateMessageCode} from "../driver/constants";
15
+ import {AddressMode, DeviceType, ZiGateCommandCode, ZiGateMessageCode, ZPSNwkKeyState} from "../driver/constants";
16
16
  import type ZiGateObject from "../driver/ziGateObject";
17
17
  import Driver from "../driver/zigate";
18
18
  import {patchZdoBuffaloBE} from "./patchZdoBuffaloBE";
@@ -272,7 +272,7 @@ export const ZiGateMessage: {[k: number]: ZiGateMessageType} = {
272
272
  // https://github.com/fairecasoimeme/ZiGate/blob/aac14153db332eb5b898cba0f57f5999e5cf11eb/Module%20Radio/Firmware/src/sdk/JN-SW-4170/Components/ZPSNWK/Include/zps_nwk_pub.h#L89
273
273
  ],
274
274
  },
275
- [0x8001]: {
275
+ 32769: {
276
276
  response: [
277
277
  {name: "logLevel", parameterType: ParameterType.LOG_LEVEL},
278
278
  {name: "log", parameterType: ParameterType.STRING},
@@ -15,7 +15,7 @@ import type {EndDeviceAnnounce, GenericZdoResponse, ResponseMap as ZdoResponseMa
15
15
  import {SerialPort} from "../../serialPort";
16
16
  import SocketPortUtils from "../../socketPortUtils";
17
17
  import type {SerialPortOptions} from "../../tstype";
18
- import {type ZiGateResponseMatcher, type ZiGateResponseMatcherRule, equal} from "./commandType";
18
+ import {equal, type ZiGateResponseMatcher, type ZiGateResponseMatcherRule} from "./commandType";
19
19
  import {Status, ZDO_REQ_CLUSTER_ID_TO_ZIGATE_COMMAND_ID, ZiGateCommandCode, ZiGateMessageCode, type ZiGateObjectPayload} from "./constants";
20
20
  import ZiGateFrame from "./frame";
21
21
  import ZiGateObject from "./ziGateObject";
@@ -693,7 +693,7 @@ export class ZoHAdapter extends Adapter {
693
693
  address:
694
694
  sender64 !== undefined
695
695
  ? `0x${bigUInt64ToHexBE(sender64)}`
696
- : // biome-ignore lint/style/noNonNullAssertion: <explanation>
696
+ : // biome-ignore lint/style/noNonNullAssertion: ignore
697
697
  sender16!,
698
698
  data: apsPayload,
699
699
  // biome-ignore lint/style/noNonNullAssertion: ignored using `--suppress`
@@ -1,6 +1,5 @@
1
- import type {Eui64} from "../zspec/tstypes";
2
-
3
1
  import {Utils as ZSpecUtils} from "../zspec";
2
+ import type {Eui64} from "../zspec/tstypes";
4
3
 
5
4
  export class Buffalo {
6
5
  protected position: number;
@@ -383,7 +383,7 @@ export class Controller extends events.EventEmitter<ControllerEventMap> {
383
383
  if (this.options.backupPath && (await this.adapter.supportsBackup())) {
384
384
  logger.debug("Creating coordinator backup", NS);
385
385
  const backup = await this.adapter.backup(this.getDeviceIeeeAddresses());
386
- const unifiedBackup = await BackupUtils.toUnifiedBackup(backup);
386
+ const unifiedBackup = BackupUtils.toUnifiedBackup(backup);
387
387
  const tmpBackupPath = `${this.options.backupPath}.tmp`;
388
388
  fs.writeFileSync(tmpBackupPath, JSON.stringify(unifiedBackup, null, 2));
389
389
  fs.renameSync(tmpBackupPath, this.options.backupPath);
@@ -657,7 +657,7 @@ export class Controller extends events.EventEmitter<ControllerEventMap> {
657
657
  this.emit("adapterDisconnected");
658
658
  }
659
659
 
660
- private async onDeviceJoinedGreenPower(payload: GreenPowerDeviceJoinedPayload): Promise<void> {
660
+ private onDeviceJoinedGreenPower(payload: GreenPowerDeviceJoinedPayload): void {
661
661
  logger.debug(() => `Green power device '${JSON.stringify(payload).replaceAll(/\[[\d,]+\]/g, "HIDDEN")}' joined`, NS);
662
662
 
663
663
  // Green power devices don't have an ieeeAddr, the sourceID is unique and static so use this.
@@ -50,8 +50,8 @@ export class Request<Type = any> {
50
50
  this.frame = frame;
51
51
  this.expires = timeout + Date.now();
52
52
  this.sendPolicy = sendPolicy ?? (!frame.command ? undefined : Request.defaultSendPolicy[frame.command.ID]);
53
- this.resolveQueue = resolve === undefined ? new Array<(value: Type) => void>() : new Array<(value: Type) => void>(resolve);
54
- this.rejectQueue = reject === undefined ? new Array<(error: Error) => void>() : new Array<(error: Error) => void>(reject);
53
+ this.resolveQueue = resolve === undefined ? ([] as ((value: Type) => void)[]) : new Array<(value: Type) => void>(resolve);
54
+ this.rejectQueue = reject === undefined ? ([] as ((error: Error) => void)[]) : new Array<(error: Error) => void>(reject);
55
55
  this.lastError = lastError ?? Error("Request rejected before first send");
56
56
  }
57
57
 
@@ -409,7 +409,7 @@ export class Device extends Entity<ControllerEventMap> {
409
409
 
410
410
  // Reponse to read requests
411
411
  if (frame.header.isGlobal && frame.isCommand("read") && !this._customReadResponse?.(frame, endpoint)) {
412
- const time = Math.round((new Date().getTime() - OneJanuary2000) / 1000);
412
+ const time = Math.round((Date.now() - OneJanuary2000) / 1000);
413
413
  const attributes: {[s: string]: KeyValue} = {
414
414
  ...endpoint.clusters,
415
415
  genTime: {
package/src/index.ts CHANGED
@@ -1,12 +1,12 @@
1
1
  /* v8 ignore start */
2
2
 
3
+ export type * as AdapterEvents from "./adapter/events";
4
+ export type * as AdapterTypes from "./adapter/tstype";
3
5
  export {Controller} from "./controller/controller";
4
6
  export type * as Events from "./controller/events";
5
- export type * as Types from "./controller/tstype";
6
7
  export type * as Models from "./controller/model";
7
- export type * as AdapterEvents from "./adapter/events";
8
- export type * as AdapterTypes from "./adapter/tstype";
8
+ export type * as Types from "./controller/tstype";
9
+ export {setLogger} from "./utils/logger";
10
+ export * as ZSpec from "./zspec";
9
11
  export * as Zcl from "./zspec/zcl";
10
12
  export * as Zdo from "./zspec/zdo";
11
- export * as ZSpec from "./zspec";
12
- export {setLogger} from "./utils/logger";
@@ -11,7 +11,7 @@ import type * as Models from "../models";
11
11
  *
12
12
  * @param backup Backup to create unified backup format from.
13
13
  */
14
- export const toUnifiedBackup = async (backup: Models.Backup): Promise<Models.UnifiedBackupStorage> => {
14
+ export const toUnifiedBackup = (backup: Models.Backup): Models.UnifiedBackupStorage => {
15
15
  const packageInfo = JSON.parse(fs.readFileSync(path.join(__dirname, "../../", "package.json")).toString());
16
16
 
17
17
  return {
@@ -14,7 +14,6 @@ export function assertString(input: unknown): asserts input is string {
14
14
 
15
15
  export function isObjectEmpty(object: object): boolean {
16
16
  // much faster than checking `Object.keys(object).length`
17
- // biome-ignore lint/style/useNamingConvention: not working properly
18
17
  for (const _k in object) return false;
19
18
  return true;
20
19
  }
@@ -1,9 +1,7 @@
1
- import type {Eui64} from "./tstypes";
2
-
3
1
  import {createCipheriv} from "node:crypto";
4
-
5
2
  import {AES_MMO_128_BLOCK_SIZE, ALL_802_15_4_CHANNELS, INSTALL_CODE_CRC_SIZE, INSTALL_CODE_SIZES} from "./consts";
6
3
  import {BroadcastAddress} from "./enums";
4
+ import type {Eui64} from "./tstypes";
7
5
 
8
6
  /**
9
7
  * Convert a channels array to a uint32 channel mask.
@@ -1,10 +1,10 @@
1
+ export {Clusters} from "./definition/cluster";
1
2
  export * from "./definition/consts";
2
3
  export * from "./definition/enums";
3
- export {Clusters} from "./definition/cluster";
4
- export {Status} from "./definition/status";
5
4
  export {Foundation} from "./definition/foundation";
6
5
  export {ManufacturerCode} from "./definition/manufacturerCode";
6
+ export {Status} from "./definition/status";
7
+ export * as Utils from "./utils";
7
8
  export {ZclFrame as Frame} from "./zclFrame";
8
9
  export {ZclHeader as Header} from "./zclHeader";
9
10
  export {ZclStatusError as StatusError} from "./zclStatusError";
10
- export * as Utils from "./utils";
@@ -82,7 +82,6 @@ export function getDataTypeClass(dataType: DataType): DataTypeClass {
82
82
  function hasCustomClusters(customClusters: CustomClusters): boolean {
83
83
  // XXX: was there a good reason to not set the parameter `customClusters` optional? it would allow simple undefined check
84
84
  // below is twice faster than checking `Object.keys(customClusters).length`
85
- // biome-ignore lint/style/useNamingConvention: not working properly
86
85
  for (const _k in customClusters) return true;
87
86
  return false;
88
87
  }