@camstack/addon-provider-petkit 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
@@ -8655,7 +8655,8 @@ var CameraSwitchAuthoritySchema = discriminatedUnion("kind", [
8655
8655
  var CameraSwitchUnavailableReasonSchema = _enum([
8656
8656
  "no-provider",
8657
8657
  "source-unreachable",
8658
- "not-configured"
8658
+ "not-configured",
8659
+ "device-disabled"
8659
8660
  ]);
8660
8661
  /**
8661
8662
  * One switch, resolved for one camera.
@@ -14162,7 +14163,12 @@ var ConfigEntrySchema = object({
14162
14163
  value: unknown(),
14163
14164
  description: string().optional()
14164
14165
  });
14165
- var LinkedDevicesModeSchema = _enum(["auto", "manual"]);
14166
+ /**
14167
+ * Only `manual` since D356: the operator picks, nothing links itself. The
14168
+ * field survives on the wire because a viewer already OTA'd parses it —
14169
+ * drop it once no shipped client reads `mode`.
14170
+ */
14171
+ var LinkedDevicesModeSchema = _enum(["manual"]);
14166
14172
  /** One resolved linked device — the compact projection consumers need. */
14167
14173
  var LinkedDeviceSchema = object({
14168
14174
  deviceId: number(),
@@ -24690,12 +24696,20 @@ var BatteryStatusSchema = object({
24690
24696
  * Charging source. `'dc'` covers wall/USB adapters; `'solar'` is
24691
24697
  * Reolink-specific for the Solar Panel 2 accessory (will become
24692
24698
  * common on other battery cams). `'none'` means running on battery
24693
- * alone.
24699
+ * alone — a NEGATIVE the firmware actually reported.
24700
+ *
24701
+ * `'unknown'` is the absence of an answer: the provider has not read the
24702
+ * power fields yet, or the firmware reported neither. Before it existed,
24703
+ * two unreadable fields produced `'none'`, and a camera nobody had reached
24704
+ * was drawn "on battery alone" — the same D315 defect `percentage` closed
24705
+ * by going nullable. Consumers SKIP it (no charger state published, no
24706
+ * glyph, no HomeKit ChargingState) rather than coerce it either way.
24694
24707
  */
24695
24708
  charging: _enum([
24696
24709
  "dc",
24697
24710
  "solar",
24698
- "none"
24711
+ "none",
24712
+ "unknown"
24699
24713
  ]),
24700
24714
  /**
24701
24715
  * True when the camera firmware has gone into low-power mode. Battery
@@ -24785,7 +24799,7 @@ onStatusChanged: { data: object({
24785
24799
  kind: "push",
24786
24800
  empty: {
24787
24801
  percentage: 0,
24788
- charging: "none",
24802
+ charging: "unknown",
24789
24803
  sleeping: false,
24790
24804
  lastUpdated: 0
24791
24805
  }
@@ -34201,8 +34215,17 @@ var BaseDeviceProvider = class extends BaseAddon {
34201
34215
  async onRestoreDevices(savedDevices) {
34202
34216
  const restored = /* @__PURE__ */ new Set();
34203
34217
  const failures = [];
34218
+ const liveStableIds = new Set((await this.ctx.kernel.devices.getAll()).map((device) => device.stableId));
34204
34219
  const attemptRestore = async (saved) => {
34205
34220
  if (restored.has(saved.id)) return;
34221
+ if (liveStableIds.has(saved.stableId)) {
34222
+ this.ctx.logger.debug("Restore row already live — not dialled again", { tags: {
34223
+ deviceId: saved.id,
34224
+ stableId: saved.stableId
34225
+ } });
34226
+ restored.add(saved.id);
34227
+ return;
34228
+ }
34206
34229
  const Class = this.deviceClasses[saved.type];
34207
34230
  if (!Class) throw new Error(`no device class registered for type "${saved.type}"`);
34208
34231
  if (saved.parentDeviceId !== null && !restored.has(saved.parentDeviceId)) throw new Error(`parent device ${saved.parentDeviceId} not restored`);
package/dist/addon.mjs CHANGED
@@ -8654,7 +8654,8 @@ var CameraSwitchAuthoritySchema = discriminatedUnion("kind", [
8654
8654
  var CameraSwitchUnavailableReasonSchema = _enum([
8655
8655
  "no-provider",
8656
8656
  "source-unreachable",
8657
- "not-configured"
8657
+ "not-configured",
8658
+ "device-disabled"
8658
8659
  ]);
8659
8660
  /**
8660
8661
  * One switch, resolved for one camera.
@@ -14161,7 +14162,12 @@ var ConfigEntrySchema = object({
14161
14162
  value: unknown(),
14162
14163
  description: string().optional()
14163
14164
  });
14164
- var LinkedDevicesModeSchema = _enum(["auto", "manual"]);
14165
+ /**
14166
+ * Only `manual` since D356: the operator picks, nothing links itself. The
14167
+ * field survives on the wire because a viewer already OTA'd parses it —
14168
+ * drop it once no shipped client reads `mode`.
14169
+ */
14170
+ var LinkedDevicesModeSchema = _enum(["manual"]);
14165
14171
  /** One resolved linked device — the compact projection consumers need. */
14166
14172
  var LinkedDeviceSchema = object({
14167
14173
  deviceId: number(),
@@ -24689,12 +24695,20 @@ var BatteryStatusSchema = object({
24689
24695
  * Charging source. `'dc'` covers wall/USB adapters; `'solar'` is
24690
24696
  * Reolink-specific for the Solar Panel 2 accessory (will become
24691
24697
  * common on other battery cams). `'none'` means running on battery
24692
- * alone.
24698
+ * alone — a NEGATIVE the firmware actually reported.
24699
+ *
24700
+ * `'unknown'` is the absence of an answer: the provider has not read the
24701
+ * power fields yet, or the firmware reported neither. Before it existed,
24702
+ * two unreadable fields produced `'none'`, and a camera nobody had reached
24703
+ * was drawn "on battery alone" — the same D315 defect `percentage` closed
24704
+ * by going nullable. Consumers SKIP it (no charger state published, no
24705
+ * glyph, no HomeKit ChargingState) rather than coerce it either way.
24693
24706
  */
24694
24707
  charging: _enum([
24695
24708
  "dc",
24696
24709
  "solar",
24697
- "none"
24710
+ "none",
24711
+ "unknown"
24698
24712
  ]),
24699
24713
  /**
24700
24714
  * True when the camera firmware has gone into low-power mode. Battery
@@ -24784,7 +24798,7 @@ onStatusChanged: { data: object({
24784
24798
  kind: "push",
24785
24799
  empty: {
24786
24800
  percentage: 0,
24787
- charging: "none",
24801
+ charging: "unknown",
24788
24802
  sleeping: false,
24789
24803
  lastUpdated: 0
24790
24804
  }
@@ -34200,8 +34214,17 @@ var BaseDeviceProvider = class extends BaseAddon {
34200
34214
  async onRestoreDevices(savedDevices) {
34201
34215
  const restored = /* @__PURE__ */ new Set();
34202
34216
  const failures = [];
34217
+ const liveStableIds = new Set((await this.ctx.kernel.devices.getAll()).map((device) => device.stableId));
34203
34218
  const attemptRestore = async (saved) => {
34204
34219
  if (restored.has(saved.id)) return;
34220
+ if (liveStableIds.has(saved.stableId)) {
34221
+ this.ctx.logger.debug("Restore row already live — not dialled again", { tags: {
34222
+ deviceId: saved.id,
34223
+ stableId: saved.stableId
34224
+ } });
34225
+ restored.add(saved.id);
34226
+ return;
34227
+ }
34205
34228
  const Class = this.deviceClasses[saved.type];
34206
34229
  if (!Class) throw new Error(`no device class registered for type "${saved.type}"`);
34207
34230
  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-petkit",
3
- "version": "0.2.64",
3
+ "version": "0.2.66",
4
4
  "description": "PetKit smart-feeder device-provider addon for CamStack — wraps the @apocaliss92/nodepetkit PetKit cloud client",
5
5
  "keywords": [
6
6
  "camstack",