@camstack/addon-provider-dreo 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
@@ -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.
@@ -23629,12 +23630,20 @@ var BatteryStatusSchema = object({
23629
23630
  * Charging source. `'dc'` covers wall/USB adapters; `'solar'` is
23630
23631
  * Reolink-specific for the Solar Panel 2 accessory (will become
23631
23632
  * common on other battery cams). `'none'` means running on battery
23632
- * 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.
23633
23641
  */
23634
23642
  charging: _enum([
23635
23643
  "dc",
23636
23644
  "solar",
23637
- "none"
23645
+ "none",
23646
+ "unknown"
23638
23647
  ]),
23639
23648
  /**
23640
23649
  * True when the camera firmware has gone into low-power mode. Battery
@@ -23724,7 +23733,7 @@ onStatusChanged: { data: object({
23724
23733
  kind: "push",
23725
23734
  empty: {
23726
23735
  percentage: 0,
23727
- charging: "none",
23736
+ charging: "unknown",
23728
23737
  sleeping: false,
23729
23738
  lastUpdated: 0
23730
23739
  }
@@ -33140,8 +33149,17 @@ var BaseDeviceProvider = class extends BaseAddon {
33140
33149
  async onRestoreDevices(savedDevices) {
33141
33150
  const restored = /* @__PURE__ */ new Set();
33142
33151
  const failures = [];
33152
+ const liveStableIds = new Set((await this.ctx.kernel.devices.getAll()).map((device) => device.stableId));
33143
33153
  const attemptRestore = async (saved) => {
33144
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
+ }
33145
33163
  const Class = this.deviceClasses[saved.type];
33146
33164
  if (!Class) throw new Error(`no device class registered for type "${saved.type}"`);
33147
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.
@@ -23630,12 +23631,20 @@ var BatteryStatusSchema = object({
23630
23631
  * Charging source. `'dc'` covers wall/USB adapters; `'solar'` is
23631
23632
  * Reolink-specific for the Solar Panel 2 accessory (will become
23632
23633
  * common on other battery cams). `'none'` means running on battery
23633
- * 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.
23634
23642
  */
23635
23643
  charging: _enum([
23636
23644
  "dc",
23637
23645
  "solar",
23638
- "none"
23646
+ "none",
23647
+ "unknown"
23639
23648
  ]),
23640
23649
  /**
23641
23650
  * True when the camera firmware has gone into low-power mode. Battery
@@ -23725,7 +23734,7 @@ onStatusChanged: { data: object({
23725
23734
  kind: "push",
23726
23735
  empty: {
23727
23736
  percentage: 0,
23728
- charging: "none",
23737
+ charging: "unknown",
23729
23738
  sleeping: false,
23730
23739
  lastUpdated: 0
23731
23740
  }
@@ -33141,8 +33150,17 @@ var BaseDeviceProvider = class extends BaseAddon {
33141
33150
  async onRestoreDevices(savedDevices) {
33142
33151
  const restored = /* @__PURE__ */ new Set();
33143
33152
  const failures = [];
33153
+ const liveStableIds = new Set((await this.ctx.kernel.devices.getAll()).map((device) => device.stableId));
33144
33154
  const attemptRestore = async (saved) => {
33145
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
+ }
33146
33164
  const Class = this.deviceClasses[saved.type];
33147
33165
  if (!Class) throw new Error(`no device class registered for type "${saved.type}"`);
33148
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.65",
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",