@camstack/addon-provider-reolink 1.2.235 → 1.2.237

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/addon.js CHANGED
@@ -101498,7 +101498,7 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
101498
101498
  return EventCategory;
101499
101499
  }({});
101500
101500
  //#endregion
101501
- //#region ../types/dist/device-type-CbDhVwFP.mjs
101501
+ //#region ../types/dist/composed-stable-id-DFNyOFzz.mjs
101502
101502
  /**
101503
101503
  import { errMsg } from '@camstack/types'
101504
101504
  * Extract a human-readable message from an unknown error value.
@@ -101511,6 +101511,7 @@ function errMsg$3(err) {
101511
101511
  }
101512
101512
  var DeviceType = /* @__PURE__ */ function(DeviceType) {
101513
101513
  DeviceType["Camera"] = "camera";
101514
+ /** Legacy stored value, read only by the hub-to-integration migrations; no live device carries it. */
101514
101515
  DeviceType["Hub"] = "hub";
101515
101516
  DeviceType["Light"] = "light";
101516
101517
  DeviceType["Siren"] = "siren";
@@ -101624,6 +101625,10 @@ var DeviceType = /* @__PURE__ */ function(DeviceType) {
101624
101625
  * (`reboot`, `device-admin-link`). Products are NOT its children — they are
101625
101626
  * adopted beside it — and its connection settings stay on the integration. */
101626
101627
  DeviceType["Gateway"] = "gateway";
101628
+ /** A heat pump (any vendor): the compressor unit with its circuits (heating, hot
101629
+ * water, cooling, solar), its system modes and its power. One main read-only
101630
+ * `heat-pump-status` cap carries all of it; `heat-pump-control` sets it (D1026). */
101631
+ DeviceType["HeatPump"] = "heat-pump";
101627
101632
  return DeviceType;
101628
101633
  }({});
101629
101634
  var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
@@ -101782,6 +101787,10 @@ var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
101782
101787
  /** Robot mower exposes targeted mowing (all-area / zones / edges /
101783
101788
  * spots) — gates the Mow action + map selectors. */
101784
101789
  DeviceFeature["MowerHasTargetedMowing"] = "mower-has-targeted-mowing";
101790
+ /** The device has a drive/navigation surface (`navigation` cap): a robot camera. */
101791
+ DeviceFeature["Navigation"] = "navigation";
101792
+ /** The device has a network-link reading (`network-link` cap). */
101793
+ DeviceFeature["NetworkLink"] = "network-link";
101785
101794
  return DeviceFeature;
101786
101795
  }({});
101787
101796
  /**
@@ -101896,6 +101905,12 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
101896
101905
  DeviceRole["IrTransmitter"] = "ir-transmitter";
101897
101906
  return DeviceRole;
101898
101907
  }({});
101908
+ /**
101909
+ * A composed device's stableId is this prefix plus the block id. Its own module,
101910
+ * free of zod, so the addon runner can read it through `@camstack/types/addon`
101911
+ * without loading the schema barrel (D28).
101912
+ */
101913
+ var COMPOSED_DEVICE_STABLE_ID_PREFIX = "composed-";
101899
101914
  //#endregion
101900
101915
  //#region ../../node_modules/zod/v4/core/core.js
101901
101916
  var _a$1;
