zigbee-herdsman 4.2.0 → 4.3.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 (151) hide show
  1. package/.release-please-manifest.json +1 -1
  2. package/CHANGELOG.md +16 -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 +16 -0
  7. package/dist/adapter/adapterDiscovery.js.map +1 -1
  8. package/dist/adapter/deconz/adapter/deconzAdapter.d.ts.map +1 -1
  9. package/dist/adapter/deconz/adapter/deconzAdapter.js +28 -10
  10. package/dist/adapter/deconz/adapter/deconzAdapter.js.map +1 -1
  11. package/dist/adapter/deconz/driver/constants.d.ts +1 -0
  12. package/dist/adapter/deconz/driver/constants.d.ts.map +1 -1
  13. package/dist/adapter/deconz/driver/constants.js.map +1 -1
  14. package/dist/adapter/deconz/driver/driver.d.ts +1 -1
  15. package/dist/adapter/deconz/driver/driver.d.ts.map +1 -1
  16. package/dist/adapter/deconz/driver/driver.js +1 -1
  17. package/dist/adapter/deconz/driver/driver.js.map +1 -1
  18. package/dist/adapter/ember/adapter/emberAdapter.d.ts +1 -1
  19. package/dist/adapter/ember/adapter/emberAdapter.d.ts.map +1 -1
  20. package/dist/adapter/ember/adapter/emberAdapter.js +1 -1
  21. package/dist/adapter/ember/adapter/emberAdapter.js.map +1 -1
  22. package/dist/adapter/ember/adapter/tokensManager.d.ts.map +1 -1
  23. package/dist/adapter/ember/ezsp/buffalo.d.ts +1 -1
  24. package/dist/adapter/ember/ezsp/buffalo.d.ts.map +1 -1
  25. package/dist/adapter/ember/ezsp/ezsp.d.ts +2 -2
  26. package/dist/adapter/ember/ezsp/ezsp.d.ts.map +1 -1
  27. package/dist/adapter/ezsp/adapter/ezspAdapter.d.ts.map +1 -1
  28. package/dist/adapter/ezsp/adapter/ezspAdapter.js +2 -2
  29. package/dist/adapter/ezsp/adapter/ezspAdapter.js.map +1 -1
  30. package/dist/adapter/ezsp/driver/driver.d.ts +1 -1
  31. package/dist/adapter/ezsp/driver/driver.d.ts.map +1 -1
  32. package/dist/adapter/ezsp/driver/driver.js +5 -5
  33. package/dist/adapter/ezsp/driver/driver.js.map +1 -1
  34. package/dist/adapter/ezsp/driver/types/index.d.ts +3 -3
  35. package/dist/adapter/ezsp/driver/types/index.d.ts.map +1 -1
  36. package/dist/adapter/ezsp/driver/types/index.js +6 -6
  37. package/dist/adapter/ezsp/driver/types/index.js.map +1 -1
  38. package/dist/adapter/ezsp/driver/types/named.js +1 -1
  39. package/dist/adapter/ezsp/driver/types/named.js.map +1 -1
  40. package/dist/adapter/serialPort.d.ts.map +1 -1
  41. package/dist/adapter/z-stack/adapter/manager.d.ts.map +1 -1
  42. package/dist/adapter/z-stack/adapter/manager.js +1 -1
  43. package/dist/adapter/z-stack/adapter/manager.js.map +1 -1
  44. package/dist/adapter/z-stack/adapter/zStackAdapter.js +2 -2
  45. package/dist/adapter/z-stack/adapter/zStackAdapter.js.map +1 -1
  46. package/dist/adapter/z-stack/structs/entries/index.d.ts +7 -7
  47. package/dist/adapter/z-stack/structs/entries/index.d.ts.map +1 -1
  48. package/dist/adapter/z-stack/structs/entries/index.js +7 -7
  49. package/dist/adapter/z-stack/structs/entries/index.js.map +1 -1
  50. package/dist/adapter/z-stack/structs/index.d.ts +2 -2
  51. package/dist/adapter/z-stack/structs/index.d.ts.map +1 -1
  52. package/dist/adapter/z-stack/structs/index.js +2 -2
  53. package/dist/adapter/z-stack/structs/index.js.map +1 -1
  54. package/dist/adapter/zboss/adapter/zbossAdapter.d.ts +1 -1
  55. package/dist/adapter/zboss/adapter/zbossAdapter.d.ts.map +1 -1
  56. package/dist/adapter/zboss/adapter/zbossAdapter.js +1 -1
  57. package/dist/adapter/zboss/adapter/zbossAdapter.js.map +1 -1
  58. package/dist/adapter/zboss/driver.d.ts +1 -1
  59. package/dist/adapter/zboss/driver.d.ts.map +1 -1
  60. package/dist/adapter/zboss/driver.js.map +1 -1
  61. package/dist/adapter/zboss/uart.d.ts.map +1 -1
  62. package/dist/adapter/zigate/driver/messageType.js +1 -1
  63. package/dist/adapter/zigate/driver/messageType.js.map +1 -1
  64. package/dist/adapter/zoh/adapter/zohAdapter.js +1 -1
  65. package/dist/adapter/zoh/adapter/zohAdapter.js.map +1 -1
  66. package/dist/buffalo/buffalo.d.ts.map +1 -1
  67. package/dist/buffalo/buffalo.js.map +1 -1
  68. package/dist/controller/controller.d.ts.map +1 -1
  69. package/dist/controller/controller.js +2 -2
  70. package/dist/controller/controller.js.map +1 -1
  71. package/dist/controller/helpers/request.js +2 -2
  72. package/dist/controller/helpers/request.js.map +1 -1
  73. package/dist/controller/model/device.js +1 -1
  74. package/dist/controller/model/device.js.map +1 -1
  75. package/dist/index.d.ts +5 -5
  76. package/dist/index.d.ts.map +1 -1
  77. package/dist/index.js +4 -4
  78. package/dist/index.js.map +1 -1
  79. package/dist/utils/backup.d.ts +1 -1
  80. package/dist/utils/backup.d.ts.map +1 -1
  81. package/dist/utils/backup.js +1 -1
  82. package/dist/utils/backup.js.map +1 -1
  83. package/dist/utils/utils.d.ts.map +1 -1
  84. package/dist/utils/utils.js +0 -1
  85. package/dist/utils/utils.js.map +1 -1
  86. package/dist/zspec/utils.d.ts.map +1 -1
  87. package/dist/zspec/utils.js.map +1 -1
  88. package/dist/zspec/zcl/index.d.ts +3 -3
  89. package/dist/zspec/zcl/index.d.ts.map +1 -1
  90. package/dist/zspec/zcl/index.js +6 -6
  91. package/dist/zspec/zcl/index.js.map +1 -1
  92. package/dist/zspec/zcl/utils.d.ts.map +1 -1
  93. package/dist/zspec/zcl/utils.js +0 -1
  94. package/dist/zspec/zcl/utils.js.map +1 -1
  95. package/dist/zspec/zdo/buffaloZdo.d.ts.map +1 -1
  96. package/dist/zspec/zdo/index.d.ts +3 -3
  97. package/dist/zspec/zdo/index.d.ts.map +1 -1
  98. package/dist/zspec/zdo/index.js +6 -6
  99. package/dist/zspec/zdo/index.js.map +1 -1
  100. package/package.json +3 -3
  101. package/src/adapter/adapterDiscovery.ts +17 -4
  102. package/src/adapter/deconz/adapter/deconzAdapter.ts +40 -12
  103. package/src/adapter/deconz/driver/constants.ts +1 -0
  104. package/src/adapter/deconz/driver/driver.ts +7 -8
  105. package/src/adapter/ember/adapter/emberAdapter.ts +2 -3
  106. package/src/adapter/ember/adapter/tokensManager.ts +1 -1
  107. package/src/adapter/ember/ezsp/buffalo.ts +3 -3
  108. package/src/adapter/ember/ezsp/ezsp.ts +5 -5
  109. package/src/adapter/ezsp/adapter/ezspAdapter.ts +2 -2
  110. package/src/adapter/ezsp/driver/commands.ts +5 -5
  111. package/src/adapter/ezsp/driver/driver.ts +6 -6
  112. package/src/adapter/ezsp/driver/ezsp.ts +3 -3
  113. package/src/adapter/ezsp/driver/types/index.ts +3 -3
  114. package/src/adapter/ezsp/driver/types/named.ts +1 -1
  115. package/src/adapter/serialPort.ts +1 -1
  116. package/src/adapter/z-stack/adapter/manager.ts +2 -3
  117. package/src/adapter/z-stack/adapter/zStackAdapter.ts +2 -2
  118. package/src/adapter/z-stack/structs/entries/index.ts +7 -7
  119. package/src/adapter/z-stack/structs/index.ts +2 -2
  120. package/src/adapter/zboss/adapter/zbossAdapter.ts +1 -2
  121. package/src/adapter/zboss/driver.ts +2 -3
  122. package/src/adapter/zboss/uart.ts +1 -1
  123. package/src/adapter/zigate/adapter/zigateAdapter.ts +1 -1
  124. package/src/adapter/zigate/driver/messageType.ts +1 -1
  125. package/src/adapter/zigate/driver/zigate.ts +1 -1
  126. package/src/adapter/zoh/adapter/zohAdapter.ts +1 -1
  127. package/src/buffalo/buffalo.ts +1 -2
  128. package/src/controller/controller.ts +2 -2
  129. package/src/controller/helpers/request.ts +2 -2
  130. package/src/controller/model/device.ts +1 -1
  131. package/src/index.ts +5 -5
  132. package/src/utils/backup.ts +1 -1
  133. package/src/utils/utils.ts +0 -1
  134. package/src/zspec/utils.ts +1 -3
  135. package/src/zspec/zcl/index.ts +3 -3
  136. package/src/zspec/zcl/utils.ts +0 -1
  137. package/src/zspec/zdo/buffaloZdo.ts +2 -2
  138. package/src/zspec/zdo/index.ts +3 -3
  139. package/test/adapter/adapter.test.ts +1 -2
  140. package/test/adapter/ember/ash.test.ts +1 -1
  141. package/test/adapter/ember/emberAdapter.test.ts +1 -1
  142. package/test/adapter/ember/ezsp.test.ts +2 -3
  143. package/test/adapter/ezsp/uart.test.ts +3 -3
  144. package/test/adapter/z-stack/znp.test.ts +6 -6
  145. package/test/adapter/zboss/fixZdoResponse.test.ts +1 -1
  146. package/test/adapter/zoh/zohAdapter.test.ts +2 -2
  147. package/test/controller.test.ts +8 -8
  148. package/test/greenpower.test.ts +1 -2
  149. package/test/tsconfig.json +1 -1
  150. package/test/utils.test.ts +1 -1
  151. package/test/zspec/zdo/buffalo.test.ts +1 -1
