@camstack/addon-provider-gree 0.2.64 → 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.
@@ -23579,12 +23580,20 @@ var BatteryStatusSchema = object({
23579
23580
  * Charging source. `'dc'` covers wall/USB adapters; `'solar'` is
23580
23581
  * Reolink-specific for the Solar Panel 2 accessory (will become
23581
23582
  * common on other battery cams). `'none'` means running on battery
23582
- * 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.
23583
23591
  */
23584
23592
  charging: _enum([
23585
23593
  "dc",
23586
23594
  "solar",
23587
- "none"
23595
+ "none",
23596
+ "unknown"
23588
23597
  ]),
23589
23598
  /**
23590
23599
  * True when the camera firmware has gone into low-power mode. Battery
@@ -23674,7 +23683,7 @@ onStatusChanged: { data: object({
23674
23683
  kind: "push",
23675
23684
  empty: {
23676
23685
  percentage: 0,
23677
- charging: "none",
23686
+ charging: "unknown",
23678
23687
  sleeping: false,
23679
23688
  lastUpdated: 0
23680
23689
  }
@@ -33082,8 +33091,17 @@ var BaseDeviceProvider = class extends BaseAddon {
33082
33091
  async onRestoreDevices(savedDevices) {
33083
33092
  const restored = /* @__PURE__ */ new Set();
33084
33093
  const failures = [];
33094
+ const liveStableIds = new Set((await this.ctx.kernel.devices.getAll()).map((device) => device.stableId));
33085
33095
  const attemptRestore = async (saved) => {
33086
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
+ }
33087
33105
  const Class = this.deviceClasses[saved.type];
33088
33106
  if (!Class) throw new Error(`no device class registered for type "${saved.type}"`);
33089
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.
@@ -23578,12 +23579,20 @@ var BatteryStatusSchema = object({
23578
23579
  * Charging source. `'dc'` covers wall/USB adapters; `'solar'` is
23579
23580
  * Reolink-specific for the Solar Panel 2 accessory (will become
23580
23581
  * common on other battery cams). `'none'` means running on battery
23581
- * 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.
23582
23590
  */
23583
23591
  charging: _enum([
23584
23592
  "dc",
23585
23593
  "solar",
23586
- "none"
23594
+ "none",
23595
+ "unknown"
23587
23596
  ]),
23588
23597
  /**
23589
23598
  * True when the camera firmware has gone into low-power mode. Battery
@@ -23673,7 +23682,7 @@ onStatusChanged: { data: object({
23673
23682
  kind: "push",
23674
23683
  empty: {
23675
23684
  percentage: 0,
23676
- charging: "none",
23685
+ charging: "unknown",
23677
23686
  sleeping: false,
23678
23687
  lastUpdated: 0
23679
23688
  }
@@ -33081,8 +33090,17 @@ var BaseDeviceProvider = class extends BaseAddon {
33081
33090
  async onRestoreDevices(savedDevices) {
33082
33091
  const restored = /* @__PURE__ */ new Set();
33083
33092
  const failures = [];
33093
+ const liveStableIds = new Set((await this.ctx.kernel.devices.getAll()).map((device) => device.stableId));
33084
33094
  const attemptRestore = async (saved) => {
33085
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
+ }
33086
33104
  const Class = this.deviceClasses[saved.type];
33087
33105
  if (!Class) throw new Error(`no device class registered for type "${saved.type}"`);
33088
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.64",
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",