zwave-js 15.4.1 → 15.4.2

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.
@@ -1,3 +1,3 @@
1
- export declare const PACKAGE_VERSION = "15.4.1";
1
+ export declare const PACKAGE_VERSION = "15.4.2";
2
2
  export declare const PACKAGE_NAME = "zwave-js";
3
3
  //# sourceMappingURL=_version.d.ts.map
@@ -22,7 +22,7 @@ __export(version_exports, {
22
22
  PACKAGE_VERSION: () => PACKAGE_VERSION
23
23
  });
24
24
  module.exports = __toCommonJS(version_exports);
25
- const PACKAGE_VERSION = "15.4.1";
25
+ const PACKAGE_VERSION = "15.4.2";
26
26
  const PACKAGE_NAME = "zwave-js";
27
27
  // Annotate the CommonJS export names for ESM import in node:
28
28
  0 && (module.exports = {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/lib/_version.ts"],
4
- "sourcesContent": ["// This file is auto-generated by the codegen maintenance script\nexport const PACKAGE_VERSION = \"15.4.1\";\nexport const PACKAGE_NAME = \"zwave-js\";\n"],
4
+ "sourcesContent": ["// This file is auto-generated by the codegen maintenance script\nexport const PACKAGE_VERSION = \"15.4.2\";\nexport const PACKAGE_NAME = \"zwave-js\";\n"],
5
5
  "mappings": ";;;;;;;;;;;;;;;;;;AAAA;;;;;;AACO,MAAM,kBAAkB;AACxB,MAAM,eAAe;",
6
6
  "names": []
7
7
  }
@@ -83,7 +83,8 @@ const libNameString = `
83
83
  `;
84
84
  const defaultOptions = {
85
85
  timeouts: {
86
- ack: 1e3,
86
+ ack: 1600,
87
+ // A sending interface MUST wait for 1600ms or more for an ACK Frame after transmitting a Data Frame.
87
88
  byte: 150,
88
89
  // Ideally we'd want to have this as low as possible, but some
89
90
  // 500 series controllers can take several seconds to respond sometimes.
@@ -92,7 +93,7 @@ const defaultOptions = {
92
93
  // ReportTime timeout SHOULD be set to CommandTime + 1 second
93
94
  nonce: 5e3,
94
95
  sendDataAbort: 2e4,
95
- // If a controller takes over 15s to reach a node, it's probably not going to happen
96
+ // If a controller takes over 20 seconds to reach a node, it's probably not going to happen
96
97
  sendDataCallback: 3e4,
97
98
  // INS13954 defines this to be 65000 ms, but waiting that long causes issues with reporting devices
98
99
  sendToSleep: 250,
@@ -3579,12 +3580,14 @@ ${handlers.length} left`);
3579
3580
  while (msg = await transaction.generateNextMessage(prevResult)) {
3580
3581
  let jammedAttempts = 0;
3581
3582
  let queueAttempts = 0;
3583
+ let commandAttempts = 0;
3582
3584
  attemptMessage: for (let attemptNumber = 1; ; attemptNumber++) {
3583
3585
  try {
3584
3586
  prevResult = await this.queueSerialAPICommand(msg, transaction.stack);
3585
3587
  if ((0, import_serialapi.isTransmitReport)(prevResult)) {
3586
3588
  if (prevResult.transmitStatus === import_core.TransmitStatus.Fail && "txReport" in prevResult && prevResult.txReport?.txTicks === 0) {
3587
3589
  jammedAttempts++;
3590
+ attemptNumber--;
3588
3591
  if (jammedAttempts < maxJammedAttempts) {
3589
3592
  this.controller.setStatus(import_core.ControllerStatus.Jammed);
3590
3593
  await (0, import_async.wait)(this.options.timeouts.retryJammed, true);
@@ -3603,35 +3606,33 @@ ${handlers.length} left`);
3603
3606
  break attemptMessage;
3604
3607
  } catch (e) {
3605
3608
  let zwError;
3606
- let waitDurationMs = 0;
3607
3609
  if (!(0, import_core.isZWaveError)(e)) {
3608
3610
  zwError = (0, import_StateMachineShared.createMessageDroppedUnexpectedError)(e);
3609
3611
  } else {
3610
3612
  if ((0, import_serialapi.isSendData)(msg) && (0, import_core.isMissingControllerCallback)(e)) {
3611
3613
  throw e;
3612
3614
  } else if ((0, import_core.isMissingControllerACK)(e)) {
3613
- throw e;
3615
+ commandAttempts++;
3616
+ attemptNumber--;
3617
+ if (commandAttempts < this.options.attempts.controller) {
3618
+ continue attemptMessage;
3619
+ } else {
3620
+ throw e;
3621
+ }
3614
3622
  } else if ((0, import_core.wasControllerReset)(e)) {
3615
3623
  throw e;
3616
3624
  } else if ((0, import_serialapi.isAnySendDataResponse)(e.context) && !e.context.wasSent) {
3617
3625
  queueAttempts++;
3626
+ attemptNumber--;
3618
3627
  if (queueAttempts < 3) {
3619
- waitDurationMs = 500;
3620
- } else {
3621
- throw e;
3628
+ await (0, import_async.wait)(500, true);
3629
+ continue attemptMessage;
3622
3630
  }
3631
+ throw e;
3623
3632
  } else if (e.code === import_core.ZWaveErrorCodes.Controller_MessageDropped) {
3624
3633
  throw e;
3625
3634
  }
3626
- if (this.mayRetrySerialAPICommand(
3627
- msg,
3628
- // Ignore the number of attempts while jammed or where queuing failed
3629
- attemptNumber - jammedAttempts - queueAttempts,
3630
- e
3631
- )) {
3632
- if (waitDurationMs) {
3633
- await (0, import_async.wait)(waitDurationMs, true);
3634
- }
3635
+ if (this.mayRetrySerialAPICommand(msg, attemptNumber, e)) {
3635
3636
  continue attemptMessage;
3636
3637
  }
3637
3638
  zwError = e;
@@ -3669,6 +3670,10 @@ ${handlers.length} left`);
3669
3670
  }
3670
3671
  }
3671
3672
  triggerQueues() {
3673
+ for (const queue of this.queues) {
3674
+ if (!queue)
3675
+ return;
3676
+ }
3672
3677
  for (const queue of this.queues) {
3673
3678
  queue.trigger();
3674
3679
  }