@camstack/addon-provider-unifi 0.2.65 → 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.
@@ -23576,12 +23577,20 @@ var BatteryStatusSchema = object({
23576
23577
  * Charging source. `'dc'` covers wall/USB adapters; `'solar'` is
23577
23578
  * Reolink-specific for the Solar Panel 2 accessory (will become
23578
23579
  * common on other battery cams). `'none'` means running on battery
23579
- * 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.
23580
23588
  */
23581
23589
  charging: _enum([
23582
23590
  "dc",
23583
23591
  "solar",
23584
- "none"
23592
+ "none",
23593
+ "unknown"
23585
23594
  ]),
23586
23595
  /**
23587
23596
  * True when the camera firmware has gone into low-power mode. Battery
@@ -23671,7 +23680,7 @@ onStatusChanged: { data: object({
23671
23680
  kind: "push",
23672
23681
  empty: {
23673
23682
  percentage: 0,
23674
- charging: "none",
23683
+ charging: "unknown",
23675
23684
  sleeping: false,
23676
23685
  lastUpdated: 0
23677
23686
  }
@@ -33096,8 +33105,17 @@ var BaseDeviceProvider = class extends BaseAddon {
33096
33105
  async onRestoreDevices(savedDevices) {
33097
33106
  const restored = /* @__PURE__ */ new Set();
33098
33107
  const failures = [];
33108
+ const liveStableIds = new Set((await this.ctx.kernel.devices.getAll()).map((device) => device.stableId));
33099
33109
  const attemptRestore = async (saved) => {
33100
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
+ }
33101
33119
  const Class = this.deviceClasses[saved.type];
33102
33120
  if (!Class) throw new Error(`no device class registered for type "${saved.type}"`);
33103
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.
@@ -23575,12 +23576,20 @@ var BatteryStatusSchema = object({
23575
23576
  * Charging source. `'dc'` covers wall/USB adapters; `'solar'` is
23576
23577
  * Reolink-specific for the Solar Panel 2 accessory (will become
23577
23578
  * common on other battery cams). `'none'` means running on battery
23578
- * 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.
23579
23587
  */
23580
23588
  charging: _enum([
23581
23589
  "dc",
23582
23590
  "solar",
23583
- "none"
23591
+ "none",
23592
+ "unknown"
23584
23593
  ]),
23585
23594
  /**
23586
23595
  * True when the camera firmware has gone into low-power mode. Battery
@@ -23670,7 +23679,7 @@ onStatusChanged: { data: object({
23670
23679
  kind: "push",
23671
23680
  empty: {
23672
23681
  percentage: 0,
23673
- charging: "none",
23682
+ charging: "unknown",
23674
23683
  sleeping: false,
23675
23684
  lastUpdated: 0
23676
23685
  }
@@ -33095,8 +33104,17 @@ var BaseDeviceProvider = class extends BaseAddon {
33095
33104
  async onRestoreDevices(savedDevices) {
33096
33105
  const restored = /* @__PURE__ */ new Set();
33097
33106
  const failures = [];
33107
+ const liveStableIds = new Set((await this.ctx.kernel.devices.getAll()).map((device) => device.stableId));
33098
33108
  const attemptRestore = async (saved) => {
33099
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
+ }
33100
33118
  const Class = this.deviceClasses[saved.type];
33101
33119
  if (!Class) throw new Error(`no device class registered for type "${saved.type}"`);
33102
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.65",
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",