@camstack/addon-provider-homematic 1.2.208 → 1.2.209

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.
Files changed (18) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/_stub.js +2 -2
  3. package/dist/{_virtual_mf-localSharedImportMap___mfe_internal__addon_provider_homematic_page-CWWYk9PV.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_provider_homematic_page-B8JEAJoX.mjs} +4 -4
  4. package/dist/_virtual_mf___mfe_internal__addon_provider_homematic_page__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-DUSr1RDG.mjs +26 -0
  5. package/dist/addon-provider-homematic.css +1 -1
  6. package/dist/addon.js +2184 -455
  7. package/dist/addon.mjs +2184 -455
  8. package/dist/{hostInit-D_zf6ohM.mjs → hostInit-dkdwmlIf.mjs} +3 -3
  9. package/dist/remoteEntry.js +1 -1
  10. package/dist/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__addon_provider_homematic_page__remoteEntry_js-Bgts9bVd.mjs → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__addon_provider_homematic_page__remoteEntry_js-D2zDM5LH.mjs} +1 -1
  11. package/dist/widgets/_stub.js +1 -1
  12. package/dist/widgets/{_virtual_mf-localSharedImportMap___mfe_internal__addon_provider_homematic_widgets-Dlfyrtfr.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_provider_homematic_widgets-CR6dsJ2l.mjs} +2 -2
  13. package/dist/widgets/_virtual_mf___mfe_internal__addon_provider_homematic_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-DkWTmjd2.mjs +26 -0
  14. package/dist/widgets/{hostInit-Yhkl--bk.mjs → hostInit-C1PiC4_E.mjs} +2 -2
  15. package/dist/widgets/remoteEntry.js +1 -1
  16. package/package.json +3 -3
  17. package/dist/_virtual_mf___mfe_internal__addon_provider_homematic_page__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-O65jH-mE.mjs +0 -26
  18. package/dist/widgets/_virtual_mf___mfe_internal__addon_provider_homematic_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-DPAzT3m6.mjs +0 -26
package/dist/addon.js CHANGED
@@ -8,7 +8,7 @@ let crypto$1 = require("crypto");
8
8
  let fs_promises = require("fs/promises");
9
9
  let path = require("path");
10
10
  let node_os = require("node:os");
11
- //#region ../types/dist/event-category-7P4A3bYA.mjs
11
+ //#region ../types/dist/event-category-BEsBTS72.mjs
12
12
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
13
13
  EventCategory["SystemBoot"] = "system.boot";
14
14
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -455,6 +455,14 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
455
455
  */
456
456
  EventCategory["StreamBrokerOnRequestStreamSourceRefresh"] = "stream-broker.onRequestStreamSourceRefresh";
457
457
  /**
458
+ * A broker RE-DIALED its source (every dial after the first). A consumer that
459
+ * reads the broker over a transport that does not announce the cut — the
460
+ * recorder's ffmpeg writer — learns here instead of through its idle clock.
461
+ * Telemetry: a dropped event only means the idle clock recovers it later.
462
+ * Payload: `{ deviceId, camStreamId, brokerId, reason }`.
463
+ */
464
+ EventCategory["StreamBrokerOnSourceRestart"] = "stream-broker.onSourceRestart";
465
+ /**
458
466
  * A camera provider changed a device's stream parameters (codec /
459
467
  * resolution / bitrate / a stream added or removed). A LOW-LATENCY NUDGE
460
468
  * for the stream-broker's catalog reconcile: it carries NO authoritative
@@ -5615,7 +5623,7 @@ var ZodUnknown = /*@__PURE__*/ $constructor("ZodUnknown", (inst, def) => {
5615
5623
  ZodType.init(inst, def);
5616
5624
  inst._zod.processJSONSchema = (ctx, json, params) => void 0;
5617
5625
  });