@@ -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
  }
@@ -8,9 +8,9 @@ import {CHALLENGE_VALUE_SIZE, CURVE_PUBLIC_POINT_SIZE, MULTICAST_BINDING, UNICAS
8
8
  import {GlobalTLV, type LeaveRequestFlags, RoutingTableStatus} from "./definition/enums";
9
9
  import {Status} from "./definition/status";
10
10
  import type {
11
+ ActiveEndpointsResponse,
11
12
  APSFrameCounterChallengeTLV,
12
13
  APSFrameCounterResponseTLV,
13
- ActiveEndpointsResponse,
14
14
  AuthenticationTokenIdTLV,
15
15
  BeaconAppendixEncapsulationGlobalTLV,
16
16
  BeaconSurveyConfigurationTLV,
@@ -29,9 +29,9 @@ import type {
29
29
  GetConfigurationResponse,
30
30
  IEEEAddressResponse,
31
31
  JoinerEncapsulationGlobalTLV,
32
+ LocalTLVReader,
32
33
  LQITableEntry,
33
34
  LQITableResponse,
34
- LocalTLVReader,
35
35
  ManufacturerSpecificGlobalTLV,
36
36
  MatchDescriptorsResponse,
37
37
  NetworkAddressResponse,
@@ -1,7 +1,7 @@
1
+ export {BuffaloZdo as Buffalo} from "./buffaloZdo";
2
+ export {ClusterId} from "./definition/clusters";
1
3
  export * from "./definition/consts";
2
4
  export * from "./definition/enums";
3
- export {ClusterId} from "./definition/clusters";
4
5
  export {Status} from "./definition/status";
5
- export {ZdoStatusError as StatusError} from "./zdoStatusError";
6
- export {BuffaloZdo as Buffalo} from "./buffaloZdo";
7
6
  export * as Utils from "./utils";
7
+ export {ZdoStatusError as StatusError} from "./zdoStatusError";
@@ -1,6 +1,5 @@
1
- import type {MockInstance} from "vitest";
2
-
3
1
  import type {BrowserConfig, Service} from "bonjour-service";
2
+ import type {MockInstance} from "vitest";
4
3
 
5
4
  import {Adapter, type TsType} from "../../src/adapter";
6
5
  import {findAllDevices} from "../../src/adapter/adapterDiscovery";
@@ -20,7 +20,7 @@ import {EZSP_HOST_RX_POOL_SIZE, TX_POOL_BUFFERS} from "../../../src/adapter/embe
20
20
  import {EzspBuffer} from "../../../src/adapter/ember/uart/queues";
21
21
  import {lowByte} from "../../../src/adapter/ember/utils/math";
22
22
  import {wait} from "../../../src/utils/";
23
- import {ASH_ACK_FIRST_BYTES, RECD_RSTACK_BYTES, SEND_ACK_FIRST_BYTES, SEND_RST_BYTES, adapterSONOFFDongleE} from "./consts";
23
+ import {ASH_ACK_FIRST_BYTES, adapterSONOFFDongleE, RECD_RSTACK_BYTES, SEND_ACK_FIRST_BYTES, SEND_RST_BYTES} from "./consts";
24
24
 
25
25
  const mockSerialPortCloseEvent = vi.fn();
26
26
  const mockSerialPortErrorEvent = vi.fn();
@@ -26,10 +26,10 @@ import {
26
26
  EmberVersionType,
27
27
  EzspStatus,
28
28
  IEEE802154CcaMode,
29
- SLStatus,
30
29
  SecManDerivedKeyType,
31
30
  SecManFlag,
32
31
  SecManKeyType,
32
+ SLStatus,
33
33
  } from "../../../src/adapter/ember/enums";
34
34
  import {EZSP_MIN_PROTOCOL_VERSION, EZSP_PROTOCOL_VERSION, EZSP_STACK_TYPE_MESH} from "../../../src/adapter/ember/ezsp/consts";
35
35
  import {EzspConfigId, EzspDecisionBitmask, EzspEndpointFlag, EzspPolicyId, EzspValueId} from "../../../src/adapter/ember/ezsp/enums";
@@ -1,11 +1,11 @@
1
- import type {Mock, MockInstance} from "vitest";
2
-
3
1
  import {MockBinding} from "@serialport/binding-mock";
2
+ import type {Mock, MockInstance} from "vitest";
4
3
 
5
4
  import {EzspStatus} from "../../../src/adapter/ember/enums";
6
5
  import {Ezsp} from "../../../src/adapter/ember/ezsp/ezsp";
7
6
  import {
8
7
  ASH_ACK_FIRST_BYTES,
8
+ adapterSONOFFDongleE,
9
9
  INCOMING_MESSAGE_HANDLER_FN2_ASH_RAW,
10
10
  MESSAGE_SENT_HANDLER_FN0_ASH_RAW,
11
11
  MESSAGE_SENT_HANDLER_FN1_ASH_RAW,
@@ -20,7 +20,6 @@ import {
20
20
  SEND_RST_BYTES,
21
21
  SEND_UNICAST_REPLY_FN0_ASH_RAW,
22
22
  SET_POLICY_REPLY_FN1_ASH_RAW,
23
- adapterSONOFFDongleE,
24
23
  } from "./consts";
25
24
 
26
25
  const emitFromSerial = async (ezsp: Ezsp, data: Buffer, skipAdvanceTimers = false): Promise<void> => {
@@ -124,7 +124,7 @@ describe("UART", () => {
124
124
  expect(writeBufferSpy).toHaveBeenCalledTimes(2);
125
125
  });
126
126
 
127
- it("Receive data", async () => {
127
+ it("Receive data", () => {
128
128
  const parsed = [];
129
129
  const parser = new Parser();
130
130
  parser.on("parsed", (result) => parsed.push(result));
@@ -150,7 +150,7 @@ describe("UART", () => {
150
150
  expect(parsed[3].type).toBe(FrameType.NAK);
151
151
  });
152
152
 
153
- it("Message in two chunks", async () => {
153
+ it("Message in two chunks", () => {
154
154
  const parsed = [];
155
155
  const parser = new Parser();
156
156
  parser.on("parsed", (result) => parsed.push(result));
@@ -163,7 +163,7 @@ describe("UART", () => {
163
163
  expect(parsed[0].type).toBe(FrameType.DATA);
164
164
  });
165
165
 
166
- it("Two messages in one chunk", async () => {
166
+ it("Two messages in one chunk", () => {
167
167
  const parsed = [];
168
168
  const parser = new Parser();
169
169
  parser.on("parsed", (result) => parsed.push(result));
@@ -339,7 +339,7 @@ describe("ZNP", () => {
339
339
  errorCb();
340
340
  });
341
341
 
342
- it("znp receive", async () => {
342
+ it("znp receive", () => {
343
343
  let parsedCb;
344
344
  const received = vi.fn();
345
345
 
@@ -371,7 +371,7 @@ describe("ZNP", () => {
371
371
  expect(obj.type).toBe(UnpiConstants.Type.SRSP);
372
372
  });
373
373
 
374
- it("znp receive malformed", async () => {
374
+ it("znp receive malformed", () => {
375
375
  let parsedCb;
376
376
  const received = vi.fn();
377
377
 
@@ -937,7 +937,7 @@ describe("ZNP", () => {
937
937
  }
938
938
  });
939
939
 
940
- it("ZpiObject throw error on missing write parser", async () => {
940
+ it("ZpiObject throw error on missing write parser", () => {
941
941
  // @ts-ignore; make sure we always get a new instance
942
942
  const obj = new ZpiObject(0, 0, "dummy", 0, {}, [{name: "nonExisting", parameterType: 9999999}]);
943
943
  expect(() => {
@@ -945,14 +945,14 @@ describe("ZNP", () => {
945
945
  }).toThrow();
946
946
  });
947
947
 
948
- it("ZpiObject throw error on unknown command", async () => {
948
+ it("ZpiObject throw error on unknown command", () => {
949
949
  const frame = new UnpiFrame(UnpiConstants.Type.SREQ, UnpiConstants.Subsystem.AF, 99999, Buffer.alloc(0));
950
950
  expect(() => {
951
951
  ZpiObject.fromUnpiFrame(frame);
952
952
  }).toThrow();
953
953
  });
954
954
 
955
- it("ZpiObject throw error on unknown parameters", async () => {
955
+ it("ZpiObject throw error on unknown parameters", () => {
956
956
  const frame = new UnpiFrame(UnpiConstants.Type.SRSP, UnpiConstants.Subsystem.AF, 128, Buffer.alloc(0));
957
957
  expect(() => {
958
958
  ZpiObject.fromUnpiFrame(frame);
@@ -1277,7 +1277,7 @@ describe("ZNP", () => {
1277
1277
  },
1278
1278
  );
1279
1279
 
1280
- it("Coverage logger", async () => {
1280
+ it("Coverage logger", () => {
1281
1281
  consoleLogger.warning(() => "Test warning", "TestNS");
1282
1282
  consoleLogger.error(() => "Test error", "TestNS");
1283
1283
  });
@@ -1,5 +1,5 @@
1
1
  import {CommandId} from "../../../src/adapter/zboss/enums";
2
- import {FrameType, type ZBOSSFrame, readZBOSSFrame} from "../../../src/adapter/zboss/frame";
2
+ import {FrameType, readZBOSSFrame, type ZBOSSFrame} from "../../../src/adapter/zboss/frame";
3
3
  import * as Zdo from "../../../src/zspec/zdo";
4
4
  import type * as ZdoTypes from "../../../src/zspec/zdo/definition/tstypes";
5
5
 
@@ -2,7 +2,7 @@ import {randomBytes} from "node:crypto";
2
2
  import {mkdirSync, rmSync, writeFileSync} from "node:fs";
3
3
  import {join} from "node:path";
4
4
 
5
- import {SPINEL_HEADER_FLG_SPINEL, encodeSpinelFrame} from "zigbee-on-host/dist/spinel/spinel";
5
+ import {encodeSpinelFrame, SPINEL_HEADER_FLG_SPINEL} from "zigbee-on-host/dist/spinel/spinel";
6
6
  import {SpinelStatus} from "zigbee-on-host/dist/spinel/statuses";
7
7
  import type {MACCapabilities} from "zigbee-on-host/dist/zigbee/mac";
8
8
  import type {ZigbeeNWKLinkStatus} from "zigbee-on-host/dist/zigbee/zigbee-nwk";
@@ -283,7 +283,7 @@ describe("ZigBee on Host", () => {
283
283
  rmSync(TEMP_PATH, {force: true, recursive: true});
284
284
  });
285
285
 
286
- beforeEach(async () => {
286
+ beforeEach(() => {
287
287
  deleteZoHSave();
288
288
 
289
289
  adapter = new ZoHAdapter(
@@ -445,13 +445,13 @@ describe("Controller", () => {
445
445
  let controller: Controller;
446
446
  let mockedDate: Date;
447
447
 
448
- beforeAll(async () => {
448
+ beforeAll(() => {
449
449
  mockedDate = new Date();
450
450
 
451
451
  vi.useFakeTimers();
452
452
  vi.setSystemTime(mockedDate);
453
453
  setLogger(mockLogger);
454
- dummyBackup = await Utils.BackupUtils.toUnifiedBackup(mockDummyBackup);
454
+ dummyBackup = Utils.BackupUtils.toUnifiedBackup(mockDummyBackup);
455
455
  });
456
456
 
457
457
  afterAll(() => {
@@ -459,7 +459,7 @@ describe("Controller", () => {
459
459
  fs.rmSync(TEMP_PATH, {recursive: true, force: true});
460
460
  });
461
461
 
462
- beforeEach(async () => {
462
+ beforeEach(() => {
463
463
  vi.setSystemTime(mockedDate);
464
464
  sendZdoResponseStatus = Zdo.Status.SUCCESS;
465
465
  for (const m of mocksRestore) m.mockRestore();
@@ -512,14 +512,14 @@ describe("Controller", () => {
512
512
  );
513
513
  }, 10000); // randomly times out for some reason
514
514
 
515
- it("Call controller constructor error on invalid channel", async () => {
515
+ it("Call controller constructor error on invalid channel", () => {
516
516
  options.network.channelList = [10];
517
517
  expect(() => {
518
518
  new Controller(options);
519
519
  }).toThrowError("'10' is an invalid channel, use a channel between 11 - 26.");
520
520
  });
521
521
 
522
- it("Call controller constructor error when network key too small", async () => {
522
+ it("Call controller constructor error when network key too small", () => {
523
523
  const newOptions = deepClone(options);
524
524
  newOptions.network.networkKey = [1, 2, 3];
525
525
  expect(() => {
@@ -527,7 +527,7 @@ describe("Controller", () => {
527
527
  }).toThrowError(`Network key must be a 16 digits long array, got ${newOptions.network.networkKey}.`);
528
528
  });
529
529
 
530
- it("Call controller constructor error when extendedPanID is too long", async () => {
530
+ it("Call controller constructor error when extendedPanID is too long", () => {
531
531
  const newOptions = deepClone(options);
532
532
  newOptions.network.extendedPanID = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16];
533
533
  expect(() => {
@@ -535,7 +535,7 @@ describe("Controller", () => {
535
535
  }).toThrowError(`ExtendedPanID must be an 8 digits long array, got ${newOptions.network.extendedPanID}.`);
536
536
  });
537
537
 
538
- it("Call controller constructor error with invalid panID", async () => {
538
+ it("Call controller constructor error with invalid panID", () => {
539
539
  const newOptions = deepClone(options);
540
540
  newOptions.network.panID = 0xffff;
541
541
  expect(() => {
@@ -6802,7 +6802,7 @@ describe("Controller", () => {
6802
6802
  );
6803
6803
  });
6804
6804
 
6805
- it("Shouldnt load device from group databaseentry", async () => {
6805
+ it("Shouldnt load device from group databaseentry", () => {
6806
6806
  expect(() => {
6807
6807
  // @ts-ignore
6808
6808
  Device.fromDatabaseEntry({type: "Group", endpoints: []});
@@ -1,6 +1,5 @@
1
- import type {ZclPayload} from "../src/adapter/events";
2
-
3
1
  import type {MockInstance} from "vitest";
2
+ import type {ZclPayload} from "../src/adapter/events";
4
3
 
5
4
  import {GreenPower} from "../src/controller/greenPower";
6
5
  import type {GreenPowerDeviceJoinedPayload} from "../src/controller/tstype";
@@ -6,5 +6,5 @@
6
6
  "rootDir": "..",
7
7
  "noEmit": true
8
8
  },
9
- "references": [{ "path": ".." }]
9
+ "references": [{"path": ".."}]
10
10
  }
@@ -35,7 +35,7 @@ describe("Utils", () => {
35
35
  }).toThrow("Input must be a string!");
36
36
  });
37
37
 
38
- it("Test wait", async () => {
38
+ it("Test wait", () => {
39
39
  const setTimeoutSpy = vi.spyOn(globalThis, "setTimeout").mockImplementationOnce(
40
40
  // @ts-expect-error mocked
41
41
  () => {},
@@ -4,9 +4,9 @@ import * as Zcl from "../../../src/zspec/zcl";
4
4
  import * as Zdo from "../../../src/zspec/zdo";
5
5
  import {BuffaloZdo} from "../../../src/zspec/zdo/buffaloZdo";
6
6
  import type {
7
+ ActiveEndpointsResponse,
7
8
  APSFrameCounterChallengeTLV,
8
9
  APSFrameCounterResponseTLV,
9
- ActiveEndpointsResponse,
10
10
  AuthenticationTokenIdTLV,
11
11
  BeaconAppendixEncapsulationGlobalTLV,
12
12
  BeaconSurveyConfigurationTLV,