@camstack/addon-provider-unifi 0.2.64 → 0.2.66

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
@@ -7553,7 +7553,8 @@ var CameraSwitchAuthoritySchema = discriminatedUnion("kind", [
7553
7553
  var CameraSwitchUnavailableReasonSchema = _enum([
7554
7554
  "no-provider",
7555
7555
  "source-unreachable",
7556
- "not-configured"
7556
+ "not-configured",
7557
+ "device-disabled"
7557
7558
  ]);
7558
7559
  /**
7559
7560
  * One switch, resolved for one camera.
@@ -13043,7 +13044,12 @@ var ConfigEntrySchema = object({
13043
13044
  value: unknown(),
13044
13045
  description: string().optional()
13045
13046
  });
13046
- var LinkedDevicesModeSchema = _enum(["auto", "manual"]);
13047
+ /**
13048
+ * Only `manual` since D356: the operator picks, nothing links itself. The
13049
+ * field survives on the wire because a viewer already OTA'd parses it —
13050
+ * drop it once no shipped client reads `mode`.
13051
+ */
13052
+ var LinkedDevicesModeSchema = _enum(["manual"]);
13047
13053
  /** One resolved linked device — the compact projection consumers need. */
13048
13054
  var LinkedDeviceSchema = object({
13049
13055
  deviceId: number(),
@@ -23571,12 +23577,20 @@ var BatteryStatusSchema = object({
23571
23577
  * Charging source. `'dc'` covers wall/USB adapters; `'solar'` is
23572
23578
  * Reolink-specific for the Solar Panel 2 accessory (will become
23573
23579
  * common on other battery cams). `'none'` means running on battery
23574
- * alone.
23580
+ * alone — a NEGATIVE the firmware actually reported.
23581
+ *
23582
+ * `'unknown'` is the absence of an answer: the provider has not read the
23583
+ * power fields yet, or the firmware reported neither. Before it existed,
23584
+ * two unreadable fields produced `'none'`, and a camera nobody had reached
23585
+ * was drawn "on battery alone" — the same D315 defect `percentage` closed
23586
+ * by going nullable. Consumers SKIP it (no charger state published, no
23587
+ * glyph, no HomeKit ChargingState) rather than coerce it either way.
23575
23588
  */
23576
23589
  charging: _enum([
23577
23590
  "dc",
23578
23591
  "solar",
23579
- "none"
23592
+ "none",
23593
+ "unknown"
23580
23594
  ]),
23581
23595
  /**
23582
23596
  * True when the camera firmware has gone into low-power mode. Battery
@@ -23666,7 +23680,7 @@ onStatusChanged: { data: object({
23666
23680
  kind: "push",
23667
23681
  empty: {
23668
23682
  percentage: 0,
23669
- charging: "none",
23683
+ charging: "unknown",
23670
23684
  sleeping: false,
23671
23685
  lastUpdated: 0
23672
23686
  }
@@ -33091,8 +33105,17 @@ var BaseDeviceProvider = class extends BaseAddon {
33091
33105
  async onRestoreDevices(savedDevices) {
33092
33106
  const restored = /* @__PURE__ */ new Set();
33093
33107
  const failures = [];
33108
+ const liveStableIds = new Set((await this.ctx.kernel.devices.getAll()).map((device) => device.stableId));
33094
33109
  const attemptRestore = async (saved) => {
33095
33110
  if (restored.has(saved.id)) return;
33111
+ if (liveStableIds.has(saved.stableId)) {
33112
+ this.ctx.logger.debug("Restore row already live — not dialled again", { tags: {
33113
+ deviceId: saved.id,
33114
+ stableId: saved.stableId
33115
+ } });
33116
+ restored.add(saved.id);
33117
+ return;
33118
+ }
33096
33119
  const Class = this.deviceClasses[saved.type];
33097
33120
  if (!Class) throw new Error(`no device class registered for type "${saved.type}"`);
33098
33121
  if (saved.parentDeviceId !== null && !restored.has(saved.parentDeviceId)) throw new Error(`parent device ${saved.parentDeviceId} not restored`);
package/dist/addon.mjs CHANGED
@@ -7552,7 +7552,8 @@ var CameraSwitchAuthoritySchema = discriminatedUnion("kind", [
7552
7552
  var CameraSwitchUnavailableReasonSchema = _enum([
7553
7553
  "no-provider",
7554
7554
  "source-unreachable",
7555
- "not-configured"
7555
+ "not-configured",
7556
+ "device-disabled"
7556
7557
  ]);
7557
7558
  /**
7558
7559
  * One switch, resolved for one camera.
@@ -13042,7 +13043,12 @@ var ConfigEntrySchema = object({
13042
13043
  value: unknown(),
13043
13044
  description: string().optional()
13044
13045
  });
13045
- var LinkedDevicesModeSchema = _enum(["auto", "manual"]);
13046
+ /**
13047
+ * Only `manual` since D356: the operator picks, nothing links itself. The
13048
+ * field survives on the wire because a viewer already OTA'd parses it —
13049
+ * drop it once no shipped client reads `mode`.
13050
+ */
13051
+ var LinkedDevicesModeSchema = _enum(["manual"]);
13046
13052
  /** One resolved linked device — the compact projection consumers need. */
13047
13053
  var LinkedDeviceSchema = object({
13048
13054
  deviceId: number(),
@@ -23570,12 +23576,20 @@ var BatteryStatusSchema = object({
23570
23576
  * Charging source. `'dc'` covers wall/USB adapters; `'solar'` is
23571
23577
  * Reolink-specific for the Solar Panel 2 accessory (will become
23572
23578
  * common on other battery cams). `'none'` means running on battery
23573
- * alone.
23579
+ * alone — a NEGATIVE the firmware actually reported.
23580
+ *
23581
+ * `'unknown'` is the absence of an answer: the provider has not read the
23582
+ * power fields yet, or the firmware reported neither. Before it existed,
23583
+ * two unreadable fields produced `'none'`, and a camera nobody had reached
23584
+ * was drawn "on battery alone" — the same D315 defect `percentage` closed
23585
+ * by going nullable. Consumers SKIP it (no charger state published, no
23586
+ * glyph, no HomeKit ChargingState) rather than coerce it either way.
23574
23587
  */
23575
23588
  charging: _enum([
23576
23589
  "dc",
23577
23590
  "solar",
23578
- "none"
23591
+ "none",
23592
+ "unknown"
23579
23593
  ]),
23580
23594
  /**
23581
23595
  * True when the camera firmware has gone into low-power mode. Battery
@@ -23665,7 +23679,7 @@ onStatusChanged: { data: object({
23665
23679
  kind: "push",
23666
23680
  empty: {
23667
23681
  percentage: 0,
23668
- charging: "none",
23682
+ charging: "unknown",
23669
23683
  sleeping: false,
23670
23684
  lastUpdated: 0
23671
23685
  }
@@ -33090,8 +33104,17 @@ var BaseDeviceProvider = class extends BaseAddon {
33090
33104
  async onRestoreDevices(savedDevices) {
33091
33105
  const restored = /* @__PURE__ */ new Set();
33092
33106
  const failures = [];
33107
+ const liveStableIds = new Set((await this.ctx.kernel.devices.getAll()).map((device) => device.stableId));
33093
33108
  const attemptRestore = async (saved) => {
33094
33109
  if (restored.has(saved.id)) return;
33110
+ if (liveStableIds.has(saved.stableId)) {
33111
+ this.ctx.logger.debug("Restore row already live — not dialled again", { tags: {
33112
+ deviceId: saved.id,
33113
+ stableId: saved.stableId
33114
+ } });
33115
+ restored.add(saved.id);
33116
+ return;
33117
+ }
33095
33118
  const Class = this.deviceClasses[saved.type];
33096
33119
  if (!Class) throw new Error(`no device class registered for type "${saved.type}"`);
33097
33120
  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-unifi",
3
- "version": "0.2.64",
3
+ "version": "0.2.66",
4
4
  "description": "UniFi Network controller device-provider addon for CamStack — local-controller infra switches/APs (as containers) + network-client presence. NO cameras/Protect.",
5
5
  "keywords": [
6
6
  "camstack",