@camstack/addon-provider-dreo 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
@@ -7589,7 +7589,8 @@ var CameraSwitchAuthoritySchema = discriminatedUnion("kind", [
7589
7589
  var CameraSwitchUnavailableReasonSchema = _enum([
7590
7590
  "no-provider",
7591
7591
  "source-unreachable",
7592
- "not-configured"
7592
+ "not-configured",
7593
+ "device-disabled"
7593
7594
  ]);
7594
7595
  /**
7595
7596
  * One switch, resolved for one camera.
@@ -13096,7 +13097,12 @@ var ConfigEntrySchema = object({
13096
13097
  value: unknown(),
13097
13098
  description: string().optional()
13098
13099
  });
13099
- var LinkedDevicesModeSchema = _enum(["auto", "manual"]);
13100
+ /**
13101
+ * Only `manual` since D356: the operator picks, nothing links itself. The
13102
+ * field survives on the wire because a viewer already OTA'd parses it —
13103
+ * drop it once no shipped client reads `mode`.
13104
+ */
13105
+ var LinkedDevicesModeSchema = _enum(["manual"]);
13100
13106
  /** One resolved linked device — the compact projection consumers need. */
13101
13107
  var LinkedDeviceSchema = object({
13102
13108
  deviceId: number(),
@@ -23624,12 +23630,20 @@ var BatteryStatusSchema = object({
23624
23630
  * Charging source. `'dc'` covers wall/USB adapters; `'solar'` is
23625
23631
  * Reolink-specific for the Solar Panel 2 accessory (will become
23626
23632
  * common on other battery cams). `'none'` means running on battery
23627
- * alone.
23633
+ * alone — a NEGATIVE the firmware actually reported.
23634
+ *
23635
+ * `'unknown'` is the absence of an answer: the provider has not read the
23636
+ * power fields yet, or the firmware reported neither. Before it existed,
23637
+ * two unreadable fields produced `'none'`, and a camera nobody had reached
23638
+ * was drawn "on battery alone" — the same D315 defect `percentage` closed
23639
+ * by going nullable. Consumers SKIP it (no charger state published, no
23640
+ * glyph, no HomeKit ChargingState) rather than coerce it either way.
23628
23641
  */
23629
23642
  charging: _enum([
23630
23643
  "dc",
23631
23644
  "solar",
23632
- "none"
23645
+ "none",
23646
+ "unknown"
23633
23647
  ]),
23634
23648
  /**
23635
23649
  * True when the camera firmware has gone into low-power mode. Battery
@@ -23719,7 +23733,7 @@ onStatusChanged: { data: object({
23719
23733
  kind: "push",
23720
23734
  empty: {
23721
23735
  percentage: 0,
23722
- charging: "none",
23736
+ charging: "unknown",
23723
23737
  sleeping: false,
23724
23738
  lastUpdated: 0
23725
23739
  }
@@ -33135,8 +33149,17 @@ var BaseDeviceProvider = class extends BaseAddon {
33135
33149
  async onRestoreDevices(savedDevices) {
33136
33150
  const restored = /* @__PURE__ */ new Set();
33137
33151
  const failures = [];
33152
+ const liveStableIds = new Set((await this.ctx.kernel.devices.getAll()).map((device) => device.stableId));
33138
33153
  const attemptRestore = async (saved) => {
33139
33154
  if (restored.has(saved.id)) return;
33155
+ if (liveStableIds.has(saved.stableId)) {
33156
+ this.ctx.logger.debug("Restore row already live — not dialled again", { tags: {
33157
+ deviceId: saved.id,
33158
+ stableId: saved.stableId
33159
+ } });
33160
+ restored.add(saved.id);
33161
+ return;
33162
+ }
33140
33163
  const Class = this.deviceClasses[saved.type];
33141
33164
  if (!Class) throw new Error(`no device class registered for type "${saved.type}"`);
33142
33165
  if (saved.parentDeviceId !== null && !restored.has(saved.parentDeviceId)) throw new Error(`parent device ${saved.parentDeviceId} not restored`);
package/dist/addon.mjs CHANGED
@@ -7590,7 +7590,8 @@ var CameraSwitchAuthoritySchema = discriminatedUnion("kind", [
7590
7590
  var CameraSwitchUnavailableReasonSchema = _enum([
7591
7591
  "no-provider",
7592
7592
  "source-unreachable",
7593
- "not-configured"
7593
+ "not-configured",
7594
+ "device-disabled"
7594
7595
  ]);
7595
7596
  /**
7596
7597
  * One switch, resolved for one camera.
@@ -13097,7 +13098,12 @@ var ConfigEntrySchema = object({
13097
13098
  value: unknown(),
13098
13099
  description: string().optional()
13099
13100
  });
13100
- var LinkedDevicesModeSchema = _enum(["auto", "manual"]);
13101
+ /**
13102
+ * Only `manual` since D356: the operator picks, nothing links itself. The
13103
+ * field survives on the wire because a viewer already OTA'd parses it —
13104
+ * drop it once no shipped client reads `mode`.
13105
+ */
13106
+ var LinkedDevicesModeSchema = _enum(["manual"]);
13101
13107
  /** One resolved linked device — the compact projection consumers need. */
13102
13108
  var LinkedDeviceSchema = object({
13103
13109
  deviceId: number(),
@@ -23625,12 +23631,20 @@ var BatteryStatusSchema = object({
23625
23631
  * Charging source. `'dc'` covers wall/USB adapters; `'solar'` is
23626
23632
  * Reolink-specific for the Solar Panel 2 accessory (will become
23627
23633
  * common on other battery cams). `'none'` means running on battery
23628
- * alone.
23634
+ * alone — a NEGATIVE the firmware actually reported.
23635
+ *
23636
+ * `'unknown'` is the absence of an answer: the provider has not read the
23637
+ * power fields yet, or the firmware reported neither. Before it existed,
23638
+ * two unreadable fields produced `'none'`, and a camera nobody had reached
23639
+ * was drawn "on battery alone" — the same D315 defect `percentage` closed
23640
+ * by going nullable. Consumers SKIP it (no charger state published, no
23641
+ * glyph, no HomeKit ChargingState) rather than coerce it either way.
23629
23642
  */
23630
23643
  charging: _enum([
23631
23644
  "dc",
23632
23645
  "solar",
23633
- "none"
23646
+ "none",
23647
+ "unknown"
23634
23648
  ]),
23635
23649
  /**
23636
23650
  * True when the camera firmware has gone into low-power mode. Battery
@@ -23720,7 +23734,7 @@ onStatusChanged: { data: object({
23720
23734
  kind: "push",
23721
23735
  empty: {
23722
23736
  percentage: 0,
23723
- charging: "none",
23737
+ charging: "unknown",
23724
23738
  sleeping: false,
23725
23739
  lastUpdated: 0
23726
23740
  }
@@ -33136,8 +33150,17 @@ var BaseDeviceProvider = class extends BaseAddon {
33136
33150
  async onRestoreDevices(savedDevices) {
33137
33151
  const restored = /* @__PURE__ */ new Set();
33138
33152
  const failures = [];
33153
+ const liveStableIds = new Set((await this.ctx.kernel.devices.getAll()).map((device) => device.stableId));
33139
33154
  const attemptRestore = async (saved) => {
33140
33155
  if (restored.has(saved.id)) return;
33156
+ if (liveStableIds.has(saved.stableId)) {
33157
+ this.ctx.logger.debug("Restore row already live — not dialled again", { tags: {
33158
+ deviceId: saved.id,
33159
+ stableId: saved.stableId
33160
+ } });
33161
+ restored.add(saved.id);
33162
+ return;
33163
+ }
33141
33164
  const Class = this.deviceClasses[saved.type];
33142
33165
  if (!Class) throw new Error(`no device class registered for type "${saved.type}"`);
33143
33166
  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-dreo",
3
- "version": "0.2.64",
3
+ "version": "0.2.66",
4
4
  "description": "Dreo smart-device (fan / air-circulator / purifier / heater / humidifier) device-provider addon for CamStack — wraps the @apocaliss92/nodedreo Dreo cloud client (REST + WebSocket)",
5
5
  "keywords": [
6
6
  "camstack",