@camstack/addon-provider-dreame 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
@@ -58058,7 +58058,8 @@ var CameraSwitchAuthoritySchema = discriminatedUnion("kind", [
58058
58058
  var CameraSwitchUnavailableReasonSchema = _enum([
58059
58059
  "no-provider",
58060
58060
  "source-unreachable",
58061
- "not-configured"
58061
+ "not-configured",
58062
+ "device-disabled"
58062
58063
  ]);
58063
58064
  /**
58064
58065
  * One switch, resolved for one camera.
@@ -63565,7 +63566,12 @@ var ConfigEntrySchema = object({
63565
63566
  value: unknown(),
63566
63567
  description: string().optional()
63567
63568
  });
63568
- var LinkedDevicesModeSchema = _enum(["auto", "manual"]);
63569
+ /**
63570
+ * Only `manual` since D356: the operator picks, nothing links itself. The
63571
+ * field survives on the wire because a viewer already OTA'd parses it —
63572
+ * drop it once no shipped client reads `mode`.
63573
+ */
63574
+ var LinkedDevicesModeSchema = _enum(["manual"]);
63569
63575
  /** One resolved linked device — the compact projection consumers need. */
63570
63576
  var LinkedDeviceSchema = object({
63571
63577
  deviceId: number(),
@@ -74093,12 +74099,20 @@ var BatteryStatusSchema = object({
74093
74099
  * Charging source. `'dc'` covers wall/USB adapters; `'solar'` is
74094
74100
  * Reolink-specific for the Solar Panel 2 accessory (will become
74095
74101
  * common on other battery cams). `'none'` means running on battery
74096
- * alone.
74102
+ * alone — a NEGATIVE the firmware actually reported.
74103
+ *
74104
+ * `'unknown'` is the absence of an answer: the provider has not read the
74105
+ * power fields yet, or the firmware reported neither. Before it existed,
74106
+ * two unreadable fields produced `'none'`, and a camera nobody had reached
74107
+ * was drawn "on battery alone" — the same D315 defect `percentage` closed
74108
+ * by going nullable. Consumers SKIP it (no charger state published, no
74109
+ * glyph, no HomeKit ChargingState) rather than coerce it either way.
74097
74110
  */
74098
74111
  charging: _enum([
74099
74112
  "dc",
74100
74113
  "solar",
74101
- "none"
74114
+ "none",
74115
+ "unknown"
74102
74116
  ]),
74103
74117
  /**
74104
74118
  * True when the camera firmware has gone into low-power mode. Battery
@@ -74188,7 +74202,7 @@ onStatusChanged: { data: object({
74188
74202
  kind: "push",
74189
74203
  empty: {
74190
74204
  percentage: 0,
74191
- charging: "none",
74205
+ charging: "unknown",
74192
74206
  sleeping: false,
74193
74207
  lastUpdated: 0
74194
74208
  }
@@ -83621,8 +83635,17 @@ var BaseDeviceProvider = class extends BaseAddon {
83621
83635
  async onRestoreDevices(savedDevices) {
83622
83636
  const restored = /* @__PURE__ */ new Set();
83623
83637
  const failures = [];
83638
+ const liveStableIds = new Set((await this.ctx.kernel.devices.getAll()).map((device) => device.stableId));
83624
83639
  const attemptRestore = async (saved) => {
83625
83640
  if (restored.has(saved.id)) return;
83641
+ if (liveStableIds.has(saved.stableId)) {
83642
+ this.ctx.logger.debug("Restore row already live — not dialled again", { tags: {
83643
+ deviceId: saved.id,
83644
+ stableId: saved.stableId
83645
+ } });
83646
+ restored.add(saved.id);
83647
+ return;
83648
+ }
83626
83649
  const Class = this.deviceClasses[saved.type];
83627
83650
  if (!Class) throw new Error(`no device class registered for type "${saved.type}"`);
83628
83651
  if (saved.parentDeviceId !== null && !restored.has(saved.parentDeviceId)) throw new Error(`parent device ${saved.parentDeviceId} not restored`);
package/dist/addon.mjs CHANGED
@@ -58058,7 +58058,8 @@ var CameraSwitchAuthoritySchema = discriminatedUnion("kind", [
58058
58058
  var CameraSwitchUnavailableReasonSchema = _enum([
58059
58059
  "no-provider",
58060
58060
  "source-unreachable",
58061
- "not-configured"
58061
+ "not-configured",
58062
+ "device-disabled"
58062
58063
  ]);
58063
58064
  /**
58064
58065
  * One switch, resolved for one camera.
@@ -63565,7 +63566,12 @@ var ConfigEntrySchema = object({
63565
63566
  value: unknown(),
63566
63567
  description: string().optional()
63567
63568
  });
63568
- var LinkedDevicesModeSchema = _enum(["auto", "manual"]);
63569
+ /**
63570
+ * Only `manual` since D356: the operator picks, nothing links itself. The
63571
+ * field survives on the wire because a viewer already OTA'd parses it —
63572
+ * drop it once no shipped client reads `mode`.
63573
+ */
63574
+ var LinkedDevicesModeSchema = _enum(["manual"]);
63569
63575
  /** One resolved linked device — the compact projection consumers need. */
63570
63576
  var LinkedDeviceSchema = object({
63571
63577
  deviceId: number(),
@@ -74093,12 +74099,20 @@ var BatteryStatusSchema = object({
74093
74099
  * Charging source. `'dc'` covers wall/USB adapters; `'solar'` is
74094
74100
  * Reolink-specific for the Solar Panel 2 accessory (will become
74095
74101
  * common on other battery cams). `'none'` means running on battery
74096
- * alone.
74102
+ * alone — a NEGATIVE the firmware actually reported.
74103
+ *
74104
+ * `'unknown'` is the absence of an answer: the provider has not read the
74105
+ * power fields yet, or the firmware reported neither. Before it existed,
74106
+ * two unreadable fields produced `'none'`, and a camera nobody had reached
74107
+ * was drawn "on battery alone" — the same D315 defect `percentage` closed
74108
+ * by going nullable. Consumers SKIP it (no charger state published, no
74109
+ * glyph, no HomeKit ChargingState) rather than coerce it either way.
74097
74110
  */
74098
74111
  charging: _enum([
74099
74112
  "dc",
74100
74113
  "solar",
74101
- "none"
74114
+ "none",
74115
+ "unknown"
74102
74116
  ]),
74103
74117
  /**
74104
74118
  * True when the camera firmware has gone into low-power mode. Battery
@@ -74188,7 +74202,7 @@ onStatusChanged: { data: object({
74188
74202
  kind: "push",
74189
74203
  empty: {
74190
74204
  percentage: 0,
74191
- charging: "none",
74205
+ charging: "unknown",
74192
74206
  sleeping: false,
74193
74207
  lastUpdated: 0
74194
74208
  }
@@ -83621,8 +83635,17 @@ var BaseDeviceProvider = class extends BaseAddon {
83621
83635
  async onRestoreDevices(savedDevices) {
83622
83636
  const restored = /* @__PURE__ */ new Set();
83623
83637
  const failures = [];
83638
+ const liveStableIds = new Set((await this.ctx.kernel.devices.getAll()).map((device) => device.stableId));
83624
83639
  const attemptRestore = async (saved) => {
83625
83640
  if (restored.has(saved.id)) return;
83641
+ if (liveStableIds.has(saved.stableId)) {
83642
+ this.ctx.logger.debug("Restore row already live — not dialled again", { tags: {
83643
+ deviceId: saved.id,
83644
+ stableId: saved.stableId
83645
+ } });
83646
+ restored.add(saved.id);
83647
+ return;
83648
+ }
83626
83649
  const Class = this.deviceClasses[saved.type];
83627
83650
  if (!Class) throw new Error(`no device class registered for type "${saved.type}"`);
83628
83651
  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-dreame",
3
- "version": "0.2.64",
3
+ "version": "0.2.66",
4
4
  "description": "Dreame robot-vacuum / lawn-mower device-provider addon for CamStack — wraps the @apocaliss92/nodedreame Dreamehome cloud client",
5
5
  "keywords": [
6
6
  "camstack",