@camstack/addon-provider-homematic 1.2.66 → 1.2.67

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
@@ -7562,7 +7562,8 @@ var CameraSwitchAuthoritySchema = discriminatedUnion("kind", [
7562
7562
  var CameraSwitchUnavailableReasonSchema = _enum([
7563
7563
  "no-provider",
7564
7564
  "source-unreachable",
7565
- "not-configured"
7565
+ "not-configured",
7566
+ "device-disabled"
7566
7567
  ]);
7567
7568
  /**
7568
7569
  * One switch, resolved for one camera.
@@ -23651,12 +23652,20 @@ var BatteryStatusSchema = object({
23651
23652
  * Charging source. `'dc'` covers wall/USB adapters; `'solar'` is
23652
23653
  * Reolink-specific for the Solar Panel 2 accessory (will become
23653
23654
  * common on other battery cams). `'none'` means running on battery
23654
- * alone.
23655
+ * alone — a NEGATIVE the firmware actually reported.
23656
+ *
23657
+ * `'unknown'` is the absence of an answer: the provider has not read the
23658
+ * power fields yet, or the firmware reported neither. Before it existed,
23659
+ * two unreadable fields produced `'none'`, and a camera nobody had reached
23660
+ * was drawn "on battery alone" — the same D315 defect `percentage` closed
23661
+ * by going nullable. Consumers SKIP it (no charger state published, no
23662
+ * glyph, no HomeKit ChargingState) rather than coerce it either way.
23655
23663
  */
23656
23664
  charging: _enum([
23657
23665
  "dc",
23658
23666
  "solar",
23659
- "none"
23667
+ "none",
23668
+ "unknown"
23660
23669
  ]),
23661
23670
  /**
23662
23671
  * True when the camera firmware has gone into low-power mode. Battery
@@ -23746,7 +23755,7 @@ onStatusChanged: { data: object({
23746
23755
  kind: "push",
23747
23756
  empty: {
23748
23757
  percentage: 0,
23749
- charging: "none",
23758
+ charging: "unknown",
23750
23759
  sleeping: false,
23751
23760
  lastUpdated: 0
23752
23761
  }
@@ -33154,8 +33163,17 @@ var BaseDeviceProvider = class extends BaseAddon {
33154
33163
  async onRestoreDevices(savedDevices) {
33155
33164
  const restored = /* @__PURE__ */ new Set();
33156
33165
  const failures = [];
33166
+ const liveStableIds = new Set((await this.ctx.kernel.devices.getAll()).map((device) => device.stableId));
33157
33167
  const attemptRestore = async (saved) => {
33158
33168
  if (restored.has(saved.id)) return;
33169
+ if (liveStableIds.has(saved.stableId)) {
33170
+ this.ctx.logger.debug("Restore row already live — not dialled again", { tags: {
33171
+ deviceId: saved.id,
33172
+ stableId: saved.stableId
33173
+ } });
33174
+ restored.add(saved.id);
33175
+ return;
33176
+ }
33159
33177
  const Class = this.deviceClasses[saved.type];
33160
33178
  if (!Class) throw new Error(`no device class registered for type "${saved.type}"`);
33161
33179
  if (saved.parentDeviceId !== null && !restored.has(saved.parentDeviceId)) throw new Error(`parent device ${saved.parentDeviceId} not restored`);
package/dist/addon.mjs CHANGED
@@ -7563,7 +7563,8 @@ var CameraSwitchAuthoritySchema = discriminatedUnion("kind", [
7563
7563
  var CameraSwitchUnavailableReasonSchema = _enum([
7564
7564
  "no-provider",
7565
7565
  "source-unreachable",
7566
- "not-configured"
7566
+ "not-configured",
7567
+ "device-disabled"
7567
7568
  ]);
7568
7569
  /**
7569
7570
  * One switch, resolved for one camera.
@@ -23652,12 +23653,20 @@ var BatteryStatusSchema = object({
23652
23653
  * Charging source. `'dc'` covers wall/USB adapters; `'solar'` is
23653
23654
  * Reolink-specific for the Solar Panel 2 accessory (will become
23654
23655
  * common on other battery cams). `'none'` means running on battery
23655
- * alone.
23656
+ * alone — a NEGATIVE the firmware actually reported.
23657
+ *
23658
+ * `'unknown'` is the absence of an answer: the provider has not read the
23659
+ * power fields yet, or the firmware reported neither. Before it existed,
23660
+ * two unreadable fields produced `'none'`, and a camera nobody had reached
23661
+ * was drawn "on battery alone" — the same D315 defect `percentage` closed
23662
+ * by going nullable. Consumers SKIP it (no charger state published, no
23663
+ * glyph, no HomeKit ChargingState) rather than coerce it either way.
23656
23664
  */
23657
23665
  charging: _enum([
23658
23666
  "dc",
23659
23667
  "solar",
23660
- "none"
23668
+ "none",
23669
+ "unknown"
23661
23670
  ]),
23662
23671
  /**
23663
23672
  * True when the camera firmware has gone into low-power mode. Battery
@@ -23747,7 +23756,7 @@ onStatusChanged: { data: object({
23747
23756
  kind: "push",
23748
23757
  empty: {
23749
23758
  percentage: 0,
23750
- charging: "none",
23759
+ charging: "unknown",
23751
23760
  sleeping: false,
23752
23761
  lastUpdated: 0
23753
23762
  }
@@ -33155,8 +33164,17 @@ var BaseDeviceProvider = class extends BaseAddon {
33155
33164
  async onRestoreDevices(savedDevices) {
33156
33165
  const restored = /* @__PURE__ */ new Set();
33157
33166
  const failures = [];
33167
+ const liveStableIds = new Set((await this.ctx.kernel.devices.getAll()).map((device) => device.stableId));
33158
33168
  const attemptRestore = async (saved) => {
33159
33169
  if (restored.has(saved.id)) return;
33170
+ if (liveStableIds.has(saved.stableId)) {
33171
+ this.ctx.logger.debug("Restore row already live — not dialled again", { tags: {
33172
+ deviceId: saved.id,
33173
+ stableId: saved.stableId
33174
+ } });
33175
+ restored.add(saved.id);
33176
+ return;
33177
+ }
33160
33178
  const Class = this.deviceClasses[saved.type];
33161
33179
  if (!Class) throw new Error(`no device class registered for type "${saved.type}"`);
33162
33180
  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-homematic",
3
- "version": "1.2.66",
3
+ "version": "1.2.67",
4
4
  "description": "Homematic / HomematicIP (CCU3 / RaspberryMatic) device-provider addon for CamStack — wraps the nodehomematic library",
5
5
  "keywords": [
6
6
  "camstack",