@camstack/addon-provider-amcrest 0.2.67 → 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.
@@ -23675,12 +23676,20 @@ var BatteryStatusSchema = object({
23675
23676
  * Charging source. `'dc'` covers wall/USB adapters; `'solar'` is
23676
23677
  * Reolink-specific for the Solar Panel 2 accessory (will become
23677
23678
  * common on other battery cams). `'none'` means running on battery
23678
- * 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.
23679
23687
  */
23680
23688
  charging: _enum([
23681
23689
  "dc",
23682
23690
  "solar",
23683
- "none"
23691
+ "none",
23692
+ "unknown"
23684
23693
  ]),
23685
23694
  /**
23686
23695
  * True when the camera firmware has gone into low-power mode. Battery
@@ -23770,7 +23779,7 @@ onStatusChanged: { data: object({
23770
23779
  kind: "push",
23771
23780
  empty: {
23772
23781
  percentage: 0,
23773
- charging: "none",
23782
+ charging: "unknown",
23774
23783
  sleeping: false,
23775
23784
  lastUpdated: 0
23776
23785
  }
@@ -33484,8 +33493,17 @@ var BaseDeviceProvider = class extends BaseAddon {
33484
33493
  async onRestoreDevices(savedDevices) {
33485
33494
  const restored = /* @__PURE__ */ new Set();
33486
33495
  const failures = [];
33496
+ const liveStableIds = new Set((await this.ctx.kernel.devices.getAll()).map((device) => device.stableId));
33487
33497
  const attemptRestore = async (saved) => {
33488
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
+ }
33489
33507
  const Class = this.deviceClasses[saved.type];
33490
33508
  if (!Class) throw new Error(`no device class registered for type "${saved.type}"`);
33491
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.
@@ -23676,12 +23677,20 @@ var BatteryStatusSchema = object({
23676
23677
  * Charging source. `'dc'` covers wall/USB adapters; `'solar'` is
23677
23678
  * Reolink-specific for the Solar Panel 2 accessory (will become
23678
23679
  * common on other battery cams). `'none'` means running on battery
23679
- * 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.
23680
23688
  */
23681
23689
  charging: _enum([
23682
23690
  "dc",
23683
23691
  "solar",
23684
- "none"
23692
+ "none",
23693
+ "unknown"
23685
23694
  ]),
23686
23695
  /**
23687
23696
  * True when the camera firmware has gone into low-power mode. Battery
@@ -23771,7 +23780,7 @@ onStatusChanged: { data: object({
23771
23780
  kind: "push",
23772
23781
  empty: {
23773
23782
  percentage: 0,
23774
- charging: "none",
23783
+ charging: "unknown",
23775
23784
  sleeping: false,
23776
23785
  lastUpdated: 0
23777
23786
  }
@@ -33485,8 +33494,17 @@ var BaseDeviceProvider = class extends BaseAddon {
33485
33494
  async onRestoreDevices(savedDevices) {
33486
33495
  const restored = /* @__PURE__ */ new Set();
33487
33496
  const failures = [];
33497
+ const liveStableIds = new Set((await this.ctx.kernel.devices.getAll()).map((device) => device.stableId));
33488
33498
  const attemptRestore = async (saved) => {
33489
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
+ }
33490
33508
  const Class = this.deviceClasses[saved.type];
33491
33509
  if (!Class) throw new Error(`no device class registered for type "${saved.type}"`);
33492
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.67",
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",