@camstack/addon-provider-gree 0.2.63 → 0.2.65

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
@@ -7556,7 +7556,8 @@ var CameraSwitchAuthoritySchema = discriminatedUnion("kind", [
7556
7556
  var CameraSwitchUnavailableReasonSchema = _enum([
7557
7557
  "no-provider",
7558
7558
  "source-unreachable",
7559
- "not-configured"
7559
+ "not-configured",
7560
+ "device-disabled"
7560
7561
  ]);
7561
7562
  /**
7562
7563
  * One switch, resolved for one camera.
@@ -13046,7 +13047,12 @@ var ConfigEntrySchema = object({
13046
13047
  value: unknown(),
13047
13048
  description: string().optional()
13048
13049
  });
13049
- var LinkedDevicesModeSchema = _enum(["auto", "manual"]);
13050
+ /**
13051
+ * Only `manual` since D356: the operator picks, nothing links itself. The
13052
+ * field survives on the wire because a viewer already OTA'd parses it —
13053
+ * drop it once no shipped client reads `mode`.
13054
+ */
13055
+ var LinkedDevicesModeSchema = _enum(["manual"]);
13050
13056
  /** One resolved linked device — the compact projection consumers need. */
13051
13057
  var LinkedDeviceSchema = object({
13052
13058
  deviceId: number(),
@@ -23574,12 +23580,20 @@ var BatteryStatusSchema = object({
23574
23580
  * Charging source. `'dc'` covers wall/USB adapters; `'solar'` is
23575
23581
  * Reolink-specific for the Solar Panel 2 accessory (will become
23576
23582
  * common on other battery cams). `'none'` means running on battery
23577
- * alone.
23583
+ * alone — a NEGATIVE the firmware actually reported.
23584
+ *
23585
+ * `'unknown'` is the absence of an answer: the provider has not read the
23586
+ * power fields yet, or the firmware reported neither. Before it existed,
23587
+ * two unreadable fields produced `'none'`, and a camera nobody had reached
23588
+ * was drawn "on battery alone" — the same D315 defect `percentage` closed
23589
+ * by going nullable. Consumers SKIP it (no charger state published, no
23590
+ * glyph, no HomeKit ChargingState) rather than coerce it either way.
23578
23591
  */
23579
23592
  charging: _enum([
23580
23593
  "dc",
23581
23594
  "solar",
23582
- "none"
23595
+ "none",
23596
+ "unknown"
23583
23597
  ]),
23584
23598
  /**
23585
23599
  * True when the camera firmware has gone into low-power mode. Battery
@@ -23669,7 +23683,7 @@ onStatusChanged: { data: object({
23669
23683
  kind: "push",
23670
23684
  empty: {
23671
23685
  percentage: 0,
23672
- charging: "none",
23686
+ charging: "unknown",
23673
23687
  sleeping: false,
23674
23688
  lastUpdated: 0
23675
23689
  }
@@ -33077,8 +33091,17 @@ var BaseDeviceProvider = class extends BaseAddon {
33077
33091
  async onRestoreDevices(savedDevices) {
33078
33092
  const restored = /* @__PURE__ */ new Set();
33079
33093
  const failures = [];
33094
+ const liveStableIds = new Set((await this.ctx.kernel.devices.getAll()).map((device) => device.stableId));
33080
33095
  const attemptRestore = async (saved) => {
33081
33096
  if (restored.has(saved.id)) return;
33097
+ if (liveStableIds.has(saved.stableId)) {
33098
+ this.ctx.logger.debug("Restore row already live — not dialled again", { tags: {
33099
+ deviceId: saved.id,
33100
+ stableId: saved.stableId
33101
+ } });
33102
+ restored.add(saved.id);
33103
+ return;
33104
+ }
33082
33105
  const Class = this.deviceClasses[saved.type];
33083
33106
  if (!Class) throw new Error(`no device class registered for type "${saved.type}"`);
33084
33107
  if (saved.parentDeviceId !== null && !restored.has(saved.parentDeviceId)) throw new Error(`parent device ${saved.parentDeviceId} not restored`);
package/dist/addon.mjs CHANGED
@@ -7555,7 +7555,8 @@ var CameraSwitchAuthoritySchema = discriminatedUnion("kind", [
7555
7555
  var CameraSwitchUnavailableReasonSchema = _enum([
7556
7556
  "no-provider",
7557
7557
  "source-unreachable",
7558
- "not-configured"
7558
+ "not-configured",
7559
+ "device-disabled"
7559
7560
  ]);
7560
7561
  /**
7561
7562
  * One switch, resolved for one camera.
@@ -13045,7 +13046,12 @@ var ConfigEntrySchema = object({
13045
13046
  value: unknown(),
13046
13047
  description: string().optional()
13047
13048
  });
13048
- var LinkedDevicesModeSchema = _enum(["auto", "manual"]);
13049
+ /**
13050
+ * Only `manual` since D356: the operator picks, nothing links itself. The
13051
+ * field survives on the wire because a viewer already OTA'd parses it —
13052
+ * drop it once no shipped client reads `mode`.
13053
+ */
13054
+ var LinkedDevicesModeSchema = _enum(["manual"]);
13049
13055
  /** One resolved linked device — the compact projection consumers need. */
13050
13056
  var LinkedDeviceSchema = object({
13051
13057
  deviceId: number(),
@@ -23573,12 +23579,20 @@ var BatteryStatusSchema = object({
23573
23579
  * Charging source. `'dc'` covers wall/USB adapters; `'solar'` is
23574
23580
  * Reolink-specific for the Solar Panel 2 accessory (will become
23575
23581
  * common on other battery cams). `'none'` means running on battery
23576
- * alone.
23582
+ * alone — a NEGATIVE the firmware actually reported.
23583
+ *
23584
+ * `'unknown'` is the absence of an answer: the provider has not read the
23585
+ * power fields yet, or the firmware reported neither. Before it existed,
23586
+ * two unreadable fields produced `'none'`, and a camera nobody had reached
23587
+ * was drawn "on battery alone" — the same D315 defect `percentage` closed
23588
+ * by going nullable. Consumers SKIP it (no charger state published, no
23589
+ * glyph, no HomeKit ChargingState) rather than coerce it either way.
23577
23590
  */
23578
23591
  charging: _enum([
23579
23592
  "dc",
23580
23593
  "solar",
23581
- "none"
23594
+ "none",
23595
+ "unknown"
23582
23596
  ]),
23583
23597
  /**
23584
23598
  * True when the camera firmware has gone into low-power mode. Battery
@@ -23668,7 +23682,7 @@ onStatusChanged: { data: object({
23668
23682
  kind: "push",
23669
23683
  empty: {
23670
23684
  percentage: 0,
23671
- charging: "none",
23685
+ charging: "unknown",
23672
23686
  sleeping: false,
23673
23687
  lastUpdated: 0
23674
23688
  }
@@ -33076,8 +33090,17 @@ var BaseDeviceProvider = class extends BaseAddon {
33076
33090
  async onRestoreDevices(savedDevices) {
33077
33091
  const restored = /* @__PURE__ */ new Set();
33078
33092
  const failures = [];
33093
+ const liveStableIds = new Set((await this.ctx.kernel.devices.getAll()).map((device) => device.stableId));
33079
33094
  const attemptRestore = async (saved) => {
33080
33095
  if (restored.has(saved.id)) return;
33096
+ if (liveStableIds.has(saved.stableId)) {
33097
+ this.ctx.logger.debug("Restore row already live — not dialled again", { tags: {
33098
+ deviceId: saved.id,
33099
+ stableId: saved.stableId
33100
+ } });
33101
+ restored.add(saved.id);
33102
+ return;
33103
+ }
33081
33104
  const Class = this.deviceClasses[saved.type];
33082
33105
  if (!Class) throw new Error(`no device class registered for type "${saved.type}"`);
33083
33106
  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-gree",
3
- "version": "0.2.63",
3
+ "version": "0.2.65",
4
4
  "description": "Gree air-conditioner device-provider addon for CamStack — wraps the @apocaliss92/nodegree local-UDP client (LAN discovery + AES control), exposing climate-control and fan-control",
5
5
  "keywords": [
6
6
  "camstack",