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