@camstack/addon-provider-homematic 1.2.65 → 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.
@@ -13118,7 +13119,12 @@ var ConfigEntrySchema = object({
13118
13119
  value: unknown(),
13119
13120
  description: string().optional()
13120
13121
  });
13121
- var LinkedDevicesModeSchema = _enum(["auto", "manual"]);
13122
+ /**
13123
+ * Only `manual` since D356: the operator picks, nothing links itself. The
13124
+ * field survives on the wire because a viewer already OTA'd parses it —
13125
+ * drop it once no shipped client reads `mode`.
13126
+ */
13127
+ var LinkedDevicesModeSchema = _enum(["manual"]);
13122
13128
  /** One resolved linked device — the compact projection consumers need. */
13123
13129
  var LinkedDeviceSchema = object({
13124
13130
  deviceId: number(),
@@ -23646,12 +23652,20 @@ var BatteryStatusSchema = object({
23646
23652
  * Charging source. `'dc'` covers wall/USB adapters; `'solar'` is
23647
23653
  * Reolink-specific for the Solar Panel 2 accessory (will become
23648
23654
  * common on other battery cams). `'none'` means running on battery
23649
- * 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.
23650
23663
  */
23651
23664
  charging: _enum([
23652
23665
  "dc",
23653
23666
  "solar",
23654
- "none"
23667
+ "none",
23668
+ "unknown"
23655
23669
  ]),
23656
23670
  /**
23657
23671
  * True when the camera firmware has gone into low-power mode. Battery
@@ -23741,7 +23755,7 @@ onStatusChanged: { data: object({
23741
23755
  kind: "push",
23742
23756
  empty: {
23743
23757
  percentage: 0,
23744
- charging: "none",
23758
+ charging: "unknown",
23745
23759
  sleeping: false,
23746
23760
  lastUpdated: 0
23747
23761
  }
@@ -33149,8 +33163,17 @@ var BaseDeviceProvider = class extends BaseAddon {
33149
33163
  async onRestoreDevices(savedDevices) {
33150
33164
  const restored = /* @__PURE__ */ new Set();
33151
33165
  const failures = [];
33166
+ const liveStableIds = new Set((await this.ctx.kernel.devices.getAll()).map((device) => device.stableId));
33152
33167
  const attemptRestore = async (saved) => {
33153
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
+ }
33154
33177
  const Class = this.deviceClasses[saved.type];
33155
33178
  if (!Class) throw new Error(`no device class registered for type "${saved.type}"`);
33156
33179
  if (saved.parentDeviceId !== null && !restored.has(saved.parentDeviceId)) throw new Error(`parent device ${saved.parentDeviceId} not restored`);
@@ -64336,6 +64359,9 @@ var HmIntegrationManager = class {
64336
64359
  await facade.start();
64337
64360
  this.#deviceCount = facade.devices().length;
64338
64361
  this.#lastCheckedAt = Date.now();
64362
+ this.#status = "connected";
64363
+ this.#error = null;
64364
+ this.#onConnected(this.#id);
64339
64365
  this.#logger.info("HmIntegrationManager: facade started", {
64340
64366
  tags: { brokerId: this.#id },
64341
64367
  meta: {
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.
@@ -13119,7 +13120,12 @@ var ConfigEntrySchema = object({
13119
13120
  value: unknown(),
13120
13121
  description: string().optional()
13121
13122
  });
13122
- var LinkedDevicesModeSchema = _enum(["auto", "manual"]);
13123
+ /**
13124
+ * Only `manual` since D356: the operator picks, nothing links itself. The
13125
+ * field survives on the wire because a viewer already OTA'd parses it —
13126
+ * drop it once no shipped client reads `mode`.
13127
+ */
13128
+ var LinkedDevicesModeSchema = _enum(["manual"]);
13123
13129
  /** One resolved linked device — the compact projection consumers need. */
13124
13130
  var LinkedDeviceSchema = object({
13125
13131
  deviceId: number(),
@@ -23647,12 +23653,20 @@ var BatteryStatusSchema = object({
23647
23653
  * Charging source. `'dc'` covers wall/USB adapters; `'solar'` is
23648
23654
  * Reolink-specific for the Solar Panel 2 accessory (will become
23649
23655
  * common on other battery cams). `'none'` means running on battery
23650
- * 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.
23651
23664
  */
23652
23665
  charging: _enum([
23653
23666
  "dc",
23654
23667
  "solar",
23655
- "none"
23668
+ "none",
23669
+ "unknown"
23656
23670
  ]),
23657
23671
  /**
23658
23672
  * True when the camera firmware has gone into low-power mode. Battery
@@ -23742,7 +23756,7 @@ onStatusChanged: { data: object({
23742
23756
  kind: "push",
23743
23757
  empty: {
23744
23758
  percentage: 0,
23745
- charging: "none",
23759
+ charging: "unknown",
23746
23760
  sleeping: false,
23747
23761
  lastUpdated: 0
23748
23762
  }
@@ -33150,8 +33164,17 @@ var BaseDeviceProvider = class extends BaseAddon {
33150
33164
  async onRestoreDevices(savedDevices) {
33151
33165
  const restored = /* @__PURE__ */ new Set();
33152
33166
  const failures = [];
33167
+ const liveStableIds = new Set((await this.ctx.kernel.devices.getAll()).map((device) => device.stableId));
33153
33168
  const attemptRestore = async (saved) => {
33154
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
+ }
33155
33178
  const Class = this.deviceClasses[saved.type];
33156
33179
  if (!Class) throw new Error(`no device class registered for type "${saved.type}"`);
33157
33180
  if (saved.parentDeviceId !== null && !restored.has(saved.parentDeviceId)) throw new Error(`parent device ${saved.parentDeviceId} not restored`);
@@ -64337,6 +64360,9 @@ var HmIntegrationManager = class {
64337
64360
  await facade.start();
64338
64361
  this.#deviceCount = facade.devices().length;
64339
64362
  this.#lastCheckedAt = Date.now();
64363
+ this.#status = "connected";
64364
+ this.#error = null;
64365
+ this.#onConnected(this.#id);
64340
64366
  this.#logger.info("HmIntegrationManager: facade started", {
64341
64367
  tags: { brokerId: this.#id },
64342
64368
  meta: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-provider-homematic",
3
- "version": "1.2.65",
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",