@camstack/addon-provider-amcrest 0.2.66 → 0.2.68

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
@@ -7548,7 +7548,8 @@ var CameraSwitchAuthoritySchema = discriminatedUnion("kind", [
7548
7548
  var CameraSwitchUnavailableReasonSchema = _enum([
7549
7549
  "no-provider",
7550
7550
  "source-unreachable",
7551
- "not-configured"
7551
+ "not-configured",
7552
+ "device-disabled"
7552
7553
  ]);
7553
7554
  /**
7554
7555
  * One switch, resolved for one camera.
@@ -13038,7 +13039,12 @@ var ConfigEntrySchema = object({
13038
13039
  value: unknown(),
13039
13040
  description: string().optional()
13040
13041
  });
13041
- var LinkedDevicesModeSchema = _enum(["auto", "manual"]);
13042
+ /**
13043
+ * Only `manual` since D356: the operator picks, nothing links itself. The
13044
+ * field survives on the wire because a viewer already OTA'd parses it —
13045
+ * drop it once no shipped client reads `mode`.
13046
+ */
13047
+ var LinkedDevicesModeSchema = _enum(["manual"]);
13042
13048
  /** One resolved linked device — the compact projection consumers need. */
13043
13049
  var LinkedDeviceSchema = object({
13044
13050
  deviceId: number(),
@@ -23670,12 +23676,20 @@ var BatteryStatusSchema = object({
23670
23676
  * Charging source. `'dc'` covers wall/USB adapters; `'solar'` is
23671
23677
  * Reolink-specific for the Solar Panel 2 accessory (will become
23672
23678
  * common on other battery cams). `'none'` means running on battery
23673
- * alone.
23679
+ * alone — a NEGATIVE the firmware actually reported.
23680
+ *
23681
+ * `'unknown'` is the absence of an answer: the provider has not read the
23682
+ * power fields yet, or the firmware reported neither. Before it existed,
23683
+ * two unreadable fields produced `'none'`, and a camera nobody had reached
23684
+ * was drawn "on battery alone" — the same D315 defect `percentage` closed
23685
+ * by going nullable. Consumers SKIP it (no charger state published, no
23686
+ * glyph, no HomeKit ChargingState) rather than coerce it either way.
23674
23687
  */
23675
23688
  charging: _enum([
23676
23689
  "dc",
23677
23690
  "solar",
23678
- "none"
23691
+ "none",
23692
+ "unknown"
23679
23693
  ]),
23680
23694
  /**
23681
23695
  * True when the camera firmware has gone into low-power mode. Battery
@@ -23765,7 +23779,7 @@ onStatusChanged: { data: object({
23765
23779
  kind: "push",
23766
23780
  empty: {
23767
23781
  percentage: 0,
23768
- charging: "none",
23782
+ charging: "unknown",
23769
23783
  sleeping: false,
23770
23784
  lastUpdated: 0
23771
23785
  }
@@ -33479,8 +33493,17 @@ var BaseDeviceProvider = class extends BaseAddon {
33479
33493
  async onRestoreDevices(savedDevices) {
33480
33494
  const restored = /* @__PURE__ */ new Set();
33481
33495
  const failures = [];
33496
+ const liveStableIds = new Set((await this.ctx.kernel.devices.getAll()).map((device) => device.stableId));
33482
33497
  const attemptRestore = async (saved) => {
33483
33498
  if (restored.has(saved.id)) return;
33499
+ if (liveStableIds.has(saved.stableId)) {
33500
+ this.ctx.logger.debug("Restore row already live — not dialled again", { tags: {
33501
+ deviceId: saved.id,
33502
+ stableId: saved.stableId
33503
+ } });
33504
+ restored.add(saved.id);
33505
+ return;
33506
+ }
33484
33507
  const Class = this.deviceClasses[saved.type];
33485
33508
  if (!Class) throw new Error(`no device class registered for type "${saved.type}"`);
33486
33509
  if (saved.parentDeviceId !== null && !restored.has(saved.parentDeviceId)) throw new Error(`parent device ${saved.parentDeviceId} not restored`);
package/dist/addon.mjs CHANGED
@@ -7549,7 +7549,8 @@ var CameraSwitchAuthoritySchema = discriminatedUnion("kind", [
7549
7549
  var CameraSwitchUnavailableReasonSchema = _enum([
7550
7550
  "no-provider",
7551
7551
  "source-unreachable",
7552
- "not-configured"
7552
+ "not-configured",
7553
+ "device-disabled"
7553
7554
  ]);
7554
7555
  /**
7555
7556
  * One switch, resolved for one camera.
@@ -13039,7 +13040,12 @@ var ConfigEntrySchema = object({
13039
13040
  value: unknown(),
13040
13041
  description: string().optional()
13041
13042
  });
13042
- var LinkedDevicesModeSchema = _enum(["auto", "manual"]);
13043
+ /**
13044
+ * Only `manual` since D356: the operator picks, nothing links itself. The
13045
+ * field survives on the wire because a viewer already OTA'd parses it —
13046
+ * drop it once no shipped client reads `mode`.
13047
+ */
13048
+ var LinkedDevicesModeSchema = _enum(["manual"]);
13043
13049
  /** One resolved linked device — the compact projection consumers need. */
13044
13050
  var LinkedDeviceSchema = object({
13045
13051
  deviceId: number(),
@@ -23671,12 +23677,20 @@ var BatteryStatusSchema = object({
23671
23677
  * Charging source. `'dc'` covers wall/USB adapters; `'solar'` is
23672
23678
  * Reolink-specific for the Solar Panel 2 accessory (will become
23673
23679
  * common on other battery cams). `'none'` means running on battery
23674
- * alone.
23680
+ * alone — a NEGATIVE the firmware actually reported.
23681
+ *
23682
+ * `'unknown'` is the absence of an answer: the provider has not read the
23683
+ * power fields yet, or the firmware reported neither. Before it existed,
23684
+ * two unreadable fields produced `'none'`, and a camera nobody had reached
23685
+ * was drawn "on battery alone" — the same D315 defect `percentage` closed
23686
+ * by going nullable. Consumers SKIP it (no charger state published, no
23687
+ * glyph, no HomeKit ChargingState) rather than coerce it either way.
23675
23688
  */
23676
23689
  charging: _enum([
23677
23690
  "dc",
23678
23691
  "solar",
23679
- "none"
23692
+ "none",
23693
+ "unknown"
23680
23694
  ]),
23681
23695
  /**
23682
23696
  * True when the camera firmware has gone into low-power mode. Battery
@@ -23766,7 +23780,7 @@ onStatusChanged: { data: object({
23766
23780
  kind: "push",
23767
23781
  empty: {
23768
23782
  percentage: 0,
23769
- charging: "none",
23783
+ charging: "unknown",
23770
23784
  sleeping: false,
23771
23785
  lastUpdated: 0
23772
23786
  }
@@ -33480,8 +33494,17 @@ var BaseDeviceProvider = class extends BaseAddon {
33480
33494
  async onRestoreDevices(savedDevices) {
33481
33495
  const restored = /* @__PURE__ */ new Set();
33482
33496
  const failures = [];
33497
+ const liveStableIds = new Set((await this.ctx.kernel.devices.getAll()).map((device) => device.stableId));
33483
33498
  const attemptRestore = async (saved) => {
33484
33499
  if (restored.has(saved.id)) return;
33500
+ if (liveStableIds.has(saved.stableId)) {
33501
+ this.ctx.logger.debug("Restore row already live — not dialled again", { tags: {
33502
+ deviceId: saved.id,
33503
+ stableId: saved.stableId
33504
+ } });
33505
+ restored.add(saved.id);
33506
+ return;
33507
+ }
33485
33508
  const Class = this.deviceClasses[saved.type];
33486
33509
  if (!Class) throw new Error(`no device class registered for type "${saved.type}"`);
33487
33510
  if (saved.parentDeviceId !== null && !restored.has(saved.parentDeviceId)) throw new Error(`parent device ${saved.parentDeviceId} not restored`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-provider-amcrest",
3
- "version": "0.2.66",
3
+ "version": "0.2.68",
4
4
  "description": "Amcrest/Dahua camera device provider addon for CamStack — Dahua CGI over HTTP(S) with digest auth (snapshot, RTSP catalog, PTZ, image/day-night config)",
5
5
  "keywords": [
6
6
  "camstack",