@camstack/addon-provider-petkit 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
@@ -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.
@@ -24695,12 +24696,20 @@ var BatteryStatusSchema = object({
24695
24696
  * Charging source. `'dc'` covers wall/USB adapters; `'solar'` is
24696
24697
  * Reolink-specific for the Solar Panel 2 accessory (will become
24697
24698
  * common on other battery cams). `'none'` means running on battery
24698
- * 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.
24699
24707
  */
24700
24708
  charging: _enum([
24701
24709
  "dc",
24702
24710
  "solar",
24703
- "none"
24711
+ "none",
24712
+ "unknown"
24704
24713
  ]),
24705
24714
  /**
24706
24715
  * True when the camera firmware has gone into low-power mode. Battery
@@ -24790,7 +24799,7 @@ onStatusChanged: { data: object({
24790
24799
  kind: "push",
24791
24800
  empty: {
24792
24801
  percentage: 0,
24793
- charging: "none",
24802
+ charging: "unknown",
24794
24803
  sleeping: false,
24795
24804
  lastUpdated: 0
24796
24805
  }
@@ -34206,8 +34215,17 @@ var BaseDeviceProvider = class extends BaseAddon {
34206
34215
  async onRestoreDevices(savedDevices) {
34207
34216
  const restored = /* @__PURE__ */ new Set();
34208
34217
  const failures = [];
34218
+ const liveStableIds = new Set((await this.ctx.kernel.devices.getAll()).map((device) => device.stableId));
34209
34219
  const attemptRestore = async (saved) => {
34210
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
+ }
34211
34229
  const Class = this.deviceClasses[saved.type];
34212
34230
  if (!Class) throw new Error(`no device class registered for type "${saved.type}"`);
34213
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.
@@ -24694,12 +24695,20 @@ var BatteryStatusSchema = object({
24694
24695
  * Charging source. `'dc'` covers wall/USB adapters; `'solar'` is
24695
24696
  * Reolink-specific for the Solar Panel 2 accessory (will become
24696
24697
  * common on other battery cams). `'none'` means running on battery
24697
- * 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.
24698
24706
  */
24699
24707
  charging: _enum([
24700
24708
  "dc",
24701
24709
  "solar",
24702
- "none"
24710
+ "none",
24711
+ "unknown"
24703
24712
  ]),
24704
24713
  /**
24705
24714
  * True when the camera firmware has gone into low-power mode. Battery
@@ -24789,7 +24798,7 @@ onStatusChanged: { data: object({
24789
24798
  kind: "push",
24790
24799
  empty: {
24791
24800
  percentage: 0,
24792
- charging: "none",
24801
+ charging: "unknown",
24793
24802
  sleeping: false,
24794
24803
  lastUpdated: 0
24795
24804
  }
@@ -34205,8 +34214,17 @@ var BaseDeviceProvider = class extends BaseAddon {
34205
34214
  async onRestoreDevices(savedDevices) {
34206
34215
  const restored = /* @__PURE__ */ new Set();
34207
34216
  const failures = [];
34217
+ const liveStableIds = new Set((await this.ctx.kernel.devices.getAll()).map((device) => device.stableId));
34208
34218
  const attemptRestore = async (saved) => {
34209
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
+ }
34210
34228
  const Class = this.deviceClasses[saved.type];
34211
34229
  if (!Class) throw new Error(`no device class registered for type "${saved.type}"`);
34212
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.65",
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",