5618
- function unknown() {
5626
+ function unknown$1() {
5619
5627
  return /* @__PURE__ */ _unknown(ZodUnknown);
5620
5628
  }
5621
5629
  var ZodNever = /*@__PURE__*/ $constructor("ZodNever", (inst, def) => {
@@ -5693,13 +5701,13 @@ var ZodObject = /*@__PURE__*/ $constructor("ZodObject", (inst, def) => {
5693
5701
  passthrough() {
5694
5702
  return this.clone({
5695
5703
  ...this._zod.def,
5696
- catchall: unknown()
5704
+ catchall: unknown$1()
5697
5705
  });
5698
5706
  },
5699
5707
  loose() {
5700
5708
  return this.clone({
5701
5709
  ...this._zod.def,
5702
- catchall: unknown()
5710
+ catchall: unknown$1()
5703
5711
  });
5704
5712
  },
5705
5713
  strict() {
@@ -5756,7 +5764,7 @@ function looseObject(shape, params) {
5756
5764
  return new ZodObject({
5757
5765
  type: "object",
5758
5766
  shape,
5759
- catchall: unknown(),
5767
+ catchall: unknown$1(),
5760
5768
  ...normalizeParams(params)
5761
5769
  });
5762
5770
  }
@@ -6131,7 +6139,7 @@ var ZodIssueCode = {
6131
6139
  var ZodFirstPartyTypeKind;
6132
6140
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
6133
6141
  //#endregion
6134
- //#region ../types/dist/runtime-capabilities-B36VcCR6.mjs
6142
+ //#region ../types/dist/runtime-capabilities-CG61dYnO.mjs
6135
6143
  /**
6136
6144
  * The audio chunk plane's byte format, and the ONE expansion from a coded
6137
6145
  * window to float samples (D455).
@@ -6226,6 +6234,97 @@ var AddonMigrationsBlockedError = class extends Error {
6226
6234
  this.migrationIds = migrationIds;
6227
6235
  }
6228
6236
  };
6237
+ var SWITCHES = /* @__PURE__ */ new Map();
6238
+ /** The ids the registry is known to hold a row for (hydrated, or told by the hub). */
6239
+ var ROWS = /* @__PURE__ */ new Set();
6240
+ /** The owner addon of an id, learned from its rows and from the helper that serves it. */
6241
+ var OWNER_OF = /* @__PURE__ */ new Map();
6242
+ /** The addons whose registry read answered at least once. */
6243
+ var ANSWERED = /* @__PURE__ */ new Set();
6244
+ /** The addons whose boot has begun reading the registry: only they can be held back. */
6245
+ var HYDRATING = /* @__PURE__ */ new Set();
6246
+ /**
6247
+ * The addons that serve an instance kind and have not been answered by the registry yet. Scoped
6248
+ * per owner: one addon's failed read never turns off another addon's instances, and an addon that
6249
+ * serves no instance kind never enters it.
6250
+ */
6251
+ var PENDING = /* @__PURE__ */ new Set();
6252
+ /**
6253
+ * An addon's boot is about to read the registry for its rows. From now on, until the registry
6254
+ * answers, its served instance kinds (already built or built later in its boot) fail closed. A
6255
+ * helper used with no addon boot around it (a spec, a tool) is never held back.
6256
+ */
6257
+ function beginHydration(ownerId) {
6258
+ if (ANSWERED.has(ownerId)) return;
6259
+ HYDRATING.add(ownerId);
6260
+ if (KINDS.has(ownerId)) PENDING.add(ownerId);
6261
+ }
6262
+ /** The helper of `ownerId` serves `id`: its fail-closed window is that owner's, not the process's. */
6263
+ function claimInstance(ownerId, id) {
6264
+ OWNER_OF.set(id, ownerId);
6265
+ }
6266
+ /** Whether `ownerId` still waits for the registry to answer (it serves a kind and has no rows yet). */
6267
+ function isHydrationPending(ownerId) {
6268
+ return PENDING.has(ownerId);
6269
+ }
6270
+ /**
6271
+ * The switch of `id` as this process knows it. An id nobody stated reads off while ITS owner waits
6272
+ * for the registry, on afterwards (a fresh instance). An id with no known owner reads off while any
6273
+ * owner waits.
6274
+ */
6275
+ function isInstanceOn(id) {
6276
+ const stated = SWITCHES.get(id);
6277
+ if (stated !== void 0) return stated;
6278
+ const owner = OWNER_OF.get(id);
6279
+ return owner === void 0 ? PENDING.size === 0 : !PENDING.has(owner);
6280
+ }
6281
+ /** Record what the hub told: the registry holds a row of `id` in this state. */
6282
+ function recordRegistrySwitch(id, enabled) {
6283
+ SWITCHES.set(id, enabled);
6284
+ ROWS.add(id);
6285
+ }
6286
+ /** Whether the registry is known to hold a row for `id`. */
6287
+ function hasRegistryRow(id) {
6288
+ return ROWS.has(id);
6289
+ }
6290
+ /** The state this process holds for `id`, or undefined when it holds none. */
6291
+ function statedInstanceSwitch(id) {
6292
+ return SWITCHES.get(id);
6293
+ }
6294
+ /** Forget `id` (the instance was deleted). */
6295
+ function forgetInstanceSwitch(id) {
6296
+ SWITCHES.delete(id);
6297
+ ROWS.delete(id);
6298
+ OWNER_OF.delete(id);
6299
+ }
6300
+ /** Seed the store from the registry rows of `ownerId`; the registry answered, so the owner is known. */
6301
+ function hydrateInstanceSwitches(ownerId, rows) {
6302
+ ANSWERED.add(ownerId);
6303
+ for (const row of rows) {
6304
+ recordRegistrySwitch(row.id, row.enabled);
6305
+ OWNER_OF.set(row.id, ownerId);
6306
+ }
6307
+ }
6308
+ /** The addon's boot has built every instance kind and read the registry: unknown ids now read on. */
6309
+ function settleHydration(ownerId) {
6310
+ PENDING.delete(ownerId);
6311
+ }
6312
+ var KINDS = /* @__PURE__ */ new Map();
6313
+ /**
6314
+ * A helper announces the kind it serves, by owner addon. The one-time body-to-registry move
6315
+ * (D1066) walks exactly these kinds, so an addon needs no list of its own: a record kind IS an
6316
+ * instance kind precisely when a helper wraps it.
6317
+ */
6318
+ function registerServedInstanceKind(ownerId, served) {
6319
+ const owned = KINDS.get(ownerId) ?? /* @__PURE__ */ new Map();
6320
+ owned.set(served.kind.name, served);
6321
+ KINDS.set(ownerId, owned);
6322
+ if (HYDRATING.has(ownerId) && !ANSWERED.has(ownerId)) PENDING.add(ownerId);
6323
+ }
6324
+ /** The instance kinds announced for `ownerId` so far. */
6325
+ function servedInstanceKindsOf(ownerId) {
6326
+ return [...KINDS.get(ownerId)?.values() ?? []];
6327
+ }
6229
6328
  /** Is this field's stored value a credential? */
6230
6329
  function isSecretConfigField(field) {
6231
6330
  if (field.type === "password") return true;
@@ -6906,6 +7005,32 @@ function switchRecordsOverMigrationApi(api) {
6906
7005
  };
6907
7006
  } };
6908
7007
  }
7008
+ /** The record calls the body-to-registry switch migration makes, over the migration API. */
7009
+ function bodySwitchRecordsOverMigrationApi(api) {
7010
+ return { kind: (definition) => {
7011
+ const handle = api.records.kind(definition);
7012
+ return {
7013
+ query: async () => {
7014
+ const rows = [];
7015
+ let cursor;
7016
+ do {
7017
+ const page = await handle.query({
7018
+ limit: 500,
7019
+ ...cursor === void 0 ? {} : { cursor }
7020
+ });
7021
+ rows.push(...page.records);
7022
+ cursor = page.nextCursor ?? void 0;
7023
+ } while (cursor !== void 0);
7024
+ return { records: rows };
7025
+ },
7026
+ get: (id) => handle.get({ id }),
7027
+ put: (input, opts) => handle.put({
7028
+ ...input,
7029
+ ...opts?.ifRev === void 0 ? {} : { ifRev: opts.ifRev }
7030
+ })
7031
+ };
7032
+ } };
7033
+ }
6909
7034
  function integrationRowsApiOver(api) {
6910
7035
  return {
6911
7036
  list: async () => (await api.integrations.list({})).integrations,
@@ -7332,13 +7457,9 @@ function secretViewsOf(owner, kind, id, decl, data) {
7332
7457
  /** The most instances one addon lists (an integrations page, not a table). */
7333
7458
  var INSTANCES_LIST_MAX = 1e3;
7334
7459
  /**
7335
- * The ONE reader of an instance's switch (D996): an absent field means on, so a row written
7336
- * before the field existed needs no migration. Every consumer of an instance body asks this.
7460
+ * The body key the switch USED to live under (D1007, D1015). Nothing writes or reads it any more;
7461
+ * the migrations that move it between the body and the registry name it.
7337
7462
  */
7338
- function isInstanceEnabled(body) {
7339
- return body.enabled !== false;
7340
- }
7341
- /** The body key of the switch; only {@link RecordIntegrationInstances.setInstanceEnabled} writes it. */
7342
7463
  var SWITCH_KEY = "enabled";
7343
7464
  /**
7344
7465
  * The "Add device" mode an instance gets when its provider states none, from how the provider's
@@ -7380,6 +7501,20 @@ var RecordIntegrationInstances = class {
7380
7501
  secretKeys;
7381
7502
  secretMaps;
7382
7503
  nameField;
7504
+ /** The state each instance had when the addon last read it or was told it: {@link reapply} announces only a change. */
7505
+ knownSwitches = /* @__PURE__ */ new Map();
7506
+ /** What the addon reads for `id`: the switch as this process holds it, remembered as known. */
7507
+ knownSwitchOf(id) {
7508
+ claimInstance(this.records.owner, id);
7509
+ const enabled = isInstanceOn(id);
7510
+ this.knownSwitches.set(id, enabled);
7511
+ return enabled;
7512
+ }
7513
+ /** What a view of `id` shows; the addon did not read it, so nothing is remembered as known. */
7514
+ viewSwitchOf(id) {
7515
+ claimInstance(this.records.owner, id);
7516
+ return isInstanceOn(id);
7517
+ }
7383
7518
  switchListeners = /* @__PURE__ */ new Set();
7384
7519
  constructor(records, kind, hooks) {
7385
7520
  this.records = records;
@@ -7389,6 +7524,11 @@ var RecordIntegrationInstances = class {
7389
7524
  this.secretKeys = topLevelSecretKeys(kind.declaration.secretPaths);
7390
7525
  this.secretMaps = secretMapKeys(kind.declaration.secretPaths);
7391
7526
  this.nameField = kind.declaration.entry?.nameField ?? "name";
7527
+ registerServedInstanceKind(records.owner, {
7528
+ kind,
7529
+ reapply: () => this.reapply(),
7530
+ unrowed: () => this.unrowed()
7531
+ });
7392
7532
  if (hooks.kindOf === void 0 && hooks.description.kinds.length !== 1) throw new Error(`record kind '${kind.name}': describe().kinds has ${hooks.description.kinds.length} entries, so kindOf is required to say which one an instance is`);
7393
7533
  }
7394
7534
  /**
@@ -7402,7 +7542,7 @@ var RecordIntegrationInstances = class {
7402
7542
  return record === null ? null : {
7403
7543
  id,
7404
7544
  body: record.data,
7405
- enabled: isInstanceEnabled(record.data),
7545
+ enabled: this.knownSwitchOf(id),
7406
7546
  secrets: "resolved"
7407
7547
  };
7408
7548
  } catch (err) {
@@ -7412,7 +7552,7 @@ var RecordIntegrationInstances = class {
7412
7552
  return {
7413
7553
  id,
7414
7554
  body: Object.fromEntries(Object.entries(stored.data).filter(([key]) => !this.secretKeys.has(key))),
7415
- enabled: isInstanceEnabled(stored.data),
7555
+ enabled: this.knownSwitchOf(id),
7416
7556
  secrets: "unavailable"
7417
7557
  };
7418
7558
  }
@@ -7451,7 +7591,7 @@ var RecordIntegrationInstances = class {
7451
7591
  id: record.id,
7452
7592
  name: typeof rawName === "string" ? rawName : record.id,
7453
7593
  configured: this.hooks.configured(record.data),
7454
- enabled: isInstanceEnabled(record.data),
7594
+ enabled: this.viewSwitchOf(record.id),
7455
7595
  formValues: shown,
7456
7596
  kind,
7457
7597
  addDevice: this.hooks.addDevice?.(record.data) ?? defaultAddDeviceMode(this.hooks.description),
@@ -7507,6 +7647,8 @@ var RecordIntegrationInstances = class {
7507
7647
  id: minted,
7508
7648
  data: initial
7509
7649
  }, { ifRev: 0 });
7650
+ claimInstance(this.records.owner, minted);
7651
+ recordRegistrySwitch(minted, true);
7510
7652
  if (Object.keys(patch).length > 0) await this.handle.patch(minted, patch);
7511
7653
  await this.hooks.onChanged?.(minted, "created");
7512
7654
  return { id: minted };
@@ -7552,23 +7694,53 @@ var RecordIntegrationInstances = class {
7552
7694
  this.switchListeners.add(listener);
7553
7695
  }
7554
7696
  /**
7555
- * The ONE writer of the switch (D996, D1014): the record body's `enabled`, for every role. A
7556
- * configured thing is an instance, so an id with no record yet (a default integration that was
7557
- * never configured) gets its record from `initialBody` before the switch is written.
7697
+ * The hub's notification that the registry row of `id` moved (D1066). The registry holds the
7698
+ * switch; this keeps NO copy of it in the record. It remembers the state for this process's
7699
+ * readers ({@link isInstanceOn}), lets the addon re-apply, and fires the listeners.
7558
7700
  */
7559
7701
  setInstanceEnabled = async ({ id, enabled }) => {
7560
- if (await this.handle.get(id) === null) await this.handle.put({
7561
- id,
7562
- data: this.hooks.initialBody(id)
7563
- }, { ifRev: 0 });
7564
- await this.handle.patch(id, { [SWITCH_KEY]: enabled });
7702
+ claimInstance(this.records.owner, id);
7703
+ recordRegistrySwitch(id, enabled);
7704
+ this.knownSwitches.set(id, enabled);
7565
7705
  await this.hooks.onChanged?.(id, "enabled");
7566
7706
  for (const listener of this.switchListeners) await listener(id, enabled);
7567
7707
  return { ok: true };
7568
7708
  };
7709
+ /**
7710
+ * After the registry answered for a kind built before it could: announce the state of every
7711
+ * instance of this kind, on and off, so an addon that started on the fail-closed default (off)
7712
+ * starts what is on and stops what is off.
7713
+ */
7714
+ async reapply() {
7715
+ const page = await this.handle.query({ limit: INSTANCES_LIST_MAX });
7716
+ for (const record of page.records) {
7717
+ claimInstance(this.records.owner, record.id);
7718
+ const enabled = isInstanceOn(record.id);
7719
+ if (this.knownSwitches.get(record.id) === enabled) continue;
7720
+ this.knownSwitches.set(record.id, enabled);
7721
+ await this.hooks.onChanged?.(record.id, "enabled");
7722
+ for (const listener of this.switchListeners) await listener(record.id, enabled);
7723
+ }
7724
+ }
7725
+ /**
7726
+ * The records of this kind the registry holds no row for: created outside the hub door (a
7727
+ * seed, a migration, a store write). Each carries the state this process holds for it, on when
7728
+ * it holds none, because on was its effective state before the registry owned the switch.
7729
+ */
7730
+ async unrowed() {
7731
+ return (await this.handle.query({ limit: INSTANCES_LIST_MAX })).records.filter((record) => !hasRegistryRow(record.id)).map((record) => {
7732
+ const name = record.data[this.nameField];
7733
+ return {
7734
+ id: record.id,
7735
+ name: typeof name === "string" ? name : record.id,
7736
+ enabled: statedInstanceSwitch(record.id) ?? true
7737
+ };
7738
+ });
7739
+ }
7569
7740
  /** The row and its keychain refs go together (the records door). */
7570
7741
  deleteInstance = async ({ id }) => {
7571
7742
  await this.handle.delete(id);
7743
+ forgetInstanceSwitch(id);
7572
7744
  await this.hooks.onChanged?.(id, "deleted");
7573
7745
  return { ok: true };
7574
7746
  };
@@ -7680,7 +7852,7 @@ function registrySwitchPortsOver(deps) {
7680
7852
  const handle = deps.records.kind({
7681
7853
  name: deps.kind.name,
7682
7854
  declaration: deps.kind.declaration,
7683
- schema: record$1(string(), unknown())
7855
+ schema: record$1(string(), unknown$1())
7684
7856
  });
7685
7857
  return {
7686
7858
  listIntegrations: async (addonId) => (await deps.api.list()).filter((i) => i.addonId === addonId).map((i) => ({
@@ -7703,6 +7875,107 @@ function registrySwitchPortsOver(deps) {
7703
7875
  };
7704
7876
  }
7705
7877
  /**
7878
+ * The switch comes back to the registry (D1066), the reverse of {@link registrySwitchToBodyMigration}.
7879
+ * An instance's on/off state lived in its record body (`enabled`, D1007 superseded by D1015); the hub
7880
+ * registry row, keyed by (addon, integration id) like a device, is now the only stored switch.
7881
+ *
7882
+ * For every record of the addon's kind:
7883
+ * - the state is the body's `enabled` (absent means on). When the registry row of that id disagrees,
7884
+ * the BODY wins: it was the only live copy while the body held the switch, and the registry
7885
+ * column of a migrated row was never read;
7886
+ * - a record with no registry row gets one (a services instance, under its addon-minted id);
7887
+ * - the key is then removed from the body, so no second copy remains.
7888
+ * A rerun finds no body that states `enabled` and writes nothing. The registry write goes first, so
7889
+ * a crash between the two steps repeats the pair (idempotent) and never loses a switched-off state.
7890
+ *
7891
+ * It runs in the addon process, after {@link registrySwitchToBodyMigration}, BEFORE the addon
7892
+ * registers its provider.
7893
+ */
7894
+ function bodySwitchToRegistryId(addonId, date, kindName) {
7895
+ return `${addonId}/${date}-body-switch-to-registry-${kindName}`;
7896
+ }
7897
+ async function moveBodySwitchToRegistry(ports, spec) {
7898
+ const records = await ports.listRecords();
7899
+ const adopted = records.length === 0 ? {
7900
+ created: 0,
7901
+ updated: 0,
7902
+ conflicts: []
7903
+ } : await ports.adoptRows(spec.addonId, records.map((r) => ({
7904
+ id: r.id,
7905
+ name: r.name,
7906
+ enabled: r.enabled,
7907
+ stated: r.stated
7908
+ })));
7909
+ const foreign = new Map(adopted.conflicts.map((c) => [c.id, c.ownerAddonId]));
7910
+ for (const [id, owner] of foreign) await ports.warn(`body switch kept: the registry row "${id}" belongs to addon "${owner}", not "${spec.addonId}"`);
7911
+ const stated = records.filter((r) => r.stated && !foreign.has(r.id));
7912
+ for (const row of stated) await ports.stripSwitch(row.id);
7913
+ const summary = {
7914
+ records: records.length,
7915
+ stripped: stated.length,
7916
+ rowsCreated: adopted.created,
7917
+ rowsCorrected: adopted.updated,
7918
+ conflicts: adopted.conflicts.length
7919
+ };
7920
+ return stated.length === 0 && adopted.created === 0 && adopted.updated === 0 ? {
7921
+ outcome: "already-done",
7922
+ summary
7923
+ } : {
7924
+ outcome: "done",
7925
+ summary
7926
+ };
7927
+ }
7928
+ /** A migration entry: an addon states its kind, nothing else. */
7929
+ function bodySwitchToRegistryMigration(spec) {
7930
+ return {
7931
+ meta: {
7932
+ id: bodySwitchToRegistryId(spec.addonId, spec.date, spec.kindName),
7933
+ owner: spec.addonId,
7934
+ level: "addon-state",
7935
+ seq: spec.seq,
7936
+ dependsOn: spec.followsDate === void 0 ? [] : [registrySwitchToBodyId(spec.addonId, spec.followsDate)],
7937
+ store: "settings",
7938
+ scope: "cluster",
7939
+ onFailure: "block-owner",
7940
+ bodyKind: "procedure",
7941
+ description: "Move the switch of every instance record back to its registry row (creating the row of a services instance) and remove it from the body",
7942
+ fixtureMark: "enabled"
7943
+ },
7944
+ procedure: (ports) => moveBodySwitchToRegistry(ports, { addonId: spec.addonId })
7945
+ };
7946
+ }
7947
+ function bodySwitchPortsOver(deps) {
7948
+ const handle = deps.records.kind({
7949
+ name: deps.kind.name,
7950
+ declaration: deps.kind.declaration,
7951
+ schema: record$1(string(), unknown$1())
7952
+ });
7953
+ return {
7954
+ listRecords: async () => {
7955
+ return (await handle.query({ limit: 1e3 })).records.map((r) => {
7956
+ const name = r.data[deps.nameField];
7957
+ return {
7958
+ id: r.id,
7959
+ name: typeof name === "string" ? name : r.id,
7960
+ enabled: r.data[SWITCH_KEY] !== false,
7961
+ stated: SWITCH_KEY in r.data
7962
+ };
7963
+ });
7964
+ },
7965
+ adoptRows: deps.adopt,
7966
+ warn: deps.warn,
7967
+ stripSwitch: async (id) => {
7968
+ const row = await handle.get(id);
7969
+ if (row === null || !("enabled" in row.data)) return;
7970
+ const { [SWITCH_KEY]: _dropped, ...rest } = row.data;
7971
+ await handle.put({
7972
+ id,
7973
+ data: rest
7974
+ }, { ifRev: row.rev });
7975
+ }
7976
+ };
7977
+ }
7978
+ /**
7706
7979
  * Build a {@link DurableState} over a single store key. Transport-agnostic:
7707
7980
  * `read`/`write` are the addon-store or device-store accessors. The whole
7708
7981
  * validated value round-trips on every read/write — the schema is the
@@ -7734,6 +8007,20 @@ function createDurableState(deps) {
7734
8007
  };
7735
8008
  }
7736
8009
  /**
8010
+ * The registry could not be read for the switches of an addon that serves instance kinds, so its
8011
+ * instances read off (D1066). A forked runner treats it as a failed boot: the supervisor respawns
8012
+ * it, bounded and marked terminally failed (D6), rather than leave instances off silently.
8013
+ */
8014
+ var INSTANCE_SWITCHES_UNREAD_ERROR_NAME = "InstanceSwitchesUnreadError";
8015
+ var InstanceSwitchesUnreadError = class extends Error {
8016
+ ownerId;
8017
+ constructor(ownerId) {
8018
+ super(`'${ownerId}': the registry did not answer for the instance switches; its instances stay off`);
8019
+ this.ownerId = ownerId;
8020
+ this.name = INSTANCE_SWITCHES_UNREAD_ERROR_NAME;
8021
+ }
8022
+ };
8023
+ /**
7737
8024
  * Per-node scoping for the shared addon-settings blob.
7738
8025
  *
7739
8026
  * An addon's settings store is hub-central (the `addon-settings` cap is
@@ -8717,7 +9004,14 @@ var BaseAddon = class {
8717
9004
  if (secrets !== void 0) this._secretChangeUnsub = secrets.onChange((ref) => {
8718
9005
  if (this._configSecretRefs.has(ref)) this.scheduleSecretReresolve(SECRET_CHANGE_DEBOUNCE_MS);
8719
9006
  });
9007
+ await this.hydrateSwitches();
8720
9008
  const result = await this.onInitialize();
9009
+ await this.moveLateInstanceKinds();
9010
+ await this.adoptUnrowed();
9011
+ if (this.switchesHydrated) {
9012
+ settleHydration(this.ctx.id);
9013
+ for (const served of servedInstanceKindsOf(this.ctx.id)) await served.reapply();
9014
+ }
8721
9015
  this.emitLifecycle(EventCategory.AddonStarted);
8722
9016
  const normalized = normalizeAddonInitResult(result);
8723
9017
  const providers = normalized && "providers" in normalized && normalized.providers ? normalized.providers : [];
@@ -8757,17 +9051,22 @@ var BaseAddon = class {
8757
9051
  this.retiredMigrationIds = ids;
8758
9052
  }
8759
9053
  registrySwitchSpec = null;
9054
+ /** The instance kinds whose switch move this process already ran (or tried), by record kind name. */
9055
+ switchMoved = /* @__PURE__ */ new Set();
9056
+ lastDeclared = [];
8760
9057
  registrySwitchBound() {
8761
- const spec = this.registrySwitchSpec;
8762
- if (spec === null) return [];
8763
9058
  const api = this.ctx.migrationApi;
9059
+ const spec = this.registrySwitchSpec;
9060
+ const kinds = servedInstanceKindsOf(this.ctx.id).filter((k) => !this.switchMoved.has(k.kind.name));
9061
+ if (spec === null && kinds.length === 0) return [];
8764
9062
  if (api === void 0) {
8765
9063
  this.ctx.logger.warn("the registry switch migration is skipped: the migration API is not available on this context");
8766
9064
  return [];
8767
9065
  }
8768
- return migrationSet([registrySwitchToBodyMigration({
9066
+ const date = "2026-11-06";
9067
+ const moveIn = spec === null ? [] : migrationSet([registrySwitchToBodyMigration({
8769
9068
  addonId: this.ctx.id,
8770
- date: "2026-11-06",
9069
+ date,
8771
9070
  seq: 1e3,
8772
9071
  initialBody: spec.initialBody
8773
9072
  })], (a) => registrySwitchPortsOver({
@@ -8775,13 +9074,53 @@ var BaseAddon = class {
8775
9074
  records: switchRecordsOverMigrationApi(a),
8776
9075
  kind: spec.kind
8777
9076
  })).bind(api);
9077
+ const moveBack = kinds.flatMap(({ kind }, index) => {
9078
+ this.switchMoved.add(kind.name);
9079
+ return migrationSet([bodySwitchToRegistryMigration({
9080
+ addonId: this.ctx.id,
9081
+ date: "2026-11-19",
9082
+ seq: 1001 + index,
9083
+ kindName: kind.name,
9084
+ ...spec === null ? {} : { followsDate: date }
9085
+ })], (a) => bodySwitchPortsOver({
9086
+ records: bodySwitchRecordsOverMigrationApi(a),
9087
+ kind,
9088
+ nameField: kind.declaration.entry?.nameField ?? "name",
9089
+ adopt: (addonId, rows) => this.ctx.api.integrations.adoptInstanceRows.mutate({
9090
+ addonId,
9091
+ rows: [...rows]
9092
+ }),
9093
+ warn: async (message) => {
9094
+ await a.log.warn({ message });
9095
+ }
9096
+ })).bind(api);
9097
+ });
9098
+ return [...moveIn, ...moveBack];
9099
+ }
9100
+ /**
9101
+ * A helper built AFTER the addon's migrations ran has a kind that moved nothing yet. Run its
9102
+ * switch move now (the engine replaces an owner's catalogue on every declare, so the whole
9103
+ * declared set goes with it, phased to the late ids), read the registry again, and tell the
9104
+ * addon about every instance that is off so it stops what it started on the default.
9105
+ */
9106
+ async moveLateInstanceKinds() {
9107
+ const late = servedInstanceKindsOf(this.ctx.id).filter((k) => !this.switchMoved.has(k.kind.name));
9108
+ if (late.length === 0) return;
9109
+ try {
9110
+ const only = late.map((k) => bodySwitchToRegistryId(this.ctx.id, "2026-11-19", k.kind.name));
9111
+ await this.runBound(this.lastDeclared, { only });
9112
+ } catch (err) {
9113
+ if (err instanceof AddonMigrationsBlockedError) throw err;
9114
+ this.ctx.logger.error("the late instance switch move failed", { meta: { error: errMsg(err) } });
9115
+ }
8778
9116
  }
8779
9117
  async runBound(declared, options) {
9118
+ this.lastDeclared = declared;
8780
9119
  const added = this.registrySwitchBound();
8781
9120
  const migrations = [...declared, ...added];
8782
9121
  const widened = options?.only === void 0 || added.length === 0 ? options : {
8783
9122
  ...options,
8784
- only: [...options.only, ...added.map((m) => m.meta.id)]
9123
+ only: [...new Set([...options.only, ...added.map((m) => m.meta.id)])]
8785
9124
  };
8786
9125
  const phased = this.retiredMigrationIds.length === 0 ? widened ?? {} : {
8787
9126
  ...widened,
@@ -8794,9 +9133,87 @@ var BaseAddon = class {
8794
9133
  finishMigration: (input) => api.finishMigration.mutate(input)
8795
9134
  }, migrations, this.ctx.logger, phased);
8796
9135
  if (report.blockOwner.length > 0) throw new AddonMigrationsBlockedError(report.blockOwner);
9136
+ await this.hydrateSwitches();
9137
+ await this.adoptUnrowed();
8797
9138
  return report;
8798
9139
  }
8799
9140
  /**
9141
+ * Learn the on/off state of this addon's instances from the registry rows (D1066), at boot, after
9142
+ * a migration run, and again through {@link rehydrateSwitches}. It runs on the addon's own boot
9143
+ * path, never inside a method the hub calls into. A registry that cannot answer leaves the
9144
+ * instances of THIS addon reading off (fail closed, per owner) until a read answers.
9145
+ */
9146
+ switchesHydrated = false;
9147
+ async hydrateSwitches() {
9148
+ beginHydration(this.ctx.id);
9149
+ try {
9150
+ const rows = await this.ctx.api.integrations.listByAddon.query({ addonId: this.ctx.id });
9151
+ hydrateInstanceSwitches(this.ctx.id, rows);
9152
+ this.switchesHydrated = true;
9153
+ return true;
9154
+ } catch (err) {
9155
+ this.ctx.logger.warn("instance switches not read from the registry: instances stay off", { meta: { error: errMsg(err) } });
9156
+ return false;
9157
+ }
9158
+ }
9159
+ /**
9160
+ * Every record of a served kind the registry holds no row for (created outside the hub door:
9161
+ * a seed, a store write) is adopted with the state it effectively had, on unless this process
9162
+ * stated it off, so the hub can switch it. A failure is logged; the next hydration retries.
9163
+ */
9164
+ async adoptUnrowed() {
9165
+ if (!this.switchesHydrated) return;
9166
+ try {
9167
+ for (const served of servedInstanceKindsOf(this.ctx.id)) {
9168
+ const rows = await served.unrowed();
9169
+ if (rows.length === 0) continue;
9170
+ await this.ctx.api.integrations.adoptInstanceRows.mutate({
9171
+ addonId: this.ctx.id,
9172
+ rows: rows.map((r) => ({
9173
+ id: r.id,
9174
+ name: r.name,
9175
+ enabled: r.enabled,
9176
+ stated: false
9177
+ }))
9178
+ });
9179
+ for (const r of rows) recordRegistrySwitch(r.id, r.enabled);
9180
+ }
9181
+ } catch (err) {
9182
+ this.ctx.logger.warn("records without a registry row were not adopted", { meta: { error: errMsg(err) } });
9183
+ }
9184
+ }
9185
+ /**
9186
+ * Read the switches from the registry again and announce the states now known, so an addon that
9187
+ * started on the fail-closed default (off) starts what is on. Throws
9188
+ * {@link InstanceSwitchesUnreadError} when the registry still does not answer while this addon
9189
+ * serves instance kinds: a forked runner turns that into a failed boot (the supervisor respawns
9190
+ * it, bounded, D6), an agent or the hub reads again on the next hub connect (event-driven, D3).
9191
+ * An addon with no instance kind has nothing waiting and never throws.
9192
+ */
9193
+ async rehydrateSwitches() {
9194
+ if (this._ctx === null) return;
9195
+ if (await this.hydrateSwitches()) {
9196
+ await this.adoptUnrowed();
9197
+ settleHydration(this.ctx.id);
9198
+ for (const served of servedInstanceKindsOf(this.ctx.id)) await served.reapply();
9199
+ return;
9200
+ }
9201
+ if (isHydrationPending(this.ctx.id)) throw new InstanceSwitchesUnreadError(this.ctx.id);
9202
+ }
9203
+ /**
9204
+ * Called on the hub-reachable event (instead of `onHubReachable` directly): the switches are
9205
+ * read again, then `onHubReachable` runs. A registry that still does not answer is logged and
9206
+ * left for the next connect.
9207
+ */
9208
+ async hubReachable() {
9209
+ try {
9210
+ await this.rehydrateSwitches();
9211
+ } catch (err) {
9212
+ this.ctx.logger.warn("instance switches still unread at the hub connect", { meta: { error: errMsg(err) } });
9213
+ }
9214
+ await this.onHubReachable();
9215
+ }
9216
+ /**
8800
9217
  * Called by the isolated-process runner AFTER `broker.start()`.
8801
9218
  * In-process addons never need this because the hub broker is already
8802
9219
  * running when `initialize()` fires. For forked children the broker
@@ -9894,9 +10311,9 @@ object({
9894
10311
  }).nullable();
9895
10312
  object({ deviceId: number$1() }), object({ deviceId: number$1() }), object({
9896
10313
  deviceId: number$1(),
9897
- patch: record$1(string(), unknown())
10314
+ patch: record$1(string(), unknown$1())
9898
10315
  }), object({ success: literal(true) });
9899
- object({ deviceId: number$1() }), unknown().nullable();
10316
+ object({ deviceId: number$1() }), unknown$1().nullable();
9900
10317
  function method(input, output, options) {
9901
10318
  return {
9902
10319
  input,
@@ -10049,7 +10466,7 @@ var EntryDescriptorSchema = object({
10049
10466
  /** The record body field shown as the entry's name. */
10050
10467
  nameField: string().min(1),
10051
10468
  /** JSON Schema of the entry body; `secret: true` marks a password field. */
10052
- fields: record$1(string(), unknown())
10469
+ fields: record$1(string(), unknown$1())
10053
10470
  }).strict();
10054
10471
  /** What crosses the wire from an addon: JSON only, no Zod. An unknown key is refused. */
10055
10472
  var RecordKindDeclarationSchema = object({
@@ -10296,7 +10713,7 @@ var TransitionValueSchema = union([
10296
10713
  number$1(),
10297
10714
  boolean(),
10298
10715
  _null(),
10299
- record$1(string(), unknown())
10716
+ record$1(string(), unknown$1())
10300
10717
  ]);
10301
10718
  /** Who asked. `device` is the fallback: nothing the hub observed asked for the change. */
10302
10719
  var TransitionActorSchema = discriminatedUnion("kind", [
@@ -10361,7 +10778,7 @@ var TransitionOutcomeSchema = _enum([
10361
10778
  var TransitionCommandSchema = object({
10362
10779
  commandId: string(),
10363
10780
  method: string(),
10364
- args: record$1(string(), unknown()),
10781
+ args: record$1(string(), unknown$1()),
10365
10782
  requestedAt: number$1(),
10366
10783
  /** Milliseconds from the command to the change it caused; `null` when no change was seen. */
10367
10784
  matchedAfterMs: number$1().nullable(),
@@ -10567,6 +10984,15 @@ var CameraStreamSchema = object({
10567
10984
  */
10568
10985
  autoEligible: boolean().optional(),
10569
10986
  /**
10987
+ * The longest continuous session the SOURCE will keep open, in ms, declared by
10988
+ * the provider that knows it (a hub that cuts every child's session on a
10989
+ * timer). Absent = no limit. The broker re-dials a live source a little
10990
+ * BEFORE this elapses, on its own terms and announced to consumers, so the
10991
+ * source's cut never lands mid-recording. Declare slightly under what was
10992
+ * observed.
10993
+ */
10994
+ maxSessionMs: number$1().int().positive().optional(),
10995
+ /**
10570
10996
  * The profile slot the PUBLISHER says this stream is: `low` for a stream
10571
10997
  * whose only sensible role is the low-bandwidth one, `high` for a main
10572
10998
  * stream. Consulted by the broker's automatic ranking
@@ -10588,7 +11014,7 @@ var CameraStreamSchema = object({
10588
11014
  * route RTP packets to the right depacketizer without an in-band
10589
11015
  * DESCRIBE phase). Other kinds typically leave it undefined.
10590
11016
  */
10591
- metadata: record$1(string(), unknown()).optional()
11017
+ metadata: record$1(string(), unknown$1()).optional()
10592
11018
  });
10593
11019
  var ProfileSlotStatusSchema = _enum([
10594
11020
  "unassigned",
@@ -10640,7 +11066,7 @@ object({
10640
11066
  url: string(),
10641
11067
  videoCodec: string().optional(),
10642
11068
  audioCodec: string().optional(),
10643
- metadata: record$1(string(), unknown()).readonly().optional()
11069
+ metadata: record$1(string(), unknown$1()).readonly().optional()
10644
11070
  });
10645
11071
  /**
10646
11072
  * Wire schema for `FrameHandle` — a zero-pixel, serialisable reference to a
@@ -19934,6 +20360,45 @@ var CAP_VOCABULARY_BY_NAME = {
19934
20360
  }
19935
20361
  ],
19936
20362
  icon: "battery-charging"
20363
+ },
20364
+ {
20365
+ kind: "enum",
20366
+ field: "chargeState",
20367
+ label: {
20368
+ en: "Charge state",
20369
+ it: "Stato di carica"
20370
+ },
20371
+ values: [
20372
+ {
20373
+ value: "charging",
20374
+ label: {
20375
+ en: "Charging",
20376
+ it: "In carica"
20377
+ }
20378
+ },
20379
+ {
20380
+ value: "full",
20381
+ label: {
20382
+ en: "Full",
20383
+ it: "Carica completa"
20384
+ }
20385
+ },
20386
+ {
20387
+ value: "idle",
20388
+ label: {
20389
+ en: "Not charging",
20390
+ it: "Non in carica"
20391
+ }
20392
+ },
20393
+ {
20394
+ value: "unknown",
20395
+ label: {
20396
+ en: "Unknown",
20397
+ it: "Sconosciuto"
20398
+ }
20399
+ }
20400
+ ],
20401
+ icon: "battery-charging"
19937
20402
  }
19938
20403
  ],
19939
20404
  events: { onStatusChanged: { notOperatorFacing: "the level / sleeping / charging state triggers each read one field of this change" } },
@@ -20689,31 +21154,31 @@ var StreamSourceEntrySchema = object({
20689
21154
  });
20690
21155
  var ConfigEntrySchema$1 = object({
20691
21156
  key: string(),
20692
- value: unknown()
21157
+ value: unknown$1()
20693
21158
  });
20694
21159
  var RawStateResultSchema = object({
20695
21160
  /** Originating provider id, e.g. 'homeassistant' | 'reolink' | 'hikvision'. */
20696
21161
  source: string(),
20697
21162
  /** Opaque, DISPLAY-SAFE upstream blob (no secrets/PII). */
20698
- data: record$1(string(), unknown())
21163
+ data: record$1(string(), unknown$1())
20699
21164
  });
20700
21165
  method(object({ deviceId: number$1() }), array(StreamSourceEntrySchema)), method(object({ deviceId: number$1() }), array(ConfigEntrySchema$1)), method(object({
20701
21166
  deviceId: number$1(),
20702
- values: record$1(string(), unknown())
21167
+ values: record$1(string(), unknown$1())
20703
21168
  }), _void(), {
20704
21169
  kind: "mutation",
20705
21170
  auth: "admin"
20706
21171
  }), method(object({
20707
21172
  deviceId: number$1(),
20708
21173
  action: string().min(1),
20709
- input: unknown()
20710
- }), unknown(), {
21174
+ input: unknown$1()
21175
+ }), unknown$1(), {
20711
21176
  kind: "mutation",
20712
21177
  notOperatorFacing: "a provider-defined custom action whose id and input only the addon knows; it reaches the picker through the custom-actions surface, not a fixed phrase"
20713
21178
  }), method(object({ deviceId: number$1() }), _void(), {
20714
21179
  kind: "mutation",
20715
21180
  auth: "admin"
20716
- }), method(object({ deviceId: number$1() }), unknown().nullable()), method(object({ deviceId: number$1() }), RawStateResultSchema.nullable(), { auth: "protected" });
21181
+ }), method(object({ deviceId: number$1() }), unknown$1().nullable()), method(object({ deviceId: number$1() }), RawStateResultSchema.nullable(), { auth: "protected" });
20717
21182
  /**
20718
21183
  * The pipeline step-input shape and the run-result bridge, in a module that
20719
21184
  * imports nothing but zod and types.
@@ -20730,7 +21195,7 @@ var PipelineStepInputSchema = lazy(() => object({
20730
21195
  modelId: string().optional(),
20731
21196
  enabled: boolean().default(true),
20732
21197
  children: array(PipelineStepInputSchema).optional(),
20733
- settings: record$1(string(), unknown()).optional(),
21198
+ settings: record$1(string(), unknown$1()).optional(),
20734
21199
  jumpDeviceKey: string().optional()
20735
21200
  }));
20736
21201
  /** Typed bridge to the recursive `FrameResult` graph; validation is structural. */
@@ -21130,6 +21595,24 @@ Object.freeze({
21130
21595
  "path": "voltage",
21131
21596
  "valueType": "number"
21132
21597
  },
21598
+ {
21599
+ "path": "chargeState",
21600
+ "valueType": "enum",
21601
+ "enumValues": [
21602
+ "charging",
21603
+ "full",
21604
+ "idle",
21605
+ "unknown"
21606
+ ]
21607
+ },
21608
+ {
21609
+ "path": "currentMa",
21610
+ "valueType": "number"
21611
+ },
21612
+ {
21613
+ "path": "temperatureC",
21614
+ "valueType": "number"
21615
+ },
21133
21616
  {
21134
21617
  "path": "lastContactAt",
21135
21618
  "valueType": "number"
@@ -23245,6 +23728,650 @@ Object.freeze({
23245
23728
  }
23246
23729
  ]
23247
23730
  });
23731
+ Object.freeze({
23732
+ "air-quality-sensor": {
23733
+ "aqi": "optional",
23734
+ "co2": "optional",
23735
+ "lastFetchedAt": "required",
23736
+ "pm10": "optional",
23737
+ "pm25": "optional",
23738
+ "voc": "optional"
23739
+ },
23740
+ "alarm-panel": {
23741
+ "availableModes": "required",
23742
+ "codeRequired": "required",
23743
+ "lastChangedAt": "required",
23744
+ "state": "required",
23745
+ "targetMode": "optional"
23746
+ },
23747
+ "ambient-light-sensor": {
23748
+ "illuminance": "required",
23749
+ "lastFetchedAt": "required"
23750
+ },
23751
+ "audio-metrics": {
23752
+ "avgDbfs": "required",
23753
+ "byClass": "required",
23754
+ "current": "required",
23755
+ "level": "required",
23756
+ "peakDbfs": "required",
23757
+ "ts": "required",
23758
+ "windowSec": "required"
23759
+ },
23760
+ "automation-control": {
23761
+ "enabled": "required",
23762
+ "isRunning": "required",
23763
+ "lastChangedAt": "required",
23764
+ "lastError": "required",
23765
+ "lastTriggeredAt": "required"
23766
+ },
23767
+ "battery": {
23768
+ "binary": "optional",
23769
+ "chargeState": "optional",
23770
+ "charging": "required",
23771
+ "currentMa": "optional",
23772
+ "lastContactAt": "optional",
23773
+ "lastFullRefreshAt": "optional",
23774
+ "lastUpdated": "required",
23775
+ "level": "required",
23776
+ "sleeping": "required",
23777
+ "temperatureC": "optional",
23778
+ "voltage": "optional"
23779
+ },
23780
+ "binary": {
23781
+ "lastChangedAt": "required",
23782
+ "on": "required"
23783
+ },
23784
+ "brightness": {
23785
+ "lastChangedAt": "required",
23786
+ "level": "required"
23787
+ },
23788
+ "camera-streams": {
23789
+ "lastChangedAt": "required",
23790
+ "online": "required",
23791
+ "slotErrors": "required",
23792
+ "slotStatuses": "required"
23793
+ },
23794
+ "carbon-monoxide": {
23795
+ "detected": "required",
23796
+ "lastChangedAt": "required"
23797
+ },
23798
+ "climate-control": {
23799
+ "action": "optional",
23800
+ "availableFanModes": "required",
23801
+ "availableModes": "required",
23802
+ "availablePresets": "required",
23803
+ "currentHumidity": "required",
23804
+ "currentTemp": "required",
23805
+ "fanMode": "required",
23806
+ "lastActiveMode": "optional",
23807
+ "lastFetchedAt": "required",
23808
+ "maxTemp": "optional",
23809
+ "minTemp": "optional",
23810
+ "mode": "required",
23811
+ "preset": "required",
23812
+ "swingHorizontal": "required",
23813
+ "swingVertical": "required",
23814
+ "target": "required",
23815
+ "targetHigh": "required",
23816
+ "targetHumidity": "required",
23817
+ "targetLow": "required",
23818
+ "tempStep": "optional"
23819
+ },
23820
+ "color": {
23821
+ "colorTemperature": "optional",
23822
+ "hsv": "optional",
23823
+ "lastChangedAt": "required",
23824
+ "mode": "required",
23825
+ "rgb": "optional"
23826
+ },
23827
+ "connectivity": {
23828
+ "connected": "required",
23829
+ "lastChangedAt": "required"
23830
+ },
23831
+ "consumables": {
23832
+ "items": "required",
23833
+ "lastChangedAt": "required",
23834
+ "lastFetchedAt": "required"
23835
+ },
23836
+ "contact": {
23837
+ "entryOpen": "required",
23838
+ "lastChangedAt": "required"
23839
+ },
23840
+ "control": {
23841
+ "kind": "required",
23842
+ "lastChangedAt": "required",
23843
+ "max": "optional",
23844
+ "min": "optional",
23845
+ "options": "required",
23846
+ "step": "optional",
23847
+ "value": "required"
23848
+ },
23849
+ "cover": {
23850
+ "lastChangedAt": "required",
23851
+ "position": "required",
23852
+ "state": "required",
23853
+ "tiltPosition": "required"
23854
+ },
23855
+ "day-night": {
23856
+ "lastFetchedAt": "required",
23857
+ "mode": "required",
23858
+ "sensitivity": "optional",
23859
+ "switchDelaySec": "optional"
23860
+ },
23861
+ "device-status": {
23862
+ "lastChangedAt": "required",
23863
+ "online": "required"
23864
+ },
23865
+ "dishwasher": {
23866
+ "activeEvents": "required",
23867
+ "availability": "required",
23868
+ "availablePrograms": "required",
23869
+ "childLock": "required",
23870
+ "delayedStart": "required",
23871
+ "doorLocked": "required",
23872
+ "doorOpen": "required",
23873
+ "errorCode": "required",
23874
+ "errorLabel": "required",
23875
+ "extraDry": "required",
23876
+ "filterCleaningDue": "required",
23877
+ "halfLoad": "required",
23878
+ "hygienePlus": "required",
23879
+ "intensiveZone": "required",
23880
+ "lastFetchedAt": "required",
23881
+ "localControlActive": "required",
23882
+ "machineCareDue": "required",
23883
+ "machineCareRemainingRuns": "required",
23884
+ "operationState": "required",
23885
+ "powerOn": "required",
23886
+ "powerState": "required",
23887
+ "program": "required",
23888
+ "progress": "required",
23889
+ "remaining": "required",
23890
+ "remoteControlActive": "required",
23891
+ "remoteStartAllowed": "required",
23892
+ "selectedProgram": "required",
23893
+ "state": "required",
23894
+ "varioSpeedPlus": "required"
23895
+ },
23896
+ "do-not-disturb": {
23897
+ "enabled": "required",
23898
+ "lastChangedAt": "required"
23899
+ },
23900
+ "doorbell": {
23901
+ "lastPressedAt": "required",
23902
+ "pressCountSinceStart": "required"
23903
+ },
23904
+ "energy-system": {
23905
+ "grid": "required",
23906
+ "heatPump": "required",
23907
+ "house": "required",
23908
+ "lastFetchedAt": "required",
23909
+ "solar": "required",
23910
+ "storage": "required"
23911
+ },
23912
+ "enum-sensor": {
23913
+ "lastFetchedAt": "required",
23914
+ "timestamp": "optional",
23915
+ "value": "required"
23916
+ },
23917
+ "error": {
23918
+ "active": "required",
23919
+ "code": "required",
23920
+ "faults": "optional",
23921
+ "label": "required",
23922
+ "lastFetchedAt": "required",
23923
+ "severity": "required",
23924
+ "since": "required"
23925
+ },
23926
+ "event-emitter": {
23927
+ "eventCountSinceStart": "required",
23928
+ "eventTypes": "required",
23929
+ "lastEvent": "required",
23930
+ "vocabulary": "optional"
23931
+ },
23932
+ "fan-control": {
23933
+ "availablePresets": "required",
23934
+ "direction": "required",
23935
+ "lastChangedAt": "required",
23936
+ "oscillating": "required",
23937
+ "oscillationAxes": "optional",
23938
+ "percentageStep": "optional",
23939
+ "preset": "required",
23940
+ "speed": "required"
23941
+ },
23942
+ "feature-probe": {
23943
+ "channelCount": "required",
23944
+ "deviceType": "required",
23945
+ "flags": "required",
23946
+ "lastFetchedAt": "required",
23947
+ "lastProbedAt": "required",
23948
+ "model": "required"
23949
+ },
23950
+ "flood": {
23951
+ "flooded": "required",
23952
+ "lastChangedAt": "required"
23953
+ },
23954
+ "gas": {
23955
+ "detected": "required",
23956
+ "lastChangedAt": "required"
23957
+ },
23958
+ "group-active": {
23959
+ "active": "required",
23960
+ "lastChangedAt": "required"
23961
+ },
23962
+ "group-commands": { "results": "required" },
23963
+ "group-status": {
23964
+ "excluded": "required",
23965
+ "included": "required",
23966
+ "total": "required"
23967
+ },
23968
+ "heat-pump-status": {
23969
+ "circuits": "required",
23970
+ "energy": "required",
23971
+ "lastFetchedAt": "required",
23972
+ "power": "required",
23973
+ "starts": "required",
23974
+ "system": "required",
23975
+ "temperatures": "required",
23976
+ "waterPressureBar": "required"
23977
+ },
23978
+ "heating-valve": {
23979
+ "lastFetchedAt": "required",
23980
+ "position": "required"
23981
+ },
23982
+ "humidifier": {
23983
+ "action": "required",
23984
+ "availableModes": "required",
23985
+ "currentHumidity": "required",
23986
+ "lastChangedAt": "required",
23987
+ "maxHumidity": "required",
23988
+ "minHumidity": "required",
23989
+ "mode": "required",
23990
+ "on": "required",
23991
+ "targetHumidity": "required"
23992
+ },
23993
+ "humidity-sensor": {
23994
+ "humidity": "required",
23995
+ "lastFetchedAt": "required"
23996
+ },
23997
+ "image": {
23998
+ "lastUpdated": "required",
23999
+ "url": "required"
24000
+ },
24001
+ "image-settings": {
24002
+ "backlightMode": "optional",
24003
+ "brightness": "optional",
24004
+ "contrast": "optional",
24005
+ "exposureMode": "optional",
24006
+ "flip": "optional",
24007
+ "lastFetchedAt": "required",
24008
+ "mirror": "optional",
24009
+ "rotate": "optional",
24010
+ "saturation": "optional",
24011
+ "sharpness": "optional",
24012
+ "warmth": "optional",
24013
+ "whiteBalance": "optional"
24014
+ },
24015
+ "intercom": {
24016
+ "ability": "required",
24017
+ "lastSessionAt": "required",
24018
+ "talking": "required"
24019
+ },
24020
+ "ir-transmitter": {
24021
+ "lastFetchedAt": "required",
24022
+ "lastLearn": "required",
24023
+ "lastSend": "required"
24024
+ },
24025
+ "lawn-mower-control": {
24026
+ "activity": "required",
24027
+ "batteryLevel": "required",
24028
+ "currentCode": "required",
24029
+ "currentCodeLabel": "required",
24030
+ "lastChangedAt": "required",
24031
+ "progress": "required",
24032
+ "severity": "required"
24033
+ },
24034
+ "lock-control": {
24035
+ "codeRequired": "optional",
24036
+ "lastChangedAt": "required",
24037
+ "state": "required"
24038
+ },
24039
+ "low-power-sleep": {
24040
+ "lastContactAt": "optional",
24041
+ "lastUpdated": "required",
24042
+ "sleeping": "required"
24043
+ },
24044
+ "media-player": {
24045
+ "assumedFields": "optional",
24046
+ "availableSources": "required",
24047
+ "currentMedia": "required",
24048
+ "declaredSources": "optional",
24049
+ "duration": "required",
24050
+ "isMuted": "required",
24051
+ "lastChangedAt": "required",
24052
+ "muteReadback": "optional",
24053
+ "position": "required",
24054
+ "positionUpdatedAt": "optional",
24055
+ "repeat": "required",
24056
+ "shuffle": "required",
24057
+ "source": "required",
24058
+ "state": "required",
24059
+ "stateSource": "optional",
24060
+ "volumeLevel": "required"
24061
+ },
24062
+ "meter": {
24063
+ "lastFetchedAt": "required",
24064
+ "value": "required"
24065
+ },
24066
+ "motion": {
24067
+ "autoClearAfterMs": "required",
24068
+ "detected": "required",
24069
+ "lastDetectedAt": "required"
24070
+ },
24071
+ "motion-trigger": {
24072
+ "enabled": "required",
24073
+ "lastChangedAt": "required",
24074
+ "lastFetchedAt": "required"
24075
+ },
24076
+ "motion-zones": {
24077
+ "enabled": "required",
24078
+ "lastFetchedAt": "required",
24079
+ "regions": "required",
24080
+ "sensitivity": "required"
24081
+ },
24082
+ "native-object-detection": {
24083
+ "enabled": "required",
24084
+ "lastByClass": "required",
24085
+ "lastFetchedAt": "required",
24086
+ "supportedClasses": "required"
24087
+ },
24088
+ "navigation": {
24089
+ "flash": "required",
24090
+ "following": "required",
24091
+ "lastChangedAt": "required",
24092
+ "lastFetchedAt": "required",
24093
+ "lightLevel": "required",
24094
+ "lightMode": "required",
24095
+ "mode": "required"
24096
+ },
24097
+ "network-link": {
24098
+ "lastUpdated": "required",
24099
+ "linkUp": "optional",
24100
+ "rssi": "optional",
24101
+ "signal": "required",
24102
+ "speedKbps": "optional",
24103
+ "ssid": "optional",
24104
+ "type": "required"
24105
+ },
24106
+ "notifier": {
24107
+ "lastError": "required",
24108
+ "lastSentAt": "required",
24109
+ "queueDepth": "required",
24110
+ "supports": "required"
24111
+ },
24112
+ "numeric-sensor": {
24113
+ "lastFetchedAt": "required",
24114
+ "value": "required"
24115
+ },
24116
+ "pet-feeder": {
24117
+ "batteryPower": "required",
24118
+ "bowlFood": "required",
24119
+ "childLock": "required",
24120
+ "desiccantLeftDays": "required",
24121
+ "eating": "required",
24122
+ "error": "required",
24123
+ "errorCode": "required",
24124
+ "feeding": "required",
24125
+ "feedSound": "required",
24126
+ "food1": "required",
24127
+ "food2": "required",
24128
+ "foodLevel": "required",
24129
+ "indicatorLight": "required",
24130
+ "isDualHopper": "required",
24131
+ "lastFeedGrams": "required",
24132
+ "lastFeedHopper1": "required",
24133
+ "lastFeedHopper2": "required",
24134
+ "lastFetchedAt": "required",
24135
+ "lowFood": "required",
24136
+ "powerSource": "required",
24137
+ "status": "required",
24138
+ "supportsMarkRefilled": "required",
24139
+ "volume": "required"
24140
+ },
24141
+ "pet-fountain": {
24142
+ "empty": "required",
24143
+ "error": "required",
24144
+ "lastFetchedAt": "required",
24145
+ "pumpRunning": "required",
24146
+ "waterLevel": "required",
24147
+ "waterVolume": "required"
24148
+ },
24149
+ "power-meter": {
24150
+ "apparentPower": "optional",
24151
+ "current": "optional",
24152
+ "deliveredPower": "optional",
24153
+ "energy": "optional",
24154
+ "lastFetchedAt": "required",
24155
+ "power": "optional",
24156
+ "powerFactor": "optional",
24157
+ "voltage": "optional"
24158
+ },
24159
+ "power-source": {
24160
+ "lastFetchedAt": "required",
24161
+ "offSeconds": "required",
24162
+ "switchOn": "required"
24163
+ },
24164
+ "presence": {
24165
+ "gps": "required",
24166
+ "lastChangedAt": "required",
24167
+ "location": "required",
24168
+ "state": "required"
24169
+ },
24170
+ "pressure-sensor": {
24171
+ "lastFetchedAt": "required",
24172
+ "pressure": "required"
24173
+ },
24174
+ "privacy-mask": {
24175
+ "audioEnabled": "required",
24176
+ "enabled": "required",
24177
+ "lastFetchedAt": "required",
24178
+ "regions": "required"
24179
+ },
24180
+ "ptz-autotrack": {
24181
+ "currentSettings": "required",
24182
+ "enabled": "required",
24183
+ "lastChangedAt": "required",
24184
+ "lastFetchedAt": "required",
24185
+ "supportedTargetTypes": "required"
24186
+ },
24187
+ "pump-cycle": {
24188
+ "enabled": "required",
24189
+ "lastFetchedAt": "required",
24190
+ "offTime": "required",
24191
+ "onTime": "required"
24192
+ },
24193
+ "recording-onboard": {
24194
+ "enabled": "required",
24195
+ "lastFetchedAt": "required",
24196
+ "overwriteWhenFull": "required",
24197
+ "postRecordSec": "required",
24198
+ "preRecordSec": "required",
24199
+ "primaryTrackId": "required",
24200
+ "recordingToNowhere": "required",
24201
+ "segmentMinutes": "required",
24202
+ "storage": "required",
24203
+ "tracks": "required",
24204
+ "unreadableWindows": "required",
24205
+ "windows": "required"
24206
+ },
24207
+ "recording-signal": {
24208
+ "active": "required",
24209
+ "lastChangedAt": "required",
24210
+ "lastFetchedAt": "required",
24211
+ "reason": "required"
24212
+ },
24213
+ "running-state": {
24214
+ "lastFetchedAt": "required",
24215
+ "phase": "required",
24216
+ "running": "required",
24217
+ "since": "required",
24218
+ "source": "required"
24219
+ },
24220
+ "scene-monitor": {
24221
+ "lastFetchedAt": "required",
24222
+ "monitors": "required"
24223
+ },
24224
+ "script-runner": {
24225
+ "isRunning": "required",
24226
+ "lastChangedAt": "required",
24227
+ "lastError": "required",
24228
+ "lastRunAt": "required",
24229
+ "lastRunSuccess": "required"
24230
+ },
24231
+ "siren": {
24232
+ "active": "required",
24233
+ "activeUntil": "required",
24234
+ "activeUntilEstimated": "optional",
24235
+ "durationSeconds": "required",
24236
+ "lastFetchedAt": "required",
24237
+ "lastTriggeredAt": "required",
24238
+ "plays": "optional"
24239
+ },
24240
+ "smoke": {
24241
+ "detected": "required",
24242
+ "lastChangedAt": "required"
24243
+ },
24244
+ "stream-catalog": {
24245
+ "descriptors": "required",
24246
+ "lastFetchedAt": "required"
24247
+ },
24248
+ "stream-params": {
24249
+ "ext": "optional",
24250
+ "lastFetchedAt": "required",
24251
+ "main": "optional",
24252
+ "sub": "optional"
24253
+ },
24254
+ "stream-signals": {
24255
+ "lastFetchedAt": "required",
24256
+ "signals": "required"
24257
+ },
24258
+ "switch": {
24259
+ "lastChangedAt": "required",
24260
+ "on": "required"
24261
+ },
24262
+ "tamper": {
24263
+ "lastChangedAt": "required",
24264
+ "tampered": "required"
24265
+ },
24266
+ "temperature-sensor": {
24267
+ "lastFetchedAt": "required",
24268
+ "temperature": "required"
24269
+ },
24270
+ "timed-run": {
24271
+ "activeUntil": "required",
24272
+ "lastFetchedAt": "required",
24273
+ "quickRun": "required",
24274
+ "requestedBy": "required"
24275
+ },
24276
+ "update": {
24277
+ "availableVersion": "required",
24278
+ "currentVersion": "required",
24279
+ "inProgress": "required",
24280
+ "state": "required",
24281
+ "updatable": "required"
24282
+ },
24283
+ "vacuum-control": {
24284
+ "availableFanSpeeds": "required",
24285
+ "batteryLevel": "required",
24286
+ "errorCode": "required",
24287
+ "errorLabel": "required",
24288
+ "fanSpeed": "required",
24289
+ "lastChangedAt": "required",
24290
+ "progress": "required",
24291
+ "state": "required"
24292
+ },
24293
+ "valve": {
24294
+ "lastChangedAt": "required",
24295
+ "position": "required",
24296
+ "state": "required"
24297
+ },
24298
+ "vibration": {
24299
+ "detected": "required",
24300
+ "lastChangedAt": "required"
24301
+ },
24302
+ "water-heater": {
24303
+ "availableModes": "required",
24304
+ "away": "required",
24305
+ "currentTemp": "required",
24306
+ "lastActiveMode": "optional",
24307
+ "lastChangedAt": "required",
24308
+ "maxTemp": "required",
24309
+ "minTemp": "required",
24310
+ "operationMode": "required",
24311
+ "targetTemp": "required"
24312
+ },
24313
+ "weather": {
24314
+ "condition": "required",
24315
+ "humidity": "required",
24316
+ "lastFetchedAt": "required",
24317
+ "pressure": "required",
24318
+ "temperature": "required",
24319
+ "windBearing": "required",
24320
+ "windSpeed": "required"
24321
+ },
24322
+ "weather-station": {
24323
+ "dewPoint": "optional",
24324
+ "feelsLike": "optional",
24325
+ "humidity": "optional",
24326
+ "lastFetchedAt": "required",
24327
+ "pressure": "optional",
24328
+ "rain24h": "optional",
24329
+ "rainDaily": "optional",
24330
+ "rainEvent": "optional",
24331
+ "rainMonthly": "optional",
24332
+ "rainRate": "optional",
24333
+ "rainWeekly": "optional",
24334
+ "rainYearly": "optional",
24335
+ "solarRadiation": "optional",
24336
+ "temperature": "optional",
24337
+ "uv": "optional",
24338
+ "vpd": "optional",
24339
+ "windBearing": "optional",
24340
+ "windBearingAvg": "optional",
24341
+ "windGust": "optional",
24342
+ "windGustMax": "optional",
24343
+ "windSpeed": "optional"
24344
+ },
24345
+ "workload": {
24346
+ "addresses": "required",
24347
+ "autostart": "required",
24348
+ "hostDeviceId": "required",
24349
+ "image": "required",
24350
+ "lastFetchedAt": "required",
24351
+ "os": "required",
24352
+ "ports": "required",
24353
+ "resources": "required",
24354
+ "since": "required",
24355
+ "state": "required",
24356
+ "updateAvailable": "required",
24357
+ "version": "required"
24358
+ },
24359
+ "zone-analytics": {
24360
+ "frame": "required",
24361
+ "frameHeight": "required",
24362
+ "frameWidth": "required",
24363
+ "stationaryObjects": "optional",
24364
+ "ts": "required",
24365
+ "unzoned": "required",
24366
+ "zones": "required"
24367
+ },
24368
+ "zone-rules": {
24369
+ "detection": "required",
24370
+ "motion": "required",
24371
+ "package": "required"
24372
+ },
24373
+ "zones": { "zones": "required" }
24374
+ });
23248
24375
  Object.freeze({
23249
24376
  "actions": { "run": 363e4 },
23250
24377
  "audio-analyzer": { "classify": 3e4 },
@@ -23297,8 +24424,149 @@ Object.freeze({
23297
24424
  "uploadDataset": 72e5
23298
24425
  }
23299
24426
  });
24427
+ /**
24428
+ * Delays before retry rounds 1..N — the round count IS the bound.
24429
+ * 10 s catches "the hub was busy for a moment"; the full schedule
24430
+ * (10 + 30 + 90 s of waiting, plus up to one 60 s transport timeout
24431
+ * per attempt) covers a device-manager lock held for minutes — the
24432
+ * 2026-09-04 outage's migration hold was ~3.5 min.
24433
+ */
24434
+ var DEVICE_RESTORE_RETRY_DELAYS_MS = [
24435
+ 1e4,
24436
+ 3e4,
24437
+ 9e4
24438
+ ];
24439
+ /** Abortable sleep — resolves early (never rejects) on abort. */
24440
+ function sleep$1(ms, signal) {
24441
+ return new Promise((resolve) => {
24442
+ if (signal.aborted) {
24443
+ resolve();
24444
+ return;
24445
+ }
24446
+ const onAbort = () => {
24447
+ clearTimeout(timer);
24448
+ resolve();
24449
+ };
24450
+ const timer = setTimeout(() => {
24451
+ signal.removeEventListener("abort", onAbort);
24452
+ resolve();
24453
+ }, ms);
24454
+ timer.unref?.();
24455
+ signal.addEventListener("abort", onAbort, { once: true });
24456
+ });
24457
+ }
24458
+ /** Drain `items` through at most `width` concurrent lanes. `fn` must
24459
+ * not reject (callers wrap their own try/catch). */
24460
+ async function runWithConcurrency(items, width, fn) {
24461
+ const queue = [...items];
24462
+ const laneCount = Math.max(1, Math.min(width, queue.length));
24463
+ const lane = async () => {
24464
+ for (;;) {
24465
+ const item = queue.shift();
24466
+ if (item === void 0) return;
24467
+ await fn(item);
24468
+ }
24469
+ };
24470
+ await Promise.all(Array.from({ length: laneCount }, lane));
24471
+ }
24472
+ var DeviceRestoreRetryScheduler = class {
24473
+ #logger;
24474
+ #attempt;
24475
+ #onPermanentFailure;
24476
+ #delaysMs;
24477
+ #concurrency;
24478
+ #now;
24479
+ #abort = new AbortController();
24480
+ constructor(options) {
24481
+ this.#logger = options.logger;
24482
+ this.#attempt = options.attempt;
24483
+ this.#onPermanentFailure = options.onPermanentFailure;
24484
+ this.#delaysMs = options.delaysMs ?? DEVICE_RESTORE_RETRY_DELAYS_MS;
24485
+ this.#concurrency = options.concurrency ?? 4;
24486
+ this.#now = options.now ?? Date.now;
24487
+ }
24488
+ /** Stop retrying (shutdown). Pending entries are NOT marked
24489
+ * permanently failed — the next boot restores them from disk. */
24490
+ cancel() {
24491
+ this.#abort.abort();
24492
+ }
24493
+ /**
24494
+ * Run the bounded retry rounds. Resolves when every entry has either
24495
+ * restored, been marked permanently failed, or the scheduler was
24496
+ * cancelled. Never rejects.
24497
+ */
24498
+ async run(initialFailures) {
24499
+ let pending = initialFailures.map((failure) => ({
24500
+ saved: failure.saved,
24501
+ lastError: failure.error,
24502
+ attempts: 1
24503
+ }));
24504
+ for (let round = 0; round < this.#delaysMs.length; round += 1) {
24505
+ if (pending.length === 0 || this.#abort.signal.aborted) break;
24506
+ await sleep$1(this.#delaysMs[round] ?? 0, this.#abort.signal);
24507
+ if (this.#abort.signal.aborted) break;
24508
+ pending = await this.#runRound(pending, round);
24509
+ }
24510
+ if (this.#abort.signal.aborted) return [];
24511
+ const terminal = pending.map((entry) => ({
24512
+ deviceId: entry.saved.id,
24513
+ stableId: entry.saved.stableId,
24514
+ type: String(entry.saved.type),
24515
+ attempts: entry.attempts,
24516
+ lastError: entry.lastError,
24517
+ failedAt: this.#now()
24518
+ }));
24519
+ for (const failure of terminal) this.#onPermanentFailure(failure);
24520
+ return terminal;
24521
+ }
24522
+ /** One retry round: parents first (phase 0), then hub-adopted
24523
+ * children (phase 1) — a child's attempt depends on its parent
24524
+ * having landed, exactly like the initial two-pass restore. */
24525
+ async #runRound(pending, round) {
24526
+ const next = [];
24527
+ const parents = pending.filter((entry) => entry.saved.parentDeviceId === null);
24528
+ const children = pending.filter((entry) => entry.saved.parentDeviceId !== null);
24529
+ for (const phase of [parents, children]) await runWithConcurrency(phase, this.#concurrency, async (entry) => {
24530
+ if (this.#abort.signal.aborted) {
24531
+ next.push(entry);
24532
+ return;
24533
+ }
24534
+ const attemptNo = entry.attempts + 1;
24535
+ try {
24536
+ await this.#attempt(entry.saved);
24537
+ this.#logger.info("Device restored on retry", {
24538
+ tags: {
24539
+ deviceId: entry.saved.id,
24540
+ stableId: entry.saved.stableId
24541
+ },
24542
+ meta: { attempt: attemptNo }
24543
+ });
24544
+ } catch (err) {
24545
+ const lastError = err instanceof Error ? err.message : String(err);
24546
+ const remainingRetries = this.#delaysMs.length - (round + 1);
24547
+ this.#logger.warn("Device restore retry failed", {
24548
+ tags: {
24549
+ deviceId: entry.saved.id,
24550
+ stableId: entry.saved.stableId
24551
+ },
24552
+ meta: {
24553
+ attempt: attemptNo,
24554
+ remainingRetries,
24555
+ error: lastError
24556
+ }
24557
+ });
24558
+ next.push({
24559
+ saved: entry.saved,
24560
+ lastError,
24561
+ attempts: attemptNo
24562
+ });
24563
+ }
24564
+ });
24565
+ return next;
24566
+ }
24567
+ };
23300
24568
  //#endregion
23301
- //#region ../types/dist/implemented-methods-BUBqZ2a0.mjs
24569
+ //#region ../types/dist/implemented-methods-GRoJIvYs.mjs
23302
24570
  /**
23303
24571
  * The ffmpeg build every CamStack node downloads, per platform and arch.
23304
24572
  *
@@ -24301,6 +25569,19 @@ var HelperSpecSchema = discriminatedUnion("kind", [
24301
25569
  publishedProfiles: array(_enum(GRID_PROFILES)).max(3),
24302
25570
  cells: array(GridCellSpecSchema).max(16)
24303
25571
  }),
25572
+ object({
25573
+ kind: literal("crop"),
25574
+ source: CompositionSourceRefSchema,
25575
+ rect: GridRectSchema,
25576
+ aspect: _enum([
25577
+ "16:9",
25578
+ "4:3",
25579
+ "1:1",
25580
+ "free"
25581
+ ]),
25582
+ fps: number$1().int().min(1).max(60),
25583
+ publishedProfiles: array(_enum(GRID_PROFILES)).max(3)
25584
+ }),
24304
25585
  object({
24305
25586
  kind: literal("terminal"),
24306
25587
  terminalId: string().uuid()
@@ -25305,6 +26586,27 @@ function deviceTemplateFilterNames() {
25305
26586
  return DEVICE_TEMPLATE_CATALOGUE.filter((item) => item.kind === "filter").map((item) => item.name);
25306
26587
  }
25307
26588
  //#endregion
26589
+ //#region ../types/dist/enums.mjs
26590
+ function e(group, en, it, flags = {}) {
26591
+ return {
26592
+ group,
26593
+ label: {
26594
+ en,
26595
+ it
26596
+ },
26597
+ noise: flags.noise === true,
26598
+ deprecated: flags.deprecated === true
26599
+ };
26600
+ }
26601
+ var N = { noise: true };
26602
+ EventCategory.SystemBoot, e("system", "System booted", "Sistema avviato"), EventCategory.SystemAddonsReady, e("system", "Addons ready", "Addon pronti"), EventCategory.SystemRestarting, e("system", "System restarting", "Sistema in riavvio"), EventCategory.SystemRestartCompleted, e("system", "Restart completed", "Riavvio completato"), EventCategory.SystemTlsCertChanged, e("system", "TLS certificate changed", "Certificato TLS cambiato"), EventCategory.UpdateAvailable, e("system", "Update available", "Aggiornamento disponibile"), EventCategory.SystemReadyState, e("system", "Readiness changed", "Stato di prontezza cambiato"), EventCategory.AddonStarted, e("addons", "Addon started", "Addon avviato"), EventCategory.AddonStopped, e("addons", "Addon stopped", "Addon fermato"), EventCategory.AddonRestarted, e("addons", "Addon restarted", "Addon riavviato"), EventCategory.AddonUpdated, e("addons", "Addon updated", "Addon aggiornato"), EventCategory.AddonInstalled, e("addons", "Addon installed", "Addon installato"), EventCategory.AddonUninstalled, e("addons", "Addon uninstalled", "Addon disinstallato"), EventCategory.AddonCrashed, e("addons", "Addon crashed", "Addon in errore fatale"), EventCategory.AddonRunnerFailed, e("addons", "Runner failed for good", "Runner fallito definitivamente"), EventCategory.AddonRunnerRefused, e("addons", "Runner refused", "Runner rifiutato"), EventCategory.ProcessStateChanged, e("addons", "Process state changed", "Stato del processo cambiato"), EventCategory.SystemRunnerCheck, e("system", "Runner check", "Verifica dei runner"), EventCategory.AlertEpisode, e("system", "Alert episode", "Episodio di allarme"), EventCategory.AddonError, e("addons", "Addon error", "Errore di un addon"), EventCategory.AddonPageReady, e("addons", "Addon page ready", "Pagina addon pronta"), EventCategory.AddonWidgetReady, e("addons", "Addon widget ready", "Widget addon pronto"), EventCategory.AddonLoadFailed, e("addons", "Addon failed to load", "Caricamento addon fallito"), EventCategory.KeychainChanged, e("system", "Keychain changed", "Portachiavi modificato"), EventCategory.AddonLoadRecovered, e("addons", "Addon load recovered", "Caricamento addon ripristinato"), EventCategory.AddonUnsupportedVersion, e("addons", "Addon version unsupported", "Versione addon non supportata"), EventCategory.AddonUnsupportedResolved, e("addons", "Unsupported addon resolved", "Addon non supportato risolto"), EventCategory.AddonRetryScheduled, e("addons", "Addon retry scheduled", "Nuovo tentativo addon pianificato"), EventCategory.SystemLivenessFailed, e("system", "Liveness check failed", "Controllo di attività fallito"), EventCategory.SystemLivenessRecovered, e("system", "Liveness recovered", "Controllo di attività ripristinato"), EventCategory.AddonRetryAttempting, e("addons", "Addon retry running", "Nuovo tentativo addon in corso"), EventCategory.DeviceRegistered, e("devices", "Device registered", "Dispositivo registrato"), EventCategory.DeviceUnregistered, e("devices", "Device removed", "Dispositivo rimosso"), EventCategory.DeviceEnabled, e("devices", "Device enabled", "Dispositivo abilitato"), EventCategory.DeviceDisabled, e("devices", "Device disabled", "Dispositivo disabilitato"), EventCategory.DeviceSettingsUpdated, e("devices", "Device settings updated", "Impostazioni dispositivo aggiornate"), EventCategory.DeviceBindingsChanged, e("devices", "Device bindings changed", "Collegamenti dispositivo cambiati"), EventCategory.DeviceMetaChanged, e("devices", "Device details changed", "Dettagli dispositivo cambiati"), EventCategory.DeviceSourceInfoChanged, e("devices", "Device source info changed", "Info sorgente dispositivo cambiate"), EventCategory.DeviceStreamsRegistered, e("streams", "Device streams registered", "Stream del dispositivo registrati"), EventCategory.DeviceProvisioned, e("devices", "Device provisioned", "Dispositivo configurato"), EventCategory.DeviceReady, e("devices", "Device ready", "Dispositivo pronto"), EventCategory.IdentityLinkCreated, e("integrations", "Identity linked", "Identità collegata"), EventCategory.IdentityLinkLost, e("integrations", "Identity link lost", "Collegamento identità perso"), EventCategory.IntegrationEnabled, e("integrations", "Integration enabled", "Integrazione abilitata"), EventCategory.IntegrationDisabled, e("integrations", "Integration disabled", "Integrazione disabilitata"), EventCategory.IntegrationDeleted, e("integrations", "Integration deleted", "Integrazione eliminata"), EventCategory.BrokerStatusChanged, e("integrations", "Broker status changed", "Stato del broker cambiato"), EventCategory.BrokerMessage, e("integrations", "Broker message", "Messaggio del broker", N), EventCategory.ProviderStarted, e("integrations", "Provider started", "Provider avviato"), EventCategory.ProviderStopped, e("integrations", "Provider stopped", "Provider fermato"), EventCategory.ProcessCrashed, e("addons", "Process crashed", "Processo andato in crash"), EventCategory.ProcessRestartScheduled, e("addons", "Process restart scheduled", "Riavvio del processo pianificato"), EventCategory.ProcessRestarted, e("addons", "Process restarted", "Processo riavviato"), EventCategory.StorageLocationsChanged, e("storage", "Storage locations changed", "Posizioni di archiviazione cambiate"), EventCategory.RecordingStarted, e("recording", "Recording started", "Registrazione avviata"), EventCategory.RecordingStopped, e("recording", "Recording stopped", "Registrazione fermata"), EventCategory.RecordingError, e("recording", "Recording error", "Errore di registrazione"), EventCategory.RecordingHealthDegraded, e("recording", "Recording degraded", "Registrazione degradata"), EventCategory.RecordingHealthStalled, e("recording", "Recording stalled", "Registrazione bloccata"), EventCategory.RecordingHealthOk, e("recording", "Recording healthy", "Registrazione regolare"), EventCategory.RecordingStorageCritical, e("recording", "Recording storage critical", "Spazio di registrazione critico"), EventCategory.StorageLocationLow, e("storage", "Storage location low", "Spazio in esaurimento"), EventCategory.StorageLocationCritical, e("storage", "Storage location critical", "Spazio critico"), EventCategory.StorageLocationOk, e("storage", "Storage location recovered", "Spazio tornato regolare"), EventCategory.StorageDrainProgress, e("storage", "Drain progress", "Avanzamento dello svuotamento"), EventCategory.StorageDrainComplete, e("storage", "Drain complete", "Svuotamento completato"), EventCategory.RecordingSegmentWritten, e("recording", "Segment written", "Segmento scritto"), EventCategory.RecordingPolicyFallback, e("recording", "Recording policy fallback", "Politica di registrazione di ripiego"), EventCategory.RecordingRetentionCompleted, e("recording", "Retention completed", "Pulizia completata"), EventCategory.RecordingExportProgress, e("recording", "Export progress", "Avanzamento esportazione"), EventCategory.RecordingExportCompleted, e("recording", "Export completed", "Esportazione completata"), EventCategory.RecordingExportFailed, e("recording", "Export failed", "Esportazione fallita"), EventCategory.DetectionEvent, e("detection", "Detection", "Rilevamento"), EventCategory.SessionTrackNew, e("detection", "Session track started", "Nuova traccia di sessione"), EventCategory.SessionTrackExpired, e("detection", "Session track expired", "Traccia di sessione scaduta"), EventCategory.BenchmarkProgress, e("metrics", "Benchmark progress", "Avanzamento benchmark", N), EventCategory.PlatformProbePhase, e("metrics", "Platform probe phase", "Fase di analisi piattaforma", N), EventCategory.PipelineProgress, e("pipeline", "Pipeline progress", "Avanzamento pipeline", N), EventCategory.PipelineTrace, e("pipeline", "Pipeline trace", "Traccia pipeline", N), EventCategory.PipelineInferenceResult, e("pipeline", "Inference result", "Risultato di inferenza", N), EventCategory.PipelineCameraAssigned, e("pipeline", "Camera assigned to pipeline", "Camera assegnata alla pipeline"), EventCategory.PipelineCameraUnassigned, e("pipeline", "Camera unassigned from pipeline", "Camera rimossa dalla pipeline"), EventCategory.PipelineNodeInferenceUnavailable, e("pipeline", "Node inference unavailable", "Inferenza del nodo non disponibile"), EventCategory.PipelineDetectionBlind, e("pipeline", "Detection blind", "Rilevamento cieco"), EventCategory.PipelineMotionNoisy, e("pipeline", "Motion too noisy", "Movimento troppo disturbato"), EventCategory.PipelineMotionCalm, e("pipeline", "Motion calm again", "Movimento di nuovo calmo"), EventCategory.PipelinePackageLlmSilent, e("pipeline", "Package check silent", "Verifica pacchi senza risposta"), EventCategory.PipelinePackageLlmAnswered, e("pipeline", "Package check answered", "Verifica pacchi con risposta"), EventCategory.PipelineCameraUpdated, e("pipeline", "Pipeline camera updated", "Camera della pipeline aggiornata"), EventCategory.PipelineIngestOwnerChanged, e("pipeline", "Ingest owner changed", "Responsabile dell’acquisizione cambiato"), EventCategory.PipelineRunnerLoadSnapshot, e("metrics", "Runner load snapshot", "Carico dei runner", N), EventCategory.PipelineCameraMetricsSnapshot, e("metrics", "Camera metrics snapshot", "Metriche delle camere", N), EventCategory.StreamBrokerMetricsSnapshot, e("metrics", "Stream broker metrics", "Metriche dello stream broker", N), EventCategory.StreamBrokerOnCamStreamDemand, e("streams", "Stream requested", "Stream richiesto"), EventCategory.StreamBrokerOnCamStreamIdle, e("streams", "Stream idle", "Stream inattivo"), EventCategory.StreamBrokerOnRequestStreamSourceRefresh, e("streams", "Stream source refresh requested", "Aggiornamento sorgente stream richiesto"), EventCategory.StreamBrokerOnSourceRestart, e("streams", "Stream source restarted", "Sorgente stream riavviata"), EventCategory.StreamParamsChanged, e("streams", "Stream parameters changed", "Parametri dello stream cambiati"), EventCategory.DeviceStateChanged, e("devices", "Device state changed", "Stato dispositivo cambiato"), EventCategory.DeviceCommandSettled, e("devices", "Device command settled", "Comando al dispositivo concluso"), EventCategory.DeviceNativeShadowChanged, e("devices", "Device native state changed", "Stato nativo del dispositivo cambiato"), EventCategory.ZoneAnalyticsOccupancyChanged, e("detection", "Zone occupancy changed", "Occupazione zona cambiata"), EventCategory.BatteryOnStatusChanged, e("devices", "Battery status changed", "Stato batteria cambiato"), EventCategory.NetworkLinkOnStatusChanged, e("devices", "Network link status changed", "Stato del collegamento di rete cambiato"), EventCategory.BatteryOnWakeStarted, e("devices", "Battery device woke up", "Dispositivo a batteria attivato"), EventCategory.DoorbellOnPressed, e("devices", "Doorbell pressed", "Campanello premuto"), EventCategory.RunningStarted, e("devices", "Run started", "Esecuzione avviata"), EventCategory.RunningFinished, e("devices", "Run finished", "Esecuzione terminata"), EventCategory.WorkloadStarted, e("devices", "Workload started", "Carico di lavoro avviato"), EventCategory.WorkloadStopped, e("devices", "Workload stopped", "Carico di lavoro fermato"), EventCategory.WorkloadCrashed, e("devices", "Workload crashed", "Carico di lavoro in crash"), EventCategory.WorkloadRecovered, e("devices", "Workload recovered", "Carico di lavoro ripristinato"), EventCategory.DeviceRunOpened, e("devices", "Device run opened", "Ciclo del dispositivo aperto"), EventCategory.DeviceRunClosed, e("devices", "Device run closed", "Ciclo del dispositivo chiuso"), EventCategory.EventEmitted, e("devices", "Device event", "Evento del dispositivo"), EventCategory.PipelineEngineMetricsSnapshot, e("metrics", "Engine metrics snapshot", "Metriche dei motori", N), EventCategory.PipelineEngineProvisioning, e("pipeline", "Engine provisioning", "Preparazione del motore"), EventCategory.ClusterTopologySnapshot, e("metrics", "Cluster topology snapshot", "Topologia del cluster", N), EventCategory.MetricsNodeResourcesSnapshot, e("metrics", "Node resources snapshot", "Risorse dei nodi", N), EventCategory.MetricsNodeProcessesSnapshot, e("metrics", "Node processes snapshot", "Processi dei nodi", N), EventCategory.CapabilityBindingChanged, e("system", "Capability binding changed", "Collegamento di capability cambiato", N), EventCategory.ModelDownloadProgress, e("pipeline", "Model download progress", "Avanzamento download modello", N), EventCategory.AgentRegistered, e("agents", "Agent registered", "Agent registrato"), EventCategory.AgentUnregistered, e("agents", "Agent removed", "Agent rimosso"), EventCategory.AgentOnline, e("agents", "Agent online", "Agent online"), EventCategory.AgentOffline, e("agents", "Agent offline", "Agent offline"), EventCategory.WorkerOnline, e("agents", "Worker online", "Worker online"), EventCategory.WorkerOffline, e("agents", "Worker offline", "Worker offline"), EventCategory.AgentTaskDispatched, e("agents", "Agent task dispatched", "Attività inviata a un agent"), EventCategory.AgentTaskAssigned, e("agents", "Agent task assigned", "Attività assegnata a un agent"), EventCategory.AgentTrpcConnected, e("agents", "Agent API connected", "API dell’agent connessa"), EventCategory.AgentWsConnected, e("agents", "Agent socket connected", "Socket dell’agent connesso"), EventCategory.AgentWsDisconnected, e("agents", "Agent socket disconnected", "Socket dell’agent disconnesso"), EventCategory.AgentBackupActivated, e("agents", "Agent backup activated", "Backup dell’agent attivato"), EventCategory.OrchestrationSettingsUpdated, e("pipeline", "Orchestration settings updated", "Impostazioni di orchestrazione aggiornate"), EventCategory.MotionAnalysis, e("detection", "Motion analysis", "Analisi del movimento", N), EventCategory.MotionZonesRaw, e("detection", "Raw motion zones", "Zone di movimento grezze", N), EventCategory.MotionOnMotionChanged, e("detection", "Motion changed", "Movimento cambiato", N), EventCategory.DetectionResult, e("detection", "Detection result", "Risultato del rilevamento", N), EventCategory.DetectionRaw, e("detection", "Raw detection", "Rilevamento grezzo"), EventCategory.DetectionCameraNative, e("detection", "Camera native detection", "Rilevamento nativo della camera"), EventCategory.PipelineAudioInferenceResult, e("pipeline", "Audio inference result", "Risultato di inferenza audio", N), EventCategory.DetectionPhaseTransition, e("detection", "Detection phase changed", "Fase di rilevamento cambiata"), EventCategory.ProviderMotion, e("detection", "Camera raw motion", "Movimento grezzo della camera", N), EventCategory.ProviderDetection, e("detection", "Camera onboard detection", "Rilevamento a bordo camera"), EventCategory.EnrichmentEmbeddingStored, e("enrichment", "Embedding stored", "Embedding salvato"), EventCategory.EnrichmentSceneStateChanged, e("enrichment", "Scene state changed", "Stato della scena cambiato"), EventCategory.EnrichmentActivitySummary, e("enrichment", "Activity summary", "Riepilogo dell’attività"), EventCategory.PipelineAnalyticsTrackLifecycle, e("detection", "Track lifecycle", "Ciclo di vita della traccia"), EventCategory.PipelineAnalyticsTrackStarted, e("detection", "Track started", "Traccia iniziata", {
26603
+ noise: true,
26604
+ deprecated: true
26605
+ }), EventCategory.PipelineAnalyticsTrackEnded, e("detection", "Track ended", "Traccia terminata", {
26606
+ noise: true,
26607
+ deprecated: true
26608
+ }), EventCategory.PipelineAnalyticsDetectionEvent, e("detection", "Analytics detection", "Rilevamento analitico", N), EventCategory.PipelineAnalyticsFrameTracked, e("detection", "Frame tracked", "Fotogramma tracciato", N), EventCategory.PipelineAnalyticsStationaryChanged, e("detection", "Stationary object changed", "Oggetto fermo cambiato"), EventCategory.PipelineAnalyticsPackageDelivered, e("detection", "Package delivered", "Pacco consegnato"), EventCategory.PipelineAnalyticsPackagePickedUp, e("detection", "Package picked up", "Pacco ritirato"), EventCategory.PipelineAnalyticsFaceGalleryChanged, e("enrichment", "Face gallery changed", "Galleria volti cambiata"), EventCategory.PipelineAnalyticsPlateGalleryChanged, e("enrichment", "Plate gallery changed", "Galleria targhe cambiata"), EventCategory.CameraStreamsProfileSlotsChanged, e("streams", "Stream profile slots changed", "Slot dei profili stream cambiati"), EventCategory.StreamOnline, e("streams", "Stream online", "Stream online"), EventCategory.StreamOffline, e("streams", "Stream offline", "Stream offline"), EventCategory.NetworkTunnelStarted, e("network", "Tunnel started", "Tunnel avviato"), EventCategory.NetworkTunnelStopped, e("network", "Tunnel stopped", "Tunnel fermato"), EventCategory.LocalNetworkChanged, e("network", "Local network changed", "Rete locale cambiata"), EventCategory.MeshNetworkChanged, e("network", "Mesh network changed", "Rete mesh cambiata"), EventCategory.BackupCompleted, e("backup", "Backup completed", "Backup completato"), EventCategory.BackupRunCompleted, e("backup", "Backup run completed", "Esecuzione backup completata"), EventCategory.BackupRestored, e("backup", "Backup restored", "Backup ripristinato"), EventCategory.NotificationDispatched, e("notifications", "Notification sent", "Notifica inviata"), EventCategory.NotificationFailed, e("notifications", "Notification failed", "Notifica non riuscita"), EventCategory.NotificationRuleBroken, e("notifications", "Notification rule broken", "Regola di notifica non valida"), EventCategory.NotificationRuleRepaired, e("notifications", "Notification rule repaired", "Regola di notifica riparata"), EventCategory.MigrationFailed, e("system", "Migration failed", "Migrazione fallita"), EventCategory.MigrationApplied, e("system", "Migration applied", "Migrazione applicata"), EventCategory.DeviceUpdated, e("devices", "Device updated", "Dispositivo aggiornato"), EventCategory.DeviceOnline, e("devices", "Device online", "Dispositivo online"), EventCategory.DeviceOffline, e("devices", "Device offline", "Dispositivo offline"), EventCategory.DeviceAwake, e("devices", "Device awake", "Dispositivo attivo"), EventCategory.DeviceSleeping, e("devices", "Device sleeping", "Dispositivo in standby"), EventCategory.RetentionCleanup, e("storage", "Retention cleanup", "Pulizia della conservazione"), EventCategory.AddonsBulkUpdateProgress, e("addons", "Bulk update progress", "Avanzamento aggiornamento multiplo"), EventCategory.AddonsJobProgress, e("addons", "Addon job progress", "Avanzamento attività addon"), EventCategory.AddonsJobLog, e("addons", "Addon job log", "Log attività addon"), EventCategory.AccessoriesChildVisibilityChanged, e("devices", "Child visibility changed", "Visibilità del dispositivo figlio cambiata"), EventCategory.AccessoriesChanged, e("devices", "Accessories changed", "Accessori cambiati"), EventCategory.ActionsRunChanged, e("system", "Action run changed", "Esecuzione dell’azione cambiata"), EventCategory.ModelConvertProgress, e("pipeline", "Model conversion progress", "Avanzamento conversione modello");
26609
+ //#endregion
25308
26610
  //#region ../types/dist/index.mjs
25309
26611
  var SMTP_INBOUND_DEFAULT_PORT = 2525;
25310
26612
  var SMTP_INBOUND_DEFAULT_DOMAIN = "camstack.local";
@@ -25677,7 +26979,7 @@ var NotificationSchema = object({
25677
26979
  tag: string().optional(),
25678
26980
  deviceId: number$1().optional(),
25679
26981
  eventId: string().optional(),
25680
- metadata: record$1(string(), unknown()).optional(),
26982
+ metadata: record$1(string(), unknown$1()).optional(),
25681
26983
  /**
25682
26984
  * Values for the parameters the target's kind DECLARES in
25683
26985
  * {@link TargetKindSchema} `deliveryParams`. Already validated against the
@@ -25763,7 +27065,7 @@ var TargetKindCapsSchema = object({
25763
27065
  * the union is large and not meant for runtime validation here; the exported
25764
27066
  * `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
25765
27067
  */
25766
- var ConfigSchemaPassthrough$3 = unknown();
27068
+ var ConfigSchemaPassthrough$3 = unknown$1();
25767
27069
  var TargetKindSchema = object({
25768
27070
  kind: string(),
25769
27071
  label: string(),
@@ -25834,13 +27136,13 @@ var TargetSchema = object({
25834
27136
  kind: string(),
25835
27137
  addonId: string(),
25836
27138
  enabled: boolean(),
25837
- config: record$1(string(), unknown())
27139
+ config: record$1(string(), unknown$1())
25838
27140
  });
25839
27141
  /** A discovery-surfaced candidate (config is partial + non-secret). */
25840
27142
  var DiscoveredTargetSchema = object({
25841
27143
  kind: string(),
25842
27144
  suggestedName: string(),
25843
- config: record$1(string(), unknown())
27145
+ config: record$1(string(), unknown$1())
25844
27146
  });
25845
27147
  /** The degrade engine's report — what was resolved / dropped / degraded. */
25846
27148
  var RenderedAsSchema = object({
@@ -25871,7 +27173,7 @@ var ProbeTargetConfigResultSchema = object({
25871
27173
  });
25872
27174
  method(object({}), array(TargetKindSchema)), method(object({
25873
27175
  kind: string(),
25874
- config: record$1(string(), unknown()).optional(),
27176
+ config: record$1(string(), unknown$1()).optional(),
25875
27177
  /**
25876
27178
  * When editing / duplicating, the blank password field never round-trips
25877
27179
  * the stored token. Pass the source target id so the provider can restore
@@ -25880,7 +27182,7 @@ method(object({}), array(TargetKindSchema)), method(object({
25880
27182
  targetId: string().optional()
25881
27183
  }), array(DiscoveredTargetSchema), { auth: "admin" }), method(object({
25882
27184
  kind: string(),
25883
- config: record$1(string(), unknown()),
27185
+ config: record$1(string(), unknown$1()),
25884
27186
  /** See `discoverTargets.targetId` — restore stored secrets for a blank password. */
25885
27187
  targetId: string().optional()
25886
27188
  }), ProbeTargetConfigResultSchema, {
@@ -26371,14 +27673,14 @@ var CameraSwitchGroupSchema = object({
26371
27673
  * Query filter for settings-store collections.
26372
27674
  */
26373
27675
  var QueryFilterSchema = object({
26374
- where: record$1(string(), unknown()).optional(),
26375
- whereIn: record$1(string(), array(unknown())).optional(),
26376
- whereBetween: record$1(string(), tuple([unknown(), unknown()])).optional(),
27676
+ where: record$1(string(), unknown$1()).optional(),
27677
+ whereIn: record$1(string(), array(unknown$1())).optional(),
27678
+ whereBetween: record$1(string(), tuple([unknown$1(), unknown$1()])).optional(),
26377
27679
  /** NULL-safe exclusion: matches rows whose field is NULL OR != the value. */
26378
- whereNot: record$1(string(), unknown()).optional(),
27680
+ whereNot: record$1(string(), unknown$1()).optional(),
26379
27681
  /** NULL-safe exclusion of a SET — `whereNot` for more than one value. An
26380
27682
  * empty list excludes nothing. See `QueryFilter.whereNotIn`. */
26381
- whereNotIn: record$1(string(), array(unknown())).optional(),
27683
+ whereNotIn: record$1(string(), array(unknown$1())).optional(),
26382
27684
  orderBy: object({
26383
27685
  field: string(),
26384
27686
  direction: _enum(["asc", "desc"])
@@ -26396,11 +27698,11 @@ var QueryFilterSchema = object({
26396
27698
  * that compiles to no predicate, because that is the whole collection.
26397
27699
  */
26398
27700
  var MutationFilterSchema = object({
26399
- where: record$1(string(), unknown()).optional(),
26400
- whereIn: record$1(string(), array(unknown())).optional(),
26401
- whereBetween: record$1(string(), tuple([unknown(), unknown()])).optional(),
26402
- whereNot: record$1(string(), unknown()).optional(),
26403
- whereNotIn: record$1(string(), array(unknown())).optional()
27701
+ where: record$1(string(), unknown$1()).optional(),
27702
+ whereIn: record$1(string(), array(unknown$1())).optional(),
27703
+ whereBetween: record$1(string(), tuple([unknown$1(), unknown$1()])).optional(),
27704
+ whereNot: record$1(string(), unknown$1()).optional(),
27705
+ whereNotIn: record$1(string(), array(unknown$1())).optional()
26404
27706
  });
26405
27707
  /**
26406
27708
  * One scalar an {@link settingsStoreCapability.methods.aggregate} call asks for.
@@ -26434,7 +27736,7 @@ var AggregateResultSchema = object({
26434
27736
  /** A single stored record: `{ id, data }`. */
26435
27737
  var SettingsRecordSchema = object({
26436
27738
  id: string(),
26437
- data: record$1(string(), unknown())
27739
+ data: record$1(string(), unknown$1())
26438
27740
  });
26439
27741
  /**
26440
27742
  * One record of a BULK insert — {@link SettingsRecordSchema} with the id made
@@ -26447,7 +27749,7 @@ var SettingsRecordSchema = object({
26447
27749
  */
26448
27750
  var BulkRecordSchema = object({
26449
27751
  id: string().optional(),
26450
- data: record$1(string(), unknown())
27752
+ data: record$1(string(), unknown$1())
26451
27753
  });
26452
27754
  /**
26453
27755
  * The database FILES one `sqlite-settings` engine process owns (D851).
@@ -26482,7 +27784,7 @@ var TransactOpSchema = discriminatedUnion("op", [
26482
27784
  op: literal("update"),
26483
27785
  collection: string(),
26484
27786
  id: string(),
26485
- data: record$1(string(), unknown())
27787
+ data: record$1(string(), unknown$1())
26486
27788
  }),
26487
27789
  object({
26488
27790
  op: literal("upsertMany"),
@@ -26499,7 +27801,7 @@ var TransactGuardSchema = object({
26499
27801
  collection: string(),
26500
27802
  key: string(),
26501
27803
  column: string(),
26502
- equals: unknown()
27804
+ equals: unknown$1()
26503
27805
  });
26504
27806
  /**
26505
27807
  * Column declaration for a structured (SQL-backed) collection.
@@ -26567,11 +27869,11 @@ method(object({
26567
27869
  namespace: string().optional(),
26568
27870
  collection: string(),
26569
27871
  key: string()
26570
- }), unknown(), { auth: "admin" }), method(object({
27872
+ }), unknown$1(), { auth: "admin" }), method(object({
26571
27873
  namespace: string().optional(),
26572
27874
  collection: string(),
26573
27875
  key: string(),
26574
- value: unknown()
27876
+ value: unknown$1()
26575
27877
  }), _void(), {
26576
27878
  kind: "mutation",
26577
27879
  auth: "admin"
@@ -26606,7 +27908,7 @@ id: union([string(), number$1()]) }), {
26606
27908
  collection: string(),
26607
27909
  record: object({
26608
27910
  id: string().optional(),
26609
- data: record$1(string(), unknown())
27911
+ data: record$1(string(), unknown$1())
26610
27912
  })
26611
27913
  }), object({
26612
27914
  /**
@@ -26630,7 +27932,7 @@ id: union([string(), number$1()]) }), {
26630
27932
  ops: array(TransactOpSchema).readonly()
26631
27933
  }), object({
26632
27934
  applied: boolean(),
26633
- current: unknown().optional()
27935
+ current: unknown$1().optional()
26634
27936
  }), {
26635
27937
  kind: "mutation",
26636
27938
  auth: "admin"
@@ -26638,7 +27940,7 @@ id: union([string(), number$1()]) }), {
26638
27940
  namespace: string().optional(),
26639
27941
  collection: string(),
26640
27942
  id: string(),
26641
- data: record$1(string(), unknown())
27943
+ data: record$1(string(), unknown$1())
26642
27944
  }), _void(), {
26643
27945
  kind: "mutation",
26644
27946
  auth: "admin"
@@ -26660,7 +27962,7 @@ id: union([string(), number$1()]) }), {
26660
27962
  namespace: string().optional(),
26661
27963
  collection: string(),
26662
27964
  filter: MutationFilterSchema,
26663
- data: record$1(string(), unknown())
27965
+ data: record$1(string(), unknown$1())
26664
27966
  }), object({ updated: number$1().int() }), {
26665
27967
  kind: "mutation",
26666
27968
  auth: "admin"
@@ -26851,7 +28153,7 @@ var MigrationPlanSchema = object({ edits: array(discriminatedUnion("op", [
26851
28153
  object({
26852
28154
  op: literal("setKeys"),
26853
28155
  scope: string().min(1),
26854
- values: record$1(string(), unknown()),
28156
+ values: record$1(string(), unknown$1()),
26855
28157
  precondition: PreconditionSchema
26856
28158
  }),
26857
28159
  object({
@@ -26863,28 +28165,44 @@ var MigrationPlanSchema = object({ edits: array(discriminatedUnion("op", [
26863
28165
  object({
26864
28166
  op: literal("putRow"),
26865
28167
  table: string().min(1),
26866
- key: record$1(string(), unknown()),
26867
- row: record$1(string(), unknown()),
28168
+ key: record$1(string(), unknown$1()),
28169
+ row: record$1(string(), unknown$1()),
26868
28170
  precondition: PreconditionSchema
26869
28171
  }),
26870
28172
  object({
26871
28173
  op: literal("deleteRow"),
26872
28174
  table: string().min(1),
26873
- key: record$1(string(), unknown()),
28175
+ key: record$1(string(), unknown$1()),
26874
28176
  precondition: PreconditionSchema
26875
28177
  }),
26876
28178
  object({
26877
28179
  op: literal("upsertRecord"),
28180
+ owner: string().min(1),
26878
28181
  kind: string().min(1),
26879
28182
  recordKey: string().min(1),
26880
- value: unknown(),
28183
+ deviceId: number$1().int().positive().optional(),
28184
+ at: number$1().int().nonnegative().optional(),
28185
+ value: record$1(string(), unknown$1()),
26881
28186
  precondition: PreconditionSchema
26882
28187
  }),
26883
28188
  object({
26884
28189
  op: literal("deleteRecord"),
28190
+ owner: string().min(1),
26885
28191
  kind: string().min(1),
26886
28192
  recordKey: string().min(1),
26887
28193
  precondition: PreconditionSchema
28194
+ }),
28195
+ object({
28196
+ op: literal("rekeyDevice"),
28197
+ deviceId: number$1().int().positive(),
28198
+ addonId: string().min(1),
28199
+ stableId: string().min(1),
28200
+ precondition: PreconditionSchema
28201
+ }),
28202
+ object({
28203
+ op: literal("tombstoneDevice"),
28204
+ deviceId: number$1().int().positive(),
28205
+ precondition: PreconditionSchema
26888
28206
  })
26889
28207
  ])) });
26890
28208
  /**
@@ -26894,7 +28212,7 @@ var MigrationPlanSchema = object({ edits: array(discriminatedUnion("op", [
26894
28212
  */
26895
28213
  var MigrationProcedureResultSchema = object({
26896
28214
  outcome: _enum(["done", "already-done"]),
26897
- summary: record$1(string(), unknown())
28215
+ summary: record$1(string(), unknown$1())
26898
28216
  });
26899
28217
  /** What an owner hands the engine when one of its migrations ran. */
26900
28218
  var MigrationOwnerResultSchema = discriminatedUnion("kind", [
@@ -26935,8 +28253,8 @@ var MigrationLedgerEntrySchema = object({
26935
28253
  appliedAt: number$1().nullable(),
26936
28254
  codeVersion: string().nullable(),
26937
28255
  /** What the apply changed: rows per table, as the engine counted them. */
26938
- planSummary: record$1(string(), unknown()).nullable(),
26939
- progress: record$1(string(), unknown()).nullable(),
28256
+ planSummary: record$1(string(), unknown$1()).nullable(),
28257
+ progress: record$1(string(), unknown$1()).nullable(),
26940
28258
  error: string().nullable(),
26941
28259
  /** Why it is `blocked` or `held` (`dependency-failed`, `snapshot-refused`, …). */
26942
28260
  reason: string().nullable(),
@@ -27249,7 +28567,7 @@ var TrainingCatalogDraftSchema = object({
27249
28567
  id: string().min(1),
27250
28568
  name: string().min(1),
27251
28569
  description: string(),
27252
- labels: array(unknown()),
28570
+ labels: array(unknown$1()),
27253
28571
  inputSize: object({
27254
28572
  width: number$1().int().positive(),
27255
28573
  height: number$1().int().positive()
@@ -27945,6 +29263,16 @@ var RecordingBandTriggersSchema = RecordingTriggersSchema;
27945
29263
  * question to answer as a continuous one.
27946
29264
  */
27947
29265
  var RecordingBandAudioSchema = _enum(["on", "muted"]);
29266
+ /**
29267
+ * A battery condition on a band: the band covers a charge level only when
29268
+ * `min <= level < max` (half-open; a missing bound is unbounded). OPTIONAL —
29269
+ * an absent key means "any charge", which is what every config written before
29270
+ * it meant. A band WITH a condition is never met while the charge is unknown.
29271
+ */
29272
+ var RecordingBandBatterySchema = object({
29273
+ min: number$1().min(0).max(100).optional(),
29274
+ max: number$1().min(0).max(100).optional()
29275
+ });
27948
29276
  var RecordingBandSchema = object({
27949
29277
  days: array(RecordingWeekdaySchema),
27950
29278
  start: string().regex(HHMM),
@@ -27956,6 +29284,7 @@ var RecordingBandSchema = object({
27956
29284
  * missing must keep meaning what it meant. See {@link RecordingBandAudioSchema}.
27957
29285
  */
27958
29286
  audio: RecordingBandAudioSchema.optional(),
29287
+ battery: RecordingBandBatterySchema.optional(),
27959
29288
  triggers: RecordingBandTriggersSchema.optional(),
27960
29289
  /**
27961
29290
  * RETIRED (D381). A band no longer carries a pre-buffer of its own.
@@ -28735,7 +30064,7 @@ var StorageLocationSchema = object({
28735
30064
  type: string(),
28736
30065
  displayName: string().min(1),
28737
30066
  providerId: string().min(1),
28738
- config: record$1(string(), unknown()),
30067
+ config: record$1(string(), unknown$1()),
28739
30068
  /**
28740
30069
  * Cluster node this location physically lives on. REQUIRED for node-local
28741
30070
  * providers (filesystem — the path exists on one node's disk), null/absent
@@ -49704,7 +51033,7 @@ object({
49704
51033
  });
49705
51034
  var PreferenceNamespaceSchema = string().regex(/^[a-z][a-z0-9.-]{0,63}$/);
49706
51035
  /** A namespace's value: a JSON object, opaque to the hub. */
49707
- var PreferenceValueSchema = record$1(string(), unknown());
51036
+ var PreferenceValueSchema = record$1(string(), unknown$1());
49708
51037
  var PreferenceDeviceIdSchema = string().min(1).max(64);
49709
51038
  /** A stored row, as the owner reads it. */
49710
51039
  var PreferenceRowSchema = object({
@@ -49803,7 +51132,7 @@ var ApiCallableSchema = _enum([
49803
51132
  ]);
49804
51133
  object({ methods: array(ApiCatalogEntrySchema.extend({ callable: ApiCallableSchema })) });
49805
51134
  /** A JSON Schema document, as the explorer receives it. */
49806
- var JsonSchemaDocumentSchema = record$1(string(), unknown());
51135
+ var JsonSchemaDocumentSchema = record$1(string(), unknown$1());
49807
51136
  object({
49808
51137
  path: string(),
49809
51138
  hasInput: boolean(),
@@ -50237,7 +51566,7 @@ var SourceInfoSchema = object({
50237
51566
  /** Provider-specific extras that don't fit the structured slots.
50238
51567
  * Whitelist what goes here per provider — do NOT dump entire HA
50239
51568
  * attribute blobs (would explode the meta JSON column). */
50240
- raw: record$1(string(), unknown()).optional()
51569
+ raw: record$1(string(), unknown$1()).optional()
50241
51570
  });
50242
51571
  /**
50243
51572
  * Build the synthetic SourceInfo every existing provider falls back to
@@ -51092,14 +52421,14 @@ var TemplateEventValueSchema = object({
51092
52421
  /** An `action` input's value: a vocabulary action and its open args. */
51093
52422
  var TemplateActionValueSchema = object({
51094
52423
  actionId: string().min(1),
51095
- args: record$1(string(), unknown()).optional()
52424
+ args: record$1(string(), unknown$1()).optional()
51096
52425
  });
51097
52426
  /**
51098
52427
  * A `time-window` input's value: what a `time-is` leaf holds beside its kind.
51099
52428
  * "No limit" is the input left without a value, never an empty object.
51100
52429
  */
51101
52430
  var TemplateTimeWindowValueSchema = TimeIsWindowSchema;
51102
- var TemplateEntriesValueSchema = array(record$1(string(), unknown()));
52431
+ var TemplateEntriesValueSchema = array(record$1(string(), unknown$1()));
51103
52432
  /** The value of one non-group input. Which member is right is the input kind's to judge. */
51104
52433
  var TemplateScalarValueSchema = union([
51105
52434
  number$1(),
@@ -51353,8 +52682,15 @@ function convertLegacyWhen(half) {
51353
52682
  /** The longest one `wait` step lasts. It is cut by a restart of the run and does not survive a hub restart. */
51354
52683
  var WAIT_MAX_SECONDS = 3600;
51355
52684
  var WAIT_TOO_LONG = `a wait is at most one hour (${WAIT_MAX_SECONDS} s)`;
52685
+ /**
52686
+ * Every step kind may be switched off without deleting it: `enabled: false`
52687
+ * skips the step (and, for a block step, its whole subtree), traced `disabled`.
52688
+ * Absent means enabled.
52689
+ */
52690
+ var stepEnabledShape = { enabled: boolean().optional() };
51356
52691
  var AutomationWaitStepSchema = object({
51357
52692
  kind: literal("wait"),
52693
+ ...stepEnabledShape,
51358
52694
  seconds: number$1().min(0).max(WAIT_MAX_SECONDS, WAIT_TOO_LONG)
51359
52695
  });
51360
52696
  /**
@@ -51363,6 +52699,7 @@ var AutomationWaitStepSchema = object({
51363
52699
  */
51364
52700
  var AutomationCommandStepBaseSchema = object({
51365
52701
  kind: literal("command"),
52702
+ ...stepEnabledShape,
51366
52703
  /** WHO the step acts on. */
51367
52704
  target: ActionTargetSchema,
51368
52705
  /** The vocabulary action this step performs (`cover.open`). */
@@ -51373,7 +52710,7 @@ var AutomationCommandStepBaseSchema = object({
51373
52710
  * may carry `{{vars.x}}` slots, or be exactly `{ $var: 'name' }`, which
51374
52711
  * SUBSTITUTE and do not evaluate (§3.2.3).
51375
52712
  */
51376
- args: record$1(string(), unknown()).optional(),
52713
+ args: record$1(string(), unknown$1()).optional(),
51377
52714
  /**
51378
52715
  * The unit the person picked per arg (display only). `args` always hold the
51379
52716
  * value in the unit the method's input DECLARES (`paramMeta`); on a write an
@@ -51438,6 +52775,7 @@ var AutomationGuardedCommandStepSchema = AutomationCommandStepBaseSchema.extend(
51438
52775
  /** End the run here, on purpose. `reason` may carry `{{vars.x}}` slots. */
51439
52776
  var AutomationStopStepSchema = object({
51440
52777
  kind: literal("stop"),
52778
+ ...stepEnabledShape,
51441
52779
  reason: string().min(1, "a stop needs a reason: it is what the run trace shows").max(200),
51442
52780
  /** `ok`: the run ends as a success. `failed`: it ends as a failure, with the reason. */
51443
52781
  outcome: _enum(["ok", "failed"]),
@@ -51457,6 +52795,7 @@ var RESERVED_RUN_VARS = [
51457
52795
  */
51458
52796
  var AutomationSetStepSchema = object({
51459
52797
  kind: literal("set"),
52798
+ ...stepEnabledShape,
51460
52799
  vars: record$1(string(), union([
51461
52800
  string().max(500),
51462
52801
  number$1(),
@@ -51465,8 +52804,25 @@ var AutomationSetStepSchema = object({
51465
52804
  /** Set only when this reads true; false or unknown leaves the bag as it is. */
51466
52805
  if: AutomationWhenSchema.optional()
51467
52806
  });
52807
+ var NOTIFY_BODY_MAX = 2e3;
52808
+ /**
52809
+ * Send a notification through one notification target (the same targets the
52810
+ * notification centre addresses). Title and body may carry `{{vars.x}}` slots.
52811
+ * Not a device command: a notification target is an instance of the
52812
+ * `notification-output` cap, not a device.
52813
+ */
52814
+ var AutomationNotifyStepSchema = object({
52815
+ kind: literal("notify"),
52816
+ ...stepEnabledShape,
52817
+ /** The notification target (an instance id of `notification-output`). */
52818
+ targetId: string().min(1, "pick the notification target"),
52819
+ title: string().max(200).optional(),
52820
+ body: string().min(1, "a notification needs a message").max(NOTIFY_BODY_MAX),
52821
+ ...continueOnErrorShape
52822
+ });
51468
52823
  var AutomationRunActionStepSchema = object({
51469
52824
  kind: literal("action"),
52825
+ ...stepEnabledShape,
51470
52826
  /** An entry of the `actions` surface (`internal:<uuid>` or `<addonId>:<localId>`). */
51471
52827
  actionId: string().min(1),
51472
52828
  /** Values for the action's declared variables; the others take their default. */
@@ -51492,6 +52848,7 @@ var WAIT_UNTIL_TIMEOUT_MAX_S = 21600;
51492
52848
  */
51493
52849
  var AutomationWaitUntilStepSchema = object({
51494
52850
  kind: literal("wait-until"),
52851
+ ...stepEnabledShape,
51495
52852
  when: AutomationWhenSchema,
51496
52853
  timeoutS: number$1().int().min(1, "a wait needs a timeout of at least one second").max(WAIT_UNTIL_TIMEOUT_MAX_S, `a wait for a condition is at most six hours (${WAIT_UNTIL_TIMEOUT_MAX_S} s)`),
51497
52854
  onTimeout: _enum(["continue", "stop"])
@@ -51517,7 +52874,8 @@ var plainStepSchemas = [
51517
52874
  AutomationCommandStepBaseSchema.extend(continueOnErrorShape).strict().superRefine(refineKnownAction),
51518
52875
  AutomationStopStepSchema.omit({ if: true }).strict(),
51519
52876
  AutomationSetStepSchema.omit({ if: true }).strict(),
51520
- AutomationRunActionStepSchema.strict()
52877
+ AutomationRunActionStepSchema.strict(),
52878
+ AutomationNotifyStepSchema.strict()
51521
52879
  ];
51522
52880
  /**
51523
52881
  * A plain step: a flow step with no condition of its own and no step inside
@@ -51525,7 +52883,7 @@ var plainStepSchemas = [
51525
52883
  */
51526
52884
  var AutomationBranchStepSchema = discriminatedUnion("kind", plainStepSchemas, { error: nestTooDeep });
51527
52885
  /** A step that can run beside others: it writes no variable and does not end the run. */
51528
- var AutomationParallelMemberSchema = AutomationBranchStepSchema.refine((step) => step.kind === "command" || step.kind === "action" || step.kind === "wait", "a parallel holds device commands, actions and waits only: a set or a stop beside other steps has no order");
52886
+ var AutomationParallelMemberSchema = AutomationBranchStepSchema.refine((step) => step.kind === "command" || step.kind === "action" || step.kind === "notify" || step.kind === "wait", "a parallel holds device commands, actions and waits only: a set or a stop beside other steps has no order");
51529
52887
  /**
51530
52888
  * Several steps at once (#500): all are started together and all are awaited.
51531
52889
  * A failure fails the run once the others finished, as in a sequence; a member
@@ -51533,6 +52891,7 @@ var AutomationParallelMemberSchema = AutomationBranchStepSchema.refine((step) =>
51533
52891
  */
51534
52892
  var AutomationParallelStepSchema = object({
51535
52893
  kind: literal("parallel"),
52894
+ ...stepEnabledShape,
51536
52895
  steps: array(AutomationParallelMemberSchema).min(2, "a parallel needs at least two steps").max(5, `a parallel takes at most 5 steps`)
51537
52896
  }).strict();
51538
52897
  var REPEAT_NEEDS_MAX = "a repeat on a condition needs a maximum number of iterations";
@@ -51573,6 +52932,7 @@ var AutomationRepeatLoopSchema = discriminatedUnion("by", [
51573
52932
  function repeatSchemaOf(step) {
51574
52933
  return object({
51575
52934
  kind: literal("repeat"),
52935
+ ...stepEnabledShape,
51576
52936
  loop: AutomationRepeatLoopSchema,
51577
52937
  steps: array(step).min(1, "a repeat needs at least one step").max(10, `a repeat takes at most 10 steps`)
51578
52938
  }).strict();
@@ -51588,6 +52948,7 @@ function chooseSchemaOf(step) {
51588
52948
  const steps = array(step).max(10);
51589
52949
  return object({
51590
52950
  kind: literal("choose"),
52951
+ ...stepEnabledShape,
51591
52952
  branches: array(object({
51592
52953
  if: AutomationWhenSchema,
51593
52954
  steps: steps.min(1, "a branch needs at least one step")
@@ -51613,8 +52974,10 @@ var AutomationActionSchema = discriminatedUnion("kind", [
51613
52974
  AutomationParallelStepSchema,
51614
52975
  AutomationRepeatStepSchema,
51615
52976
  AutomationRunActionStepSchema,
52977
+ AutomationNotifyStepSchema,
51616
52978
  object({
51617
52979
  kind: literal("code"),
52980
+ ...stepEnabledShape,
51618
52981
  /** Compiled into the automation's OWN block by esbuild — not a third
51619
52982
  * runtime, not a `vm`, and not dynamically evaluated. */
51620
52983
  code: string().min(1).max(2e4)
@@ -52071,7 +53434,12 @@ var AutomationRunTraceSchema = object({
52071
53434
  * automation outcome so a reader that does not know schedulers still reads
52072
53435
  * the trace; this field says exactly what happened.
52073
53436
  */
52074
- scheduler: SchedulerOutcomeSchema.optional()
53437
+ scheduler: SchedulerOutcomeSchema.optional(),
53438
+ /**
53439
+ * Why the run failed when no step carries it: the run crashed outside the
53440
+ * steps (conditions, gate). Absent when the failure is on a step.
53441
+ */
53442
+ error: string().optional()
52075
53443
  });
52076
53444
  /**
52077
53445
  * What the hub's `runs` ledger holds for one owner (`automation:<blockId>` or
@@ -52146,7 +53514,7 @@ var EventFireSchema = object({
52146
53514
  deviceId: number$1(),
52147
53515
  eventType: string(),
52148
53516
  sourceId: string().optional(),
52149
- data: record$1(string(), unknown()).nullable(),
53517
+ data: record$1(string(), unknown$1()).nullable(),
52150
53518
  timestamp: number$1().meta(readingMeta("none")),
52151
53519
  seq: number$1().meta(readingMeta("count"))
52152
53520
  });
@@ -52766,7 +54134,7 @@ var InvokeRequestSchema = object({
52766
54134
  path: string(),
52767
54135
  params: record$1(string(), string()),
52768
54136
  query: record$1(string(), string()),
52769
- body: unknown(),
54137
+ body: unknown$1(),
52770
54138
  headers: record$1(string(), string()),
52771
54139
  /** The instance the hub resolved for a `perInstance` route. */
52772
54140
  instanceId: string().optional(),
@@ -52775,7 +54143,7 @@ var InvokeRequestSchema = object({
52775
54143
  username: string(),
52776
54144
  isAdmin: boolean()
52777
54145
  }).optional(),
52778
- scopedToken: unknown().optional()
54146
+ scopedToken: unknown$1().optional()
52779
54147
  });
52780
54148
  var InvokeReplyEnvelopeSchema = object({
52781
54149
  status: number$1().int(),
@@ -52785,7 +54153,7 @@ var InvokeReplyEnvelopeSchema = object({
52785
54153
  * the handler called `reply.code(...)` explicitly. */
52786
54154
  redirectUrl: string().nullable(),
52787
54155
  /** JSON-serializable body. `undefined` is treated as "no body". */
52788
- body: unknown().optional(),
54156
+ body: unknown$1().optional(),
52789
54157
  /** Set when the handler called `reply.type(mime)`. */
52790
54158
  contentType: string().optional()
52791
54159
  });
@@ -52824,7 +54192,7 @@ var SettingsSchemaWithValuesSchema = object({
52824
54192
  sections: array(ConfigSectionWithValuesSchema)
52825
54193
  });
52826
54194
  /** Patch object — keys are field names, values are the new field values. */
52827
- var SettingsPatchSchema = record$1(string(), unknown());
54195
+ var SettingsPatchSchema = record$1(string(), unknown$1());
52828
54196
  /** The scope of a scoped-settings call (D986): where the capability declared the values. */
52829
54197
  var ScopedSettingsScopeSchema = _enum(SCOPED_SETTINGS_SCOPES);
52830
54198
  /** One scoped schema an addon serves: its capability, scope and section ids. */
@@ -52857,7 +54225,7 @@ method(object({
52857
54225
  cap: string(),
52858
54226
  scope: ScopedSettingsScopeSchema,
52859
54227
  nodeId: string().optional()
52860
- }), record$1(string(), unknown()).nullable()), method(object({
54228
+ }), record$1(string(), unknown$1()).nullable()), method(object({
52861
54229
  addonId: string(),
52862
54230
  nodeId: string().optional()
52863
54231
  }), object({ keys: array(string()) }).nullable(), { auth: "admin" }), method(object({
@@ -53158,7 +54526,7 @@ var ManifestShapeSchema = object({
53158
54526
  description: string().optional(),
53159
54527
  icon: string().optional(),
53160
54528
  color: string().optional(),
53161
- capabilities: array(unknown()).readonly().optional(),
54529
+ capabilities: array(unknown$1()).readonly().optional(),
53162
54530
  packageName: string(),
53163
54531
  packageVersion: string(),
53164
54532
  packageDisplayName: string().optional(),
@@ -53214,7 +54582,7 @@ var AddonHealthSchema = object({
53214
54582
  });
53215
54583
  var AddonListItemSchema = object({
53216
54584
  manifest: ManifestShapeSchema,
53217
- declaration: unknown().optional(),
54585
+ declaration: unknown$1().optional(),
53218
54586
  source: string(),
53219
54587
  installSource: string().optional(),
53220
54588
  process: AddonProcessSchema.optional(),
@@ -53299,9 +54667,9 @@ var AutoUpdateSettingsSchema = object({
53299
54667
  updateCheckIntervalSeconds: number$1()
53300
54668
  });
53301
54669
  var AddonAutoUpdateSchema = ChannelWithInheritSchema;
53302
- var RestartAddonResultSchema = unknown();
53303
- var InstallPackageResultSchema = unknown();
53304
- var ReloadPackagesResultSchema = unknown();
54670
+ var RestartAddonResultSchema = unknown$1();
54671
+ var InstallPackageResultSchema = unknown$1();
54672
+ var ReloadPackagesResultSchema = unknown$1();
53305
54673
  /**
53306
54674
  * What an uninstall did on ONE node.
53307
54675
  * - `uninstalled` — removed: runner(s) stopped, caps gone, code deleted.
@@ -53418,11 +54786,11 @@ var LogStreamEntrySchema = object({
53418
54786
  message: string(),
53419
54787
  scope: string().optional()
53420
54788
  });
53421
- var LogQueryEntrySchema = unknown();
54789
+ var LogQueryEntrySchema = unknown$1();
53422
54790
  var CustomActionInputSchema = object({
53423
54791
  addonId: string().min(1),
53424
54792
  action: string().min(1),
53425
- input: unknown()
54793
+ input: unknown$1()
53426
54794
  });
53427
54795
  method(object({ nodeId: string().optional() }).optional(), array(AddonListItemSchema).readonly()), method(object({
53428
54796
  addonId: string(),
@@ -53452,16 +54820,16 @@ method(object({ nodeId: string().optional() }).optional(), array(AddonListItemSc
53452
54820
  name: string().min(1),
53453
54821
  version: string().optional(),
53454
54822
  nodeId: string().optional()
53455
- }), unknown(), {
54823
+ }), unknown$1(), {
53456
54824
  kind: "mutation",
53457
54825
  auth: "admin"
53458
54826
  }), method(object({ name: string().min(1) }), object({ rolledBackTo: string().nullable() }), {
53459
54827
  kind: "mutation",
53460
54828
  auth: "admin"
53461
- }), method(object({ nodeId: string().optional() }), unknown(), {
54829
+ }), method(object({ nodeId: string().optional() }), unknown$1(), {
53462
54830
  kind: "mutation",
53463
54831
  auth: "admin"
53464
- }), method(object({ confirm: literal(true) }), unknown(), {
54832
+ }), method(object({ confirm: literal(true) }), unknown$1(), {
53465
54833
  kind: "mutation",
53466
54834
  auth: "admin"
53467
54835
  }), method(_void(), object({
@@ -53501,19 +54869,19 @@ method(object({ nodeId: string().optional() }).optional(), array(AddonListItemSc
53501
54869
  intervalSeconds: number$1().min(300).max(86400).optional(),
53502
54870
  /** Availability-poll cadence; see AutoUpdateSettingsSchema. */
53503
54871
  updateCheckIntervalSeconds: number$1().min(900).max(604800).optional()
53504
- }), unknown(), {
54872
+ }), unknown$1(), {
53505
54873
  kind: "mutation",
53506
54874
  auth: "admin"
53507
54875
  }), method(object({ addonId: string() }), AddonAutoUpdateSchema, { auth: "admin" }), method(object({
53508
54876
  addonId: string(),
53509
54877
  channel: ChannelWithInheritSchema
53510
- }), unknown(), {
54878
+ }), unknown$1(), {
53511
54879
  kind: "mutation",
53512
54880
  auth: "admin"
53513
54881
  }), method(object({ channel: ChannelSchema }), object({ success: literal(true) }), {
53514
54882
  kind: "mutation",
53515
54883
  auth: "admin"
53516
- }), method(CustomActionInputSchema, unknown(), {
54884
+ }), method(CustomActionInputSchema, unknown$1(), {
53517
54885
  role: "viewer",
53518
54886
  kind: "mutation"
53519
54887
  }), method(object({
@@ -54044,7 +55412,7 @@ var AlertSeveritySchema = _enum([
54044
55412
  var AlertActionInvokeSchema = object({
54045
55413
  addonId: string().min(1),
54046
55414
  action: string().min(1),
54047
- input: record$1(string(), unknown()).optional()
55415
+ input: record$1(string(), unknown$1()).optional()
54048
55416
  });
54049
55417
  /** An action has `href` (a link) OR `invoke` (a button that runs a custom action). */
54050
55418
  var AlertActionSchema = object({
@@ -54083,7 +55451,7 @@ var AlertSchema = object({
54083
55451
  createdAt: number$1(),
54084
55452
  updatedAt: number$1(),
54085
55453
  source: AlertSourceSchema.optional(),
54086
- metadata: record$1(string(), unknown()).optional()
55454
+ metadata: record$1(string(), unknown$1()).optional()
54087
55455
  });
54088
55456
  method(AlertSchema, _void(), { kind: "mutation" }), method(object({
54089
55457
  alertId: string(),
@@ -55219,6 +56587,31 @@ var BatteryStatusSchema = object({
55219
56587
  */
55220
56588
  voltage: number$1().nullable().optional().meta(readingMeta("voltage", { label: "Voltage" })),
55221
56589
  /**
56590
+ * What the CELL is doing, as opposed to {@link charging} (what it is powered
56591
+ * from). `'charging'` takes current, `'full'` is connected and topped up,
56592
+ * `'idle'` is a stopped cell the firmware reported as such (running on the
56593
+ * battery, or an adapter that is not feeding it).
56594
+ *
56595
+ * Absent or `'unknown'` is NOT an answer: the provider has not read the
56596
+ * charge fields. It must never be coerced to `'idle'` (D315) — a camera
56597
+ * nobody reached would be drawn "not charging". Consumers SKIP it.
56598
+ */
56599
+ chargeState: _enum([
56600
+ "charging",
56601
+ "full",
56602
+ "idle",
56603
+ "unknown"
56604
+ ]).optional().meta({ label: "Charge state" }),
56605
+ /**
56606
+ * Battery current in milliamperes, as the firmware reports it (sign is the
56607
+ * firmware's). `null`/absent = not reported. Stored in mA, not the quantity
56608
+ * base (A), so it carries no reading quantity: a quantity would make the UI
56609
+ * convert and print it as amperes.
56610
+ */
56611
+ currentMa: number$1().nullable().optional().meta(readingMeta("none", { label: "Current (mA)" })),
56612
+ /** Battery temperature in °C. `null`/absent = not reported. */
56613
+ temperatureC: number$1().nullable().optional().meta(readingMeta("temperature", { label: "Temperature" })),
56614
+ /**
55222
56615
  * Ms epoch of the last time the device PROVED it was reachable — a
55223
56616
  * completed firmware round-trip, an observed wake, or an inbound push
55224
56617
  * (firmware event, email). `0`/absent = never since this slice was born.
@@ -55378,6 +56771,10 @@ onStatusChanged: {
55378
56771
  voltage: {
55379
56772
  kind: "gauge",
55380
56773
  unit: "V"
56774
+ },
56775
+ temperatureC: {
56776
+ kind: "gauge",
56777
+ unit: "°C"
55381
56778
  }
55382
56779
  } },
55383
56780
  customize: batteryCustomize,
@@ -55430,6 +56827,30 @@ onStatusChanged: {
55430
56827
  }
55431
56828
  ],
55432
56829
  icon: "battery-charging"
56830
+ },
56831
+ {
56832
+ kind: "enum",
56833
+ field: "chargeState",
56834
+ label: t("Charge state", "Stato di carica"),
56835
+ values: [
56836
+ {
56837
+ value: "charging",
56838
+ label: t("Charging", "In carica")
56839
+ },
56840
+ {
56841
+ value: "full",
56842
+ label: t("Full", "Carica completa")
56843
+ },
56844
+ {
56845
+ value: "idle",
56846
+ label: t("Not charging", "Non in carica")
56847
+ },
56848
+ {
56849
+ value: "unknown",
56850
+ label: t("Unknown", "Sconosciuto")
56851
+ }
56852
+ ],
56853
+ icon: "battery-charging"
55433
56854
  }
55434
56855
  ],
55435
56856
  extraEvents: [{
@@ -55769,24 +57190,24 @@ var RegistryStatusSchema = object({
55769
57190
  connectedCount: number$1().int().nonnegative()
55770
57191
  });
55771
57192
  var GetInputSchema = object({ id: string() });
55772
- var SettingsRecordSchema$1 = record$1(string(), unknown());
57193
+ var SettingsRecordSchema$1 = record$1(string(), unknown$1());
55773
57194
  var PublishInputSchema = object({
55774
57195
  brokerId: string(),
55775
57196
  /** Kind-specific routing target.
55776
57197
  * MQTT: `{ topic: string, qos?: 0|1|2, retain?: boolean }`.
55777
57198
  * HA: `{ domain: string, service: string, entityId?: string, area?: string }`. */
55778
- target: record$1(string(), unknown()),
57199
+ target: record$1(string(), unknown$1()),
55779
57200
  /** Kind-specific payload.
55780
57201
  * MQTT: raw string / number / object (provider serialises).
55781
57202
  * HA: service-call `data` object (transition, brightness, …). */
55782
- payload: unknown().optional()
57203
+ payload: unknown$1().optional()
55783
57204
  });
55784
57205
  var SubscribeInputSchema = object({
55785
57206
  brokerId: string(),
55786
57207
  /** Kind-specific filter.
55787
57208
  * MQTT: `{ topic: string, qos?: 0|1|2 }` — topic can include wildcards.
55788
57209
  * HA: `{ entityIds: string[] }` or `{ domain: string }`. */
55789
- filter: record$1(string(), unknown())
57210
+ filter: record$1(string(), unknown$1())
55790
57211
  });
55791
57212
  var SubscribeResultSchema = object({
55792
57213
  /** Stable subscription id. Used to unsubscribe and to filter the
@@ -55803,7 +57224,7 @@ var GetStateInputSchema = object({
55803
57224
  * HA: entity_id (returns the cached entity state). */
55804
57225
  key: string()
55805
57226
  });
55806
- method(GetInputSchema, SettingsRecordSchema$1.nullable(), { auth: "admin" }), method(PublishInputSchema, unknown(), {
57227
+ method(GetInputSchema, SettingsRecordSchema$1.nullable(), { auth: "admin" }), method(PublishInputSchema, unknown$1(), {
55807
57228
  kind: "mutation",
55808
57229
  auth: "admin"
55809
57230
  }), method(SubscribeInputSchema, SubscribeResultSchema, {
@@ -55812,7 +57233,7 @@ method(GetInputSchema, SettingsRecordSchema$1.nullable(), { auth: "admin" }), me
55812
57233
  }), method(UnsubscribeInputSchema, _void(), {
55813
57234
  kind: "mutation",
55814
57235
  auth: "admin"
55815
- }), method(GetStateInputSchema, unknown().nullable(), { auth: "admin" }), method(_void(), RegistryStatusSchema);
57236
+ }), method(GetStateInputSchema, unknown$1().nullable(), { auth: "admin" }), method(_void(), RegistryStatusSchema);
55816
57237
  DeviceType.Button, method(object({ deviceId: number$1().int().nonnegative() }), _void(), {
55817
57238
  kind: "mutation",
55818
57239
  auth: "protected",
@@ -56575,7 +57996,9 @@ method(object({
56575
57996
  autoEligible: boolean().optional(),
56576
57997
  /** The slot the publisher says this stream IS — see `CameraStreamSchema.profileHint`. */
56577
57998
  profileHint: CamProfileSchema.optional(),
56578
- metadata: record$1(string(), unknown()).optional(),
57999
+ metadata: record$1(string(), unknown$1()).optional(),
58000
+ /** The longest session the source keeps open (ms) — see `CameraStreamSchema.maxSessionMs`. */
58001
+ maxSessionMs: number$1().int().positive().optional(),
56579
58002
  /** Required when kind === 'derived' — the source camStreamId the
56580
58003
  * derived broker reads its encoded plane from.
56581
58004
  * The runtime guard (broker manager, Task 10) enforces presence for
@@ -56794,6 +58217,11 @@ method(object({
56794
58217
  deviceId: number$1().int().nonnegative(),
56795
58218
  camStreamId: string(),
56796
58219
  brokerId: string()
58220
+ })), event(object({
58221
+ deviceId: number$1().int().nonnegative(),
58222
+ camStreamId: string(),
58223
+ brokerId: string(),
58224
+ reason: string()
56797
58225
  })), NOT_A_DEVICE.PIPELINE;
56798
58226
  var StreamCodecSchema = _enum([
56799
58227
  "h264",
@@ -59898,7 +61326,7 @@ var mediaPlayerCapability = {
59898
61326
  ]
59899
61327
  }
59900
61328
  };
59901
- DeviceType.Camera, DeviceType.Sensor, DeviceType.Button, DeviceType.Switch, DeviceType.PetFeeder, DeviceType.Container, DeviceType.Climate, DeviceType.EventEmitter, DeviceType.Climate, DeviceType.Climate, DeviceType.Camera, DeviceType.Light, DeviceType.Siren, DeviceType.Switch, DeviceType.Sensor, DeviceType.Climate, DeviceType.Button, DeviceType.EventEmitter, DeviceType.Update, DeviceType.Generic, DeviceType.Notifier, DeviceType.Script, DeviceType.Automation, DeviceType.Lock, DeviceType.Cover, DeviceType.Valve, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.Fan, DeviceType.MediaPlayer, DeviceType.AlarmPanel, DeviceType.Control, DeviceType.Presence, DeviceType.Weather, DeviceType.WeatherStation, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.Container, DeviceType.Image, DeviceType.PetFeeder, DeviceType.PetFountain, DeviceType.Dishwasher, DeviceType.Washer, DeviceType.Dryer, DeviceType.Gateway, DeviceType.HeatPump, DeviceType.EnergySystem, DeviceType.Workload, DeviceType.Camera, DeviceType.Fan, DeviceType.Fan, DeviceType.Fan, DeviceType.Fan, DeviceType.Fan, DeviceType.Fan, DeviceType.Fan, DeviceType.Fan, DeviceType.Fan, DeviceType.Fan, DeviceType.Lock, DeviceType.Camera, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Workload, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Workload, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Workload, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Workload, DeviceType.Gateway, DeviceType.Camera, DeviceType.Sensor, DeviceType.MediaPlayer, DeviceType.Vacuum, DeviceType.Generic, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.PetFountain, DeviceType.Fan, DeviceType.Humidifier, DeviceType.Climate, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.MediaPlayer, DeviceType.WaterHeater, DeviceType.Humidifier, DeviceType.Fan, DeviceType.Climate, DeviceType.PetFeeder, DeviceType.MediaPlayer, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation;
61329
+ DeviceType.Camera, DeviceType.Sensor, DeviceType.Button, DeviceType.Switch, DeviceType.PetFeeder, DeviceType.Container, DeviceType.Climate, DeviceType.EventEmitter, DeviceType.Climate, DeviceType.Climate, DeviceType.Camera, DeviceType.Light, DeviceType.Siren, DeviceType.Switch, DeviceType.Sensor, DeviceType.Climate, DeviceType.Button, DeviceType.EventEmitter, DeviceType.Update, DeviceType.Generic, DeviceType.Notifier, DeviceType.Script, DeviceType.Automation, DeviceType.Lock, DeviceType.Cover, DeviceType.Valve, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.Fan, DeviceType.MediaPlayer, DeviceType.AlarmPanel, DeviceType.Control, DeviceType.Presence, DeviceType.Weather, DeviceType.WeatherStation, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.Container, DeviceType.Image, DeviceType.PetFeeder, DeviceType.PetFountain, DeviceType.Dishwasher, DeviceType.Washer, DeviceType.Dryer, DeviceType.Gateway, DeviceType.HeatPump, DeviceType.EnergySystem, DeviceType.Workload, DeviceType.Camera, DeviceType.Fan, DeviceType.Fan, DeviceType.Fan, DeviceType.Fan, DeviceType.Fan, DeviceType.Fan, DeviceType.Fan, DeviceType.Fan, DeviceType.Fan, DeviceType.Fan, DeviceType.HeatPump, DeviceType.HeatPump, DeviceType.Lock, DeviceType.Camera, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Workload, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Workload, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Workload, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Workload, DeviceType.Gateway, DeviceType.Camera, DeviceType.Sensor, DeviceType.MediaPlayer, DeviceType.Vacuum, DeviceType.Generic, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.PetFountain, DeviceType.Fan, DeviceType.Humidifier, DeviceType.Climate, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.MediaPlayer, DeviceType.WaterHeater, DeviceType.Humidifier, DeviceType.Fan, DeviceType.Climate, DeviceType.PetFeeder, DeviceType.MediaPlayer, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation, DeviceType.WeatherStation;
59902
61330
  var NUMBER = {
59903
61331
  kind: "fixed",
59904
61332
  result: ["number"]
@@ -61381,11 +62809,11 @@ method(_void(), EngineInfoSchema, { auth: "admin" }), method(object({
61381
62809
  namespace: string().optional(),
61382
62810
  collection: string(),
61383
62811
  key: string()
61384
- }), unknown(), { auth: "admin" }), method(object({
62812
+ }), unknown$1(), { auth: "admin" }), method(object({
61385
62813
  namespace: string().optional(),
61386
62814
  collection: string(),
61387
62815
  key: string(),
61388
- value: unknown()
62816
+ value: unknown$1()
61389
62817
  }), _void(), {
61390
62818
  kind: "mutation",
61391
62819
  auth: "admin"
@@ -61421,7 +62849,7 @@ method(_void(), EngineInfoSchema, { auth: "admin" }), method(object({
61421
62849
  collection: string(),
61422
62850
  record: object({
61423
62851
  id: string().optional(),
61424
- data: record$1(string(), unknown())
62852
+ data: record$1(string(), unknown$1())
61425
62853
  })
61426
62854
  }), object({
61427
62855
  /**
@@ -61461,7 +62889,7 @@ id: union([string(), number$1()]) }), {
61461
62889
  ops: array(TransactOpSchema).readonly()
61462
62890
  }), object({
61463
62891
  applied: boolean(),
61464
- current: unknown().optional()
62892
+ current: unknown$1().optional()
61465
62893
  }), {
61466
62894
  kind: "mutation",
61467
62895
  auth: "admin"
@@ -61469,7 +62897,7 @@ id: union([string(), number$1()]) }), {
61469
62897
  namespace: string().optional(),
61470
62898
  collection: string(),
61471
62899
  id: string(),
61472
- data: record$1(string(), unknown())
62900
+ data: record$1(string(), unknown$1())
61473
62901
  }), _void(), {
61474
62902
  kind: "mutation",
61475
62903
  auth: "admin"
@@ -61491,7 +62919,7 @@ id: union([string(), number$1()]) }), {
61491
62919
  namespace: string().optional(),
61492
62920
  collection: string(),
61493
62921
  filter: MutationFilterSchema,
61494
- data: record$1(string(), unknown())
62922
+ data: record$1(string(), unknown$1())
61495
62923
  }), object({ updated: number$1().int() }), {
61496
62924
  kind: "mutation",
61497
62925
  auth: "admin"
@@ -62661,7 +64089,7 @@ object({
62661
64089
  externalId: string(),
62662
64090
  name: string(),
62663
64091
  type: string(),
62664
- metadata: record$1(string(), unknown()).optional()
64092
+ metadata: record$1(string(), unknown$1()).optional()
62665
64093
  });
62666
64094
  /**
62667
64095
  * HOW a provider can be found on the network. The provider only DECLARES the
@@ -62745,7 +64173,7 @@ var DiscoveryCandidateSchema = object({
62745
64173
  stableId: string(),
62746
64174
  type: _enum(DeviceType),
62747
64175
  suggestedName: string(),
62748
- prefilledConfig: record$1(string(), unknown()),
64176
+ prefilledConfig: record$1(string(), unknown$1()),
62749
64177
  /**
62750
64178
  * Optional upstream-system identity (HA entity_id, vendor MAC, …).
62751
64179
  * Discovery pre-populates this for systems that know the upstream
@@ -62804,7 +64232,7 @@ var DeviceSummarySchema = object({
62804
64232
  parentDeviceId: number$1().nullable(),
62805
64233
  online: boolean(),
62806
64234
  features: array(string()),
62807
- config: record$1(string(), unknown()),
64235
+ config: record$1(string(), unknown$1()),
62808
64236
  /** Optional upstream-system identity (dispatch key + system tag).
62809
64237
  * See `SourceInfo`. Present when the device has a non-synthetic
62810
64238
  * source identifier (HA entities, vendor MAC, …); omitted when the
@@ -62830,7 +64258,7 @@ var FieldProbeResultSchema = object({
62830
64258
  * but we deliberately avoid a Zod mirror because the union is large and
62831
64259
  * not meant for runtime validation at this seam.
62832
64260
  */
62833
- var CreationSchemaOutputSchema = unknown();
64261
+ var CreationSchemaOutputSchema = unknown$1();
62834
64262
  var deviceProviderCapability = {
62835
64263
  name: "device-provider",
62836
64264
  scope: "system",
@@ -62880,7 +64308,7 @@ var deviceProviderCapability = {
62880
64308
  * shaped by `getDiscoveryParamsSchema`. Omitted for the generic scan
62881
64309
  * (provider uses its local-network default).
62882
64310
  */
62883
- discoverDevices: method(object({ params: record$1(string(), unknown()).optional() }), array(DiscoveryCandidateSchema), {
64311
+ discoverDevices: method(object({ params: record$1(string(), unknown$1()).optional() }), array(DiscoveryCandidateSchema), {
62884
64312
  kind: "mutation",
62885
64313
  auth: "admin"
62886
64314
  }),
@@ -62897,7 +64325,7 @@ var deviceProviderCapability = {
62897
64325
  */
62898
64326
  classifyDiscoveryHits: method(object({
62899
64327
  hits: array(DiscoveryHitSchema),
62900
- params: record$1(string(), unknown()).optional()
64328
+ params: record$1(string(), unknown$1()).optional()
62901
64329
  }), array(DiscoveryCandidateSchema), {
62902
64330
  kind: "mutation",
62903
64331
  auth: "admin"
@@ -62940,7 +64368,7 @@ integrationId: string().optional() }), object({ deviceType: _enum(DeviceType).nu
62940
64368
  }), CreationSchemaOutputSchema),
62941
64369
  createDevice: method(object({
62942
64370
  type: _enum(DeviceType),
62943
- config: record$1(string(), unknown()),
64371
+ config: record$1(string(), unknown$1()),
62944
64372
  /** The integration the operator adds the device to; a provider with several instances needs it. */
62945
64373
  integrationId: string().optional()
62946
64374
  }), DeviceSummarySchema, {
@@ -62962,8 +64390,8 @@ integrationId: string().optional() }), object({ deviceType: _enum(DeviceType).nu
62962
64390
  testCreationField: method(object({
62963
64391
  type: _enum(DeviceType),
62964
64392
  key: string(),
62965
- value: unknown(),
62966
- formValues: record$1(string(), unknown()).optional()
64393
+ value: unknown$1(),
64394
+ formValues: record$1(string(), unknown$1()).optional()
62967
64395
  }), FieldProbeResultSchema, {
62968
64396
  kind: "mutation",
62969
64397
  auth: "admin"
@@ -63106,14 +64534,14 @@ var DeviceInfoSchema = object({
63106
64534
  /** true when the device has a getStreamSources() method (ICameraDevice) */
63107
64535
  isCamera: boolean(),
63108
64536
  /** Current config values — serializable snapshot */
63109
- config: record$1(string(), unknown()),
64537
+ config: record$1(string(), unknown$1()),
63110
64538
  /** Paths inside `config` the device's schema declares secret (D783) —
63111
64539
  * what the non-admin redaction withholds. Paths, never values. Absent
63112
64540
  * when the owning runner has not reported them. */
63113
64541
  secretConfigPaths: array(string()).optional(),
63114
64542
  /** Hardware + identity blob (manufacturer / model / firmware / sn /
63115
64543
  * uid / mac / …). Populated by drivers; editable via setMetadata. */
63116
- metadata: record$1(string(), unknown()).nullable().optional(),
64544
+ metadata: record$1(string(), unknown$1()).nullable().optional(),
63117
64545
  /** Provider-declared identifiers (D1059): typed, normalised, written only by
63118
64546
  * the owning provider via `setIdentifiers`; read-only for the operator.
63119
64547
  * Absent ⇒ the provider declared none. */
@@ -63147,7 +64575,7 @@ var DeviceInfoSchema = object({
63147
64575
  });
63148
64576
  var ConfigEntrySchema = object({
63149
64577
  key: string(),
63150
- value: unknown(),
64578
+ value: unknown$1(),
63151
64579
  description: string().optional()
63152
64580
  });
63153
64581
  /**
@@ -63273,7 +64701,7 @@ var DeviceMetaSchema = object({
63273
64701
  tags: TagsFieldSchema.optional(),
63274
64702
  disabled: boolean(),
63275
64703
  parentDeviceId: number$1().nullable(),
63276
- metadata: record$1(string(), unknown()).nullable().optional(),
64704
+ metadata: record$1(string(), unknown$1()).nullable().optional(),
63277
64705
  /** Provider-declared identifiers (D1059). See `DeviceMeta.identifiers`. */
63278
64706
  identifiers: DeviceIdentifiersSchema.optional(),
63279
64707
  /** The far end of the device's physical link (D1063). See `DeviceMeta.attachedIdentifiers`. */
@@ -63308,7 +64736,7 @@ var DeviceMetaSchema = object({
63308
64736
  display: DeviceDisplayOverrideSchema.optional()
63309
64737
  });
63310
64738
  /** ConfigUISchema passed through as unknown — mirrors device-provider's CreationSchemaOutputSchema */
63311
- var ConfigUISchemaOutput = unknown().nullable();
64739
+ var ConfigUISchemaOutput = unknown$1().nullable();
63312
64740
  var StreamProbeResultSchema = object({
63313
64741
  streamId: string(),
63314
64742
  width: number$1().optional(),
@@ -63341,7 +64769,7 @@ var DeviceRegisterPayloadSchema = object({
63341
64769
  * call (workers re-register on init), so probe-driven updates
63342
64770
  * (e.g. PTZ flag flipping after the abilities probe) propagate. */
63343
64771
  features: array(string()).optional(),
63344
- config: record$1(string(), unknown()),
64772
+ config: record$1(string(), unknown$1()),
63345
64773
  /** Config paths the device's own schema DECLARES secret
63346
64774
  * (`.meta({ secret: true })` — dotted, `[]` for array items, e.g.
63347
64775
  * `connection.password`). Re-published on every register; the non-admin
@@ -63384,7 +64812,7 @@ var CleanupDeletedDevicesResultSchema = object({
63384
64812
  var DeviceRemovePayloadSchema = object({ deviceId: number$1() });
63385
64813
  var DevicePersistConfigPayloadSchema = object({
63386
64814
  deviceId: number$1(),
63387
- data: record$1(string(), unknown()),
64815
+ data: record$1(string(), unknown$1()),
63388
64816
  /** The paths the device's schema declares secret (D783), when the caller
63389
64817
  * knows them — those values are kept in the keychain, not the blob (D787).
63390
64818
  * Absent: the paths the device last reported at `registerDevice` apply. */
@@ -63426,7 +64854,7 @@ method(object({
63426
64854
  }), method(DeviceRegisterPayloadSchema, _void(), { kind: "mutation" }), method(DeviceRemovePayloadSchema, _void(), { kind: "mutation" }), method(DevicePersistConfigPayloadSchema, _void(), {
63427
64855
  kind: "mutation",
63428
64856
  auth: "admin"
63429
- }), method(object({ deviceId: number$1() }), record$1(string(), unknown()), { auth: "admin" }), method(object({ deviceId: number$1() }), record$1(string(), unknown()), { auth: "admin" }), method(object({ deviceId: number$1() }), DeviceMetaSchema.nullable()), method(object({
64857
+ }), method(object({ deviceId: number$1() }), record$1(string(), unknown$1()), { auth: "admin" }), method(object({ deviceId: number$1() }), record$1(string(), unknown$1()), { auth: "admin" }), method(object({ deviceId: number$1() }), DeviceMetaSchema.nullable()), method(object({
63430
64858
  deviceId: number$1(),
63431
64859
  name: string(),
63432
64860
  /**
@@ -63587,7 +65015,7 @@ method(object({
63587
65015
  auth: "admin"
63588
65016
  }), method(object({
63589
65017
  deviceId: number$1(),
63590
- patch: record$1(string(), unknown())
65018
+ patch: record$1(string(), unknown$1())
63591
65019
  }), _void(), {
63592
65020
  kind: "mutation",
63593
65021
  auth: "admin"
@@ -63708,7 +65136,7 @@ method(object({
63708
65136
  devices: array(LinkedDeviceSchema)
63709
65137
  }), { role: "viewer" }), method(object({ deviceIds: array(number$1()) }), array(LinkedDevicesForDeviceSchema), { role: "viewer" }), method(object({ deviceId: number$1() }), array(StreamSourceEntrySchema$1)), method(object({ deviceId: number$1() }), array(ConfigEntrySchema)), method(object({ deviceId: number$1() }), ConfigUISchemaOutput), method(object({
63710
65138
  deviceId: number$1(),
63711
- values: record$1(string(), unknown())
65139
+ values: record$1(string(), unknown$1())
63712
65140
  }), object({ success: literal(true) }), {
63713
65141
  kind: "mutation",
63714
65142
  auth: "admin"
@@ -63756,13 +65184,13 @@ method(object({
63756
65184
  })), method(object({
63757
65185
  deviceId: number$1().int().nonnegative(),
63758
65186
  action: string().min(1),
63759
- input: unknown()
63760
- }), unknown(), { kind: "mutation" }), method(object({
65187
+ input: unknown$1()
65188
+ }), unknown$1(), { kind: "mutation" }), method(object({
63761
65189
  deviceId: number$1(),
63762
65190
  writerCapName: string(),
63763
65191
  writerAddonId: string(),
63764
65192
  key: string(),
63765
- value: unknown()
65193
+ value: unknown$1()
63766
65194
  }), object({ success: literal(true) }), {
63767
65195
  kind: "mutation",
63768
65196
  auth: "admin"
@@ -63772,7 +65200,7 @@ method(object({
63772
65200
  writerCapName: string(),
63773
65201
  writerAddonId: string(),
63774
65202
  key: string(),
63775
- value: unknown()
65203
+ value: unknown$1()
63776
65204
  }))
63777
65205
  }), object({
63778
65206
  success: literal(true),
@@ -63803,10 +65231,10 @@ method(object({
63803
65231
  /** The integration the form is for; a provider whose integrations differ (a hub
63804
65232
  * integration takes no manual add) answers per integration. Absent = the addon's own. */
63805
65233
  integrationId: string().optional()
63806
- }), unknown().nullable()), method(object({
65234
+ }), unknown$1().nullable()), method(object({
63807
65235
  addonId: string(),
63808
65236
  type: _enum(DeviceType),
63809
- config: record$1(string(), unknown()),
65237
+ config: record$1(string(), unknown$1()),
63810
65238
  /** Owning integration id, stamped onto the new device's meta by the
63811
65239
  * device-manager forwarder so `removeByIntegration` can cascade it.
63812
65240
  * Optional for back-compat (omitted = no stamp = pre-existing behavior). */
@@ -63818,8 +65246,8 @@ method(object({
63818
65246
  addonId: string(),
63819
65247
  type: _enum(DeviceType),
63820
65248
  key: string(),
63821
- value: unknown(),
63822
- formValues: record$1(string(), unknown()).optional()
65249
+ value: unknown$1(),
65250
+ formValues: record$1(string(), unknown$1()).optional()
63823
65251
  }), FieldProbeResultSchema, {
63824
65252
  kind: "mutation",
63825
65253
  auth: "admin"
@@ -63868,7 +65296,7 @@ method(object({
63868
65296
  }
63869
65297
  ), method(object({
63870
65298
  addonId: string(),
63871
- params: record$1(string(), unknown()).optional(),
65299
+ params: record$1(string(), unknown$1()).optional(),
63872
65300
  subnets: array(string()).optional()
63873
65301
  }), object({ candidates: array(DiscoveryCandidateSchema).readonly() }), {
63874
65302
  kind: "mutation",
@@ -63890,20 +65318,20 @@ method(object({
63890
65318
  addonId: string(),
63891
65319
  /** The integration the Add-Device dialog is open on; absent = the addon's own. */
63892
65320
  integrationId: string().optional()
63893
- }), object({ deviceType: _enum(DeviceType).nullable() }), { auth: "admin" }), method(object({ addonId: string() }), unknown(), { auth: "admin" }), method(object({
65321
+ }), object({ deviceType: _enum(DeviceType).nullable() }), { auth: "admin" }), method(object({ addonId: string() }), unknown$1(), { auth: "admin" }), method(object({
63894
65322
  deviceId: number$1(),
63895
65323
  key: string(),
63896
- value: unknown()
65324
+ value: unknown$1()
63897
65325
  }), FieldProbeResultSchema, {
63898
65326
  kind: "mutation",
63899
65327
  auth: "admin"
63900
65328
  }), method(object({
63901
65329
  deviceId: number$1(),
63902
65330
  caps: array(string()).readonly().optional()
63903
- }), record$1(string(), unknown().nullable())), method(object({
65331
+ }), record$1(string(), unknown$1().nullable())), method(object({
63904
65332
  deviceIds: array(number$1()).readonly(),
63905
65333
  caps: array(string()).readonly().optional()
63906
- }), record$1(string(), record$1(string(), unknown().nullable())), { role: "viewer" });
65334
+ }), record$1(string(), record$1(string(), unknown$1().nullable())), { role: "viewer" });
63907
65335
  var ExtensionSlotIdSchema = _enum(["linked-devices"]);
63908
65336
  DeviceType.Camera;
63909
65337
  /** A slot's editable value, discriminated on `slot`. */
@@ -64570,24 +65998,24 @@ var ClaimsListingSchema = discriminatedUnion("state", [object({
64570
65998
  state: literal("not-loaded"),
64571
65999
  reason: string()
64572
66000
  })]);
64573
- method(object({ deviceId: number$1() }), record$1(string(), record$1(string(), unknown()))), method(object({
66001
+ method(object({ deviceId: number$1() }), record$1(string(), record$1(string(), unknown$1()))), method(object({
64574
66002
  deviceId: number$1(),
64575
66003
  capName: string(),
64576
66004
  /** The slice the device CONFIRMED, without a held command (D1061) — history and automations. */
64577
66005
  confirmed: boolean().optional()
64578
- }), record$1(string(), unknown()).nullable()), method(object({
66006
+ }), record$1(string(), unknown$1()).nullable()), method(object({
64579
66007
  /** The slices the devices CONFIRMED, without held commands (D1061). */
64580
- confirmed: boolean().optional() }), record$1(string(), record$1(string(), record$1(string(), unknown())))), method(object({
66008
+ confirmed: boolean().optional() }), record$1(string(), record$1(string(), record$1(string(), unknown$1())))), method(object({
64581
66009
  deviceId: number$1(),
64582
66010
  capName: string(),
64583
- slice: record$1(string(), unknown())
66011
+ slice: record$1(string(), unknown$1())
64584
66012
  }), _void(), { kind: "mutation" }), method(object({
64585
66013
  deviceId: number$1(),
64586
66014
  capName: string(),
64587
66015
  owner: string().min(1),
64588
66016
  mode: FieldClaimModeSchema,
64589
66017
  fields: array(string().min(1)).min(1),
64590
- values: record$1(string(), unknown())
66018
+ values: record$1(string(), unknown$1())
64591
66019
  }), ClaimOutcomeSchema, {
64592
66020
  kind: "mutation",
64593
66021
  auth: "admin"
@@ -64595,7 +66023,7 @@ confirmed: boolean().optional() }), record$1(string(), record$1(string(), record
64595
66023
  deviceId: number$1(),
64596
66024
  capName: string(),
64597
66025
  owner: string().min(1),
64598
- values: record$1(string(), unknown())
66026
+ values: record$1(string(), unknown$1())
64599
66027
  }), ClaimOutcomeSchema, {
64600
66028
  kind: "mutation",
64601
66029
  auth: "admin"
@@ -64609,10 +66037,10 @@ confirmed: boolean().optional() }), record$1(string(), record$1(string(), record
64609
66037
  }), method(object({ ownerPrefix: string().optional() }), ClaimsListingSchema, { auth: "admin" }), method(object({
64610
66038
  deviceId: number$1(),
64611
66039
  capName: string()
64612
- }), record$1(string(), unknown()).nullable(), { auth: "admin" }), event(object({
66040
+ }), record$1(string(), unknown$1()).nullable(), { auth: "admin" }), event(object({
64613
66041
  deviceId: number$1(),
64614
66042
  capName: string(),
64615
- slice: record$1(string(), unknown())
66043
+ slice: record$1(string(), unknown$1())
64616
66044
  }));
64617
66045
  /**
64618
66046
  * Server-driven device state refresh (D1062): the core decides WHEN a device is
@@ -66203,6 +67631,12 @@ var energySystemCapability = {
66203
67631
  deadband: .05,
66204
67632
  displayName: "Stored energy"
66205
67633
  },
67634
+ "storage.capacityKwh": {
67635
+ kind: "gauge",
67636
+ unit: "kWh",
67637
+ deadband: .1,
67638
+ displayName: "Storage capacity"
67639
+ },
66206
67640
  "storage.powerW": {
66207
67641
  group: "power-flow",
66208
67642
  kind: "gauge",
@@ -66303,6 +67737,15 @@ var DeviceFaultSchema = object({
66303
67737
  label: string(),
66304
67738
  severity: DeviceErrorSeveritySchema
66305
67739
  });
67740
+ /** One kind of fault a device CAN raise: the integration's own declared catalog entry. */
67741
+ var DeviceFaultTypeSchema = DeviceFaultSchema;
67742
+ /**
67743
+ * The fault catalog of a device, declared by its integration at runtime (never a
67744
+ * code enum). A fault outside the catalog is still published and still matches
67745
+ * a rule that names no code.
67746
+ */
67747
+ var ListFaultTypesInputSchema = object({ deviceId: number$1().int().nonnegative() });
67748
+ var FaultTypesSchema = object({ types: array(DeviceFaultTypeSchema) });
66306
67749
  /**
66307
67750
  * The fault a device reports right now. One slice per device.
66308
67751
  *
@@ -66340,7 +67783,12 @@ var errorCapability = {
66340
67783
  scope: "device",
66341
67784
  deviceNative: true,
66342
67785
  mode: "singleton",
66343
- methods: {},
67786
+ methods: {
67787
+ /** The fault codes this device's integration can raise; `[]` when it declares none. */
67788
+ listFaultTypes: method(ListFaultTypesInputSchema, FaultTypesSchema, {
67789
+ kind: "query",
67790
+ auth: "protected"
67791
+ }) },
66344
67792
  status: {
66345
67793
  schema: ErrorStatusSchema,
66346
67794
  kind: "push",
@@ -67451,7 +68899,7 @@ var FeatureProbeStatusSchema = object({
67451
68899
  * `hasPirSensor`, `hasAutotrack`, `hasBattery`. Hikvision keys:
67452
68900
  * `hasSupplementalLight`, `lightHasWhiteLight`, `hasAlarmIo`, `hasPtz`.
67453
68901
  */
67454
- flags: record$1(string(), unknown()),
68902
+ flags: record$1(string(), unknown$1()),
67455
68903
  /**
67456
68904
  * Coarse driver-classification — lets cross-process consumers tell apart
67457
68905
  * cameras / battery-cams / NVRs without re-running the probe. `null`
@@ -68268,6 +69716,43 @@ function heatPumpInstantCop(power) {
68268
69716
  if (thermalW === null || electricalW === null || electricalW <= 0) return null;
68269
69717
  return thermalW / electricalW;
68270
69718
  }
69719
+ var HEAT_PUMP_CUSTOMIZE_DEVICE_TYPES = [DeviceType.HeatPump];
69720
+ /** One electrical reading the operator may take from a device they pick, unit checked. */
69721
+ function electricalTarget(id, path, unit) {
69722
+ return {
69723
+ id,
69724
+ cardinality: "scalar",
69725
+ vocabulary: { cap: "heat-pump-status" },
69726
+ deviceTypes: HEAT_PUMP_CUSTOMIZE_DEVICE_TYPES,
69727
+ apply: "replace",
69728
+ path,
69729
+ sources: [{
69730
+ kind: "numeric",
69731
+ requiredUnit: unit,
69732
+ transforms: [{ kind: "identity" }]
69733
+ }],
69734
+ sourceReport: { status: "assignment-status" }
69735
+ };
69736
+ }
69737
+ var HEAT_PUMP_TARGETS = [electricalTarget("electrical-power", "power.electricalW", "W"), electricalTarget("electrical-energy", "energy.electricalKwh", "kWh")];
69738
+ /**
69739
+ * Customize (D984, #476): a gateway that reports no instantaneous electrical
69740
+ * power (the cloud ones) or whose energy meter the operator trusts less than a
69741
+ * dedicated one lets the OPERATOR pick a device for `power.electricalW` and
69742
+ * `energy.electricalKwh` — a `replace` over a field listed in `overridable`,
69743
+ * nothing else. The replaced value IS the cap field, so the instant COP, the
69744
+ * hero pills and the history use it; nothing is linked by itself (D356), the
69745
+ * unit is checked, and a source that does not answer releases the field back to
69746
+ * the native reading (never a 0, D393).
69747
+ */
69748
+ var heatPumpStatusCustomize = {
69749
+ version: 1,
69750
+ overridable: HEAT_PUMP_TARGETS.map((target) => ({
69751
+ path: target.path,
69752
+ by: target.id
69753
+ })),
69754
+ targets: HEAT_PUMP_TARGETS
69755
+ };
68271
69756
  var heatPumpStatusCapability = {
68272
69757
  name: "heat-pump-status",
68273
69758
  scope: "device",
@@ -68286,6 +69771,7 @@ var heatPumpStatusCapability = {
68286
69771
  * (the series are recorded). See `RuntimeStateDurability`.
68287
69772
  */
68288
69773
  durability: "session",
69774
+ customize: heatPumpStatusCustomize,
68289
69775
  /**
68290
69776
  * History (D850, D917): `circuits[]` is a keyed array — one series per circuit and
68291
69777
  * field, named by the circuit's label. The mode is a state (D896); the energy
@@ -69844,15 +71330,9 @@ var IntegrationWithStateSchema = object({
69844
71330
  id: string(),
69845
71331
  addonId: string(),
69846
71332
  name: string(),
69847
- /** A projection of the instance body's switch (`setInstanceEnabled` is the only writer). */
71333
+ /** THE switch of the instance: the hub registry row is its only stored copy (D1066). */
69848
71334
  enabled: boolean(),
69849
- /**
69850
- * True when the addon that holds the switch did not answer (down, failed, or keeps no record for
69851
- * this row): `enabled` is then the stored registry flag, a stale value, not the state. A reader
69852
- * must not draw it as on or off (D315).
69853
- */
69854
- switchUnknown: literal(true).optional(),
69855
- info: record$1(string(), unknown()).readonly(),
71335
+ info: record$1(string(), unknown$1()).readonly(),
69856
71336
  /** The discovery candidate this integration was set up from (D984). */
69857
71337
  originStableId: string().optional(),
69858
71338
  createdAt: number$1(),
@@ -69863,15 +71343,9 @@ var IntegrationLiteSchema = object({
69863
71343
  id: string(),
69864
71344
  addonId: string(),
69865
71345
  name: string(),
69866
- /** A projection of the instance body's switch (`setInstanceEnabled` is the only writer). */
71346
+ /** THE switch of the instance: the hub registry row is its only stored copy (D1066). */
69867
71347
  enabled: boolean(),
69868
- /**
69869
- * True when the addon that holds the switch did not answer (down, failed, or keeps no record for
69870
- * this row): `enabled` is then the stored registry flag, a stale value, not the state. A reader
69871
- * must not draw it as on or off (D315).
69872
- */
69873
- switchUnknown: literal(true).optional(),
69874
- info: record$1(string(), unknown()).readonly(),
71348
+ info: record$1(string(), unknown$1()).readonly(),
69875
71349
  /** The discovery candidate this integration was set up from (D984). */
69876
71350
  originStableId: string().optional(),
69877
71351
  createdAt: number$1(),
@@ -69980,13 +71454,33 @@ var UpdateIntegrationInputSchema = object({
69980
71454
  * switch is `integration-instances.setInstanceEnabled`.
69981
71455
  */
69982
71456
  enabled: boolean().optional(),
69983
- info: record$1(string(), unknown()).optional()
71457
+ info: record$1(string(), unknown$1()).optional()
69984
71458
  });
69985
71459
  var DeleteIntegrationResultSchema = object({
69986
71460
  success: boolean(),
69987
71461
  deletedId: string()
69988
71462
  });
69989
- method(_void(), array(IntegrationWithStateSchema)), method(object({ id: string() }), IntegrationWithStateSchema), method(object({ addonId: string() }), IntegrationLiteSchema.nullable()), method(UpdateIntegrationInputSchema, IntegrationLiteSchema, {
71463
+ method(_void(), array(IntegrationWithStateSchema)), method(object({ id: string() }), IntegrationWithStateSchema), method(object({ addonId: string() }), IntegrationLiteSchema.nullable()), method(object({ addonId: string() }), array(IntegrationLiteSchema)), method(object({
71464
+ addonId: string(),
71465
+ rows: array(object({
71466
+ id: string().min(1),
71467
+ name: string(),
71468
+ enabled: boolean(),
71469
+ /** True when the record body STATED the switch: only then does it override an existing row. */
71470
+ stated: boolean()
71471
+ }))
71472
+ }), object({
71473
+ created: number$1().int(),
71474
+ updated: number$1().int(),
71475
+ /** Rows whose id belongs to ANOTHER addon: left untouched, so the caller keeps its own copy. */
71476
+ conflicts: array(object({
71477
+ id: string(),
71478
+ ownerAddonId: string()
71479
+ }))
71480
+ }), {
71481
+ kind: "mutation",
71482
+ auth: "admin"
71483
+ }), method(UpdateIntegrationInputSchema, IntegrationLiteSchema, {
69990
71484
  kind: "mutation",
69991
71485
  auth: "admin"
69992
71486
  }), method(object({ id: string() }), DeleteIntegrationResultSchema, {
@@ -70069,6 +71563,8 @@ var IntegrationInstanceKindSchema = object({
70069
71563
  role: IntegrationInstanceRoleSchema.optional(),
70070
71564
  /** `testInstance` really probes the remote for this kind; absent takes the provider's `canTest`. */
70071
71565
  canTest: boolean().optional(),
71566
+ /** `false`: Add never offers this kind (the system creates its one instance, e.g. a default integration). Absent = creatable. */
71567
+ creatable: boolean().optional(),
70072
71568
  /** The kind signs in through a server-held interactive session. */
70073
71569
  signIn: object({
70074
71570
  basePath: string().min(1),
@@ -70188,7 +71684,7 @@ var IntegrationInstanceSchema = object({
70188
71684
  /** The kind of this instance: exactly one of `describe().kinds[].id` (D1013 rule 2). */
70189
71685
  kind: string().min(1),
70190
71686
  /** Values for the instance form; a secret is a `SecretFieldView`, never text. */
70191
- formValues: record$1(string(), unknown()),
71687
+ formValues: record$1(string(), unknown$1()),
70192
71688
  status: IntegrationInstanceStatusSchema.optional(),
70193
71689
  /** Epoch ms of the last probe of the remote that produced `status`; absent when never checked. */
70194
71690
  lastCheckedAt: number$1().optional(),
@@ -70199,7 +71695,7 @@ var IntegrationInstancePatchSchema = object({
70199
71695
  id: IntegrationInstanceIdSchema,
70200
71696
  name: string().min(1).optional(),
70201
71697
  /** Omitted / '' / redaction token keeps a secret; `{ $secretClear: true }` clears it. */
70202
- values: record$1(string(), unknown())
71698
+ values: record$1(string(), unknown$1())
70203
71699
  });
70204
71700
  var integrationInstancesCapability = {
70205
71701
  name: "integration-instances",
@@ -70244,7 +71740,7 @@ var integrationInstancesCapability = {
70244
71740
  name: string().min(1),
70245
71741
  kind: string().min(1).optional(),
70246
71742
  /** Form values written with the record (a link picked in the create dialog). */
70247
- values: record$1(string(), unknown()).optional(),
71743
+ values: record$1(string(), unknown$1()).optional(),
70248
71744
  /**
70249
71745
  * The discovery candidate (`stableId`) the instance is set up from. Kept on the integration
70250
71746
  * registry row of an instance that brings devices, so discovery stops offering a candidate
@@ -70258,7 +71754,7 @@ var integrationInstancesCapability = {
70258
71754
  * caller the transport stamped as the addon itself (`callerAddonId`): an admin session
70259
71755
  * cannot send it, and the wizard never does. `values` are the settings it is seeded with.
70260
71756
  */
70261
- seed: object({ info: record$1(string(), unknown()) }).optional()
71757
+ seed: object({ info: record$1(string(), unknown$1()) }).optional()
70262
71758
  }), object({ id: string() }), {
70263
71759
  kind: "mutation",
70264
71760
  auth: "protected",
@@ -70294,7 +71790,7 @@ var integrationInstancesCapability = {
70294
71790
  }),
70295
71791
  testInstance: optionalMethod(object({
70296
71792
  id: IntegrationInstanceIdSchema.nullable(),
70297
- values: record$1(string(), unknown()),
71793
+ values: record$1(string(), unknown$1()),
70298
71794
  /** The kind to test when `id` is null and the provider has several. */
70299
71795
  kind: string().min(1).optional()
70300
71796
  }), TestConnectionResultSchema, {
@@ -71186,7 +72682,7 @@ var LlmGenerateBaseInputSchema = object({
71186
72682
  /** v1: single-turn. `messages[]` is a v2 additive field. */
71187
72683
  prompt: string(),
71188
72684
  /** Structured output — adapter-mapped (response_format / forced tool / responseSchema). */
71189
- jsonSchema: record$1(string(), unknown()).optional(),
72685
+ jsonSchema: record$1(string(), unknown$1()).optional(),
71190
72686
  /** Per-call override of the profile default. */
71191
72687
  maxTokens: number$1().int().positive().optional(),
71192
72688
  temperature: number$1().optional(),
@@ -71511,7 +73007,7 @@ var LlmModelInfoSchema = object({
71511
73007
  * `connectionSchema` declares `type: 'password'` is a secret: it is held in the
71512
73008
  * keychain, never in the row, and reads back as the redaction marker.
71513
73009
  */
71514
- var LlmProviderConfigSchema = record$1(string(), unknown());
73010
+ var LlmProviderConfigSchema = record$1(string(), unknown$1());
71515
73011
  object({
71516
73012
  id: string(),
71517
73013
  name: string(),
@@ -71606,7 +73102,7 @@ var LlmProviderWidgetSchema = object({
71606
73102
  /** ConfigUISchema tree passed through untyped on the wire (the
71607
73103
  * notification-output `ConfigSchemaPassthrough` precedent at
71608
73104
  * notification-output.cap.ts:151); the exported TS type re-tightens it. */
71609
- var ConfigSchemaPassthrough$1 = unknown();
73105
+ var ConfigSchemaPassthrough$1 = unknown$1();
71610
73106
  object({
71611
73107
  kind: LlmProfileKindSchema,
71612
73108
  label: string(),
@@ -72548,7 +74044,7 @@ var LogEntrySchema = object({
72548
74044
  level: LogLevelSchema,
72549
74045
  scope: array(string()),
72550
74046
  message: string(),
72551
- meta: record$1(string(), unknown()).optional(),
74047
+ meta: record$1(string(), unknown$1()).optional(),
72552
74048
  tags: record$1(string(), string()).optional()
72553
74049
  });
72554
74050
  /**
@@ -72617,7 +74113,7 @@ var LogReadResultSchema = object({
72617
74113
  scope: string().optional(),
72618
74114
  message: string(),
72619
74115
  tags: record$1(string(), union([string(), number$1()])).optional(),
72620
- meta: record$1(string(), unknown()).optional()
74116
+ meta: record$1(string(), unknown$1()).optional()
72621
74117
  })),
72622
74118
  /** Pass as `before` for the next older page; null when nothing older exists. */
72623
74119
  nextBefore: string().nullable(),
@@ -73405,7 +74901,7 @@ method(_void(), SystemResourceSnapshotSchema), method(_void(), SystemResourceSna
73405
74901
  */
73406
74902
  var RecordIdSchema = string().min(1).max(256);
73407
74903
  /** A JSON object body. Size is the engine's check (`maxDataBytes`), not a schema's. */
73408
- var RecordBodySchema = record$1(string(), unknown());
74904
+ var RecordBodySchema = record$1(string(), unknown$1());
73409
74905
  var RecordInputSchema = object({
73410
74906
  id: RecordIdSchema,
73411
74907
  /** The device this row belongs to (D865 removal, per-device reads). */
@@ -73645,7 +75141,7 @@ method(object({ kinds: record$1(RecordKindNameSchema, RecordKindDeclarationSchem
73645
75141
  * `scripts/migration-api-contract.json`, and every `behaviours` id below must have an
73646
75142
  * `it('<id>'` in `migration-api.contract.spec.ts`.
73647
75143
  */
73648
- var Rows = record$1(string(), unknown());
75144
+ var Rows = record$1(string(), unknown$1());
73649
75145
  var IntegrationId = object({ integrationId: string().min(1) });
73650
75146
  var RecordId = object({ id: string().min(1) });
73651
75147
  var RecordRowSchema = object({
@@ -73813,7 +75309,7 @@ method(object({}), object({ entries: array(MigrationLedgerEntrySchema) }), { aut
73813
75309
  }), {
73814
75310
  kind: "mutation",
73815
75311
  auth: "admin"
73816
- }), method(object({ integrationId: string().min(1) }), record$1(string(), unknown()), { auth: "admin" }), method(object({ integrationId: string().min(1) }), object({
75312
+ }), method(object({ integrationId: string().min(1) }), record$1(string(), unknown$1()), { auth: "admin" }), method(object({ integrationId: string().min(1) }), object({
73817
75313
  rows: number$1().int().nonnegative(),
73818
75314
  secrets: number$1().int().nonnegative()
73819
75315
  }), {
@@ -73821,7 +75317,7 @@ method(object({}), object({ entries: array(MigrationLedgerEntrySchema) }), { aut
73821
75317
  auth: "admin"
73822
75318
  }), method(object({
73823
75319
  integrationId: string().min(1),
73824
- patch: record$1(string(), unknown())
75320
+ patch: record$1(string(), unknown$1())
73825
75321
  }), object({ written: boolean() }), {
73826
75322
  kind: "mutation",
73827
75323
  auth: "admin"
@@ -73830,7 +75326,7 @@ method(object({}), object({ entries: array(MigrationLedgerEntrySchema) }), { aut
73830
75326
  keys: array(string().min(1))
73831
75327
  }), object({
73832
75328
  present: boolean(),
73833
- removed: record$1(string(), unknown())
75329
+ removed: record$1(string(), unknown$1())
73834
75330
  }), {
73835
75331
  kind: "mutation",
73836
75332
  auth: "admin"
@@ -74328,7 +75824,7 @@ var SensorEventSchema = object({
74328
75824
  /** Event kind id — matches an `EventKindDescriptor.kind`. */
74329
75825
  kind: string(),
74330
75826
  /** Snapshot of the sensor cap's runtime-state slice at the change. */
74331
- value: record$1(string(), unknown()).nullable(),
75827
+ value: record$1(string(), unknown$1()).nullable(),
74332
75828
  timestamp: number$1()
74333
75829
  });
74334
75830
  /**
@@ -76922,7 +78418,7 @@ var PipelineDefaultStepSchema = lazy(() => object({
76922
78418
  modelId: string(),
76923
78419
  children: array(PipelineDefaultStepSchema).readonly(),
76924
78420
  group: string().optional(),
76925
- settings: record$1(string(), unknown()).optional()
78421
+ settings: record$1(string(), unknown$1()).optional()
76926
78422
  }));
76927
78423
  var PipelineModelOptionSchema = object({
76928
78424
  id: string(),
@@ -77070,10 +78566,10 @@ var InferenceCapabilitiesBridge = custom();
77070
78566
  var ModelAvailabilityListBridge = custom();
77071
78567
  method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngineChoiceSchema), method(object({ nodeId: string() }), EngineProvisioningSchema), method(_void(), record$1(string(), object({
77072
78568
  modelId: string(),
77073
- settings: record$1(string(), unknown()).readonly()
78569
+ settings: record$1(string(), unknown$1()).readonly()
77074
78570
  }))), method(object({ steps: record$1(string(), object({
77075
78571
  modelId: string(),
77076
- settings: record$1(string(), unknown()).readonly()
78572
+ settings: record$1(string(), unknown$1()).readonly()
77077
78573
  })) }), object({ success: literal(true) }), {
77078
78574
  kind: "mutation",
77079
78575
  auth: "admin"
@@ -77241,7 +78737,7 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
77241
78737
  * their warmup `runPipeline` reported: the model that actually ran.
77242
78738
  */
77243
78739
  modelId: string().min(1)
77244
- }), record$1(string(), unknown()), { kind: "mutation" }), method(object({ frameId: number$1().int() }), _void(), { kind: "mutation" }), method(object({ deviceKey: string().optional() }), EffectiveTuningSchema), method(_void(), array(object({
78740
+ }), record$1(string(), unknown$1()), { kind: "mutation" }), method(object({ frameId: number$1().int() }), _void(), { kind: "mutation" }), method(object({ deviceKey: string().optional() }), EffectiveTuningSchema), method(_void(), array(object({
77245
78741
  engineKey: string(),
77246
78742
  engine: PipelineEngineChoiceSchema,
77247
78743
  modelsLoaded: array(string()).readonly(),
@@ -77279,7 +78775,7 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
77279
78775
  addonId: string(),
77280
78776
  modelId: string(),
77281
78777
  filename: string().optional(),
77282
- settings: record$1(string(), unknown()).optional()
78778
+ settings: record$1(string(), unknown$1()).optional()
77283
78779
  }), AudioTestResultSchema, { kind: "mutation" }), method(_void(), ConfigUISchemaNullableBridge), NOT_A_DEVICE.PIPELINE;
77284
78780
  object({
77285
78781
  activeCameras: number$1(),
@@ -78269,7 +79765,7 @@ var RunnerFrameSourceSchema = discriminatedUnion("kind", [object({ kind: literal
78269
79765
  */
78270
79766
  var RunnerJumpStepProvisioningSchema = object({
78271
79767
  modelId: string().optional(),
78272
- settings: record$1(string(), unknown()).optional()
79768
+ settings: record$1(string(), unknown$1()).optional()
78273
79769
  });
78274
79770
  /**
78275
79771
  * One ENABLED inference device on the runner's node, as the step-tree
@@ -80482,8 +81978,8 @@ method(_void(), array(TopologyNodeSchema).readonly(), { auth: "admin" }), method
80482
81978
  nodeId: string(),
80483
81979
  addonId: string(),
80484
81980
  queryName: string(),
80485
- params: record$1(string(), unknown()).optional()
80486
- }), unknown(), {
81981
+ params: record$1(string(), unknown$1()).optional()
81982
+ }), unknown$1(), {
80487
81983
  kind: "mutation",
80488
81984
  auth: "admin"
80489
81985
  }), NOT_A_DEVICE.CLUSTER;
@@ -81199,6 +82695,13 @@ var NcSystemEventConditionSchema = object({
81199
82695
  * pick from. The hub refuses an id the action index does not know.
81200
82696
  */
81201
82697
  commandActions: array(string().min(1)).min(1).optional(),
82698
+ /**
82699
+ * `device-attention-*` only: the fault CODES this rule speaks about (the
82700
+ * integration declares them through `error.listFaultTypes`; free text is
82701
+ * accepted too). Absent or empty = any fault. The rule matches when any
82702
+ * fault of the episode is in the list.
82703
+ */
82704
+ faultCodes: array(string().min(1)).optional(),
81202
82705
  /** `device-command` only: how the command settled. A device's own change is not a command. */
81203
82706
  commandOutcomes: array(_enum([
81204
82707
  "confirmed",
@@ -81801,7 +83304,7 @@ var NcRuleTargetSchema = object({
81801
83304
  * Notification (`priority`, `level`, `sound`, `clickUrl`, `ttl`); the
81802
83305
  * degrade engine drops what the backend can't render.
81803
83306
  */
81804
- params: record$1(string(), unknown()).optional()
83307
+ params: record$1(string(), unknown$1()).optional()
81805
83308
  });
81806
83309
  /** Which picture kind one target receives (#487). */
81807
83310
  var NcTargetAttachmentSchema = _enum([
@@ -82610,7 +84113,7 @@ var NcHistorySubjectSchema = object({
82610
84113
  subject: string(),
82611
84114
  title: string(),
82612
84115
  body: string(),
82613
- data: record$1(string(), unknown())
84116
+ data: record$1(string(), unknown$1())
82614
84117
  }).optional()
82615
84118
  });
82616
84119
  /**
@@ -83398,7 +84901,7 @@ var NotifierSendInputSchema = object({
83398
84901
  actions: array(NotifierActionSchema).optional(),
83399
84902
  /** Free-form platform-specific payload — passed through to the
83400
84903
  * upstream service untouched. */
83401
- data: record$1(string(), unknown()).optional()
84904
+ data: record$1(string(), unknown$1()).optional()
83402
84905
  });
83403
84906
  var NotifierSendResultSchema = object({
83404
84907
  /** Provider-assigned id for the delivery. Used for `cancel`. */
@@ -84525,6 +86028,7 @@ var HardwareClassIdSchema = _enum([
84525
86028
  "apple-m-base",
84526
86029
  "apple-m-pro",
84527
86030
  "amd-phoenix",
86031
+ "nvidia-gpu",
84528
86032
  "unknown"
84529
86033
  ]);
84530
86034
  var AcceleratorKindSchema = _enum([
@@ -84532,6 +86036,7 @@ var AcceleratorKindSchema = _enum([
84532
86036
  "intel-igpu",
84533
86037
  "amd-igpu",
84534
86038
  "amd-npu",
86039
+ "nvidia-gpu",
84535
86040
  "x86-cpu",
84536
86041
  "arm-cpu",
84537
86042
  "apple-ane",
@@ -84988,12 +86493,12 @@ var CameraPipelineConfigSchema = object({
84988
86493
  engine: PipelineEngineChoiceSchema.optional(),
84989
86494
  modelId: string().optional(),
84990
86495
  enabled: boolean(),
84991
- settings: record$1(string(), unknown()).readonly().optional()
86496
+ settings: record$1(string(), unknown$1()).readonly().optional()
84992
86497
  }).nullable().optional()
84993
86498
  });
84994
86499
  var DeviceStepConfigSchema = object({
84995
86500
  modelId: string().optional(),
84996
- settings: record$1(string(), unknown()).optional(),
86501
+ settings: record$1(string(), unknown$1()).optional(),
84997
86502
  /**
84998
86503
  * Step-tree device jump (same-node, phase 1) — OPTIONAL manual override.
84999
86504
  * When set, this step runs on the named enabled device of the SAME node
@@ -85052,7 +86557,7 @@ var AgentPipelineSettingsSchema = object({
85052
86557
  * every accelerator of the node under the device's own settings. Never a
85053
86558
  * model or a model-bound threshold. Written by `setNodeStepSettings`.
85054
86559
  */
85055
- stepSettings: record$1(string(), record$1(string(), unknown()).readonly()).optional(),
86560
+ stepSettings: record$1(string(), record$1(string(), unknown$1()).readonly()).optional(),
85056
86561
  /**
85057
86562
  * NODE switch per step (D1065): `stepId → enabled`. `false` = the step never
85058
86563
  * runs on a camera whose pipeline runs on this node (skip reason
@@ -85075,7 +86580,7 @@ var AgentPipelineSettingsSchema = object({
85075
86580
  steps: record$1(string(), DeviceStepConfigSchema).optional()
85076
86581
  })).optional()
85077
86582
  });
85078
- var CameraStepSettingsSchema = record$1(string(), record$1(string(), unknown()).readonly());
86583
+ var CameraStepSettingsSchema = record$1(string(), record$1(string(), unknown$1()).readonly());
85079
86584
  /** The three root-detector choices a camera has (D507: at most one root). */
85080
86585
  var CameraDetectionSourceSchema = _enum([
85081
86586
  "pipeline",
@@ -85718,7 +87223,7 @@ method(object({
85718
87223
  }), method(object({
85719
87224
  agentNodeId: string(),
85720
87225
  addonId: string(),
85721
- settings: record$1(string(), unknown()).nullable()
87226
+ settings: record$1(string(), unknown$1()).nullable()
85722
87227
  }), object({ success: literal(true) }), {
85723
87228
  kind: "mutation",
85724
87229
  auth: "admin"
@@ -85810,7 +87315,7 @@ method(object({
85810
87315
  }), method(object({
85811
87316
  deviceId: number$1(),
85812
87317
  addonId: string(),
85813
- settings: record$1(string(), unknown()).nullable()
87318
+ settings: record$1(string(), unknown$1()).nullable()
85814
87319
  }), object({ success: literal(true) }), {
85815
87320
  kind: "mutation",
85816
87321
  auth: "admin"
@@ -87502,7 +89007,7 @@ var EntryKindInfoSchema = object({
87502
89007
  title: string(),
87503
89008
  nameField: string(),
87504
89009
  /** JSON Schema of the body; `secret: true` marks a password field. */
87505
- fields: record$1(string(), unknown()),
89010
+ fields: record$1(string(), unknown$1()),
87506
89011
  secretPaths: array(string()),
87507
89012
  rows: number$1().int().nonnegative()
87508
89013
  });
@@ -89735,7 +91240,7 @@ var RemoteBindingSchema = object({ action: object({
89735
91240
  deviceId: number$1().int().nonnegative(),
89736
91241
  cap: string().min(1),
89737
91242
  method: string().min(1),
89738
- args: record$1(string(), unknown()).optional(),
91243
+ args: record$1(string(), unknown$1()).optional(),
89739
91244
  /** The unit the person picked per arg (display only); `args` always hold the cap's own unit. */
89740
91245
  argUnits: record$1(string(), string().min(1)).optional()
89741
91246
  }) });
@@ -89871,7 +91376,7 @@ var RemoteConfigSchema = object({
89871
91376
  }
89872
91377
  refineSources(config, ctx);
89873
91378
  });
89874
- looseObject({ sources: array(unknown()) });
91379
+ looseObject({ sources: array(unknown$1()) });
89875
91380
  object({
89876
91381
  id: string(),
89877
91382
  name: string()
@@ -90951,7 +92456,7 @@ var scriptRunnerCapability = {
90951
92456
  /** Optional variables map — passed through to the upstream
90952
92457
  * script. Provider rejects when the script doesn't declare
90953
92458
  * input fields (gated by `DeviceFeature.ScriptVariables`). */
90954
- variables: record$1(string(), unknown()).optional()
92459
+ variables: record$1(string(), unknown$1()).optional()
90955
92460
  }), _void(), {
90956
92461
  kind: "mutation",
90957
92462
  auth: "admin",
@@ -92278,7 +93783,7 @@ method(object({ locationIds: array(string()).readonly() }), array(StorageOccupan
92278
93783
  var ProviderInfoSchema = discriminatedUnion("shouldSaveDiskSpace", [object({
92279
93784
  providerId: string().min(1),
92280
93785
  displayName: string().min(1),
92281
- configSchema: unknown(),
93786
+ configSchema: unknown$1(),
92282
93787
  /** True = provider serves a node-local volume (filesystem): its locations
92283
93788
  * bind to a single node and need a node + path. False = reachable from any
92284
93789
  * node (remote/object store). */
@@ -92288,7 +93793,7 @@ var ProviderInfoSchema = discriminatedUnion("shouldSaveDiskSpace", [object({
92288
93793
  }), object({
92289
93794
  providerId: string().min(1),
92290
93795
  displayName: string().min(1),
92291
- configSchema: unknown(),
93796
+ configSchema: unknown$1(),
92292
93797
  /** True = provider serves a node-local volume (filesystem): its locations
92293
93798
  * bind to a single node and need a node + path. False = reachable from any
92294
93799
  * node (remote/object store). */
@@ -92327,7 +93832,7 @@ var ReadChunkInputSchema = object({
92327
93832
  length: number$1()
92328
93833
  });
92329
93834
  var EndDownloadInputSchema = object({ downloadId: string() });
92330
- method(_void(), ProviderInfoSchema, { auth: "admin" }), method(object({ config: record$1(string(), unknown()) }), TestLocationResultSchema, { auth: "admin" }), method(object({
93835
+ method(_void(), ProviderInfoSchema, { auth: "admin" }), method(object({ config: record$1(string(), unknown$1()) }), TestLocationResultSchema, { auth: "admin" }), method(object({
92331
93836
  location: StorageLocationSchema,
92332
93837
  relativePath: string()
92333
93838
  }), string(), { auth: "admin" }), method(object({
@@ -92404,7 +93909,16 @@ var CamStreamDescriptorSchema = object({
92404
93909
  /** The slot the publisher says this stream IS — see `CameraStreamSchema.profileHint`. */
92405
93910
  profileHint: CamProfileSchema.optional(),
92406
93911
  /** Transport-specific opaque metadata (e.g. rfc4571 SDP). */
92407
- metadata: record$1(string(), unknown()).optional()
93912
+ metadata: record$1(string(), unknown$1()).optional(),
93913
+ /**
93914
+ * The longest continuous session the SOURCE will keep open, in ms, declared by
93915
+ * the provider that knows it (a hub that cuts every child's session on a
93916
+ * timer). Absent = no limit. The broker re-dials a live source a little
93917
+ * BEFORE this elapses, on its own terms and announced to consumers, so the
93918
+ * source's cut never lands mid-recording. Declare slightly under what was
93919
+ * observed.
93920
+ */
93921
+ maxSessionMs: number$1().int().positive().optional()
92408
93922
  });
92409
93923
  /**
92410
93924
  * `stream-catalog` — device-scoped, provider-implemented. The pull counterpart
@@ -92609,7 +94123,7 @@ var streamParamsCapability = {
92609
94123
  * companion Zod schema, and a concrete object would collapse
92610
94124
  * unrelated AppRouter branches to `unknown` during codegen.
92611
94125
  */
92612
- getConfigSchema: method(object({ deviceId: number$1() }), unknown().nullable())
94126
+ getConfigSchema: method(object({ deviceId: number$1() }), unknown$1().nullable())
92613
94127
  },
92614
94128
  status: {
92615
94129
  schema: StreamParamsStatusSchema,
@@ -93637,7 +95151,7 @@ var DebugWatchResultSchema = object({
93637
95151
  /** Channels a `rearm` found already lapsed: nothing was revived. */
93638
95152
  lapsed: array(string()).readonly()
93639
95153
  });
93640
- method(_void(), SystemInfoSchema), method(_void(), HealthStatusSchema), method(_void(), FeatureManifestSchema), method(_void(), array(NetworkAddressSchema).readonly()), method(_void(), unknown().nullable(), { auth: "admin" }), method(record$1(string(), unknown()), _null(), {
95154
+ method(_void(), SystemInfoSchema), method(_void(), HealthStatusSchema), method(_void(), FeatureManifestSchema), method(_void(), array(NetworkAddressSchema).readonly()), method(_void(), unknown$1().nullable(), { auth: "admin" }), method(record$1(string(), unknown$1()), _null(), {
93641
95155
  kind: "mutation",
93642
95156
  auth: "admin"
93643
95157
  }), method(_void(), _void(), {
@@ -93987,7 +95501,7 @@ var TemplateRowItemBindingSchema = discriminatedUnion("kind", [
93987
95501
  input: inputKey,
93988
95502
  /** The list the nested rows are appended to, from the parent row's item. */
93989
95503
  path: TemplatePathSchema,
93990
- item: unknown(),
95504
+ item: unknown$1(),
93991
95505
  bindings: array(TemplateLeafRowBindingSchema).max(40)
93992
95506
  })
93993
95507
  ]);
@@ -94005,7 +95519,7 @@ var TemplateBindingSchema = discriminatedUnion("kind", [
94005
95519
  /** The list in the body the rows are appended to. */
94006
95520
  path: TemplatePathSchema,
94007
95521
  /** The JSON copied once per row. */
94008
- item: unknown(),
95522
+ item: unknown$1(),
94009
95523
  bindings: array(TemplateRowItemBindingSchema).max(40)
94010
95524
  }),
94011
95525
  object({
@@ -94147,7 +95661,7 @@ var AutomationTemplatePayloadSchema = object({
94147
95661
  version: literal(1),
94148
95662
  description: string().max(500).optional(),
94149
95663
  /** The automation body; a recipe once the inputs are written into it. */
94150
- body: record$1(string(), unknown()),
95664
+ body: record$1(string(), unknown$1()),
94151
95665
  inputs: array(TemplateInputSchema).max(30),
94152
95666
  bindings: array(TemplateBindingSchema).max(100)
94153
95667
  }).superRefine(bindingProblems);
@@ -94176,7 +95690,7 @@ var TemplateRecordSchema = object({
94176
95690
  kind: TemplateKindSchema,
94177
95691
  name: string().min(1).max(120),
94178
95692
  /** Shaped by the kind; `checkTemplatePayload(kind, payload)` reads it. */
94179
- payload: unknown(),
95693
+ payload: unknown$1(),
94180
95694
  createdAt: number$1(),
94181
95695
  updatedAt: number$1(),
94182
95696
  /** Shipped with CamStack (`builtin:` ids): listed beside the operator's, never updated or deleted. */
@@ -94219,7 +95733,7 @@ var TemplateDeleteResultSchema = discriminatedUnion("status", [
94219
95733
  method(object({ kind: TemplateKindSchema.optional() }), array(TemplateRecordSchema), { auth: "protected" }), method(object({ id: string().min(1) }), TemplateRecordSchema.nullable(), { auth: "protected" }), method(object({
94220
95734
  kind: TemplateKindSchema,
94221
95735
  name: string().min(1).max(120),
94222
- payload: unknown(),
95736
+ payload: unknown$1(),
94223
95737
  tags: TagsFieldSchema.optional()
94224
95738
  }), TemplateWriteResultSchema, {
94225
95739
  kind: "mutation",
@@ -94227,7 +95741,7 @@ method(object({ kind: TemplateKindSchema.optional() }), array(TemplateRecordSche
94227
95741
  }), method(object({
94228
95742
  id: string().min(1),
94229
95743
  name: string().min(1).max(120).optional(),
94230
- payload: unknown().optional(),
95744
+ payload: unknown$1().optional(),
94231
95745
  tags: TagsFieldSchema.optional()
94232
95746
  }), TemplateWriteResultSchema, {
94233
95747
  kind: "mutation",
@@ -94237,7 +95751,7 @@ method(object({ kind: TemplateKindSchema.optional() }), array(TemplateRecordSche
94237
95751
  auth: "admin"
94238
95752
  });
94239
95753
  /** Profile-exported FormBuilder schema. Shape is ConfigUISchema at the UI. */
94240
- var ProfileSettingsSchemaBridge = unknown().nullable();
95754
+ var ProfileSettingsSchemaBridge = unknown$1().nullable();
94241
95755
  /**
94242
95756
  * A live terminal session hosted by the provider addon. Output and input do
94243
95757
  * NOT flow through the capability — they use the addon data plane
@@ -94438,7 +95952,7 @@ var TrainingProviderDefaultsSchema = object({
94438
95952
  * `TargetKind.configSchema` (`z.unknown()` at the wire; callers tighten to
94439
95953
  * {@link ConfigUISchema}). Drives `ConfigFormBuilder` on Training → Providers.
94440
95954
  */
94441
- var ConfigSchemaPassthrough = unknown();
95955
+ var ConfigSchemaPassthrough = unknown$1();
94442
95956
  /** One creatable provider type, for the Add-entry dialog. */
94443
95957
  var TrainingProviderTypeSchema = object({
94444
95958
  typeId: string(),
@@ -94488,7 +96002,7 @@ var TrainingProviderDescriptorSchema = object({
94488
96002
  * fields are keychain {@link SecretFieldView} or `null` / `''` (create),
94489
96003
  * never plaintext. Same hydrate contract as settings forms (D789).
94490
96004
  */
94491
- formValues: record$1(string(), unknown()).optional()
96005
+ formValues: record$1(string(), unknown$1()).optional()
94492
96006
  });
94493
96007
  var ProviderJobStateSchema = _enum([
94494
96008
  "pending",
@@ -95245,14 +96759,14 @@ var PasskeySummarySchema = object({
95245
96759
  method(object({
95246
96760
  userId: string(),
95247
96761
  username: string()
95248
- }), object({ optionsJSON: record$1(string(), unknown()) }), {
96762
+ }), object({ optionsJSON: record$1(string(), unknown$1()) }), {
95249
96763
  kind: "mutation",
95250
96764
  auth: "admin",
95251
96765
  access: "create"
95252
96766
  }), method(object({
95253
96767
  userId: string(),
95254
96768
  /** RegistrationResponseJSON from the browser. */
95255
- response: record$1(string(), unknown()),
96769
+ response: record$1(string(), unknown$1()),
95256
96770
  /** Operator-visible label (e.g. "MacBook Touch ID"). */
95257
96771
  label: string()
95258
96772
  }), object({
@@ -95262,7 +96776,7 @@ method(object({
95262
96776
  kind: "mutation",
95263
96777
  auth: "admin",
95264
96778
  access: "create"
95265
- }), method(object({ userId: string().optional() }), object({ optionsJSON: record$1(string(), unknown()) }), {
96779
+ }), method(object({ userId: string().optional() }), object({ optionsJSON: record$1(string(), unknown$1()) }), {
95266
96780
  kind: "mutation",
95267
96781
  access: "view",
95268
96782
  auth: "admin"
@@ -95270,18 +96784,18 @@ method(object({
95270
96784
  /** Required — the user the assertion belongs to (verified). */
95271
96785
  userId: string(),
95272
96786
  /** AuthenticationResponseJSON from the browser. */
95273
- response: record$1(string(), unknown())
96787
+ response: record$1(string(), unknown$1())
95274
96788
  }), object({ verified: boolean() }), {
95275
96789
  kind: "mutation",
95276
96790
  access: "view",
95277
96791
  auth: "admin"
95278
- }), method(object({}), object({ optionsJSON: record$1(string(), unknown()) }), {
96792
+ }), method(object({}), object({ optionsJSON: record$1(string(), unknown$1()) }), {
95279
96793
  kind: "mutation",
95280
96794
  access: "view",
95281
96795
  auth: "admin"
95282
96796
  }), method(object({
95283
96797
  /** AuthenticationResponseJSON from the browser. */
95284
- response: record$1(string(), unknown()) }), object({
96798
+ response: record$1(string(), unknown$1()) }), object({
95285
96799
  verified: boolean(),
95286
96800
  userId: string().nullable()
95287
96801
  }), {
@@ -98706,6 +100220,20 @@ function deviceErrorEdge(previous, next) {
98706
100220
  function deviceErrorAlertId(deviceId) {
98707
100221
  return `device-error:${String(deviceId)}`;
98708
100222
  }
100223
+ /** Every active fault, the principal first; a status that lists none still names its principal. */
100224
+ function activeFaults(status) {
100225
+ if (status.faults !== void 0 && status.faults.length > 0) return status.faults.map(({ code, label, severity }) => ({
100226
+ code,
100227
+ label,
100228
+ severity
100229
+ }));
100230
+ if (status.code === null) return [];
100231
+ return [{
100232
+ code: status.code,
100233
+ label: status.label ?? status.code,
100234
+ severity: status.severity
100235
+ }];
100236
+ }
98709
100237
  /** The alert that opens an episode. `since` is the fault's own start, else `now`. */
98710
100238
  function buildDeviceErrorAlert(deviceId, deviceName, status, now) {
98711
100239
  const label = status.label ?? status.code ?? "Fault";
@@ -98733,7 +100261,9 @@ function buildDeviceErrorAlert(deviceId, deviceName, status, now) {
98733
100261
  metadata: {
98734
100262
  episodeId: `${alertId}@${String(startedAt)}`,
98735
100263
  code: status.code,
98736
- deviceSeverity: status.severity
100264
+ deviceSeverity: status.severity,
100265
+ label: status.label,
100266
+ faults: activeFaults(status)
98737
100267
  }
98738
100268
  };
98739
100269
  }
@@ -98743,6 +100273,8 @@ var BaseDevice = class {
98743
100273
  type;
98744
100274
  /** True when another process owns the base slices (`options.deviceStatus: 'external'`). */
98745
100275
  statusIsExternal;
100276
+ /** The fault catalog the integration declared; `[]` until it does. */
100277
+ faultTypes = [];
98746
100278
  name;
98747
100279
  parentDeviceId;
98748
100280
  role;
@@ -99080,10 +100612,19 @@ var BaseDevice = class {
99080
100612
  * a restart is compared, not announced again.
99081
100613
  */
99082
100614
  registerErrorCap() {
99083
- this.ctx.registerNativeCap?.(errorCapability, {});
100615
+ this.ctx.registerNativeCap?.(errorCapability, { listFaultTypes: async () => ({ types: [...this.faultTypes] }) });
99084
100616
  if (this.runtimeState.getCapState(errorCapability.name) === void 0) this.setCapSlice(errorCapability, ERROR_STATUS_COLD);
99085
100617
  }
99086
100618
  /**
100619
+ * Declare the fault kinds this device's integration can raise (code, label,
100620
+ * severity), served by `error.listFaultTypes` so a rule's code picker is
100621
+ * offered the integration's own words. The default is `[]`; a fault outside
100622
+ * the catalog is still published. Call it before or after `registerErrorCap`.
100623
+ */
100624
+ declareFaultTypes(types) {
100625
+ this.faultTypes = types.map((type) => ({ ...type }));
100626
+ }
100627
+ /**
99087
100628
  * Publish the device's fault. The slice is written; on an EDGE (a fault
99088
100629
  * starts, or one resolves) an attention episode opens or closes through the
99089
100630
  * alerts cap, which the notification center announces as
@@ -99342,147 +100883,6 @@ var BaseDevice = class {
99342
100883
  }
99343
100884
  };
99344
100885
  /**
99345
- * Delays before retry rounds 1..N — the round count IS the bound.
99346
- * 10 s catches "the hub was busy for a moment"; the full schedule
99347
- * (10 + 30 + 90 s of waiting, plus up to one 60 s transport timeout
99348
- * per attempt) covers a device-manager lock held for minutes — the
99349
- * 2026-09-04 outage's migration hold was ~3.5 min.
99350
- */
99351
- var DEVICE_RESTORE_RETRY_DELAYS_MS = [
99352
- 1e4,
99353
- 3e4,
99354
- 9e4
99355
- ];
99356
- /** Abortable sleep — resolves early (never rejects) on abort. */
99357
- function sleep$1(ms, signal) {
99358
- return new Promise((resolve) => {
99359
- if (signal.aborted) {
99360
- resolve();
99361
- return;
99362
- }
99363
- const onAbort = () => {
99364
- clearTimeout(timer);
99365
- resolve();
99366
- };
99367
- const timer = setTimeout(() => {
99368
- signal.removeEventListener("abort", onAbort);
99369
- resolve();
99370
- }, ms);
99371
- timer.unref?.();
99372
- signal.addEventListener("abort", onAbort, { once: true });
99373
- });
99374
- }
99375
- /** Drain `items` through at most `width` concurrent lanes. `fn` must
99376
- * not reject (callers wrap their own try/catch). */
99377
- async function runWithConcurrency(items, width, fn) {
99378
- const queue = [...items];
99379
- const laneCount = Math.max(1, Math.min(width, queue.length));
99380
- const lane = async () => {
99381
- for (;;) {
99382
- const item = queue.shift();
99383
- if (item === void 0) return;
99384
- await fn(item);
99385
- }
99386
- };
99387
- await Promise.all(Array.from({ length: laneCount }, lane));
99388
- }
99389
- var DeviceRestoreRetryScheduler = class {
99390
- #logger;
99391
- #attempt;
99392
- #onPermanentFailure;
99393
- #delaysMs;
99394
- #concurrency;
99395
- #now;
99396
- #abort = new AbortController();
99397
- constructor(options) {
99398
- this.#logger = options.logger;
99399
- this.#attempt = options.attempt;
99400
- this.#onPermanentFailure = options.onPermanentFailure;
99401
- this.#delaysMs = options.delaysMs ?? DEVICE_RESTORE_RETRY_DELAYS_MS;
99402
- this.#concurrency = options.concurrency ?? 4;
99403
- this.#now = options.now ?? Date.now;
99404
- }
99405
- /** Stop retrying (shutdown). Pending entries are NOT marked
99406
- * permanently failed — the next boot restores them from disk. */
99407
- cancel() {
99408
- this.#abort.abort();
99409
- }
99410
- /**
99411
- * Run the bounded retry rounds. Resolves when every entry has either
99412
- * restored, been marked permanently failed, or the scheduler was
99413
- * cancelled. Never rejects.
99414
- */
99415
- async run(initialFailures) {
99416
- let pending = initialFailures.map((failure) => ({
99417
- saved: failure.saved,
99418
- lastError: failure.error,
99419
- attempts: 1
99420
- }));
99421
- for (let round = 0; round < this.#delaysMs.length; round += 1) {
99422
- if (pending.length === 0 || this.#abort.signal.aborted) break;
99423
- await sleep$1(this.#delaysMs[round] ?? 0, this.#abort.signal);
99424
- if (this.#abort.signal.aborted) break;
99425
- pending = await this.#runRound(pending, round);
99426
- }
99427
- if (this.#abort.signal.aborted) return [];
99428
- const terminal = pending.map((entry) => ({
99429
- deviceId: entry.saved.id,
99430
- stableId: entry.saved.stableId,
99431
- type: String(entry.saved.type),
99432
- attempts: entry.attempts,
99433
- lastError: entry.lastError,
99434
- failedAt: this.#now()
99435
- }));
99436
- for (const failure of terminal) this.#onPermanentFailure(failure);
99437
- return terminal;
99438
- }
99439
- /** One retry round: parents first (phase 0), then hub-adopted
99440
- * children (phase 1) — a child's attempt depends on its parent
99441
- * having landed, exactly like the initial two-pass restore. */
99442
- async #runRound(pending, round) {
99443
- const next = [];
99444
- const parents = pending.filter((entry) => entry.saved.parentDeviceId === null);
99445
- const children = pending.filter((entry) => entry.saved.parentDeviceId !== null);
99446
- for (const phase of [parents, children]) await runWithConcurrency(phase, this.#concurrency, async (entry) => {
99447
- if (this.#abort.signal.aborted) {
99448
- next.push(entry);
99449
- return;
99450
- }
99451
- const attemptNo = entry.attempts + 1;
99452
- try {
99453
- await this.#attempt(entry.saved);
99454
- this.#logger.info("Device restored on retry", {
99455
- tags: {
99456
- deviceId: entry.saved.id,
99457
- stableId: entry.saved.stableId
99458
- },
99459
- meta: { attempt: attemptNo }
99460
- });
99461
- } catch (err) {
99462
- const lastError = err instanceof Error ? err.message : String(err);
99463
- const remainingRetries = this.#delaysMs.length - (round + 1);
99464
- this.#logger.warn("Device restore retry failed", {
99465
- tags: {
99466
- deviceId: entry.saved.id,
99467
- stableId: entry.saved.stableId
99468
- },
99469
- meta: {
99470
- attempt: attemptNo,
99471
- remainingRetries,
99472
- error: lastError
99473
- }
99474
- });
99475
- next.push({
99476
- saved: entry.saved,
99477
- lastError,
99478
- attempts: attemptNo
99479
- });
99480
- }
99481
- });
99482
- return next;
99483
- }
99484
- };
99485
- /**
99486
100886
  * Convert an IDevice to the flat DeviceSummary shape expected by the
99487
100887
  * device-provider cap router. Shared across all providers.
99488
100888
  */
@@ -100137,7 +101537,7 @@ var asAction = (a) => ({
100137
101537
  kind: "action",
100138
101538
  action: a
100139
101539
  });
100140
- function reading$1(source, state, assumed = false, title) {
101540
+ function reading$2(source, state, assumed = false, title) {
100141
101541
  return title === void 0 ? {
100142
101542
  source,
100143
101543
  state,
@@ -100240,7 +101640,7 @@ var lockContribution = contribution("lock-control", LockControlStatusSchema, (sl
100240
101640
  const since = slice === void 0 ? null : elapsedText(slice.lastChangedAt, ctx.now);
100241
101641
  const title = words?.title ?? NOT_REPORTED;
100242
101642
  return {
100243
- reading: reading$1("lock-control", words?.state ?? "unknown", false, words?.title),
101643
+ reading: reading$2("lock-control", words?.state ?? "unknown", false, words?.title),
100244
101644
  rows: [row$1("lock", state === "locked" || state === "locking" ? "lock" : "lock-open", joinText([title, since]), lockControls(state, ctx.features.includes(DeviceFeature.LockOpen)))],
100245
101645
  ...since === null || words === null ? {} : { facts: [fact("since", "clock", since, "muted")] },
100246
101646
  ...words === null ? {} : { tiles: { left: [{
@@ -100329,7 +101729,7 @@ var ACCESS_FAMILY_CONTRIBUTIONS = {
100329
101729
  const since = slice === void 0 ? null : elapsedText(slice.lastChangedAt, ctx.now);
100330
101730
  const modes = slice === void 0 ? ALARM_MODES : slice.availableModes;
100331
101731
  return {
100332
- reading: reading$1("alarm-panel", words?.state ?? "unknown", false, words?.title),
101732
+ reading: reading$2("alarm-panel", words?.state ?? "unknown", false, words?.title),
100333
101733
  rows: [row$1("alarm", state === "triggered" ? "shield-alert" : state === "disarmed" ? "shield-off" : "shield-check", joinText([words?.title ?? NOT_REPORTED, since]), alarmControls(state, modes, slice?.codeRequired !== false))],
100334
101734
  ...since === null || words === null ? {} : { facts: [fact("since", "clock", since, state === "triggered" ? "danger" : "muted")] },
100335
101735
  ...words === null ? {} : { tiles: {
@@ -100359,7 +101759,7 @@ var ACCESS_FAMILY_CONTRIBUTIONS = {
100359
101759
  turnOff: action("automation.disable", t("Disable", "Disattiva"), "square", "automation-control", "disable")
100360
101760
  };
100361
101761
  return {
100362
- reading: reading$1("automation-control", state, false, title),
101762
+ reading: reading$2("automation-control", state, false, title),
100363
101763
  rows: [row$1("automation", "workflow", joinText([
100364
101764
  title ?? NOT_REPORTED,
100365
101765
  last === null ? null : t(`Ran ${last.en}`, `Eseguita ${last.it}`),
@@ -100375,7 +101775,7 @@ var ACCESS_FAMILY_CONTRIBUTIONS = {
100375
101775
  const last = slice === void 0 ? null : elapsedText(slice.lastRunAt, ctx.now);
100376
101776
  const control = slice?.isRunning === true ? action("script.stop", t("Stop", "Ferma"), "square", "script-runner", "stop", {}, "primary") : action("script.run", t("Run", "Esegui"), "play", "script-runner", "run", {}, "primary");
100377
101777
  return {
100378
- reading: reading$1("script-runner", state, false, title),
101778
+ reading: reading$2("script-runner", state, false, title),
100379
101779
  rows: [row$1("script", "scroll-text", joinText([
100380
101780
  title ?? NOT_REPORTED,
100381
101781
  last === null ? null : t(`Ran ${last.en}`, `Eseguito ${last.it}`),
@@ -100471,7 +101871,7 @@ var fanContribution = contribution("fan-control", FanControlStatusSchema, (slice
100471
101871
  const preset = slice?.preset ?? "";
100472
101872
  const status = speed === null ? unknownText : joinText([speed === 0 ? t("Off", "Spento") : t(`Speed ${speed}%`, `Velocità ${speed}%`), preset === "" ? null : t(preset, preset)]);
100473
101873
  return {
100474
- reading: reading$1("fan-control", state),
101874
+ reading: reading$2("fan-control", state),
100475
101875
  rows: [{
100476
101876
  id: "fan",
100477
101877
  icon: "fan",
@@ -100586,7 +101986,7 @@ var vacuumContribution = contribution("vacuum-control", VacuumControlStatusSchem
100586
101986
  controls
100587
101987
  }, ...suctionRows];
100588
101988
  return {
100589
- reading: reading$1("vacuum-control", words?.state ?? "unknown", false, title),
101989
+ reading: reading$2("vacuum-control", words?.state ?? "unknown", false, title),
100590
101990
  rows: vacuumRows,
100591
101991
  facts: [...ownBattery(slice?.batteryLevel ?? null, ctx), ...progress === null ? [] : [fact("progress", "activity", pct$2(progress), "primary")]],
100592
101992
  ...suction.length === 0 && progress === null ? {} : { tiles: { right: [...suction, ...progress === null ? [] : [{
@@ -100642,7 +102042,7 @@ var mowerContribution = contribution("lawn-mower-control", LawnMowerControlStatu
100642
102042
  const title = activity === "error" && slice?.currentCodeLabel ? t(slice.currentCodeLabel, slice.currentCodeLabel) : words?.title;
100643
102043
  const progress = activity === "mowing" ? slice?.progress ?? null : null;
100644
102044
  return {
100645
- reading: reading$1("lawn-mower-control", words?.state ?? "unknown", false, title),
102045
+ reading: reading$2("lawn-mower-control", words?.state ?? "unknown", false, title),
100646
102046
  rows: [{
100647
102047
  id: "mower",
100648
102048
  icon: "sprout",
@@ -100712,7 +102112,7 @@ var feederContribution = contribution("pet-feeder", PetFeederStatusSchema, (slic
100712
102112
  const words = feederWords(slice);
100713
102113
  const last = slice?.lastFeedGrams ?? null;
100714
102114
  return {
100715
- reading: reading$1("pet-feeder", words?.state ?? "unknown", false, words?.title),
102115
+ reading: reading$2("pet-feeder", words?.state ?? "unknown", false, words?.title),
100716
102116
  rows: [{
100717
102117
  id: "feeder",
100718
102118
  icon: "bone",
@@ -100749,7 +102149,7 @@ var fountainContribution = contribution("pet-fountain", PetFountainStatusSchema,
100749
102149
  turnOff: action("fountain.pump.off", t("Pump off", "Spegni la pompa"), "square", "pet-fountain", "setPump", { on: false })
100750
102150
  };
100751
102151
  return {
100752
- reading: reading$1("pet-fountain", state, false, title),
102152
+ reading: reading$2("pet-fountain", state, false, title),
100753
102153
  rows: [{
100754
102154
  id: "fountain",
100755
102155
  icon: "droplets",
@@ -100817,9 +102217,9 @@ var DEVICES_FAMILY_CONTRIBUTIONS = {
100817
102217
  "pump-cycle": pumpCycleContribution,
100818
102218
  workload: contribution("workload", WorkloadStatusSchema, (slice) => {
100819
102219
  const state = slice?.state ?? null;
100820
- if (state === null) return { reading: reading$1("workload", "unknown") };
102220
+ if (state === null) return { reading: reading$2("workload", "unknown") };
100821
102221
  const words = WORKLOAD_WORDS[state];
100822
- return { reading: reading$1("workload", words.state, false, words.title) };
102222
+ return { reading: reading$2("workload", words.state, false, words.title) };
100823
102223
  })
100824
102224
  };
100825
102225
  /**
@@ -100833,7 +102233,7 @@ var pct$1 = (n) => t(`${Math.round(n)}%`, `${Math.round(n)}%`);
100833
102233
  var brightnessContribution = contribution("brightness", BrightnessStatusSchema, (slice) => {
100834
102234
  const level = slice?.level ?? null;
100835
102235
  return {
100836
- ...level === null ? {} : { reading: reading$1("brightness", level > 0 ? "on" : "off") },
102236
+ ...level === null ? {} : { reading: reading$2("brightness", level > 0 ? "on" : "off") },
100837
102237
  ...level === null ? {} : {
100838
102238
  facts: [fact("level", "sun-dim", pct$1(level), level > 0 ? "primary" : "muted")],
100839
102239
  scene: { level: level / 100 },
@@ -101025,7 +102425,7 @@ function positionSlider(s, position) {
101025
102425
  }
101026
102426
  function travelFragment(s, state, position, tilt, ctx) {
101027
102427
  if (state === void 0) return {
101028
- reading: reading$1(s.source, "unknown"),
102428
+ reading: reading$2(s.source, "unknown"),
101029
102429
  rows: [row$1(s.rowId, "arrow-up", null, travelActions(s, void 0, false).map(asAction))]
101030
102430
  };
101031
102431
  const words = travelWords(state, position);
@@ -101048,7 +102448,7 @@ function travelFragment(s, state, position, tilt, ctx) {
101048
102448
  valueArg: "tiltPosition"
101049
102449
  });
101050
102450
  return {
101051
- reading: reading$1(s.source, words.state, false, words.title),
102451
+ reading: reading$2(s.source, words.state, false, words.title),
101052
102452
  ...position === null ? {} : { facts: [fact("level", "arrow-up-down", pct$1(position))] },
101053
102453
  ...position === null ? {} : { tiles: { left: [{
101054
102454
  label: t("Opening", "Apertura"),
@@ -101079,7 +102479,7 @@ var ACTUATORS_FAMILY_CONTRIBUTIONS = {
101079
102479
  positionable: has$2(ctx, DeviceFeature.ValvePositionable)
101080
102480
  }, slice?.state, slice?.position ?? null, null, ctx)),
101081
102481
  humidifier: contribution("humidifier", HumidifierStatusSchema, (slice) => {
101082
- if (slice === void 0) return { reading: reading$1("humidifier", "unknown") };
102482
+ if (slice === void 0) return { reading: reading$2("humidifier", "unknown") };
101083
102483
  const action_ = slice.action;
101084
102484
  let state = "off";
101085
102485
  let title = t("Off", "Spento");
@@ -101135,7 +102535,7 @@ var ACTUATORS_FAMILY_CONTRIBUTIONS = {
101135
102535
  });
101136
102536
  const now = slice.currentHumidity;
101137
102537
  return {
101138
- reading: reading$1("humidifier", state, false, title),
102538
+ reading: reading$2("humidifier", state, false, title),
101139
102539
  ...now === null ? {} : { facts: [fact("level", "droplets", pct$1(now), "info")] },
101140
102540
  ...slice.targetHumidity === null ? {} : { tiles: { right: [{
101141
102541
  label: t("Target", "Obiettivo"),
@@ -101148,8 +102548,8 @@ var ACTUATORS_FAMILY_CONTRIBUTIONS = {
101148
102548
  };
101149
102549
  var GROUPS_FAMILY_CONTRIBUTIONS = {
101150
102550
  "group-active": contribution("group-active", GroupActiveSchema, (slice) => {
101151
- if (slice === void 0) return { reading: reading$1("group-active", "unknown") };
101152
- return { reading: reading$1("group-active", slice.active ? "on" : "off", false, slice.active ? t("Active", "Attivo") : t("Inactive", "Non attivo")) };
102551
+ if (slice === void 0) return { reading: reading$2("group-active", "unknown") };
102552
+ return { reading: reading$2("group-active", slice.active ? "on" : "off", false, slice.active ? t("Active", "Attivo") : t("Inactive", "Non attivo")) };
101153
102553
  }),
101154
102554
  "group-status": contribution("group-status", GroupStatusSchema, (slice) => {
101155
102555
  if (slice === void 0) return {};
@@ -101170,11 +102570,11 @@ var GROUPS_FAMILY_CONTRIBUTIONS = {
101170
102570
  return { facts: [fact("failures", "triangle-alert", t(`${failed} of ${total} failed`, `${failed} di ${total} falliti`), "danger")] };
101171
102571
  }),
101172
102572
  "event-emitter": contribution("event-emitter", EventEmitterStatusSchema, (slice, ctx) => {
101173
- if (slice === void 0) return { reading: reading$1("event-emitter", "unknown") };
102573
+ if (slice === void 0) return { reading: reading$2("event-emitter", "unknown") };
101174
102574
  const last = slice.lastEvent;
101175
102575
  const ago = last === null ? null : elapsedText(last.timestamp, ctx.now);
101176
102576
  return {
101177
- reading: reading$1("event-emitter", "idle", false, t("Listening", "In ascolto")),
102577
+ reading: reading$2("event-emitter", "idle", false, t("Listening", "In ascolto")),
101178
102578
  ...last === null ? {} : { facts: [fact("event", "radio-tower", ago === null ? t(last.eventType, last.eventType) : t(`${last.eventType} · ${ago.en}`, `${last.eventType} · ${ago.it}`), "primary")] },
101179
102579
  tiles: { right: [{
101180
102580
  label: t("Events", "Eventi"),
@@ -101202,11 +102602,11 @@ function sinceFact(at, now, tone = "muted") {
101202
102602
  }
101203
102603
  function detection(spec) {
101204
102604
  return contribution(spec.cap, spec.schema, (slice, ctx) => {
101205
- if (slice === void 0) return { reading: reading$1(spec.source, "unknown") };
102605
+ if (slice === void 0) return { reading: reading$2(spec.source, "unknown") };
101206
102606
  const tripped = spec.flag(slice);
101207
102607
  const changed = spec.changedAt(slice);
101208
102608
  return {
101209
- reading: reading$1(spec.source, tripped ? spec.yesState : "idle", false, tripped ? spec.words.yes : spec.words.no),
102609
+ reading: reading$2(spec.source, tripped ? spec.yesState : "idle", false, tripped ? spec.words.yes : spec.words.no),
101210
102610
  facts: sinceFact(changed === 0 ? null : changed, ctx.now, tripped ? "danger" : "muted")
101211
102611
  };
101212
102612
  });
@@ -101288,16 +102688,16 @@ var binaryContribution = detection({
101288
102688
  changedAt: (s) => s.lastChangedAt
101289
102689
  });
101290
102690
  var motionContribution = contribution("motion", MotionStatusSchema, (slice, ctx) => {
101291
- if (slice === void 0) return { reading: reading$1("motion", "unknown") };
102691
+ if (slice === void 0) return { reading: reading$2("motion", "unknown") };
101292
102692
  const last = slice.lastDetectedAt;
101293
102693
  const ago = last === null ? null : elapsedText(last, ctx.now);
101294
102694
  return {
101295
- reading: reading$1("motion", slice.detected ? "on" : "idle", false, slice.detected ? detected.yes : t("Clear", "Nessun movimento")),
102695
+ reading: reading$2("motion", slice.detected ? "on" : "idle", false, slice.detected ? detected.yes : t("Clear", "Nessun movimento")),
101296
102696
  ...ago === null ? {} : { facts: [fact("since", "clock", t(`Last motion ${ago.en}`, `Ultimo movimento ${ago.it}`), slice.detected ? "primary" : "muted")] }
101297
102697
  };
101298
102698
  });
101299
102699
  var presenceContribution = contribution("presence", PresenceStatusSchema, (slice, ctx) => {
101300
- if (slice === void 0) return { reading: reading$1("presence", "unknown") };
102700
+ if (slice === void 0) return { reading: reading$2("presence", "unknown") };
101301
102701
  const zone = slice.state;
101302
102702
  const home = zone === "home";
101303
102703
  const away = zone === "not_home";
@@ -101306,30 +102706,30 @@ var presenceContribution = contribution("presence", PresenceStatusSchema, (slice
101306
102706
  if (slice.location !== null && slice.location !== "") facts.push(fact("reading", "map-pin", t(slice.location, slice.location)));
101307
102707
  facts.push(...sinceFact(slice.lastChangedAt === 0 ? null : slice.lastChangedAt, ctx.now));
101308
102708
  return {
101309
- reading: reading$1("presence", away ? "off" : "on", false, title),
102709
+ reading: reading$2("presence", away ? "off" : "on", false, title),
101310
102710
  facts
101311
102711
  };
101312
102712
  });
101313
102713
  /** A ring this recent still reads as "ringing". */
101314
102714
  var RINGING_MS = 3e4;
101315
102715
  var doorbellContribution = contribution("doorbell", DoorbellStatusSchema, (slice, ctx) => {
101316
- if (slice === void 0) return { reading: reading$1("doorbell", "unknown") };
102716
+ if (slice === void 0) return { reading: reading$2("doorbell", "unknown") };
101317
102717
  const last = slice.lastPressedAt;
101318
102718
  const ago = last === null ? null : elapsedText(last, ctx.now);
101319
102719
  const ringing = last !== null && ctx.now >= last && ctx.now - last < RINGING_MS;
101320
102720
  const title = ringing ? t("Ringing", "Suona") : ago === null ? t("No ring yet", "Nessun squillo") : t(`Last ring ${ago.en}`, `Ultimo squillo ${ago.it}`);
101321
102721
  const count = slice.pressCountSinceStart;
101322
102722
  return {
101323
- ...ctx.caps.includes("motion") && !ringing ? {} : { reading: reading$1("doorbell", ringing ? "on" : "idle", false, title) },
102723
+ ...ctx.caps.includes("motion") && !ringing ? {} : { reading: reading$2("doorbell", ringing ? "on" : "idle", false, title) },
101324
102724
  facts: [...ctx.caps.includes("motion") && !ringing ? [fact("event", "bell", title)] : [], ...count > 0 ? [fact("event", "bell-ring", t(`${count} ring${count === 1 ? "" : "s"}`, `${count} squilli`))] : []]
101325
102725
  };
101326
102726
  });
101327
102727
  var number = (n) => `${Number(n.toFixed(2))}`;
101328
102728
  var meterContribution = contribution("meter", MeterStatusSchema, (slice, ctx) => {
101329
- if (slice === void 0 || slice.value === null) return { reading: reading$1("meter", "unknown") };
102729
+ if (slice === void 0 || slice.value === null) return { reading: reading$2("meter", "unknown") };
101330
102730
  const value = number(slice.value);
101331
102731
  return {
101332
- reading: reading$1("meter", "idle", false, t(value, value)),
102732
+ reading: reading$2("meter", "idle", false, t(value, value)),
101333
102733
  facts: sinceFact(slice.lastFetchedAt === 0 ? null : slice.lastFetchedAt, ctx.now)
101334
102734
  };
101335
102735
  });
@@ -101351,12 +102751,12 @@ var CONDITION_WORDS = {
101351
102751
  exceptional: t("Exceptional", "Eccezionale")
101352
102752
  };
101353
102753
  var weatherContribution = contribution("weather", WeatherStatusSchema, (slice, ctx) => {
101354
- if (slice === void 0) return { reading: reading$1("weather", "unknown") };
102754
+ if (slice === void 0) return { reading: reading$2("weather", "unknown") };
101355
102755
  const { condition, temperature, humidity, pressure, windSpeed } = slice;
101356
102756
  const celsius = temperature === null ? null : `${number(temperature)}°C`;
101357
102757
  const word = condition === null ? null : CONDITION_WORDS[condition] ?? t(condition, condition);
101358
102758
  const title = word ?? (celsius === null ? null : t(celsius, celsius));
101359
- if (title === null) return { reading: reading$1("weather", "unknown") };
102759
+ if (title === null) return { reading: reading$2("weather", "unknown") };
101360
102760
  const facts = [];
101361
102761
  if (celsius !== null && word !== null) facts.push(fact("reading", "thermometer", t(celsius, celsius), "primary"));
101362
102762
  if (humidity !== null) facts.push(fact("reading", "droplets", t(`${Math.round(humidity)}%`, `${Math.round(humidity)}%`)));
@@ -101377,7 +102777,7 @@ var weatherContribution = contribution("weather", WeatherStatusSchema, (slice, c
101377
102777
  value: t(`${number(windSpeed)} m/s`, `${number(windSpeed)} m/s`)
101378
102778
  }];
101379
102779
  return {
101380
- reading: reading$1("weather", "on", false, title),
102780
+ reading: reading$2("weather", "on", false, title),
101381
102781
  facts,
101382
102782
  tiles: {
101383
102783
  left,
@@ -101386,25 +102786,25 @@ var weatherContribution = contribution("weather", WeatherStatusSchema, (slice, c
101386
102786
  };
101387
102787
  });
101388
102788
  var updateContribution = contribution("update", UpdateStatusSchema, (slice) => {
101389
- if (slice === void 0) return { reading: reading$1("update", "unknown") };
102789
+ if (slice === void 0) return { reading: reading$2("update", "unknown") };
101390
102790
  const { currentVersion, availableVersion, inProgress } = slice;
101391
102791
  const pending = availableVersion !== null && availableVersion !== "" && availableVersion !== currentVersion;
101392
- if (!pending && currentVersion === null && !inProgress) return { reading: reading$1("update", "unknown") };
102792
+ if (!pending && currentVersion === null && !inProgress) return { reading: reading$2("update", "unknown") };
101393
102793
  const state = inProgress ? "running" : pending ? "standby" : "idle";
101394
102794
  const title = inProgress ? t("Updating", "Aggiornamento in corso") : pending ? t("Update available", "Aggiornamento disponibile") : t("Up to date", "Aggiornato");
101395
102795
  const versions = currentVersion === null ? pending ? t(`${availableVersion}`, `${availableVersion}`) : null : pending ? t(`${currentVersion} → ${availableVersion}`, `${currentVersion} → ${availableVersion}`) : t(`Version ${currentVersion}`, `Versione ${currentVersion}`);
101396
102796
  return {
101397
- reading: reading$1("update", state, false, title),
102797
+ reading: reading$2("update", state, false, title),
101398
102798
  facts: versions === null ? [] : [fact("reading", "download", versions, pending ? "warning" : "muted")],
101399
102799
  rows: [row$1("update", "download", versions, [])]
101400
102800
  };
101401
102801
  });
101402
102802
  var imageContribution = contribution("image", ImageStatusSchema, (slice, ctx) => {
101403
- if (slice === void 0) return { reading: reading$1("image", "unknown") };
101404
- if (slice.url === null) return { reading: reading$1("image", "idle", false, t("No image yet", "Nessuna immagine")) };
102803
+ if (slice === void 0) return { reading: reading$2("image", "unknown") };
102804
+ if (slice.url === null) return { reading: reading$2("image", "idle", false, t("No image yet", "Nessuna immagine")) };
101405
102805
  const ago = slice.lastUpdated === null ? null : elapsedText(slice.lastUpdated, ctx.now);
101406
102806
  return {
101407
- reading: reading$1("image", "on", false, ago === null ? t("Image", "Immagine") : t(`Updated ${ago.en}`, `Aggiornata ${ago.it}`)),
102807
+ reading: reading$2("image", "on", false, ago === null ? t("Image", "Immagine") : t(`Updated ${ago.en}`, `Aggiornata ${ago.it}`)),
101408
102808
  artworkUrl: slice.url
101409
102809
  };
101410
102810
  });
@@ -101412,15 +102812,15 @@ var imageContribution = contribution("image", ImageStatusSchema, (slice, ctx) =>
101412
102812
  var buttonContribution = {
101413
102813
  cap: "button",
101414
102814
  contribute: () => ({
101415
- reading: reading$1("button", "idle", false, t("Ready", "Pronto")),
102815
+ reading: reading$2("button", "idle", false, t("Ready", "Pronto")),
101416
102816
  rows: [row$1("button", "pointer", null, [asAction(action("button.press", t("Press", "Premi"), "pointer", "button", "press", {}, "primary", "press"))])]
101417
102817
  })
101418
102818
  };
101419
102819
  var controlContribution = contribution("control", ControlStatusSchema, (slice, ctx) => {
101420
- if (slice === void 0) return { reading: reading$1("control", "unknown") };
102820
+ if (slice === void 0) return { reading: reading$2("control", "unknown") };
101421
102821
  const text = typeof slice.value === "number" ? number(slice.value) : slice.value;
101422
102822
  return {
101423
- reading: reading$1("control", "on", false, t(text, text)),
102823
+ reading: reading$2("control", "on", false, t(text, text)),
101424
102824
  facts: sinceFact(slice.lastChangedAt === 0 ? null : slice.lastChangedAt, ctx.now),
101425
102825
  rows: controlRows(slice)
101426
102826
  };
@@ -101503,13 +102903,13 @@ var SENSORS_FAMILY_CONTRIBUTIONS = {
101503
102903
  meter: meterContribution,
101504
102904
  weather: weatherContribution,
101505
102905
  "weather-station": contribution("weather-station", WeatherStationStatusSchema, (slice) => {
101506
- if (slice === void 0 || slice.temperature === null) return { reading: reading$1("weather", "unknown") };
102906
+ if (slice === void 0 || slice.temperature === null) return { reading: reading$2("weather", "unknown") };
101507
102907
  const celsius = `${number(slice.temperature)}°C`;
101508
102908
  const facts = [fact("reading", "thermometer", t(celsius, celsius), "primary")];
101509
102909
  if (slice.humidity !== null) facts.push(fact("reading", "droplets", t(`${Math.round(slice.humidity)}%`, `${Math.round(slice.humidity)}%`)));
101510
102910
  if (slice.windSpeed !== null) facts.push(fact("reading", "wind", t(`${number(slice.windSpeed)} m/s`, `${number(slice.windSpeed)} m/s`)));
101511
102911
  return {
101512
- reading: reading$1("weather", "on", false, t(celsius, celsius)),
102912
+ reading: reading$2("weather", "on", false, t(celsius, celsius)),
101513
102913
  facts
101514
102914
  };
101515
102915
  }),
@@ -101668,7 +103068,7 @@ function setpointRow(status, slider) {
101668
103068
  }];
101669
103069
  }
101670
103070
  var climateContribution = contribution("climate-control", ClimateControlStatusSchema, (slice, ctx) => {
101671
- if (slice === void 0) return { reading: reading$1("climate-control", "unknown") };
103071
+ if (slice === void 0) return { reading: reading$2("climate-control", "unknown") };
101672
103072
  const view = deriveClimateView(slice);
101673
103073
  const status = climateStatusText(view);
101674
103074
  const facts = [];
@@ -101745,7 +103145,7 @@ var climateContribution = contribution("climate-control", ClimateControlStatusSc
101745
103145
  rows.push(...setpointRow(view.target === null ? null : same$1(formatDegrees(view.target)), view.range === null || view.target === null ? null : setpointSlider("climate.target", "climate-control", "setTarget", "target", view.target, view.range)));
101746
103146
  const sceneMode = view.sceneMode;
101747
103147
  return {
101748
- reading: reading$1("climate-control", view.isOff ? "off" : "on"),
103148
+ reading: reading$2("climate-control", view.isOff ? "off" : "on"),
101749
103149
  title: view.modeLabel,
101750
103150
  ...view.isOff || slice.fanMode === "" ? {} : { caption: t(`${view.modeLabel.en} · fan ${fanLabelOf(slice.fanMode).en}`, `${view.modeLabel.it} · ventola ${fanLabelOf(slice.fanMode).it}`) },
101751
103151
  facts,
@@ -101777,7 +103177,7 @@ function capitalised(word) {
101777
103177
  return same$1(word.charAt(0).toUpperCase() + word.slice(1).replace(/_/g, " "));
101778
103178
  }
101779
103179
  var waterHeaterContribution = contribution("water-heater", WaterHeaterStatusSchema, (slice) => {
101780
- if (slice === void 0 || slice.operationMode === null) return { reading: reading$1("climate-control", "unknown") };
103180
+ if (slice === void 0 || slice.operationMode === null) return { reading: reading$2("climate-control", "unknown") };
101781
103181
  const isOff = slice.operationMode === "off";
101782
103182
  const label = capitalised(slice.operationMode);
101783
103183
  const status = thermalStatusText(slice.targetTemp, slice.currentTemp);
@@ -101814,7 +103214,7 @@ var waterHeaterContribution = contribution("water-heater", WaterHeaterStatusSche
101814
103214
  }, ...setpointRow(slice.targetTemp === null ? null : same$1(formatDegrees(slice.targetTemp)), range === null || slice.targetTemp === null ? null : setpointSlider("water-heater.target", "water-heater", "setTargetTemp", "temp", slice.targetTemp, range))];
101815
103215
  const level = levelWithin(slice.targetTemp, range);
101816
103216
  return {
101817
- reading: reading$1("climate-control", isOff ? "off" : "on"),
103217
+ reading: reading$2("climate-control", isOff ? "off" : "on"),
101818
103218
  title: label,
101819
103219
  facts: status === null ? [] : [fact("climate", "flame", status)],
101820
103220
  ...slice.currentTemp === null ? {} : { tiles: { left: [tile$1("Water", "Acqua", formatDegrees(slice.currentTemp))] } },
@@ -101834,10 +103234,10 @@ var waterHeaterContribution = contribution("water-heater", WaterHeaterStatusSche
101834
103234
  });
101835
103235
  var heatingValveContribution = contribution("heating-valve", HeatingValveStatusSchema, (slice) => {
101836
103236
  const position = slice?.position ?? null;
101837
- if (position === null) return { reading: reading$1("sensor", "unknown") };
103237
+ if (position === null) return { reading: reading$2("sensor", "unknown") };
101838
103238
  const text = same$1(`${Math.round(position)}%`);
101839
103239
  return {
101840
- reading: reading$1("sensor", position > 0 ? "running" : "idle"),
103240
+ reading: reading$2("sensor", position > 0 ? "running" : "idle"),
101841
103241
  facts: [fact("valve", "gauge", t(`Valve ${text.en}`, `Valvola ${text.it}`))],
101842
103242
  tiles: { right: [tile$1("Valve", "Valvola", text.en)] },
101843
103243
  ...position > 0 ? { caption: t(`Heating · valve ${text.en}`, `Riscalda · valvola ${text.it}`) } : {},
@@ -101846,9 +103246,9 @@ var heatingValveContribution = contribution("heating-valve", HeatingValveStatusS
101846
103246
  });
101847
103247
  /** One reading fact plus its tile; a value that did not answer says nothing and the state stays unknown. */
101848
103248
  function sensorFragment(value, id, icon, en, it, text) {
101849
- if (value === null) return { reading: reading$1("sensor", "unknown") };
103249
+ if (value === null) return { reading: reading$2("sensor", "unknown") };
101850
103250
  return {
101851
- reading: reading$1("sensor", "on"),
103251
+ reading: reading$2("sensor", "on"),
101852
103252
  title: same$1(text),
101853
103253
  facts: [fact(id, icon, same$1(text))],
101854
103254
  tiles: { right: [tile$1(en, it, text)] }
@@ -101864,8 +103264,8 @@ var numericContribution = contribution("numeric-sensor", NumericSensorStatusSche
101864
103264
  return sensorFragment(slice?.value ?? null, "reading", "gauge", "Value", "Valore", unit === void 0 ? text : `${text} ${unit}`);
101865
103265
  });
101866
103266
  var enumContribution = contribution("enum-sensor", EnumSensorStatusSchema, (slice) => {
101867
- if (slice === void 0 || slice.value === "") return measured({ reading: reading$1("sensor", "unknown") }, emptyMeasurement("text"));
101868
- if (slice.timestamp === true) return { reading: reading$1("sensor", "on") };
103267
+ if (slice === void 0 || slice.value === "") return measured({ reading: reading$2("sensor", "unknown") }, emptyMeasurement("text"));
103268
+ if (slice.timestamp === true) return { reading: reading$2("sensor", "on") };
101869
103269
  return measured(sensorFragment(slice.value, "reading", "gauge", "State", "Stato", slice.value), textMeasurement(slice.value, slice.lastFetchedAt));
101870
103270
  });
101871
103271
  /** Index bands: the headline of an air-quality sensor is a word, not a number. */
@@ -101884,7 +103284,7 @@ var CLIMATE_FAMILY_CONTRIBUTIONS = {
101884
103284
  "humidity-sensor": humidityContribution,
101885
103285
  "pressure-sensor": pressureContribution,
101886
103286
  "air-quality-sensor": contribution("air-quality-sensor", AirQualitySensorStatusSchema, (slice) => {
101887
- if (slice === void 0) return { reading: reading$1("sensor", "unknown") };
103287
+ if (slice === void 0) return { reading: reading$2("sensor", "unknown") };
101888
103288
  const parts = [];
101889
103289
  if (slice.aqi !== void 0) parts.push({
101890
103290
  label: "AQI",
@@ -101906,18 +103306,18 @@ var CLIMATE_FAMILY_CONTRIBUTIONS = {
101906
103306
  label: "PM10",
101907
103307
  value: `${Math.round(slice.pm10)} µg/m³`
101908
103308
  });
101909
- if (parts.length === 0) return { reading: reading$1("sensor", "unknown") };
103309
+ if (parts.length === 0) return { reading: reading$2("sensor", "unknown") };
101910
103310
  return {
101911
- reading: reading$1("sensor", "on"),
103311
+ reading: reading$2("sensor", "on"),
101912
103312
  ...slice.aqi === void 0 ? {} : { title: airQualityWord(slice.aqi) },
101913
103313
  facts: parts.map((p) => fact("air-quality", "wind", same$1(`${p.label} ${p.value}`))),
101914
103314
  tiles: { right: parts.slice(0, 2).map((p) => tile$1(p.label, p.label, p.value)) }
101915
103315
  };
101916
103316
  }),
101917
103317
  "carbon-monoxide": contribution("carbon-monoxide", CarbonMonoxideStatusSchema, (slice) => {
101918
- if (slice === void 0) return { reading: reading$1("sensor", "unknown") };
103318
+ if (slice === void 0) return { reading: reading$2("sensor", "unknown") };
101919
103319
  return {
101920
- reading: reading$1("sensor", slice.detected ? "alert" : "idle"),
103320
+ reading: reading$2("sensor", slice.detected ? "alert" : "idle"),
101921
103321
  title: slice.detected ? t("CO detected", "CO rilevato") : t("Air clear", "Aria libera"),
101922
103322
  facts: [fact("reading", slice.detected ? "triangle-alert" : "shield-check", slice.detected ? t("CO detected", "CO rilevato") : t("Air clear", "Aria libera"), slice.detected ? "danger" : "muted")]
101923
103323
  };
@@ -102140,7 +103540,7 @@ function isRunning(status) {
102140
103540
  return null;
102141
103541
  }
102142
103542
  var HEAT_PUMP_FAMILY_CONTRIBUTIONS = { "heat-pump-status": contribution("heat-pump-status", HeatPumpStatusSchema, (slice) => {
102143
- if (slice === void 0) return { reading: reading$1("climate-control", "unknown") };
103543
+ if (slice === void 0) return { reading: reading$2("climate-control", "unknown") };
102144
103544
  const running = isRunning(slice);
102145
103545
  const facts = [];
102146
103546
  if (slice.power.electricalW !== null) facts.push(fact("power", "zap", same(`${Math.round(slice.power.electricalW)} W`)));
@@ -102160,7 +103560,7 @@ var HEAT_PUMP_FAMILY_CONTRIBUTIONS = { "heat-pump-status": contribution("heat-pu
102160
103560
  ...systemRows(slice)
102161
103561
  ];
102162
103562
  return {
102163
- reading: reading$1("climate-control", running === true ? "running" : running === false ? "idle" : "on"),
103563
+ reading: reading$2("climate-control", running === true ? "running" : running === false ? "idle" : "on"),
102164
103564
  title: t("Heat pump", "Pompa di calore"),
102165
103565
  ...charging === void 0 ? {} : { caption: t(`${charging.label} · heating`.toUpperCase(), `${charging.label} · in riscaldamento`.toUpperCase()) },
102166
103566
  facts,
@@ -106203,6 +107603,13 @@ Object.freeze({
106203
107603
  access: "view",
106204
107604
  role: "viewer"
106205
107605
  },
107606
+ "error.listFaultTypes": {
107607
+ capName: "error",
107608
+ capScope: "device",
107609
+ addonId: null,
107610
+ access: "view",
107611
+ role: "viewer"
107612
+ },
106206
107613
  "eventEmitter.getStatus": {
106207
107614
  capName: "event-emitter",
106208
107615
  capScope: "device",
@@ -106728,6 +108135,13 @@ Object.freeze({
106728
108135
  access: "create",
106729
108136
  role: "admin"
106730
108137
  },
108138
+ "integrations.adoptInstanceRows": {
108139
+ capName: "integrations",
108140
+ capScope: "system",
108141
+ addonId: null,
108142
+ access: "create",
108143
+ role: "admin"
108144
+ },
106731
108145
  "integrations.delete": {
106732
108146
  capName: "integrations",
106733
108147
  capScope: "system",
@@ -106763,6 +108177,13 @@ Object.freeze({
106763
108177
  access: "view",
106764
108178
  role: "admin"
106765
108179
  },
108180
+ "integrations.listByAddon": {
108181
+ capName: "integrations",
108182
+ capScope: "system",
108183
+ addonId: null,
108184
+ access: "view",
108185
+ role: "admin"
108186
+ },
106766
108187
  "integrations.update": {
106767
108188
  capName: "integrations",
106768
108189
  capScope: "system",
@@ -113591,7 +115012,7 @@ DeviceFeature.BatteryOperated, DeviceFeature.Sleeps, derived("low-power-sleep",
113591
115012
  "startTalkSession",
113592
115013
  "pushTalkAudio",
113593
115014
  "endTalkSession"
113594
- ]), DeviceFeature.PanTiltZoom, derived("ptz"), DeviceFeature.PtzAutotrack, derived("ptz-autotrack"), DeviceFeature.MotionTrigger, derived("motion-trigger", ["setMotionTrigger"]), DeviceFeature.TimedRun, derived("timed-run", ["runFor"]), DeviceFeature.Switch, DeviceFeature.LightColorRgb, DeviceFeature.LightColorHsv, DeviceFeature.LightColorMired, DeviceFeature.ClimateDualSetpoint, DeviceFeature.ClimateHumidity, DeviceFeature.ClimateFanMode, DeviceFeature.ClimatePreset, DeviceFeature.ClimateSwingVertical, DeviceFeature.ClimateSwingHorizontal, DeviceFeature.CoverPositionable, DeviceFeature.CoverTilt, DeviceFeature.CoverStoppable, DeviceFeature.ValvePositionable, DeviceFeature.FanSpeed, DeviceFeature.FanPreset, DeviceFeature.FanDirection, DeviceFeature.FanOscillating, DeviceFeature.LockOpen, DeviceFeature.MediaPlayerSeek, DeviceFeature.MediaPlayerVolume, DeviceFeature.MediaPlayerMute, DeviceFeature.MediaPlayerShuffle, DeviceFeature.MediaPlayerRepeat, DeviceFeature.MediaPlayerSelectSource, DeviceFeature.MediaPlayerPlayMedia, DeviceFeature.MediaPlayerNext, DeviceFeature.MediaPlayerPrevious, DeviceFeature.MediaPlayerStop, DeviceFeature.MediaPlayerVolumeStep, DeviceFeature.MediaPlayerChannelStep, DeviceFeature.MediaPlayerPower, DeviceFeature.PresenceGps, DeviceFeature.NotifierImage, DeviceFeature.NotifierPriority, DeviceFeature.NotifierData, DeviceFeature.NotifierActions, DeviceFeature.NotifierRecipients, DeviceFeature.ScriptVariables, DeviceFeature.AutomationSkipCondition, DeviceFeature.VacuumHasAi, DeviceFeature.MowerHasTargetedMowing, DeviceFeature.Navigation, derived("navigation"), DeviceFeature.NetworkLink, derived("network-link");
115015
+ ]), DeviceFeature.PanTiltZoom, derived("ptz"), DeviceFeature.PtzAutotrack, derived("ptz-autotrack"), DeviceFeature.MotionTrigger, derived("motion-trigger", ["setMotionTrigger"]), DeviceFeature.TimedRun, derived("timed-run", ["runFor"]), DeviceFeature.Switch, DeviceFeature.LightColorRgb, DeviceFeature.LightColorHsv, DeviceFeature.LightColorMired, DeviceFeature.ClimateDualSetpoint, DeviceFeature.ClimateHumidity, DeviceFeature.ClimateFanMode, DeviceFeature.ClimatePreset, DeviceFeature.ClimateSwingVertical, DeviceFeature.ClimateSwingHorizontal, DeviceFeature.CoverPositionable, DeviceFeature.CoverTilt, DeviceFeature.CoverStoppable, DeviceFeature.ValvePositionable, derived("valve", ["setPosition"]), DeviceFeature.FanSpeed, DeviceFeature.FanPreset, DeviceFeature.FanDirection, DeviceFeature.FanOscillating, DeviceFeature.LockOpen, DeviceFeature.MediaPlayerSeek, DeviceFeature.MediaPlayerVolume, DeviceFeature.MediaPlayerMute, DeviceFeature.MediaPlayerShuffle, DeviceFeature.MediaPlayerRepeat, DeviceFeature.MediaPlayerSelectSource, DeviceFeature.MediaPlayerPlayMedia, DeviceFeature.MediaPlayerNext, DeviceFeature.MediaPlayerPrevious, DeviceFeature.MediaPlayerStop, DeviceFeature.MediaPlayerVolumeStep, DeviceFeature.MediaPlayerChannelStep, DeviceFeature.MediaPlayerPower, DeviceFeature.PresenceGps, DeviceFeature.NotifierImage, DeviceFeature.NotifierPriority, DeviceFeature.NotifierData, DeviceFeature.NotifierActions, DeviceFeature.NotifierRecipients, DeviceFeature.ScriptVariables, DeviceFeature.AutomationSkipCondition, DeviceFeature.VacuumHasAi, DeviceFeature.MowerHasTargetedMowing, DeviceFeature.Navigation, derived("navigation"), DeviceFeature.NetworkLink, derived("network-link");
113595
115016
  var ALL_FEATURES = Object.values(DeviceFeature);
113596
115017
  new Set(ALL_FEATURES);
113597
115018
  DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher;
@@ -114803,6 +116224,11 @@ Object.freeze({
114803
116224
  form: "single",
114804
116225
  optional: false
114805
116226
  }],
116227
+ "error.listFaultTypes": [{
116228
+ name: "deviceId",
116229
+ form: "single",
116230
+ optional: false
116231
+ }],
114806
116232
  "eventEmitter.getStatus": [{
114807
116233
  name: "deviceId",
114808
116234
  form: "single",
@@ -117135,7 +118561,8 @@ var NC_SYSTEM_EVENT_FILTER_KEYS = [
117135
118561
  "consumableLowPercent",
117136
118562
  "commandActions",
117137
118563
  "commandOutcomes",
117138
- "commandActorKinds"
118564
+ "commandActorKinds",
118565
+ "faultCodes"
117139
118566
  ];
117140
118567
  new Map(Object.entries({
117141
118568
  "device-online": "device-events",
@@ -117506,6 +118933,8 @@ object({
117506
118933
  nodeId: string().optional(),
117507
118934
  /** The alert's own action link (where the operator acts on it), when it has one. */
117508
118935
  actionUrl: string().optional(),
118936
+ /** A device fault episode: every active fault (`metadata.faults`), principal first. */
118937
+ faults: array(DeviceFaultSchema).optional(),
117509
118938
  at: number$1()
117510
118939
  });
117511
118940
  var RULE_BODY_ONLY = ["body"];
@@ -117790,6 +119219,9 @@ var STATE_SUMMARY_VARS = [
117790
119219
  ([...RULE_TEXT], [...DEVICE_ATTENTION, ...ALERT_EPISODE]),
117791
119220
  ([...RULE_TEXT], [...ALERT_EPISODE]),
117792
119221
  ([...RULE_TEXT], [...DEVICE_ATTENTION, ...ALERT_EPISODE]),
119222
+ ([...RULE_TEXT], [...DEVICE_ATTENTION]),
119223
+ ([...RULE_TEXT], [...DEVICE_ATTENTION]),
119224
+ ([...RULE_TEXT], [...DEVICE_ATTENTION]),
117793
119225
  [...RULE_TEXT],
117794
119226
  [...RULE_TEXT],
117795
119227
  [...RULE_TEXT],
@@ -118727,7 +120159,7 @@ object({
118727
120159
  supportedController: string().optional(),
118728
120160
  commandsEncoding: string(),
118729
120161
  delay: number$1().nonnegative().optional(),
118730
- commands: record$1(string(), unknown())
120162
+ commands: record$1(string(), unknown$1())
118731
120163
  });
118732
120164
  //#endregion
118733
120165
  //#region src/devices/hm-cold-start.ts
@@ -119451,22 +120883,22 @@ function requireDevice(devices, address) {
119451
120883
  return device;
119452
120884
  }
119453
120885
  /** The first reading of `names` on any channel (the maintenance channel carries them). */
119454
- function reading(device, names) {
120886
+ function reading$1(device, names) {
119455
120887
  for (const channel of device.channels) {
119456
120888
  const point = channel.dataPoints.find((candidate) => names.includes(candidate.parameter));
119457
120889
  if (point !== void 0) return point.value;
119458
120890
  }
119459
120891
  }
119460
120892
  function numberReading(device, names) {
119461
- const value = reading(device, names);
120893
+ const value = reading$1(device, names);
119462
120894
  return typeof value === "number" ? value : null;
119463
120895
  }
119464
120896
  function boolReading(device, names) {
119465
- const value = reading(device, names);
120897
+ const value = reading$1(device, names);
119466
120898
  return typeof value === "boolean" ? value : null;
119467
120899
  }
119468
120900
  function diagnosticsOf(device) {
119469
- const duty = reading(device, ["DUTY_CYCLE", "DUTYCYCLE"]);
120901
+ const duty = reading$1(device, ["DUTY_CYCLE", "DUTYCYCLE"]);
119470
120902
  return {
119471
120903
  rssiDevice: numberReading(device, ["RSSI_DEVICE"]),
119472
120904
  rssiPeer: numberReading(device, ["RSSI_PEER"]),
@@ -147861,6 +149293,212 @@ function devicePanelSection(integrationId, address) {
147861
149293
  };
147862
149294
  }
147863
149295
  //#endregion
149296
+ //#region src/homematic-fault-mapping.ts
149297
+ /**
149298
+ * PURE mapping of what a CCU reports as faulty to `error` cap readings, with no
149299
+ * session and no I/O: the WatchDog system variables of the box, and the
149300
+ * MAINTENANCE service flags of one device.
149301
+ *
149302
+ * A reading is UNKNOWN (`active: null`, the cold slice) until the CCU has said
149303
+ * something about the flags; "no fault" is only ever written from a value that
149304
+ * was read (D315, D393).
149305
+ *
149306
+ * The cap's `label` is a plain string the provider translates, and the server
149307
+ * has no per-operator language: the label carries the English words, and the
149308
+ * Italian beside it stays in the table for the surface that can pick one.
149309
+ */
149310
+ /** The two languages of one fault, side by side so neither is forgotten. */
149311
+ function words(en, it) {
149312
+ return {
149313
+ en,
149314
+ it
149315
+ };
149316
+ }
149317
+ var SEVERITY_ORDER = {
149318
+ error: 0,
149319
+ warning: 1
149320
+ };
149321
+ function toFault(rule) {
149322
+ return {
149323
+ code: rule.key,
149324
+ label: rule.words.en,
149325
+ severity: rule.severity
149326
+ };
149327
+ }
149328
+ /** Errors first, then warnings; the order inside a tier is the rule order. */
149329
+ function rank(faults) {
149330
+ return [...faults].sort((a, b) => SEVERITY_ORDER[a.severity] - SEVERITY_ORDER[b.severity]);
149331
+ }
149332
+ function reading(faults, now) {
149333
+ const ranked = rank(faults);
149334
+ const principal = ranked[0];
149335
+ if (principal === void 0) return {
149336
+ ...ERROR_STATUS_COLD,
149337
+ active: false,
149338
+ faults: [],
149339
+ lastFetchedAt: now
149340
+ };
149341
+ return {
149342
+ active: true,
149343
+ code: principal.code,
149344
+ label: principal.label,
149345
+ severity: principal.severity,
149346
+ since: null,
149347
+ faults: ranked,
149348
+ lastFetchedAt: now
149349
+ };
149350
+ }
149351
+ function unknown(now) {
149352
+ return {
149353
+ ...ERROR_STATUS_COLD,
149354
+ lastFetchedAt: now
149355
+ };
149356
+ }
149357
+ /** A LOGIC value as the CCU hands it over: a boolean, 0/1, or its text. `null` is unread. */
149358
+ function truthy(value) {
149359
+ if (value === null) return null;
149360
+ if (typeof value === "boolean") return value;
149361
+ if (typeof value === "number") return value !== 0;
149362
+ const text = value.trim().toLowerCase();
149363
+ return text === "true" || text === "1" || text === "on" || text === "yes";
149364
+ }
149365
+ /** The WatchDog add-on names its variables "SV WatchDog: <key>". */
149366
+ var WATCHDOG_PREFIX = /^sv\s*watchdog\s*:\s*/i;
149367
+ var WATCHDOG_FAULTS = [
149368
+ {
149369
+ key: "hb-rf-eth-connection",
149370
+ severity: "error",
149371
+ words: words("HB-RF-ETH connection lost", "Connessione HB-RF-ETH persa")
149372
+ },
149373
+ {
149374
+ key: "low-voltage",
149375
+ severity: "error",
149376
+ words: words("CCU supply voltage low", "Tensione di alimentazione della CCU bassa")
149377
+ },
149378
+ {
149379
+ key: "rfd-restart",
149380
+ severity: "warning",
149381
+ words: words("The radio service restarted", "Il servizio radio si è riavviato")
149382
+ },
149383
+ {
149384
+ key: "regahss-restart",
149385
+ severity: "warning",
149386
+ words: words("The ReGa service restarted", "Il servizio ReGa si è riavviato")
149387
+ },
149388
+ {
149389
+ key: "no-internet",
149390
+ severity: "warning",
149391
+ words: words("The CCU has no internet", "La CCU non ha internet")
149392
+ },
149393
+ {
149394
+ key: "unclean-shutdown",
149395
+ severity: "warning",
149396
+ words: words("The CCU shut down uncleanly", "La CCU si è spenta in modo anomalo")
149397
+ }
149398
+ ];
149399
+ /** Which WatchDog fault a system variable is, or `null` when it is not one of them. */
149400
+ function watchdogRuleOf(name) {
149401
+ const key = name.trim().replace(WATCHDOG_PREFIX, "").trim().toLowerCase();
149402
+ return WATCHDOG_FAULTS.find((rule) => rule.key === key) ?? null;
149403
+ }
149404
+ /**
149405
+ * The gateway's reading from a system-variable snapshot. No WatchDog variable
149406
+ * with a value (no snapshot, no credentials, the add-on not installed) is
149407
+ * UNKNOWN, never "no fault".
149408
+ */
149409
+ function watchdogFaultReading(vars, now) {
149410
+ const faults = [];
149411
+ let known = 0;
149412
+ for (const variable of vars) {
149413
+ const rule = watchdogRuleOf(variable.name);
149414
+ if (rule === null) continue;
149415
+ const on = truthy(variable.value);
149416
+ if (on === null) continue;
149417
+ known += 1;
149418
+ if (on) faults.push(toFault(rule));
149419
+ }
149420
+ if (known === 0) return unknown(now);
149421
+ return reading(faults, now);
149422
+ }
149423
+ var MAINTENANCE_FAULTS = [
149424
+ {
149425
+ key: "UNREACH",
149426
+ severity: "error",
149427
+ words: words("Device unreachable", "Dispositivo non raggiungibile")
149428
+ },
149429
+ {
149430
+ key: "STICKY_UNREACH",
149431
+ severity: "warning",
149432
+ words: words("Device was unreachable (not acknowledged)", "Dispositivo stato non raggiungibile")
149433
+ },
149434
+ {
149435
+ key: "LOW_BAT",
149436
+ severity: "warning",
149437
+ words: words("Battery low", "Batteria scarica")
149438
+ },
149439
+ {
149440
+ key: "LOWBAT",
149441
+ severity: "warning",
149442
+ words: words("Battery low", "Batteria scarica")
149443
+ },
149444
+ {
149445
+ key: "CONFIG_PENDING",
149446
+ severity: "warning",
149447
+ words: words("Configuration pending", "Configurazione in attesa")
149448
+ },
149449
+ {
149450
+ key: "DUTY_CYCLE",
149451
+ severity: "warning",
149452
+ words: words("Radio duty cycle exhausted", "Duty cycle radio esaurito")
149453
+ }
149454
+ ];
149455
+ /** Every `ERROR_*` boolean flag the device raises is its own fault (overheat, overload, jammed…). */
149456
+ function errorFlagRule(param) {
149457
+ const name = param.slice(6).toLowerCase().replace(/_/g, " ");
149458
+ return {
149459
+ key: param,
149460
+ severity: "error",
149461
+ words: words(`Device error: ${name}`, `Errore del dispositivo: ${name}`)
149462
+ };
149463
+ }
149464
+ function maintenanceRuleOf(param, value) {
149465
+ const upper = param.toUpperCase();
149466
+ const fixed = MAINTENANCE_FAULTS.find((rule) => rule.key === upper);
149467
+ if (fixed !== void 0) return fixed;
149468
+ if (upper.startsWith("ERROR_") && typeof value === "boolean") return errorFlagRule(upper);
149469
+ return null;
149470
+ }
149471
+ /**
149472
+ * A device's reading from its MAINTENANCE channel values (parameter -> value).
149473
+ * Until a service flag has a value the reading is UNKNOWN.
149474
+ */
149475
+ function maintenanceFaultReading(values, now) {
149476
+ const faults = [];
149477
+ let known = 0;
149478
+ for (const [param, value] of values) {
149479
+ const rule = maintenanceRuleOf(param, value);
149480
+ if (rule === null) continue;
149481
+ const on = truthy(value);
149482
+ if (on === null) continue;
149483
+ known += 1;
149484
+ if (on) faults.push(toFault(rule));
149485
+ }
149486
+ if (known === 0) return unknown(now);
149487
+ return reading(faults, now);
149488
+ }
149489
+ /** The faults the CCU box can raise: its WatchDog variables. */
149490
+ function watchdogFaultTypes() {
149491
+ return WATCHDOG_FAULTS.map(toFault);
149492
+ }
149493
+ /**
149494
+ * The faults a device's MAINTENANCE channel can raise, by their fixed flags.
149495
+ * The per-model `ERROR_*` flags are discovered from the channel, so they are
149496
+ * published when raised but not listed here.
149497
+ */
149498
+ function maintenanceFaultTypes() {
149499
+ return MAINTENANCE_FAULTS.map(toFault);
149500
+ }
149501
+ //#endregion
147864
149502
  //#region src/homematic-diagnostics-mapping.ts
147865
149503
  var MAINTENANCE_CHANNEL_TYPE$1 = "MAINTENANCE";
147866
149504
  /** Reachability parameters that drive the Container's `online`, not a child. */
@@ -148268,6 +149906,9 @@ var HmContainerDevice = class HmContainerDevice extends BaseDevice {
148268
149906
  features;
148269
149907
  address;
148270
149908
  integrationId;
149909
+ /** MAINTENANCE channel address and its last known flag values; null when the device has no such channel. */
149910
+ maintenanceChannel = null;
149911
+ maintenanceValues = /* @__PURE__ */ new Map();
148271
149912
  /** Unsubscribe for the facade `valueChanged` reachability listener. */
148272
149913
  valueChangedUnsub = null;
148273
149914
  /** Unsubscribe for the session fan-out that re-stamps names once the CCU answers. */
@@ -148282,6 +149923,7 @@ var HmContainerDevice = class HmContainerDevice extends BaseDevice {
148282
149923
  this.features = HmContainerDevice.deriveFeatures(hmDevice);
148283
149924
  this.online = this.deriveOnline(hmDevice);
148284
149925
  this.attachReachabilityListener();
149926
+ this.attachErrorCap(hmDevice);
148285
149927
  this.refreshButtonEvents();
148286
149928
  this.updateSourceInfo({
148287
149929
  id: this.address,
@@ -148310,11 +149952,49 @@ var HmContainerDevice = class HmContainerDevice extends BaseDevice {
148310
149952
  if (reach === null) return true;
148311
149953
  return !reach.unreach;
148312
149954
  }
149955
+ /**
149956
+ * Declare the `error` cap when the device has a MAINTENANCE channel, seed the
149957
+ * flags it already carries, and publish them. A device without one has no
149958
+ * service flags to read, so it declares nothing (and says so).
149959
+ */
149960
+ attachErrorCap(hmDevice) {
149961
+ const channel = hmDevice?.channels.find((c) => c.type?.toUpperCase() === "MAINTENANCE");
149962
+ if (hmDevice === null || channel === void 0) {
149963
+ this.ctx.logger.debug("HmContainerDevice: no MAINTENANCE channel, no error cap", {
149964
+ tags: { deviceId: this.id },
149965
+ meta: { address: this.address }
149966
+ });
149967
+ return;
149968
+ }
149969
+ this.maintenanceChannel = channel.address;
149970
+ for (const dp of channel.dataPoints) this.maintenanceValues.set(dp.parameter, dp.value);
149971
+ this.declareFaultTypes(maintenanceFaultTypes());
149972
+ this.registerErrorCap();
149973
+ this.publishFaults();
149974
+ }
149975
+ onMaintenanceEvent(event) {
149976
+ if (this.maintenanceChannel === null || event.channel !== this.maintenanceChannel) return;
149977
+ this.maintenanceValues.set(event.parameter.toUpperCase(), event.value);
149978
+ this.publishFaults();
149979
+ }
149980
+ publishFaults() {
149981
+ const reading = maintenanceFaultReading(this.maintenanceValues, Date.now());
149982
+ this.publishError(reading).catch((err) => {
149983
+ this.ctx.logger.warn("HmContainerDevice: could not publish the device fault", {
149984
+ tags: { deviceId: this.id },
149985
+ meta: {
149986
+ address: this.address,
149987
+ error: errMsg(err)
149988
+ }
149989
+ });
149990
+ });
149991
+ }
148313
149992
  attachReachabilityListener() {
148314
149993
  const facade = this.facade;
148315
149994
  if (!facade) return;
148316
149995
  this.valueChangedUnsub = facade.on("valueChanged", (event) => {
148317
149996
  if (event.device !== this.address) return;
149997
+ this.onMaintenanceEvent(event);
148318
149998
  if (!REACHABILITY_PARAMS.has(event.parameter.toUpperCase())) return;
148319
149999
  const next = !event.value;
148320
150000
  if (this.online !== next) this.markOnline(next);
@@ -148809,6 +150489,8 @@ function gatewayMetadataPatch(input) {
148809
150489
  }
148810
150490
  //#endregion
148811
150491
  //#region src/devices/homematic-gateway-device.ts
150492
+ /** How often the CCU system variables are re-read: they are a snapshot, the CCU pushes no event for them. */
150493
+ var WATCHDOG_POLL_MS = 3e4;
148812
150494
  /**
148813
150495
  * The physical CCU3 / RaspberryMatic box, as a {@link DeviceType.Gateway}. Its
148814
150496
  * connection and password live on the INTEGRATION; this device follows whether
@@ -148817,6 +150499,9 @@ function gatewayMetadataPatch(input) {
148817
150499
  *
148818
150500
  * - `device-admin-link`, the CCU's own WebUI.
148819
150501
  *
150502
+ * - `error`, the faults the CCU WatchDog add-on raises as system variables
150503
+ * (`homematic-fault-mapping.ts`), re-read every {@link WATCHDOG_POLL_MS}.
150504
+ *
148820
150505
  * There is no `reboot` and no `update`: nodehomematic has no call that restarts
148821
150506
  * the CCU, and its firmware call installs an update on a radio DEVICE by its
148822
150507
  * address, never on the box, so neither is advertised.
@@ -148830,12 +150515,17 @@ var HomematicGatewayDevice = class extends BaseDevice {
148830
150515
  snapshotUnsub = null;
148831
150516
  /** The last metadata written, so a state change that altered nothing writes nothing. */
148832
150517
  lastMetadataKey = "";
150518
+ pollTimer = null;
150519
+ polling = false;
150520
+ warnedReadFailure = false;
148833
150521
  constructor(ctx) {
148834
150522
  const cfg = homematicGatewayDeviceSchema.parse(ctx.persistedConfig ?? {});
148835
150523
  super(ctx, homematicGatewayDeviceSchema, { type: DeviceType.Gateway });
148836
150524
  this.integrationId = cfg.integrationId;
148837
150525
  this.online = this.sessionUp();
148838
150526
  this.registerAdminLinkCap();
150527
+ this.declareFaultTypes(watchdogFaultTypes());
150528
+ this.registerErrorCap();
148839
150529
  this.updateSourceInfo({
148840
150530
  id: cfg.nativeId,
148841
150531
  system: "homematic"
@@ -148845,10 +150535,18 @@ var HomematicGatewayDevice = class extends BaseDevice {
148845
150535
  await super.onActivate();
148846
150536
  this.snapshotUnsub = homematicFacades.onSnapshot(this.integrationId, () => {
148847
150537
  this.sync();
150538
+ if (this.sessionUp()) this.pollFaults();
148848
150539
  });
148849
150540
  await this.sync();
150541
+ this.pollTimer = setInterval(() => {
150542
+ this.pollFaults();
150543
+ }, WATCHDOG_POLL_MS);
150544
+ this.pollTimer.unref();
150545
+ await this.pollFaults();
148850
150546
  }
148851
150547
  async removeDevice() {
150548
+ if (this.pollTimer !== null) clearInterval(this.pollTimer);
150549
+ this.pollTimer = null;
148852
150550
  this.snapshotUnsub?.();
148853
150551
  this.snapshotUnsub = null;
148854
150552
  await super.removeDevice();
@@ -148856,6 +150554,37 @@ var HomematicGatewayDevice = class extends BaseDevice {
148856
150554
  sessionUp() {
148857
150555
  return homematicFacades.getSession(this.integrationId)?.getInfo().status === "connected";
148858
150556
  }
150557
+ /**
150558
+ * Read the CCU's WatchDog system variables and publish them as faults. A read
150559
+ * that fails changes nothing (the previous reading stands), and every branch
150560
+ * that publishes nothing leaves a line on the device.
150561
+ */
150562
+ async pollFaults() {
150563
+ if (this.polling) return;
150564
+ const tags = { deviceId: this.id };
150565
+ const facade = homematicFacades.get(this.integrationId);
150566
+ if (!this.sessionUp() || facade === null) {
150567
+ this.ctx.logger.debug("Homematic gateway: fault read skipped, session not connected", { tags });
150568
+ return;
150569
+ }
150570
+ this.polling = true;
150571
+ try {
150572
+ await facade.refreshHub();
150573
+ const reading = watchdogFaultReading(facade.systemVariables(), Date.now());
150574
+ if (reading.active === null) this.ctx.logger.debug("Homematic gateway: no WatchDog system variable readable on the CCU, faults stay unknown", { tags });
150575
+ this.warnedReadFailure = false;
150576
+ await this.publishError(reading);
150577
+ } catch (err) {
150578
+ const log = this.warnedReadFailure ? this.ctx.logger.debug : this.ctx.logger.warn;
150579
+ this.warnedReadFailure = true;
150580
+ log.call(this.ctx.logger, "Homematic gateway: fault read failed, the previous reading stands", {
150581
+ tags,
150582
+ meta: { error: errMsg(err) }
150583
+ });
150584
+ } finally {
150585
+ this.polling = false;
150586
+ }
150587
+ }
148859
150588
  /** Follow the session: online state, and the box's host as device metadata. */
148860
150589
  async sync() {
148861
150590
  const up = this.sessionUp();
@@ -150698,7 +152427,7 @@ var HomematicProviderAddon = class extends BaseDeviceProvider {
150698
152427
  records: records.kind({
150699
152428
  name: homematicConnectionsEntryKind.name,
150700
152429
  declaration: homematicConnectionsEntryKind.declaration,
150701
- schema: record$1(string(), unknown())
152430
+ schema: record$1(string(), unknown$1())
150702
152431
  }),
150703
152432
  log: { warn: (message) => this.ctx.logger.warn(message) }
150704
152433
  })));