@@ -106708,7 +106723,7 @@ var ZodIssueCode = {
106708
106723
  var ZodFirstPartyTypeKind;
106709
106724
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
106710
106725
  //#endregion
106711
- //#region ../types/dist/sleep-CS5Xp1iQ.mjs
106726
+ //#region ../types/dist/sleep-D_NpiLFP.mjs
106712
106727
  /**
106713
106728
  * The audio chunk plane's byte format, and the ONE expansion from a coded
106714
106729
  * window to float samples (D455).
@@ -109402,16 +109417,6 @@ var BaseAddon = class {
109402
109417
  return null;
109403
109418
  }
109404
109419
  /**
109405
- * The form schema of ONE integration instance, or `null` to use the scoped form.
109406
- *
109407
- * Override it only when an `instanceMode: multiple` addon's instances differ: an NVR integration
109408
- * needs its connection fields, the default integration the addon's own sections. It is the
109409
- * SHAPE of the form only — the values live on the instance record.
109410
- */
109411
- async integrationFormSchema(_instance) {
109412
- return null;
109413
- }
109414
- /**
109415
109420
  * D986 scoped settings: the form shape of the CLUSTER-wide settings one capability this addon
109416
109421
  * provides owns, or `null` when it has none. `cap` is a capability name the addon's manifest
109417
109422
  * declares. Stored as `addon-settings` rows `<addonId>.<field>`. The keys of this schema, of
@@ -109439,8 +109444,7 @@ var BaseAddon = class {
109439
109444
  }
109440
109445
  /**
109441
109446
  * The host's read of the scoped declarations: the schema one capability declares for `scope`,
109442
- * or `null`. Beside {@link getIntegrationFormSchema}, the same shape: the hook is protected, the
109443
- * host asks this method.
109447
+ * or `null`. The hook is protected, the host asks this method.
109444
109448
  */
109445
109449
  async getScopedSettingsSchema(scope, cap) {
109446
109450
  switch (scope) {
@@ -109608,22 +109612,6 @@ var BaseAddon = class {
109608
109612
  return Object.fromEntries([...collectHydratedFieldValues(form)].filter(([, value]) => value !== void 0));
109609
109613
  }
109610
109614
  /**
109611
- * What the create wizard and the integration edit page render for one instance: the addon's
109612
- * per-instance schema when it declares one, else its global schema (what they always showed).
109613
- */
109614
- async getIntegrationFormSchema(instance, nodeId) {
109615
- const scoped = await this.integrationFormSchema(instance);
109616
- if (scoped === null) return this.scopedForm(nodeId);
109617
- return hydrateSchema(scoped, {}, { inlineSecretsAsViews: true });
109618
- }
109619
- /** The form of the scoped schemas this addon declared, hydrated from its store. */
109620
- async scopedForm(nodeId) {
109621
- await this.loadScopedSchemas();
109622
- const schema = this.scopedFormSchema();
109623
- if (!schema) return { sections: [] };
109624
- return hydrateSchema(schema, await this.readRawProjectedStore(nodeId), { inlineSecretsAsViews: true });
109625
- }
109626
- /**
109627
109615
  * The raw addon store PROJECTED onto the target node's bare per-node keys:
109628
109616
  * every `perNode: true` field carries THAT node's scoped value on its bare
109629
109617
  * key (absent scoped key ⇒ key absent, so the schema `default` wins — no
@@ -109810,12 +109798,6 @@ var BaseAddon = class {
109810
109798
  this._nodeKeysByCap = /* @__PURE__ */ new Map();
109811
109799
  this._addonSecretTree = null;
109812
109800
  }
109813
- /** The form of an addon's scoped schemas: their sections, each shown once. */
109814
- scopedFormSchema(cap) {
109815
- const byId = /* @__PURE__ */ new Map();
109816
- for (const entry of this.loadedScopedSchemas(cap)) for (const section of entry.schema.sections) if (!byId.has(section.id)) byId.set(section.id, section);
109817
- return byId.size === 0 ? null : { sections: [...byId.values()] };
109818
- }
109819
109801
  /** Every loaded scoped schema of `cap`, or of every loaded capability. */
109820
109802
  loadedScopedSchemas(cap) {
109821
109803
  if (cap !== void 0) return this._scopedByCap.get(cap) ?? [];
@@ -110405,6 +110387,24 @@ function normalizeAddonInitResult(result) {
110405
110387
  if (Array.isArray(result)) return { providers: result };
110406
110388
  return result;
110407
110389
  }
110390
+ object({
110391
+ code: string().regex(/^[a-z][a-z0-9-]*(\.[a-z0-9-]+)+$/),
110392
+ params: record(string(), union([string(), number$1()])).optional()
110393
+ });
110394
+ var CamstackError = class extends Error {
110395
+ i18nCode;
110396
+ i18nParams;
110397
+ constructor(code, params, englishMessage) {
110398
+ super(englishMessage);
110399
+ this.name = "CamstackError";
110400
+ this.i18nCode = code;
110401
+ this.i18nParams = params;
110402
+ }
110403
+ };
110404
+ /** `throw userError('device.not-found', { id }, 'Device 12 not found')` */
110405
+ function userError(code, params, englishFallback) {
110406
+ return new CamstackError(code, params, englishFallback);
110407
+ }
110408
110408
  object({
110409
110409
  field: string().min(1),
110410
110410
  on: literal("advance")
@@ -110481,12 +110481,6 @@ function systemMethod(input, output, options) {
110481
110481
  systemOnly: true
110482
110482
  };
110483
110483
  }
110484
- /**
110485
- * A method a SOURCE of a collection cap may legitimately not serve — OPTIONAL
110486
- * on `InferProvider`. The `providerOptional: true` literal is what
110487
- * `InferProvider` keys on; see {@link CapabilityMethodSchema.providerOptional}
110488
- * for when this is the honest answer and when it is a soft stub.
110489
- */
110490
110484
  function optionalMethod(input, output, options) {
110491
110485
  return {
110492
110486
  ...method(input, output, options),
@@ -110777,15 +110771,52 @@ var PeerBytesTicketSchema = object({
110777
110771
  */
110778
110772
  declaredBytes: number$1().int().nonnegative().nullable()
110779
110773
  });
110780
- discriminatedUnion("kind", [object({
110781
- kind: literal("action"),
110782
- actionId: string(),
110783
- runId: string(),
110784
- automationId: string().optional()
110785
- }), object({
110786
- kind: literal("scheduler"),
110787
- schedulerId: string()
110788
- })]);
110774
+ /**
110775
+ * The match a notification rule fired on (D705). Carried as a command origin so an
110776
+ * Action the rule starts can press `alarm-panel.trigger` as that match, not as an
110777
+ * anonymous press (D735). The same fields a rule fire ref freezes.
110778
+ */
110779
+ var RuleFireOriginSchema = object({
110780
+ ruleId: string(),
110781
+ ruleName: string(),
110782
+ deviceId: number$1().int(),
110783
+ sourceDeviceId: number$1().int().optional(),
110784
+ recordId: string(),
110785
+ timestamp: number$1(),
110786
+ trackId: string().optional(),
110787
+ eventId: string().optional(),
110788
+ className: string().optional(),
110789
+ label: string().optional(),
110790
+ zones: array(string()).optional(),
110791
+ confidence: number$1().optional(),
110792
+ sensorChange: object({
110793
+ name: string(),
110794
+ kind: string(),
110795
+ state: string()
110796
+ }).optional(),
110797
+ extraStills: array(object({
110798
+ ownerId: string(),
110799
+ cameraId: number$1().int()
110800
+ })).optional()
110801
+ });
110802
+ discriminatedUnion("kind", [
110803
+ object({
110804
+ kind: literal("action"),
110805
+ actionId: string(),
110806
+ runId: string(),
110807
+ automationId: string().optional(),
110808
+ /** The rule fire that started this run, when one did (D705). */
110809
+ ruleFire: RuleFireOriginSchema.optional()
110810
+ }),
110811
+ object({
110812
+ kind: literal("scheduler"),
110813
+ schedulerId: string()
110814
+ }),
110815
+ object({
110816
+ kind: literal("rule"),
110817
+ fire: RuleFireOriginSchema
110818
+ })
110819
+ ]);
110789
110820
  /**
110790
110821
  * One recorded device transition (D1022): a status field of a device went from
110791
110822
  * one value to another, with who or what asked for it.
@@ -111371,7 +111402,7 @@ function t(en, it) {
111371
111402
  * Things an operator switches, opens, sets or arms: lights, plugs, sirens,
111372
111403
  * covers, valves, locks, climate, fans, alarm panels.
111373
111404
  */
111374
- var ON = t("On", "Acceso");
111405
+ var ON$1 = t("On", "Acceso");
111375
111406
  var PERCENT = t("Percentage", "Percentuale");
111376
111407
  var OPEN_CLOSE_STATES = [
111377
111408
  {
@@ -111431,7 +111462,7 @@ var ACTUATOR_CAP_VOCABULARY = {
111431
111462
  state: [{
111432
111463
  kind: "boolean",
111433
111464
  field: "on",
111434
- label: ON,
111465
+ label: ON$1,
111435
111466
  whenTrue: t("When {device} turns on", "Quando {device} si accende"),
111436
111467
  whenFalse: t("When {device} turns off", "Quando {device} si spegne"),
111437
111468
  icon: "power"
@@ -112597,7 +112628,7 @@ var ACTUATOR_CAP_VOCABULARY = {
112597
112628
  state: [{
112598
112629
  kind: "boolean",
112599
112630
  field: "on",
112600
- label: ON,
112631
+ label: ON$1,
112601
112632
  whenTrue: t("When {device} turns on", "Quando {device} si accende"),
112602
112633
  whenFalse: t("When {device} turns off", "Quando {device} si spegne"),
112603
112634
  icon: "power"
@@ -114594,10 +114625,6 @@ var CAMERA_CAP_VOCABULARY = {
114594
114625
  scope: "device",
114595
114626
  noun: t("Admin link", "Link di amministrazione")
114596
114627
  },
114597
- "device-discovery": {
114598
- scope: "device",
114599
- noun: t("Discovery", "Rilevamento dispositivi")
114600
- },
114601
114628
  "device-extension": {
114602
114629
  scope: "device",
114603
114630
  noun: t("Device extension", "Estensione del dispositivo")
@@ -115009,6 +115036,133 @@ var CAMERA_CAP_VOCABULARY = {
115009
115036
  }
115010
115037
  };
115011
115038
  /**
115039
+ * The heat pump (D1026): its system modes are phrased for automations, each with the
115040
+ * values the gateway really accepts; the per-circuit parameters need a circuit and are
115041
+ * set from the device page.
115042
+ */
115043
+ var OFF = {
115044
+ value: "off",
115045
+ label: t("Off", "Off")
115046
+ };
115047
+ var AUTO = {
115048
+ value: "auto",
115049
+ label: t("Auto", "Auto")
115050
+ };
115051
+ var ON = {
115052
+ value: "on",
115053
+ label: t("On", "On")
115054
+ };
115055
+ var MANUAL = {
115056
+ value: "manual",
115057
+ label: t("Manual", "Manuale")
115058
+ };
115059
+ var HOLIDAY_PROGRAMMES = [OFF, ...[
115060
+ 1,
115061
+ 2,
115062
+ 3,
115063
+ 4,
115064
+ 5,
115065
+ 6,
115066
+ 7,
115067
+ 8
115068
+ ].map((n) => ({
115069
+ value: `hm${n}`,
115070
+ label: t(`Programme ${n}`, `Programma ${n}`)
115071
+ }))];
115072
+ var PER_CIRCUIT = "Needs a circuit: set from the device page, not offered to automations";
115073
+ var HEAT_PUMP_CAP_VOCABULARY = {
115074
+ "heat-pump-status": {
115075
+ scope: "device",
115076
+ noun: t("Heat pump", "Pompa di calore")
115077
+ },
115078
+ "heat-pump-control": {
115079
+ scope: "device",
115080
+ noun: t("Heat pump settings", "Impostazioni pompa di calore"),
115081
+ actions: [
115082
+ {
115083
+ id: "heatPump.silent",
115084
+ method: "setSilentMode",
115085
+ label: t("Set silent mode", "Imposta la modalità silenziosa"),
115086
+ phrase: t("Set silent mode of {device} to {mode}", "Imposta la modalità silenziosa di {device} su {mode}"),
115087
+ icon: "volume-x",
115088
+ openArgs: [{
115089
+ key: "mode",
115090
+ label: t("Silent mode", "Modalità silenziosa"),
115091
+ offer: {
115092
+ kind: "enum",
115093
+ values: [
115094
+ OFF,
115095
+ AUTO,
115096
+ ON
115097
+ ]
115098
+ }
115099
+ }]
115100
+ },
115101
+ {
115102
+ id: "heatPump.away",
115103
+ method: "setAwayMode",
115104
+ label: t("Set away mode", "Imposta la modalità assente"),
115105
+ phrase: t("Set away mode of {device} to {mode}", "Imposta la modalità assente di {device} su {mode}"),
115106
+ icon: "plane",
115107
+ openArgs: [{
115108
+ key: "mode",
115109
+ label: t("Away mode", "Modalità assente"),
115110
+ offer: {
115111
+ kind: "enum",
115112
+ values: [OFF, ON]
115113
+ }
115114
+ }]
115115
+ },
115116
+ {
115117
+ id: "heatPump.additionalHeater",
115118
+ method: "setAdditionalHeaterMode",
115119
+ label: t("Set additional heater", "Imposta il riscaldatore aggiuntivo"),
115120
+ phrase: t("Set the additional heater of {device} to {mode}", "Imposta il riscaldatore aggiuntivo di {device} su {mode}"),
115121
+ icon: "flame",
115122
+ openArgs: [{
115123
+ key: "mode",
115124
+ label: t("Additional heater", "Riscaldatore aggiuntivo"),
115125
+ offer: {
115126
+ kind: "enum",
115127
+ values: [
115128
+ OFF,
115129
+ MANUAL,
115130
+ AUTO
115131
+ ]
115132
+ }
115133
+ }]
115134
+ },
115135
+ {
115136
+ id: "heatPump.holiday",
115137
+ method: "setHolidayMode",
115138
+ label: t("Set holiday mode", "Imposta la modalità vacanza"),
115139
+ phrase: t("Set holiday mode of {device} to {mode}", "Imposta la modalità vacanza di {device} su {mode}"),
115140
+ icon: "tree-palm",
115141
+ openArgs: [{
115142
+ key: "mode",
115143
+ label: t("Holiday programme", "Programma vacanza"),
115144
+ offer: {
115145
+ kind: "enum",
115146
+ values: HOLIDAY_PROGRAMMES
115147
+ }
115148
+ }]
115149
+ }
115150
+ ],
115151
+ notOperatorFacing: {
115152
+ setCircuitOperationMode: PER_CIRCUIT,
115153
+ setCircuitHeatCoolMode: PER_CIRCUIT,
115154
+ setCircuitSummerWinter: PER_CIRCUIT,
115155
+ setCircuitComfortSetpoint: PER_CIRCUIT,
115156
+ setCircuitEcoSetpoint: PER_CIRCUIT,
115157
+ setCircuitMaxFlowTemp: PER_CIRCUIT,
115158
+ setDhwOperationMode: PER_CIRCUIT,
115159
+ setDhwTemperatureLevel: PER_CIRCUIT,
115160
+ setDhwChargeDuration: PER_CIRCUIT,
115161
+ startExtraHotWater: PER_CIRCUIT
115162
+ }
115163
+ }
115164
+ };
115165
+ /**
115012
115166
  * Things an operator WATCHES: contacts, motion, leaks, smoke, measurements,
115013
115167
  * presence, reachability, batteries, doorbells and event sources.
115014
115168
  */
@@ -115642,6 +115796,7 @@ var SYSTEM_CAP_VOCABULARY = {
115642
115796
  backup: system("system backups — run and restored from the Backups page"),
115643
115797
  broker: system("message-broker connections — configured, not actuated"),
115644
115798
  "calendar-source": system(INTERNAL),
115799
+ "cluster-update": system(CLUSTER),
115645
115800
  calendars: system("calendars feed schedules and conditions, not device actions"),
115646
115801
  composer: system("device composition — an authoring tool, not an action"),
115647
115802
  "core-blocks": system(INTERNAL),
@@ -115730,6 +115885,7 @@ var CAP_VOCABULARY_BY_NAME = {
115730
115885
  ...ACTUATOR_CAP_VOCABULARY,
115731
115886
  ...APPLIANCE_CAP_VOCABULARY,
115732
115887
  ...CAMERA_CAP_VOCABULARY,
115888
+ ...HEAT_PUMP_CAP_VOCABULARY,
115733
115889
  ...SENSOR_CAP_VOCABULARY,
115734
115890
  ...SYSTEM_CAP_VOCABULARY
115735
115891
  };
@@ -115942,6 +116098,7 @@ var CAP_NAMES = Object.freeze([
115942
116098
  "camera-streams",
115943
116099
  "carbon-monoxide",
115944
116100
  "climate-control",
116101
+ "cluster-update",
115945
116102
  "color",
115946
116103
  "composer",
115947
116104
  "connectivity",
@@ -115959,7 +116116,6 @@ var CAP_NAMES = Object.freeze([
115959
116116
  "device-admin-link",
115960
116117
  "device-adoption",
115961
116118
  "device-credentials",
115962
- "device-discovery",
115963
116119
  "device-export",
115964
116120
  "device-extension",
115965
116121
  "device-history",
@@ -115989,6 +116145,8 @@ var CAP_NAMES = Object.freeze([
115989
116145
  "group-active",
115990
116146
  "group-commands",
115991
116147
  "group-status",
116148
+ "heat-pump-control",
116149
+ "heat-pump-status",
115992
116150
  "heating-valve",
115993
116151
  "hero-layout",
115994
116152
  "humidifier",
@@ -116579,13 +116737,6 @@ Object.freeze({
116579
116737
  "valueType": "string"
116580
116738
  }
116581
116739
  ],
116582
- "device-discovery": [{
116583
- "path": "lastDiscoveryAt",
116584
- "valueType": "number"
116585
- }, {
116586
- "path": "lastError",
116587
- "valueType": "string"
116588
- }],
116589
116740
  "device-export": [
116590
116741
  {
116591
116742
  "path": "linkState",
@@ -116854,6 +117005,48 @@ Object.freeze({
116854
117005
  "valueType": "number"
116855
117006
  }
116856
117007
  ],
117008
+ "heat-pump-status": [
117009
+ {
117010
+ "path": "power.thermalW",
117011
+ "valueType": "number"
117012
+ },
117013
+ {
117014
+ "path": "power.electricalW",
117015
+ "valueType": "number"
117016
+ },
117017
+ {
117018
+ "path": "power.compressorPct",
117019
+ "valueType": "number"
117020
+ },
117021
+ {
117022
+ "path": "temperatures.supply",
117023
+ "valueType": "number"
117024
+ },
117025
+ {
117026
+ "path": "temperatures.return",
117027
+ "valueType": "number"
117028
+ },
117029
+ {
117030
+ "path": "temperatures.outdoor",
117031
+ "valueType": "number"
117032
+ },
117033
+ {
117034
+ "path": "energy.thermalKwh",
117035
+ "valueType": "number"
117036
+ },
117037
+ {
117038
+ "path": "energy.electricalKwh",
117039
+ "valueType": "number"
117040
+ },
117041
+ {
117042
+ "path": "waterPressureBar",
117043
+ "valueType": "number"
117044
+ },
117045
+ {
117046
+ "path": "starts",
117047
+ "valueType": "number"
117048
+ }
117049
+ ],
116857
117050
  "heating-valve": [{
116858
117051
  "path": "position",
116859
117052
  "valueType": "number"
@@ -117994,24 +118187,6 @@ Object.freeze({
117994
118187
  "uploadDataset": 72e5
117995
118188
  }
117996
118189
  });
117997
- object({
117998
- code: string().regex(/^[a-z][a-z0-9-]*(\.[a-z0-9-]+)+$/),
117999
- params: record(string(), union([string(), number$1()])).optional()
118000
- });
118001
- var CamstackError = class extends Error {
118002
- i18nCode;
118003
- i18nParams;
118004
- constructor(code, params, englishMessage) {
118005
- super(englishMessage);
118006
- this.name = "CamstackError";
118007
- this.i18nCode = code;
118008
- this.i18nParams = params;
118009
- }
118010
- };
118011
- /** `throw userError('device.not-found', { id }, 'Device 12 not found')` */
118012
- function userError(code, params, englishFallback) {
118013
- return new CamstackError(code, params, englishFallback);
118014
- }
118015
118190
  /**
118016
118191
  * Promise-based timer helpers — used everywhere the codebase needs to
118017
118192
  * wait, back off, or schedule a retry. Before these helpers landed, each
@@ -118037,7 +118212,7 @@ function sleep(ms) {
118037
118212
  return new Promise((resolve) => setTimeout(resolve, Math.max(0, ms)));
118038
118213
  }
118039
118214
  //#endregion
118040
- //#region ../types/dist/composition-CXCX78IR.mjs
118215
+ //#region ../types/dist/implemented-methods-M5aguGon.mjs
118041
118216
  /**
118042
118217
  * The ffmpeg build every CamStack node downloads, per platform and arch.
118043
118218
  *
@@ -118992,8 +119167,6 @@ var HelperSpecSchema = discriminatedUnion("kind", [
118992
119167
  source: HelperMemberSchema
118993
119168
  })
118994
119169
  ]);
118995
- /** A composed device's stableId is this prefix plus the block id. */
118996
- var COMPOSED_DEVICE_STABLE_ID_PREFIX = "composed-";
118997
119170
  /** Longest snippet a `code` source may carry (slice 4). */
118998
119171
  var MAX_COMPOSITION_CODE_LENGTH = 2e4;
118999
119172
  /** One field of one capability of one source device. */
@@ -119768,25 +119941,6 @@ var RequiredAddonUpdateSchema = object({
119768
119941
  installed: string().nullable()
119769
119942
  });
119770
119943
  /**
119771
- * Which integration instance a settings form is for. An addon that serves several instances
119772
- * (`instanceMode: multiple`) can show a different form per instance — an NVR integration
119773
- * needs its connection, the default integration needs the addon's own sections.
119774
- *
119775
- * - `integrationId` is `null` in the create wizard: nothing exists yet, the operator is
119776
- * setting up a NEW instance.
119777
- * - `mode` is the wizard mode of the integration type (`getAvailableTypes`).
119778
- * - `candidateStableId` is the discovery candidate a wizard was seeded from, if any.
119779
- */
119780
- var IntegrationInstanceRefSchema = object({
119781
- integrationId: string().nullable(),
119782
- mode: _enum([
119783
- "standalone",
119784
- "account",
119785
- "broker"
119786
- ]),
119787
- candidateStableId: string().optional()
119788
- });
119789
- /**
119790
119944
  * notification-output — canonical, capability-gated notification delivery.
119791
119945
  *
119792
119946
  * Apprise-derived model (see
@@ -120015,18 +120169,43 @@ var TargetKindLevelSchema = object({
120015
120169
  requires: array(string()).optional(),
120016
120170
  description: string().optional()
120017
120171
  });
120172
+ /** Attachment capabilities for a kind (drives the degrade engine + test panel). */
120173
+ var TargetKindAttachmentsCapsSchema = object({
120174
+ mediaTypes: array(AttachmentMediaTypeSchema),
120175
+ mode: _enum([
120176
+ "url",
120177
+ "bytes",
120178
+ "both"
120179
+ ]),
120180
+ max: number$1().int().nonnegative(),
120181
+ maxBytes: number$1().int().positive().optional()
120182
+ });
120183
+ /**
120184
+ * Which TEXT fields a kind delivers (#483). Alexa speaks a title and nothing
120185
+ * else; a push service shows both.
120186
+ *
120187
+ * `.optional()` on the caps block, never defaulted: absent = both, which is
120188
+ * what every kind declared before this field meant (D938's rule for a Zod
120189
+ * default on the addon cap path).
120190
+ */
120191
+ var TargetKindTextCapsSchema = object({
120192
+ title: boolean(),
120193
+ body: boolean()
120194
+ });
120195
+ _enum([
120196
+ "title",
120197
+ "body",
120198
+ "attachments",
120199
+ "actions",
120200
+ "priority",
120201
+ "sound",
120202
+ "clickUrl"
120203
+ ]);
120018
120204
  /** The full capability block consulted before dispatch. */
120019
120205
  var TargetKindCapsSchema = object({
120020
- attachments: object({
120021
- mediaTypes: array(AttachmentMediaTypeSchema),
120022
- mode: _enum([
120023
- "url",
120024
- "bytes",
120025
- "both"
120026
- ]),
120027
- max: number$1().int().nonnegative(),
120028
- maxBytes: number$1().int().positive().optional()
120029
- }),
120206
+ /** Text fields this kind delivers (#483). Absent = title AND body. */
120207
+ text: TargetKindTextCapsSchema.optional(),
120208
+ attachments: TargetKindAttachmentsCapsSchema,
120030
120209
  /** Max action buttons (0 = none). */
120031
120210
  actions: number$1().int().nonnegative(),
120032
120211
  /**
@@ -145371,6 +145550,62 @@ var WeekdayKeySchema = _enum([
145371
145550
  "sat",
145372
145551
  "sun"
145373
145552
  ]);
145553
+ /**
145554
+ * Hold semantics — "for N seconds" on a leaf of the `when` tree (#498).
145555
+ *
145556
+ * ONE primitive, `for: { ms, mode, tolerance? }`, shared by `device-becomes`,
145557
+ * `device-is` and `expression`:
145558
+ *
145559
+ * - `held`: the condition stays true for `ms`;
145560
+ * - `stable`: the value does not move by more than `tolerance` (absolute, in
145561
+ * the field's base unit) for `ms` while the condition holds.
145562
+ *
145563
+ * {@link HoldCore} is the pure state machine (an input observation → a reading).
145564
+ * {@link HoldTracker} keys cores by a leaf path for the STATE leaves the tree
145565
+ * evaluator judges. {@link BecomesWatch} wraps a core with a timer for the
145566
+ * `device-becomes` EVENT leaf: the deadline is armed when the hold starts and
145567
+ * cancelled when it breaks, and the leaf fires ONCE per episode.
145568
+ *
145569
+ * Hold state is memory only. A hold that is already running when the watcher
145570
+ * first looks (a restart) is INHERITED: nobody knows when it began, so it never
145571
+ * fires for that episode and a state leaf reads it as unknown until the window
145572
+ * has elapsed from the moment the watcher started (D49: not-known is not false).
145573
+ */
145574
+ var HOLD_MAX_MS = 864e5;
145575
+ var HoldModeSchema = _enum(["held", "stable"]);
145576
+ var HoldSpecSchema = object({
145577
+ /** How long the condition (or the value) must hold. */
145578
+ ms: number$1().int().min(1).max(HOLD_MAX_MS),
145579
+ mode: HoldModeSchema,
145580
+ /** `stable` only: the largest move of the value that still counts as unchanged (absolute, base unit). */
145581
+ tolerance: number$1().min(0).optional()
145582
+ });
145583
+ /** What a trace says about a hold. */
145584
+ var HoldTraceSchema = object({
145585
+ phase: _enum([
145586
+ "pending",
145587
+ "cancelled",
145588
+ "fired",
145589
+ "reseeded"
145590
+ ]),
145591
+ ms: number$1().int(),
145592
+ mode: HoldModeSchema,
145593
+ /** When the hold started (ms epoch). */
145594
+ since: number$1().optional(),
145595
+ /** When it completes (ms epoch), for a pending hold. */
145596
+ deadline: number$1().optional()
145597
+ });
145598
+ /** The operators a `device-becomes` leaf may carry: a threshold or a range. */
145599
+ var BecomesOperatorSchema = _enum([
145600
+ "eq",
145601
+ "ne",
145602
+ "gt",
145603
+ "gte",
145604
+ "lt",
145605
+ "lte",
145606
+ "between",
145607
+ "outside"
145608
+ ]);
145374
145609
  /** How a state leaf compares a device field to a value. Derived from the
145375
145610
  * field's `kind` in `deviceManager.getWireableFields`, never hand-maintained. */
145376
145611
  var AutomationConditionOperatorSchema = _enum([
@@ -145394,18 +145629,52 @@ var DeviceBecomesLeafSchema = object({
145394
145629
  deviceId: number$1().int().nonnegative(),
145395
145630
  cap: string().min(1),
145396
145631
  fieldPath: string().min(1),
145397
- /** Fire when the field takes this value. Omit to fire on any change. */
145632
+ /** Fire when the field takes this value. Omit (with no `operator`) to fire on any change. */
145398
145633
  becomes: union([
145399
145634
  string(),
145400
145635
  number$1(),
145401
145636
  boolean()
145402
145637
  ]).optional(),
145403
- /** Only on a CHANGE of value, not on every re-report. */
145638
+ /**
145639
+ * A threshold or a range instead of an equality: "crosses above 3000", "enters
145640
+ * 18..24". The leaf fires on the TRANSITION into the predicate, never on a re-report.
145641
+ * `value` is in the field's base unit; `between` / `outside` take `[low, high]`.
145642
+ */
145643
+ operator: BecomesOperatorSchema.optional(),
145644
+ value: union([
145645
+ number$1(),
145646
+ string(),
145647
+ boolean(),
145648
+ array(number$1()).length(2)
145649
+ ]).optional(),
145650
+ /**
145651
+ * Hold: the transition (or, with no predicate, the new value) must stay for
145652
+ * `for.ms` before the leaf fires, ONCE per episode. See `hold.ts`.
145653
+ */
145654
+ for: HoldSpecSchema.optional(),
145655
+ /** @deprecated every leaf fires on a transition now; read as always on. */
145404
145656
  edge: boolean().optional(),
145405
- /** The new value must hold this long before it counts. */
145406
- forMs: number$1().int().min(0).max(864e5).optional(),
145657
+ /** @deprecated legacy `held` window — read through `holdOf` as `for: { ms, mode: 'held' }`. */
145658
+ forMs: number$1().int().min(0).max(HOLD_MAX_MS).optional(),
145407
145659
  /** Collapse a burst into one occurrence. */
145408
145660
  debounceMs: number$1().int().min(0).max(6e5).optional()
145661
+ }).superRefine((leaf, ctx) => {
145662
+ if (leaf.becomes !== void 0 && leaf.operator !== void 0) ctx.addIssue({
145663
+ code: "custom",
145664
+ message: "a leaf names `becomes` or `operator`, not both",
145665
+ path: ["operator"]
145666
+ });
145667
+ if (leaf.operator !== void 0 && leaf.value === void 0) ctx.addIssue({
145668
+ code: "custom",
145669
+ message: "an operator needs the value to compare to",
145670
+ path: ["value"]
145671
+ });
145672
+ const range = leaf.operator === "between" || leaf.operator === "outside";
145673
+ if (leaf.operator !== void 0 && range !== Array.isArray(leaf.value)) ctx.addIssue({
145674
+ code: "custom",
145675
+ message: range ? "a range takes [low, high]" : "only a range takes [low, high]",
145676
+ path: ["value"]
145677
+ });
145409
145678
  });
145410
145679
  var DeviceEventLeafSchema = object({
145411
145680
  kind: literal("device-event"),
@@ -145470,7 +145739,9 @@ var DeviceIsLeafSchema = object({
145470
145739
  QuantityValueSchema
145471
145740
  ]),
145472
145741
  /** The unit the person picked for `value` (display only; `value` is in the base unit). */
145473
- unit: string().min(1).optional()
145742
+ unit: string().min(1).optional(),
145743
+ /** The comparison must hold (`held`) or the value stay put (`stable`) this long. */
145744
+ for: HoldSpecSchema.optional()
145474
145745
  });
145475
145746
  /**
145476
145747
  * True when the camera currently has a PARKED object matching `subjects` in at
@@ -145493,7 +145764,9 @@ var StationaryPresentLeafSchema = object({
145493
145764
  var ExpressionLeafSchema = object({
145494
145765
  kind: literal("expression"),
145495
145766
  expr: string().min(1).max(MAX_EXPRESSION_SOURCE_LENGTH),
145496
- bindings: record(string().regex(EXPRESSION_IDENTIFIER_RE), ExpressionBindingSourceSchema)
145767
+ bindings: record(string().regex(EXPRESSION_IDENTIFIER_RE), ExpressionBindingSourceSchema),
145768
+ /** The expression must stay true this long. An expression has no single value, so only `held`. */
145769
+ for: HoldSpecSchema.optional()
145497
145770
  }).superRefine((src, ctx) => {
145498
145771
  const err = validateExpressionSource(src);
145499
145772
  if (err !== null) ctx.addIssue({
@@ -145501,6 +145774,11 @@ var ExpressionLeafSchema = object({
145501
145774
  message: err,
145502
145775
  path: ["expr"]
145503
145776
  });
145777
+ if (src.for?.mode === "stable") ctx.addIssue({
145778
+ code: "custom",
145779
+ message: "an expression is held, not stable: it has no single value to keep still",
145780
+ path: ["for", "mode"]
145781
+ });
145504
145782
  });
145505
145783
  var AutomationWhenSchema = lazy(() => discriminatedUnion("kind", [
145506
145784
  object({
@@ -145831,30 +146109,21 @@ function convertLegacyWhen(half) {
145831
146109
  * (instants) and state leaves (durations). It replaces the flat trigger list
145832
146110
  * plus the separate condition tree; the firing rule is in that file and in
145833
146111
  * ADR "one tree".
145834
- * - **Actions** — `NcRuleActionSchema`'s two steps, plus the `{kind:'code'}`
145835
- * fragment of §3.2.2. See {@link AutomationActionSchema} for the ONE place
145836
- * this had to diverge from "verbatim", and why.
146112
+ * - **Actions** — the `wait` and `cap` steps, plus the `{kind:'code'}`
146113
+ * fragment of §3.2.2. See {@link AutomationActionSchema}.
145837
146114
  *
145838
146115
  * A recipe stored in the old shape (`triggers` + `conditions`) still LOADS:
145839
146116
  * {@link AutomationRecipeSchema} (the parse-anywhere schema) converts it on parse. Nothing writes it.
145840
146117
  */
145841
146118
  /**
145842
- * One action step.
145843
- *
145844
- * `wait` and `cap` are `NcRuleActionSchema`'s two members, kept structurally
145845
- * identical so `NcRuleActionRunner` runs them unchanged — its device-scope
145846
- * check, stop-at-first-failure and per-sequence throttle are the whole reason
145847
- * to reuse it, and none of them are re-implemented here.
146119
+ * One action step: `wait`, or a `cap` call.
145848
146120
  *
145849
- * **The one divergence, and it is forced.** `NcRuleActionSchema.cap.deviceId` is
145850
- * a literal `z.number().int()`, and the NC runner's own `RunSequencesInput`
145851
- * documents its subject device as *"for the log tag, never for routing"*. So an
145852
- * NC action can never target the device that triggered it — which is fine for
145853
- * the NC (its rules already scope to a device) and fatal for an automation
145854
- * ("sound the siren of the camera that saw the person"). `deviceId` therefore
145855
- * also accepts `{ $var }`, resolved from the run's `vars` bag BEFORE the runner
145856
- * is called. The runner still receives a number and is untouched; the
145857
- * resolution is the recipe's job, not the runner's.
146121
+ * A cap step's target is who it acts on (D983: `devices`, a `domain`, or a
146122
+ * `{ $var }` resolved from the run's variables); the legacy `deviceId` is still
146123
+ * READ, never written. The step runner (`runSteps`) owns the device-scope
146124
+ * check, the stop-at-first-failure and the variable substitution, once, for
146125
+ * every caller — automations, Actions, and the notification centre, which runs
146126
+ * only Actions (planning#473).
145858
146127
  */
145859
146128
  var AutomationWaitStepSchema = object({
145860
146129
  kind: literal("wait"),
@@ -145901,21 +146170,44 @@ var AutomationCapStepBaseSchema = object({
145901
146170
  */
145902
146171
  argUnits: record(string(), string().min(1)).optional()
145903
146172
  });
145904
- var AutomationCapStepSchema = AutomationCapStepBaseSchema.refine((step) => step.target !== void 0 || step.deviceId !== void 0, {
146173
+ /**
146174
+ * The steps an internal Action may contain: cap and wait, and nothing that can
146175
+ * call back into an Action — so an Action can never reach itself (no cycles).
146176
+ * This is the LEAF shape: no condition of its own.
146177
+ */
146178
+ var LeafActionStepSchema = discriminatedUnion("kind", [AutomationWaitStepSchema, AutomationCapStepBaseSchema.refine((step) => step.target !== void 0 || step.deviceId !== void 0, {
145905
146179
  message: "a cap step needs a target",
145906
146180
  path: ["target"]
145907
146181
  }).refine((step) => step.target?.kind !== "domain" || step.actionId !== void 0, {
145908
146182
  message: "a domain target needs the vocabulary action it applies to (actionId)",
145909
146183
  path: ["actionId"]
145910
- });
146184
+ })]);
145911
146185
  /**
145912
- * The steps an internal Action may contain: cap and wait, and nothing that can
145913
- * call back into an Action — so an Action can never reach itself (no cycles).
146186
+ * The optional guard of a step (#472): `if` is the ONE `when` tree (D980), read
146187
+ * on the state mirror when the step is reached; `else` runs when it is false.
146188
+ * An `else` holds leaf steps only — the nesting is bounded at ONE level, so a
146189
+ * branch can never grow a tree the trace has to draw.
145914
146190
  */
145915
- var ActionStepSchema = discriminatedUnion("kind", [AutomationWaitStepSchema, AutomationCapStepSchema]);
146191
+ var stepGuardShape = {
146192
+ if: AutomationWhenSchema.optional(),
146193
+ else: array(LeafActionStepSchema).max(10).optional()
146194
+ };
146195
+ var elseNeedsIf = {
146196
+ message: "an else list needs the condition it is the other side of (if)",
146197
+ path: ["else"]
146198
+ };
146199
+ var GuardedWaitStepSchema = AutomationWaitStepSchema.extend(stepGuardShape).refine((step) => step.else === void 0 || step.if !== void 0, elseNeedsIf);
146200
+ var GuardedCapStepSchema = AutomationCapStepBaseSchema.extend(stepGuardShape).refine((step) => step.target !== void 0 || step.deviceId !== void 0, {
146201
+ message: "a cap step needs a target",
146202
+ path: ["target"]
146203
+ }).refine((step) => step.target?.kind !== "domain" || step.actionId !== void 0, {
146204
+ message: "a domain target needs the vocabulary action it applies to (actionId)",
146205
+ path: ["actionId"]
146206
+ }).refine((step) => step.else === void 0 || step.if !== void 0, elseNeedsIf);
146207
+ var ActionStepSchema = discriminatedUnion("kind", [GuardedWaitStepSchema, GuardedCapStepSchema]);
145916
146208
  var AutomationActionSchema = discriminatedUnion("kind", [
145917
- AutomationWaitStepSchema,
145918
- AutomationCapStepSchema,
146209
+ GuardedWaitStepSchema,
146210
+ GuardedCapStepSchema,
145919
146211
  object({
145920
146212
  kind: literal("action"),
145921
146213
  /** An entry of the `actions` surface (`internal:<uuid>` or `<addonId>:<localId>`). */
@@ -146246,7 +146538,9 @@ var AutomationTriggerTraceSchema = object({
146246
146538
  /** Why an event was rejected ("class person not in [dog]") or what fired. */
146247
146539
  reason: string(),
146248
146540
  /** deviceId, className, trackId, score … — only what the trigger exposes. */
146249
- vars: record(string(), TraceValueSchema)
146541
+ vars: record(string(), TraceValueSchema),
146542
+ /** A hold (`for`) this occurrence went through: pending, cancelled, fired or re-seeded. */
146543
+ hold: HoldTraceSchema.optional()
146250
146544
  });
146251
146545
  var AutomationConditionTraceNodeSchema = object({
146252
146546
  /** `when` for the root, `when.<i>` for its i-th child, … (`conditions…` on an old trace). */
@@ -146295,7 +146589,7 @@ var StepDeviceTraceSchema = object({
146295
146589
  outcome: _enum(["ok", "error"]),
146296
146590
  message: string().optional()
146297
146591
  });
146298
- var AutomationStepTraceSchema = object({
146592
+ var StepTraceBaseSchema = object({
146299
146593
  /** `actions.<i>` */
146300
146594
  path: string().min(1),
146301
146595
  kind: string().min(1),
@@ -146314,15 +146608,35 @@ var AutomationStepTraceSchema = object({
146314
146608
  * is shown as {@link REDACTED_ARG}. Absent on traces written before it existed.
146315
146609
  */
146316
146610
  args: record(string(), TraceValueSchema).optional(),
146317
- /** `empty`: the target resolved to no device, so nothing was done — never silently `ok`. */
146611
+ /**
146612
+ * The device values a templated arg printed as `—`, one `ref: reason` each
146613
+ * (D1021): why a sentence says "—" where a number was expected. Bounded.
146614
+ */
146615
+ templates: array(string()).max(20).optional(),
146616
+ /**
146617
+ * What the step's own `if` read when the step was reached (#472): `true` the
146618
+ * step ran, `false` its `else` ran (or nothing did), `unknown` a state leaf
146619
+ * could not be read, so NEITHER side ran. Absent on an unguarded step.
146620
+ */
146621
+ condition: _enum([
146622
+ "true",
146623
+ "false",
146624
+ "unknown"
146625
+ ]).optional(),
146626
+ /** Why the condition read what it read, in the evaluator's own words. */
146627
+ conditionReason: string().optional(),
146628
+ /** `empty`: the target resolved to no device, so nothing was done — never silently `ok`. `skipped`: its `if` was false (or unknown) and nothing ran in its place. */
146318
146629
  outcome: _enum([
146319
146630
  "ok",
146320
146631
  "error",
146321
146632
  "not-run",
146322
- "empty"
146633
+ "empty",
146634
+ "skipped"
146323
146635
  ]),
146324
146636
  message: string().optional()
146325
146637
  });
146638
+ /** A step trace; the `else` steps that ran are one level of the same shape (the nesting is bounded at one). */
146639
+ var AutomationStepTraceSchema = StepTraceBaseSchema.extend({ else: array(StepTraceBaseSchema).optional() });
146326
146640
  var AutomationRunTraceSchema = object({
146327
146641
  runId: string().min(1),
146328
146642
  startedAt: number$1(),
@@ -146429,6 +146743,8 @@ var ActionStatusSchema = object({
146429
146743
  /** The latest run's failure; null on success or when it never ran. */
146430
146744
  lastError: string().nullable()
146431
146745
  });
146746
+ /** The throttle window of an action, in seconds; absent or 0 = no throttle. */
146747
+ var ActionMinDelaySecSchema = number$1().int().min(0).max(86400);
146432
146748
  var ActionEntrySchema = object({
146433
146749
  /** `internal:<uuid>` or `<addonId>:<localId>`. */
146434
146750
  id: string().min(3),
@@ -146441,6 +146757,14 @@ var ActionEntrySchema = object({
146441
146757
  /** Internal only: cap and wait steps. No action-in-action, so no cycles. */
146442
146758
  steps: array(ActionStepSchema).min(1).max(50).optional(),
146443
146759
  variables: array(ActionVariableSchema).max(20).optional(),
146760
+ /**
146761
+ * Internal only: the least time between two run STARTS. A run that begins
146762
+ * inside the window is skipped (`skipped-cooldown`), traced and logged. It
146763
+ * is an actuator's budget — "how often may this gate physically open" —
146764
+ * not a notification cooldown, and it is shared by every caller of the
146765
+ * action (two rules, a button, an automation).
146766
+ */
146767
+ minDelaySec: ActionMinDelaySecSchema.optional(),
146444
146768
  status: ActionStatusSchema
146445
146769
  }).superRefine((entry, ctx) => {
146446
146770
  if (entry.source === "internal") {
@@ -146471,7 +146795,8 @@ var ActionEntrySchema = object({
146471
146795
  var ActionInputSchema = object({
146472
146796
  name: string().min(1).max(120),
146473
146797
  steps: array(ActionStepSchema).min(1).max(50),
146474
- variables: array(ActionVariableSchema).max(20).optional()
146798
+ variables: array(ActionVariableSchema).max(20).optional(),
146799
+ minDelaySec: ActionMinDelaySecSchema.optional()
146475
146800
  });
146476
146801
  /** Who started a run. Absent = the operator pressed it. */
146477
146802
  var ActionRunOriginSchema = object({
@@ -146498,6 +146823,7 @@ _enum([
146498
146823
  "invalid-variables",
146499
146824
  "invalid-steps",
146500
146825
  "not-linked",
146826
+ "template-scope",
146501
146827
  "busy"
146502
146828
  ]);
146503
146829
  object({
@@ -146560,7 +146886,7 @@ object({
146560
146886
  * is irrelevant; the array is treated as a set by consumers. */
146561
146887
  hiddenChildIds: array(number$1()).readonly()
146562
146888
  });
146563
- DeviceType.Camera, DeviceType.Hub, DeviceType.Switch, DeviceType.Light, DeviceType.Sensor, DeviceType.Thermostat, DeviceType.Cover, DeviceType.Lock, DeviceType.Fan, DeviceType.MediaPlayer, DeviceType.AlarmPanel, DeviceType.Generic, method(object({
146889
+ DeviceType.Camera, DeviceType.Switch, DeviceType.Light, DeviceType.Sensor, DeviceType.Thermostat, DeviceType.Cover, DeviceType.Lock, DeviceType.Fan, DeviceType.MediaPlayer, DeviceType.AlarmPanel, DeviceType.Generic, method(object({
146564
146890
  deviceId: number$1().int().nonnegative(),
146565
146891
  childDeviceId: number$1().int().nonnegative(),
146566
146892
  hidden: boolean()
@@ -146822,10 +147148,6 @@ method(object({
146822
147148
  scope: ScopedSettingsScopeSchema,
146823
147149
  nodeId: string().optional()
146824
147150
  }), record(string(), unknown()).nullable()), method(object({
146825
- addonId: string(),
146826
- nodeId: string().optional(),
146827
- instance: IntegrationInstanceRefSchema
146828
- }), SettingsSchemaWithValuesSchema.nullable()), method(object({
146829
147151
  addonId: string(),
146830
147152
  nodeId: string().optional()
146831
147153
  }), object({ keys: array(string()) }).nullable(), { auth: "admin" }), method(object({
@@ -149242,7 +149564,14 @@ var CalendarInfoSchema = object({
149242
149564
  id: string().min(1),
149243
149565
  name: string().min(1),
149244
149566
  source: CalendarSourceKindSchema,
149245
- enabled: boolean()
149567
+ enabled: boolean(),
149568
+ /**
149569
+ * The `integration-instances` record that owns this calendar (the record the switch writes).
149570
+ * Every source stamps it from the record it read the calendar from, so a consumer joins on
149571
+ * it instead of rebuilding an id from form values. Optional on the wire so a source addon
149572
+ * that predates the field still lists its calendars: such a row simply has no switch.
149573
+ */
149574
+ instanceId: string().min(1).optional()
149246
149575
  });
149247
149576
  /**
149248
149577
  * Time contract of {@link CalendarEvent}.
@@ -150627,14 +150956,14 @@ var climateControlCapability = {
150627
150956
  kind: "mutation",
150628
150957
  auth: "protected"
150629
150958
  }),
150630
- setFanMode: method(object({
150959
+ setFanMode: optionalMethod(object({
150631
150960
  deviceId: number$1().int().nonnegative(),
150632
150961
  fanMode: string().min(1)
150633
150962
  }), _void(), {
150634
150963
  kind: "mutation",
150635
150964
  auth: "protected"
150636
150965
  }),
150637
- setPreset: method(object({
150966
+ setPreset: optionalMethod(object({
150638
150967
  deviceId: number$1().int().nonnegative(),
150639
150968
  preset: string().min(1)
150640
150969
  }), _void(), {
@@ -150648,7 +150977,7 @@ var climateControlCapability = {
150648
150977
  kind: "mutation",
150649
150978
  auth: "protected"
150650
150979
  }),
150651
- setTargetRange: method(object({
150980
+ setTargetRange: optionalMethod(object({
150652
150981
  deviceId: number$1().int().nonnegative(),
150653
150982
  targetLow: number$1(),
150654
150983
  targetHigh: number$1()
@@ -150656,21 +150985,21 @@ var climateControlCapability = {
150656
150985
  kind: "mutation",
150657
150986
  auth: "protected"
150658
150987
  }),
150659
- setTargetHumidity: method(object({
150988
+ setTargetHumidity: optionalMethod(object({
150660
150989
  deviceId: number$1().int().nonnegative(),
150661
150990
  targetHumidity: number$1().min(0).max(100)
150662
150991
  }), _void(), {
150663
150992
  kind: "mutation",
150664
150993
  auth: "protected"
150665
150994
  }),
150666
- setSwingVertical: method(object({
150995
+ setSwingVertical: optionalMethod(object({
150667
150996
  deviceId: number$1().int().nonnegative(),
150668
150997
  on: boolean()
150669
150998
  }), _void(), {
150670
150999
  kind: "mutation",
150671
151000
  auth: "protected"
150672
151001
  }),
150673
- setSwingHorizontal: method(object({
151002
+ setSwingHorizontal: optionalMethod(object({
150674
151003
  deviceId: number$1().int().nonnegative(),
150675
151004
  on: boolean()
150676
151005
  }), _void(), {
@@ -150728,6 +151057,140 @@ var climateControlCapability = {
150728
151057
  } }
150729
151058
  };
150730
151059
  /**
151060
+ * cluster-update — the ONE flow that brings the whole cluster to a release
151061
+ * (planning#493). Hub-provided (`server-provided`), hub-only: the hub runs
151062
+ * the sequence itself, so the admin UI, the MCP and the CLI all start the same
151063
+ * job and read the same report instead of each driving their own loop.
151064
+ *
151065
+ * 1. backup (`backup.trigger`) — skipped only when the caller says so
151066
+ * 2. the hub's server closure (`applyServerUpdate`); the hub restarts and the
151067
+ * job RESUMES on the new boot, verified against the hub's running version
151068
+ * 3. every online agent behind the target, one at a time, verified: runs the
151069
+ * target, settled, online, and its capabilities registered (D848) — an
151070
+ * agent that comes back capless is a FAILED step, never a done one
151071
+ * 4. every stale addon on the hub (`addons.updatePackage`); agents follow by
151072
+ * reconciliation, which is verified, never pushed
151073
+ *
151074
+ * The job stops on the first failed step with a typed reason (D877). Its state
151075
+ * is durable on the hub and read by RPC (`getClusterUpdateJob`) — events are
151076
+ * telemetry and never carry it (D8, D11).
151077
+ */
151078
+ /** The steps, in the order they run. */
151079
+ var ClusterUpdateStepKindSchema = _enum([
151080
+ "backup",
151081
+ "hub-server",
151082
+ "agent-server",
151083
+ "addons"
151084
+ ]);
151085
+ /**
151086
+ * - `pending` — not reached yet.
151087
+ * - `running` — in progress (for `hub-server`: possibly across the restart).
151088
+ * - `ok` — done AND verified.
151089
+ * - `failed` — did not land; `reason` + `detail` say why. Stops the job.
151090
+ * - `skipped` — not run: nothing to do, opted out, the node is offline, or a
151091
+ * step before it failed. `detail` says which.
151092
+ */
151093
+ var ClusterUpdateStepStatusSchema = _enum([
151094
+ "pending",
151095
+ "running",
151096
+ "ok",
151097
+ "failed",
151098
+ "skipped"
151099
+ ]);
151100
+ /**
151101
+ * Why a step (and with it the job) failed. Stable, greppable; `detail` carries
151102
+ * the prose.
151103
+ */
151104
+ var ClusterUpdateFailureReasonSchema = _enum([
151105
+ "backup-unavailable",
151106
+ "backup-failed",
151107
+ "server-refused",
151108
+ "server-not-on-target",
151109
+ "node-capless",
151110
+ "status-unreadable",
151111
+ "addon-update-failed",
151112
+ "addons-not-converged",
151113
+ "interrupted"
151114
+ ]);
151115
+ var ClusterUpdateStepSchema = object({
151116
+ kind: ClusterUpdateStepKindSchema,
151117
+ /** The node the step acts on; absent for `backup` and `addons`. */
151118
+ nodeId: string().optional(),
151119
+ status: ClusterUpdateStepStatusSchema,
151120
+ /** One line for the operator: what happened, or why not. */
151121
+ detail: string(),
151122
+ reason: ClusterUpdateFailureReasonSchema.optional(),
151123
+ /** `hub-server` / `agent-server`: the version the node ran before. */
151124
+ fromVersion: string().nullable().optional(),
151125
+ /** `addons`: the packages this step updates, `name from -> to`. */
151126
+ packages: array(string()).readonly().optional(),
151127
+ startedAt: number$1().optional(),
151128
+ finishedAt: number$1().optional()
151129
+ });
151130
+ var ClusterUpdateJobStateSchema = _enum([
151131
+ "running",
151132
+ "succeeded",
151133
+ "failed"
151134
+ ]);
151135
+ var ClusterUpdateJobSchema = object({
151136
+ id: string(),
151137
+ state: ClusterUpdateJobStateSchema,
151138
+ /** The server version every node is brought to. */
151139
+ targetVersion: string(),
151140
+ /** Who started it (the user name, or `system`). */
151141
+ requestedBy: string(),
151142
+ startedAt: number$1(),
151143
+ finishedAt: number$1().optional(),
151144
+ /** Every step, in run order; later steps stay `pending` while it runs. */
151145
+ steps: array(ClusterUpdateStepSchema).readonly(),
151146
+ /** On `failed`: the step that stopped it (`nodeId` or the step kind). */
151147
+ stoppedAt: string().optional(),
151148
+ reason: ClusterUpdateFailureReasonSchema.optional(),
151149
+ /** Agents offline when the plan was read: never touched. */
151150
+ skippedOffline: array(string()).readonly()
151151
+ });
151152
+ var ClusterUpdateOptionsSchema = object({
151153
+ /** Explicit server target; omitted = the hub's latest registry check. */
151154
+ version: string().optional(),
151155
+ /** Update the addons too (default true). */
151156
+ addons: boolean().optional(),
151157
+ /**
151158
+ * Back up before touching anything (default true). `false` is an explicit
151159
+ * operator opt-out; a missing backup provider is otherwise a failure.
151160
+ */
151161
+ backup: boolean().optional()
151162
+ });
151163
+ /** Why a plan cannot start. */
151164
+ var ClusterUpdateBlockerSchema = _enum([
151165
+ "no-target",
151166
+ "node-busy",
151167
+ "job-running",
151168
+ "nothing-to-do",
151169
+ "status-unreadable"
151170
+ ]);
151171
+ var ClusterUpdatePlanSchema = object({
151172
+ /** `null` when no target could be resolved (`blocker: 'no-target'`). */
151173
+ targetVersion: string().nullable(),
151174
+ /** The steps the job WOULD run, all `pending` (or `skipped` with a reason). */
151175
+ steps: array(ClusterUpdateStepSchema).readonly(),
151176
+ skippedOffline: array(string()).readonly(),
151177
+ /** `null` = the plan can start. */
151178
+ blocker: ClusterUpdateBlockerSchema.nullable(),
151179
+ /** Prose for `blocker`. */
151180
+ blockerDetail: string().nullable()
151181
+ });
151182
+ var StartClusterUpdateResultSchema = object({
151183
+ accepted: boolean(),
151184
+ /** The job to follow with `getClusterUpdateJob`; `null` when refused. */
151185
+ jobId: string().nullable(),
151186
+ blocker: ClusterUpdateBlockerSchema.nullable(),
151187
+ message: string()
151188
+ });
151189
+ method(ClusterUpdateOptionsSchema, ClusterUpdatePlanSchema, { auth: "admin" }), method(ClusterUpdateOptionsSchema, StartClusterUpdateResultSchema, {
151190
+ kind: "mutation",
151191
+ auth: "admin"
151192
+ }), method(object({ jobId: string().optional() }), ClusterUpdateJobSchema.nullable(), { auth: "admin" });
151193
+ /**
150731
151194
  * Color-light cap. Coexists with `switch` (on/off) and `brightness`
150732
151195
  * (level) on the same device — `switch` toggles the bulb, `brightness`
150733
151196
  * sets the dim level, this cap sets the chromaticity.
@@ -151770,8 +152233,12 @@ var RemoteSourceSchema = discriminatedUnion("kind", [
151770
152233
  object({
151771
152234
  ...sourceBase,
151772
152235
  kind: literal("ir"),
151773
- /** The `ir-transmitter` device the code is sent through. */
151774
- transmitterId: number$1().int().nonnegative(),
152236
+ /**
152237
+ * The `ir-transmitter` device the code is sent through. Absent = the remote's
152238
+ * `defaultTransmitterId` at run time (a source stored before this field was
152239
+ * optional keeps the emitter it names).
152240
+ */
152241
+ transmitterId: number$1().int().nonnegative().optional(),
151775
152242
  /** The code itself; whether a transmitter could send it is `irSourceProblem`. */
151776
152243
  payload: IrPayloadSchema
151777
152244
  })
@@ -151925,27 +152392,27 @@ var mediaPlayerCapability = {
151925
152392
  mode: "singleton",
151926
152393
  deviceTypes: [DeviceType.MediaPlayer],
151927
152394
  methods: {
151928
- turnOn: method(deviceOnly, _void(), {
152395
+ turnOn: optionalMethod(deviceOnly, _void(), {
151929
152396
  kind: "mutation",
151930
152397
  auth: "protected"
151931
152398
  }),
151932
- turnOff: method(deviceOnly, _void(), {
152399
+ turnOff: optionalMethod(deviceOnly, _void(), {
151933
152400
  kind: "mutation",
151934
152401
  auth: "protected"
151935
152402
  }),
151936
- volumeUp: method(stepInput, _void(), {
152403
+ volumeUp: optionalMethod(stepInput, _void(), {
151937
152404
  kind: "mutation",
151938
152405
  auth: "protected"
151939
152406
  }),
151940
- volumeDown: method(stepInput, _void(), {
152407
+ volumeDown: optionalMethod(stepInput, _void(), {
151941
152408
  kind: "mutation",
151942
152409
  auth: "protected"
151943
152410
  }),
151944
- channelUp: method(stepInput, _void(), {
152411
+ channelUp: optionalMethod(stepInput, _void(), {
151945
152412
  kind: "mutation",
151946
152413
  auth: "protected"
151947
152414
  }),
151948
- channelDown: method(stepInput, _void(), {
152415
+ channelDown: optionalMethod(stepInput, _void(), {
151949
152416
  kind: "mutation",
151950
152417
  auth: "protected"
151951
152418
  }),
@@ -151957,61 +152424,61 @@ var mediaPlayerCapability = {
151957
152424
  kind: "mutation",
151958
152425
  auth: "protected"
151959
152426
  }),
151960
- stop: method(object({ deviceId: number$1().int().nonnegative() }), _void(), {
152427
+ stop: optionalMethod(object({ deviceId: number$1().int().nonnegative() }), _void(), {
151961
152428
  kind: "mutation",
151962
152429
  auth: "protected"
151963
152430
  }),
151964
- next: method(object({ deviceId: number$1().int().nonnegative() }), _void(), {
152431
+ next: optionalMethod(object({ deviceId: number$1().int().nonnegative() }), _void(), {
151965
152432
  kind: "mutation",
151966
152433
  auth: "protected"
151967
152434
  }),
151968
- previous: method(object({ deviceId: number$1().int().nonnegative() }), _void(), {
152435
+ previous: optionalMethod(object({ deviceId: number$1().int().nonnegative() }), _void(), {
151969
152436
  kind: "mutation",
151970
152437
  auth: "protected"
151971
152438
  }),
151972
- seek: method(object({
152439
+ seek: optionalMethod(object({
151973
152440
  deviceId: number$1().int().nonnegative(),
151974
152441
  position: number$1().int().nonnegative()
151975
152442
  }), _void(), {
151976
152443
  kind: "mutation",
151977
152444
  auth: "protected"
151978
152445
  }),
151979
- setVolume: method(object({
152446
+ setVolume: optionalMethod(object({
151980
152447
  deviceId: number$1().int().nonnegative(),
151981
152448
  volumeLevel: number$1().min(0).max(100)
151982
152449
  }), _void(), {
151983
152450
  kind: "mutation",
151984
152451
  auth: "protected"
151985
152452
  }),
151986
- setMute: method(object({
152453
+ setMute: optionalMethod(object({
151987
152454
  deviceId: number$1().int().nonnegative(),
151988
152455
  muted: boolean()
151989
152456
  }), _void(), {
151990
152457
  kind: "mutation",
151991
152458
  auth: "protected"
151992
152459
  }),
151993
- setShuffle: method(object({
152460
+ setShuffle: optionalMethod(object({
151994
152461
  deviceId: number$1().int().nonnegative(),
151995
152462
  shuffle: boolean()
151996
152463
  }), _void(), {
151997
152464
  kind: "mutation",
151998
152465
  auth: "protected"
151999
152466
  }),
152000
- setRepeat: method(object({
152467
+ setRepeat: optionalMethod(object({
152001
152468
  deviceId: number$1().int().nonnegative(),
152002
152469
  repeat: MediaPlayerRepeatSchema
152003
152470
  }), _void(), {
152004
152471
  kind: "mutation",
152005
152472
  auth: "protected"
152006
152473
  }),
152007
- selectSource: method(object({
152474
+ selectSource: optionalMethod(object({
152008
152475
  deviceId: number$1().int().nonnegative(),
152009
152476
  source: string().min(1)
152010
152477
  }), _void(), {
152011
152478
  kind: "mutation",
152012
152479
  auth: "protected"
152013
152480
  }),
152014
- playMedia: method(object({
152481
+ playMedia: optionalMethod(object({
152015
152482
  deviceId: number$1().int().nonnegative(),
152016
152483
  /** Media identifier / URL. */
152017
152484
  mediaId: string().min(1),
@@ -152054,7 +152521,7 @@ var mediaPlayerCapability = {
152054
152521
  isMuted: { kind: "boolean" }
152055
152522
  } }
152056
152523
  };
152057
- DeviceType.Camera, DeviceType.Sensor, DeviceType.Button, DeviceType.Switch, DeviceType.PetFeeder, DeviceType.Container, DeviceType.Thermostat, DeviceType.EventEmitter, DeviceType.Camera, DeviceType.Hub, DeviceType.Light, DeviceType.Siren, DeviceType.Switch, DeviceType.Sensor, DeviceType.Thermostat, 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.Vacuum, DeviceType.LawnMower, DeviceType.Container, DeviceType.Image, DeviceType.PetFeeder, DeviceType.PetFountain, DeviceType.Dishwasher, DeviceType.Washer, DeviceType.Heater, DeviceType.Dryer, DeviceType.Gateway, DeviceType.Camera, DeviceType.Fan, DeviceType.Lock, DeviceType.Camera, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Heater, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Heater, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Heater, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Heater, DeviceType.Gateway, DeviceType.Hub, 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.Thermostat, DeviceType.PetFeeder, DeviceType.Heater, DeviceType.MediaPlayer;
152524
+ DeviceType.Camera, DeviceType.Sensor, DeviceType.Button, DeviceType.Switch, DeviceType.PetFeeder, DeviceType.Container, DeviceType.Thermostat, DeviceType.EventEmitter, DeviceType.Camera, DeviceType.Hub, DeviceType.Light, DeviceType.Siren, DeviceType.Switch, DeviceType.Sensor, DeviceType.Thermostat, 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.Vacuum, DeviceType.LawnMower, DeviceType.Container, DeviceType.Image, DeviceType.PetFeeder, DeviceType.PetFountain, DeviceType.Dishwasher, DeviceType.Washer, DeviceType.Heater, DeviceType.Dryer, DeviceType.Gateway, DeviceType.HeatPump, DeviceType.Camera, DeviceType.Fan, DeviceType.Lock, DeviceType.Camera, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Heater, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Heater, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Heater, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Heater, 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.Thermostat, DeviceType.PetFeeder, DeviceType.Heater, DeviceType.MediaPlayer;
152058
152525
  var NUMBER = {
152059
152526
  kind: "fixed",
152060
152527
  result: ["number"]
@@ -153033,18 +153500,18 @@ var coverCapability = {
153033
153500
  kind: "mutation",
153034
153501
  auth: "protected"
153035
153502
  }),
153036
- stop: method(object({ deviceId: number$1().int().nonnegative() }), _void(), {
153503
+ stop: optionalMethod(object({ deviceId: number$1().int().nonnegative() }), _void(), {
153037
153504
  kind: "mutation",
153038
153505
  auth: "protected"
153039
153506
  }),
153040
- setPosition: method(object({
153507
+ setPosition: optionalMethod(object({
153041
153508
  deviceId: number$1().int().nonnegative(),
153042
153509
  position: number$1().min(0).max(100)
153043
153510
  }), _void(), {
153044
153511
  kind: "mutation",
153045
153512
  auth: "protected"
153046
153513
  }),
153047
- setTiltPosition: method(object({
153514
+ setTiltPosition: optionalMethod(object({
153048
153515
  deviceId: number$1().int().nonnegative(),
153049
153516
  tiltPosition: number$1().min(0).max(100)
153050
153517
  }), _void(), {
@@ -153547,27 +154014,35 @@ var deviceAdminLinkCapability = {
153547
154014
  getAdminLink: method(object({ deviceId: number$1().int().nonnegative() }), DeviceAdminLinkSchema.nullable(), { auth: "admin" }) }
153548
154015
  };
153549
154016
  /**
153550
- * device-discovery — device-scoped capability for parents that host /
153551
- * enumerate child devices (Reolink Hub / NVR, ONVIF gateway, future
153552
- * integrations). The parent advertises a list of discoverable children,
153553
- * and the operator promotes a subset to real devices via `adoptDevice`.
153554
- * Child lifecycle (kernel device create/remove, parent reference) is
153555
- * owned by the framework so a single shared `<DiscoveryPanel />` can
153556
- * drive any integration.
153557
- *
153558
- * Boundaries:
153559
- * - The cap exposes ENUMERATION + ADOPT/RELEASE only. The protocol
153560
- * used to discover children (CGI poll, mDNS, push from hub, ...)
153561
- * is the integration's business; results land in `runtimeState`
153562
- * so the panel can render without a fresh round-trip.
153563
- * - `childNativeId` is integration-defined and must be stable across
153564
- * reboots so re-discovery doesn't duplicate adopted children.
153565
- * - `adoptDevice` returns the new `deviceId` so the UI can navigate
153566
- * directly to the freshly-created child's settings page.
153567
- */
153568
- /**
153569
- * Status enum for a discovered device. Mirrors the Reolink simpleEvent
153570
- * lifecycle (`online` / `sleeping` / `offline`) — generic enough for
154017
+ * `device-adoption` — generic discovery + adoption surface,
154018
+ * system-scoped collection (one provider per integration addon), routed
154019
+ * by explicit `{ addonId }` on direct `deviceAdoption.*` calls — the same
154020
+ * pin model as `connection-test`. The admin UI keeps using
154021
+ * `deviceManager.adoption*` (which already threads `addonId`). The de-HA-ified
154022
+ * successor to `ha-discovery`:
154023
+ * keyed by `integrationId` (the addon resolves integrationId → broker
154024
+ * internally) rather than a connection-specific `brokerId`, and it
154025
+ * OWNS the shared `DiscoveredChildDevice` candidate type
154026
+ * (declared below) so a single shared adoption modal renders any integration's
154027
+ * candidate tree.
154028
+ *
154029
+ * UI flow (Integrations page → integration detail):
154030
+ * 1. `listCandidates({integrationId, page, pageSize, filter})` →
154031
+ * paginated candidate list, each row collapsed.
154032
+ * 2. User expands a row → `getCandidate({integrationId,
154033
+ * childNativeId})` returns the single candidate (with its nested
154034
+ * `children`) for the accordion render.
154035
+ * 3. User clicks "Adopt" on one or more candidates →
154036
+ * `adopt({integrationId, childNativeIds, perCandidate?})`
154037
+ * materialises one parent CamStack device per candidate plus its
154038
+ * accessory children. `perCandidate[childNativeId]` carries an
154039
+ * optional display-name override + a `hiddenChildIds` pre-hide set
154040
+ * (the parent's `accessories.hiddenChildIds` gates UI visibility).
154041
+ * 4. User clicks "Release" → `release({integrationId, camDeviceId})`
154042
+ * removes the parent + every child from the kernel registry.
154043
+ */
154044
+ /**
154045
+ * Status enum for a discovered device. Generic enough for
153571
154046
  * battery cams, awake cams, and unreachable cams alike.
153572
154047
  */
153573
154048
  var DiscoveredChildStatusSchema = _enum([
@@ -153584,12 +154059,12 @@ var DiscoveredChildDeviceSchema = lazy(() => object({
153584
154059
  /** DeviceType the child should be created with on adopt. */
153585
154060
  type: _enum(DeviceType),
153586
154061
  status: DiscoveredChildStatusSchema,
153587
- /** Free-form integration-specific metadata surfaced in the panel. */
154062
+ /** Free-form integration-specific metadata surfaced in the adoption modal. */
153588
154063
  metadata: object({
153589
154064
  model: string().optional(),
153590
154065
  serialNumber: string().optional(),
153591
154066
  uid: string().optional(),
153592
- /** Reolink: 0-based channel index inside the parent NVR/Hub. */
154067
+ /** Reolink: 0-based channel index inside the parent NVR. */
153593
154068
  rtspChannel: number$1().int().nonnegative().optional(),
153594
154069
  isBattery: boolean().optional(),
153595
154070
  isDoorbell: boolean().optional(),
@@ -153605,137 +154080,24 @@ var DiscoveredChildDeviceSchema = lazy(() => object({
153605
154080
  }).default({}),
153606
154081
  /**
153607
154082
  * `true` when the framework already created a child device for this
153608
- * `childNativeId` under the current parent. The panel uses it to
154083
+ * `childNativeId` under the current parent. The adoption modal uses it to
153609
154084
  * gate the Add/Remove button and surface the existing `deviceId`.
153610
154085
  */
153611
154086
  alreadyAdopted: boolean(),
153612
154087
  /** When `alreadyAdopted=true`, the framework-assigned child device id. */
153613
154088
  adoptedDeviceId: number$1().int().nonnegative().nullable(),
153614
- /** Capability names the candidate advertises — integrations populate, Hubs omit. */
154089
+ /** Capability names the candidate advertises — integrations populate, flat enumerations omit. */
153615
154090
  capabilities: array(string()).readonly().optional(),
153616
- /** Feature flags the candidate advertises — integrations populate, Hubs omit. */
154091
+ /** Feature flags the candidate advertises — integrations populate, flat enumerations omit. */
153617
154092
  features: array(string()).readonly().optional(),
153618
154093
  /** Upstream-system identity + rendering hints for the candidate. */
153619
154094
  sourceInfo: SourceInfoSchema.optional(),
153620
- /** Nested entity-children for accordion preview — integrations populate, Hubs omit. */
154095
+ /** Nested entity-children for accordion preview — integrations populate, flat enumerations omit. */
153621
154096
  children: array(DiscoveredChildDeviceSchema).readonly().optional(),
153622
154097
  /** `childNativeId` of the gateway candidate in the same list this device sits behind. */
153623
154098
  parentStableId: string().optional()
153624
154099
  }));
153625
154100
  /**
153626
- * Status block — populated by the integration after each
153627
- * `refreshDiscovery` (or push-driven update). The runtime-state slice
153628
- * is what the panel reads via the per-device proxy; `getStatus`
153629
- * returns the same payload via the codegen'd auto-injection.
153630
- */
153631
- var DeviceDiscoveryStatusSchema = object({
153632
- discovered: array(DiscoveredChildDeviceSchema),
153633
- /** Wall-clock ms of the last successful enumeration. */
153634
- lastDiscoveryAt: number$1().int().nonnegative().nullable(),
153635
- /** Last error surfaced from the source (rendered as a banner). */
153636
- lastError: string().nullable()
153637
- });
153638
- var deviceDiscoveryCapability = {
153639
- name: "device-discovery",
153640
- scope: "device",
153641
- deviceNative: true,
153642
- mode: "singleton",
153643
- deviceTypes: [DeviceType.Hub],
153644
- status: {
153645
- schema: DeviceDiscoveryStatusSchema,
153646
- kind: "poll"
153647
- },
153648
- runtimeState: DeviceDiscoveryStatusSchema.extend({ lastFetchedAt: number$1().int().nonnegative() }),
153649
- /**
153650
- * Runtime-state durability: **session** — 5.7 KB of scan output on the largest device, fully re-derivable by re-scanning.
153651
- *
153652
- * See `RuntimeStateDurability`. Enforced by
153653
- * `scripts/check-runtime-state-durability.ts`.
153654
- */
153655
- durability: "session",
153656
- /**
153657
- * History (D850): none — inventory.
153658
- */
153659
- history: "none",
153660
- methods: {
153661
- /**
153662
- * Snapshot of the current `discovered` list. Returns the
153663
- * runtime-state cache — call `refreshDiscovery` first if a
153664
- * fresh round-trip to the source is required.
153665
- */
153666
- listDiscovered: method(object({ deviceId: number$1().int().nonnegative() }), array(DiscoveredChildDeviceSchema).readonly()),
153667
- /**
153668
- * Force the integration to re-enumerate and update the
153669
- * runtime-state slice. Returns the freshly-enumerated list (also
153670
- * available via `listDiscovered` post-call).
153671
- */
153672
- refreshDiscovery: method(object({ deviceId: number$1().int().nonnegative() }), array(DiscoveredChildDeviceSchema).readonly(), {
153673
- kind: "mutation",
153674
- auth: "admin"
153675
- }),
153676
- /**
153677
- * Promote a discovered entry to a real child device. The framework
153678
- * creates the child via `kernel.devices.create()` with
153679
- * `parentDeviceId = parent.id` and seeds the child's config from
153680
- * `childInitialConfig` (driver-defined; usually carries channel +
153681
- * uid + parent reference). Returns the kernel-assigned numeric id.
153682
- */
153683
- adoptDevice: method(object({
153684
- deviceId: number$1().int().nonnegative(),
153685
- childNativeId: string(),
153686
- /** Optional override for the child's display name. */
153687
- name: string().optional()
153688
- }), object({
153689
- deviceId: number$1().int().nonnegative(),
153690
- stableId: string()
153691
- }), {
153692
- kind: "mutation",
153693
- auth: "admin"
153694
- }),
153695
- /**
153696
- * Inverse of `adoptDevice`: removes the child device from the
153697
- * kernel registry. The discovered entry remains in the
153698
- * enumeration (status updates resume) so the operator can re-adopt
153699
- * it later without a fresh refresh.
153700
- */
153701
- releaseDevice: method(object({
153702
- deviceId: number$1().int().nonnegative(),
153703
- childDeviceId: number$1().int().nonnegative()
153704
- }), _void(), {
153705
- kind: "mutation",
153706
- auth: "admin"
153707
- })
153708
- }
153709
- };
153710
- /**
153711
- * `device-adoption` — generic discovery + adoption surface,
153712
- * system-scoped collection (one provider per integration addon), routed
153713
- * by explicit `{ addonId }` on direct `deviceAdoption.*` calls — the same
153714
- * pin model as `connection-test`. The admin UI keeps using
153715
- * `deviceManager.adoption*` (which already threads `addonId`). The de-HA-ified
153716
- * successor to `ha-discovery`:
153717
- * keyed by `integrationId` (the addon resolves integrationId → broker
153718
- * internally) rather than a connection-specific `brokerId`, and it
153719
- * REUSES the shared `DiscoveredChildDevice` candidate type from
153720
- * `device-discovery.cap.ts` so a single shared adoption panel renders
153721
- * any integration's candidate tree.
153722
- *
153723
- * UI flow (Integrations page → integration detail):
153724
- * 1. `listCandidates({integrationId, page, pageSize, filter})` →
153725
- * paginated candidate list, each row collapsed.
153726
- * 2. User expands a row → `getCandidate({integrationId,
153727
- * childNativeId})` returns the single candidate (with its nested
153728
- * `children`) for the accordion render.
153729
- * 3. User clicks "Adopt" on one or more candidates →
153730
- * `adopt({integrationId, childNativeIds, perCandidate?})`
153731
- * materialises one parent CamStack device per candidate plus its
153732
- * accessory children. `perCandidate[childNativeId]` carries an
153733
- * optional display-name override + a `hiddenChildIds` pre-hide set
153734
- * (the parent's `accessories.hiddenChildIds` gates UI visibility).
153735
- * 4. User clicks "Release" → `release({integrationId, camDeviceId})`
153736
- * removes the parent + every child from the kernel registry.
153737
- */
153738
- /**
153739
154101
  * Provider-declared discovery *granularity* filter (the keystone of the
153740
154102
  * single-entity-import design). A provider advertises which discovery
153741
154103
  * granularities it supports via `listCandidateFilters`; the operator picks
@@ -154094,6 +154456,59 @@ method(InstancePinSchema, DeviceExportStatusSchema), method(_void(), array(Expor
154094
154456
  auth: "admin"
154095
154457
  });
154096
154458
  var DeviceAliasSchema = string().max(64).regex(/^[a-z][a-z0-9_]*$/);
154459
+ var DeviceTemplateSchema = string().min(1).max(4096);
154460
+ /** One value a caller hands the renderer for `thisDevice`. */
154461
+ var DeviceTemplateValueSchema = union([
154462
+ string(),
154463
+ number$1(),
154464
+ boolean()
154465
+ ]);
154466
+ /**
154467
+ * The device a render is FOR (`camera` in the text) and the values the caller
154468
+ * knows about it that no capability carries, for example `lastPerson` and
154469
+ * `lastPlate`. `values` read as `camera.<name>`; a name a capability also carries
154470
+ * is `ambiguous` and is written `camera.values.<name>`.
154471
+ */
154472
+ var DeviceTemplateThisDeviceSchema = object({
154473
+ deviceId: number$1().int(),
154474
+ values: record(string().min(1).max(64), DeviceTemplateValueSchema).optional()
154475
+ });
154476
+ var DeviceTemplateRefusalSchema = object({
154477
+ reason: _enum([
154478
+ "too-long",
154479
+ "syntax",
154480
+ "forbidden-syntax",
154481
+ "forbidden-member",
154482
+ "unknown-filter",
154483
+ "ambiguous-field",
154484
+ "busy",
154485
+ "budget-exceeded",
154486
+ "timeout",
154487
+ "output-too-large",
154488
+ "render-failed",
154489
+ "out-of-scope",
154490
+ "unavailable"
154491
+ ]),
154492
+ message: string()
154493
+ });
154494
+ var DeviceTemplateTraceEntrySchema = object({
154495
+ ref: string(),
154496
+ reason: _enum([
154497
+ "unknown-alias",
154498
+ "unknown-field",
154499
+ "no-field",
154500
+ "unavailable"
154501
+ ])
154502
+ });
154503
+ var DeviceTemplateRenderSchema = discriminatedUnion("ok", [object({
154504
+ ok: literal(true),
154505
+ text: string(),
154506
+ trace: array(DeviceTemplateTraceEntrySchema)
154507
+ }), object({
154508
+ ok: literal(false),
154509
+ refusal: DeviceTemplateRefusalSchema,
154510
+ trace: array(DeviceTemplateTraceEntrySchema)
154511
+ })]);
154097
154512
  /**
154098
154513
  * A SITE ZONE — a named part of the property that several locations belong to.
154099
154514
  *
@@ -154143,6 +154558,90 @@ var SiteZoneSchema = object({
154143
154558
  * the ones that most want grouping. */
154144
154559
  locationKeys: array(string())
154145
154560
  });
154561
+ var DeviceSearchRequiresSchema = object({
154562
+ /** Capability names the field wants a value of. */
154563
+ caps: array(string()).readonly(),
154564
+ /** `any` (default): a device with one of them is compatible. `all`: it must hold every one. */
154565
+ mode: _enum(["any", "all"]).optional()
154566
+ });
154567
+ var DeviceSearchFiltersSchema = object({
154568
+ locations: array(string()).readonly().optional(),
154569
+ integrationIds: array(string()).readonly().optional(),
154570
+ types: array(string()).readonly().optional()
154571
+ });
154572
+ var DeviceSearchInputSchema = object({
154573
+ /** Matches name, location, type, integration (id and label) and id. Case-insensitive. */
154574
+ text: string().optional(),
154575
+ requires: DeviceSearchRequiresSchema.optional(),
154576
+ filters: DeviceSearchFiltersSchema.optional(),
154577
+ /** List the devices that do not provide the required cap too (greyed, not pickable). */
154578
+ includeIncompatible: boolean().optional(),
154579
+ /** The device the field belongs to: its location drives `suggested`. */
154580
+ contextDeviceId: number$1().optional(),
154581
+ /**
154582
+ * Resolve exactly these devices, regardless of every filter, so a picked
154583
+ * value can be rendered. When given, `items` is these devices in the order
154584
+ * asked (no paging, `nextCursor` null) and the ones that do not exist are
154585
+ * listed in `missingIds`.
154586
+ */
154587
+ ids: array(number$1()).readonly().optional(),
154588
+ cursor: string().nullable().optional(),
154589
+ limit: number$1().int().min(1).max(200).optional()
154590
+ });
154591
+ var DeviceValueOptionSchema = object({
154592
+ cap: string(),
154593
+ /** Status-schema field path inside the cap (same paths as `getWireableFields`). */
154594
+ path: string(),
154595
+ label: string(),
154596
+ /** The current value as text; `null` when it is unknown or the read FAILED — never `0`. */
154597
+ reading: string().nullable(),
154598
+ unit: string().nullable().optional(),
154599
+ /** The field's measured quantity, when the cap declares one, so a client can format the reading. */
154600
+ quantity: ReadingQuantitySchema.optional()
154601
+ });
154602
+ var DeviceSearchItemSchema = object({
154603
+ id: number$1(),
154604
+ name: string(),
154605
+ type: _enum(DeviceType),
154606
+ location: string().nullable(),
154607
+ integrationId: string().nullable(),
154608
+ integrationLabel: string().nullable(),
154609
+ online: boolean().nullable(),
154610
+ disabled: boolean(),
154611
+ compatible: boolean(),
154612
+ /** Only the required caps' fields; empty when nothing was required or the device is incompatible. */
154613
+ values: array(DeviceValueOptionSchema).readonly()
154614
+ });
154615
+ var DeviceSearchFacetValueSchema = object({
154616
+ value: string(),
154617
+ count: number$1()
154618
+ });
154619
+ var DeviceSearchFacetIntegrationSchema = object({
154620
+ id: string(),
154621
+ label: string(),
154622
+ count: number$1()
154623
+ });
154624
+ var DeviceSearchFacetsSchema = object({
154625
+ locations: array(DeviceSearchFacetValueSchema).readonly(),
154626
+ integrations: array(DeviceSearchFacetIntegrationSchema).readonly(),
154627
+ types: array(DeviceSearchFacetValueSchema).readonly()
154628
+ });
154629
+ var DeviceSearchResultSchema = object({
154630
+ items: array(DeviceSearchItemSchema).readonly(),
154631
+ nextCursor: string().nullable(),
154632
+ /** Devices listed by this query across all pages (filters + text applied; incompatible counted only when `includeIncompatible`). */
154633
+ total: number$1(),
154634
+ /** Compatible devices after filters + text. */
154635
+ compatibleTotal: number$1(),
154636
+ /** Every device the caller's fleet holds, before anything is applied. */
154637
+ fleetTotal: number$1(),
154638
+ /** Incompatible devices after filters + text — the K of "show the K that don't". */
154639
+ hiddenIncompatible: number$1(),
154640
+ facets: DeviceSearchFacetsSchema,
154641
+ /** Same location as `contextDeviceId`; first page only. */
154642
+ suggested: array(DeviceSearchItemSchema).readonly(),
154643
+ missingIds: array(number$1()).readonly()
154644
+ });
154146
154645
  var ProviderStatusSchema = object({
154147
154646
  connected: boolean(),
154148
154647
  deviceCount: number$1(),
@@ -154628,6 +155127,9 @@ var DeviceInfoSchema = object({
154628
155127
  * named accordion sections (with optional intra-section order). See
154629
155128
  * `DeviceMeta.childLayout`. Absent ⇒ no layout declared. */
154630
155129
  childLayout: array(ChildLayoutEntrySchema).readonly().optional(),
155130
+ /** The children a container stands for, most preferred first, by accessory
155131
+ * `childKey`. Provider-declared. See `DeviceMeta.primaryChildPreference`. */
155132
+ primaryChildPreference: array(string()).readonly().optional(),
154631
155133
  /** Operator-authored per-device display override. See `DeviceMeta.display`. */
154632
155134
  display: DeviceDisplayOverrideSchema.optional()
154633
155135
  });
@@ -154689,7 +155191,9 @@ var DeviceBindingsForDeviceSchema = object({
154689
155191
  kind: _enum(["native", "wrapped"]),
154690
155192
  providerAddonId: string(),
154691
155193
  providerNodeId: string(),
154692
- nativeAddonId: string()
155194
+ nativeAddonId: string(),
155195
+ /** The cap's methods the native provider implements; absent = all. */
155196
+ implementedMethods: array(string()).optional()
154693
155197
  }))
154694
155198
  });
154695
155199
  /**
@@ -154774,6 +155278,9 @@ var DeviceMetaSchema = object({
154774
155278
  * accordion sections (with optional intra-section order). See
154775
155279
  * `DeviceMeta.childLayout`. Absent ⇒ no layout declared. */
154776
155280
  childLayout: array(ChildLayoutEntrySchema).readonly().optional(),
155281
+ /** The children a container stands for, most preferred first, by accessory
155282
+ * `childKey`. Provider-declared. See `DeviceMeta.primaryChildPreference`. */
155283
+ primaryChildPreference: array(string()).readonly().optional(),
154777
155284
  /** Semantic role string (`DeviceRole`) — propagated from the spawn pre-seed.
154778
155285
  * Optional: only present for accessory children that carry a known role. */
154779
155286
  role: string().nullable().optional(),
@@ -154901,7 +155408,13 @@ method(object({
154901
155408
  auth: "admin"
154902
155409
  }), method(object({ deviceId: number$1() }), record(string(), unknown()), { auth: "admin" }), method(object({ deviceId: number$1() }), record(string(), unknown()), { auth: "admin" }), method(object({ deviceId: number$1() }), DeviceMetaSchema.nullable()), method(object({
154903
155410
  deviceId: number$1(),
154904
- name: string()
155411
+ name: string(),
155412
+ /**
155413
+ * Absent or true: an operator rename, which stamps `userNamed`.
155414
+ * False: the system copying a block name onto the device. That write
155415
+ * must not look like the operator's, or the next reconcile freezes it.
155416
+ */
155417
+ stampUserNamed: boolean().optional()
154905
155418
  }), _void(), {
154906
155419
  kind: "mutation",
154907
155420
  auth: "admin"
@@ -154925,6 +155438,29 @@ method(object({
154925
155438
  kind: "mutation",
154926
155439
  auth: "admin"
154927
155440
  }), method(object({
155441
+ templates: array(DeviceTemplateSchema).max(64),
155442
+ allowedDeviceIds: array(number$1().int()).optional(),
155443
+ /** The device `camera` names in the texts, and the values the caller knows of it. */
155444
+ thisDevice: DeviceTemplateThisDeviceSchema.optional()
155445
+ }), object({ results: array(DeviceTemplateRenderSchema) }), { auth: "admin" }), method(object({
155446
+ templates: array(string()).max(64),
155447
+ allowedDeviceIds: array(number$1().int()).optional(),
155448
+ thisDevice: DeviceTemplateThisDeviceSchema.optional()
155449
+ }), object({ results: array(discriminatedUnion("ok", [object({
155450
+ ok: literal(true),
155451
+ aliases: array(object({
155452
+ alias: string(),
155453
+ deviceId: number$1().int().nullable(),
155454
+ allowed: boolean(),
155455
+ /** The fields the text reads on this alias, as written (`temperature`, `cap.field`). */
155456
+ reads: array(string())
155457
+ })),
155458
+ /** Whether the text reads the clock (`now`): it changes every minute. */
155459
+ readsClock: boolean()
155460
+ }), object({
155461
+ ok: literal(false),
155462
+ refusal: DeviceTemplateRefusalSchema
155463
+ })])) }), { auth: "admin" }), method(object({
154928
155464
  deviceId: number$1(),
154929
155465
  location: string().nullable()
154930
155466
  }), _void(), {
@@ -154960,6 +155496,12 @@ method(object({
154960
155496
  }), _void(), {
154961
155497
  kind: "mutation",
154962
155498
  auth: "admin"
155499
+ }), method(object({
155500
+ deviceId: number$1(),
155501
+ primaryChildPreference: array(string()).readonly()
155502
+ }), _void(), {
155503
+ kind: "mutation",
155504
+ auth: "admin"
154963
155505
  }), method(object({
154964
155506
  deviceId: number$1(),
154965
155507
  display: DeviceDisplayOverrideSchema.nullable()
@@ -155097,7 +155639,7 @@ method(object({
155097
155639
  * it answers today and the caller filters as it already does.
155098
155640
  */
155099
155641
  deviceIds: array(number$1()).optional()
155100
- }), array(DeviceInfoSchema), { role: "viewer" }), method(object({ deviceId: number$1() }), DeviceInfoSchema.nullable()), method(object({ parentDeviceId: number$1() }), array(DeviceInfoSchema), { role: "viewer" }), method(object({ parentDeviceIds: array(number$1()).max(256) }), record(string(), array(DeviceInfoSchema))), method(object({ deviceId: number$1() }), object({
155642
+ }), array(DeviceInfoSchema), { role: "viewer" }), method(DeviceSearchInputSchema, DeviceSearchResultSchema, { role: "viewer" }), method(object({ deviceId: number$1() }), DeviceInfoSchema.nullable()), method(object({ parentDeviceId: number$1() }), array(DeviceInfoSchema), { role: "viewer" }), method(object({ parentDeviceIds: array(number$1()).max(256) }), record(string(), array(DeviceInfoSchema))), method(object({ deviceId: number$1() }), object({
155101
155643
  mode: LinkedDevicesModeSchema,
155102
155644
  devices: array(LinkedDeviceSchema)
155103
155645
  }), { 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({
@@ -157674,28 +158216,28 @@ var fanControlCapability = {
157674
158216
  mode: "singleton",
157675
158217
  deviceTypes: [DeviceType.Fan],
157676
158218
  methods: {
157677
- setPercentage: method(object({
158219
+ setPercentage: optionalMethod(object({
157678
158220
  deviceId: number$1().int().nonnegative(),
157679
158221
  speed: number$1().min(0).max(100)
157680
158222
  }), _void(), {
157681
158223
  kind: "mutation",
157682
158224
  auth: "protected"
157683
158225
  }),
157684
- setPreset: method(object({
158226
+ setPreset: optionalMethod(object({
157685
158227
  deviceId: number$1().int().nonnegative(),
157686
158228
  preset: string().min(1)
157687
158229
  }), _void(), {
157688
158230
  kind: "mutation",
157689
158231
  auth: "protected"
157690
158232
  }),
157691
- setDirection: method(object({
158233
+ setDirection: optionalMethod(object({
157692
158234
  deviceId: number$1().int().nonnegative(),
157693
158235
  direction: FanDirectionSchema
157694
158236
  }), _void(), {
157695
158237
  kind: "mutation",
157696
158238
  auth: "protected"
157697
158239
  }),
157698
- setOscillating: method(object({
158240
+ setOscillating: optionalMethod(object({
157699
158241
  deviceId: number$1().int().nonnegative(),
157700
158242
  oscillating: boolean()
157701
158243
  }), _void(), {
@@ -158147,6 +158689,305 @@ var groupStatusCapability = {
158147
158689
  durability: "session",
158148
158690
  history: "none"
158149
158691
  };
158692
+ /**
158693
+ * Heat pump settable surface (D1026): one typed method per parameter, never a
158694
+ * generic `set(key, value)`. The values a mode takes and the limits of a number
158695
+ * are the ones `heat-pump-status` carries (`allowed`, `min`, `max`, `step`),
158696
+ * read from the gateway; a provider refuses a value outside them. The state is
158697
+ * `heat-pump-status` — this cap has none.
158698
+ */
158699
+ var deviceId = number$1().int().nonnegative();
158700
+ var circuitId = string().min(1);
158701
+ var mode = string().min(1);
158702
+ var temp = number$1().finite();
158703
+ DeviceType.HeatPump, method(object({
158704
+ deviceId,
158705
+ mode
158706
+ }), _void(), {
158707
+ kind: "mutation",
158708
+ auth: "protected"
158709
+ }), method(object({
158710
+ deviceId,
158711
+ mode
158712
+ }), _void(), {
158713
+ kind: "mutation",
158714
+ auth: "protected"
158715
+ }), method(object({
158716
+ deviceId,
158717
+ mode
158718
+ }), _void(), {
158719
+ kind: "mutation",
158720
+ auth: "protected"
158721
+ }), method(object({
158722
+ deviceId,
158723
+ mode
158724
+ }), _void(), {
158725
+ kind: "mutation",
158726
+ auth: "protected"
158727
+ }), method(object({
158728
+ deviceId,
158729
+ circuitId,
158730
+ mode
158731
+ }), _void(), {
158732
+ kind: "mutation",
158733
+ auth: "protected"
158734
+ }), method(object({
158735
+ deviceId,
158736
+ circuitId,
158737
+ mode
158738
+ }), _void(), {
158739
+ kind: "mutation",
158740
+ auth: "protected"
158741
+ }), method(object({
158742
+ deviceId,
158743
+ circuitId,
158744
+ mode
158745
+ }), _void(), {
158746
+ kind: "mutation",
158747
+ auth: "protected"
158748
+ }), method(object({
158749
+ deviceId,
158750
+ circuitId,
158751
+ temp
158752
+ }), _void(), {
158753
+ kind: "mutation",
158754
+ auth: "protected"
158755
+ }), method(object({
158756
+ deviceId,
158757
+ circuitId,
158758
+ temp
158759
+ }), _void(), {
158760
+ kind: "mutation",
158761
+ auth: "protected"
158762
+ }), method(object({
158763
+ deviceId,
158764
+ circuitId,
158765
+ temp
158766
+ }), _void(), {
158767
+ kind: "mutation",
158768
+ auth: "protected"
158769
+ }), method(object({
158770
+ deviceId,
158771
+ circuitId,
158772
+ mode
158773
+ }), _void(), {
158774
+ kind: "mutation",
158775
+ auth: "protected"
158776
+ }), method(object({
158777
+ deviceId,
158778
+ circuitId,
158779
+ level: mode
158780
+ }), _void(), {
158781
+ kind: "mutation",
158782
+ auth: "protected"
158783
+ }), method(object({
158784
+ deviceId,
158785
+ circuitId,
158786
+ minutes: number$1().int().positive()
158787
+ }), _void(), {
158788
+ kind: "mutation",
158789
+ auth: "protected"
158790
+ }), method(object({
158791
+ deviceId,
158792
+ circuitId
158793
+ }), _void(), {
158794
+ kind: "mutation",
158795
+ auth: "protected"
158796
+ });
158797
+ var HeatPumpCircuitKindSchema = _enum([
158798
+ "heating",
158799
+ "dhw",
158800
+ "cooling",
158801
+ "solar"
158802
+ ]);
158803
+ /** A setting that takes one of a list of values the gateway named. */
158804
+ var HeatPumpOptionSettingSchema = object({
158805
+ /** The active value. Null when the gateway did not answer. */
158806
+ value: string().nullable(),
158807
+ /** Values the gateway accepts, in its order. Empty = read-only here. */
158808
+ allowed: array(string())
158809
+ });
158810
+ /** A numeric setting with the limits the gateway named. */
158811
+ var HeatPumpRangeSettingSchema = object({
158812
+ value: number$1().nullable(),
158813
+ min: number$1().nullable(),
158814
+ max: number$1().nullable(),
158815
+ step: number$1().nullable()
158816
+ });
158817
+ var HeatPumpCircuitSchema = object({
158818
+ /** Gateway id of the circuit (`hc1`, `dhw1`): the key of the series. */
158819
+ id: string().min(1),
158820
+ kind: HeatPumpCircuitKindSchema,
158821
+ label: string(),
158822
+ icon: IconKeySchema,
158823
+ /** Measured temperature of the circuit (room, tank, collector). */
158824
+ currentTemp: number$1().nullable().meta(readingMeta("temperature")),
158825
+ /** The setpoint in force now. */
158826
+ targetTemp: number$1().nullable().meta(readingMeta("temperature")),
158827
+ /** The operation mode in force (mirror of `operationMode.value`, for the series). */
158828
+ mode: string().nullable(),
158829
+ /** Whether the circuit is calling for heat right now. Null = unknown. */
158830
+ active: boolean().nullable(),
158831
+ operationMode: HeatPumpOptionSettingSchema.nullable(),
158832
+ /** Heating circuits: heat / cool / heatCool. */
158833
+ heatCoolMode: HeatPumpOptionSettingSchema.nullable(),
158834
+ /** Heating circuits: summer / winter changeover. */
158835
+ summerWinter: HeatPumpOptionSettingSchema.nullable(),
158836
+ comfortSetpoint: HeatPumpRangeSettingSchema.nullable(),
158837
+ ecoSetpoint: HeatPumpRangeSettingSchema.nullable(),
158838
+ maxFlowTemp: HeatPumpRangeSettingSchema.nullable(),
158839
+ /** Hot water: the temperature level (off / low / high / eco). */
158840
+ temperatureLevel: HeatPumpOptionSettingSchema.nullable(),
158841
+ /** Hot water: how long a charge lasts, minutes. */
158842
+ chargeDuration: HeatPumpRangeSettingSchema.nullable(),
158843
+ /** Hot water: whether an extra-hot-water charge is running. Null = no such surface. */
158844
+ extraHotWater: boolean().nullable()
158845
+ });
158846
+ /** The independent system modes, each with its real values. A null mode = the gateway has none. */
158847
+ var HeatPumpSystemSchema = object({
158848
+ silent: HeatPumpOptionSettingSchema.nullable(),
158849
+ away: HeatPumpOptionSettingSchema.nullable(),
158850
+ additionalHeater: HeatPumpOptionSettingSchema.nullable(),
158851
+ holiday: HeatPumpOptionSettingSchema.nullable()
158852
+ });
158853
+ var HeatPumpPowerSchema = object({
158854
+ thermalW: number$1().nullable().meta(readingMeta("power")),
158855
+ electricalW: number$1().nullable().meta(readingMeta("power")),
158856
+ /** Compressor modulation, percent. */
158857
+ compressorPct: number$1().nullable().meta(readingMeta("percentage"))
158858
+ });
158859
+ var HeatPumpTemperaturesSchema = object({
158860
+ supply: number$1().nullable().meta(readingMeta("temperature")),
158861
+ return: number$1().nullable().meta(readingMeta("temperature")),
158862
+ outdoor: number$1().nullable().meta(readingMeta("temperature"))
158863
+ });
158864
+ /** Lifetime meters, kWh: the energy of a period is computed at read time from their difference (D944). */
158865
+ var HeatPumpEnergySchema = object({
158866
+ thermalKwh: number$1().nullable().meta(readingMeta("energy")),
158867
+ electricalKwh: number$1().nullable().meta(readingMeta("energy"))
158868
+ });
158869
+ var HeatPumpStatusSchema = object({
158870
+ circuits: array(HeatPumpCircuitSchema),
158871
+ system: HeatPumpSystemSchema,
158872
+ power: HeatPumpPowerSchema,
158873
+ temperatures: HeatPumpTemperaturesSchema,
158874
+ energy: HeatPumpEnergySchema,
158875
+ /** Water pressure of the heating loop, bar. */
158876
+ waterPressureBar: number$1().nullable(),
158877
+ /** Compressor starts since commissioning. */
158878
+ starts: number$1().nullable(),
158879
+ /** Ms epoch when the slice was last read from the gateway. */
158880
+ lastFetchedAt: number$1()
158881
+ });
158882
+ /**
158883
+ * The instantaneous COP: thermal over electrical power. Null unless BOTH powers
158884
+ * are known and the unit draws power — a missing reading is never a 0 or a
158885
+ * division by it (D393). Computed on every read; there is no stored value.
158886
+ */
158887
+ function heatPumpInstantCop(power) {
158888
+ const { thermalW, electricalW } = power;
158889
+ if (thermalW === null || electricalW === null || electricalW <= 0) return null;
158890
+ return thermalW / electricalW;
158891
+ }
158892
+ var heatPumpStatusCapability = {
158893
+ name: "heat-pump-status",
158894
+ scope: "device",
158895
+ deviceNative: true,
158896
+ mode: "singleton",
158897
+ deviceTypes: [DeviceType.HeatPump],
158898
+ methods: {},
158899
+ status: {
158900
+ schema: HeatPumpStatusSchema,
158901
+ kind: "push"
158902
+ },
158903
+ runtimeState: HeatPumpStatusSchema,
158904
+ /**
158905
+ * Runtime-state durability: **session** — a heat pump's gateway answers on the
158906
+ * next poll, so a restart that clears the slice loses nothing a reader needs
158907
+ * (the series are recorded). See `RuntimeStateDurability`.
158908
+ */
158909
+ durability: "session",
158910
+ /**
158911
+ * History (D850, D917): `circuits[]` is a keyed array — one series per circuit and
158912
+ * field, named by the circuit's label. The mode is a state (D896); the energy
158913
+ * totals are lifetime counters, the kWh of a period is computed at read time (D944).
158914
+ * The COP is never recorded: it derives from the two powers.
158915
+ */
158916
+ history: {
158917
+ fields: {
158918
+ "power.thermalW": {
158919
+ kind: "gauge",
158920
+ unit: "W",
158921
+ deadband: 50,
158922
+ displayName: "Thermal power"
158923
+ },
158924
+ "power.electricalW": {
158925
+ kind: "gauge",
158926
+ unit: "W",
158927
+ deadband: 50,
158928
+ displayName: "Electrical power"
158929
+ },
158930
+ "power.compressorPct": {
158931
+ kind: "gauge",
158932
+ unit: "%",
158933
+ deadband: 2,
158934
+ displayName: "Compressor"
158935
+ },
158936
+ "temperatures.supply": {
158937
+ kind: "gauge",
158938
+ unit: "°C",
158939
+ deadband: .5,
158940
+ displayName: "Supply"
158941
+ },
158942
+ "temperatures.return": {
158943
+ kind: "gauge",
158944
+ unit: "°C",
158945
+ deadband: .5,
158946
+ displayName: "Return"
158947
+ },
158948
+ "temperatures.outdoor": {
158949
+ kind: "gauge",
158950
+ unit: "°C",
158951
+ deadband: .5,
158952
+ displayName: "Outdoor"
158953
+ },
158954
+ "energy.thermalKwh": {
158955
+ kind: "counter",
158956
+ unit: "kWh",
158957
+ displayName: "Thermal energy"
158958
+ },
158959
+ "energy.electricalKwh": {
158960
+ kind: "counter",
158961
+ unit: "kWh",
158962
+ displayName: "Electrical energy"
158963
+ }
158964
+ },
158965
+ items: {
158966
+ path: "circuits",
158967
+ key: "id",
158968
+ label: "label",
158969
+ fields: {
158970
+ currentTemp: {
158971
+ kind: "gauge",
158972
+ unit: "°C",
158973
+ deadband: .5,
158974
+ displayName: "Temperature"
158975
+ },
158976
+ targetTemp: {
158977
+ kind: "gauge",
158978
+ unit: "°C",
158979
+ minIntervalMs: 0,
158980
+ displayName: "Setpoint"
158981
+ },
158982
+ mode: {
158983
+ kind: "enum",
158984
+ displayName: "Mode"
158985
+ }
158986
+ }
158987
+ }
158988
+ },
158989
+ volatileStateFields: ["lastFetchedAt"]
158990
+ };
158150
158991
  var HeatingValveStatusSchema = object({
158151
158992
  /** Radiator valve opening 0 (closed) .. 100 (open). Null = not yet known. */
158152
158993
  position: number$1().min(0).max(100).nullable().meta(readingMeta("percentage")),
@@ -158361,6 +159202,7 @@ var HeroSceneSchema = object({
158361
159202
  "ac",
158362
159203
  "thermostat",
158363
159204
  "heater",
159205
+ "heat-pump",
158364
159206
  "fan",
158365
159207
  "washer",
158366
159208
  "dryer",
@@ -158403,7 +159245,7 @@ var HeroSceneSchema = object({
158403
159245
  /** 0..1: volume, cover position, cycle progress. */
158404
159246
  level: number$1().min(0).max(1).nullable()
158405
159247
  });
158406
- DeviceType.Camera, DeviceType.Hub, DeviceType.Light, DeviceType.Siren, DeviceType.Switch, DeviceType.Sensor, DeviceType.Thermostat, 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.Vacuum, DeviceType.LawnMower, DeviceType.Container, DeviceType.Image, DeviceType.PetFeeder, DeviceType.PetFountain, DeviceType.Dishwasher, DeviceType.Washer, DeviceType.Heater, DeviceType.Dryer, DeviceType.Gateway;
159248
+ DeviceType.Camera, DeviceType.Hub, DeviceType.Light, DeviceType.Siren, DeviceType.Switch, DeviceType.Sensor, DeviceType.Thermostat, 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.HeatPump, DeviceType.Fan, DeviceType.MediaPlayer, DeviceType.AlarmPanel, DeviceType.Control, DeviceType.Presence, DeviceType.Weather, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.Container, DeviceType.Image, DeviceType.PetFeeder, DeviceType.PetFountain, DeviceType.Dishwasher, DeviceType.Washer, DeviceType.Heater, DeviceType.Dryer, DeviceType.Gateway;
158407
159249
  DeviceRole.Siren, DeviceRole.Floodlight, DeviceRole.Spotlight, DeviceRole.PirSensor, DeviceRole.Chime, DeviceRole.Autotrack, DeviceRole.Nightvision, DeviceRole.PrivacyMask, DeviceRole.Doorbell, DeviceRole.CoverBlind, DeviceRole.CoverShutter, DeviceRole.CoverAwning, DeviceRole.CoverCurtain, DeviceRole.CoverGarage, DeviceRole.CoverGate, DeviceRole.CoverDoor, DeviceRole.CoverWindow, DeviceRole.BinaryHelper, DeviceRole.Outlet, DeviceRole.MotionSensor, DeviceRole.ContactSensor, DeviceRole.LeakSensor, DeviceRole.SmokeSensor, DeviceRole.COSensor, DeviceRole.GasSensor, DeviceRole.TamperSensor, DeviceRole.VibrationSensor, DeviceRole.ConnectivitySensor, DeviceRole.SoundSensor, DeviceRole.BinarySensor, DeviceRole.TemperatureSensor, DeviceRole.HumiditySensor, DeviceRole.AmbientLightSensor, DeviceRole.PressureSensor, DeviceRole.WindSensor, DeviceRole.RainSensor, DeviceRole.UvSensor, DeviceRole.SolarRadiationSensor, DeviceRole.SoilMoistureSensor, DeviceRole.PowerSensor, DeviceRole.EnergySensor, DeviceRole.VoltageSensor, DeviceRole.CurrentSensor, DeviceRole.AirQualitySensor, DeviceRole.BatterySensor, DeviceRole.NumericSensor, DeviceRole.EnumSensor, DeviceRole.DateTimeSensor, DeviceRole.GenericSensor, DeviceRole.NumericControl, DeviceRole.SelectControl, DeviceRole.TextControl, DeviceRole.DateTimeControl, DeviceRole.MobilePushNotifier, DeviceRole.MessagingNotifier, DeviceRole.EmailNotifier, DeviceRole.GenericNotifier, DeviceRole.IrTransmitter;
158408
159250
  /** A string in both languages, as the cap vocabulary writes it (D920): no `t()` in the model. */
158409
159251
  var HeroTextSchema = object({
@@ -158411,6 +159253,7 @@ var HeroTextSchema = object({
158411
159253
  it: string()
158412
159254
  });
158413
159255
  var HeroRowIdSchema = _enum([
159256
+ "progress",
158414
159257
  "run-for",
158415
159258
  "cycle",
158416
159259
  "program",
@@ -158425,6 +159268,7 @@ var HeroRowIdSchema = _enum([
158425
159268
  "alarm",
158426
159269
  "fan",
158427
159270
  "vacuum",
159271
+ "vacuum-suction",
158428
159272
  "mower",
158429
159273
  "feeder",
158430
159274
  "fountain",
@@ -158443,7 +159287,10 @@ var HeroRowIdSchema = _enum([
158443
159287
  "climate-fan",
158444
159288
  "setpoint",
158445
159289
  "channel",
158446
- "control"
159290
+ "control",
159291
+ "circuit",
159292
+ "heat-pump-power",
159293
+ "system-mode"
158447
159294
  ]);
158448
159295
  var HeroArgValueSchema = lazy(() => union([
158449
159296
  string(),
@@ -158465,13 +159312,11 @@ var HeroConfirmSchema = _enum([
158465
159312
  "press"
158466
159313
  ]);
158467
159314
  var HeroActionSchema = object({
158468
- /** Unique within the model; the `gated` list and the specs name it. */
158469
159315
  id: string(),
158470
159316
  label: HeroTextSchema,
158471
159317
  icon: IconKeySchema,
158472
159318
  call: HeroCallSchema,
158473
159319
  emphasis: _enum(["primary", "normal"]),
158474
- /** Ask before running it. */
158475
159320
  confirm: HeroConfirmSchema.nullable()
158476
159321
  });
158477
159322
  var HeroControlSchema = discriminatedUnion("kind", [
@@ -158508,16 +159353,34 @@ var HeroControlSchema = discriminatedUnion("kind", [
158508
159353
  label: HeroTextSchema,
158509
159354
  current: string().nullable(),
158510
159355
  options: array(string()),
159356
+ /** A readable label per option value; an option without one is drawn as its raw value. */
159357
+ optionLabels: record(string(), HeroTextSchema).optional(),
158511
159358
  call: HeroCallSchema,
158512
159359
  valueArg: string()
158513
159360
  })
158514
159361
  ]);
159362
+ /** Declared by its interface: a `z.infer` of one more icon union pushes the cap's inferred type past what the compiler can print. */
159363
+ var HeroPillSchema = object({
159364
+ icon: IconKeySchema.nullable(),
159365
+ text: HeroTextSchema,
159366
+ tone: HeroToneSchema
159367
+ });
158515
159368
  var HeroRowSchema = object({
158516
159369
  id: HeroRowIdSchema,
159370
+ /** `scene`: the row's action and slider controls are drawn on the scene. Absent: an ordinary row. */
159371
+ placement: _enum(["row", "scene"]).optional(),
159372
+ /** The row's own name when the kind's label would not tell rows of one kind apart (a circuit's label). */
159373
+ label: HeroTextSchema.optional(),
159374
+ /** A group header drawn above the row when it differs from the previous row's ("System"). */
159375
+ group: HeroTextSchema.optional(),
159376
+ /** Values drawn as pills across the row (a heat pump's powers). */
159377
+ pills: array(HeroPillSchema).optional(),
158517
159378
  icon: IconKeySchema,
158518
159379
  /** The row's status, in words. `null` = nothing to say. */
158519
159380
  status: HeroTextSchema.nullable(),
158520
- controls: array(HeroControlSchema)
159381
+ controls: array(HeroControlSchema),
159382
+ /** A bar under the row's label, 0..1; `null` / absent = no bar. */
159383
+ progress: number$1().min(0).max(1).nullable().optional()
158521
159384
  });
158522
159385
  var HeroDetailSchema = object({
158523
159386
  label: HeroTextSchema,
@@ -158525,16 +159388,27 @@ var HeroDetailSchema = object({
158525
159388
  unit: string().nullable()
158526
159389
  });
158527
159390
  var HeroBadgeSchema = object({
158528
- id: _enum(["battery", "network-link"]),
159391
+ id: _enum([
159392
+ "battery",
159393
+ "network-link",
159394
+ "integration"
159395
+ ]),
158529
159396
  icon: IconKeySchema,
158530
159397
  tone: HeroToneSchema,
158531
159398
  /** Percent for a battery, link quality for a link; `null` = not known. */
158532
159399
  value: number$1().nullable(),
158533
159400
  label: HeroTextSchema
158534
159401
  });
158535
- var HeroRemoteSlotSchema = object({
158536
- /** Saved commands; `null` = not known yet (the button still shows). */
158537
- commands: number$1().int().nullable() });
159402
+ var HeroRemoteSlotSchema = object({
159403
+ /** Saved commands; `null` = not known yet (the button still shows). */
159404
+ commands: number$1().int().nullable(),
159405
+ /**
159406
+ * The control a list row draws as the "open the remote" icon. Recognised by its id
159407
+ * ({@link REMOTE_OPEN_ACTION_ID}); it changes no state, so a client opens the remote
159408
+ * instead of running `call`. Absent on a model from an older server.
159409
+ */
159410
+ open: HeroActionSchema.optional()
159411
+ });
158538
159412
  var HeroConsumablesSlotSchema = object({
158539
159413
  items: array(object({
158540
159414
  key: string(),
@@ -158573,7 +159447,13 @@ var HeroTimedRunSlotSchema = object({
158573
159447
  activeUntil: number$1().nullable(),
158574
159448
  quickRun: TimedRunQuickRunSchema,
158575
159449
  run: HeroActionSchema,
158576
- cancel: HeroActionSchema
159450
+ cancel: HeroActionSchema,
159451
+ /**
159452
+ * Whole units left (the limit's unit, ceil). `null` while nothing is armed.
159453
+ * A number, not words: the row formats it, and a text here would not fit the
159454
+ * hero-layout declaration.
159455
+ */
159456
+ remaining: number$1().nullable()
158577
159457
  });
158578
159458
  var HeroPowerSupplySlotSchema = object({
158579
159459
  /** The plug's state; `null` = unknown, never off. */
@@ -158625,7 +159505,12 @@ var HeroFactSchema = object({
158625
159505
  var HeroSideTileSchema = object({
158626
159506
  label: HeroTextSchema,
158627
159507
  value: HeroTextSchema,
158628
- tone: HeroToneSchema.optional()
159508
+ tone: HeroToneSchema.optional(),
159509
+ /**
159510
+ * Epoch ms when the tile reads a clock time (an appliance's end): a client prints it in
159511
+ * the viewer's own time zone; `value` is the fallback for one that cannot.
159512
+ */
159513
+ at: number$1().optional()
158629
159514
  });
158630
159515
  var HeroSideTilesSchema = object({
158631
159516
  left: array(HeroSideTileSchema).max(2),
@@ -158661,8 +159546,12 @@ var HeroModelSchema = object({
158661
159546
  sideTiles: HeroSideTilesSchema,
158662
159547
  /** The status line under the main icon. */
158663
159548
  title: HeroTextSchema,
159549
+ /** The scene's top line when it says more than `title`; absent = draw the title. */
159550
+ caption: HeroTextSchema.optional(),
158664
159551
  badges: array(HeroBadgeSchema),
158665
159552
  remote: HeroRemoteSlotSchema.nullable(),
159553
+ /** The foot button that opens the device's history: "History", "Cycles", "Meals", "Access". */
159554
+ historyLabel: HeroTextSchema,
158666
159555
  consumables: HeroConsumablesSlotSchema.nullable(),
158667
159556
  consumption: HeroConsumptionSlotSchema.nullable(),
158668
159557
  ownPower: HeroOwnPowerSlotSchema.nullable(),
@@ -158683,18 +159572,40 @@ var HeroModelSchema = object({
158683
159572
  * 4. a trailing fact (power, else battery, else consumables).
158684
159573
  *
158685
159574
  * Selection rules, all taken from the model:
158686
- * - ONE control is ever shown: the device's own power; else the FIRST control of
159575
+ * - the primary control is the device's own power; else the FIRST control of
158687
159576
  * the FIRST row that has any (a later row's control is never promoted). When
158688
159577
  * the model lists that part in `gated`, the row has no inline control: the
158689
159578
  * projection never falls through to another control the caller could use.
159579
+ * - a climate or thermostat row's primary is its `climate.mode` control (no power
159580
+ * toggle: "off" is a mode); when the model gates it the rule above applies as before;
159581
+ * - a timed run, when the model carries the slot, sits beside that primary:
159582
+ * Run while idle, Stop while armed. Gating the slot hides the control.
158690
159583
  * - the status line is the head (what plays, else the state) plus at most
158691
- * {@link ROW_STATUS_FACTS_MAX} facts, the trailing fact excluded;
159584
+ * {@link ROW_STATUS_FACTS_MAX} facts, the trailing fact excluded, then the
159585
+ * time left on an armed timed run;
158692
159586
  * - the trailing fact is the first of power, battery, consumables.
158693
159587
  *
159588
+ * - `extras` are the further inline controls of the types that carry more than one
159589
+ * ({@link ROW_EXTRAS_BY_TYPE}): climate setpoint, a robot's return to base,
159590
+ * a player's volume and remote. Each is a control the model already has, named by id,
159591
+ * in that order and at most {@link ROW_EXTRAS_MAX}; one the model lacks, or lists in
159592
+ * `gated`, is absent, and the one `primary` already is never repeats. Empty = the
159593
+ * row of an older server: `primary` alone.
159594
+ *
158694
159595
  * `projectDeviceRow` is pure and computes nothing: it selects from a
158695
159596
  * {@link HeroModel}. A row that needed a value the hero lacks would mean the
158696
159597
  * model is missing it, so the fix goes in the model.
158697
159598
  */
159599
+ /**
159600
+ * The row's timed-run control. `id` is `timed-run.run` while idle and
159601
+ * `timed-run.cancel` while armed; `duration` and `unit` are the one-tap run
159602
+ * a Run press starts.
159603
+ */
159604
+ var HeroRowTimedRunSchema = object({
159605
+ id: _enum(["timed-run.run", "timed-run.cancel"]),
159606
+ duration: number$1(),
159607
+ unit: _enum(["min", "s"])
159608
+ });
158698
159609
  var HeroRowModelSchema = object({
158699
159610
  deviceId: number$1().int(),
158700
159611
  name: string(),
@@ -158707,8 +159618,21 @@ var HeroRowModelSchema = object({
158707
159618
  statusLine: array(HeroTextSchema),
158708
159619
  /** `null` = the type has no inline control, or the caller may not act on it. */
158709
159620
  primary: HeroControlSchema.nullable(),
159621
+ /**
159622
+ * Beside `primary` when the device offers a timed run: Run while idle, Stop
159623
+ * while armed. `null` when there is no slot, or the caller may not act.
159624
+ */
159625
+ timedRun: HeroRowTimedRunSchema.nullable(),
159626
+ /**
159627
+ * The further inline controls after `primary`, in order (see the header). The remote
159628
+ * is an `action` with id `remote.open`: the client opens the remote, it does not run
159629
+ * the call. Absent or empty = `primary` alone.
159630
+ */
159631
+ extras: array(HeroControlSchema).max(2).optional(),
158710
159632
  trailing: HeroFactSchema.nullable()
158711
159633
  });
159634
+ DeviceType.Climate, DeviceType.Thermostat;
159635
+ DeviceType.Climate, DeviceType.Thermostat, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.MediaPlayer;
158712
159636
  /**
158713
159637
  * hero-layout — what a device's hero says (D1023). Read-only: the FIXED
158714
159638
  * layouts live in `@camstack/types` and nothing here stores or edits one.
@@ -159120,6 +160044,12 @@ var IntegrationWithStateSchema = object({
159120
160044
  name: string(),
159121
160045
  /** A projection of the instance body's switch (`setInstanceEnabled` is the only writer). */
159122
160046
  enabled: boolean(),
160047
+ /**
160048
+ * True when the addon that holds the switch did not answer (down, failed, or keeps no record for
160049
+ * this row): `enabled` is then the stored registry flag, a stale value, not the state. A reader
160050
+ * must not draw it as on or off (D315).
160051
+ */
160052
+ switchUnknown: literal(true).optional(),
159123
160053
  info: record(string(), unknown()).readonly(),
159124
160054
  /** The discovery candidate this integration was set up from (D984). */
159125
160055
  originStableId: string().optional(),
@@ -159133,6 +160063,12 @@ var IntegrationLiteSchema = object({
159133
160063
  name: string(),
159134
160064
  /** A projection of the instance body's switch (`setInstanceEnabled` is the only writer). */
159135
160065
  enabled: boolean(),
160066
+ /**
160067
+ * True when the addon that holds the switch did not answer (down, failed, or keeps no record for
160068
+ * this row): `enabled` is then the stored registry flag, a stale value, not the state. A reader
160069
+ * must not draw it as on or off (D315).
160070
+ */
160071
+ switchUnknown: literal(true).optional(),
159136
160072
  info: record(string(), unknown()).readonly(),
159137
160073
  /** The discovery candidate this integration was set up from (D984). */
159138
160074
  originStableId: string().optional(),
@@ -159231,9 +160167,9 @@ var UpdateIntegrationInputSchema = object({
159231
160167
  id: string(),
159232
160168
  name: string().optional(),
159233
160169
  /**
159234
- * Accepted for a FIXED builtin only (`info.fixed`: alarm panel, camera grid, core blocks,
159235
- * terminal), which keeps no instance record: the registry flag is its one store. Any other
159236
- * integration is switched through `integration-instances.setInstanceEnabled`.
160170
+ * Honoured ONLY for a fixed builtin (`info.fixed`), whose switch is the hub's own registry flag
160171
+ * and works while its addon is down. Any other row is refused (a typed `BAD_REQUEST`): its
160172
+ * switch is `integration-instances.setInstanceEnabled`.
159237
160173
  */
159238
160174
  enabled: boolean().optional(),
159239
160175
  info: record(string(), unknown()).optional()
@@ -159267,6 +160203,12 @@ method(_void(), array(IntegrationWithStateSchema)), method(object({ id: string()
159267
160203
  * the form as a `SecretFieldView`, never text (D789). A patch value omitted, `''`
159268
160204
  * or the redaction token KEEPS the stored secret; `{ $secretClear: true }`
159269
160205
  * clears it.
160206
+ *
160207
+ * Who may call (epic #440): every method but `describe` and `instanceFormSchema` is open to any
160208
+ * session (`caller: 'scoped'`) and default-denies. An admin passes everywhere. A non-admin passes
160209
+ * only on a call pinned to one addon whose `describe().userScoped` is true, and that provider
160210
+ * filters every row on the `caller` the router injected (a notification target is somebody's
160211
+ * phone: a user sees and changes only their own). An addon that says nothing keeps the admin door.
159270
160212
  */
159271
160213
  var ConfigSchemaPassthrough$2 = custom();
159272
160214
  var IntegrationInstanceIdSchema = string().min(1);
@@ -159380,7 +160322,15 @@ var IntegrationInstanceDescriptionSchema = object({
159380
160322
  */
159381
160323
  mintsId: boolean().optional(),
159382
160324
  /** The links to other instances the provider's kinds declare; absent means none. */
159383
- links: array(IntegrationInstanceLinkSchema).optional()
160325
+ links: array(IntegrationInstanceLinkSchema).optional(),
160326
+ /**
160327
+ * The rows belong to individual users (a notification target is somebody's phone). The router
160328
+ * then opens `listInstances`, `getInstance`, `createInstance`, `updateInstance`,
160329
+ * `setInstanceEnabled`, `deleteInstance` and `testInstance` to a NON-admin session on a call
160330
+ * pinned to this addon, and hands the provider the `caller` so it keeps a user to their own rows.
160331
+ * Absent means admin only, as it always was.
160332
+ */
160333
+ userScoped: boolean().optional()
159384
160334
  });
159385
160335
  var IntegrationInstanceStatusSchema = object({
159386
160336
  state: _enum([
@@ -159438,8 +160388,14 @@ var integrationInstancesCapability = {
159438
160388
  /** The discovery candidate the wizard was seeded from (`stableId`), if any. */
159439
160389
  candidateStableId: string().min(1).optional()
159440
160390
  }), ConfigSchemaPassthrough$2, { auth: "admin" }),
159441
- listInstances: method(_void(), array(IntegrationInstanceSchema).readonly(), { auth: "admin" }),
159442
- getInstance: method(object({ id: IntegrationInstanceIdSchema }), IntegrationInstanceSchema.nullable(), { auth: "admin" }),
160391
+ listInstances: method(looseObject({}), array(IntegrationInstanceSchema).readonly(), {
160392
+ auth: "protected",
160393
+ caller: "scoped"
160394
+ }),
160395
+ getInstance: method(object({ id: IntegrationInstanceIdSchema }), IntegrationInstanceSchema.nullable(), {
160396
+ auth: "protected",
160397
+ caller: "scoped"
160398
+ }),
159443
160399
  /**
159444
160400
  * Insert the typed record. With `id` it is stored under that id (a duplicate id is refused);
159445
160401
  * without one the PROVIDER mints it and answers it. `kind` picks one of `describe().kinds`.
@@ -159472,11 +160428,13 @@ var integrationInstancesCapability = {
159472
160428
  seed: object({ info: record(string(), unknown()) }).optional()
159473
160429
  }), object({ id: string() }), {
159474
160430
  kind: "mutation",
159475
- auth: "admin"
160431
+ auth: "protected",
160432
+ caller: "scoped"
159476
160433
  }),
159477
160434
  updateInstance: method(IntegrationInstancePatchSchema, object({ ok: literal(true) }), {
159478
160435
  kind: "mutation",
159479
- auth: "admin"
160436
+ auth: "protected",
160437
+ caller: "scoped"
159480
160438
  }),
159481
160439
  /**
159482
160440
  * Switch ONE instance on or off, for every role; a missing record is created from the addon's
@@ -159488,7 +160446,8 @@ var integrationInstancesCapability = {
159488
160446
  enabled: boolean()
159489
160447
  }), object({ ok: literal(true) }), {
159490
160448
  kind: "mutation",
159491
- auth: "admin"
160449
+ auth: "protected",
160450
+ caller: "scoped"
159492
160451
  }),
159493
160452
  /**
159494
160453
  * Delete the record and its keychain refs together. For an instance that brings devices the hub
@@ -159497,7 +160456,8 @@ var integrationInstancesCapability = {
159497
160456
  */
159498
160457
  deleteInstance: method(object({ id: IntegrationInstanceIdSchema }), object({ ok: literal(true) }), {
159499
160458
  kind: "mutation",
159500
- auth: "admin"
160459
+ auth: "protected",
160460
+ caller: "scoped"
159501
160461
  }),
159502
160462
  testInstance: optionalMethod(object({
159503
160463
  id: IntegrationInstanceIdSchema.nullable(),
@@ -159506,7 +160466,8 @@ var integrationInstancesCapability = {
159506
160466
  kind: string().min(1).optional()
159507
160467
  }), TestConnectionResultSchema, {
159508
160468
  kind: "mutation",
159509
- auth: "admin"
160469
+ auth: "protected",
160470
+ caller: "scoped"
159510
160471
  })
159511
160472
  }
159512
160473
  };
@@ -161378,7 +162339,7 @@ var lockControlCapability = {
161378
162339
  kind: "mutation",
161379
162340
  auth: "protected"
161380
162341
  }),
161381
- open: method(object({ deviceId: number$1().int().nonnegative() }), _void(), {
162342
+ open: optionalMethod(object({ deviceId: number$1().int().nonnegative() }), _void(), {
161382
162343
  kind: "mutation",
161383
162344
  auth: "protected"
161384
162345
  })
@@ -162596,7 +163557,7 @@ object({
162596
163557
  deviceId: number$1().int().optional(),
162597
163558
  atBefore: number$1().optional(),
162598
163559
  where: RecordWhereSchema.optional()
162599
- }), object({ count: number$1().int().nonnegative() }), object({}), object({ store: Rows }), object({ patch: Rows }), object({}), object({ keys: array(string().min(1)) }), object({ removed: array(string()) }), object({ refs: array(string()) }), object({ values: record(string(), string().nullable()) }), object({
163560
+ }), object({ count: number$1().int().nonnegative() }), object({}), object({ store: Rows }), object({ patch: Rows }), object({}), object({ keys: array(string().min(1)) }), object({ removed: array(string()) }), object({}), object({ deviceIds: array(number$1().int()) }), object({ deviceIds: array(number$1().int()) }), object({ blobs: record(string(), Rows) }), object({ refs: array(string()) }), object({ values: record(string(), string().nullable()) }), object({
162600
163561
  ref: string().min(1),
162601
163562
  value: string()
162602
163563
  }), object({}), object({ refs: array(string()) }), object({ deleted: number$1().int().nonnegative() }), object({}), object({ integrations: array(MigrationIntegrationSchema) }), object({ id: string().min(1) }), MigrationIntegrationSchema.nullable(), object({
@@ -162607,7 +163568,7 @@ object({
162607
163568
  integrationId: string().nullable(),
162608
163569
  /** Whether the device carries any stored config; its content is not offered. */
162609
163570
  hasConfig: boolean()
162610
- }).nullable(), object({
163571
+ }).nullable(), object({ deviceIds: array(number$1().int()) }), object({ aliases: record(string(), string()) }), object({
162611
163572
  deviceId: number$1().int(),
162612
163573
  integrationId: string().min(1)
162613
163574
  }), object({}), object({}), object({ nodeId: string() }), object({}), object({});
@@ -169905,92 +170866,21 @@ var NcZoneConditionSchema = object({
169905
170866
  * membership lists are OR within the list (spec §2.3).
169906
170867
  */
169907
170868
  /**
169908
- * What a rule may actuate.
169909
- *
169910
- * **No hand-maintained allowlist** (operator decision, and the right one — a
169911
- * written list of methods is a third parallel map to keep aligned, and this
169912
- * repo has paid for those). The boundary instead comes from a property the
169913
- * capabilities already carry: an action may target only a **device-scoped**
169914
- * capability method.
169915
- *
169916
- * That is not decoration. A rule can be authored by a NON-ADMIN — personal
169917
- * rules are a supported flow — and the executor runs with the addon's
169918
- * privileges, so an unbounded action is an arbitrary RPC channel with a
169919
- * privilege escalation attached. Restricting to device scope excludes the
169920
- * system caps (`device-manager.removeDevice` and friends) by construction,
169921
- * costs nothing to maintain, and cannot rot: a cap that stops being
169922
- * device-scoped stops being actuatable in the same change.
169923
- *
169924
- * The executor enforces it; {@link NcRuleActionSchema} carries the intent.
169925
- */
169926
- /**
169927
- * One step of a sequence.
169928
- *
169929
- * `wait` is a first-class step rather than a property of the next action: it is
169930
- * what makes a sequence a SEQUENCE and not a list — "unlock, wait 5s, open"
169931
- * cannot be expressed otherwise.
169932
- */
169933
- var NcRuleActionSchema = discriminatedUnion("kind", [object({
169934
- kind: literal("wait"),
169935
- seconds: number$1().min(0).max(300)
169936
- }), object({
169937
- kind: literal("cap"),
169938
- /**
169939
- * WHO the step acts on (D983) — the only shape that is written. A sequence
169940
- * stored before D983 carries `deviceId`; the sequence store reads it as a
169941
- * `devices` target.
169942
- */
169943
- target: ActionTargetSchema.optional(),
169944
- /** The vocabulary action the step performs; required for a `domain` target. */
169945
- actionId: string().min(1).optional(),
169946
- /** @deprecated The pre-D983 single device. Read, never written. */
169947
- deviceId: number$1().int().optional(),
169948
- /** Capability name, e.g. `alarm-panel`. */
169949
- cap: string().min(1),
169950
- /** Method on it. The executor refuses a non-device-scoped cap. */
169951
- method: string().min(1),
169952
- /** Method arguments, minus `deviceId` (the executor injects it). */
169953
- args: record(string(), unknown()).optional()
169954
- }).refine((step) => step.target !== void 0 || step.deviceId !== void 0, {
169955
- message: "a cap step needs a target",
169956
- path: ["target"]
169957
- }).refine((step) => step.target?.kind !== "domain" || step.actionId !== void 0, {
169958
- message: "a domain target needs the vocabulary action it applies to (actionId)",
169959
- path: ["actionId"]
169960
- })]);
169961
- /**
169962
- * A named, ordered run of steps shared across rules, with its own throttle.
170869
+ * What a rule or a button runs: an **Action** of the `actions` surface
170870
+ * (`internal:<uuid>` or an addon's), by id, and nothing else (planning#473).
169963
170871
  *
169964
- * Sequences live in the notification centre's sequence store — never inline on
169965
- * a rule. A rule binds to one by id ({@link NcActionBindingSchema}), and a
169966
- * button names one the same way. `minDelaySec` exists because a noisy rule
169967
- * otherwise hammers a physical actuator — the rule's own cooldown governs
169968
- * NOTIFICATIONS, which is a different budget from "how often may this gate
169969
- * actually open". The throttle key is the sequence id, so two rules sharing
169970
- * one sequence share its budget.
170872
+ * The notification centre has no step vocabulary of its own. The steps, the
170873
+ * device-scope boundary, the stop-at-first-failure, the throttle
170874
+ * (`minDelaySec`), the variables and the runs ledger all belong to the Action;
170875
+ * an operator edits them in ONE place (the Actions page) and a rule points at
170876
+ * the result. A rule can be authored by a non-admin (personal rules), which is
170877
+ * safe for the same reason: it can only name an Action an admin already wrote.
169971
170878
  */
169972
- var NcSharedSequenceSchema = object({
169973
- id: string().min(1),
169974
- name: string().min(1).max(120),
169975
- minDelaySec: number$1().int().min(0).max(86400).optional(),
169976
- actions: array(NcRuleActionSchema).min(1)
169977
- });
169978
- /** Create / update body — the id is minted by the provider. */
169979
- var NcSharedSequenceInputSchema = object({
169980
- name: string().min(1).max(120),
169981
- minDelaySec: number$1().int().min(0).max(86400).optional(),
169982
- actions: array(NcRuleActionSchema).min(1)
169983
- });
169984
- /** Bindings on one hook edge. Cap keeps a slot from becoming a second sequence editor. */
169985
- var NcHookBindingsSchema = array(discriminatedUnion("kind", [object({
169986
- kind: literal("sequence"),
169987
- sequenceId: string().min(1)
169988
- }), object({
169989
- kind: literal("do"),
169990
- action: NcRuleActionSchema
169991
- })])).max(4);
170879
+ var NcActionIdSchema = string().min(1);
170880
+ /** Action ids one hook edge runs, in order. Capped so a slot never becomes a second editor. */
170881
+ var NcHookActionIdsSchema = array(NcActionIdSchema).max(4);
169992
170882
  /**
169993
- * One button carried by the notification, running a shared sequence on tap.
170883
+ * One button carried by the notification, running an Action on tap.
169994
170884
  *
169995
170885
  * **Read this before adding a button that does something physical.** The tap
169996
170886
  * arrives over a link that travelled through third-party infrastructure — ntfy,
@@ -170005,9 +170895,9 @@ var NcRuleNotificationButtonSchema = object({
170005
170895
  /** Stable id — travels in the callback and identifies the button in logs. */
170006
170896
  id: string().min(1).max(64),
170007
170897
  label: string().min(1).max(40),
170008
- /** Id of a shared sequence. The dispatcher drops a button whose sequence
170009
- * does not exist rather than minting a token for nothing. */
170010
- sequenceId: string().min(1),
170898
+ /** The Action the tap runs. The dispatcher drops a button whose Action does
170899
+ * not exist rather than minting a token for nothing. */
170900
+ actionId: NcActionIdSchema,
170011
170901
  icon: NotificationActionIconSchema.optional(),
170012
170902
  destructive: boolean().optional()
170013
170903
  });
@@ -170022,25 +170912,19 @@ var NcRuleNotificationButtonSchema = object({
170022
170912
  * leave). A delivery with no clear edge never produces this hook.
170023
170913
  */
170024
170914
  var NcRuleActionsSchema = object({
170025
- onActivation: NcHookBindingsSchema.optional(),
170026
- onDeactivation: NcHookBindingsSchema.optional(),
170915
+ onActivation: NcHookActionIdsSchema.optional(),
170916
+ onDeactivation: NcHookActionIdsSchema.optional(),
170027
170917
  /** Runs on a positive / raised match. */
170028
- onTrigger: NcHookBindingsSchema.optional(),
170918
+ onTrigger: NcHookActionIdsSchema.optional(),
170029
170919
  /** Runs on a clear / leave match, when the subject carries one. */
170030
- onTriggerOff: NcHookBindingsSchema.optional(),
170920
+ onTriggerOff: NcHookActionIdsSchema.optional(),
170031
170921
  /**
170032
- * Buttons the NOTIFICATION carries, each running one shared sequence when
170033
- * tapped. Deliberately a REFERENCE — a button that could define its own
170034
- * actions would be a parallel actuation vocabulary.
170922
+ * Buttons the NOTIFICATION carries, each running one Action when tapped.
170923
+ * Deliberately a REFERENCE — a button that could define its own steps would
170924
+ * be a parallel actuation vocabulary.
170035
170925
  */
170036
170926
  buttons: array(NcRuleNotificationButtonSchema).max(8).optional()
170037
170927
  });
170038
- object({
170039
- name: string().min(1).max(120),
170040
- enabled: boolean(),
170041
- minDelaySec: number$1().int().min(0).max(86400).optional(),
170042
- actions: array(NcRuleActionSchema).min(1)
170043
- });
170044
170928
  /**
170045
170929
  * "This rule applies only while `deviceId` is in one of `states`."
170046
170930
  *
@@ -170339,6 +171223,26 @@ var NcRuleTargetSchema = object({
170339
171223
  */
170340
171224
  params: record(string(), unknown()).optional()
170341
171225
  });
171226
+ /** Which picture kind one target receives (#487). */
171227
+ var NcTargetAttachmentSchema = _enum([
171228
+ "none",
171229
+ "image",
171230
+ "clip",
171231
+ "gif"
171232
+ ]);
171233
+ var NcTargetOverrideSchema = object({
171234
+ template: object({
171235
+ title: string().max(500).optional(),
171236
+ body: string().max(2e3).optional()
171237
+ }).optional(),
171238
+ schedule: NcScheduleSchema.optional(),
171239
+ priority: number$1().int().min(1).max(5).optional(),
171240
+ attachment: NcTargetAttachmentSchema.optional(),
171241
+ /** `false` = no buttons for this target; `true` is the same as absent. */
171242
+ actions: boolean().optional()
171243
+ });
171244
+ /** Per-target settings keyed by target id (#487). */
171245
+ var NcTargetOverridesSchema = record(string(), NcTargetOverrideSchema);
170342
171246
  /**
170343
171247
  * WHAT THE NOTIFICATION'S PICTURE IS (D897) — the ONE media choice of a rule.
170344
171248
  *
@@ -170620,6 +171524,13 @@ var NcRuleInputSchema = object({
170620
171524
  * targets.
170621
171525
  */
170622
171526
  targetUsers: array(string()).optional(),
171527
+ /**
171528
+ * Per-target settings keyed by target id (#487): texts, schedule, priority.
171529
+ * Absent (and an absent entry) = the rule's own values. A patch that omits
171530
+ * the key keeps the stored map; a patch that names it REPLACES it whole —
171531
+ * `{}` empties it.
171532
+ */
171533
+ targetOverrides: NcTargetOverridesSchema.optional(),
170623
171534
  /** Absent = the kind's default picture (`resolveNcMediaImage`): the subject crop for a
170624
171535
  * detection, the clean scene for a sensor or a sound. Set explicitly on save (D897). */
170625
171536
  media: NcMediaPolicySchema.default({}),
@@ -171721,18 +172632,6 @@ method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), m
171721
172632
  }), object({ success: literal(true) }), {
171722
172633
  kind: "mutation",
171723
172634
  auth: "admin"
171724
- }), method(object({}), object({ sequences: array(NcSharedSequenceSchema) }), { auth: "admin" }), method(object({ sequenceId: string().min(1) }), object({ sequence: NcSharedSequenceSchema.nullable() }), { auth: "admin" }), method(object({ sequence: NcSharedSequenceInputSchema }), object({ sequence: NcSharedSequenceSchema }), {
171725
- kind: "mutation",
171726
- auth: "admin"
171727
- }), method(object({
171728
- sequenceId: string().min(1),
171729
- sequence: NcSharedSequenceInputSchema
171730
- }), object({ sequence: NcSharedSequenceSchema }), {
171731
- kind: "mutation",
171732
- auth: "admin"
171733
- }), method(object({ sequenceId: string().min(1) }), object({ success: literal(true) }), {
171734
- kind: "mutation",
171735
- auth: "admin"
171736
172635
  }), method(object({}), NcClipRetentionPlanSchema, { auth: "admin" }), method(object({}), object({ mutedDeviceIds: array(number$1().int()).readonly() }), { auth: "admin" }), method(object({
171737
172636
  deviceId: number$1().int(),
171738
172637
  muted: boolean()
@@ -172217,53 +173116,41 @@ setOverlay: method(object({
172217
173116
  }
172218
173117
  }] }
172219
173118
  };
172220
- _enum([
172221
- "value",
172222
- "unit",
172223
- "full"
172224
- ]);
172225
- _enum([
172226
- "value+unit",
172227
- "value",
172228
- "unit"
172229
- ]);
172230
173119
  /**
172231
- * How the operator reached the leaf device. `deviceId` is ALWAYS the
172232
- * OSD-supported leaf that is read; `containerId` is set when the pick
172233
- * went through a container (gateway) first.
173120
+ * `osd-manager` — the ORCHESTRATOR over the device-scope `osd` cap.
173121
+ *
173122
+ * The `osd` cap is the firmware contract: it probes a camera's overlay
173123
+ * SLOTS and writes literal text into one. It has no idea WHERE that text
173124
+ * comes from, and it must not — a driver that grew a "show the temperature
173125
+ * here" feature would grow it once per vendor.
173126
+ *
173127
+ * This cap owns the other half: a per-(camera, slot) BINDING that says
173128
+ * which value feeds the slot, how it is formatted, and under which
173129
+ * conditions it is shown at all. Named TEMPLATES combine many device
173130
+ * fields into one overlay string (plugin catalog OSD Manager parity).
172234
173131
  */
172235
- var OsdTemplatePickSchema = object({
172236
- containerId: number$1().int().optional(),
172237
- deviceId: number$1().int()
172238
- });
172239
173132
  /**
172240
- * One named binding inside a multi-device template: device path + unit
172241
- * selection + precision. The parser expands `{alias}`, `{alias.value}`,
172242
- * `{alias.unit}`, or `{alias.full}` from the same binding — there is no
172243
- * per-binding format lock.
173133
+ * The text of a named template: a device template (D1021) —
173134
+ * `{{ camera.temperature | round(1) }}`, `{{ now | time('HH:mm') }}`,
173135
+ * `{% if camera.motion %}MOTION{% endif %}` — rendered by the ONE hub renderer
173136
+ * (`device-manager.renderDeviceTemplates`), never by this addon.
173137
+ *
173138
+ * Two names belong to the render rather than to a device:
173139
+ * - `now` is the clock; `time('HH:mm')` prints it in the server's zone.
173140
+ * - `camera` is the camera the overlay is on, so one template serves every
173141
+ * camera. `camera.lastPerson` and `camera.lastPlate` are the most recent
173142
+ * recognition persisted for it (empty text until there is one, with
173143
+ * `| default('')`).
172244
173144
  */
172245
- var OsdTemplateBindingSchema = object({
172246
- /** Token stem in the parser, e.g. `t` → `{t}` / `{t.value}`. Unique within the template. */
172247
- alias: string().min(1).max(32).regex(/^[A-Za-z][A-Za-z0-9_-]*$/, "alias must start with a letter"),
172248
- pick: OsdTemplatePickSchema,
172249
- capName: string().min(1).max(64),
172250
- valuePath: string().min(1).max(64),
172251
- /** Convert TO this unit at render (`tryConvertUnit`). Absent = source unit. */
172252
- displayUnit: string().max(16).optional(),
172253
- maxDecimals: number$1().int().min(0).max(4).default(1),
172254
- /** Raw value → display text (same shape as slot binding). Empty string hides. */
172255
- valueMap: record(string(), string()).optional()
172256
- });
173145
+ var OSD_TEMPLATE_TEXT_MAX = 1024;
172257
173146
  /**
172258
- * A named template: bindings (alias → leaf field) + a parser that
172259
- * references `{alias}` / `{alias.value}` / `{alias.unit}` / `{alias.full}`.
173147
+ * A named template: the unit of reuse. A slot points at one by id; editing it
173148
+ * changes every slot that points at it, on every camera.
172260
173149
  */
172261
173150
  var OsdNamedTemplateSchema = object({
172262
173151
  id: string().min(1).max(64),
172263
173152
  name: string().min(1).max(64),
172264
- bindings: array(OsdTemplateBindingSchema).max(32).default([]),
172265
- /** Parser with alias placeholders, e.g. `{t.value} {t.unit} / {h}`. */
172266
- parser: string().max(256).default("")
173153
+ text: string().max(OSD_TEMPLATE_TEXT_MAX).default("")
172267
173154
  });
172268
173155
  /** Where a slot's value comes from. */
172269
173156
  var OsdSourceSchema = discriminatedUnion("kind", [
@@ -172272,26 +173159,6 @@ var OsdSourceSchema = discriminatedUnion("kind", [
172272
173159
  kind: literal("static"),
172273
173160
  text: string().max(64)
172274
173161
  }),
172275
- object({
172276
- kind: literal("clock"),
172277
- /** Token pattern: `YYYY MM DD HH mm ss`. Everything else is literal. */
172278
- pattern: string().min(1).max(32).default("HH:mm"),
172279
- /** IANA zone. Omitted = the server's zone. */
172280
- timezone: string().min(1).max(64).optional()
172281
- }),
172282
- object({
172283
- kind: literal("device-state"),
172284
- deviceId: number$1().int().optional(),
172285
- capName: string().min(1).max(64),
172286
- /** Dot path inside the slice, e.g. `detected`, `value`, `mode`. */
172287
- valuePath: string().min(1).max(64),
172288
- /** Convert TO this unit at render. Absent = no conversion. */
172289
- displayUnit: string().max(16).optional()
172290
- }),
172291
- object({
172292
- kind: literal("latest-recognition"),
172293
- recognition: _enum(["person", "plate"])
172294
- }),
172295
173162
  object({
172296
173163
  kind: literal("template"),
172297
173164
  templateId: string().min(1).max(64)
@@ -172301,15 +173168,6 @@ var OsdSlotBindingSchema = object({
172301
173168
  /** Off = the manager stops driving this slot. It does NOT clear it. */
172302
173169
  enabled: boolean().default(true),
172303
173170
  source: OsdSourceSchema,
172304
- /** `${value}` and `${unit}` are substituted; every occurrence. */
172305
- template: string().max(96).default("${value}"),
172306
- /**
172307
- * Decimal places for a numeric value. `0` yields an integer — the
172308
- * documented workaround for firmwares that reject `.` in overlay text.
172309
- */
172310
- maxDecimals: number$1().int().min(0).max(4).default(1),
172311
- /** Raw value → display text, e.g. `{"true":"MOTION","false":""}`. */
172312
- valueMap: record(string(), string()).optional(),
172313
173171
  /** Time windows in which the slot is shown. Absent = always. */
172314
173172
  schedule: NcScheduleSchema.optional(),
172315
173173
  /**
@@ -172351,31 +173209,21 @@ var OsdRenderResultSchema = object({
172351
173209
  /** Why, whenever the outcome is not a plain write. Never silent. */
172352
173210
  reason: string().optional()
172353
173211
  });
172354
- var OsdSourceValueTypeEnum = _enum([
172355
- "number",
172356
- "boolean",
172357
- "string",
172358
- "enum"
172359
- ]);
172360
173212
  /**
172361
- * One bindable value, derived from a cap's `runtimeState` schema — never
172362
- * hand-listed. The editor renders from this, so a cap that ships a new
172363
- * state field becomes bindable with no UI change.
173213
+ * A template rendered for one camera without being saved: what the editor
173214
+ * previews. `text` is what the overlay would carry; a refused render has a
173215
+ * `reason` and an empty text.
172364
173216
  */
172365
- var OsdSourceOptionSchema = object({
172366
- deviceId: number$1().int(),
172367
- deviceName: string(),
172368
- capName: string(),
172369
- valuePath: string(),
172370
- label: string(),
172371
- valueType: OsdSourceValueTypeEnum,
172372
- /** Present for `enum`; the editor offers these as `valueMap` keys. */
172373
- enumValues: array(string()).readonly().optional()
173217
+ var OsdTemplatePreviewSchema = object({
173218
+ ok: boolean(),
173219
+ text: string(),
173220
+ /** The refusal, or `ref: reason` per value that printed `—`. */
173221
+ notes: array(string())
172374
173222
  });
172375
173223
  method(object({ deviceId: number$1().int() }), object({
172376
173224
  supported: boolean(),
172377
173225
  slots: array(OsdSlotViewSchema)
172378
- }), { auth: "admin" }), method(object({ deviceId: number$1().int() }), object({ sources: array(OsdSourceOptionSchema) }), { auth: "admin" }), method(object({}), object({
173226
+ }), { auth: "admin" }), method(object({}), object({
172379
173227
  supported: array(string()),
172380
173228
  catalog: array(NcConditionDescriptorSchema)
172381
173229
  }), { auth: "admin" }), method(object({
@@ -172417,6 +173265,12 @@ method(object({ deviceId: number$1().int() }), object({
172417
173265
  }), OsdRenderResultSchema, {
172418
173266
  kind: "mutation",
172419
173267
  auth: "admin"
173268
+ }), method(object({
173269
+ deviceId: number$1().int(),
173270
+ text: string().max(OSD_TEMPLATE_TEXT_MAX)
173271
+ }), OsdTemplatePreviewSchema, {
173272
+ kind: "mutation",
173273
+ auth: "admin"
172420
173274
  }), method(object({ deviceId: number$1().int() }), object({ results: array(OsdRenderResultSchema) }), {
172421
173275
  kind: "mutation",
172422
173276
  auth: "admin"
@@ -172622,9 +173476,13 @@ var petFeederCapability = {
172622
173476
  */
172623
173477
  durability: "session",
172624
173478
  /**
172625
- * History (D850): recorded series.
173479
+ * History (D850): recorded series. `feeding` / `eating` are the meals the
173480
+ * device hero's "Meals" button names — change-only booleans, so a dispense
173481
+ * or a pet at the bowl is one span on the history.
172626
173482
  */
172627
173483
  history: { fields: {
173484
+ feeding: { kind: "boolean" },
173485
+ eating: { kind: "boolean" },
172628
173486
  foodLevel: { kind: "gauge" },
172629
173487
  bowlFood: { kind: "gauge" },
172630
173488
  food1: { kind: "gauge" },
@@ -174417,7 +175275,6 @@ var PowerSourceStateSchema = object({
174417
175275
  });
174418
175276
  var POWER_SOURCE_DEVICE_TYPES = [
174419
175277
  DeviceType.Gateway,
174420
- DeviceType.Hub,
174421
175278
  DeviceType.Camera,
174422
175279
  DeviceType.Sensor,
174423
175280
  DeviceType.MediaPlayer,
@@ -174469,18 +175326,18 @@ var powerSourceCapability = {
174469
175326
  mode: "singleton",
174470
175327
  deviceTypes: POWER_SOURCE_DEVICE_TYPES,
174471
175328
  methods: {
174472
- getStatus: systemMethod(deviceInput$1, PowerSourceInfoSchema, { auth: "admin" }),
175329
+ getStatus: systemMethod(deviceInput$1, PowerSourceInfoSchema, { auth: "protected" }),
174473
175330
  powerOn: systemMethod(deviceInput$1, PowerSourceActionResultSchema, {
174474
175331
  kind: "mutation",
174475
- auth: "admin"
175332
+ auth: "protected"
174476
175333
  }),
174477
175334
  powerOff: systemMethod(deviceInput$1, PowerSourceActionResultSchema, {
174478
175335
  kind: "mutation",
174479
- auth: "admin"
175336
+ auth: "protected"
174480
175337
  }),
174481
175338
  forceRestart: systemMethod(deviceInput$1, PowerSourceActionResultSchema, {
174482
175339
  kind: "mutation",
174483
- auth: "admin"
175340
+ auth: "protected"
174484
175341
  })
174485
175342
  },
174486
175343
  runtimeState: PowerSourceStateSchema,
@@ -177981,7 +178838,6 @@ var RemoteCustomButtonSchema = object({
177981
178838
  /** What the operator calls it, and what a voice command may name. */
177982
178839
  name: string().min(1).max(60)
177983
178840
  });
177984
- var RemotePowerModeSchema = _enum(["toggle", "discrete"]);
177985
178841
  /**
177986
178842
  * The source rules: every step role is bound, ids and names are unique, a
177987
178843
  * channel number belongs to one `digits` source, and no name or id is another
@@ -178062,7 +178918,6 @@ var RemoteConfigSchema = object({
178062
178918
  sources: array(RemoteSourceSchema).max(200).default([]),
178063
178919
  /** The pause between two steps of a source: the television's receiver, not a repeat. */
178064
178920
  stepDelayMs: number$1().int().min(100).max(REMOTE_STEP_DELAY_MAX_MS).default(500),
178065
- power: object({ mode: RemotePowerModeSchema }),
178066
178921
  /**
178067
178922
  * READ-ONLY: sources a stored configuration carries that no longer parse,
178068
178923
  * left out of `sources` with the reason (`readStoredRemoteConfig`). Never
@@ -178166,6 +179021,11 @@ var RemoteLayoutButtonSchema = object({
178166
179021
  /** Absent = the plain rendering every layout had before shapes existed. */
178167
179022
  shape: RemoteButtonShapeSchema.optional(),
178168
179023
  tone: RemoteButtonToneSchema.optional(),
179024
+ /**
179025
+ * Draw the label on a colour-toned key. A colour key shows only its colour
179026
+ * by default; a remote whose plastic prints letters on them (A B C D) sets it.
179027
+ */
179028
+ showLegend: boolean().optional(),
178169
179029
  /** The group this button belongs to; it must lie inside that group's rectangle. */
178170
179030
  groupId: string().min(1).max(40).optional()
178171
179031
  });
@@ -178303,7 +179163,6 @@ var RemoteBoundCommandSchema = object({
178303
179163
  });
178304
179164
  var RemoteCommandListSchema = object({
178305
179165
  layoutTemplateId: string().nullable(),
178306
- power: object({ mode: RemotePowerModeSchema }),
178307
179166
  /** Only the roles that are BOUND — the ones a press can reach. */
178308
179167
  commands: array(RemoteBoundCommandSchema),
178309
179168
  /** The sources the operator declared; empty when none (planning#460). */
@@ -178316,7 +179175,8 @@ var RemoteRefusalReasonSchema = _enum([
178316
179175
  "unknown-source",
178317
179176
  "unbound-step",
178318
179177
  "undeclared-channel",
178319
- "press-timeout"
179178
+ "press-timeout",
179179
+ "no-transmitter"
178320
179180
  ]);
178321
179181
  var RemoteSendResultSchema = discriminatedUnion("status", [
178322
179182
  object({
@@ -178409,7 +179269,8 @@ var RemoteComponentButtonSchema = object({
178409
179269
  icon: string().min(1).max(60).optional(),
178410
179270
  label: string().min(1).max(40).optional(),
178411
179271
  shape: RemoteButtonShapeSchema.optional(),
178412
- tone: RemoteButtonToneSchema.optional()
179272
+ tone: RemoteButtonToneSchema.optional(),
179273
+ showLegend: boolean().optional()
178413
179274
  });
178414
179275
  var RemoteLayoutComponentSchema = object({
178415
179276
  id: string().max(80).regex(COMPONENT_ID_RE, { message: "<namespace>:<name>, lowercase" }),
@@ -179608,6 +180469,11 @@ var SendEmailResultSchema = object({
179608
180469
  var SmtpStatusSchema = object({
179609
180470
  /** True iff the addon has successfully verified the relay. */
179610
180471
  ready: boolean(),
180472
+ /**
180473
+ * The tri-state behind `ready` (D315): true when the last send worked, false when it failed,
180474
+ * ABSENT when the relay has not sent yet (unknown, never "not verified").
180475
+ */
180476
+ verified: boolean().optional(),
179611
180477
  /** Operator-visible host string (no credentials). */
179612
180478
  host: string(),
179613
180479
  /** Last error message reported by the relay, when not ready. */
@@ -179619,10 +180485,6 @@ method(SendEmailInputSchema, SendEmailResultSchema, {
179619
180485
  kind: "mutation",
179620
180486
  auth: "admin",
179621
180487
  access: "create"
179622
- }), method(RelayPinSchema, SmtpStatusSchema, {
179623
- kind: "mutation",
179624
- auth: "admin",
179625
- access: "view"
179626
180488
  }), method(RelayPinSchema, SmtpStatusSchema, { auth: "admin" });
179627
180489
  /**
179628
180490
  * A single device snapshot returned as base64 JPEG/PNG.
@@ -182667,7 +183529,7 @@ var valveCapability = {
182667
183529
  kind: "mutation",
182668
183530
  auth: "protected"
182669
183531
  }),
182670
- setPosition: method(object({
183532
+ setPosition: optionalMethod(object({
182671
183533
  deviceId: number$1().int().nonnegative(),
182672
183534
  position: number$1().min(0).max(100)
182673
183535
  }), _void(), {
@@ -185221,7 +186083,6 @@ var DEVICE_LOCAL_STATE_CAPS = {
185221
186083
  control: controlCapability,
185222
186084
  cover: coverCapability,
185223
186085
  dayNight: dayNightCapability,
185224
- deviceDiscovery: deviceDiscoveryCapability,
185225
186086
  deviceStatus: deviceStatusCapability,
185226
186087
  dishwasher: dishwasherCapability,
185227
186088
  doNotDisturb: doNotDisturbCapability,
@@ -185236,6 +186097,7 @@ var DEVICE_LOCAL_STATE_CAPS = {
185236
186097
  groupCommands: groupCommandsCapability,
185237
186098
  groupStatus: groupStatusCapability,
185238
186099
  heatingValve: heatingValveCapability,
186100
+ heatPumpStatus: heatPumpStatusCapability,
185239
186101
  humidifier: humidifierCapability,
185240
186102
  humiditySensor: humiditySensorCapability,
185241
186103
  image: imageCapability,
@@ -186519,7 +187381,8 @@ var BaseDeviceProvider = class extends BaseAddon {
186519
187381
  return toDeviceSummary(device, this.addonId);
186520
187382
  }
186521
187383
  };
186522
- DeviceType.Cover, DeviceType.Valve, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.Camera, DeviceType.Hub, DeviceType.Switch, DeviceType.Siren, DeviceType.Light, DeviceType.Fan, DeviceType.Sensor, DeviceType.Thermostat, DeviceType.Climate, DeviceType.Button, DeviceType.EventEmitter, DeviceType.Update, DeviceType.Generic, DeviceType.Notifier, DeviceType.Script, DeviceType.Automation, DeviceType.Lock, DeviceType.MediaPlayer, DeviceType.AlarmPanel, DeviceType.Control, DeviceType.Presence, DeviceType.Weather, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.Container, DeviceType.Image, DeviceType.PetFeeder, DeviceType.PetFountain, DeviceType.Heater, DeviceType.Dishwasher, DeviceType.Washer, DeviceType.Dryer, DeviceType.Gateway;
187384
+ DeviceType.HeatPump;
187385
+ DeviceType.Cover, DeviceType.Valve, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.HeatPump, DeviceType.Camera, DeviceType.Hub, DeviceType.Switch, DeviceType.Siren, DeviceType.Light, DeviceType.Fan, DeviceType.Sensor, DeviceType.Thermostat, DeviceType.Climate, DeviceType.Button, DeviceType.EventEmitter, DeviceType.Update, DeviceType.Generic, DeviceType.Notifier, DeviceType.Script, DeviceType.Automation, DeviceType.Lock, DeviceType.MediaPlayer, DeviceType.AlarmPanel, DeviceType.Control, DeviceType.Presence, DeviceType.Weather, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.Container, DeviceType.Image, DeviceType.PetFeeder, DeviceType.PetFountain, DeviceType.Heater, DeviceType.Dishwasher, DeviceType.Washer, DeviceType.Dryer, DeviceType.Gateway;
186523
187386
  new Set(Object.values(DeviceType));
186524
187387
  /** Parses the raw slice with the cap's own schema; `undefined` when it does not parse. */
186525
187388
  function contribution(cap, schema, build) {
@@ -186655,6 +187518,13 @@ var lockContribution = contribution("lock-control", LockControlStatusSchema, (sl
186655
187518
  reading: reading("lock-control", words?.state ?? "unknown", false, words?.title),
186656
187519
  rows: [row$1("lock", state === "locked" || state === "locking" ? "lock" : "lock-open", joinText([title, since]), lockControls(state, ctx.features.includes(DeviceFeature.LockOpen)))],
186657
187520
  ...since === null || words === null ? {} : { facts: [fact("since", "clock", since, "muted")] },
187521
+ ...words === null ? {} : { tiles: { left: [{
187522
+ label: t("Door", "Porta"),
187523
+ value: title
187524
+ }, ...since === null ? [] : [{
187525
+ label: t("Since", "Da"),
187526
+ value: since
187527
+ }]] } },
186658
187528
  ...words?.door == null ? {} : { scene: { mode: words.door } }
186659
187529
  };
186660
187530
  });
@@ -186736,7 +187606,17 @@ var ACCESS_FAMILY_CONTRIBUTIONS = {
186736
187606
  return {
186737
187607
  reading: reading("alarm-panel", words?.state ?? "unknown", false, words?.title),
186738
187608
  rows: [row$1("alarm", state === "triggered" ? "shield-alert" : state === "disarmed" ? "shield-off" : "shield-check", joinText([words?.title ?? t("Unknown", "Sconosciuto"), since]), alarmControls(state, modes, slice?.requiresCode ?? false))],
186739
- ...since === null || words === null ? {} : { facts: [fact("since", "clock", since, state === "triggered" ? "danger" : "muted")] }
187609
+ ...since === null || words === null ? {} : { facts: [fact("since", "clock", since, state === "triggered" ? "danger" : "muted")] },
187610
+ ...words === null ? {} : { tiles: {
187611
+ left: [{
187612
+ label: t("Mode", "Modalità"),
187613
+ value: words.title
187614
+ }],
187615
+ ...since === null ? {} : { right: [{
187616
+ label: t("Since", "Da"),
187617
+ value: since
187618
+ }] }
187619
+ } }
186740
187620
  };
186741
187621
  }),
186742
187622
  "automation-control": contribution("automation-control", AutomationControlStatusSchema, (slice, ctx) => {
@@ -186800,7 +187680,7 @@ var ACCESS_FAMILY_CONTRIBUTIONS = {
186800
187680
  */
186801
187681
  var has$3 = (ctx, f) => ctx.features.includes(f);
186802
187682
  var unknownText = t("Unknown", "Sconosciuto");
186803
- var pct$1 = (n) => t(`${Math.round(n)}%`, `${Math.round(n)}%`);
187683
+ var pct$2 = (n) => t(`${Math.round(n)}%`, `${Math.round(n)}%`);
186804
187684
  var unit = (n) => Math.min(1, Math.max(0, n / 100));
186805
187685
  /** Battery as a fact, unless the device is also bound to the `battery` cap (it already says so). */
186806
187686
  function ownBattery(level, ctx) {
@@ -186862,7 +187742,7 @@ var fanContribution = contribution("fan-control", FanControlStatusSchema, (slice
186862
187742
  },
186863
187743
  valueArg: "direction"
186864
187744
  });
186865
- const speedText = speed === null ? null : pct$1(speed);
187745
+ const speedText = speed === null ? null : pct$2(speed);
186866
187746
  const preset = slice?.preset ?? "";
186867
187747
  const status = speed === null ? unknownText : joinText([speed === 0 ? t("Off", "Spento") : t(`Speed ${speed}%`, `Velocità ${speed}%`), preset === "" ? null : t(preset, preset)]);
186868
187748
  return {
@@ -186875,10 +187755,16 @@ var fanContribution = contribution("fan-control", FanControlStatusSchema, (slice
186875
187755
  }],
186876
187756
  ...speedText === null ? {} : {
186877
187757
  facts: [fact("speed", "fan", speedText, speed === 0 ? "muted" : "primary")],
186878
- tiles: { right: [{
186879
- label: t("Speed", "Velocità"),
186880
- value: speedText
186881
- }] },
187758
+ tiles: {
187759
+ ...slice?.oscillating == null ? {} : { left: [{
187760
+ label: t("Oscillation", "Oscilla"),
187761
+ value: slice.oscillating ? t("Yes", "Sì") : t("No", "No")
187762
+ }] },
187763
+ ...preset === "" ? {} : { right: [{
187764
+ label: t("Mode", "Modalità"),
187765
+ value: t(preset, preset)
187766
+ }] }
187767
+ },
186882
187768
  scene: { level: unit(speed ?? 0) }
186883
187769
  }
186884
187770
  };
@@ -186942,7 +187828,8 @@ var vacuumContribution = contribution("vacuum-control", VacuumControlStatusSchem
186942
187828
  const words = state === null ? null : VACUUM_WORDS[state];
186943
187829
  const title = state === "error" && slice?.errorLabel ? t(slice.errorLabel, slice.errorLabel) : words?.title;
186944
187830
  const controls = vacuumControls(state);
186945
- if (slice !== void 0 && slice.availableFanSpeeds.length > 0) controls.push({
187831
+ const suctionControls = [];
187832
+ if (slice !== void 0 && slice.availableFanSpeeds.length > 0) suctionControls.push({
186946
187833
  kind: "picker",
186947
187834
  id: "vacuum.suction",
186948
187835
  label: t("Suction", "Aspirazione"),
@@ -186957,22 +187844,31 @@ var vacuumContribution = contribution("vacuum-control", VacuumControlStatusSchem
186957
187844
  });
186958
187845
  if (state !== null) controls.push(vac("locate", "Locate", "Trova", "map-pin", "locate"));
186959
187846
  const progress = state === "cleaning" ? slice?.progress ?? null : null;
187847
+ const suction = slice?.fanSpeed == null || slice.fanSpeed === "" ? [] : [{
187848
+ label: t("Suction", "Aspirazione"),
187849
+ value: t(slice.fanSpeed, slice.fanSpeed)
187850
+ }];
187851
+ const suctionRows = suctionControls.length === 0 ? [] : [{
187852
+ id: "vacuum-suction",
187853
+ icon: "bot",
187854
+ status: null,
187855
+ controls: suctionControls
187856
+ }];
187857
+ const vacuumRows = [{
187858
+ id: "vacuum",
187859
+ icon: "bot",
187860
+ status: title ?? unknownText,
187861
+ controls
187862
+ }, ...suctionRows];
186960
187863
  return {
186961
187864
  reading: reading("vacuum-control", words?.state ?? "unknown", false, title),
186962
- rows: [{
186963
- id: "vacuum",
186964
- icon: "bot",
186965
- status: title ?? unknownText,
186966
- controls
186967
- }],
186968
- facts: [...ownBattery(slice?.batteryLevel ?? null, ctx), ...progress === null ? [] : [fact("progress", "activity", pct$1(progress), "primary")]],
186969
- ...progress === null ? {} : {
186970
- tiles: { right: [{
186971
- label: t("Progress", "Avanzamento"),
186972
- value: pct$1(progress)
186973
- }] },
186974
- scene: { level: unit(progress) }
186975
- }
187865
+ rows: vacuumRows,
187866
+ facts: [...ownBattery(slice?.batteryLevel ?? null, ctx), ...progress === null ? [] : [fact("progress", "activity", pct$2(progress), "primary")]],
187867
+ ...suction.length === 0 && progress === null ? {} : { tiles: { right: [...suction, ...progress === null ? [] : [{
187868
+ label: t("Progress", "Avanzamento"),
187869
+ value: pct$2(progress)
187870
+ }]] } },
187871
+ ...progress === null ? {} : { scene: { level: unit(progress) } }
186976
187872
  };
186977
187873
  });
186978
187874
  var MOWER_WORDS = {
@@ -187028,11 +187924,11 @@ var mowerContribution = contribution("lawn-mower-control", LawnMowerControlStatu
187028
187924
  status: title ?? unknownText,
187029
187925
  controls: mowerControls(activity)
187030
187926
  }],
187031
- facts: [...ownBattery(slice?.batteryLevel ?? null, ctx), ...progress === null ? [] : [fact("progress", "activity", pct$1(progress), "primary")]],
187927
+ facts: [...ownBattery(slice?.batteryLevel ?? null, ctx), ...progress === null ? [] : [fact("progress", "activity", pct$2(progress), "primary")]],
187032
187928
  ...progress === null ? {} : {
187033
187929
  tiles: { right: [{
187034
187930
  label: t("Progress", "Avanzamento"),
187035
- value: pct$1(progress)
187931
+ value: pct$2(progress)
187036
187932
  }] },
187037
187933
  scene: { level: unit(progress) }
187038
187934
  }
@@ -187103,10 +187999,13 @@ var feederContribution = contribution("pet-feeder", PetFeederStatusSchema, (slic
187103
187999
  ...last === null ? [] : [fact("last-run", "clock", t(`Last ${last} g`, `Ultimo ${last} g`))],
187104
188000
  ...ownBattery(slice?.powerSource === "battery" ? slice.batteryPower : null, ctx)
187105
188001
  ],
187106
- ...last === null ? {} : { tiles: { right: [{
188002
+ tiles: { left: [...slice?.foodLevel == null ? [] : [{
188003
+ label: t("Tank", "Serbatoio"),
188004
+ value: pct$2(slice.foodLevel)
188005
+ }], ...last === null ? [] : [{
187107
188006
  label: t("Last portion", "Ultima porzione"),
187108
188007
  value: t(`${last} g`, `${last} g`)
187109
- }] } }
188008
+ }]] }
187110
188009
  };
187111
188010
  });
187112
188011
  var fountainContribution = contribution("pet-fountain", PetFountainStatusSchema, (slice) => {
@@ -187134,10 +188033,13 @@ var fountainContribution = contribution("pet-fountain", PetFountainStatusSchema,
187134
188033
  }],
187135
188034
  ...level === null ? {} : {
187136
188035
  facts: [fact("level", "droplets", t(`Water ${Math.round(level)}%`, `Acqua ${Math.round(level)}%`), level <= 20 ? "warning" : "primary")],
187137
- tiles: { right: [{
188036
+ tiles: { left: [{
187138
188037
  label: t("Water", "Acqua"),
187139
- value: pct$1(level)
187140
- }] },
188038
+ value: pct$2(level)
188039
+ }, ...slice?.waterVolume == null ? [] : [{
188040
+ label: t("Volume", "Volume"),
188041
+ value: t(`${Math.round(slice.waterVolume)} ml`, `${Math.round(slice.waterVolume)} ml`)
188042
+ }]] },
187141
188043
  scene: { level: unit(level) }
187142
188044
  }
187143
188045
  };
@@ -187169,14 +188071,18 @@ var DEVICES_FAMILY_CONTRIBUTIONS = {
187169
188071
  * that does not parse reads `unknown`, never closed or off (D315/D393).
187170
188072
  */
187171
188073
  var has$2 = (ctx, f) => ctx.features.includes(f);
187172
- var pct = (n) => t(`${Math.round(n)}%`, `${Math.round(n)}%`);
188074
+ var pct$1 = (n) => t(`${Math.round(n)}%`, `${Math.round(n)}%`);
187173
188075
  var brightnessContribution = contribution("brightness", BrightnessStatusSchema, (slice) => {
187174
188076
  const level = slice?.level ?? null;
187175
188077
  return {
187176
188078
  ...level === null ? {} : { reading: reading("brightness", level > 0 ? "on" : "off") },
187177
188079
  ...level === null ? {} : {
187178
- facts: [fact("level", "sun-dim", pct(level), level > 0 ? "primary" : "muted")],
187179
- scene: { level: level / 100 }
188080
+ facts: [fact("level", "sun-dim", pct$1(level), level > 0 ? "primary" : "muted")],
188081
+ scene: { level: level / 100 },
188082
+ tiles: { left: [{
188083
+ label: t("Brightness", "Luminosità"),
188084
+ value: pct$1(level)
188085
+ }] }
187180
188086
  },
187181
188087
  rows: [row$1("brightness", "sun-dim", level === null ? null : t(`Brightness ${Math.round(level)}%`, `Luminosità ${Math.round(level)}%`), [{
187182
188088
  kind: "slider",
@@ -187385,12 +188291,16 @@ function travelFragment(s, state, position, tilt, ctx) {
187385
188291
  });
187386
188292
  return {
187387
188293
  reading: reading(s.source, words.state, false, words.title),
187388
- ...position === null ? {} : { facts: [fact("level", "arrow-up-down", pct(position))] },
188294
+ ...position === null ? {} : { facts: [fact("level", "arrow-up-down", pct$1(position))] },
188295
+ ...position === null ? {} : { tiles: { left: [{
188296
+ label: t("Opening", "Apertura"),
188297
+ value: pct$1(position)
188298
+ }] } },
187389
188299
  scene: {
187390
188300
  ...words.mode === null ? {} : { mode: words.mode },
187391
188301
  ...position === null ? {} : { level: position / 100 }
187392
188302
  },
187393
- rows: [row$1(s.rowId, "arrow-up-down", joinText([words.title, position !== null && state !== "open" ? pct(position) : null]), controls)]
188303
+ rows: [row$1(s.rowId, "arrow-up-down", joinText([words.title, position !== null && state !== "open" ? pct$1(position) : null]), controls)]
187394
188304
  };
187395
188305
  }
187396
188306
  var ACTUATORS_FAMILY_CONTRIBUTIONS = {
@@ -187468,10 +188378,10 @@ var ACTUATORS_FAMILY_CONTRIBUTIONS = {
187468
188378
  const now = slice.currentHumidity;
187469
188379
  return {
187470
188380
  reading: reading("humidifier", state, false, title),
187471
- ...now === null ? {} : { facts: [fact("level", "droplets", pct(now), "info")] },
188381
+ ...now === null ? {} : { facts: [fact("level", "droplets", pct$1(now), "info")] },
187472
188382
  ...slice.targetHumidity === null ? {} : { tiles: { right: [{
187473
188383
  label: t("Target", "Obiettivo"),
187474
- value: pct(slice.targetHumidity)
188384
+ value: pct$1(slice.targetHumidity)
187475
188385
  }] } },
187476
188386
  ...now === null ? {} : { scene: { level: now / 100 } },
187477
188387
  rows: [row$1("humidifier", "droplets", joinText([title, slice.mode === null ? null : t(slice.mode, slice.mode)]), controls)]
@@ -187719,17 +188629,16 @@ var weatherContribution = contribution("weather", WeatherStatusSchema, (slice, c
187719
188629
  });
187720
188630
  var updateContribution = contribution("update", UpdateStatusSchema, (slice) => {
187721
188631
  if (slice === void 0) return { reading: reading("update", "unknown") };
187722
- const { currentVersion, availableVersion, inProgress, updatable } = slice;
188632
+ const { currentVersion, availableVersion, inProgress } = slice;
187723
188633
  const pending = availableVersion !== null && availableVersion !== "" && availableVersion !== currentVersion;
187724
188634
  if (!pending && currentVersion === null && !inProgress) return { reading: reading("update", "unknown") };
187725
188635
  const state = inProgress ? "running" : pending ? "standby" : "idle";
187726
188636
  const title = inProgress ? t("Updating", "Aggiornamento in corso") : pending ? t("Update available", "Aggiornamento disponibile") : t("Up to date", "Aggiornato");
187727
188637
  const versions = currentVersion === null ? pending ? t(`${availableVersion}`, `${availableVersion}`) : null : pending ? t(`${currentVersion} → ${availableVersion}`, `${currentVersion} → ${availableVersion}`) : t(`Version ${currentVersion}`, `Versione ${currentVersion}`);
187728
- const install = pending && updatable && !inProgress ? [asAction(action("update.install", t("Install", "Installa"), "download", "update", "installUpdate", {}, "primary", "install"))] : [];
187729
188638
  return {
187730
188639
  reading: reading("update", state, false, title),
187731
188640
  facts: versions === null ? [] : [fact("reading", "download", versions, pending ? "warning" : "muted")],
187732
- rows: [row$1("update", "download", versions, install)]
188641
+ rows: [row$1("update", "download", versions, [])]
187733
188642
  };
187734
188643
  });
187735
188644
  var imageContribution = contribution("image", ImageStatusSchema, (slice, ctx) => {
@@ -187837,6 +188746,33 @@ var ON_MODE_PREFERENCE = [
187837
188746
  "heat",
187838
188747
  "cool"
187839
188748
  ];
188749
+ var FAN_LABEL = {
188750
+ auto: t("Auto", "Auto"),
188751
+ quiet: t("Quiet", "Silenziosa"),
188752
+ low: t("Low", "Bassa"),
188753
+ medium: t("Medium", "Media"),
188754
+ high: t("High", "Alta"),
188755
+ turbo: t("Turbo", "Turbo"),
188756
+ off: t("Off", "Spenta")
188757
+ };
188758
+ /** A readable label for a fan speed name; an unknown one is shown as the device reported it. */
188759
+ function fanLabelOf(fan) {
188760
+ return FAN_LABEL[fan] ?? t(fan, fan);
188761
+ }
188762
+ /** Short labels for a segmented control: one word each, so the segments stay on a line. */
188763
+ var MODE_SEGMENT_LABEL = {
188764
+ off: t("Off", "Spento"),
188765
+ heat: t("Heat", "Caldo"),
188766
+ cool: t("Cool", "Freddo"),
188767
+ auto: t("Auto", "Auto"),
188768
+ heat_cool: t("Heat/Cool", "Caldo/Freddo"),
188769
+ fan_only: t("Fan", "Vent."),
188770
+ dry: t("Dry", "Deum.")
188771
+ };
188772
+ /** The segment label of every available HVAC mode, keyed by the mode value. */
188773
+ function modeLabelsOf(modes) {
188774
+ return Object.fromEntries(modes.map((m) => [m, MODE_SEGMENT_LABEL[m]]));
188775
+ }
187840
188776
  /** 22 -> "22", 22.3 -> "22.3": a trailing zero is noise on a thermostat. */
187841
188777
  function formatDegrees(value) {
187842
188778
  return `${Number(value.toFixed(1))}°`;
@@ -187901,11 +188837,11 @@ function rangeFrom(min, max, step) {
187901
188837
  * contribute, types never do (D14). A slice that is absent or does not parse is
187902
188838
  * "not answered": the state reads unknown, no row is drawn (D315, D393).
187903
188839
  */
187904
- var same = (text) => t(text, text);
187905
- function tile(en, it, value) {
188840
+ var same$1 = (text) => t(text, text);
188841
+ function tile$1(en, it, value) {
187906
188842
  return {
187907
188843
  label: t(en, it),
187908
- value: same(value)
188844
+ value: same$1(value)
187909
188845
  };
187910
188846
  }
187911
188847
  function setpointSlider(id, cap, method, valueArg, value, range) {
@@ -187940,18 +188876,19 @@ var climateContribution = contribution("climate-control", ClimateControlStatusSc
187940
188876
  const status = climateStatusText(view);
187941
188877
  const facts = [];
187942
188878
  if (status !== null) facts.push(fact("climate", "thermometer", status));
187943
- if (view.humidity !== null) facts.push(fact("humidity", "droplets", same(`${Math.round(view.humidity)}%`)));
187944
- if (view.targetHumidity !== null) facts.push(fact("humidity", "droplets", same(`→ ${Math.round(view.targetHumidity)}%`)));
188879
+ if (view.humidity !== null) facts.push(fact("humidity", "droplets", same$1(`${Math.round(view.humidity)}%`)));
188880
+ if (view.targetHumidity !== null) facts.push(fact("humidity", "droplets", same$1(`→ ${Math.round(view.targetHumidity)}%`)));
187945
188881
  const left = [];
187946
188882
  const right = [];
187947
- if (view.measured !== null) left.push(tile("Indoor", "In casa", formatDegrees(view.measured)));
187948
- if (view.humidity !== null) left.push(tile("Humidity", "Umidità", `${Math.round(view.humidity)}%`));
188883
+ if (view.measured !== null) left.push(tile$1("Indoor", "In casa", formatDegrees(view.measured)));
188884
+ if (view.humidity !== null) left.push(tile$1("Humidity", "Umidità", `${Math.round(view.humidity)}%`));
187949
188885
  const modeControls = [{
187950
188886
  kind: "picker",
187951
188887
  id: "climate.mode",
187952
188888
  label: t("Mode", "Modalità"),
187953
188889
  current: view.mode,
187954
- options: [...view.availableModes],
188890
+ options: [...view.availableModes.filter((m) => m !== "off"), ...view.availableModes.filter((m) => m === "off")],
188891
+ optionLabels: modeLabelsOf(view.availableModes),
187955
188892
  call: {
187956
188893
  cap: "climate-control",
187957
188894
  method: "setMode",
@@ -187979,6 +188916,7 @@ var climateContribution = contribution("climate-control", ClimateControlStatusSc
187979
188916
  label: t("Fan", "Ventola"),
187980
188917
  current: slice.fanMode === "" ? null : slice.fanMode,
187981
188918
  options: [...slice.availableFanModes],
188919
+ optionLabels: Object.fromEntries(slice.availableFanModes.map((m) => [m, fanLabelOf(m)])),
187982
188920
  call: {
187983
188921
  cap: "climate-control",
187984
188922
  method: "setFanMode",
@@ -188004,14 +188942,15 @@ var climateContribution = contribution("climate-control", ClimateControlStatusSc
188004
188942
  if (fanControls.length > 0) rows.push({
188005
188943
  id: "climate-fan",
188006
188944
  icon: "fan",
188007
- status: slice.fanMode === "" ? null : same(slice.fanMode),
188945
+ status: slice.fanMode === "" ? null : same$1(slice.fanMode),
188008
188946
  controls: fanControls
188009
188947
  });
188010
- rows.push(...setpointRow(view.target === null ? null : same(formatDegrees(view.target)), view.range === null || view.target === null ? null : setpointSlider("climate.target", "climate-control", "setTarget", "target", view.target, view.range)));
188948
+ 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)));
188011
188949
  const sceneMode = view.sceneMode;
188012
188950
  return {
188013
188951
  reading: reading("climate-control", view.isOff ? "off" : "on"),
188014
188952
  title: view.modeLabel,
188953
+ ...view.isOff || slice.fanMode === "" ? {} : { caption: t(`${view.modeLabel.en} · fan ${fanLabelOf(slice.fanMode).en}`, `${view.modeLabel.it} · ventola ${fanLabelOf(slice.fanMode).it}`) },
188015
188954
  facts,
188016
188955
  ...left.length === 0 && right.length === 0 ? {} : { tiles: {
188017
188956
  left,
@@ -188038,7 +188977,7 @@ var WATER_ON_PREFERENCE = [
188038
188977
  "performance"
188039
188978
  ];
188040
188979
  function capitalised(word) {
188041
- return same(word.charAt(0).toUpperCase() + word.slice(1).replace(/_/g, " "));
188980
+ return same$1(word.charAt(0).toUpperCase() + word.slice(1).replace(/_/g, " "));
188042
188981
  }
188043
188982
  var waterHeaterContribution = contribution("water-heater", WaterHeaterStatusSchema, (slice) => {
188044
188983
  if (slice === void 0 || slice.operationMode === null) return { reading: reading("climate-control", "unknown") };
@@ -188075,13 +189014,13 @@ var waterHeaterContribution = contribution("water-heater", WaterHeaterStatusSche
188075
189014
  icon: "flame",
188076
189015
  status: label,
188077
189016
  controls: modeControls
188078
- }, ...setpointRow(slice.targetTemp === null ? null : same(formatDegrees(slice.targetTemp)), range === null || slice.targetTemp === null ? null : setpointSlider("water-heater.target", "water-heater", "setTargetTemp", "temp", slice.targetTemp, range))];
189017
+ }, ...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))];
188079
189018
  const level = levelWithin(slice.targetTemp, range);
188080
189019
  return {
188081
189020
  reading: reading("climate-control", isOff ? "off" : "on"),
188082
189021
  title: label,
188083
189022
  facts: status === null ? [] : [fact("climate", "flame", status)],
188084
- ...slice.currentTemp === null ? {} : { tiles: { left: [tile("Water", "Acqua", formatDegrees(slice.currentTemp))] } },
189023
+ ...slice.currentTemp === null ? {} : { tiles: { left: [tile$1("Water", "Acqua", formatDegrees(slice.currentTemp))] } },
188085
189024
  scene: {
188086
189025
  ...isOff ? {} : { mode: "heat" },
188087
189026
  ...level === null ? {} : { level }
@@ -188099,11 +189038,12 @@ var waterHeaterContribution = contribution("water-heater", WaterHeaterStatusSche
188099
189038
  var heatingValveContribution = contribution("heating-valve", HeatingValveStatusSchema, (slice) => {
188100
189039
  const position = slice?.position ?? null;
188101
189040
  if (position === null) return { reading: reading("sensor", "unknown") };
188102
- const text = same(`${Math.round(position)}%`);
189041
+ const text = same$1(`${Math.round(position)}%`);
188103
189042
  return {
188104
189043
  reading: reading("sensor", position > 0 ? "running" : "idle"),
188105
189044
  facts: [fact("valve", "gauge", t(`Valve ${text.en}`, `Valvola ${text.it}`))],
188106
- tiles: { right: [tile("Valve", "Valvola", text.en)] },
189045
+ tiles: { right: [tile$1("Valve", "Valvola", text.en)] },
189046
+ ...position > 0 ? { caption: t(`Heating · valve ${text.en}`, `Riscalda · valvola ${text.it}`) } : {},
188107
189047
  scene: { level: position / 100 }
188108
189048
  };
188109
189049
  });
@@ -188112,9 +189052,9 @@ function sensorFragment(value, id, icon, en, it, text) {
188112
189052
  if (value === null) return { reading: reading("sensor", "unknown") };
188113
189053
  return {
188114
189054
  reading: reading("sensor", "on"),
188115
- title: same(text),
188116
- facts: [fact(id, icon, same(text))],
188117
- tiles: { right: [tile(en, it, text)] }
189055
+ title: same$1(text),
189056
+ facts: [fact(id, icon, same$1(text))],
189057
+ tiles: { right: [tile$1(en, it, text)] }
188118
189058
  };
188119
189059
  }
188120
189060
  var temperatureContribution = contribution("temperature-sensor", TemperatureSensorStatusSchema, (slice) => sensorFragment(slice?.temperature ?? null, "temperature", "thermometer", "Temperature", "Temperatura", formatDegrees(slice?.temperature ?? 0)));
@@ -188169,8 +189109,8 @@ var CLIMATE_FAMILY_CONTRIBUTIONS = {
188169
189109
  return {
188170
189110
  reading: reading("sensor", "on"),
188171
189111
  ...slice.aqi === void 0 ? {} : { title: airQualityWord(slice.aqi) },
188172
- facts: parts.map((p) => fact("air-quality", "wind", same(`${p.label} ${p.value}`))),
188173
- tiles: { right: parts.slice(0, 2).map((p) => tile(p.label, p.label, p.value)) }
189112
+ facts: parts.map((p) => fact("air-quality", "wind", same$1(`${p.label} ${p.value}`))),
189113
+ tiles: { right: parts.slice(0, 2).map((p) => tile$1(p.label, p.label, p.value)) }
188174
189114
  };
188175
189115
  }),
188176
189116
  "carbon-monoxide": contribution("carbon-monoxide", CarbonMonoxideStatusSchema, (slice) => {
@@ -188185,15 +189125,270 @@ var CLIMATE_FAMILY_CONTRIBUTIONS = {
188185
189125
  "numeric-sensor": numericContribution,
188186
189126
  "enum-sensor": enumContribution
188187
189127
  };
189128
+ /**
189129
+ * The heat pump's contribution to a hero (D1026): the compressor scene, every
189130
+ * circuit as a row with its own label and icon, the powers as pills (the
189131
+ * instantaneous COP is "—" when it cannot be computed) and a "System" group with
189132
+ * one selector per mode. Values and their limits come from the slice, which the
189133
+ * gateway filled: a selector with no allowed value is not drawn, a missing
189134
+ * reading is never a 0 (D393).
189135
+ */
189136
+ var CAP = "heat-pump-control";
189137
+ var same = (text) => t(text, text);
189138
+ /** The words of the values the gateway names; a value not listed is drawn as the gateway wrote it. */
189139
+ var VALUE_LABELS = {
189140
+ off: t("Off", "Off"),
189141
+ on: t("On", "On"),
189142
+ auto: t("Auto", "Auto"),
189143
+ manual: t("Manual", "Manuale"),
189144
+ low: t("Low", "Bassa"),
189145
+ high: t("High", "Alta"),
189146
+ eco: t("Eco", "Eco"),
189147
+ heat: t("Heat", "Caldo"),
189148
+ cool: t("Cool", "Freddo"),
189149
+ heatCool: t("Heat/cool", "Caldo/freddo"),
189150
+ ownprogram: t("Programme", "Programma")
189151
+ };
189152
+ function valueLabel(value) {
189153
+ const known = VALUE_LABELS[value];
189154
+ if (known !== void 0) return known;
189155
+ const holiday = /^hm(\d+)$/.exec(value);
189156
+ if (holiday?.[1] !== void 0) return t(`Programme ${holiday[1]}`, `Programma ${holiday[1]}`);
189157
+ return same(value);
189158
+ }
189159
+ function optionLabels(allowed) {
189160
+ return Object.fromEntries(allowed.map((value) => [value, valueLabel(value)]));
189161
+ }
189162
+ function picker(id, label, setting, method, args, valueArg = "mode") {
189163
+ return {
189164
+ kind: "picker",
189165
+ id,
189166
+ label,
189167
+ current: setting.value,
189168
+ options: [...setting.allowed],
189169
+ optionLabels: optionLabels(setting.allowed),
189170
+ call: {
189171
+ cap: CAP,
189172
+ method,
189173
+ args: { ...args }
189174
+ },
189175
+ valueArg
189176
+ };
189177
+ }
189178
+ /** A selector exists only where the gateway named values to choose from. */
189179
+ function choosable(setting) {
189180
+ return setting !== null && setting.allowed.length > 0;
189181
+ }
189182
+ function circuitControl(circuit) {
189183
+ const args = { circuitId: circuit.id };
189184
+ if (circuit.kind === "dhw" && choosable(circuit.temperatureLevel)) return picker(`heat-pump.${circuit.id}.level`, t("Level", "Livello"), circuit.temperatureLevel, "setDhwTemperatureLevel", args, "level");
189185
+ if (!choosable(circuit.operationMode)) return null;
189186
+ const method = circuit.kind === "dhw" ? "setDhwOperationMode" : "setCircuitOperationMode";
189187
+ return picker(`heat-pump.${circuit.id}.mode`, t("Mode", "Modalità"), circuit.operationMode, method, args);
189188
+ }
189189
+ /** A circuit with no reading is still a row: it shows that nothing is known, not nothing. */
189190
+ var UNKNOWN_STATUS = same("—");
189191
+ function circuitRow(circuit) {
189192
+ const control = circuitControl(circuit);
189193
+ const status = thermalStatusText(circuit.targetTemp, circuit.currentTemp) ?? UNKNOWN_STATUS;
189194
+ return {
189195
+ id: "circuit",
189196
+ label: same(circuit.label),
189197
+ icon: circuit.icon,
189198
+ status,
189199
+ controls: control === null ? [] : [control]
189200
+ };
189201
+ }
189202
+ var kilowatts = (watts) => `${Number((watts / 1e3).toFixed(2))} kW`;
189203
+ /** A COP that cannot be computed is still the pill: "—", never an absent reading (D393). */
189204
+ function copPill(cop) {
189205
+ if (cop === null) return {
189206
+ icon: "gauge",
189207
+ text: t("Instantaneous COP —", "COP istantaneo —"),
189208
+ tone: "muted"
189209
+ };
189210
+ const text = String(Number(cop.toFixed(1)));
189211
+ return {
189212
+ icon: "gauge",
189213
+ text: t(`Instantaneous COP ${text}`, `COP istantaneo ${text}`),
189214
+ tone: "success"
189215
+ };
189216
+ }
189217
+ function powerPills(status) {
189218
+ const { thermalW, electricalW } = status.power;
189219
+ const pills = [];
189220
+ if (thermalW !== null) pills.push({
189221
+ icon: "flame",
189222
+ text: t(`Thermal ${kilowatts(thermalW)}`, `Termica ${kilowatts(thermalW)}`),
189223
+ tone: "muted"
189224
+ });
189225
+ if (electricalW !== null) pills.push({
189226
+ icon: "zap",
189227
+ text: t(`Electrical ${kilowatts(electricalW)}`, `Elettrica ${kilowatts(electricalW)}`),
189228
+ tone: "muted"
189229
+ });
189230
+ pills.push(copPill(heatPumpInstantCop(status.power)));
189231
+ return pills;
189232
+ }
189233
+ /** The independent system modes, in the order the card draws them. */
189234
+ var SYSTEM_MODES = [
189235
+ {
189236
+ key: "silent",
189237
+ label: t("Silent", "Silenzioso"),
189238
+ icon: "volume-x",
189239
+ method: "setSilentMode"
189240
+ },
189241
+ {
189242
+ key: "away",
189243
+ label: t("Away", "Assente"),
189244
+ icon: "plane",
189245
+ method: "setAwayMode"
189246
+ },
189247
+ {
189248
+ key: "additionalHeater",
189249
+ label: t("Additional heater", "Riscaldatore aggiuntivo"),
189250
+ icon: "flame",
189251
+ method: "setAdditionalHeaterMode"
189252
+ },
189253
+ {
189254
+ key: "holiday",
189255
+ label: t("Holiday", "Vacanza"),
189256
+ icon: "tree-palm",
189257
+ method: "setHolidayMode"
189258
+ }
189259
+ ];
189260
+ var SYSTEM_GROUP = t("System", "Sistema");
189261
+ var PROGRAMME = /^hm\d+$/;
189262
+ /**
189263
+ * Holiday is two segments, off / programme. Choosing "programme" keeps the programme
189264
+ * that is set, else the first one the gateway allowed, so a write never leaves
189265
+ * `allowed`. The full hm1..hm8 pick is not in the hero (D1026). A holiday whose values
189266
+ * are not programmes keeps the plain selector.
189267
+ */
189268
+ function holidayRow(def, setting) {
189269
+ if (!setting.allowed.includes("off")) return null;
189270
+ const current = setting.value !== null && PROGRAMME.test(setting.value) ? setting.value : null;
189271
+ const programme = current ?? setting.allowed.find((v) => PROGRAMME.test(v));
189272
+ if (programme === void 0) return null;
189273
+ const control = picker("heat-pump.system.holiday", def.label, {
189274
+ value: setting.value,
189275
+ allowed: ["off", programme]
189276
+ }, def.method, {});
189277
+ const number = programme.slice(2);
189278
+ return {
189279
+ id: "system-mode",
189280
+ label: def.label,
189281
+ group: SYSTEM_GROUP,
189282
+ icon: def.icon,
189283
+ status: current === null ? null : t(`Programme ${number}`, `Programma ${number}`),
189284
+ controls: [control.kind === "picker" ? {
189285
+ ...control,
189286
+ optionLabels: {
189287
+ off: t("Off", "Off"),
189288
+ [programme]: t("Programme", "Programma")
189289
+ }
189290
+ } : control]
189291
+ };
189292
+ }
189293
+ function systemRows(status) {
189294
+ const rows = [];
189295
+ for (const def of SYSTEM_MODES) {
189296
+ const setting = status.system[def.key];
189297
+ if (!choosable(setting)) continue;
189298
+ if (def.key === "holiday") {
189299
+ const holiday = holidayRow(def, setting);
189300
+ if (holiday !== null) {
189301
+ rows.push(holiday);
189302
+ continue;
189303
+ }
189304
+ }
189305
+ rows.push({
189306
+ id: "system-mode",
189307
+ label: def.label,
189308
+ group: SYSTEM_GROUP,
189309
+ icon: def.icon,
189310
+ status: null,
189311
+ controls: [picker(`heat-pump.system.${def.key}`, def.label, setting, def.method, {})]
189312
+ });
189313
+ }
189314
+ return rows;
189315
+ }
189316
+ function tile(en, it, value) {
189317
+ return {
189318
+ label: t(en, it),
189319
+ value: same(value)
189320
+ };
189321
+ }
189322
+ function tilesOf$1(status) {
189323
+ const { supply, return: back, outdoor } = status.temperatures;
189324
+ const left = [];
189325
+ const right = [];
189326
+ if (supply !== null) left.push(tile("Supply", "Mandata", formatDegrees(supply)));
189327
+ if (back !== null) left.push(tile("Return", "Ritorno", formatDegrees(back)));
189328
+ if (outdoor !== null) right.push(tile("Outdoor", "Esterna", formatDegrees(outdoor)));
189329
+ if (status.waterPressureBar !== null) right.push(tile("Pressure", "Pressione", `${Number(status.waterPressureBar.toFixed(1))} bar`));
189330
+ return {
189331
+ left,
189332
+ right
189333
+ };
189334
+ }
189335
+ function isRunning(status) {
189336
+ const { compressorPct, electricalW } = status.power;
189337
+ if (compressorPct !== null) return compressorPct > 0;
189338
+ if (electricalW !== null) return electricalW > 0;
189339
+ return null;
189340
+ }
189341
+ var HEAT_PUMP_FAMILY_CONTRIBUTIONS = { "heat-pump-status": contribution("heat-pump-status", HeatPumpStatusSchema, (slice) => {
189342
+ if (slice === void 0) return { reading: reading("climate-control", "unknown") };
189343
+ const running = isRunning(slice);
189344
+ const facts = [];
189345
+ if (slice.power.electricalW !== null) facts.push(fact("power", "zap", same(`${Math.round(slice.power.electricalW)} W`)));
189346
+ if (slice.power.compressorPct !== null) facts.push(fact("level", "gauge", t(`Compressor ${Math.round(slice.power.compressorPct)} %`, `Compressore ${Math.round(slice.power.compressorPct)} %`)));
189347
+ const charging = slice.circuits.find((c) => c.active === true);
189348
+ const tiles = tilesOf$1(slice);
189349
+ const pills = powerPills(slice);
189350
+ const rows = [
189351
+ ...slice.circuits.map(circuitRow),
189352
+ ...pills.length === 0 ? [] : [{
189353
+ id: "heat-pump-power",
189354
+ icon: "zap",
189355
+ status: null,
189356
+ controls: [],
189357
+ pills: [...pills]
189358
+ }],
189359
+ ...systemRows(slice)
189360
+ ];
189361
+ return {
189362
+ reading: reading("climate-control", running === true ? "running" : running === false ? "idle" : "on"),
189363
+ title: t("Heat pump", "Pompa di calore"),
189364
+ ...charging === void 0 ? {} : { caption: t(`${charging.label} · heating`.toUpperCase(), `${charging.label} · in riscaldamento`.toUpperCase()) },
189365
+ facts,
189366
+ ...tiles.left.length === 0 && tiles.right.length === 0 ? {} : { tiles },
189367
+ ...slice.power.electricalW === null ? {} : { consumption: {
189368
+ priority: 1,
189369
+ slot: {
189370
+ kind: "power",
189371
+ watts: slice.power.electricalW,
189372
+ detail: slice.power.thermalW === null ? [] : [{
189373
+ label: t("Thermal", "Termica"),
189374
+ value: Math.round(slice.power.thermalW),
189375
+ unit: "W"
189376
+ }]
189377
+ }
189378
+ } },
189379
+ rows
189380
+ };
189381
+ }) };
188188
189382
  [
188189
189383
  ...Object.values(ACCESS_FAMILY_CONTRIBUTIONS),
188190
189384
  ...Object.values(DEVICES_FAMILY_CONTRIBUTIONS),
188191
189385
  ...Object.values(GROUPS_FAMILY_CONTRIBUTIONS),
188192
189386
  ...Object.values(ACTUATORS_FAMILY_CONTRIBUTIONS),
188193
189387
  ...Object.values(SENSORS_FAMILY_CONTRIBUTIONS),
188194
- ...Object.values(CLIMATE_FAMILY_CONTRIBUTIONS)
189388
+ ...Object.values(CLIMATE_FAMILY_CONTRIBUTIONS),
189389
+ ...Object.values(HEAT_PUMP_FAMILY_CONTRIBUTIONS)
188195
189390
  ];
188196
- DeviceType.Camera, DeviceType.Hub, DeviceType.Light, DeviceType.Siren, DeviceType.Switch, DeviceType.Sensor, DeviceType.Thermostat, 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.Vacuum, DeviceType.LawnMower, DeviceType.Container, DeviceType.Image, DeviceType.PetFeeder, DeviceType.PetFountain, DeviceType.Dishwasher, DeviceType.Washer, DeviceType.Heater, DeviceType.Dryer, DeviceType.Gateway;
189391
+ DeviceType.Camera, DeviceType.Hub, DeviceType.Light, DeviceType.Siren, DeviceType.Switch, DeviceType.Sensor, DeviceType.Thermostat, 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.HeatPump, DeviceType.Fan, DeviceType.MediaPlayer, DeviceType.AlarmPanel, DeviceType.Control, DeviceType.Presence, DeviceType.Weather, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.Container, DeviceType.Image, DeviceType.PetFeeder, DeviceType.PetFountain, DeviceType.Dishwasher, DeviceType.Washer, DeviceType.Heater, DeviceType.Dryer, DeviceType.Gateway;
188197
189392
  /**
188198
189393
  * Who looks like what (D1023). One look per {@link DeviceType}, refined by a
188199
189394
  * {@link DeviceRole} where the role changes how the device reads (a leak
@@ -188583,7 +189778,7 @@ lookOf({
188583
189778
  ({ ...lookOf({
188584
189779
  icon: "shield-check",
188585
189780
  on: [
188586
- "success",
189781
+ "danger",
188587
189782
  "glow",
188588
189783
  "halo"
188589
189784
  ],
@@ -188821,8 +190016,24 @@ lookOf({
188821
190016
  idle: INFO,
188822
190017
  standby: MUTED
188823
190018
  });
190019
+ lookOf({
190020
+ icon: "thermometer-sun",
190021
+ on: [
190022
+ "warning",
190023
+ "heat-rise",
190024
+ "rise"
190025
+ ],
190026
+ off: MUTED,
190027
+ running: [
190028
+ "warning",
190029
+ "heat-rise",
190030
+ "rise"
190031
+ ],
190032
+ idle: INFO,
190033
+ standby: MUTED
190034
+ });
188824
190035
  DeviceType.Climate, DeviceType.Thermostat;
188825
- DeviceType.Camera, DeviceType.Hub, DeviceType.Light, DeviceType.Siren, DeviceType.Switch, DeviceType.Sensor, DeviceType.Thermostat, 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.Vacuum, DeviceType.LawnMower, DeviceType.Container, DeviceType.Image, DeviceType.PetFeeder, DeviceType.PetFountain, DeviceType.Dishwasher, DeviceType.Washer, DeviceType.Heater, DeviceType.Dryer, DeviceType.Gateway;
190036
+ DeviceType.Camera, DeviceType.Hub, DeviceType.Light, DeviceType.Siren, DeviceType.Switch, DeviceType.Sensor, DeviceType.Thermostat, 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.HeatPump, DeviceType.Fan, DeviceType.MediaPlayer, DeviceType.AlarmPanel, DeviceType.Control, DeviceType.Presence, DeviceType.Weather, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.Container, DeviceType.Image, DeviceType.PetFeeder, DeviceType.PetFountain, DeviceType.Dishwasher, DeviceType.Washer, DeviceType.Heater, DeviceType.Dryer, DeviceType.Gateway;
188826
190037
  DeviceRole.Siren, DeviceRole.Floodlight, DeviceRole.Spotlight, DeviceRole.PirSensor, DeviceRole.Chime, DeviceRole.Autotrack, DeviceRole.Nightvision, DeviceRole.PrivacyMask, DeviceRole.Doorbell, DeviceRole.CoverBlind, DeviceRole.CoverShutter, DeviceRole.CoverAwning, DeviceRole.CoverCurtain, DeviceRole.CoverGarage, DeviceRole.CoverGate, DeviceRole.CoverDoor, DeviceRole.CoverWindow, DeviceRole.BinaryHelper, DeviceRole.Outlet, DeviceRole.MotionSensor, DeviceRole.ContactSensor, DeviceRole.LeakSensor, DeviceRole.SmokeSensor, DeviceRole.COSensor, DeviceRole.GasSensor, DeviceRole.TamperSensor, DeviceRole.VibrationSensor, DeviceRole.ConnectivitySensor, DeviceRole.SoundSensor, DeviceRole.BinarySensor, DeviceRole.TemperatureSensor, DeviceRole.HumiditySensor, DeviceRole.AmbientLightSensor, DeviceRole.PressureSensor, DeviceRole.WindSensor, DeviceRole.RainSensor, DeviceRole.UvSensor, DeviceRole.SolarRadiationSensor, DeviceRole.SoilMoistureSensor, DeviceRole.PowerSensor, DeviceRole.EnergySensor, DeviceRole.VoltageSensor, DeviceRole.CurrentSensor, DeviceRole.AirQualitySensor, DeviceRole.BatterySensor, DeviceRole.NumericSensor, DeviceRole.EnumSensor, DeviceRole.DateTimeSensor, DeviceRole.GenericSensor, DeviceRole.NumericControl, DeviceRole.SelectControl, DeviceRole.TextControl, DeviceRole.DateTimeControl, DeviceRole.MobilePushNotifier, DeviceRole.MessagingNotifier, DeviceRole.EmailNotifier, DeviceRole.GenericNotifier, DeviceRole.IrTransmitter;
188827
190038
  Object.freeze({
188828
190039
  "accessories.getStatus": {
@@ -189203,13 +190414,6 @@ Object.freeze({
189203
190414
  access: "view",
189204
190415
  role: "admin"
189205
190416
  },
189206
- "addonSettings.getIntegrationFormSchema": {
189207
- capName: "addon-settings",
189208
- capScope: "system",
189209
- addonId: null,
189210
- access: "view",
189211
- role: "admin"
189212
- },
189213
190417
  "addonSettings.getScopedSettings": {
189214
190418
  capName: "addon-settings",
189215
190419
  capScope: "system",
@@ -190057,6 +191261,27 @@ Object.freeze({
190057
191261
  access: "create",
190058
191262
  role: "viewer"
190059
191263
  },
191264
+ "clusterUpdate.getClusterUpdateJob": {
191265
+ capName: "cluster-update",
191266
+ capScope: "system",
191267
+ addonId: null,
191268
+ access: "view",
191269
+ role: "admin"
191270
+ },
191271
+ "clusterUpdate.previewClusterUpdate": {
191272
+ capName: "cluster-update",
191273
+ capScope: "system",
191274
+ addonId: null,
191275
+ access: "view",
191276
+ role: "admin"
191277
+ },
191278
+ "clusterUpdate.startClusterUpdate": {
191279
+ capName: "cluster-update",
191280
+ capScope: "system",
191281
+ addonId: null,
191282
+ access: "create",
191283
+ role: "admin"
191284
+ },
190060
191285
  "color.getStatus": {
190061
191286
  capName: "color",
190062
191287
  capScope: "device",
@@ -190659,41 +191884,6 @@ Object.freeze({
190659
191884
  access: "create",
190660
191885
  role: "admin"
190661
191886
  },
190662
- "deviceDiscovery.adoptDevice": {
190663
- capName: "device-discovery",
190664
- capScope: "device",
190665
- addonId: null,
190666
- access: "create",
190667
- role: "admin"
190668
- },
190669
- "deviceDiscovery.getStatus": {
190670
- capName: "device-discovery",
190671
- capScope: "device",
190672
- addonId: null,
190673
- access: "view",
190674
- role: "viewer"
190675
- },
190676
- "deviceDiscovery.listDiscovered": {
190677
- capName: "device-discovery",
190678
- capScope: "device",
190679
- addonId: null,
190680
- access: "view",
190681
- role: "viewer"
190682
- },
190683
- "deviceDiscovery.refreshDiscovery": {
190684
- capName: "device-discovery",
190685
- capScope: "device",
190686
- addonId: null,
190687
- access: "create",
190688
- role: "admin"
190689
- },
190690
- "deviceDiscovery.releaseDevice": {
190691
- capName: "device-discovery",
190692
- capScope: "device",
190693
- addonId: null,
190694
- access: "create",
190695
- role: "admin"
190696
- },
190697
191887
  "deviceExport.applyDeviceSettingsPatch": {
190698
191888
  capName: "device-export",
190699
191889
  capScope: "system",
@@ -190995,6 +192185,13 @@ Object.freeze({
190995
192185
  access: "create",
190996
192186
  role: "admin"
190997
192187
  },
192188
+ "deviceManager.checkDeviceTemplates": {
192189
+ capName: "device-manager",
192190
+ capScope: "system",
192191
+ addonId: null,
192192
+ access: "view",
192193
+ role: "admin"
192194
+ },
190998
192195
  "deviceManager.cleanupDeletedDevicesData": {
190999
192196
  capName: "device-manager",
191000
192197
  capScope: "system",
@@ -191394,6 +192591,13 @@ Object.freeze({
191394
192591
  access: "create",
191395
192592
  role: "admin"
191396
192593
  },
192594
+ "deviceManager.renderDeviceTemplates": {
192595
+ capName: "device-manager",
192596
+ capScope: "system",
192597
+ addonId: null,
192598
+ access: "view",
192599
+ role: "admin"
192600
+ },
191397
192601
  "deviceManager.reportDiscoveryObservations": {
191398
192602
  capName: "device-manager",
191399
192603
  capScope: "system",
@@ -191415,6 +192619,13 @@ Object.freeze({
191415
192619
  access: "create",
191416
192620
  role: "admin"
191417
192621
  },
192622
+ "deviceManager.search": {
192623
+ capName: "device-manager",
192624
+ capScope: "system",
192625
+ addonId: null,
192626
+ access: "view",
192627
+ role: "viewer"
192628
+ },
191418
192629
  "deviceManager.setAlias": {
191419
192630
  capName: "device-manager",
191420
192631
  capScope: "system",
@@ -191506,6 +192717,13 @@ Object.freeze({
191506
192717
  access: "create",
191507
192718
  role: "admin"
191508
192719
  },
192720
+ "deviceManager.setPrimaryChildPreference": {
192721
+ capName: "device-manager",
192722
+ capScope: "system",
192723
+ addonId: null,
192724
+ access: "create",
192725
+ role: "admin"
192726
+ },
191509
192727
  "deviceManager.setRole": {
191510
192728
  capName: "device-manager",
191511
192729
  capScope: "system",
@@ -192325,6 +193543,111 @@ Object.freeze({
192325
193543
  access: "view",
192326
193544
  role: "viewer"
192327
193545
  },
193546
+ "heatPumpControl.setAdditionalHeaterMode": {
193547
+ capName: "heat-pump-control",
193548
+ capScope: "device",
193549
+ addonId: null,
193550
+ access: "create",
193551
+ role: "viewer"
193552
+ },
193553
+ "heatPumpControl.setAwayMode": {
193554
+ capName: "heat-pump-control",
193555
+ capScope: "device",
193556
+ addonId: null,
193557
+ access: "create",
193558
+ role: "viewer"
193559
+ },
193560
+ "heatPumpControl.setCircuitComfortSetpoint": {
193561
+ capName: "heat-pump-control",
193562
+ capScope: "device",
193563
+ addonId: null,
193564
+ access: "create",
193565
+ role: "viewer"
193566
+ },
193567
+ "heatPumpControl.setCircuitEcoSetpoint": {
193568
+ capName: "heat-pump-control",
193569
+ capScope: "device",
193570
+ addonId: null,
193571
+ access: "create",
193572
+ role: "viewer"
193573
+ },
193574
+ "heatPumpControl.setCircuitHeatCoolMode": {
193575
+ capName: "heat-pump-control",
193576
+ capScope: "device",
193577
+ addonId: null,
193578
+ access: "create",
193579
+ role: "viewer"
193580
+ },
193581
+ "heatPumpControl.setCircuitMaxFlowTemp": {
193582
+ capName: "heat-pump-control",
193583
+ capScope: "device",
193584
+ addonId: null,
193585
+ access: "create",
193586
+ role: "viewer"
193587
+ },
193588
+ "heatPumpControl.setCircuitOperationMode": {
193589
+ capName: "heat-pump-control",
193590
+ capScope: "device",
193591
+ addonId: null,
193592
+ access: "create",
193593
+ role: "viewer"
193594
+ },
193595
+ "heatPumpControl.setCircuitSummerWinter": {
193596
+ capName: "heat-pump-control",
193597
+ capScope: "device",
193598
+ addonId: null,
193599
+ access: "create",
193600
+ role: "viewer"
193601
+ },
193602
+ "heatPumpControl.setDhwChargeDuration": {
193603
+ capName: "heat-pump-control",
193604
+ capScope: "device",
193605
+ addonId: null,
193606
+ access: "create",
193607
+ role: "viewer"
193608
+ },
193609
+ "heatPumpControl.setDhwOperationMode": {
193610
+ capName: "heat-pump-control",
193611
+ capScope: "device",
193612
+ addonId: null,
193613
+ access: "create",
193614
+ role: "viewer"
193615
+ },
193616
+ "heatPumpControl.setDhwTemperatureLevel": {
193617
+ capName: "heat-pump-control",
193618
+ capScope: "device",
193619
+ addonId: null,
193620
+ access: "create",
193621
+ role: "viewer"
193622
+ },
193623
+ "heatPumpControl.setHolidayMode": {
193624
+ capName: "heat-pump-control",
193625
+ capScope: "device",
193626
+ addonId: null,
193627
+ access: "create",
193628
+ role: "viewer"
193629
+ },
193630
+ "heatPumpControl.setSilentMode": {
193631
+ capName: "heat-pump-control",
193632
+ capScope: "device",
193633
+ addonId: null,
193634
+ access: "create",
193635
+ role: "viewer"
193636
+ },
193637
+ "heatPumpControl.startExtraHotWater": {
193638
+ capName: "heat-pump-control",
193639
+ capScope: "device",
193640
+ addonId: null,
193641
+ access: "create",
193642
+ role: "viewer"
193643
+ },
193644
+ "heatPumpStatus.getStatus": {
193645
+ capName: "heat-pump-status",
193646
+ capScope: "device",
193647
+ addonId: null,
193648
+ access: "view",
193649
+ role: "viewer"
193650
+ },
192328
193651
  "heroLayout.getHeroModel": {
192329
193652
  capName: "hero-layout",
192330
193653
  capScope: "system",
@@ -194082,13 +195405,6 @@ Object.freeze({
194082
195405
  access: "create",
194083
195406
  role: "admin"
194084
195407
  },
194085
- "notificationRules.createSequence": {
194086
- capName: "notification-rules",
194087
- capScope: "system",
194088
- addonId: null,
194089
- access: "create",
194090
- role: "admin"
194091
- },
194092
195408
  "notificationRules.createSnooze": {
194093
195409
  capName: "notification-rules",
194094
195410
  capScope: "system",
@@ -194110,13 +195426,6 @@ Object.freeze({
194110
195426
  access: "delete",
194111
195427
  role: "admin"
194112
195428
  },
194113
- "notificationRules.deleteSequence": {
194114
- capName: "notification-rules",
194115
- capScope: "system",
194116
- addonId: null,
194117
- access: "delete",
194118
- role: "admin"
194119
- },
194120
195429
  "notificationRules.getAlarmConfig": {
194121
195430
  capName: "notification-rules",
194122
195431
  capScope: "system",
@@ -194166,13 +195475,6 @@ Object.freeze({
194166
195475
  access: "view",
194167
195476
  role: "admin"
194168
195477
  },
194169
- "notificationRules.getSequence": {
194170
- capName: "notification-rules",
194171
- capScope: "system",
194172
- addonId: null,
194173
- access: "view",
194174
- role: "admin"
194175
- },
194176
195478
  "notificationRules.getTemplateCatalog": {
194177
195479
  capName: "notification-rules",
194178
195480
  capScope: "system",
@@ -194194,13 +195496,6 @@ Object.freeze({
194194
195496
  access: "view",
194195
195497
  role: "admin"
194196
195498
  },
194197
- "notificationRules.listSequences": {
194198
- capName: "notification-rules",
194199
- capScope: "system",
194200
- addonId: null,
194201
- access: "view",
194202
- role: "admin"
194203
- },
194204
195499
  "notificationRules.listSnoozes": {
194205
195500
  capName: "notification-rules",
194206
195501
  capScope: "system",
@@ -194271,13 +195566,6 @@ Object.freeze({
194271
195566
  access: "create",
194272
195567
  role: "admin"
194273
195568
  },
194274
- "notificationRules.updateSequence": {
194275
- capName: "notification-rules",
194276
- capScope: "system",
194277
- addonId: null,
194278
- access: "create",
194279
- role: "admin"
194280
- },
194281
195569
  "notifier.cancel": {
194282
195570
  capName: "notifier",
194283
195571
  capScope: "device",
@@ -194362,21 +195650,21 @@ Object.freeze({
194362
195650
  access: "view",
194363
195651
  role: "admin"
194364
195652
  },
194365
- "osdManager.getSourceCatalog": {
195653
+ "osdManager.listTemplates": {
194366
195654
  capName: "osd-manager",
194367
195655
  capScope: "system",
194368
195656
  addonId: null,
194369
195657
  access: "view",
194370
195658
  role: "admin"
194371
195659
  },
194372
- "osdManager.listTemplates": {
195660
+ "osdManager.previewSlot": {
194373
195661
  capName: "osd-manager",
194374
195662
  capScope: "system",
194375
195663
  addonId: null,
194376
- access: "view",
195664
+ access: "create",
194377
195665
  role: "admin"
194378
195666
  },
194379
- "osdManager.previewSlot": {
195667
+ "osdManager.previewTemplate": {
194380
195668
  capName: "osd-manager",
194381
195669
  capScope: "system",
194382
195670
  addonId: null,
@@ -196075,28 +197363,28 @@ Object.freeze({
196075
197363
  capScope: "device",
196076
197364
  addonId: null,
196077
197365
  access: "create",
196078
- role: "admin"
197366
+ role: "viewer"
196079
197367
  },
196080
197368
  "powerSource.getStatus": {
196081
197369
  capName: "power-source",
196082
197370
  capScope: "device",
196083
197371
  addonId: null,
196084
197372
  access: "view",
196085
- role: "admin"
197373
+ role: "viewer"
196086
197374
  },
196087
197375
  "powerSource.powerOff": {
196088
197376
  capName: "power-source",
196089
197377
  capScope: "device",
196090
197378
  addonId: null,
196091
197379
  access: "create",
196092
- role: "admin"
197380
+ role: "viewer"
196093
197381
  },
196094
197382
  "powerSource.powerOn": {
196095
197383
  capName: "power-source",
196096
197384
  capScope: "device",
196097
197385
  addonId: null,
196098
197386
  access: "create",
196099
- role: "admin"
197387
+ role: "viewer"
196100
197388
  },
196101
197389
  "presence.getStatus": {
196102
197390
  capName: "presence",
@@ -197232,13 +198520,6 @@ Object.freeze({
197232
198520
  access: "create",
197233
198521
  role: "admin"
197234
198522
  },
197235
- "smtpProvider.verify": {
197236
- capName: "smtp-provider",
197237
- capScope: "system",
197238
- addonId: null,
197239
- access: "view",
197240
- role: "admin"
197241
- },
197242
198523
  "snapshot.applyDeviceSettingsPatch": {
197243
198524
  capName: "snapshot",
197244
198525
  capScope: "device",
@@ -199171,8 +200452,26 @@ function projectAction(cap, action) {
199171
200452
  };
199172
200453
  }
199173
200454
  Object.entries(CAP_VOCABULARY_BY_NAME).flatMap(([cap, entry]) => entry.scope === "device" ? (entry.actions ?? []).map((a) => projectAction(cap, a)) : []);
199174
- DeviceType.Camera, DeviceType.Hub, DeviceType.Light, DeviceType.Siren, DeviceType.Switch, DeviceType.Sensor, DeviceType.Thermostat, 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.Vacuum, DeviceType.LawnMower, DeviceType.Container, DeviceType.Image, DeviceType.PetFeeder, DeviceType.PetFountain, DeviceType.Heater, DeviceType.Dishwasher, DeviceType.Washer, DeviceType.Dryer, DeviceType.Gateway;
200455
+ DeviceType.Camera, DeviceType.Hub, DeviceType.Light, DeviceType.Siren, DeviceType.Switch, DeviceType.Sensor, DeviceType.Thermostat, 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.HeatPump, DeviceType.Fan, DeviceType.MediaPlayer, DeviceType.AlarmPanel, DeviceType.Control, DeviceType.Presence, DeviceType.Weather, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.Container, DeviceType.Image, DeviceType.PetFeeder, DeviceType.PetFountain, DeviceType.Heater, DeviceType.Dishwasher, DeviceType.Washer, DeviceType.Dryer, DeviceType.Gateway;
199175
200456
  DeviceFeature.BatteryOperated;
200457
+ function bound(cap, methods = [], authority = "reported") {
200458
+ return {
200459
+ kind: "cap",
200460
+ cap,
200461
+ methods,
200462
+ authority
200463
+ };
200464
+ }
200465
+ function derived(cap, methods = []) {
200466
+ return bound(cap, methods, "derived");
200467
+ }
200468
+ DeviceFeature.BatteryOperated, DeviceFeature.Rebootable, derived("reboot", ["reboot"]), DeviceFeature.Resyncable, DeviceFeature.NativeSnapshot, DeviceFeature.DoorbellButton, derived("doorbell"), DeviceFeature.TwoWayAudio, derived("intercom", [
200469
+ "startTalkSession",
200470
+ "pushTalkAudio",
200471
+ "endTalkSession"
200472
+ ]), 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.LockPinRequired, 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.AlarmPinRequired, DeviceFeature.PresenceGps, DeviceFeature.NotifierImage, DeviceFeature.NotifierPriority, DeviceFeature.NotifierData, DeviceFeature.NotifierActions, DeviceFeature.NotifierRecipients, DeviceFeature.ScriptVariables, DeviceFeature.AutomationSkipCondition, DeviceFeature.VacuumHasMap, DeviceFeature.VacuumHasAi, DeviceFeature.MowerHasMap, DeviceFeature.MowerHasTargetedMowing, DeviceFeature.Navigation, derived("navigation"), DeviceFeature.NetworkLink, derived("network-link");
200473
+ var ALL_FEATURES = Object.values(DeviceFeature);
200474
+ new Set(ALL_FEATURES);
199176
200475
  DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher;
199177
200476
  var HA_AS = "a power sensor (device_class power). Home Assistant has no laundry domain. running-state stays unexported until a null reading can be published as unavailable.";
199178
200477
  var HOMEKIT_REASON = "HomeKit has no laundry-appliance service. The export tab would pair an accessory with nothing on it: running-state is withheld until a null reading can be unavailable, and power is not a HomeKit service this export honours.";
@@ -199364,7 +200663,6 @@ function createRuntimeStateBridge(params) {
199364
200663
  getStatus
199365
200664
  };
199366
200665
  }
199367
- string().min(1).max(4096);
199368
200666
  Object.freeze({
199369
200667
  "accessories.getStatus": [{
199370
200668
  name: "deviceId",
@@ -199795,35 +201093,6 @@ Object.freeze({
199795
201093
  form: "single",
199796
201094
  optional: false
199797
201095
  }],
199798
- "deviceDiscovery.adoptDevice": [{
199799
- name: "deviceId",
199800
- form: "single",
199801
- optional: false
199802
- }],
199803
- "deviceDiscovery.getStatus": [{
199804
- name: "deviceId",
199805
- form: "single",
199806
- optional: false
199807
- }],
199808
- "deviceDiscovery.listDiscovered": [{
199809
- name: "deviceId",
199810
- form: "single",
199811
- optional: false
199812
- }],
199813
- "deviceDiscovery.refreshDiscovery": [{
199814
- name: "deviceId",
199815
- form: "single",
199816
- optional: false
199817
- }],
199818
- "deviceDiscovery.releaseDevice": [{
199819
- name: "childDeviceId",
199820
- form: "single",
199821
- optional: false
199822
- }, {
199823
- name: "deviceId",
199824
- form: "single",
199825
- optional: false
199826
- }],
199827
201096
  "deviceExport.applyDeviceSettingsPatch": [{
199828
201097
  name: "deviceId",
199829
201098
  form: "single",
@@ -200102,6 +201371,11 @@ Object.freeze({
200102
201371
  form: "single",
200103
201372
  optional: false
200104
201373
  }],
201374
+ "deviceManager.setPrimaryChildPreference": [{
201375
+ name: "deviceId",
201376
+ form: "single",
201377
+ optional: false
201378
+ }],
200105
201379
  "deviceManager.setRole": [{
200106
201380
  name: "deviceId",
200107
201381
  form: "single",
@@ -200447,6 +201721,81 @@ Object.freeze({
200447
201721
  form: "single",
200448
201722
  optional: false
200449
201723
  }],
201724
+ "heatPumpControl.setAdditionalHeaterMode": [{
201725
+ name: "deviceId",
201726
+ form: "single",
201727
+ optional: false
201728
+ }],
201729
+ "heatPumpControl.setAwayMode": [{
201730
+ name: "deviceId",
201731
+ form: "single",
201732
+ optional: false
201733
+ }],
201734
+ "heatPumpControl.setCircuitComfortSetpoint": [{
201735
+ name: "deviceId",
201736
+ form: "single",
201737
+ optional: false
201738
+ }],
201739
+ "heatPumpControl.setCircuitEcoSetpoint": [{
201740
+ name: "deviceId",
201741
+ form: "single",
201742
+ optional: false
201743
+ }],
201744
+ "heatPumpControl.setCircuitHeatCoolMode": [{
201745
+ name: "deviceId",
201746
+ form: "single",
201747
+ optional: false
201748
+ }],
201749
+ "heatPumpControl.setCircuitMaxFlowTemp": [{
201750
+ name: "deviceId",
201751
+ form: "single",
201752
+ optional: false
201753
+ }],
201754
+ "heatPumpControl.setCircuitOperationMode": [{
201755
+ name: "deviceId",
201756
+ form: "single",
201757
+ optional: false
201758
+ }],
201759
+ "heatPumpControl.setCircuitSummerWinter": [{
201760
+ name: "deviceId",
201761
+ form: "single",
201762
+ optional: false
201763
+ }],
201764
+ "heatPumpControl.setDhwChargeDuration": [{
201765
+ name: "deviceId",
201766
+ form: "single",
201767
+ optional: false
201768
+ }],
201769
+ "heatPumpControl.setDhwOperationMode": [{
201770
+ name: "deviceId",
201771
+ form: "single",
201772
+ optional: false
201773
+ }],
201774
+ "heatPumpControl.setDhwTemperatureLevel": [{
201775
+ name: "deviceId",
201776
+ form: "single",
201777
+ optional: false
201778
+ }],
201779
+ "heatPumpControl.setHolidayMode": [{
201780
+ name: "deviceId",
201781
+ form: "single",
201782
+ optional: false
201783
+ }],
201784
+ "heatPumpControl.setSilentMode": [{
201785
+ name: "deviceId",
201786
+ form: "single",
201787
+ optional: false
201788
+ }],
201789
+ "heatPumpControl.startExtraHotWater": [{
201790
+ name: "deviceId",
201791
+ form: "single",
201792
+ optional: false
201793
+ }],
201794
+ "heatPumpStatus.getStatus": [{
201795
+ name: "deviceId",
201796
+ form: "single",
201797
+ optional: false
201798
+ }],
200450
201799
  "heroLayout.getHeroModel": [{
200451
201800
  name: "deviceId",
200452
201801
  form: "single",
@@ -200906,12 +202255,12 @@ Object.freeze({
200906
202255
  form: "single",
200907
202256
  optional: false
200908
202257
  }],
200909
- "osdManager.getSourceCatalog": [{
202258
+ "osdManager.previewSlot": [{
200910
202259
  name: "deviceId",
200911
202260
  form: "single",
200912
202261
  optional: false
200913
202262
  }],
200914
- "osdManager.previewSlot": [{
202263
+ "osdManager.previewTemplate": [{
200915
202264
  name: "deviceId",
200916
202265
  form: "single",
200917
202266
  optional: false
@@ -203495,7 +204844,9 @@ var TimelapseRuleInputSchema = object({
203495
204844
  /** Classes the notification counts — see {@link ReportClassesField}. */
203496
204845
  reportClasses: ReportClassesField.optional(),
203497
204846
  /** Canonical notification priority ordinal (1..5); per-target overridable. */
203498
- priority: PriorityField.default(3)
204847
+ priority: PriorityField.default(3),
204848
+ /** Per-target settings keyed by target id (D1032) — absent = every target follows the rule. */
204849
+ targetOverrides: NcTargetOverridesSchema.optional()
203499
204850
  });
203500
204851
  object({
203501
204852
  name: NameField.optional(),
@@ -203511,7 +204862,9 @@ object({
203511
204862
  previewText: PreviewTextField.optional(),
203512
204863
  previewMode: PreviewModeField.optional(),
203513
204864
  reportClasses: ReportClassesField.optional(),
203514
- priority: PriorityField.optional()
204865
+ priority: PriorityField.optional(),
204866
+ /** Per-target settings keyed by target id (D1032) — absent = every target follows the rule. */
204867
+ targetOverrides: NcTargetOverridesSchema.optional()
203515
204868
  });
203516
204869
  TimelapseRuleInputSchema.extend({
203517
204870
  id: string(),
@@ -211869,6 +213222,19 @@ var HUB_DISCOVERY_REFRESH_TIMEOUT_MS = 8e3;
211869
213222
  var HUB_CHILD_SLEEP_RECONCILE_MS = 6e4;
211870
213223
  var HUB_RECONNECT_BASE_MS = 2e3;
211871
213224
  var HUB_RECONNECT_MAX_MS = 3e4;
213225
+ /**
213226
+ * Threshold for marking an adopted child offline when missing from consecutive refreshes.
213227
+ * 10 minutes covers ~3 default refresh cycles + transient firmware latency without
213228
+ * false-flagging battery cams that take a few cycles to wake into the list.
213229
+ */
213230
+ var HUB_MISSING_OFFLINE_MS = 10 * 6e4;
213231
+ /**
213232
+ * Longer grace for a child flagged asleep that drops off a non-empty hub list. A sleeping battery
213233
+ * camera may vanish from the summary for hours, but `battery.sleeping` is a persisted slice: a
213234
+ * camera that died or was unplugged while flagged asleep must still go offline eventually.
213235
+ * Measured from the last time the hub actually LISTED the child.
213236
+ */
213237
+ var SLEEPING_MISSING_OFFLINE_MS = 360 * 6e4;
211872
213238
  var UNROUTED_LOG_THROTTLE_MS = 6e4;
211873
213239
  /**
211874
213240
  * ONE Reolink NVR / Home Hub: a single Baichuan control + event socket fronting N channels,
@@ -211901,6 +213267,10 @@ var ReolinkHubSession = class {
211901
213267
  #refreshInFlight = null;
211902
213268
  /** Wall-clock ms of the last refresh that listed each child (by device id). */
211903
213269
  #childLastSeenAt = /* @__PURE__ */ new Map();
213270
+ /** The empty-list warning fired and the list has not been non-empty since. */
213271
+ #emptyListWarned = false;
213272
+ /** Children THIS session marked offline for being missing from the list (the only ones it may restore). */
213273
+ #offlineByMissing = /* @__PURE__ */ new Set();
211904
213274
  /** Channels the last good refresh listed but nobody adopted: their pushes are expected drops. */
211905
213275
  #knownUnadoptedChannels = /* @__PURE__ */ new Set();
211906
213276
  #unroutedLoggedAt = /* @__PURE__ */ new Map();
@@ -212199,13 +213569,25 @@ var ReolinkHubSession = class {
212199
213569
  */
212200
213570
  reconcileChildOnline(channels) {
212201
213571
  const now = this.#now();
213572
+ const cameras = this.#deps.children().filter((c) => c.channel !== void 0 && c.type === DeviceType.Camera);
213573
+ if (channels.length === 0 && cameras.length > 0) {
213574
+ if (!this.#emptyListWarned) {
213575
+ this.#emptyListWarned = true;
213576
+ this.#logger.warn("Reolink hub: channel list came back empty with adopted children — online state left unchanged", {
213577
+ tags: { integrationId: this.integrationId },
213578
+ meta: { adopted: cameras.length }
213579
+ });
213580
+ }
213581
+ return;
213582
+ }
213583
+ if (channels.length > 0) this.#emptyListWarned = false;
212202
213584
  const listed = new Set(channels.map((c) => c.channel));
212203
- for (const child of this.#deps.children()) {
213585
+ for (const child of cameras) {
212204
213586
  const ch = child.channel;
212205
213587
  if (ch === void 0) continue;
212206
- if (child.type !== DeviceType.Camera) continue;
212207
213588
  if (listed.has(ch)) {
212208
213589
  this.#childLastSeenAt.set(child.id, now);
213590
+ this.#offlineByMissing.delete(child.id);
212209
213591
  if (!child.online) {
212210
213592
  child.markOnline(true);
212211
213593
  this.#logger.info("Reolink hub: adopted child back online", {
@@ -212218,10 +213600,28 @@ var ReolinkHubSession = class {
212218
213600
  }
212219
213601
  continue;
212220
213602
  }
212221
- const lastSeen = this.#childLastSeenAt.get(child.id) ?? 0;
212222
- const missingMs = lastSeen > 0 ? now - lastSeen : Number.POSITIVE_INFINITY;
212223
- if (missingMs >= 6e5 && child.online) {
213603
+ let lastSeen = this.#childLastSeenAt.get(child.id);
213604
+ if (lastSeen === void 0) {
213605
+ lastSeen = now;
213606
+ this.#childLastSeenAt.set(child.id, now);
213607
+ }
213608
+ if (child.sleeping && !child.online && this.#offlineByMissing.has(child.id) && now - lastSeen < 216e5) {
213609
+ this.#offlineByMissing.delete(child.id);
213610
+ child.markOnline(true);
213611
+ this.#logger.info("Reolink hub: sleeping child restored to online", {
213612
+ tags: {
213613
+ deviceId: child.id,
213614
+ deviceName: child.name
213615
+ },
213616
+ meta: { channel: ch }
213617
+ });
213618
+ continue;
213619
+ }
213620
+ const graceMs = child.sleeping ? SLEEPING_MISSING_OFFLINE_MS : HUB_MISSING_OFFLINE_MS;
213621
+ const missingMs = now - lastSeen;
213622
+ if (missingMs >= graceMs && child.online) {
212224
213623
  child.markOnline(false);
213624
+ this.#offlineByMissing.add(child.id);
212225
213625
  this.#logger.warn("Reolink hub: adopted child marked offline (missing from the hub list)", {
212226
213626
  tags: {
212227
213627
  deviceId: child.id,
@@ -216343,6 +217743,9 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
216343
217743
  get online() {
216344
217744
  return camera.online;
216345
217745
  },
217746
+ get sleeping() {
217747
+ return camera.sleeping;
217748
+ },
216346
217749
  get debugGeneral() {
216347
217750
  return camera.config.get("debugGeneral") === true;
216348
217751
  },