@camstack/addon-provider-reolink 1.2.31 → 1.2.32

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.
package/dist/addon.js CHANGED
@@ -230964,26 +230964,39 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
230964
230964
  const CONFIRM_TIMEOUT_MS = 1e4;
230965
230965
  const CONFIRM_POLL_MS = 1e3;
230966
230966
  const confirmDeadline = Date.now() + CONFIRM_TIMEOUT_MS;
230967
+ const parent = await this.getParentHub();
230967
230968
  let confirmed = false;
230968
230969
  while (Date.now() < confirmDeadline) {
230969
- let state = null;
230970
- try {
230971
- state = api.getSleepStatus({ channel: this.getChannel() }).state;
230972
- } catch {
230973
- state = null;
230974
- }
230975
- if (state === "awake") {
230976
- confirmed = true;
230977
- break;
230970
+ if (parent !== null) try {
230971
+ if ((await (await parent.getApi()).getNvrChannelsSummary({ channels: [this.getChannel()] })).devices.find((d) => d.channel === this.getChannel())?.sleeping === false) {
230972
+ confirmed = true;
230973
+ break;
230974
+ }
230975
+ } catch {}
230976
+ else {
230977
+ let state = null;
230978
+ try {
230979
+ state = api.getSleepStatus({ channel: this.getChannel() }).state;
230980
+ } catch {
230981
+ state = null;
230982
+ }
230983
+ if (state === "awake") {
230984
+ confirmed = true;
230985
+ break;
230986
+ }
230978
230987
  }
230979
230988
  await sleep$1(CONFIRM_POLL_MS);
230980
230989
  }
230981
- if (confirmed && this.commitSleepState(false, "sleep-poll")) {
230990
+ const confirmSource = parent !== null ? "hub-summary" : "sleep-poll";
230991
+ if (confirmed && this.commitSleepState(false, confirmSource)) {
230982
230992
  this.ctx.logger.info("battery wakeForStream: wake confirmed — driving wake transition", {
230983
230993
  tags: { deviceId: this.id },
230984
- meta: { confirmMs: Date.now() - startedAt }
230994
+ meta: {
230995
+ confirmMs: Date.now() - startedAt,
230996
+ source: confirmSource
230997
+ }
230985
230998
  });
230986
- this.onWakeTransition("sleep-poll").catch(() => {});
230999
+ this.onWakeTransition(confirmSource).catch(() => {});
230987
231000
  } else if (!confirmed) {
230988
231001
  this.ctx.logger.warn("battery wakeForStream: ACK received but no awake evidence inside the confirm window", {
230989
231002
  tags: { deviceId: this.id },
package/dist/addon.mjs CHANGED
@@ -230944,26 +230944,39 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
230944
230944
  const CONFIRM_TIMEOUT_MS = 1e4;
230945
230945
  const CONFIRM_POLL_MS = 1e3;
230946
230946
  const confirmDeadline = Date.now() + CONFIRM_TIMEOUT_MS;
230947
+ const parent = await this.getParentHub();
230947
230948
  let confirmed = false;
230948
230949
  while (Date.now() < confirmDeadline) {
230949
- let state = null;
230950
- try {
230951
- state = api.getSleepStatus({ channel: this.getChannel() }).state;
230952
- } catch {
230953
- state = null;
230954
- }
230955
- if (state === "awake") {
230956
- confirmed = true;
230957
- break;
230950
+ if (parent !== null) try {
230951
+ if ((await (await parent.getApi()).getNvrChannelsSummary({ channels: [this.getChannel()] })).devices.find((d) => d.channel === this.getChannel())?.sleeping === false) {
230952
+ confirmed = true;
230953
+ break;
230954
+ }
230955
+ } catch {}
230956
+ else {
230957
+ let state = null;
230958
+ try {
230959
+ state = api.getSleepStatus({ channel: this.getChannel() }).state;
230960
+ } catch {
230961
+ state = null;
230962
+ }
230963
+ if (state === "awake") {
230964
+ confirmed = true;
230965
+ break;
230966
+ }
230958
230967
  }
230959
230968
  await sleep$1(CONFIRM_POLL_MS);
230960
230969
  }
230961
- if (confirmed && this.commitSleepState(false, "sleep-poll")) {
230970
+ const confirmSource = parent !== null ? "hub-summary" : "sleep-poll";
230971
+ if (confirmed && this.commitSleepState(false, confirmSource)) {
230962
230972
  this.ctx.logger.info("battery wakeForStream: wake confirmed — driving wake transition", {
230963
230973
  tags: { deviceId: this.id },
230964
- meta: { confirmMs: Date.now() - startedAt }
230974
+ meta: {
230975
+ confirmMs: Date.now() - startedAt,
230976
+ source: confirmSource
230977
+ }
230965
230978
  });
230966
- this.onWakeTransition("sleep-poll").catch(() => {});
230979
+ this.onWakeTransition(confirmSource).catch(() => {});
230967
230980
  } else if (!confirmed) {
230968
230981
  this.ctx.logger.warn("battery wakeForStream: ACK received but no awake evidence inside the confirm window", {
230969
230982
  tags: { deviceId: this.id },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-provider-reolink",
3
- "version": "1.2.31",
3
+ "version": "1.2.32",
4
4
  "description": "Reolink camera device provider addon for CamStack — native Baichuan protocol",
5
5
  "keywords": [
6
6
  "camstack",