@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.mjs CHANGED
@@ -101490,7 +101490,7 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
101490
101490
  return EventCategory;
101491
101491
  }({});
101492
101492
  //#endregion
101493
- //#region ../types/dist/device-type-CbDhVwFP.mjs
101493
+ //#region ../types/dist/composed-stable-id-DFNyOFzz.mjs
101494
101494
  /**
101495
101495
  import { errMsg } from '@camstack/types'
101496
101496
  * Extract a human-readable message from an unknown error value.
@@ -101503,6 +101503,7 @@ function errMsg$3(err) {
101503
101503
  }
101504
101504
  var DeviceType = /* @__PURE__ */ function(DeviceType) {
101505
101505
  DeviceType["Camera"] = "camera";
101506
+ /** Legacy stored value, read only by the hub-to-integration migrations; no live device carries it. */
101506
101507
  DeviceType["Hub"] = "hub";
101507
101508
  DeviceType["Light"] = "light";
101508
101509
  DeviceType["Siren"] = "siren";
@@ -101616,6 +101617,10 @@ var DeviceType = /* @__PURE__ */ function(DeviceType) {
101616
101617
  * (`reboot`, `device-admin-link`). Products are NOT its children — they are
101617
101618
  * adopted beside it — and its connection settings stay on the integration. */
101618
101619
  DeviceType["Gateway"] = "gateway";
101620
+ /** A heat pump (any vendor): the compressor unit with its circuits (heating, hot
101621
+ * water, cooling, solar), its system modes and its power. One main read-only
101622
+ * `heat-pump-status` cap carries all of it; `heat-pump-control` sets it (D1026). */
101623
+ DeviceType["HeatPump"] = "heat-pump";
101619
101624
  return DeviceType;
101620
101625
  }({});
101621
101626
  var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
@@ -101774,6 +101779,10 @@ var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
101774
101779
  /** Robot mower exposes targeted mowing (all-area / zones / edges /
101775
101780
  * spots) — gates the Mow action + map selectors. */
101776
101781
  DeviceFeature["MowerHasTargetedMowing"] = "mower-has-targeted-mowing";
101782
+ /** The device has a drive/navigation surface (`navigation` cap): a robot camera. */
101783
+ DeviceFeature["Navigation"] = "navigation";
101784
+ /** The device has a network-link reading (`network-link` cap). */
101785
+ DeviceFeature["NetworkLink"] = "network-link";
101777
101786
  return DeviceFeature;
101778
101787
  }({});
101779
101788
  /**
@@ -101888,6 +101897,12 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
101888
101897
  DeviceRole["IrTransmitter"] = "ir-transmitter";
101889
101898
  return DeviceRole;
101890
101899
  }({});
101900
+ /**
101901
+ * A composed device's stableId is this prefix plus the block id. Its own module,
101902
+ * free of zod, so the addon runner can read it through `@camstack/types/addon`
101903
+ * without loading the schema barrel (D28).
101904
+ */
101905
+ var COMPOSED_DEVICE_STABLE_ID_PREFIX = "composed-";
101891
101906
  //#endregion
101892
101907
  //#region ../../node_modules/zod/v4/core/core.js
101893
101908
  var _a$1;
@@ -106700,7 +106715,7 @@ var ZodIssueCode = {
106700
106715
  var ZodFirstPartyTypeKind;
106701
106716
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
106702
106717
  //#endregion
106703
- //#region ../types/dist/sleep-CS5Xp1iQ.mjs
106718
+ //#region ../types/dist/sleep-D_NpiLFP.mjs
106704
106719
  /**
106705
106720
  * The audio chunk plane's byte format, and the ONE expansion from a coded
106706
106721
  * window to float samples (D455).
@@ -109394,16 +109409,6 @@ var BaseAddon = class {
109394
109409
  return null;
109395
109410
  }
109396
109411
  /**
109397
- * The form schema of ONE integration instance, or `null` to use the scoped form.
109398
- *
109399
- * Override it only when an `instanceMode: multiple` addon's instances differ: an NVR integration
109400
- * needs its connection fields, the default integration the addon's own sections. It is the
109401
- * SHAPE of the form only — the values live on the instance record.
109402
- */
109403
- async integrationFormSchema(_instance) {
109404
- return null;
109405
- }
109406
- /**
109407
109412
  * D986 scoped settings: the form shape of the CLUSTER-wide settings one capability this addon
109408
109413
  * provides owns, or `null` when it has none. `cap` is a capability name the addon's manifest
109409
109414
  * declares. Stored as `addon-settings` rows `<addonId>.<field>`. The keys of this schema, of
@@ -109431,8 +109436,7 @@ var BaseAddon = class {
109431
109436
  }
109432
109437
  /**
109433
109438
  * The host's read of the scoped declarations: the schema one capability declares for `scope`,
109434
- * or `null`. Beside {@link getIntegrationFormSchema}, the same shape: the hook is protected, the
109435
- * host asks this method.
109439
+ * or `null`. The hook is protected, the host asks this method.
109436
109440
  */
109437
109441
  async getScopedSettingsSchema(scope, cap) {
109438
109442
  switch (scope) {
@@ -109600,22 +109604,6 @@ var BaseAddon = class {
109600
109604
  return Object.fromEntries([...collectHydratedFieldValues(form)].filter(([, value]) => value !== void 0));
109601
109605
  }
109602
109606
  /**
109603
- * What the create wizard and the integration edit page render for one instance: the addon's
109604
- * per-instance schema when it declares one, else its global schema (what they always showed).
109605
- */
109606
- async getIntegrationFormSchema(instance, nodeId) {
109607
- const scoped = await this.integrationFormSchema(instance);
109608
- if (scoped === null) return this.scopedForm(nodeId);
109609
- return hydrateSchema(scoped, {}, { inlineSecretsAsViews: true });
109610
- }
109611
- /** The form of the scoped schemas this addon declared, hydrated from its store. */
109612
- async scopedForm(nodeId) {
109613
- await this.loadScopedSchemas();
109614
- const schema = this.scopedFormSchema();
109615
- if (!schema) return { sections: [] };
109616
- return hydrateSchema(schema, await this.readRawProjectedStore(nodeId), { inlineSecretsAsViews: true });
109617
- }
109618
- /**
109619
109607
  * The raw addon store PROJECTED onto the target node's bare per-node keys:
109620
109608
  * every `perNode: true` field carries THAT node's scoped value on its bare
109621
109609
  * key (absent scoped key ⇒ key absent, so the schema `default` wins — no
@@ -109802,12 +109790,6 @@ var BaseAddon = class {
109802
109790
  this._nodeKeysByCap = /* @__PURE__ */ new Map();
109803
109791
  this._addonSecretTree = null;
109804
109792
  }
109805
- /** The form of an addon's scoped schemas: their sections, each shown once. */
109806
- scopedFormSchema(cap) {
109807
- const byId = /* @__PURE__ */ new Map();
109808
- for (const entry of this.loadedScopedSchemas(cap)) for (const section of entry.schema.sections) if (!byId.has(section.id)) byId.set(section.id, section);
109809
- return byId.size === 0 ? null : { sections: [...byId.values()] };
109810
- }
109811
109793
  /** Every loaded scoped schema of `cap`, or of every loaded capability. */
109812
109794
  loadedScopedSchemas(cap) {
109813
109795
  if (cap !== void 0) return this._scopedByCap.get(cap) ?? [];
@@ -110397,6 +110379,24 @@ function normalizeAddonInitResult(result) {
110397
110379
  if (Array.isArray(result)) return { providers: result };
110398
110380
  return result;
110399
110381
  }
110382
+ object({
110383
+ code: string().regex(/^[a-z][a-z0-9-]*(\.[a-z0-9-]+)+$/),
110384
+ params: record(string(), union([string(), number$1()])).optional()
110385
+ });
110386
+ var CamstackError = class extends Error {
110387
+ i18nCode;
110388
+ i18nParams;
110389
+ constructor(code, params, englishMessage) {
110390
+ super(englishMessage);
110391
+ this.name = "CamstackError";
110392
+ this.i18nCode = code;
110393
+ this.i18nParams = params;
110394
+ }
110395
+ };
110396
+ /** `throw userError('device.not-found', { id }, 'Device 12 not found')` */
110397
+ function userError(code, params, englishFallback) {
110398
+ return new CamstackError(code, params, englishFallback);
110399
+ }
110400
110400
  object({
110401
110401
  field: string().min(1),
110402
110402
  on: literal("advance")
@@ -110473,12 +110473,6 @@ function systemMethod(input, output, options) {
110473
110473
  systemOnly: true
110474
110474
  };
110475
110475
  }
110476
- /**
110477
- * A method a SOURCE of a collection cap may legitimately not serve — OPTIONAL
110478
- * on `InferProvider`. The `providerOptional: true` literal is what
110479
- * `InferProvider` keys on; see {@link CapabilityMethodSchema.providerOptional}
110480
- * for when this is the honest answer and when it is a soft stub.
110481
- */
110482
110476
  function optionalMethod(input, output, options) {
110483
110477
  return {
110484
110478
  ...method(input, output, options),
@@ -110769,15 +110763,52 @@ var PeerBytesTicketSchema = object({
110769
110763
  */
110770
110764
  declaredBytes: number$1().int().nonnegative().nullable()
110771
110765
  });
110772
- discriminatedUnion("kind", [object({
110773
- kind: literal("action"),
110774
- actionId: string(),
110775
- runId: string(),
110776
- automationId: string().optional()
110777
- }), object({
110778
- kind: literal("scheduler"),
110779
- schedulerId: string()
110780
- })]);
110766
+ /**
110767
+ * The match a notification rule fired on (D705). Carried as a command origin so an
110768
+ * Action the rule starts can press `alarm-panel.trigger` as that match, not as an
110769
+ * anonymous press (D735). The same fields a rule fire ref freezes.
110770
+ */
110771
+ var RuleFireOriginSchema = object({
110772
+ ruleId: string(),
110773
+ ruleName: string(),
110774
+ deviceId: number$1().int(),
110775
+ sourceDeviceId: number$1().int().optional(),
110776
+ recordId: string(),
110777
+ timestamp: number$1(),
110778
+ trackId: string().optional(),
110779
+ eventId: string().optional(),
110780
+ className: string().optional(),
110781
+ label: string().optional(),
110782
+ zones: array(string()).optional(),
110783
+ confidence: number$1().optional(),
110784
+ sensorChange: object({
110785
+ name: string(),
110786
+ kind: string(),
110787
+ state: string()
110788
+ }).optional(),
110789
+ extraStills: array(object({
110790
+ ownerId: string(),
110791
+ cameraId: number$1().int()
110792
+ })).optional()
110793
+ });
110794
+ discriminatedUnion("kind", [
110795
+ object({
110796
+ kind: literal("action"),
110797
+ actionId: string(),
110798
+ runId: string(),
110799
+ automationId: string().optional(),
110800
+ /** The rule fire that started this run, when one did (D705). */
110801
+ ruleFire: RuleFireOriginSchema.optional()
110802
+ }),
110803
+ object({
110804
+ kind: literal("scheduler"),
110805
+ schedulerId: string()
110806
+ }),
110807
+ object({
110808
+ kind: literal("rule"),
110809
+ fire: RuleFireOriginSchema
110810
+ })
110811
+ ]);
110781
110812
  /**
110782
110813
  * One recorded device transition (D1022): a status field of a device went from
110783
110814
  * one value to another, with who or what asked for it.
@@ -111363,7 +111394,7 @@ function t(en, it) {
111363
111394
  * Things an operator switches, opens, sets or arms: lights, plugs, sirens,
111364
111395
  * covers, valves, locks, climate, fans, alarm panels.
111365
111396
  */
111366
- var ON = t("On", "Acceso");
111397
+ var ON$1 = t("On", "Acceso");
111367
111398
  var PERCENT = t("Percentage", "Percentuale");
111368
111399
  var OPEN_CLOSE_STATES = [
111369
111400
  {
@@ -111423,7 +111454,7 @@ var ACTUATOR_CAP_VOCABULARY = {
111423
111454
  state: [{
111424
111455
  kind: "boolean",
111425
111456
  field: "on",
111426
- label: ON,
111457
+ label: ON$1,
111427
111458
  whenTrue: t("When {device} turns on", "Quando {device} si accende"),
111428
111459
  whenFalse: t("When {device} turns off", "Quando {device} si spegne"),
111429
111460
  icon: "power"
@@ -112589,7 +112620,7 @@ var ACTUATOR_CAP_VOCABULARY = {
112589
112620
  state: [{
112590
112621
  kind: "boolean",
112591
112622
  field: "on",
112592
- label: ON,
112623
+ label: ON$1,
112593
112624
  whenTrue: t("When {device} turns on", "Quando {device} si accende"),
112594
112625
  whenFalse: t("When {device} turns off", "Quando {device} si spegne"),
112595
112626
  icon: "power"
@@ -114586,10 +114617,6 @@ var CAMERA_CAP_VOCABULARY = {
114586
114617
  scope: "device",
114587
114618
  noun: t("Admin link", "Link di amministrazione")
114588
114619
  },
114589
- "device-discovery": {
114590
- scope: "device",
114591
- noun: t("Discovery", "Rilevamento dispositivi")
114592
- },
114593
114620
  "device-extension": {
114594
114621
  scope: "device",
114595
114622
  noun: t("Device extension", "Estensione del dispositivo")
@@ -115001,6 +115028,133 @@ var CAMERA_CAP_VOCABULARY = {
115001
115028
  }
115002
115029
  };
115003
115030
  /**
115031
+ * The heat pump (D1026): its system modes are phrased for automations, each with the
115032
+ * values the gateway really accepts; the per-circuit parameters need a circuit and are
115033
+ * set from the device page.
115034
+ */
115035
+ var OFF = {
115036
+ value: "off",
115037
+ label: t("Off", "Off")
115038
+ };
115039
+ var AUTO = {
115040
+ value: "auto",
115041
+ label: t("Auto", "Auto")
115042
+ };
115043
+ var ON = {
115044
+ value: "on",
115045
+ label: t("On", "On")
115046
+ };
115047
+ var MANUAL = {
115048
+ value: "manual",
115049
+ label: t("Manual", "Manuale")
115050
+ };
115051
+ var HOLIDAY_PROGRAMMES = [OFF, ...[
115052
+ 1,
115053
+ 2,
115054
+ 3,
115055
+ 4,
115056
+ 5,
115057
+ 6,
115058
+ 7,
115059
+ 8
115060
+ ].map((n) => ({
115061
+ value: `hm${n}`,
115062
+ label: t(`Programme ${n}`, `Programma ${n}`)
115063
+ }))];
115064
+ var PER_CIRCUIT = "Needs a circuit: set from the device page, not offered to automations";
115065
+ var HEAT_PUMP_CAP_VOCABULARY = {
115066
+ "heat-pump-status": {
115067
+ scope: "device",
115068
+ noun: t("Heat pump", "Pompa di calore")
115069
+ },
115070
+ "heat-pump-control": {
115071
+ scope: "device",
115072
+ noun: t("Heat pump settings", "Impostazioni pompa di calore"),
115073
+ actions: [
115074
+ {
115075
+ id: "heatPump.silent",
115076
+ method: "setSilentMode",
115077
+ label: t("Set silent mode", "Imposta la modalità silenziosa"),
115078
+ phrase: t("Set silent mode of {device} to {mode}", "Imposta la modalità silenziosa di {device} su {mode}"),
115079
+ icon: "volume-x",
115080
+ openArgs: [{
115081
+ key: "mode",
115082
+ label: t("Silent mode", "Modalità silenziosa"),
115083
+ offer: {
115084
+ kind: "enum",
115085
+ values: [
115086
+ OFF,
115087
+ AUTO,
115088
+ ON
115089
+ ]
115090
+ }
115091
+ }]
115092
+ },
115093
+ {
115094
+ id: "heatPump.away",
115095
+ method: "setAwayMode",
115096
+ label: t("Set away mode", "Imposta la modalità assente"),
115097
+ phrase: t("Set away mode of {device} to {mode}", "Imposta la modalità assente di {device} su {mode}"),
115098
+ icon: "plane",
115099
+ openArgs: [{
115100
+ key: "mode",
115101
+ label: t("Away mode", "Modalità assente"),
115102
+ offer: {
115103
+ kind: "enum",
115104
+ values: [OFF, ON]
115105
+ }
115106
+ }]
115107
+ },
115108
+ {
115109
+ id: "heatPump.additionalHeater",
115110
+ method: "setAdditionalHeaterMode",
115111
+ label: t("Set additional heater", "Imposta il riscaldatore aggiuntivo"),
115112
+ phrase: t("Set the additional heater of {device} to {mode}", "Imposta il riscaldatore aggiuntivo di {device} su {mode}"),
115113
+ icon: "flame",
115114
+ openArgs: [{
115115
+ key: "mode",
115116
+ label: t("Additional heater", "Riscaldatore aggiuntivo"),
115117
+ offer: {
115118
+ kind: "enum",
115119
+ values: [
115120
+ OFF,
115121
+ MANUAL,
115122
+ AUTO
115123
+ ]
115124
+ }
115125
+ }]
115126
+ },
115127
+ {
115128
+ id: "heatPump.holiday",
115129
+ method: "setHolidayMode",
115130
+ label: t("Set holiday mode", "Imposta la modalità vacanza"),
115131
+ phrase: t("Set holiday mode of {device} to {mode}", "Imposta la modalità vacanza di {device} su {mode}"),
115132
+ icon: "tree-palm",
115133
+ openArgs: [{
115134
+ key: "mode",
115135
+ label: t("Holiday programme", "Programma vacanza"),
115136
+ offer: {
115137
+ kind: "enum",
115138
+ values: HOLIDAY_PROGRAMMES
115139
+ }
115140
+ }]
115141
+ }
115142
+ ],
115143
+ notOperatorFacing: {
115144
+ setCircuitOperationMode: PER_CIRCUIT,
115145
+ setCircuitHeatCoolMode: PER_CIRCUIT,
115146
+ setCircuitSummerWinter: PER_CIRCUIT,
115147
+ setCircuitComfortSetpoint: PER_CIRCUIT,
115148
+ setCircuitEcoSetpoint: PER_CIRCUIT,
115149
+ setCircuitMaxFlowTemp: PER_CIRCUIT,
115150
+ setDhwOperationMode: PER_CIRCUIT,
115151
+ setDhwTemperatureLevel: PER_CIRCUIT,
115152
+ setDhwChargeDuration: PER_CIRCUIT,
115153
+ startExtraHotWater: PER_CIRCUIT
115154
+ }
115155
+ }
115156
+ };
115157
+ /**
115004
115158
  * Things an operator WATCHES: contacts, motion, leaks, smoke, measurements,
115005
115159
  * presence, reachability, batteries, doorbells and event sources.
115006
115160
  */
@@ -115634,6 +115788,7 @@ var SYSTEM_CAP_VOCABULARY = {
115634
115788
  backup: system("system backups — run and restored from the Backups page"),
115635
115789
  broker: system("message-broker connections — configured, not actuated"),
115636
115790
  "calendar-source": system(INTERNAL),
115791
+ "cluster-update": system(CLUSTER),
115637
115792
  calendars: system("calendars feed schedules and conditions, not device actions"),
115638
115793
  composer: system("device composition — an authoring tool, not an action"),
115639
115794
  "core-blocks": system(INTERNAL),
@@ -115722,6 +115877,7 @@ var CAP_VOCABULARY_BY_NAME = {
115722
115877
  ...ACTUATOR_CAP_VOCABULARY,
115723
115878
  ...APPLIANCE_CAP_VOCABULARY,
115724
115879
  ...CAMERA_CAP_VOCABULARY,
115880
+ ...HEAT_PUMP_CAP_VOCABULARY,
115725
115881
  ...SENSOR_CAP_VOCABULARY,
115726
115882
  ...SYSTEM_CAP_VOCABULARY
115727
115883
  };
@@ -115934,6 +116090,7 @@ var CAP_NAMES = Object.freeze([
115934
116090
  "camera-streams",
115935
116091
  "carbon-monoxide",
115936
116092
  "climate-control",
116093
+ "cluster-update",
115937
116094
  "color",
115938
116095
  "composer",
115939
116096
  "connectivity",
@@ -115951,7 +116108,6 @@ var CAP_NAMES = Object.freeze([
115951
116108
  "device-admin-link",
115952
116109
  "device-adoption",
115953
116110
  "device-credentials",
115954
- "device-discovery",
115955
116111
  "device-export",
115956
116112
  "device-extension",
115957
116113
  "device-history",
@@ -115981,6 +116137,8 @@ var CAP_NAMES = Object.freeze([
115981
116137
  "group-active",
115982
116138
  "group-commands",
115983
116139
  "group-status",
116140
+ "heat-pump-control",
116141
+ "heat-pump-status",
115984
116142
  "heating-valve",
115985
116143
  "hero-layout",
115986
116144
  "humidifier",
@@ -116571,13 +116729,6 @@ Object.freeze({
116571
116729
  "valueType": "string"
116572
116730
  }
116573
116731
  ],
116574
- "device-discovery": [{
116575
- "path": "lastDiscoveryAt",
116576
- "valueType": "number"
116577
- }, {
116578
- "path": "lastError",
116579
- "valueType": "string"
116580
- }],
116581
116732
  "device-export": [
116582
116733
  {
116583
116734
  "path": "linkState",
@@ -116846,6 +116997,48 @@ Object.freeze({
116846
116997
  "valueType": "number"
116847
116998
  }
116848
116999
  ],
117000
+ "heat-pump-status": [
117001
+ {
117002
+ "path": "power.thermalW",
117003
+ "valueType": "number"
117004
+ },
117005
+ {
117006
+ "path": "power.electricalW",
117007
+ "valueType": "number"
117008
+ },
117009
+ {
117010
+ "path": "power.compressorPct",
117011
+ "valueType": "number"
117012
+ },
117013
+ {
117014
+ "path": "temperatures.supply",
117015
+ "valueType": "number"
117016
+ },
117017
+ {
117018
+ "path": "temperatures.return",
117019
+ "valueType": "number"
117020
+ },
117021
+ {
117022
+ "path": "temperatures.outdoor",
117023
+ "valueType": "number"
117024
+ },
117025
+ {
117026
+ "path": "energy.thermalKwh",
117027
+ "valueType": "number"
117028
+ },
117029
+ {
117030
+ "path": "energy.electricalKwh",
117031
+ "valueType": "number"
117032
+ },
117033
+ {
117034
+ "path": "waterPressureBar",
117035
+ "valueType": "number"
117036
+ },
117037
+ {
117038
+ "path": "starts",
117039
+ "valueType": "number"
117040
+ }
117041
+ ],
116849
117042
  "heating-valve": [{
116850
117043
  "path": "position",
116851
117044
  "valueType": "number"
@@ -117986,24 +118179,6 @@ Object.freeze({
117986
118179
  "uploadDataset": 72e5
117987
118180
  }
117988
118181
  });
117989
- object({
117990
- code: string().regex(/^[a-z][a-z0-9-]*(\.[a-z0-9-]+)+$/),
117991
- params: record(string(), union([string(), number$1()])).optional()
117992
- });
117993
- var CamstackError = class extends Error {
117994
- i18nCode;
117995
- i18nParams;
117996
- constructor(code, params, englishMessage) {
117997
- super(englishMessage);
117998
- this.name = "CamstackError";
117999
- this.i18nCode = code;
118000
- this.i18nParams = params;
118001
- }
118002
- };
118003
- /** `throw userError('device.not-found', { id }, 'Device 12 not found')` */
118004
- function userError(code, params, englishFallback) {
118005
- return new CamstackError(code, params, englishFallback);
118006
- }
118007
118182
  /**
118008
118183
  * Promise-based timer helpers — used everywhere the codebase needs to
118009
118184
  * wait, back off, or schedule a retry. Before these helpers landed, each
@@ -118029,7 +118204,7 @@ function sleep(ms) {
118029
118204
  return new Promise((resolve) => setTimeout(resolve, Math.max(0, ms)));
118030
118205
  }
118031
118206
  //#endregion
118032
- //#region ../types/dist/composition-CXCX78IR.mjs
118207
+ //#region ../types/dist/implemented-methods-M5aguGon.mjs
118033
118208
  /**
118034
118209
  * The ffmpeg build every CamStack node downloads, per platform and arch.
118035
118210
  *
@@ -118984,8 +119159,6 @@ var HelperSpecSchema = discriminatedUnion("kind", [
118984
119159
  source: HelperMemberSchema
118985
119160
  })
118986
119161
  ]);
118987
- /** A composed device's stableId is this prefix plus the block id. */
118988
- var COMPOSED_DEVICE_STABLE_ID_PREFIX = "composed-";
118989
119162
  /** Longest snippet a `code` source may carry (slice 4). */
118990
119163
  var MAX_COMPOSITION_CODE_LENGTH = 2e4;
118991
119164
  /** One field of one capability of one source device. */
@@ -119760,25 +119933,6 @@ var RequiredAddonUpdateSchema = object({
119760
119933
  installed: string().nullable()
119761
119934
  });
119762
119935
  /**
119763
- * Which integration instance a settings form is for. An addon that serves several instances
119764
- * (`instanceMode: multiple`) can show a different form per instance — an NVR integration
119765
- * needs its connection, the default integration needs the addon's own sections.
119766
- *
119767
- * - `integrationId` is `null` in the create wizard: nothing exists yet, the operator is
119768
- * setting up a NEW instance.
119769
- * - `mode` is the wizard mode of the integration type (`getAvailableTypes`).
119770
- * - `candidateStableId` is the discovery candidate a wizard was seeded from, if any.
119771
- */
119772
- var IntegrationInstanceRefSchema = object({
119773
- integrationId: string().nullable(),
119774
- mode: _enum([
119775
- "standalone",
119776
- "account",
119777
- "broker"
119778
- ]),
119779
- candidateStableId: string().optional()
119780
- });
119781
- /**
119782
119936
  * notification-output — canonical, capability-gated notification delivery.
119783
119937
  *
119784
119938
  * Apprise-derived model (see
@@ -120007,18 +120161,43 @@ var TargetKindLevelSchema = object({
120007
120161
  requires: array(string()).optional(),
120008
120162
  description: string().optional()
120009
120163
  });
120164
+ /** Attachment capabilities for a kind (drives the degrade engine + test panel). */
120165
+ var TargetKindAttachmentsCapsSchema = object({
120166
+ mediaTypes: array(AttachmentMediaTypeSchema),
120167
+ mode: _enum([
120168
+ "url",
120169
+ "bytes",
120170
+ "both"
120171
+ ]),
120172
+ max: number$1().int().nonnegative(),
120173
+ maxBytes: number$1().int().positive().optional()
120174
+ });
120175
+ /**
120176
+ * Which TEXT fields a kind delivers (#483). Alexa speaks a title and nothing
120177
+ * else; a push service shows both.
120178
+ *
120179
+ * `.optional()` on the caps block, never defaulted: absent = both, which is
120180
+ * what every kind declared before this field meant (D938's rule for a Zod
120181
+ * default on the addon cap path).
120182
+ */
120183
+ var TargetKindTextCapsSchema = object({
120184
+ title: boolean(),
120185
+ body: boolean()
120186
+ });
120187
+ _enum([
120188
+ "title",
120189
+ "body",
120190
+ "attachments",
120191
+ "actions",
120192
+ "priority",
120193
+ "sound",
120194
+ "clickUrl"
120195
+ ]);
120010
120196
  /** The full capability block consulted before dispatch. */
120011
120197
  var TargetKindCapsSchema = object({
120012
- attachments: object({
120013
- mediaTypes: array(AttachmentMediaTypeSchema),
120014
- mode: _enum([
120015
- "url",
120016
- "bytes",
120017
- "both"
120018
- ]),
120019
- max: number$1().int().nonnegative(),
120020
- maxBytes: number$1().int().positive().optional()
120021
- }),
120198
+ /** Text fields this kind delivers (#483). Absent = title AND body. */
120199
+ text: TargetKindTextCapsSchema.optional(),
120200
+ attachments: TargetKindAttachmentsCapsSchema,
120022
120201
  /** Max action buttons (0 = none). */
120023
120202
  actions: number$1().int().nonnegative(),
120024
120203
  /**
@@ -145363,6 +145542,62 @@ var WeekdayKeySchema = _enum([
145363
145542
  "sat",
145364
145543
  "sun"
145365
145544
  ]);
145545
+ /**
145546
+ * Hold semantics — "for N seconds" on a leaf of the `when` tree (#498).
145547
+ *
145548
+ * ONE primitive, `for: { ms, mode, tolerance? }`, shared by `device-becomes`,
145549
+ * `device-is` and `expression`:
145550
+ *
145551
+ * - `held`: the condition stays true for `ms`;
145552
+ * - `stable`: the value does not move by more than `tolerance` (absolute, in
145553
+ * the field's base unit) for `ms` while the condition holds.
145554
+ *
145555
+ * {@link HoldCore} is the pure state machine (an input observation → a reading).
145556
+ * {@link HoldTracker} keys cores by a leaf path for the STATE leaves the tree
145557
+ * evaluator judges. {@link BecomesWatch} wraps a core with a timer for the
145558
+ * `device-becomes` EVENT leaf: the deadline is armed when the hold starts and
145559
+ * cancelled when it breaks, and the leaf fires ONCE per episode.
145560
+ *
145561
+ * Hold state is memory only. A hold that is already running when the watcher
145562
+ * first looks (a restart) is INHERITED: nobody knows when it began, so it never
145563
+ * fires for that episode and a state leaf reads it as unknown until the window
145564
+ * has elapsed from the moment the watcher started (D49: not-known is not false).
145565
+ */
145566
+ var HOLD_MAX_MS = 864e5;
145567
+ var HoldModeSchema = _enum(["held", "stable"]);
145568
+ var HoldSpecSchema = object({
145569
+ /** How long the condition (or the value) must hold. */
145570
+ ms: number$1().int().min(1).max(HOLD_MAX_MS),
145571
+ mode: HoldModeSchema,
145572
+ /** `stable` only: the largest move of the value that still counts as unchanged (absolute, base unit). */
145573
+ tolerance: number$1().min(0).optional()
145574
+ });
145575
+ /** What a trace says about a hold. */
145576
+ var HoldTraceSchema = object({
145577
+ phase: _enum([
145578
+ "pending",
145579
+ "cancelled",
145580
+ "fired",
145581
+ "reseeded"
145582
+ ]),
145583
+ ms: number$1().int(),
145584
+ mode: HoldModeSchema,
145585
+ /** When the hold started (ms epoch). */
145586
+ since: number$1().optional(),
145587
+ /** When it completes (ms epoch), for a pending hold. */
145588
+ deadline: number$1().optional()
145589
+ });
145590
+ /** The operators a `device-becomes` leaf may carry: a threshold or a range. */
145591
+ var BecomesOperatorSchema = _enum([
145592
+ "eq",
145593
+ "ne",
145594
+ "gt",
145595
+ "gte",
145596
+ "lt",
145597
+ "lte",
145598
+ "between",
145599
+ "outside"
145600
+ ]);
145366
145601
  /** How a state leaf compares a device field to a value. Derived from the
145367
145602
  * field's `kind` in `deviceManager.getWireableFields`, never hand-maintained. */
145368
145603
  var AutomationConditionOperatorSchema = _enum([
@@ -145386,18 +145621,52 @@ var DeviceBecomesLeafSchema = object({
145386
145621
  deviceId: number$1().int().nonnegative(),
145387
145622
  cap: string().min(1),
145388
145623
  fieldPath: string().min(1),
145389
- /** Fire when the field takes this value. Omit to fire on any change. */
145624
+ /** Fire when the field takes this value. Omit (with no `operator`) to fire on any change. */
145390
145625
  becomes: union([
145391
145626
  string(),
145392
145627
  number$1(),
145393
145628
  boolean()
145394
145629
  ]).optional(),
145395
- /** Only on a CHANGE of value, not on every re-report. */
145630
+ /**
145631
+ * A threshold or a range instead of an equality: "crosses above 3000", "enters
145632
+ * 18..24". The leaf fires on the TRANSITION into the predicate, never on a re-report.
145633
+ * `value` is in the field's base unit; `between` / `outside` take `[low, high]`.
145634
+ */
145635
+ operator: BecomesOperatorSchema.optional(),
145636
+ value: union([
145637
+ number$1(),
145638
+ string(),
145639
+ boolean(),
145640
+ array(number$1()).length(2)
145641
+ ]).optional(),
145642
+ /**
145643
+ * Hold: the transition (or, with no predicate, the new value) must stay for
145644
+ * `for.ms` before the leaf fires, ONCE per episode. See `hold.ts`.
145645
+ */
145646
+ for: HoldSpecSchema.optional(),
145647
+ /** @deprecated every leaf fires on a transition now; read as always on. */
145396
145648
  edge: boolean().optional(),
145397
- /** The new value must hold this long before it counts. */
145398
- forMs: number$1().int().min(0).max(864e5).optional(),
145649
+ /** @deprecated legacy `held` window — read through `holdOf` as `for: { ms, mode: 'held' }`. */
145650
+ forMs: number$1().int().min(0).max(HOLD_MAX_MS).optional(),
145399
145651
  /** Collapse a burst into one occurrence. */
145400
145652
  debounceMs: number$1().int().min(0).max(6e5).optional()
145653
+ }).superRefine((leaf, ctx) => {
145654
+ if (leaf.becomes !== void 0 && leaf.operator !== void 0) ctx.addIssue({
145655
+ code: "custom",
145656
+ message: "a leaf names `becomes` or `operator`, not both",
145657
+ path: ["operator"]
145658
+ });
145659
+ if (leaf.operator !== void 0 && leaf.value === void 0) ctx.addIssue({
145660
+ code: "custom",
145661
+ message: "an operator needs the value to compare to",
145662
+ path: ["value"]
145663
+ });
145664
+ const range = leaf.operator === "between" || leaf.operator === "outside";
145665
+ if (leaf.operator !== void 0 && range !== Array.isArray(leaf.value)) ctx.addIssue({
145666
+ code: "custom",
145667
+ message: range ? "a range takes [low, high]" : "only a range takes [low, high]",
145668
+ path: ["value"]
145669
+ });
145401
145670
  });
145402
145671
  var DeviceEventLeafSchema = object({
145403
145672
  kind: literal("device-event"),
@@ -145462,7 +145731,9 @@ var DeviceIsLeafSchema = object({
145462
145731
  QuantityValueSchema
145463
145732
  ]),
145464
145733
  /** The unit the person picked for `value` (display only; `value` is in the base unit). */
145465
- unit: string().min(1).optional()
145734
+ unit: string().min(1).optional(),
145735
+ /** The comparison must hold (`held`) or the value stay put (`stable`) this long. */
145736
+ for: HoldSpecSchema.optional()
145466
145737
  });
145467
145738
  /**
145468
145739
  * True when the camera currently has a PARKED object matching `subjects` in at
@@ -145485,7 +145756,9 @@ var StationaryPresentLeafSchema = object({
145485
145756
  var ExpressionLeafSchema = object({
145486
145757
  kind: literal("expression"),
145487
145758
  expr: string().min(1).max(MAX_EXPRESSION_SOURCE_LENGTH),
145488
- bindings: record(string().regex(EXPRESSION_IDENTIFIER_RE), ExpressionBindingSourceSchema)
145759
+ bindings: record(string().regex(EXPRESSION_IDENTIFIER_RE), ExpressionBindingSourceSchema),
145760
+ /** The expression must stay true this long. An expression has no single value, so only `held`. */
145761
+ for: HoldSpecSchema.optional()
145489
145762
  }).superRefine((src, ctx) => {
145490
145763
  const err = validateExpressionSource(src);
145491
145764
  if (err !== null) ctx.addIssue({
@@ -145493,6 +145766,11 @@ var ExpressionLeafSchema = object({
145493
145766
  message: err,
145494
145767
  path: ["expr"]
145495
145768
  });
145769
+ if (src.for?.mode === "stable") ctx.addIssue({
145770
+ code: "custom",
145771
+ message: "an expression is held, not stable: it has no single value to keep still",
145772
+ path: ["for", "mode"]
145773
+ });
145496
145774
  });
145497
145775
  var AutomationWhenSchema = lazy(() => discriminatedUnion("kind", [
145498
145776
  object({
@@ -145823,30 +146101,21 @@ function convertLegacyWhen(half) {
145823
146101
  * (instants) and state leaves (durations). It replaces the flat trigger list
145824
146102
  * plus the separate condition tree; the firing rule is in that file and in
145825
146103
  * ADR "one tree".
145826
- * - **Actions** — `NcRuleActionSchema`'s two steps, plus the `{kind:'code'}`
145827
- * fragment of §3.2.2. See {@link AutomationActionSchema} for the ONE place
145828
- * this had to diverge from "verbatim", and why.
146104
+ * - **Actions** — the `wait` and `cap` steps, plus the `{kind:'code'}`
146105
+ * fragment of §3.2.2. See {@link AutomationActionSchema}.
145829
146106
  *
145830
146107
  * A recipe stored in the old shape (`triggers` + `conditions`) still LOADS:
145831
146108
  * {@link AutomationRecipeSchema} (the parse-anywhere schema) converts it on parse. Nothing writes it.
145832
146109
  */
145833
146110
  /**
145834
- * One action step.
145835
- *
145836
- * `wait` and `cap` are `NcRuleActionSchema`'s two members, kept structurally
145837
- * identical so `NcRuleActionRunner` runs them unchanged — its device-scope
145838
- * check, stop-at-first-failure and per-sequence throttle are the whole reason
145839
- * to reuse it, and none of them are re-implemented here.
146111
+ * One action step: `wait`, or a `cap` call.
145840
146112
  *
145841
- * **The one divergence, and it is forced.** `NcRuleActionSchema.cap.deviceId` is
145842
- * a literal `z.number().int()`, and the NC runner's own `RunSequencesInput`
145843
- * documents its subject device as *"for the log tag, never for routing"*. So an
145844
- * NC action can never target the device that triggered it — which is fine for
145845
- * the NC (its rules already scope to a device) and fatal for an automation
145846
- * ("sound the siren of the camera that saw the person"). `deviceId` therefore
145847
- * also accepts `{ $var }`, resolved from the run's `vars` bag BEFORE the runner
145848
- * is called. The runner still receives a number and is untouched; the
145849
- * resolution is the recipe's job, not the runner's.
146113
+ * A cap step's target is who it acts on (D983: `devices`, a `domain`, or a
146114
+ * `{ $var }` resolved from the run's variables); the legacy `deviceId` is still
146115
+ * READ, never written. The step runner (`runSteps`) owns the device-scope
146116
+ * check, the stop-at-first-failure and the variable substitution, once, for
146117
+ * every caller — automations, Actions, and the notification centre, which runs
146118
+ * only Actions (planning#473).
145850
146119
  */
145851
146120
  var AutomationWaitStepSchema = object({
145852
146121
  kind: literal("wait"),
@@ -145893,21 +146162,44 @@ var AutomationCapStepBaseSchema = object({
145893
146162
  */
145894
146163
  argUnits: record(string(), string().min(1)).optional()
145895
146164
  });
145896
- var AutomationCapStepSchema = AutomationCapStepBaseSchema.refine((step) => step.target !== void 0 || step.deviceId !== void 0, {
146165
+ /**
146166
+ * The steps an internal Action may contain: cap and wait, and nothing that can
146167
+ * call back into an Action — so an Action can never reach itself (no cycles).
146168
+ * This is the LEAF shape: no condition of its own.
146169
+ */
146170
+ var LeafActionStepSchema = discriminatedUnion("kind", [AutomationWaitStepSchema, AutomationCapStepBaseSchema.refine((step) => step.target !== void 0 || step.deviceId !== void 0, {
145897
146171
  message: "a cap step needs a target",
145898
146172
  path: ["target"]
145899
146173
  }).refine((step) => step.target?.kind !== "domain" || step.actionId !== void 0, {
145900
146174
  message: "a domain target needs the vocabulary action it applies to (actionId)",
145901
146175
  path: ["actionId"]
145902
- });
146176
+ })]);
145903
146177
  /**
145904
- * The steps an internal Action may contain: cap and wait, and nothing that can
145905
- * call back into an Action — so an Action can never reach itself (no cycles).
146178
+ * The optional guard of a step (#472): `if` is the ONE `when` tree (D980), read
146179
+ * on the state mirror when the step is reached; `else` runs when it is false.
146180
+ * An `else` holds leaf steps only — the nesting is bounded at ONE level, so a
146181
+ * branch can never grow a tree the trace has to draw.
145906
146182
  */
145907
- var ActionStepSchema = discriminatedUnion("kind", [AutomationWaitStepSchema, AutomationCapStepSchema]);
146183
+ var stepGuardShape = {
146184
+ if: AutomationWhenSchema.optional(),
146185
+ else: array(LeafActionStepSchema).max(10).optional()
146186
+ };
146187
+ var elseNeedsIf = {
146188
+ message: "an else list needs the condition it is the other side of (if)",
146189
+ path: ["else"]
146190
+ };
146191
+ var GuardedWaitStepSchema = AutomationWaitStepSchema.extend(stepGuardShape).refine((step) => step.else === void 0 || step.if !== void 0, elseNeedsIf);
146192
+ var GuardedCapStepSchema = AutomationCapStepBaseSchema.extend(stepGuardShape).refine((step) => step.target !== void 0 || step.deviceId !== void 0, {
146193
+ message: "a cap step needs a target",
146194
+ path: ["target"]
146195
+ }).refine((step) => step.target?.kind !== "domain" || step.actionId !== void 0, {
146196
+ message: "a domain target needs the vocabulary action it applies to (actionId)",
146197
+ path: ["actionId"]
146198
+ }).refine((step) => step.else === void 0 || step.if !== void 0, elseNeedsIf);
146199
+ var ActionStepSchema = discriminatedUnion("kind", [GuardedWaitStepSchema, GuardedCapStepSchema]);
145908
146200
  var AutomationActionSchema = discriminatedUnion("kind", [
145909
- AutomationWaitStepSchema,
145910
- AutomationCapStepSchema,
146201
+ GuardedWaitStepSchema,
146202
+ GuardedCapStepSchema,
145911
146203
  object({
145912
146204
  kind: literal("action"),
145913
146205
  /** An entry of the `actions` surface (`internal:<uuid>` or `<addonId>:<localId>`). */
@@ -146238,7 +146530,9 @@ var AutomationTriggerTraceSchema = object({
146238
146530
  /** Why an event was rejected ("class person not in [dog]") or what fired. */
146239
146531
  reason: string(),
146240
146532
  /** deviceId, className, trackId, score … — only what the trigger exposes. */
146241
- vars: record(string(), TraceValueSchema)
146533
+ vars: record(string(), TraceValueSchema),
146534
+ /** A hold (`for`) this occurrence went through: pending, cancelled, fired or re-seeded. */
146535
+ hold: HoldTraceSchema.optional()
146242
146536
  });
146243
146537
  var AutomationConditionTraceNodeSchema = object({
146244
146538
  /** `when` for the root, `when.<i>` for its i-th child, … (`conditions…` on an old trace). */
@@ -146287,7 +146581,7 @@ var StepDeviceTraceSchema = object({
146287
146581
  outcome: _enum(["ok", "error"]),
146288
146582
  message: string().optional()
146289
146583
  });
146290
- var AutomationStepTraceSchema = object({
146584
+ var StepTraceBaseSchema = object({
146291
146585
  /** `actions.<i>` */
146292
146586
  path: string().min(1),
146293
146587
  kind: string().min(1),
@@ -146306,15 +146600,35 @@ var AutomationStepTraceSchema = object({
146306
146600
  * is shown as {@link REDACTED_ARG}. Absent on traces written before it existed.
146307
146601
  */
146308
146602
  args: record(string(), TraceValueSchema).optional(),
146309
- /** `empty`: the target resolved to no device, so nothing was done — never silently `ok`. */
146603
+ /**
146604
+ * The device values a templated arg printed as `—`, one `ref: reason` each
146605
+ * (D1021): why a sentence says "—" where a number was expected. Bounded.
146606
+ */
146607
+ templates: array(string()).max(20).optional(),
146608
+ /**
146609
+ * What the step's own `if` read when the step was reached (#472): `true` the
146610
+ * step ran, `false` its `else` ran (or nothing did), `unknown` a state leaf
146611
+ * could not be read, so NEITHER side ran. Absent on an unguarded step.
146612
+ */
146613
+ condition: _enum([
146614
+ "true",
146615
+ "false",
146616
+ "unknown"
146617
+ ]).optional(),
146618
+ /** Why the condition read what it read, in the evaluator's own words. */
146619
+ conditionReason: string().optional(),
146620
+ /** `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. */
146310
146621
  outcome: _enum([
146311
146622
  "ok",
146312
146623
  "error",
146313
146624
  "not-run",
146314
- "empty"
146625
+ "empty",
146626
+ "skipped"
146315
146627
  ]),
146316
146628
  message: string().optional()
146317
146629
  });
146630
+ /** A step trace; the `else` steps that ran are one level of the same shape (the nesting is bounded at one). */
146631
+ var AutomationStepTraceSchema = StepTraceBaseSchema.extend({ else: array(StepTraceBaseSchema).optional() });
146318
146632
  var AutomationRunTraceSchema = object({
146319
146633
  runId: string().min(1),
146320
146634
  startedAt: number$1(),
@@ -146421,6 +146735,8 @@ var ActionStatusSchema = object({
146421
146735
  /** The latest run's failure; null on success or when it never ran. */
146422
146736
  lastError: string().nullable()
146423
146737
  });
146738
+ /** The throttle window of an action, in seconds; absent or 0 = no throttle. */
146739
+ var ActionMinDelaySecSchema = number$1().int().min(0).max(86400);
146424
146740
  var ActionEntrySchema = object({
146425
146741
  /** `internal:<uuid>` or `<addonId>:<localId>`. */
146426
146742
  id: string().min(3),
@@ -146433,6 +146749,14 @@ var ActionEntrySchema = object({
146433
146749
  /** Internal only: cap and wait steps. No action-in-action, so no cycles. */
146434
146750
  steps: array(ActionStepSchema).min(1).max(50).optional(),
146435
146751
  variables: array(ActionVariableSchema).max(20).optional(),
146752
+ /**
146753
+ * Internal only: the least time between two run STARTS. A run that begins
146754
+ * inside the window is skipped (`skipped-cooldown`), traced and logged. It
146755
+ * is an actuator's budget — "how often may this gate physically open" —
146756
+ * not a notification cooldown, and it is shared by every caller of the
146757
+ * action (two rules, a button, an automation).
146758
+ */
146759
+ minDelaySec: ActionMinDelaySecSchema.optional(),
146436
146760
  status: ActionStatusSchema
146437
146761
  }).superRefine((entry, ctx) => {
146438
146762
  if (entry.source === "internal") {
@@ -146463,7 +146787,8 @@ var ActionEntrySchema = object({
146463
146787
  var ActionInputSchema = object({
146464
146788
  name: string().min(1).max(120),
146465
146789
  steps: array(ActionStepSchema).min(1).max(50),
146466
- variables: array(ActionVariableSchema).max(20).optional()
146790
+ variables: array(ActionVariableSchema).max(20).optional(),
146791
+ minDelaySec: ActionMinDelaySecSchema.optional()
146467
146792
  });
146468
146793
  /** Who started a run. Absent = the operator pressed it. */
146469
146794
  var ActionRunOriginSchema = object({
@@ -146490,6 +146815,7 @@ _enum([
146490
146815
  "invalid-variables",
146491
146816
  "invalid-steps",
146492
146817
  "not-linked",
146818
+ "template-scope",
146493
146819
  "busy"
146494
146820
  ]);
146495
146821
  object({
@@ -146552,7 +146878,7 @@ object({
146552
146878
  * is irrelevant; the array is treated as a set by consumers. */
146553
146879
  hiddenChildIds: array(number$1()).readonly()
146554
146880
  });
146555
- 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({
146881
+ DeviceType.Camera, DeviceType.Switch, DeviceType.Light, DeviceType.Sensor, DeviceType.Thermostat, DeviceType.Cover, DeviceType.Lock, DeviceType.Fan, DeviceType.MediaPlayer, DeviceType.AlarmPanel, DeviceType.Generic, method(object({
146556
146882
  deviceId: number$1().int().nonnegative(),
146557
146883
  childDeviceId: number$1().int().nonnegative(),
146558
146884
  hidden: boolean()
@@ -146814,10 +147140,6 @@ method(object({
146814
147140
  scope: ScopedSettingsScopeSchema,
146815
147141
  nodeId: string().optional()
146816
147142
  }), record(string(), unknown()).nullable()), method(object({
146817
- addonId: string(),
146818
- nodeId: string().optional(),
146819
- instance: IntegrationInstanceRefSchema
146820
- }), SettingsSchemaWithValuesSchema.nullable()), method(object({
146821
147143
  addonId: string(),
146822
147144
  nodeId: string().optional()
146823
147145
  }), object({ keys: array(string()) }).nullable(), { auth: "admin" }), method(object({
@@ -149234,7 +149556,14 @@ var CalendarInfoSchema = object({
149234
149556
  id: string().min(1),
149235
149557
  name: string().min(1),
149236
149558
  source: CalendarSourceKindSchema,
149237
- enabled: boolean()
149559
+ enabled: boolean(),
149560
+ /**
149561
+ * The `integration-instances` record that owns this calendar (the record the switch writes).
149562
+ * Every source stamps it from the record it read the calendar from, so a consumer joins on
149563
+ * it instead of rebuilding an id from form values. Optional on the wire so a source addon
149564
+ * that predates the field still lists its calendars: such a row simply has no switch.
149565
+ */
149566
+ instanceId: string().min(1).optional()
149238
149567
  });
149239
149568
  /**
149240
149569
  * Time contract of {@link CalendarEvent}.
@@ -150619,14 +150948,14 @@ var climateControlCapability = {
150619
150948
  kind: "mutation",
150620
150949
  auth: "protected"
150621
150950
  }),
150622
- setFanMode: method(object({
150951
+ setFanMode: optionalMethod(object({
150623
150952
  deviceId: number$1().int().nonnegative(),
150624
150953
  fanMode: string().min(1)
150625
150954
  }), _void(), {
150626
150955
  kind: "mutation",
150627
150956
  auth: "protected"
150628
150957
  }),
150629
- setPreset: method(object({
150958
+ setPreset: optionalMethod(object({
150630
150959
  deviceId: number$1().int().nonnegative(),
150631
150960
  preset: string().min(1)
150632
150961
  }), _void(), {
@@ -150640,7 +150969,7 @@ var climateControlCapability = {
150640
150969
  kind: "mutation",
150641
150970
  auth: "protected"
150642
150971
  }),
150643
- setTargetRange: method(object({
150972
+ setTargetRange: optionalMethod(object({
150644
150973
  deviceId: number$1().int().nonnegative(),
150645
150974
  targetLow: number$1(),
150646
150975
  targetHigh: number$1()
@@ -150648,21 +150977,21 @@ var climateControlCapability = {
150648
150977
  kind: "mutation",
150649
150978
  auth: "protected"
150650
150979
  }),
150651
- setTargetHumidity: method(object({
150980
+ setTargetHumidity: optionalMethod(object({
150652
150981
  deviceId: number$1().int().nonnegative(),
150653
150982
  targetHumidity: number$1().min(0).max(100)
150654
150983
  }), _void(), {
150655
150984
  kind: "mutation",
150656
150985
  auth: "protected"
150657
150986
  }),
150658
- setSwingVertical: method(object({
150987
+ setSwingVertical: optionalMethod(object({
150659
150988
  deviceId: number$1().int().nonnegative(),
150660
150989
  on: boolean()
150661
150990
  }), _void(), {
150662
150991
  kind: "mutation",
150663
150992
  auth: "protected"
150664
150993
  }),
150665
- setSwingHorizontal: method(object({
150994
+ setSwingHorizontal: optionalMethod(object({
150666
150995
  deviceId: number$1().int().nonnegative(),
150667
150996
  on: boolean()
150668
150997
  }), _void(), {
@@ -150720,6 +151049,140 @@ var climateControlCapability = {
150720
151049
  } }
150721
151050
  };
150722
151051
  /**
151052
+ * cluster-update — the ONE flow that brings the whole cluster to a release
151053
+ * (planning#493). Hub-provided (`server-provided`), hub-only: the hub runs
151054
+ * the sequence itself, so the admin UI, the MCP and the CLI all start the same
151055
+ * job and read the same report instead of each driving their own loop.
151056
+ *
151057
+ * 1. backup (`backup.trigger`) — skipped only when the caller says so
151058
+ * 2. the hub's server closure (`applyServerUpdate`); the hub restarts and the
151059
+ * job RESUMES on the new boot, verified against the hub's running version
151060
+ * 3. every online agent behind the target, one at a time, verified: runs the
151061
+ * target, settled, online, and its capabilities registered (D848) — an
151062
+ * agent that comes back capless is a FAILED step, never a done one
151063
+ * 4. every stale addon on the hub (`addons.updatePackage`); agents follow by
151064
+ * reconciliation, which is verified, never pushed
151065
+ *
151066
+ * The job stops on the first failed step with a typed reason (D877). Its state
151067
+ * is durable on the hub and read by RPC (`getClusterUpdateJob`) — events are
151068
+ * telemetry and never carry it (D8, D11).
151069
+ */
151070
+ /** The steps, in the order they run. */
151071
+ var ClusterUpdateStepKindSchema = _enum([
151072
+ "backup",
151073
+ "hub-server",
151074
+ "agent-server",
151075
+ "addons"
151076
+ ]);
151077
+ /**
151078
+ * - `pending` — not reached yet.
151079
+ * - `running` — in progress (for `hub-server`: possibly across the restart).
151080
+ * - `ok` — done AND verified.
151081
+ * - `failed` — did not land; `reason` + `detail` say why. Stops the job.
151082
+ * - `skipped` — not run: nothing to do, opted out, the node is offline, or a
151083
+ * step before it failed. `detail` says which.
151084
+ */
151085
+ var ClusterUpdateStepStatusSchema = _enum([
151086
+ "pending",
151087
+ "running",
151088
+ "ok",
151089
+ "failed",
151090
+ "skipped"
151091
+ ]);
151092
+ /**
151093
+ * Why a step (and with it the job) failed. Stable, greppable; `detail` carries
151094
+ * the prose.
151095
+ */
151096
+ var ClusterUpdateFailureReasonSchema = _enum([
151097
+ "backup-unavailable",
151098
+ "backup-failed",
151099
+ "server-refused",
151100
+ "server-not-on-target",
151101
+ "node-capless",
151102
+ "status-unreadable",
151103
+ "addon-update-failed",
151104
+ "addons-not-converged",
151105
+ "interrupted"
151106
+ ]);
151107
+ var ClusterUpdateStepSchema = object({
151108
+ kind: ClusterUpdateStepKindSchema,
151109
+ /** The node the step acts on; absent for `backup` and `addons`. */
151110
+ nodeId: string().optional(),
151111
+ status: ClusterUpdateStepStatusSchema,
151112
+ /** One line for the operator: what happened, or why not. */
151113
+ detail: string(),
151114
+ reason: ClusterUpdateFailureReasonSchema.optional(),
151115
+ /** `hub-server` / `agent-server`: the version the node ran before. */
151116
+ fromVersion: string().nullable().optional(),
151117
+ /** `addons`: the packages this step updates, `name from -> to`. */
151118
+ packages: array(string()).readonly().optional(),
151119
+ startedAt: number$1().optional(),
151120
+ finishedAt: number$1().optional()
151121
+ });
151122
+ var ClusterUpdateJobStateSchema = _enum([
151123
+ "running",
151124
+ "succeeded",
151125
+ "failed"
151126
+ ]);
151127
+ var ClusterUpdateJobSchema = object({
151128
+ id: string(),
151129
+ state: ClusterUpdateJobStateSchema,
151130
+ /** The server version every node is brought to. */
151131
+ targetVersion: string(),
151132
+ /** Who started it (the user name, or `system`). */
151133
+ requestedBy: string(),
151134
+ startedAt: number$1(),
151135
+ finishedAt: number$1().optional(),
151136
+ /** Every step, in run order; later steps stay `pending` while it runs. */
151137
+ steps: array(ClusterUpdateStepSchema).readonly(),
151138
+ /** On `failed`: the step that stopped it (`nodeId` or the step kind). */
151139
+ stoppedAt: string().optional(),
151140
+ reason: ClusterUpdateFailureReasonSchema.optional(),
151141
+ /** Agents offline when the plan was read: never touched. */
151142
+ skippedOffline: array(string()).readonly()
151143
+ });
151144
+ var ClusterUpdateOptionsSchema = object({
151145
+ /** Explicit server target; omitted = the hub's latest registry check. */
151146
+ version: string().optional(),
151147
+ /** Update the addons too (default true). */
151148
+ addons: boolean().optional(),
151149
+ /**
151150
+ * Back up before touching anything (default true). `false` is an explicit
151151
+ * operator opt-out; a missing backup provider is otherwise a failure.
151152
+ */
151153
+ backup: boolean().optional()
151154
+ });
151155
+ /** Why a plan cannot start. */
151156
+ var ClusterUpdateBlockerSchema = _enum([
151157
+ "no-target",
151158
+ "node-busy",
151159
+ "job-running",
151160
+ "nothing-to-do",
151161
+ "status-unreadable"
151162
+ ]);
151163
+ var ClusterUpdatePlanSchema = object({
151164
+ /** `null` when no target could be resolved (`blocker: 'no-target'`). */
151165
+ targetVersion: string().nullable(),
151166
+ /** The steps the job WOULD run, all `pending` (or `skipped` with a reason). */
151167
+ steps: array(ClusterUpdateStepSchema).readonly(),
151168
+ skippedOffline: array(string()).readonly(),
151169
+ /** `null` = the plan can start. */
151170
+ blocker: ClusterUpdateBlockerSchema.nullable(),
151171
+ /** Prose for `blocker`. */
151172
+ blockerDetail: string().nullable()
151173
+ });
151174
+ var StartClusterUpdateResultSchema = object({
151175
+ accepted: boolean(),
151176
+ /** The job to follow with `getClusterUpdateJob`; `null` when refused. */
151177
+ jobId: string().nullable(),
151178
+ blocker: ClusterUpdateBlockerSchema.nullable(),
151179
+ message: string()
151180
+ });
151181
+ method(ClusterUpdateOptionsSchema, ClusterUpdatePlanSchema, { auth: "admin" }), method(ClusterUpdateOptionsSchema, StartClusterUpdateResultSchema, {
151182
+ kind: "mutation",
151183
+ auth: "admin"
151184
+ }), method(object({ jobId: string().optional() }), ClusterUpdateJobSchema.nullable(), { auth: "admin" });
151185
+ /**
150723
151186
  * Color-light cap. Coexists with `switch` (on/off) and `brightness`
150724
151187
  * (level) on the same device — `switch` toggles the bulb, `brightness`
150725
151188
  * sets the dim level, this cap sets the chromaticity.
@@ -151762,8 +152225,12 @@ var RemoteSourceSchema = discriminatedUnion("kind", [
151762
152225
  object({
151763
152226
  ...sourceBase,
151764
152227
  kind: literal("ir"),
151765
- /** The `ir-transmitter` device the code is sent through. */
151766
- transmitterId: number$1().int().nonnegative(),
152228
+ /**
152229
+ * The `ir-transmitter` device the code is sent through. Absent = the remote's
152230
+ * `defaultTransmitterId` at run time (a source stored before this field was
152231
+ * optional keeps the emitter it names).
152232
+ */
152233
+ transmitterId: number$1().int().nonnegative().optional(),
151767
152234
  /** The code itself; whether a transmitter could send it is `irSourceProblem`. */
151768
152235
  payload: IrPayloadSchema
151769
152236
  })
@@ -151917,27 +152384,27 @@ var mediaPlayerCapability = {
151917
152384
  mode: "singleton",
151918
152385
  deviceTypes: [DeviceType.MediaPlayer],
151919
152386
  methods: {
151920
- turnOn: method(deviceOnly, _void(), {
152387
+ turnOn: optionalMethod(deviceOnly, _void(), {
151921
152388
  kind: "mutation",
151922
152389
  auth: "protected"
151923
152390
  }),
151924
- turnOff: method(deviceOnly, _void(), {
152391
+ turnOff: optionalMethod(deviceOnly, _void(), {
151925
152392
  kind: "mutation",
151926
152393
  auth: "protected"
151927
152394
  }),
151928
- volumeUp: method(stepInput, _void(), {
152395
+ volumeUp: optionalMethod(stepInput, _void(), {
151929
152396
  kind: "mutation",
151930
152397
  auth: "protected"
151931
152398
  }),
151932
- volumeDown: method(stepInput, _void(), {
152399
+ volumeDown: optionalMethod(stepInput, _void(), {
151933
152400
  kind: "mutation",
151934
152401
  auth: "protected"
151935
152402
  }),
151936
- channelUp: method(stepInput, _void(), {
152403
+ channelUp: optionalMethod(stepInput, _void(), {
151937
152404
  kind: "mutation",
151938
152405
  auth: "protected"
151939
152406
  }),
151940
- channelDown: method(stepInput, _void(), {
152407
+ channelDown: optionalMethod(stepInput, _void(), {
151941
152408
  kind: "mutation",
151942
152409
  auth: "protected"
151943
152410
  }),
@@ -151949,61 +152416,61 @@ var mediaPlayerCapability = {
151949
152416
  kind: "mutation",
151950
152417
  auth: "protected"
151951
152418
  }),
151952
- stop: method(object({ deviceId: number$1().int().nonnegative() }), _void(), {
152419
+ stop: optionalMethod(object({ deviceId: number$1().int().nonnegative() }), _void(), {
151953
152420
  kind: "mutation",
151954
152421
  auth: "protected"
151955
152422
  }),
151956
- next: method(object({ deviceId: number$1().int().nonnegative() }), _void(), {
152423
+ next: optionalMethod(object({ deviceId: number$1().int().nonnegative() }), _void(), {
151957
152424
  kind: "mutation",
151958
152425
  auth: "protected"
151959
152426
  }),
151960
- previous: method(object({ deviceId: number$1().int().nonnegative() }), _void(), {
152427
+ previous: optionalMethod(object({ deviceId: number$1().int().nonnegative() }), _void(), {
151961
152428
  kind: "mutation",
151962
152429
  auth: "protected"
151963
152430
  }),
151964
- seek: method(object({
152431
+ seek: optionalMethod(object({
151965
152432
  deviceId: number$1().int().nonnegative(),
151966
152433
  position: number$1().int().nonnegative()
151967
152434
  }), _void(), {
151968
152435
  kind: "mutation",
151969
152436
  auth: "protected"
151970
152437
  }),
151971
- setVolume: method(object({
152438
+ setVolume: optionalMethod(object({
151972
152439
  deviceId: number$1().int().nonnegative(),
151973
152440
  volumeLevel: number$1().min(0).max(100)
151974
152441
  }), _void(), {
151975
152442
  kind: "mutation",
151976
152443
  auth: "protected"
151977
152444
  }),
151978
- setMute: method(object({
152445
+ setMute: optionalMethod(object({
151979
152446
  deviceId: number$1().int().nonnegative(),
151980
152447
  muted: boolean()
151981
152448
  }), _void(), {
151982
152449
  kind: "mutation",
151983
152450
  auth: "protected"
151984
152451
  }),
151985
- setShuffle: method(object({
152452
+ setShuffle: optionalMethod(object({
151986
152453
  deviceId: number$1().int().nonnegative(),
151987
152454
  shuffle: boolean()
151988
152455
  }), _void(), {
151989
152456
  kind: "mutation",
151990
152457
  auth: "protected"
151991
152458
  }),
151992
- setRepeat: method(object({
152459
+ setRepeat: optionalMethod(object({
151993
152460
  deviceId: number$1().int().nonnegative(),
151994
152461
  repeat: MediaPlayerRepeatSchema
151995
152462
  }), _void(), {
151996
152463
  kind: "mutation",
151997
152464
  auth: "protected"
151998
152465
  }),
151999
- selectSource: method(object({
152466
+ selectSource: optionalMethod(object({
152000
152467
  deviceId: number$1().int().nonnegative(),
152001
152468
  source: string().min(1)
152002
152469
  }), _void(), {
152003
152470
  kind: "mutation",
152004
152471
  auth: "protected"
152005
152472
  }),
152006
- playMedia: method(object({
152473
+ playMedia: optionalMethod(object({
152007
152474
  deviceId: number$1().int().nonnegative(),
152008
152475
  /** Media identifier / URL. */
152009
152476
  mediaId: string().min(1),
@@ -152046,7 +152513,7 @@ var mediaPlayerCapability = {
152046
152513
  isMuted: { kind: "boolean" }
152047
152514
  } }
152048
152515
  };
152049
- 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;
152516
+ 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;
152050
152517
  var NUMBER = {
152051
152518
  kind: "fixed",
152052
152519
  result: ["number"]
@@ -153025,18 +153492,18 @@ var coverCapability = {
153025
153492
  kind: "mutation",
153026
153493
  auth: "protected"
153027
153494
  }),
153028
- stop: method(object({ deviceId: number$1().int().nonnegative() }), _void(), {
153495
+ stop: optionalMethod(object({ deviceId: number$1().int().nonnegative() }), _void(), {
153029
153496
  kind: "mutation",
153030
153497
  auth: "protected"
153031
153498
  }),
153032
- setPosition: method(object({
153499
+ setPosition: optionalMethod(object({
153033
153500
  deviceId: number$1().int().nonnegative(),
153034
153501
  position: number$1().min(0).max(100)
153035
153502
  }), _void(), {
153036
153503
  kind: "mutation",
153037
153504
  auth: "protected"
153038
153505
  }),
153039
- setTiltPosition: method(object({
153506
+ setTiltPosition: optionalMethod(object({
153040
153507
  deviceId: number$1().int().nonnegative(),
153041
153508
  tiltPosition: number$1().min(0).max(100)
153042
153509
  }), _void(), {
@@ -153539,27 +154006,35 @@ var deviceAdminLinkCapability = {
153539
154006
  getAdminLink: method(object({ deviceId: number$1().int().nonnegative() }), DeviceAdminLinkSchema.nullable(), { auth: "admin" }) }
153540
154007
  };
153541
154008
  /**
153542
- * device-discovery — device-scoped capability for parents that host /
153543
- * enumerate child devices (Reolink Hub / NVR, ONVIF gateway, future
153544
- * integrations). The parent advertises a list of discoverable children,
153545
- * and the operator promotes a subset to real devices via `adoptDevice`.
153546
- * Child lifecycle (kernel device create/remove, parent reference) is
153547
- * owned by the framework so a single shared `<DiscoveryPanel />` can
153548
- * drive any integration.
153549
- *
153550
- * Boundaries:
153551
- * - The cap exposes ENUMERATION + ADOPT/RELEASE only. The protocol
153552
- * used to discover children (CGI poll, mDNS, push from hub, ...)
153553
- * is the integration's business; results land in `runtimeState`
153554
- * so the panel can render without a fresh round-trip.
153555
- * - `childNativeId` is integration-defined and must be stable across
153556
- * reboots so re-discovery doesn't duplicate adopted children.
153557
- * - `adoptDevice` returns the new `deviceId` so the UI can navigate
153558
- * directly to the freshly-created child's settings page.
153559
- */
153560
- /**
153561
- * Status enum for a discovered device. Mirrors the Reolink simpleEvent
153562
- * lifecycle (`online` / `sleeping` / `offline`) — generic enough for
154009
+ * `device-adoption` — generic discovery + adoption surface,
154010
+ * system-scoped collection (one provider per integration addon), routed
154011
+ * by explicit `{ addonId }` on direct `deviceAdoption.*` calls — the same
154012
+ * pin model as `connection-test`. The admin UI keeps using
154013
+ * `deviceManager.adoption*` (which already threads `addonId`). The de-HA-ified
154014
+ * successor to `ha-discovery`:
154015
+ * keyed by `integrationId` (the addon resolves integrationId → broker
154016
+ * internally) rather than a connection-specific `brokerId`, and it
154017
+ * OWNS the shared `DiscoveredChildDevice` candidate type
154018
+ * (declared below) so a single shared adoption modal renders any integration's
154019
+ * candidate tree.
154020
+ *
154021
+ * UI flow (Integrations page → integration detail):
154022
+ * 1. `listCandidates({integrationId, page, pageSize, filter})` →
154023
+ * paginated candidate list, each row collapsed.
154024
+ * 2. User expands a row → `getCandidate({integrationId,
154025
+ * childNativeId})` returns the single candidate (with its nested
154026
+ * `children`) for the accordion render.
154027
+ * 3. User clicks "Adopt" on one or more candidates →
154028
+ * `adopt({integrationId, childNativeIds, perCandidate?})`
154029
+ * materialises one parent CamStack device per candidate plus its
154030
+ * accessory children. `perCandidate[childNativeId]` carries an
154031
+ * optional display-name override + a `hiddenChildIds` pre-hide set
154032
+ * (the parent's `accessories.hiddenChildIds` gates UI visibility).
154033
+ * 4. User clicks "Release" → `release({integrationId, camDeviceId})`
154034
+ * removes the parent + every child from the kernel registry.
154035
+ */
154036
+ /**
154037
+ * Status enum for a discovered device. Generic enough for
153563
154038
  * battery cams, awake cams, and unreachable cams alike.
153564
154039
  */
153565
154040
  var DiscoveredChildStatusSchema = _enum([
@@ -153576,12 +154051,12 @@ var DiscoveredChildDeviceSchema = lazy(() => object({
153576
154051
  /** DeviceType the child should be created with on adopt. */
153577
154052
  type: _enum(DeviceType),
153578
154053
  status: DiscoveredChildStatusSchema,
153579
- /** Free-form integration-specific metadata surfaced in the panel. */
154054
+ /** Free-form integration-specific metadata surfaced in the adoption modal. */
153580
154055
  metadata: object({
153581
154056
  model: string().optional(),
153582
154057
  serialNumber: string().optional(),
153583
154058
  uid: string().optional(),
153584
- /** Reolink: 0-based channel index inside the parent NVR/Hub. */
154059
+ /** Reolink: 0-based channel index inside the parent NVR. */
153585
154060
  rtspChannel: number$1().int().nonnegative().optional(),
153586
154061
  isBattery: boolean().optional(),
153587
154062
  isDoorbell: boolean().optional(),
@@ -153597,137 +154072,24 @@ var DiscoveredChildDeviceSchema = lazy(() => object({
153597
154072
  }).default({}),
153598
154073
  /**
153599
154074
  * `true` when the framework already created a child device for this
153600
- * `childNativeId` under the current parent. The panel uses it to
154075
+ * `childNativeId` under the current parent. The adoption modal uses it to
153601
154076
  * gate the Add/Remove button and surface the existing `deviceId`.
153602
154077
  */
153603
154078
  alreadyAdopted: boolean(),
153604
154079
  /** When `alreadyAdopted=true`, the framework-assigned child device id. */
153605
154080
  adoptedDeviceId: number$1().int().nonnegative().nullable(),
153606
- /** Capability names the candidate advertises — integrations populate, Hubs omit. */
154081
+ /** Capability names the candidate advertises — integrations populate, flat enumerations omit. */
153607
154082
  capabilities: array(string()).readonly().optional(),
153608
- /** Feature flags the candidate advertises — integrations populate, Hubs omit. */
154083
+ /** Feature flags the candidate advertises — integrations populate, flat enumerations omit. */
153609
154084
  features: array(string()).readonly().optional(),
153610
154085
  /** Upstream-system identity + rendering hints for the candidate. */
153611
154086
  sourceInfo: SourceInfoSchema.optional(),
153612
- /** Nested entity-children for accordion preview — integrations populate, Hubs omit. */
154087
+ /** Nested entity-children for accordion preview — integrations populate, flat enumerations omit. */
153613
154088
  children: array(DiscoveredChildDeviceSchema).readonly().optional(),
153614
154089
  /** `childNativeId` of the gateway candidate in the same list this device sits behind. */
153615
154090
  parentStableId: string().optional()
153616
154091
  }));
153617
154092
  /**
153618
- * Status block — populated by the integration after each
153619
- * `refreshDiscovery` (or push-driven update). The runtime-state slice
153620
- * is what the panel reads via the per-device proxy; `getStatus`
153621
- * returns the same payload via the codegen'd auto-injection.
153622
- */
153623
- var DeviceDiscoveryStatusSchema = object({
153624
- discovered: array(DiscoveredChildDeviceSchema),
153625
- /** Wall-clock ms of the last successful enumeration. */
153626
- lastDiscoveryAt: number$1().int().nonnegative().nullable(),
153627
- /** Last error surfaced from the source (rendered as a banner). */
153628
- lastError: string().nullable()
153629
- });
153630
- var deviceDiscoveryCapability = {
153631
- name: "device-discovery",
153632
- scope: "device",
153633
- deviceNative: true,
153634
- mode: "singleton",
153635
- deviceTypes: [DeviceType.Hub],
153636
- status: {
153637
- schema: DeviceDiscoveryStatusSchema,
153638
- kind: "poll"
153639
- },
153640
- runtimeState: DeviceDiscoveryStatusSchema.extend({ lastFetchedAt: number$1().int().nonnegative() }),
153641
- /**
153642
- * Runtime-state durability: **session** — 5.7 KB of scan output on the largest device, fully re-derivable by re-scanning.
153643
- *
153644
- * See `RuntimeStateDurability`. Enforced by
153645
- * `scripts/check-runtime-state-durability.ts`.
153646
- */
153647
- durability: "session",
153648
- /**
153649
- * History (D850): none — inventory.
153650
- */
153651
- history: "none",
153652
- methods: {
153653
- /**
153654
- * Snapshot of the current `discovered` list. Returns the
153655
- * runtime-state cache — call `refreshDiscovery` first if a
153656
- * fresh round-trip to the source is required.
153657
- */
153658
- listDiscovered: method(object({ deviceId: number$1().int().nonnegative() }), array(DiscoveredChildDeviceSchema).readonly()),
153659
- /**
153660
- * Force the integration to re-enumerate and update the
153661
- * runtime-state slice. Returns the freshly-enumerated list (also
153662
- * available via `listDiscovered` post-call).
153663
- */
153664
- refreshDiscovery: method(object({ deviceId: number$1().int().nonnegative() }), array(DiscoveredChildDeviceSchema).readonly(), {
153665
- kind: "mutation",
153666
- auth: "admin"
153667
- }),
153668
- /**
153669
- * Promote a discovered entry to a real child device. The framework
153670
- * creates the child via `kernel.devices.create()` with
153671
- * `parentDeviceId = parent.id` and seeds the child's config from
153672
- * `childInitialConfig` (driver-defined; usually carries channel +
153673
- * uid + parent reference). Returns the kernel-assigned numeric id.
153674
- */
153675
- adoptDevice: method(object({
153676
- deviceId: number$1().int().nonnegative(),
153677
- childNativeId: string(),
153678
- /** Optional override for the child's display name. */
153679
- name: string().optional()
153680
- }), object({
153681
- deviceId: number$1().int().nonnegative(),
153682
- stableId: string()
153683
- }), {
153684
- kind: "mutation",
153685
- auth: "admin"
153686
- }),
153687
- /**
153688
- * Inverse of `adoptDevice`: removes the child device from the
153689
- * kernel registry. The discovered entry remains in the
153690
- * enumeration (status updates resume) so the operator can re-adopt
153691
- * it later without a fresh refresh.
153692
- */
153693
- releaseDevice: method(object({
153694
- deviceId: number$1().int().nonnegative(),
153695
- childDeviceId: number$1().int().nonnegative()
153696
- }), _void(), {
153697
- kind: "mutation",
153698
- auth: "admin"
153699
- })
153700
- }
153701
- };
153702
- /**
153703
- * `device-adoption` — generic discovery + adoption surface,
153704
- * system-scoped collection (one provider per integration addon), routed
153705
- * by explicit `{ addonId }` on direct `deviceAdoption.*` calls — the same
153706
- * pin model as `connection-test`. The admin UI keeps using
153707
- * `deviceManager.adoption*` (which already threads `addonId`). The de-HA-ified
153708
- * successor to `ha-discovery`:
153709
- * keyed by `integrationId` (the addon resolves integrationId → broker
153710
- * internally) rather than a connection-specific `brokerId`, and it
153711
- * REUSES the shared `DiscoveredChildDevice` candidate type from
153712
- * `device-discovery.cap.ts` so a single shared adoption panel renders
153713
- * any integration's candidate tree.
153714
- *
153715
- * UI flow (Integrations page → integration detail):
153716
- * 1. `listCandidates({integrationId, page, pageSize, filter})` →
153717
- * paginated candidate list, each row collapsed.
153718
- * 2. User expands a row → `getCandidate({integrationId,
153719
- * childNativeId})` returns the single candidate (with its nested
153720
- * `children`) for the accordion render.
153721
- * 3. User clicks "Adopt" on one or more candidates →
153722
- * `adopt({integrationId, childNativeIds, perCandidate?})`
153723
- * materialises one parent CamStack device per candidate plus its
153724
- * accessory children. `perCandidate[childNativeId]` carries an
153725
- * optional display-name override + a `hiddenChildIds` pre-hide set
153726
- * (the parent's `accessories.hiddenChildIds` gates UI visibility).
153727
- * 4. User clicks "Release" → `release({integrationId, camDeviceId})`
153728
- * removes the parent + every child from the kernel registry.
153729
- */
153730
- /**
153731
154093
  * Provider-declared discovery *granularity* filter (the keystone of the
153732
154094
  * single-entity-import design). A provider advertises which discovery
153733
154095
  * granularities it supports via `listCandidateFilters`; the operator picks
@@ -154086,6 +154448,59 @@ method(InstancePinSchema, DeviceExportStatusSchema), method(_void(), array(Expor
154086
154448
  auth: "admin"
154087
154449
  });
154088
154450
  var DeviceAliasSchema = string().max(64).regex(/^[a-z][a-z0-9_]*$/);
154451
+ var DeviceTemplateSchema = string().min(1).max(4096);
154452
+ /** One value a caller hands the renderer for `thisDevice`. */
154453
+ var DeviceTemplateValueSchema = union([
154454
+ string(),
154455
+ number$1(),
154456
+ boolean()
154457
+ ]);
154458
+ /**
154459
+ * The device a render is FOR (`camera` in the text) and the values the caller
154460
+ * knows about it that no capability carries, for example `lastPerson` and
154461
+ * `lastPlate`. `values` read as `camera.<name>`; a name a capability also carries
154462
+ * is `ambiguous` and is written `camera.values.<name>`.
154463
+ */
154464
+ var DeviceTemplateThisDeviceSchema = object({
154465
+ deviceId: number$1().int(),
154466
+ values: record(string().min(1).max(64), DeviceTemplateValueSchema).optional()
154467
+ });
154468
+ var DeviceTemplateRefusalSchema = object({
154469
+ reason: _enum([
154470
+ "too-long",
154471
+ "syntax",
154472
+ "forbidden-syntax",
154473
+ "forbidden-member",
154474
+ "unknown-filter",
154475
+ "ambiguous-field",
154476
+ "busy",
154477
+ "budget-exceeded",
154478
+ "timeout",
154479
+ "output-too-large",
154480
+ "render-failed",
154481
+ "out-of-scope",
154482
+ "unavailable"
154483
+ ]),
154484
+ message: string()
154485
+ });
154486
+ var DeviceTemplateTraceEntrySchema = object({
154487
+ ref: string(),
154488
+ reason: _enum([
154489
+ "unknown-alias",
154490
+ "unknown-field",
154491
+ "no-field",
154492
+ "unavailable"
154493
+ ])
154494
+ });
154495
+ var DeviceTemplateRenderSchema = discriminatedUnion("ok", [object({
154496
+ ok: literal(true),
154497
+ text: string(),
154498
+ trace: array(DeviceTemplateTraceEntrySchema)
154499
+ }), object({
154500
+ ok: literal(false),
154501
+ refusal: DeviceTemplateRefusalSchema,
154502
+ trace: array(DeviceTemplateTraceEntrySchema)
154503
+ })]);
154089
154504
  /**
154090
154505
  * A SITE ZONE — a named part of the property that several locations belong to.
154091
154506
  *
@@ -154135,6 +154550,90 @@ var SiteZoneSchema = object({
154135
154550
  * the ones that most want grouping. */
154136
154551
  locationKeys: array(string())
154137
154552
  });
154553
+ var DeviceSearchRequiresSchema = object({
154554
+ /** Capability names the field wants a value of. */
154555
+ caps: array(string()).readonly(),
154556
+ /** `any` (default): a device with one of them is compatible. `all`: it must hold every one. */
154557
+ mode: _enum(["any", "all"]).optional()
154558
+ });
154559
+ var DeviceSearchFiltersSchema = object({
154560
+ locations: array(string()).readonly().optional(),
154561
+ integrationIds: array(string()).readonly().optional(),
154562
+ types: array(string()).readonly().optional()
154563
+ });
154564
+ var DeviceSearchInputSchema = object({
154565
+ /** Matches name, location, type, integration (id and label) and id. Case-insensitive. */
154566
+ text: string().optional(),
154567
+ requires: DeviceSearchRequiresSchema.optional(),
154568
+ filters: DeviceSearchFiltersSchema.optional(),
154569
+ /** List the devices that do not provide the required cap too (greyed, not pickable). */
154570
+ includeIncompatible: boolean().optional(),
154571
+ /** The device the field belongs to: its location drives `suggested`. */
154572
+ contextDeviceId: number$1().optional(),
154573
+ /**
154574
+ * Resolve exactly these devices, regardless of every filter, so a picked
154575
+ * value can be rendered. When given, `items` is these devices in the order
154576
+ * asked (no paging, `nextCursor` null) and the ones that do not exist are
154577
+ * listed in `missingIds`.
154578
+ */
154579
+ ids: array(number$1()).readonly().optional(),
154580
+ cursor: string().nullable().optional(),
154581
+ limit: number$1().int().min(1).max(200).optional()
154582
+ });
154583
+ var DeviceValueOptionSchema = object({
154584
+ cap: string(),
154585
+ /** Status-schema field path inside the cap (same paths as `getWireableFields`). */
154586
+ path: string(),
154587
+ label: string(),
154588
+ /** The current value as text; `null` when it is unknown or the read FAILED — never `0`. */
154589
+ reading: string().nullable(),
154590
+ unit: string().nullable().optional(),
154591
+ /** The field's measured quantity, when the cap declares one, so a client can format the reading. */
154592
+ quantity: ReadingQuantitySchema.optional()
154593
+ });
154594
+ var DeviceSearchItemSchema = object({
154595
+ id: number$1(),
154596
+ name: string(),
154597
+ type: _enum(DeviceType),
154598
+ location: string().nullable(),
154599
+ integrationId: string().nullable(),
154600
+ integrationLabel: string().nullable(),
154601
+ online: boolean().nullable(),
154602
+ disabled: boolean(),
154603
+ compatible: boolean(),
154604
+ /** Only the required caps' fields; empty when nothing was required or the device is incompatible. */
154605
+ values: array(DeviceValueOptionSchema).readonly()
154606
+ });
154607
+ var DeviceSearchFacetValueSchema = object({
154608
+ value: string(),
154609
+ count: number$1()
154610
+ });
154611
+ var DeviceSearchFacetIntegrationSchema = object({
154612
+ id: string(),
154613
+ label: string(),
154614
+ count: number$1()
154615
+ });
154616
+ var DeviceSearchFacetsSchema = object({
154617
+ locations: array(DeviceSearchFacetValueSchema).readonly(),
154618
+ integrations: array(DeviceSearchFacetIntegrationSchema).readonly(),
154619
+ types: array(DeviceSearchFacetValueSchema).readonly()
154620
+ });
154621
+ var DeviceSearchResultSchema = object({
154622
+ items: array(DeviceSearchItemSchema).readonly(),
154623
+ nextCursor: string().nullable(),
154624
+ /** Devices listed by this query across all pages (filters + text applied; incompatible counted only when `includeIncompatible`). */
154625
+ total: number$1(),
154626
+ /** Compatible devices after filters + text. */
154627
+ compatibleTotal: number$1(),
154628
+ /** Every device the caller's fleet holds, before anything is applied. */
154629
+ fleetTotal: number$1(),
154630
+ /** Incompatible devices after filters + text — the K of "show the K that don't". */
154631
+ hiddenIncompatible: number$1(),
154632
+ facets: DeviceSearchFacetsSchema,
154633
+ /** Same location as `contextDeviceId`; first page only. */
154634
+ suggested: array(DeviceSearchItemSchema).readonly(),
154635
+ missingIds: array(number$1()).readonly()
154636
+ });
154138
154637
  var ProviderStatusSchema = object({
154139
154638
  connected: boolean(),
154140
154639
  deviceCount: number$1(),
@@ -154620,6 +155119,9 @@ var DeviceInfoSchema = object({
154620
155119
  * named accordion sections (with optional intra-section order). See
154621
155120
  * `DeviceMeta.childLayout`. Absent ⇒ no layout declared. */
154622
155121
  childLayout: array(ChildLayoutEntrySchema).readonly().optional(),
155122
+ /** The children a container stands for, most preferred first, by accessory
155123
+ * `childKey`. Provider-declared. See `DeviceMeta.primaryChildPreference`. */
155124
+ primaryChildPreference: array(string()).readonly().optional(),
154623
155125
  /** Operator-authored per-device display override. See `DeviceMeta.display`. */
154624
155126
  display: DeviceDisplayOverrideSchema.optional()
154625
155127
  });
@@ -154681,7 +155183,9 @@ var DeviceBindingsForDeviceSchema = object({
154681
155183
  kind: _enum(["native", "wrapped"]),
154682
155184
  providerAddonId: string(),
154683
155185
  providerNodeId: string(),
154684
- nativeAddonId: string()
155186
+ nativeAddonId: string(),
155187
+ /** The cap's methods the native provider implements; absent = all. */
155188
+ implementedMethods: array(string()).optional()
154685
155189
  }))
154686
155190
  });
154687
155191
  /**
@@ -154766,6 +155270,9 @@ var DeviceMetaSchema = object({
154766
155270
  * accordion sections (with optional intra-section order). See
154767
155271
  * `DeviceMeta.childLayout`. Absent ⇒ no layout declared. */
154768
155272
  childLayout: array(ChildLayoutEntrySchema).readonly().optional(),
155273
+ /** The children a container stands for, most preferred first, by accessory
155274
+ * `childKey`. Provider-declared. See `DeviceMeta.primaryChildPreference`. */
155275
+ primaryChildPreference: array(string()).readonly().optional(),
154769
155276
  /** Semantic role string (`DeviceRole`) — propagated from the spawn pre-seed.
154770
155277
  * Optional: only present for accessory children that carry a known role. */
154771
155278
  role: string().nullable().optional(),
@@ -154893,7 +155400,13 @@ method(object({
154893
155400
  auth: "admin"
154894
155401
  }), 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({
154895
155402
  deviceId: number$1(),
154896
- name: string()
155403
+ name: string(),
155404
+ /**
155405
+ * Absent or true: an operator rename, which stamps `userNamed`.
155406
+ * False: the system copying a block name onto the device. That write
155407
+ * must not look like the operator's, or the next reconcile freezes it.
155408
+ */
155409
+ stampUserNamed: boolean().optional()
154897
155410
  }), _void(), {
154898
155411
  kind: "mutation",
154899
155412
  auth: "admin"
@@ -154917,6 +155430,29 @@ method(object({
154917
155430
  kind: "mutation",
154918
155431
  auth: "admin"
154919
155432
  }), method(object({
155433
+ templates: array(DeviceTemplateSchema).max(64),
155434
+ allowedDeviceIds: array(number$1().int()).optional(),
155435
+ /** The device `camera` names in the texts, and the values the caller knows of it. */
155436
+ thisDevice: DeviceTemplateThisDeviceSchema.optional()
155437
+ }), object({ results: array(DeviceTemplateRenderSchema) }), { auth: "admin" }), method(object({
155438
+ templates: array(string()).max(64),
155439
+ allowedDeviceIds: array(number$1().int()).optional(),
155440
+ thisDevice: DeviceTemplateThisDeviceSchema.optional()
155441
+ }), object({ results: array(discriminatedUnion("ok", [object({
155442
+ ok: literal(true),
155443
+ aliases: array(object({
155444
+ alias: string(),
155445
+ deviceId: number$1().int().nullable(),
155446
+ allowed: boolean(),
155447
+ /** The fields the text reads on this alias, as written (`temperature`, `cap.field`). */
155448
+ reads: array(string())
155449
+ })),
155450
+ /** Whether the text reads the clock (`now`): it changes every minute. */
155451
+ readsClock: boolean()
155452
+ }), object({
155453
+ ok: literal(false),
155454
+ refusal: DeviceTemplateRefusalSchema
155455
+ })])) }), { auth: "admin" }), method(object({
154920
155456
  deviceId: number$1(),
154921
155457
  location: string().nullable()
154922
155458
  }), _void(), {
@@ -154952,6 +155488,12 @@ method(object({
154952
155488
  }), _void(), {
154953
155489
  kind: "mutation",
154954
155490
  auth: "admin"
155491
+ }), method(object({
155492
+ deviceId: number$1(),
155493
+ primaryChildPreference: array(string()).readonly()
155494
+ }), _void(), {
155495
+ kind: "mutation",
155496
+ auth: "admin"
154955
155497
  }), method(object({
154956
155498
  deviceId: number$1(),
154957
155499
  display: DeviceDisplayOverrideSchema.nullable()
@@ -155089,7 +155631,7 @@ method(object({
155089
155631
  * it answers today and the caller filters as it already does.
155090
155632
  */
155091
155633
  deviceIds: array(number$1()).optional()
155092
- }), 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({
155634
+ }), 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({
155093
155635
  mode: LinkedDevicesModeSchema,
155094
155636
  devices: array(LinkedDeviceSchema)
155095
155637
  }), { 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({
@@ -157666,28 +158208,28 @@ var fanControlCapability = {
157666
158208
  mode: "singleton",
157667
158209
  deviceTypes: [DeviceType.Fan],
157668
158210
  methods: {
157669
- setPercentage: method(object({
158211
+ setPercentage: optionalMethod(object({
157670
158212
  deviceId: number$1().int().nonnegative(),
157671
158213
  speed: number$1().min(0).max(100)
157672
158214
  }), _void(), {
157673
158215
  kind: "mutation",
157674
158216
  auth: "protected"
157675
158217
  }),
157676
- setPreset: method(object({
158218
+ setPreset: optionalMethod(object({
157677
158219
  deviceId: number$1().int().nonnegative(),
157678
158220
  preset: string().min(1)
157679
158221
  }), _void(), {
157680
158222
  kind: "mutation",
157681
158223
  auth: "protected"
157682
158224
  }),
157683
- setDirection: method(object({
158225
+ setDirection: optionalMethod(object({
157684
158226
  deviceId: number$1().int().nonnegative(),
157685
158227
  direction: FanDirectionSchema
157686
158228
  }), _void(), {
157687
158229
  kind: "mutation",
157688
158230
  auth: "protected"
157689
158231
  }),
157690
- setOscillating: method(object({
158232
+ setOscillating: optionalMethod(object({
157691
158233
  deviceId: number$1().int().nonnegative(),
157692
158234
  oscillating: boolean()
157693
158235
  }), _void(), {
@@ -158139,6 +158681,305 @@ var groupStatusCapability = {
158139
158681
  durability: "session",
158140
158682
  history: "none"
158141
158683
  };
158684
+ /**
158685
+ * Heat pump settable surface (D1026): one typed method per parameter, never a
158686
+ * generic `set(key, value)`. The values a mode takes and the limits of a number
158687
+ * are the ones `heat-pump-status` carries (`allowed`, `min`, `max`, `step`),
158688
+ * read from the gateway; a provider refuses a value outside them. The state is
158689
+ * `heat-pump-status` — this cap has none.
158690
+ */
158691
+ var deviceId = number$1().int().nonnegative();
158692
+ var circuitId = string().min(1);
158693
+ var mode = string().min(1);
158694
+ var temp = number$1().finite();
158695
+ DeviceType.HeatPump, method(object({
158696
+ deviceId,
158697
+ mode
158698
+ }), _void(), {
158699
+ kind: "mutation",
158700
+ auth: "protected"
158701
+ }), method(object({
158702
+ deviceId,
158703
+ mode
158704
+ }), _void(), {
158705
+ kind: "mutation",
158706
+ auth: "protected"
158707
+ }), method(object({
158708
+ deviceId,
158709
+ mode
158710
+ }), _void(), {
158711
+ kind: "mutation",
158712
+ auth: "protected"
158713
+ }), method(object({
158714
+ deviceId,
158715
+ mode
158716
+ }), _void(), {
158717
+ kind: "mutation",
158718
+ auth: "protected"
158719
+ }), method(object({
158720
+ deviceId,
158721
+ circuitId,
158722
+ mode
158723
+ }), _void(), {
158724
+ kind: "mutation",
158725
+ auth: "protected"
158726
+ }), method(object({
158727
+ deviceId,
158728
+ circuitId,
158729
+ mode
158730
+ }), _void(), {
158731
+ kind: "mutation",
158732
+ auth: "protected"
158733
+ }), method(object({
158734
+ deviceId,
158735
+ circuitId,
158736
+ mode
158737
+ }), _void(), {
158738
+ kind: "mutation",
158739
+ auth: "protected"
158740
+ }), method(object({
158741
+ deviceId,
158742
+ circuitId,
158743
+ temp
158744
+ }), _void(), {
158745
+ kind: "mutation",
158746
+ auth: "protected"
158747
+ }), method(object({
158748
+ deviceId,
158749
+ circuitId,
158750
+ temp
158751
+ }), _void(), {
158752
+ kind: "mutation",
158753
+ auth: "protected"
158754
+ }), method(object({
158755
+ deviceId,
158756
+ circuitId,
158757
+ temp
158758
+ }), _void(), {
158759
+ kind: "mutation",
158760
+ auth: "protected"
158761
+ }), method(object({
158762
+ deviceId,
158763
+ circuitId,
158764
+ mode
158765
+ }), _void(), {
158766
+ kind: "mutation",
158767
+ auth: "protected"
158768
+ }), method(object({
158769
+ deviceId,
158770
+ circuitId,
158771
+ level: mode
158772
+ }), _void(), {
158773
+ kind: "mutation",
158774
+ auth: "protected"
158775
+ }), method(object({
158776
+ deviceId,
158777
+ circuitId,
158778
+ minutes: number$1().int().positive()
158779
+ }), _void(), {
158780
+ kind: "mutation",
158781
+ auth: "protected"
158782
+ }), method(object({
158783
+ deviceId,
158784
+ circuitId
158785
+ }), _void(), {
158786
+ kind: "mutation",
158787
+ auth: "protected"
158788
+ });
158789
+ var HeatPumpCircuitKindSchema = _enum([
158790
+ "heating",
158791
+ "dhw",
158792
+ "cooling",
158793
+ "solar"
158794
+ ]);
158795
+ /** A setting that takes one of a list of values the gateway named. */
158796
+ var HeatPumpOptionSettingSchema = object({
158797
+ /** The active value. Null when the gateway did not answer. */
158798
+ value: string().nullable(),
158799
+ /** Values the gateway accepts, in its order. Empty = read-only here. */
158800
+ allowed: array(string())
158801
+ });
158802
+ /** A numeric setting with the limits the gateway named. */
158803
+ var HeatPumpRangeSettingSchema = object({
158804
+ value: number$1().nullable(),
158805
+ min: number$1().nullable(),
158806
+ max: number$1().nullable(),
158807
+ step: number$1().nullable()
158808
+ });
158809
+ var HeatPumpCircuitSchema = object({
158810
+ /** Gateway id of the circuit (`hc1`, `dhw1`): the key of the series. */
158811
+ id: string().min(1),
158812
+ kind: HeatPumpCircuitKindSchema,
158813
+ label: string(),
158814
+ icon: IconKeySchema,
158815
+ /** Measured temperature of the circuit (room, tank, collector). */
158816
+ currentTemp: number$1().nullable().meta(readingMeta("temperature")),
158817
+ /** The setpoint in force now. */
158818
+ targetTemp: number$1().nullable().meta(readingMeta("temperature")),
158819
+ /** The operation mode in force (mirror of `operationMode.value`, for the series). */
158820
+ mode: string().nullable(),
158821
+ /** Whether the circuit is calling for heat right now. Null = unknown. */
158822
+ active: boolean().nullable(),
158823
+ operationMode: HeatPumpOptionSettingSchema.nullable(),
158824
+ /** Heating circuits: heat / cool / heatCool. */
158825
+ heatCoolMode: HeatPumpOptionSettingSchema.nullable(),
158826
+ /** Heating circuits: summer / winter changeover. */
158827
+ summerWinter: HeatPumpOptionSettingSchema.nullable(),
158828
+ comfortSetpoint: HeatPumpRangeSettingSchema.nullable(),
158829
+ ecoSetpoint: HeatPumpRangeSettingSchema.nullable(),
158830
+ maxFlowTemp: HeatPumpRangeSettingSchema.nullable(),
158831
+ /** Hot water: the temperature level (off / low / high / eco). */
158832
+ temperatureLevel: HeatPumpOptionSettingSchema.nullable(),
158833
+ /** Hot water: how long a charge lasts, minutes. */
158834
+ chargeDuration: HeatPumpRangeSettingSchema.nullable(),
158835
+ /** Hot water: whether an extra-hot-water charge is running. Null = no such surface. */
158836
+ extraHotWater: boolean().nullable()
158837
+ });
158838
+ /** The independent system modes, each with its real values. A null mode = the gateway has none. */
158839
+ var HeatPumpSystemSchema = object({
158840
+ silent: HeatPumpOptionSettingSchema.nullable(),
158841
+ away: HeatPumpOptionSettingSchema.nullable(),
158842
+ additionalHeater: HeatPumpOptionSettingSchema.nullable(),
158843
+ holiday: HeatPumpOptionSettingSchema.nullable()
158844
+ });
158845
+ var HeatPumpPowerSchema = object({
158846
+ thermalW: number$1().nullable().meta(readingMeta("power")),
158847
+ electricalW: number$1().nullable().meta(readingMeta("power")),
158848
+ /** Compressor modulation, percent. */
158849
+ compressorPct: number$1().nullable().meta(readingMeta("percentage"))
158850
+ });
158851
+ var HeatPumpTemperaturesSchema = object({
158852
+ supply: number$1().nullable().meta(readingMeta("temperature")),
158853
+ return: number$1().nullable().meta(readingMeta("temperature")),
158854
+ outdoor: number$1().nullable().meta(readingMeta("temperature"))
158855
+ });
158856
+ /** Lifetime meters, kWh: the energy of a period is computed at read time from their difference (D944). */
158857
+ var HeatPumpEnergySchema = object({
158858
+ thermalKwh: number$1().nullable().meta(readingMeta("energy")),
158859
+ electricalKwh: number$1().nullable().meta(readingMeta("energy"))
158860
+ });
158861
+ var HeatPumpStatusSchema = object({
158862
+ circuits: array(HeatPumpCircuitSchema),
158863
+ system: HeatPumpSystemSchema,
158864
+ power: HeatPumpPowerSchema,
158865
+ temperatures: HeatPumpTemperaturesSchema,
158866
+ energy: HeatPumpEnergySchema,
158867
+ /** Water pressure of the heating loop, bar. */
158868
+ waterPressureBar: number$1().nullable(),
158869
+ /** Compressor starts since commissioning. */
158870
+ starts: number$1().nullable(),
158871
+ /** Ms epoch when the slice was last read from the gateway. */
158872
+ lastFetchedAt: number$1()
158873
+ });
158874
+ /**
158875
+ * The instantaneous COP: thermal over electrical power. Null unless BOTH powers
158876
+ * are known and the unit draws power — a missing reading is never a 0 or a
158877
+ * division by it (D393). Computed on every read; there is no stored value.
158878
+ */
158879
+ function heatPumpInstantCop(power) {
158880
+ const { thermalW, electricalW } = power;
158881
+ if (thermalW === null || electricalW === null || electricalW <= 0) return null;
158882
+ return thermalW / electricalW;
158883
+ }
158884
+ var heatPumpStatusCapability = {
158885
+ name: "heat-pump-status",
158886
+ scope: "device",
158887
+ deviceNative: true,
158888
+ mode: "singleton",
158889
+ deviceTypes: [DeviceType.HeatPump],
158890
+ methods: {},
158891
+ status: {
158892
+ schema: HeatPumpStatusSchema,
158893
+ kind: "push"
158894
+ },
158895
+ runtimeState: HeatPumpStatusSchema,
158896
+ /**
158897
+ * Runtime-state durability: **session** — a heat pump's gateway answers on the
158898
+ * next poll, so a restart that clears the slice loses nothing a reader needs
158899
+ * (the series are recorded). See `RuntimeStateDurability`.
158900
+ */
158901
+ durability: "session",
158902
+ /**
158903
+ * History (D850, D917): `circuits[]` is a keyed array — one series per circuit and
158904
+ * field, named by the circuit's label. The mode is a state (D896); the energy
158905
+ * totals are lifetime counters, the kWh of a period is computed at read time (D944).
158906
+ * The COP is never recorded: it derives from the two powers.
158907
+ */
158908
+ history: {
158909
+ fields: {
158910
+ "power.thermalW": {
158911
+ kind: "gauge",
158912
+ unit: "W",
158913
+ deadband: 50,
158914
+ displayName: "Thermal power"
158915
+ },
158916
+ "power.electricalW": {
158917
+ kind: "gauge",
158918
+ unit: "W",
158919
+ deadband: 50,
158920
+ displayName: "Electrical power"
158921
+ },
158922
+ "power.compressorPct": {
158923
+ kind: "gauge",
158924
+ unit: "%",
158925
+ deadband: 2,
158926
+ displayName: "Compressor"
158927
+ },
158928
+ "temperatures.supply": {
158929
+ kind: "gauge",
158930
+ unit: "°C",
158931
+ deadband: .5,
158932
+ displayName: "Supply"
158933
+ },
158934
+ "temperatures.return": {
158935
+ kind: "gauge",
158936
+ unit: "°C",
158937
+ deadband: .5,
158938
+ displayName: "Return"
158939
+ },
158940
+ "temperatures.outdoor": {
158941
+ kind: "gauge",
158942
+ unit: "°C",
158943
+ deadband: .5,
158944
+ displayName: "Outdoor"
158945
+ },
158946
+ "energy.thermalKwh": {
158947
+ kind: "counter",
158948
+ unit: "kWh",
158949
+ displayName: "Thermal energy"
158950
+ },
158951
+ "energy.electricalKwh": {
158952
+ kind: "counter",
158953
+ unit: "kWh",
158954
+ displayName: "Electrical energy"
158955
+ }
158956
+ },
158957
+ items: {
158958
+ path: "circuits",
158959
+ key: "id",
158960
+ label: "label",
158961
+ fields: {
158962
+ currentTemp: {
158963
+ kind: "gauge",
158964
+ unit: "°C",
158965
+ deadband: .5,
158966
+ displayName: "Temperature"
158967
+ },
158968
+ targetTemp: {
158969
+ kind: "gauge",
158970
+ unit: "°C",
158971
+ minIntervalMs: 0,
158972
+ displayName: "Setpoint"
158973
+ },
158974
+ mode: {
158975
+ kind: "enum",
158976
+ displayName: "Mode"
158977
+ }
158978
+ }
158979
+ }
158980
+ },
158981
+ volatileStateFields: ["lastFetchedAt"]
158982
+ };
158142
158983
  var HeatingValveStatusSchema = object({
158143
158984
  /** Radiator valve opening 0 (closed) .. 100 (open). Null = not yet known. */
158144
158985
  position: number$1().min(0).max(100).nullable().meta(readingMeta("percentage")),
@@ -158353,6 +159194,7 @@ var HeroSceneSchema = object({
158353
159194
  "ac",
158354
159195
  "thermostat",
158355
159196
  "heater",
159197
+ "heat-pump",
158356
159198
  "fan",
158357
159199
  "washer",
158358
159200
  "dryer",
@@ -158395,7 +159237,7 @@ var HeroSceneSchema = object({
158395
159237
  /** 0..1: volume, cover position, cycle progress. */
158396
159238
  level: number$1().min(0).max(1).nullable()
158397
159239
  });
158398
- 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;
159240
+ 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;
158399
159241
  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;
158400
159242
  /** A string in both languages, as the cap vocabulary writes it (D920): no `t()` in the model. */
158401
159243
  var HeroTextSchema = object({
@@ -158403,6 +159245,7 @@ var HeroTextSchema = object({
158403
159245
  it: string()
158404
159246
  });
158405
159247
  var HeroRowIdSchema = _enum([
159248
+ "progress",
158406
159249
  "run-for",
158407
159250
  "cycle",
158408
159251
  "program",
@@ -158417,6 +159260,7 @@ var HeroRowIdSchema = _enum([
158417
159260
  "alarm",
158418
159261
  "fan",
158419
159262
  "vacuum",
159263
+ "vacuum-suction",
158420
159264
  "mower",
158421
159265
  "feeder",
158422
159266
  "fountain",
@@ -158435,7 +159279,10 @@ var HeroRowIdSchema = _enum([
158435
159279
  "climate-fan",
158436
159280
  "setpoint",
158437
159281
  "channel",
158438
- "control"
159282
+ "control",
159283
+ "circuit",
159284
+ "heat-pump-power",
159285
+ "system-mode"
158439
159286
  ]);
158440
159287
  var HeroArgValueSchema = lazy(() => union([
158441
159288
  string(),
@@ -158457,13 +159304,11 @@ var HeroConfirmSchema = _enum([
158457
159304
  "press"
158458
159305
  ]);
158459
159306
  var HeroActionSchema = object({
158460
- /** Unique within the model; the `gated` list and the specs name it. */
158461
159307
  id: string(),
158462
159308
  label: HeroTextSchema,
158463
159309
  icon: IconKeySchema,
158464
159310
  call: HeroCallSchema,
158465
159311
  emphasis: _enum(["primary", "normal"]),
158466
- /** Ask before running it. */
158467
159312
  confirm: HeroConfirmSchema.nullable()
158468
159313
  });
158469
159314
  var HeroControlSchema = discriminatedUnion("kind", [
@@ -158500,16 +159345,34 @@ var HeroControlSchema = discriminatedUnion("kind", [
158500
159345
  label: HeroTextSchema,
158501
159346
  current: string().nullable(),
158502
159347
  options: array(string()),
159348
+ /** A readable label per option value; an option without one is drawn as its raw value. */
159349
+ optionLabels: record(string(), HeroTextSchema).optional(),
158503
159350
  call: HeroCallSchema,
158504
159351
  valueArg: string()
158505
159352
  })
158506
159353
  ]);
159354
+ /** Declared by its interface: a `z.infer` of one more icon union pushes the cap's inferred type past what the compiler can print. */
159355
+ var HeroPillSchema = object({
159356
+ icon: IconKeySchema.nullable(),
159357
+ text: HeroTextSchema,
159358
+ tone: HeroToneSchema
159359
+ });
158507
159360
  var HeroRowSchema = object({
158508
159361
  id: HeroRowIdSchema,
159362
+ /** `scene`: the row's action and slider controls are drawn on the scene. Absent: an ordinary row. */
159363
+ placement: _enum(["row", "scene"]).optional(),
159364
+ /** The row's own name when the kind's label would not tell rows of one kind apart (a circuit's label). */
159365
+ label: HeroTextSchema.optional(),
159366
+ /** A group header drawn above the row when it differs from the previous row's ("System"). */
159367
+ group: HeroTextSchema.optional(),
159368
+ /** Values drawn as pills across the row (a heat pump's powers). */
159369
+ pills: array(HeroPillSchema).optional(),
158509
159370
  icon: IconKeySchema,
158510
159371
  /** The row's status, in words. `null` = nothing to say. */
158511
159372
  status: HeroTextSchema.nullable(),
158512
- controls: array(HeroControlSchema)
159373
+ controls: array(HeroControlSchema),
159374
+ /** A bar under the row's label, 0..1; `null` / absent = no bar. */
159375
+ progress: number$1().min(0).max(1).nullable().optional()
158513
159376
  });
158514
159377
  var HeroDetailSchema = object({
158515
159378
  label: HeroTextSchema,
@@ -158517,16 +159380,27 @@ var HeroDetailSchema = object({
158517
159380
  unit: string().nullable()
158518
159381
  });
158519
159382
  var HeroBadgeSchema = object({
158520
- id: _enum(["battery", "network-link"]),
159383
+ id: _enum([
159384
+ "battery",
159385
+ "network-link",
159386
+ "integration"
159387
+ ]),
158521
159388
  icon: IconKeySchema,
158522
159389
  tone: HeroToneSchema,
158523
159390
  /** Percent for a battery, link quality for a link; `null` = not known. */
158524
159391
  value: number$1().nullable(),
158525
159392
  label: HeroTextSchema
158526
159393
  });
158527
- var HeroRemoteSlotSchema = object({
158528
- /** Saved commands; `null` = not known yet (the button still shows). */
158529
- commands: number$1().int().nullable() });
159394
+ var HeroRemoteSlotSchema = object({
159395
+ /** Saved commands; `null` = not known yet (the button still shows). */
159396
+ commands: number$1().int().nullable(),
159397
+ /**
159398
+ * The control a list row draws as the "open the remote" icon. Recognised by its id
159399
+ * ({@link REMOTE_OPEN_ACTION_ID}); it changes no state, so a client opens the remote
159400
+ * instead of running `call`. Absent on a model from an older server.
159401
+ */
159402
+ open: HeroActionSchema.optional()
159403
+ });
158530
159404
  var HeroConsumablesSlotSchema = object({
158531
159405
  items: array(object({
158532
159406
  key: string(),
@@ -158565,7 +159439,13 @@ var HeroTimedRunSlotSchema = object({
158565
159439
  activeUntil: number$1().nullable(),
158566
159440
  quickRun: TimedRunQuickRunSchema,
158567
159441
  run: HeroActionSchema,
158568
- cancel: HeroActionSchema
159442
+ cancel: HeroActionSchema,
159443
+ /**
159444
+ * Whole units left (the limit's unit, ceil). `null` while nothing is armed.
159445
+ * A number, not words: the row formats it, and a text here would not fit the
159446
+ * hero-layout declaration.
159447
+ */
159448
+ remaining: number$1().nullable()
158569
159449
  });
158570
159450
  var HeroPowerSupplySlotSchema = object({
158571
159451
  /** The plug's state; `null` = unknown, never off. */
@@ -158617,7 +159497,12 @@ var HeroFactSchema = object({
158617
159497
  var HeroSideTileSchema = object({
158618
159498
  label: HeroTextSchema,
158619
159499
  value: HeroTextSchema,
158620
- tone: HeroToneSchema.optional()
159500
+ tone: HeroToneSchema.optional(),
159501
+ /**
159502
+ * Epoch ms when the tile reads a clock time (an appliance's end): a client prints it in
159503
+ * the viewer's own time zone; `value` is the fallback for one that cannot.
159504
+ */
159505
+ at: number$1().optional()
158621
159506
  });
158622
159507
  var HeroSideTilesSchema = object({
158623
159508
  left: array(HeroSideTileSchema).max(2),
@@ -158653,8 +159538,12 @@ var HeroModelSchema = object({
158653
159538
  sideTiles: HeroSideTilesSchema,
158654
159539
  /** The status line under the main icon. */
158655
159540
  title: HeroTextSchema,
159541
+ /** The scene's top line when it says more than `title`; absent = draw the title. */
159542
+ caption: HeroTextSchema.optional(),
158656
159543
  badges: array(HeroBadgeSchema),
158657
159544
  remote: HeroRemoteSlotSchema.nullable(),
159545
+ /** The foot button that opens the device's history: "History", "Cycles", "Meals", "Access". */
159546
+ historyLabel: HeroTextSchema,
158658
159547
  consumables: HeroConsumablesSlotSchema.nullable(),
158659
159548
  consumption: HeroConsumptionSlotSchema.nullable(),
158660
159549
  ownPower: HeroOwnPowerSlotSchema.nullable(),
@@ -158675,18 +159564,40 @@ var HeroModelSchema = object({
158675
159564
  * 4. a trailing fact (power, else battery, else consumables).
158676
159565
  *
158677
159566
  * Selection rules, all taken from the model:
158678
- * - ONE control is ever shown: the device's own power; else the FIRST control of
159567
+ * - the primary control is the device's own power; else the FIRST control of
158679
159568
  * the FIRST row that has any (a later row's control is never promoted). When
158680
159569
  * the model lists that part in `gated`, the row has no inline control: the
158681
159570
  * projection never falls through to another control the caller could use.
159571
+ * - a climate or thermostat row's primary is its `climate.mode` control (no power
159572
+ * toggle: "off" is a mode); when the model gates it the rule above applies as before;
159573
+ * - a timed run, when the model carries the slot, sits beside that primary:
159574
+ * Run while idle, Stop while armed. Gating the slot hides the control.
158682
159575
  * - the status line is the head (what plays, else the state) plus at most
158683
- * {@link ROW_STATUS_FACTS_MAX} facts, the trailing fact excluded;
159576
+ * {@link ROW_STATUS_FACTS_MAX} facts, the trailing fact excluded, then the
159577
+ * time left on an armed timed run;
158684
159578
  * - the trailing fact is the first of power, battery, consumables.
158685
159579
  *
159580
+ * - `extras` are the further inline controls of the types that carry more than one
159581
+ * ({@link ROW_EXTRAS_BY_TYPE}): climate setpoint, a robot's return to base,
159582
+ * a player's volume and remote. Each is a control the model already has, named by id,
159583
+ * in that order and at most {@link ROW_EXTRAS_MAX}; one the model lacks, or lists in
159584
+ * `gated`, is absent, and the one `primary` already is never repeats. Empty = the
159585
+ * row of an older server: `primary` alone.
159586
+ *
158686
159587
  * `projectDeviceRow` is pure and computes nothing: it selects from a
158687
159588
  * {@link HeroModel}. A row that needed a value the hero lacks would mean the
158688
159589
  * model is missing it, so the fix goes in the model.
158689
159590
  */
159591
+ /**
159592
+ * The row's timed-run control. `id` is `timed-run.run` while idle and
159593
+ * `timed-run.cancel` while armed; `duration` and `unit` are the one-tap run
159594
+ * a Run press starts.
159595
+ */
159596
+ var HeroRowTimedRunSchema = object({
159597
+ id: _enum(["timed-run.run", "timed-run.cancel"]),
159598
+ duration: number$1(),
159599
+ unit: _enum(["min", "s"])
159600
+ });
158690
159601
  var HeroRowModelSchema = object({
158691
159602
  deviceId: number$1().int(),
158692
159603
  name: string(),
@@ -158699,8 +159610,21 @@ var HeroRowModelSchema = object({
158699
159610
  statusLine: array(HeroTextSchema),
158700
159611
  /** `null` = the type has no inline control, or the caller may not act on it. */
158701
159612
  primary: HeroControlSchema.nullable(),
159613
+ /**
159614
+ * Beside `primary` when the device offers a timed run: Run while idle, Stop
159615
+ * while armed. `null` when there is no slot, or the caller may not act.
159616
+ */
159617
+ timedRun: HeroRowTimedRunSchema.nullable(),
159618
+ /**
159619
+ * The further inline controls after `primary`, in order (see the header). The remote
159620
+ * is an `action` with id `remote.open`: the client opens the remote, it does not run
159621
+ * the call. Absent or empty = `primary` alone.
159622
+ */
159623
+ extras: array(HeroControlSchema).max(2).optional(),
158702
159624
  trailing: HeroFactSchema.nullable()
158703
159625
  });
159626
+ DeviceType.Climate, DeviceType.Thermostat;
159627
+ DeviceType.Climate, DeviceType.Thermostat, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.MediaPlayer;
158704
159628
  /**
158705
159629
  * hero-layout — what a device's hero says (D1023). Read-only: the FIXED
158706
159630
  * layouts live in `@camstack/types` and nothing here stores or edits one.
@@ -159112,6 +160036,12 @@ var IntegrationWithStateSchema = object({
159112
160036
  name: string(),
159113
160037
  /** A projection of the instance body's switch (`setInstanceEnabled` is the only writer). */
159114
160038
  enabled: boolean(),
160039
+ /**
160040
+ * True when the addon that holds the switch did not answer (down, failed, or keeps no record for
160041
+ * this row): `enabled` is then the stored registry flag, a stale value, not the state. A reader
160042
+ * must not draw it as on or off (D315).
160043
+ */
160044
+ switchUnknown: literal(true).optional(),
159115
160045
  info: record(string(), unknown()).readonly(),
159116
160046
  /** The discovery candidate this integration was set up from (D984). */
159117
160047
  originStableId: string().optional(),
@@ -159125,6 +160055,12 @@ var IntegrationLiteSchema = object({
159125
160055
  name: string(),
159126
160056
  /** A projection of the instance body's switch (`setInstanceEnabled` is the only writer). */
159127
160057
  enabled: boolean(),
160058
+ /**
160059
+ * True when the addon that holds the switch did not answer (down, failed, or keeps no record for
160060
+ * this row): `enabled` is then the stored registry flag, a stale value, not the state. A reader
160061
+ * must not draw it as on or off (D315).
160062
+ */
160063
+ switchUnknown: literal(true).optional(),
159128
160064
  info: record(string(), unknown()).readonly(),
159129
160065
  /** The discovery candidate this integration was set up from (D984). */
159130
160066
  originStableId: string().optional(),
@@ -159223,9 +160159,9 @@ var UpdateIntegrationInputSchema = object({
159223
160159
  id: string(),
159224
160160
  name: string().optional(),
159225
160161
  /**
159226
- * Accepted for a FIXED builtin only (`info.fixed`: alarm panel, camera grid, core blocks,
159227
- * terminal), which keeps no instance record: the registry flag is its one store. Any other
159228
- * integration is switched through `integration-instances.setInstanceEnabled`.
160162
+ * Honoured ONLY for a fixed builtin (`info.fixed`), whose switch is the hub's own registry flag
160163
+ * and works while its addon is down. Any other row is refused (a typed `BAD_REQUEST`): its
160164
+ * switch is `integration-instances.setInstanceEnabled`.
159229
160165
  */
159230
160166
  enabled: boolean().optional(),
159231
160167
  info: record(string(), unknown()).optional()
@@ -159259,6 +160195,12 @@ method(_void(), array(IntegrationWithStateSchema)), method(object({ id: string()
159259
160195
  * the form as a `SecretFieldView`, never text (D789). A patch value omitted, `''`
159260
160196
  * or the redaction token KEEPS the stored secret; `{ $secretClear: true }`
159261
160197
  * clears it.
160198
+ *
160199
+ * Who may call (epic #440): every method but `describe` and `instanceFormSchema` is open to any
160200
+ * session (`caller: 'scoped'`) and default-denies. An admin passes everywhere. A non-admin passes
160201
+ * only on a call pinned to one addon whose `describe().userScoped` is true, and that provider
160202
+ * filters every row on the `caller` the router injected (a notification target is somebody's
160203
+ * phone: a user sees and changes only their own). An addon that says nothing keeps the admin door.
159262
160204
  */
159263
160205
  var ConfigSchemaPassthrough$2 = custom();
159264
160206
  var IntegrationInstanceIdSchema = string().min(1);
@@ -159372,7 +160314,15 @@ var IntegrationInstanceDescriptionSchema = object({
159372
160314
  */
159373
160315
  mintsId: boolean().optional(),
159374
160316
  /** The links to other instances the provider's kinds declare; absent means none. */
159375
- links: array(IntegrationInstanceLinkSchema).optional()
160317
+ links: array(IntegrationInstanceLinkSchema).optional(),
160318
+ /**
160319
+ * The rows belong to individual users (a notification target is somebody's phone). The router
160320
+ * then opens `listInstances`, `getInstance`, `createInstance`, `updateInstance`,
160321
+ * `setInstanceEnabled`, `deleteInstance` and `testInstance` to a NON-admin session on a call
160322
+ * pinned to this addon, and hands the provider the `caller` so it keeps a user to their own rows.
160323
+ * Absent means admin only, as it always was.
160324
+ */
160325
+ userScoped: boolean().optional()
159376
160326
  });
159377
160327
  var IntegrationInstanceStatusSchema = object({
159378
160328
  state: _enum([
@@ -159430,8 +160380,14 @@ var integrationInstancesCapability = {
159430
160380
  /** The discovery candidate the wizard was seeded from (`stableId`), if any. */
159431
160381
  candidateStableId: string().min(1).optional()
159432
160382
  }), ConfigSchemaPassthrough$2, { auth: "admin" }),
159433
- listInstances: method(_void(), array(IntegrationInstanceSchema).readonly(), { auth: "admin" }),
159434
- getInstance: method(object({ id: IntegrationInstanceIdSchema }), IntegrationInstanceSchema.nullable(), { auth: "admin" }),
160383
+ listInstances: method(looseObject({}), array(IntegrationInstanceSchema).readonly(), {
160384
+ auth: "protected",
160385
+ caller: "scoped"
160386
+ }),
160387
+ getInstance: method(object({ id: IntegrationInstanceIdSchema }), IntegrationInstanceSchema.nullable(), {
160388
+ auth: "protected",
160389
+ caller: "scoped"
160390
+ }),
159435
160391
  /**
159436
160392
  * Insert the typed record. With `id` it is stored under that id (a duplicate id is refused);
159437
160393
  * without one the PROVIDER mints it and answers it. `kind` picks one of `describe().kinds`.
@@ -159464,11 +160420,13 @@ var integrationInstancesCapability = {
159464
160420
  seed: object({ info: record(string(), unknown()) }).optional()
159465
160421
  }), object({ id: string() }), {
159466
160422
  kind: "mutation",
159467
- auth: "admin"
160423
+ auth: "protected",
160424
+ caller: "scoped"
159468
160425
  }),
159469
160426
  updateInstance: method(IntegrationInstancePatchSchema, object({ ok: literal(true) }), {
159470
160427
  kind: "mutation",
159471
- auth: "admin"
160428
+ auth: "protected",
160429
+ caller: "scoped"
159472
160430
  }),
159473
160431
  /**
159474
160432
  * Switch ONE instance on or off, for every role; a missing record is created from the addon's
@@ -159480,7 +160438,8 @@ var integrationInstancesCapability = {
159480
160438
  enabled: boolean()
159481
160439
  }), object({ ok: literal(true) }), {
159482
160440
  kind: "mutation",
159483
- auth: "admin"
160441
+ auth: "protected",
160442
+ caller: "scoped"
159484
160443
  }),
159485
160444
  /**
159486
160445
  * Delete the record and its keychain refs together. For an instance that brings devices the hub
@@ -159489,7 +160448,8 @@ var integrationInstancesCapability = {
159489
160448
  */
159490
160449
  deleteInstance: method(object({ id: IntegrationInstanceIdSchema }), object({ ok: literal(true) }), {
159491
160450
  kind: "mutation",
159492
- auth: "admin"
160451
+ auth: "protected",
160452
+ caller: "scoped"
159493
160453
  }),
159494
160454
  testInstance: optionalMethod(object({
159495
160455
  id: IntegrationInstanceIdSchema.nullable(),
@@ -159498,7 +160458,8 @@ var integrationInstancesCapability = {
159498
160458
  kind: string().min(1).optional()
159499
160459
  }), TestConnectionResultSchema, {
159500
160460
  kind: "mutation",
159501
- auth: "admin"
160461
+ auth: "protected",
160462
+ caller: "scoped"
159502
160463
  })
159503
160464
  }
159504
160465
  };
@@ -161370,7 +162331,7 @@ var lockControlCapability = {
161370
162331
  kind: "mutation",
161371
162332
  auth: "protected"
161372
162333
  }),
161373
- open: method(object({ deviceId: number$1().int().nonnegative() }), _void(), {
162334
+ open: optionalMethod(object({ deviceId: number$1().int().nonnegative() }), _void(), {
161374
162335
  kind: "mutation",
161375
162336
  auth: "protected"
161376
162337
  })
@@ -162588,7 +163549,7 @@ object({
162588
163549
  deviceId: number$1().int().optional(),
162589
163550
  atBefore: number$1().optional(),
162590
163551
  where: RecordWhereSchema.optional()
162591
- }), 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({
163552
+ }), 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({
162592
163553
  ref: string().min(1),
162593
163554
  value: string()
162594
163555
  }), object({}), object({ refs: array(string()) }), object({ deleted: number$1().int().nonnegative() }), object({}), object({ integrations: array(MigrationIntegrationSchema) }), object({ id: string().min(1) }), MigrationIntegrationSchema.nullable(), object({
@@ -162599,7 +163560,7 @@ object({
162599
163560
  integrationId: string().nullable(),
162600
163561
  /** Whether the device carries any stored config; its content is not offered. */
162601
163562
  hasConfig: boolean()
162602
- }).nullable(), object({
163563
+ }).nullable(), object({ deviceIds: array(number$1().int()) }), object({ aliases: record(string(), string()) }), object({
162603
163564
  deviceId: number$1().int(),
162604
163565
  integrationId: string().min(1)
162605
163566
  }), object({}), object({}), object({ nodeId: string() }), object({}), object({});
@@ -169897,92 +170858,21 @@ var NcZoneConditionSchema = object({
169897
170858
  * membership lists are OR within the list (spec §2.3).
169898
170859
  */
169899
170860
  /**
169900
- * What a rule may actuate.
169901
- *
169902
- * **No hand-maintained allowlist** (operator decision, and the right one — a
169903
- * written list of methods is a third parallel map to keep aligned, and this
169904
- * repo has paid for those). The boundary instead comes from a property the
169905
- * capabilities already carry: an action may target only a **device-scoped**
169906
- * capability method.
169907
- *
169908
- * That is not decoration. A rule can be authored by a NON-ADMIN — personal
169909
- * rules are a supported flow — and the executor runs with the addon's
169910
- * privileges, so an unbounded action is an arbitrary RPC channel with a
169911
- * privilege escalation attached. Restricting to device scope excludes the
169912
- * system caps (`device-manager.removeDevice` and friends) by construction,
169913
- * costs nothing to maintain, and cannot rot: a cap that stops being
169914
- * device-scoped stops being actuatable in the same change.
169915
- *
169916
- * The executor enforces it; {@link NcRuleActionSchema} carries the intent.
169917
- */
169918
- /**
169919
- * One step of a sequence.
169920
- *
169921
- * `wait` is a first-class step rather than a property of the next action: it is
169922
- * what makes a sequence a SEQUENCE and not a list — "unlock, wait 5s, open"
169923
- * cannot be expressed otherwise.
169924
- */
169925
- var NcRuleActionSchema = discriminatedUnion("kind", [object({
169926
- kind: literal("wait"),
169927
- seconds: number$1().min(0).max(300)
169928
- }), object({
169929
- kind: literal("cap"),
169930
- /**
169931
- * WHO the step acts on (D983) — the only shape that is written. A sequence
169932
- * stored before D983 carries `deviceId`; the sequence store reads it as a
169933
- * `devices` target.
169934
- */
169935
- target: ActionTargetSchema.optional(),
169936
- /** The vocabulary action the step performs; required for a `domain` target. */
169937
- actionId: string().min(1).optional(),
169938
- /** @deprecated The pre-D983 single device. Read, never written. */
169939
- deviceId: number$1().int().optional(),
169940
- /** Capability name, e.g. `alarm-panel`. */
169941
- cap: string().min(1),
169942
- /** Method on it. The executor refuses a non-device-scoped cap. */
169943
- method: string().min(1),
169944
- /** Method arguments, minus `deviceId` (the executor injects it). */
169945
- args: record(string(), unknown()).optional()
169946
- }).refine((step) => step.target !== void 0 || step.deviceId !== void 0, {
169947
- message: "a cap step needs a target",
169948
- path: ["target"]
169949
- }).refine((step) => step.target?.kind !== "domain" || step.actionId !== void 0, {
169950
- message: "a domain target needs the vocabulary action it applies to (actionId)",
169951
- path: ["actionId"]
169952
- })]);
169953
- /**
169954
- * A named, ordered run of steps shared across rules, with its own throttle.
170861
+ * What a rule or a button runs: an **Action** of the `actions` surface
170862
+ * (`internal:<uuid>` or an addon's), by id, and nothing else (planning#473).
169955
170863
  *
169956
- * Sequences live in the notification centre's sequence store — never inline on
169957
- * a rule. A rule binds to one by id ({@link NcActionBindingSchema}), and a
169958
- * button names one the same way. `minDelaySec` exists because a noisy rule
169959
- * otherwise hammers a physical actuator — the rule's own cooldown governs
169960
- * NOTIFICATIONS, which is a different budget from "how often may this gate
169961
- * actually open". The throttle key is the sequence id, so two rules sharing
169962
- * one sequence share its budget.
170864
+ * The notification centre has no step vocabulary of its own. The steps, the
170865
+ * device-scope boundary, the stop-at-first-failure, the throttle
170866
+ * (`minDelaySec`), the variables and the runs ledger all belong to the Action;
170867
+ * an operator edits them in ONE place (the Actions page) and a rule points at
170868
+ * the result. A rule can be authored by a non-admin (personal rules), which is
170869
+ * safe for the same reason: it can only name an Action an admin already wrote.
169963
170870
  */
169964
- var NcSharedSequenceSchema = object({
169965
- id: string().min(1),
169966
- name: string().min(1).max(120),
169967
- minDelaySec: number$1().int().min(0).max(86400).optional(),
169968
- actions: array(NcRuleActionSchema).min(1)
169969
- });
169970
- /** Create / update body — the id is minted by the provider. */
169971
- var NcSharedSequenceInputSchema = object({
169972
- name: string().min(1).max(120),
169973
- minDelaySec: number$1().int().min(0).max(86400).optional(),
169974
- actions: array(NcRuleActionSchema).min(1)
169975
- });
169976
- /** Bindings on one hook edge. Cap keeps a slot from becoming a second sequence editor. */
169977
- var NcHookBindingsSchema = array(discriminatedUnion("kind", [object({
169978
- kind: literal("sequence"),
169979
- sequenceId: string().min(1)
169980
- }), object({
169981
- kind: literal("do"),
169982
- action: NcRuleActionSchema
169983
- })])).max(4);
170871
+ var NcActionIdSchema = string().min(1);
170872
+ /** Action ids one hook edge runs, in order. Capped so a slot never becomes a second editor. */
170873
+ var NcHookActionIdsSchema = array(NcActionIdSchema).max(4);
169984
170874
  /**
169985
- * One button carried by the notification, running a shared sequence on tap.
170875
+ * One button carried by the notification, running an Action on tap.
169986
170876
  *
169987
170877
  * **Read this before adding a button that does something physical.** The tap
169988
170878
  * arrives over a link that travelled through third-party infrastructure — ntfy,
@@ -169997,9 +170887,9 @@ var NcRuleNotificationButtonSchema = object({
169997
170887
  /** Stable id — travels in the callback and identifies the button in logs. */
169998
170888
  id: string().min(1).max(64),
169999
170889
  label: string().min(1).max(40),
170000
- /** Id of a shared sequence. The dispatcher drops a button whose sequence
170001
- * does not exist rather than minting a token for nothing. */
170002
- sequenceId: string().min(1),
170890
+ /** The Action the tap runs. The dispatcher drops a button whose Action does
170891
+ * not exist rather than minting a token for nothing. */
170892
+ actionId: NcActionIdSchema,
170003
170893
  icon: NotificationActionIconSchema.optional(),
170004
170894
  destructive: boolean().optional()
170005
170895
  });
@@ -170014,25 +170904,19 @@ var NcRuleNotificationButtonSchema = object({
170014
170904
  * leave). A delivery with no clear edge never produces this hook.
170015
170905
  */
170016
170906
  var NcRuleActionsSchema = object({
170017
- onActivation: NcHookBindingsSchema.optional(),
170018
- onDeactivation: NcHookBindingsSchema.optional(),
170907
+ onActivation: NcHookActionIdsSchema.optional(),
170908
+ onDeactivation: NcHookActionIdsSchema.optional(),
170019
170909
  /** Runs on a positive / raised match. */
170020
- onTrigger: NcHookBindingsSchema.optional(),
170910
+ onTrigger: NcHookActionIdsSchema.optional(),
170021
170911
  /** Runs on a clear / leave match, when the subject carries one. */
170022
- onTriggerOff: NcHookBindingsSchema.optional(),
170912
+ onTriggerOff: NcHookActionIdsSchema.optional(),
170023
170913
  /**
170024
- * Buttons the NOTIFICATION carries, each running one shared sequence when
170025
- * tapped. Deliberately a REFERENCE — a button that could define its own
170026
- * actions would be a parallel actuation vocabulary.
170914
+ * Buttons the NOTIFICATION carries, each running one Action when tapped.
170915
+ * Deliberately a REFERENCE — a button that could define its own steps would
170916
+ * be a parallel actuation vocabulary.
170027
170917
  */
170028
170918
  buttons: array(NcRuleNotificationButtonSchema).max(8).optional()
170029
170919
  });
170030
- object({
170031
- name: string().min(1).max(120),
170032
- enabled: boolean(),
170033
- minDelaySec: number$1().int().min(0).max(86400).optional(),
170034
- actions: array(NcRuleActionSchema).min(1)
170035
- });
170036
170920
  /**
170037
170921
  * "This rule applies only while `deviceId` is in one of `states`."
170038
170922
  *
@@ -170331,6 +171215,26 @@ var NcRuleTargetSchema = object({
170331
171215
  */
170332
171216
  params: record(string(), unknown()).optional()
170333
171217
  });
171218
+ /** Which picture kind one target receives (#487). */
171219
+ var NcTargetAttachmentSchema = _enum([
171220
+ "none",
171221
+ "image",
171222
+ "clip",
171223
+ "gif"
171224
+ ]);
171225
+ var NcTargetOverrideSchema = object({
171226
+ template: object({
171227
+ title: string().max(500).optional(),
171228
+ body: string().max(2e3).optional()
171229
+ }).optional(),
171230
+ schedule: NcScheduleSchema.optional(),
171231
+ priority: number$1().int().min(1).max(5).optional(),
171232
+ attachment: NcTargetAttachmentSchema.optional(),
171233
+ /** `false` = no buttons for this target; `true` is the same as absent. */
171234
+ actions: boolean().optional()
171235
+ });
171236
+ /** Per-target settings keyed by target id (#487). */
171237
+ var NcTargetOverridesSchema = record(string(), NcTargetOverrideSchema);
170334
171238
  /**
170335
171239
  * WHAT THE NOTIFICATION'S PICTURE IS (D897) — the ONE media choice of a rule.
170336
171240
  *
@@ -170612,6 +171516,13 @@ var NcRuleInputSchema = object({
170612
171516
  * targets.
170613
171517
  */
170614
171518
  targetUsers: array(string()).optional(),
171519
+ /**
171520
+ * Per-target settings keyed by target id (#487): texts, schedule, priority.
171521
+ * Absent (and an absent entry) = the rule's own values. A patch that omits
171522
+ * the key keeps the stored map; a patch that names it REPLACES it whole —
171523
+ * `{}` empties it.
171524
+ */
171525
+ targetOverrides: NcTargetOverridesSchema.optional(),
170615
171526
  /** Absent = the kind's default picture (`resolveNcMediaImage`): the subject crop for a
170616
171527
  * detection, the clean scene for a sensor or a sound. Set explicitly on save (D897). */
170617
171528
  media: NcMediaPolicySchema.default({}),
@@ -171713,18 +172624,6 @@ method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), m
171713
172624
  }), object({ success: literal(true) }), {
171714
172625
  kind: "mutation",
171715
172626
  auth: "admin"
171716
- }), 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 }), {
171717
- kind: "mutation",
171718
- auth: "admin"
171719
- }), method(object({
171720
- sequenceId: string().min(1),
171721
- sequence: NcSharedSequenceInputSchema
171722
- }), object({ sequence: NcSharedSequenceSchema }), {
171723
- kind: "mutation",
171724
- auth: "admin"
171725
- }), method(object({ sequenceId: string().min(1) }), object({ success: literal(true) }), {
171726
- kind: "mutation",
171727
- auth: "admin"
171728
172627
  }), method(object({}), NcClipRetentionPlanSchema, { auth: "admin" }), method(object({}), object({ mutedDeviceIds: array(number$1().int()).readonly() }), { auth: "admin" }), method(object({
171729
172628
  deviceId: number$1().int(),
171730
172629
  muted: boolean()
@@ -172209,53 +173108,41 @@ setOverlay: method(object({
172209
173108
  }
172210
173109
  }] }
172211
173110
  };
172212
- _enum([
172213
- "value",
172214
- "unit",
172215
- "full"
172216
- ]);
172217
- _enum([
172218
- "value+unit",
172219
- "value",
172220
- "unit"
172221
- ]);
172222
173111
  /**
172223
- * How the operator reached the leaf device. `deviceId` is ALWAYS the
172224
- * OSD-supported leaf that is read; `containerId` is set when the pick
172225
- * went through a container (gateway) first.
173112
+ * `osd-manager` — the ORCHESTRATOR over the device-scope `osd` cap.
173113
+ *
173114
+ * The `osd` cap is the firmware contract: it probes a camera's overlay
173115
+ * SLOTS and writes literal text into one. It has no idea WHERE that text
173116
+ * comes from, and it must not — a driver that grew a "show the temperature
173117
+ * here" feature would grow it once per vendor.
173118
+ *
173119
+ * This cap owns the other half: a per-(camera, slot) BINDING that says
173120
+ * which value feeds the slot, how it is formatted, and under which
173121
+ * conditions it is shown at all. Named TEMPLATES combine many device
173122
+ * fields into one overlay string (plugin catalog OSD Manager parity).
172226
173123
  */
172227
- var OsdTemplatePickSchema = object({
172228
- containerId: number$1().int().optional(),
172229
- deviceId: number$1().int()
172230
- });
172231
173124
  /**
172232
- * One named binding inside a multi-device template: device path + unit
172233
- * selection + precision. The parser expands `{alias}`, `{alias.value}`,
172234
- * `{alias.unit}`, or `{alias.full}` from the same binding — there is no
172235
- * per-binding format lock.
173125
+ * The text of a named template: a device template (D1021) —
173126
+ * `{{ camera.temperature | round(1) }}`, `{{ now | time('HH:mm') }}`,
173127
+ * `{% if camera.motion %}MOTION{% endif %}` — rendered by the ONE hub renderer
173128
+ * (`device-manager.renderDeviceTemplates`), never by this addon.
173129
+ *
173130
+ * Two names belong to the render rather than to a device:
173131
+ * - `now` is the clock; `time('HH:mm')` prints it in the server's zone.
173132
+ * - `camera` is the camera the overlay is on, so one template serves every
173133
+ * camera. `camera.lastPerson` and `camera.lastPlate` are the most recent
173134
+ * recognition persisted for it (empty text until there is one, with
173135
+ * `| default('')`).
172236
173136
  */
172237
- var OsdTemplateBindingSchema = object({
172238
- /** Token stem in the parser, e.g. `t` → `{t}` / `{t.value}`. Unique within the template. */
172239
- alias: string().min(1).max(32).regex(/^[A-Za-z][A-Za-z0-9_-]*$/, "alias must start with a letter"),
172240
- pick: OsdTemplatePickSchema,
172241
- capName: string().min(1).max(64),
172242
- valuePath: string().min(1).max(64),
172243
- /** Convert TO this unit at render (`tryConvertUnit`). Absent = source unit. */
172244
- displayUnit: string().max(16).optional(),
172245
- maxDecimals: number$1().int().min(0).max(4).default(1),
172246
- /** Raw value → display text (same shape as slot binding). Empty string hides. */
172247
- valueMap: record(string(), string()).optional()
172248
- });
173137
+ var OSD_TEMPLATE_TEXT_MAX = 1024;
172249
173138
  /**
172250
- * A named template: bindings (alias → leaf field) + a parser that
172251
- * references `{alias}` / `{alias.value}` / `{alias.unit}` / `{alias.full}`.
173139
+ * A named template: the unit of reuse. A slot points at one by id; editing it
173140
+ * changes every slot that points at it, on every camera.
172252
173141
  */
172253
173142
  var OsdNamedTemplateSchema = object({
172254
173143
  id: string().min(1).max(64),
172255
173144
  name: string().min(1).max(64),
172256
- bindings: array(OsdTemplateBindingSchema).max(32).default([]),
172257
- /** Parser with alias placeholders, e.g. `{t.value} {t.unit} / {h}`. */
172258
- parser: string().max(256).default("")
173145
+ text: string().max(OSD_TEMPLATE_TEXT_MAX).default("")
172259
173146
  });
172260
173147
  /** Where a slot's value comes from. */
172261
173148
  var OsdSourceSchema = discriminatedUnion("kind", [
@@ -172264,26 +173151,6 @@ var OsdSourceSchema = discriminatedUnion("kind", [
172264
173151
  kind: literal("static"),
172265
173152
  text: string().max(64)
172266
173153
  }),
172267
- object({
172268
- kind: literal("clock"),
172269
- /** Token pattern: `YYYY MM DD HH mm ss`. Everything else is literal. */
172270
- pattern: string().min(1).max(32).default("HH:mm"),
172271
- /** IANA zone. Omitted = the server's zone. */
172272
- timezone: string().min(1).max(64).optional()
172273
- }),
172274
- object({
172275
- kind: literal("device-state"),
172276
- deviceId: number$1().int().optional(),
172277
- capName: string().min(1).max(64),
172278
- /** Dot path inside the slice, e.g. `detected`, `value`, `mode`. */
172279
- valuePath: string().min(1).max(64),
172280
- /** Convert TO this unit at render. Absent = no conversion. */
172281
- displayUnit: string().max(16).optional()
172282
- }),
172283
- object({
172284
- kind: literal("latest-recognition"),
172285
- recognition: _enum(["person", "plate"])
172286
- }),
172287
173154
  object({
172288
173155
  kind: literal("template"),
172289
173156
  templateId: string().min(1).max(64)
@@ -172293,15 +173160,6 @@ var OsdSlotBindingSchema = object({
172293
173160
  /** Off = the manager stops driving this slot. It does NOT clear it. */
172294
173161
  enabled: boolean().default(true),
172295
173162
  source: OsdSourceSchema,
172296
- /** `${value}` and `${unit}` are substituted; every occurrence. */
172297
- template: string().max(96).default("${value}"),
172298
- /**
172299
- * Decimal places for a numeric value. `0` yields an integer — the
172300
- * documented workaround for firmwares that reject `.` in overlay text.
172301
- */
172302
- maxDecimals: number$1().int().min(0).max(4).default(1),
172303
- /** Raw value → display text, e.g. `{"true":"MOTION","false":""}`. */
172304
- valueMap: record(string(), string()).optional(),
172305
173163
  /** Time windows in which the slot is shown. Absent = always. */
172306
173164
  schedule: NcScheduleSchema.optional(),
172307
173165
  /**
@@ -172343,31 +173201,21 @@ var OsdRenderResultSchema = object({
172343
173201
  /** Why, whenever the outcome is not a plain write. Never silent. */
172344
173202
  reason: string().optional()
172345
173203
  });
172346
- var OsdSourceValueTypeEnum = _enum([
172347
- "number",
172348
- "boolean",
172349
- "string",
172350
- "enum"
172351
- ]);
172352
173204
  /**
172353
- * One bindable value, derived from a cap's `runtimeState` schema — never
172354
- * hand-listed. The editor renders from this, so a cap that ships a new
172355
- * state field becomes bindable with no UI change.
173205
+ * A template rendered for one camera without being saved: what the editor
173206
+ * previews. `text` is what the overlay would carry; a refused render has a
173207
+ * `reason` and an empty text.
172356
173208
  */
172357
- var OsdSourceOptionSchema = object({
172358
- deviceId: number$1().int(),
172359
- deviceName: string(),
172360
- capName: string(),
172361
- valuePath: string(),
172362
- label: string(),
172363
- valueType: OsdSourceValueTypeEnum,
172364
- /** Present for `enum`; the editor offers these as `valueMap` keys. */
172365
- enumValues: array(string()).readonly().optional()
173209
+ var OsdTemplatePreviewSchema = object({
173210
+ ok: boolean(),
173211
+ text: string(),
173212
+ /** The refusal, or `ref: reason` per value that printed `—`. */
173213
+ notes: array(string())
172366
173214
  });
172367
173215
  method(object({ deviceId: number$1().int() }), object({
172368
173216
  supported: boolean(),
172369
173217
  slots: array(OsdSlotViewSchema)
172370
- }), { auth: "admin" }), method(object({ deviceId: number$1().int() }), object({ sources: array(OsdSourceOptionSchema) }), { auth: "admin" }), method(object({}), object({
173218
+ }), { auth: "admin" }), method(object({}), object({
172371
173219
  supported: array(string()),
172372
173220
  catalog: array(NcConditionDescriptorSchema)
172373
173221
  }), { auth: "admin" }), method(object({
@@ -172409,6 +173257,12 @@ method(object({ deviceId: number$1().int() }), object({
172409
173257
  }), OsdRenderResultSchema, {
172410
173258
  kind: "mutation",
172411
173259
  auth: "admin"
173260
+ }), method(object({
173261
+ deviceId: number$1().int(),
173262
+ text: string().max(OSD_TEMPLATE_TEXT_MAX)
173263
+ }), OsdTemplatePreviewSchema, {
173264
+ kind: "mutation",
173265
+ auth: "admin"
172412
173266
  }), method(object({ deviceId: number$1().int() }), object({ results: array(OsdRenderResultSchema) }), {
172413
173267
  kind: "mutation",
172414
173268
  auth: "admin"
@@ -172614,9 +173468,13 @@ var petFeederCapability = {
172614
173468
  */
172615
173469
  durability: "session",
172616
173470
  /**
172617
- * History (D850): recorded series.
173471
+ * History (D850): recorded series. `feeding` / `eating` are the meals the
173472
+ * device hero's "Meals" button names — change-only booleans, so a dispense
173473
+ * or a pet at the bowl is one span on the history.
172618
173474
  */
172619
173475
  history: { fields: {
173476
+ feeding: { kind: "boolean" },
173477
+ eating: { kind: "boolean" },
172620
173478
  foodLevel: { kind: "gauge" },
172621
173479
  bowlFood: { kind: "gauge" },
172622
173480
  food1: { kind: "gauge" },
@@ -174409,7 +175267,6 @@ var PowerSourceStateSchema = object({
174409
175267
  });
174410
175268
  var POWER_SOURCE_DEVICE_TYPES = [
174411
175269
  DeviceType.Gateway,
174412
- DeviceType.Hub,
174413
175270
  DeviceType.Camera,
174414
175271
  DeviceType.Sensor,
174415
175272
  DeviceType.MediaPlayer,
@@ -174461,18 +175318,18 @@ var powerSourceCapability = {
174461
175318
  mode: "singleton",
174462
175319
  deviceTypes: POWER_SOURCE_DEVICE_TYPES,
174463
175320
  methods: {
174464
- getStatus: systemMethod(deviceInput$1, PowerSourceInfoSchema, { auth: "admin" }),
175321
+ getStatus: systemMethod(deviceInput$1, PowerSourceInfoSchema, { auth: "protected" }),
174465
175322
  powerOn: systemMethod(deviceInput$1, PowerSourceActionResultSchema, {
174466
175323
  kind: "mutation",
174467
- auth: "admin"
175324
+ auth: "protected"
174468
175325
  }),
174469
175326
  powerOff: systemMethod(deviceInput$1, PowerSourceActionResultSchema, {
174470
175327
  kind: "mutation",
174471
- auth: "admin"
175328
+ auth: "protected"
174472
175329
  }),
174473
175330
  forceRestart: systemMethod(deviceInput$1, PowerSourceActionResultSchema, {
174474
175331
  kind: "mutation",
174475
- auth: "admin"
175332
+ auth: "protected"
174476
175333
  })
174477
175334
  },
174478
175335
  runtimeState: PowerSourceStateSchema,
@@ -177973,7 +178830,6 @@ var RemoteCustomButtonSchema = object({
177973
178830
  /** What the operator calls it, and what a voice command may name. */
177974
178831
  name: string().min(1).max(60)
177975
178832
  });
177976
- var RemotePowerModeSchema = _enum(["toggle", "discrete"]);
177977
178833
  /**
177978
178834
  * The source rules: every step role is bound, ids and names are unique, a
177979
178835
  * channel number belongs to one `digits` source, and no name or id is another
@@ -178054,7 +178910,6 @@ var RemoteConfigSchema = object({
178054
178910
  sources: array(RemoteSourceSchema).max(200).default([]),
178055
178911
  /** The pause between two steps of a source: the television's receiver, not a repeat. */
178056
178912
  stepDelayMs: number$1().int().min(100).max(REMOTE_STEP_DELAY_MAX_MS).default(500),
178057
- power: object({ mode: RemotePowerModeSchema }),
178058
178913
  /**
178059
178914
  * READ-ONLY: sources a stored configuration carries that no longer parse,
178060
178915
  * left out of `sources` with the reason (`readStoredRemoteConfig`). Never
@@ -178158,6 +179013,11 @@ var RemoteLayoutButtonSchema = object({
178158
179013
  /** Absent = the plain rendering every layout had before shapes existed. */
178159
179014
  shape: RemoteButtonShapeSchema.optional(),
178160
179015
  tone: RemoteButtonToneSchema.optional(),
179016
+ /**
179017
+ * Draw the label on a colour-toned key. A colour key shows only its colour
179018
+ * by default; a remote whose plastic prints letters on them (A B C D) sets it.
179019
+ */
179020
+ showLegend: boolean().optional(),
178161
179021
  /** The group this button belongs to; it must lie inside that group's rectangle. */
178162
179022
  groupId: string().min(1).max(40).optional()
178163
179023
  });
@@ -178295,7 +179155,6 @@ var RemoteBoundCommandSchema = object({
178295
179155
  });
178296
179156
  var RemoteCommandListSchema = object({
178297
179157
  layoutTemplateId: string().nullable(),
178298
- power: object({ mode: RemotePowerModeSchema }),
178299
179158
  /** Only the roles that are BOUND — the ones a press can reach. */
178300
179159
  commands: array(RemoteBoundCommandSchema),
178301
179160
  /** The sources the operator declared; empty when none (planning#460). */
@@ -178308,7 +179167,8 @@ var RemoteRefusalReasonSchema = _enum([
178308
179167
  "unknown-source",
178309
179168
  "unbound-step",
178310
179169
  "undeclared-channel",
178311
- "press-timeout"
179170
+ "press-timeout",
179171
+ "no-transmitter"
178312
179172
  ]);
178313
179173
  var RemoteSendResultSchema = discriminatedUnion("status", [
178314
179174
  object({
@@ -178401,7 +179261,8 @@ var RemoteComponentButtonSchema = object({
178401
179261
  icon: string().min(1).max(60).optional(),
178402
179262
  label: string().min(1).max(40).optional(),
178403
179263
  shape: RemoteButtonShapeSchema.optional(),
178404
- tone: RemoteButtonToneSchema.optional()
179264
+ tone: RemoteButtonToneSchema.optional(),
179265
+ showLegend: boolean().optional()
178405
179266
  });
178406
179267
  var RemoteLayoutComponentSchema = object({
178407
179268
  id: string().max(80).regex(COMPONENT_ID_RE, { message: "<namespace>:<name>, lowercase" }),
@@ -179600,6 +180461,11 @@ var SendEmailResultSchema = object({
179600
180461
  var SmtpStatusSchema = object({
179601
180462
  /** True iff the addon has successfully verified the relay. */
179602
180463
  ready: boolean(),
180464
+ /**
180465
+ * The tri-state behind `ready` (D315): true when the last send worked, false when it failed,
180466
+ * ABSENT when the relay has not sent yet (unknown, never "not verified").
180467
+ */
180468
+ verified: boolean().optional(),
179603
180469
  /** Operator-visible host string (no credentials). */
179604
180470
  host: string(),
179605
180471
  /** Last error message reported by the relay, when not ready. */
@@ -179611,10 +180477,6 @@ method(SendEmailInputSchema, SendEmailResultSchema, {
179611
180477
  kind: "mutation",
179612
180478
  auth: "admin",
179613
180479
  access: "create"
179614
- }), method(RelayPinSchema, SmtpStatusSchema, {
179615
- kind: "mutation",
179616
- auth: "admin",
179617
- access: "view"
179618
180480
  }), method(RelayPinSchema, SmtpStatusSchema, { auth: "admin" });
179619
180481
  /**
179620
180482
  * A single device snapshot returned as base64 JPEG/PNG.
@@ -182659,7 +183521,7 @@ var valveCapability = {
182659
183521
  kind: "mutation",
182660
183522
  auth: "protected"
182661
183523
  }),
182662
- setPosition: method(object({
183524
+ setPosition: optionalMethod(object({
182663
183525
  deviceId: number$1().int().nonnegative(),
182664
183526
  position: number$1().min(0).max(100)
182665
183527
  }), _void(), {
@@ -185213,7 +186075,6 @@ var DEVICE_LOCAL_STATE_CAPS = {
185213
186075
  control: controlCapability,
185214
186076
  cover: coverCapability,
185215
186077
  dayNight: dayNightCapability,
185216
- deviceDiscovery: deviceDiscoveryCapability,
185217
186078
  deviceStatus: deviceStatusCapability,
185218
186079
  dishwasher: dishwasherCapability,
185219
186080
  doNotDisturb: doNotDisturbCapability,
@@ -185228,6 +186089,7 @@ var DEVICE_LOCAL_STATE_CAPS = {
185228
186089
  groupCommands: groupCommandsCapability,
185229
186090
  groupStatus: groupStatusCapability,
185230
186091
  heatingValve: heatingValveCapability,
186092
+ heatPumpStatus: heatPumpStatusCapability,
185231
186093
  humidifier: humidifierCapability,
185232
186094
  humiditySensor: humiditySensorCapability,
185233
186095
  image: imageCapability,
@@ -186511,7 +187373,8 @@ var BaseDeviceProvider = class extends BaseAddon {
186511
187373
  return toDeviceSummary(device, this.addonId);
186512
187374
  }
186513
187375
  };
186514
- 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;
187376
+ DeviceType.HeatPump;
187377
+ 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;
186515
187378
  new Set(Object.values(DeviceType));
186516
187379
  /** Parses the raw slice with the cap's own schema; `undefined` when it does not parse. */
186517
187380
  function contribution(cap, schema, build) {
@@ -186647,6 +187510,13 @@ var lockContribution = contribution("lock-control", LockControlStatusSchema, (sl
186647
187510
  reading: reading("lock-control", words?.state ?? "unknown", false, words?.title),
186648
187511
  rows: [row$1("lock", state === "locked" || state === "locking" ? "lock" : "lock-open", joinText([title, since]), lockControls(state, ctx.features.includes(DeviceFeature.LockOpen)))],
186649
187512
  ...since === null || words === null ? {} : { facts: [fact("since", "clock", since, "muted")] },
187513
+ ...words === null ? {} : { tiles: { left: [{
187514
+ label: t("Door", "Porta"),
187515
+ value: title
187516
+ }, ...since === null ? [] : [{
187517
+ label: t("Since", "Da"),
187518
+ value: since
187519
+ }]] } },
186650
187520
  ...words?.door == null ? {} : { scene: { mode: words.door } }
186651
187521
  };
186652
187522
  });
@@ -186728,7 +187598,17 @@ var ACCESS_FAMILY_CONTRIBUTIONS = {
186728
187598
  return {
186729
187599
  reading: reading("alarm-panel", words?.state ?? "unknown", false, words?.title),
186730
187600
  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))],
186731
- ...since === null || words === null ? {} : { facts: [fact("since", "clock", since, state === "triggered" ? "danger" : "muted")] }
187601
+ ...since === null || words === null ? {} : { facts: [fact("since", "clock", since, state === "triggered" ? "danger" : "muted")] },
187602
+ ...words === null ? {} : { tiles: {
187603
+ left: [{
187604
+ label: t("Mode", "Modalità"),
187605
+ value: words.title
187606
+ }],
187607
+ ...since === null ? {} : { right: [{
187608
+ label: t("Since", "Da"),
187609
+ value: since
187610
+ }] }
187611
+ } }
186732
187612
  };
186733
187613
  }),
186734
187614
  "automation-control": contribution("automation-control", AutomationControlStatusSchema, (slice, ctx) => {
@@ -186792,7 +187672,7 @@ var ACCESS_FAMILY_CONTRIBUTIONS = {
186792
187672
  */
186793
187673
  var has$3 = (ctx, f) => ctx.features.includes(f);
186794
187674
  var unknownText = t("Unknown", "Sconosciuto");
186795
- var pct$1 = (n) => t(`${Math.round(n)}%`, `${Math.round(n)}%`);
187675
+ var pct$2 = (n) => t(`${Math.round(n)}%`, `${Math.round(n)}%`);
186796
187676
  var unit = (n) => Math.min(1, Math.max(0, n / 100));
186797
187677
  /** Battery as a fact, unless the device is also bound to the `battery` cap (it already says so). */
186798
187678
  function ownBattery(level, ctx) {
@@ -186854,7 +187734,7 @@ var fanContribution = contribution("fan-control", FanControlStatusSchema, (slice
186854
187734
  },
186855
187735
  valueArg: "direction"
186856
187736
  });
186857
- const speedText = speed === null ? null : pct$1(speed);
187737
+ const speedText = speed === null ? null : pct$2(speed);
186858
187738
  const preset = slice?.preset ?? "";
186859
187739
  const status = speed === null ? unknownText : joinText([speed === 0 ? t("Off", "Spento") : t(`Speed ${speed}%`, `Velocità ${speed}%`), preset === "" ? null : t(preset, preset)]);
186860
187740
  return {
@@ -186867,10 +187747,16 @@ var fanContribution = contribution("fan-control", FanControlStatusSchema, (slice
186867
187747
  }],
186868
187748
  ...speedText === null ? {} : {
186869
187749
  facts: [fact("speed", "fan", speedText, speed === 0 ? "muted" : "primary")],
186870
- tiles: { right: [{
186871
- label: t("Speed", "Velocità"),
186872
- value: speedText
186873
- }] },
187750
+ tiles: {
187751
+ ...slice?.oscillating == null ? {} : { left: [{
187752
+ label: t("Oscillation", "Oscilla"),
187753
+ value: slice.oscillating ? t("Yes", "Sì") : t("No", "No")
187754
+ }] },
187755
+ ...preset === "" ? {} : { right: [{
187756
+ label: t("Mode", "Modalità"),
187757
+ value: t(preset, preset)
187758
+ }] }
187759
+ },
186874
187760
  scene: { level: unit(speed ?? 0) }
186875
187761
  }
186876
187762
  };
@@ -186934,7 +187820,8 @@ var vacuumContribution = contribution("vacuum-control", VacuumControlStatusSchem
186934
187820
  const words = state === null ? null : VACUUM_WORDS[state];
186935
187821
  const title = state === "error" && slice?.errorLabel ? t(slice.errorLabel, slice.errorLabel) : words?.title;
186936
187822
  const controls = vacuumControls(state);
186937
- if (slice !== void 0 && slice.availableFanSpeeds.length > 0) controls.push({
187823
+ const suctionControls = [];
187824
+ if (slice !== void 0 && slice.availableFanSpeeds.length > 0) suctionControls.push({
186938
187825
  kind: "picker",
186939
187826
  id: "vacuum.suction",
186940
187827
  label: t("Suction", "Aspirazione"),
@@ -186949,22 +187836,31 @@ var vacuumContribution = contribution("vacuum-control", VacuumControlStatusSchem
186949
187836
  });
186950
187837
  if (state !== null) controls.push(vac("locate", "Locate", "Trova", "map-pin", "locate"));
186951
187838
  const progress = state === "cleaning" ? slice?.progress ?? null : null;
187839
+ const suction = slice?.fanSpeed == null || slice.fanSpeed === "" ? [] : [{
187840
+ label: t("Suction", "Aspirazione"),
187841
+ value: t(slice.fanSpeed, slice.fanSpeed)
187842
+ }];
187843
+ const suctionRows = suctionControls.length === 0 ? [] : [{
187844
+ id: "vacuum-suction",
187845
+ icon: "bot",
187846
+ status: null,
187847
+ controls: suctionControls
187848
+ }];
187849
+ const vacuumRows = [{
187850
+ id: "vacuum",
187851
+ icon: "bot",
187852
+ status: title ?? unknownText,
187853
+ controls
187854
+ }, ...suctionRows];
186952
187855
  return {
186953
187856
  reading: reading("vacuum-control", words?.state ?? "unknown", false, title),
186954
- rows: [{
186955
- id: "vacuum",
186956
- icon: "bot",
186957
- status: title ?? unknownText,
186958
- controls
186959
- }],
186960
- facts: [...ownBattery(slice?.batteryLevel ?? null, ctx), ...progress === null ? [] : [fact("progress", "activity", pct$1(progress), "primary")]],
186961
- ...progress === null ? {} : {
186962
- tiles: { right: [{
186963
- label: t("Progress", "Avanzamento"),
186964
- value: pct$1(progress)
186965
- }] },
186966
- scene: { level: unit(progress) }
186967
- }
187857
+ rows: vacuumRows,
187858
+ facts: [...ownBattery(slice?.batteryLevel ?? null, ctx), ...progress === null ? [] : [fact("progress", "activity", pct$2(progress), "primary")]],
187859
+ ...suction.length === 0 && progress === null ? {} : { tiles: { right: [...suction, ...progress === null ? [] : [{
187860
+ label: t("Progress", "Avanzamento"),
187861
+ value: pct$2(progress)
187862
+ }]] } },
187863
+ ...progress === null ? {} : { scene: { level: unit(progress) } }
186968
187864
  };
186969
187865
  });
186970
187866
  var MOWER_WORDS = {
@@ -187020,11 +187916,11 @@ var mowerContribution = contribution("lawn-mower-control", LawnMowerControlStatu
187020
187916
  status: title ?? unknownText,
187021
187917
  controls: mowerControls(activity)
187022
187918
  }],
187023
- facts: [...ownBattery(slice?.batteryLevel ?? null, ctx), ...progress === null ? [] : [fact("progress", "activity", pct$1(progress), "primary")]],
187919
+ facts: [...ownBattery(slice?.batteryLevel ?? null, ctx), ...progress === null ? [] : [fact("progress", "activity", pct$2(progress), "primary")]],
187024
187920
  ...progress === null ? {} : {
187025
187921
  tiles: { right: [{
187026
187922
  label: t("Progress", "Avanzamento"),
187027
- value: pct$1(progress)
187923
+ value: pct$2(progress)
187028
187924
  }] },
187029
187925
  scene: { level: unit(progress) }
187030
187926
  }
@@ -187095,10 +187991,13 @@ var feederContribution = contribution("pet-feeder", PetFeederStatusSchema, (slic
187095
187991
  ...last === null ? [] : [fact("last-run", "clock", t(`Last ${last} g`, `Ultimo ${last} g`))],
187096
187992
  ...ownBattery(slice?.powerSource === "battery" ? slice.batteryPower : null, ctx)
187097
187993
  ],
187098
- ...last === null ? {} : { tiles: { right: [{
187994
+ tiles: { left: [...slice?.foodLevel == null ? [] : [{
187995
+ label: t("Tank", "Serbatoio"),
187996
+ value: pct$2(slice.foodLevel)
187997
+ }], ...last === null ? [] : [{
187099
187998
  label: t("Last portion", "Ultima porzione"),
187100
187999
  value: t(`${last} g`, `${last} g`)
187101
- }] } }
188000
+ }]] }
187102
188001
  };
187103
188002
  });
187104
188003
  var fountainContribution = contribution("pet-fountain", PetFountainStatusSchema, (slice) => {
@@ -187126,10 +188025,13 @@ var fountainContribution = contribution("pet-fountain", PetFountainStatusSchema,
187126
188025
  }],
187127
188026
  ...level === null ? {} : {
187128
188027
  facts: [fact("level", "droplets", t(`Water ${Math.round(level)}%`, `Acqua ${Math.round(level)}%`), level <= 20 ? "warning" : "primary")],
187129
- tiles: { right: [{
188028
+ tiles: { left: [{
187130
188029
  label: t("Water", "Acqua"),
187131
- value: pct$1(level)
187132
- }] },
188030
+ value: pct$2(level)
188031
+ }, ...slice?.waterVolume == null ? [] : [{
188032
+ label: t("Volume", "Volume"),
188033
+ value: t(`${Math.round(slice.waterVolume)} ml`, `${Math.round(slice.waterVolume)} ml`)
188034
+ }]] },
187133
188035
  scene: { level: unit(level) }
187134
188036
  }
187135
188037
  };
@@ -187161,14 +188063,18 @@ var DEVICES_FAMILY_CONTRIBUTIONS = {
187161
188063
  * that does not parse reads `unknown`, never closed or off (D315/D393).
187162
188064
  */
187163
188065
  var has$2 = (ctx, f) => ctx.features.includes(f);
187164
- var pct = (n) => t(`${Math.round(n)}%`, `${Math.round(n)}%`);
188066
+ var pct$1 = (n) => t(`${Math.round(n)}%`, `${Math.round(n)}%`);
187165
188067
  var brightnessContribution = contribution("brightness", BrightnessStatusSchema, (slice) => {
187166
188068
  const level = slice?.level ?? null;
187167
188069
  return {
187168
188070
  ...level === null ? {} : { reading: reading("brightness", level > 0 ? "on" : "off") },
187169
188071
  ...level === null ? {} : {
187170
- facts: [fact("level", "sun-dim", pct(level), level > 0 ? "primary" : "muted")],
187171
- scene: { level: level / 100 }
188072
+ facts: [fact("level", "sun-dim", pct$1(level), level > 0 ? "primary" : "muted")],
188073
+ scene: { level: level / 100 },
188074
+ tiles: { left: [{
188075
+ label: t("Brightness", "Luminosità"),
188076
+ value: pct$1(level)
188077
+ }] }
187172
188078
  },
187173
188079
  rows: [row$1("brightness", "sun-dim", level === null ? null : t(`Brightness ${Math.round(level)}%`, `Luminosità ${Math.round(level)}%`), [{
187174
188080
  kind: "slider",
@@ -187377,12 +188283,16 @@ function travelFragment(s, state, position, tilt, ctx) {
187377
188283
  });
187378
188284
  return {
187379
188285
  reading: reading(s.source, words.state, false, words.title),
187380
- ...position === null ? {} : { facts: [fact("level", "arrow-up-down", pct(position))] },
188286
+ ...position === null ? {} : { facts: [fact("level", "arrow-up-down", pct$1(position))] },
188287
+ ...position === null ? {} : { tiles: { left: [{
188288
+ label: t("Opening", "Apertura"),
188289
+ value: pct$1(position)
188290
+ }] } },
187381
188291
  scene: {
187382
188292
  ...words.mode === null ? {} : { mode: words.mode },
187383
188293
  ...position === null ? {} : { level: position / 100 }
187384
188294
  },
187385
- rows: [row$1(s.rowId, "arrow-up-down", joinText([words.title, position !== null && state !== "open" ? pct(position) : null]), controls)]
188295
+ rows: [row$1(s.rowId, "arrow-up-down", joinText([words.title, position !== null && state !== "open" ? pct$1(position) : null]), controls)]
187386
188296
  };
187387
188297
  }
187388
188298
  var ACTUATORS_FAMILY_CONTRIBUTIONS = {
@@ -187460,10 +188370,10 @@ var ACTUATORS_FAMILY_CONTRIBUTIONS = {
187460
188370
  const now = slice.currentHumidity;
187461
188371
  return {
187462
188372
  reading: reading("humidifier", state, false, title),
187463
- ...now === null ? {} : { facts: [fact("level", "droplets", pct(now), "info")] },
188373
+ ...now === null ? {} : { facts: [fact("level", "droplets", pct$1(now), "info")] },
187464
188374
  ...slice.targetHumidity === null ? {} : { tiles: { right: [{
187465
188375
  label: t("Target", "Obiettivo"),
187466
- value: pct(slice.targetHumidity)
188376
+ value: pct$1(slice.targetHumidity)
187467
188377
  }] } },
187468
188378
  ...now === null ? {} : { scene: { level: now / 100 } },
187469
188379
  rows: [row$1("humidifier", "droplets", joinText([title, slice.mode === null ? null : t(slice.mode, slice.mode)]), controls)]
@@ -187711,17 +188621,16 @@ var weatherContribution = contribution("weather", WeatherStatusSchema, (slice, c
187711
188621
  });
187712
188622
  var updateContribution = contribution("update", UpdateStatusSchema, (slice) => {
187713
188623
  if (slice === void 0) return { reading: reading("update", "unknown") };
187714
- const { currentVersion, availableVersion, inProgress, updatable } = slice;
188624
+ const { currentVersion, availableVersion, inProgress } = slice;
187715
188625
  const pending = availableVersion !== null && availableVersion !== "" && availableVersion !== currentVersion;
187716
188626
  if (!pending && currentVersion === null && !inProgress) return { reading: reading("update", "unknown") };
187717
188627
  const state = inProgress ? "running" : pending ? "standby" : "idle";
187718
188628
  const title = inProgress ? t("Updating", "Aggiornamento in corso") : pending ? t("Update available", "Aggiornamento disponibile") : t("Up to date", "Aggiornato");
187719
188629
  const versions = currentVersion === null ? pending ? t(`${availableVersion}`, `${availableVersion}`) : null : pending ? t(`${currentVersion} → ${availableVersion}`, `${currentVersion} → ${availableVersion}`) : t(`Version ${currentVersion}`, `Versione ${currentVersion}`);
187720
- const install = pending && updatable && !inProgress ? [asAction(action("update.install", t("Install", "Installa"), "download", "update", "installUpdate", {}, "primary", "install"))] : [];
187721
188630
  return {
187722
188631
  reading: reading("update", state, false, title),
187723
188632
  facts: versions === null ? [] : [fact("reading", "download", versions, pending ? "warning" : "muted")],
187724
- rows: [row$1("update", "download", versions, install)]
188633
+ rows: [row$1("update", "download", versions, [])]
187725
188634
  };
187726
188635
  });
187727
188636
  var imageContribution = contribution("image", ImageStatusSchema, (slice, ctx) => {
@@ -187829,6 +188738,33 @@ var ON_MODE_PREFERENCE = [
187829
188738
  "heat",
187830
188739
  "cool"
187831
188740
  ];
188741
+ var FAN_LABEL = {
188742
+ auto: t("Auto", "Auto"),
188743
+ quiet: t("Quiet", "Silenziosa"),
188744
+ low: t("Low", "Bassa"),
188745
+ medium: t("Medium", "Media"),
188746
+ high: t("High", "Alta"),
188747
+ turbo: t("Turbo", "Turbo"),
188748
+ off: t("Off", "Spenta")
188749
+ };
188750
+ /** A readable label for a fan speed name; an unknown one is shown as the device reported it. */
188751
+ function fanLabelOf(fan) {
188752
+ return FAN_LABEL[fan] ?? t(fan, fan);
188753
+ }
188754
+ /** Short labels for a segmented control: one word each, so the segments stay on a line. */
188755
+ var MODE_SEGMENT_LABEL = {
188756
+ off: t("Off", "Spento"),
188757
+ heat: t("Heat", "Caldo"),
188758
+ cool: t("Cool", "Freddo"),
188759
+ auto: t("Auto", "Auto"),
188760
+ heat_cool: t("Heat/Cool", "Caldo/Freddo"),
188761
+ fan_only: t("Fan", "Vent."),
188762
+ dry: t("Dry", "Deum.")
188763
+ };
188764
+ /** The segment label of every available HVAC mode, keyed by the mode value. */
188765
+ function modeLabelsOf(modes) {
188766
+ return Object.fromEntries(modes.map((m) => [m, MODE_SEGMENT_LABEL[m]]));
188767
+ }
187832
188768
  /** 22 -> "22", 22.3 -> "22.3": a trailing zero is noise on a thermostat. */
187833
188769
  function formatDegrees(value) {
187834
188770
  return `${Number(value.toFixed(1))}°`;
@@ -187893,11 +188829,11 @@ function rangeFrom(min, max, step) {
187893
188829
  * contribute, types never do (D14). A slice that is absent or does not parse is
187894
188830
  * "not answered": the state reads unknown, no row is drawn (D315, D393).
187895
188831
  */
187896
- var same = (text) => t(text, text);
187897
- function tile(en, it, value) {
188832
+ var same$1 = (text) => t(text, text);
188833
+ function tile$1(en, it, value) {
187898
188834
  return {
187899
188835
  label: t(en, it),
187900
- value: same(value)
188836
+ value: same$1(value)
187901
188837
  };
187902
188838
  }
187903
188839
  function setpointSlider(id, cap, method, valueArg, value, range) {
@@ -187932,18 +188868,19 @@ var climateContribution = contribution("climate-control", ClimateControlStatusSc
187932
188868
  const status = climateStatusText(view);
187933
188869
  const facts = [];
187934
188870
  if (status !== null) facts.push(fact("climate", "thermometer", status));
187935
- if (view.humidity !== null) facts.push(fact("humidity", "droplets", same(`${Math.round(view.humidity)}%`)));
187936
- if (view.targetHumidity !== null) facts.push(fact("humidity", "droplets", same(`→ ${Math.round(view.targetHumidity)}%`)));
188871
+ if (view.humidity !== null) facts.push(fact("humidity", "droplets", same$1(`${Math.round(view.humidity)}%`)));
188872
+ if (view.targetHumidity !== null) facts.push(fact("humidity", "droplets", same$1(`→ ${Math.round(view.targetHumidity)}%`)));
187937
188873
  const left = [];
187938
188874
  const right = [];
187939
- if (view.measured !== null) left.push(tile("Indoor", "In casa", formatDegrees(view.measured)));
187940
- if (view.humidity !== null) left.push(tile("Humidity", "Umidità", `${Math.round(view.humidity)}%`));
188875
+ if (view.measured !== null) left.push(tile$1("Indoor", "In casa", formatDegrees(view.measured)));
188876
+ if (view.humidity !== null) left.push(tile$1("Humidity", "Umidità", `${Math.round(view.humidity)}%`));
187941
188877
  const modeControls = [{
187942
188878
  kind: "picker",
187943
188879
  id: "climate.mode",
187944
188880
  label: t("Mode", "Modalità"),
187945
188881
  current: view.mode,
187946
- options: [...view.availableModes],
188882
+ options: [...view.availableModes.filter((m) => m !== "off"), ...view.availableModes.filter((m) => m === "off")],
188883
+ optionLabels: modeLabelsOf(view.availableModes),
187947
188884
  call: {
187948
188885
  cap: "climate-control",
187949
188886
  method: "setMode",
@@ -187971,6 +188908,7 @@ var climateContribution = contribution("climate-control", ClimateControlStatusSc
187971
188908
  label: t("Fan", "Ventola"),
187972
188909
  current: slice.fanMode === "" ? null : slice.fanMode,
187973
188910
  options: [...slice.availableFanModes],
188911
+ optionLabels: Object.fromEntries(slice.availableFanModes.map((m) => [m, fanLabelOf(m)])),
187974
188912
  call: {
187975
188913
  cap: "climate-control",
187976
188914
  method: "setFanMode",
@@ -187996,14 +188934,15 @@ var climateContribution = contribution("climate-control", ClimateControlStatusSc
187996
188934
  if (fanControls.length > 0) rows.push({
187997
188935
  id: "climate-fan",
187998
188936
  icon: "fan",
187999
- status: slice.fanMode === "" ? null : same(slice.fanMode),
188937
+ status: slice.fanMode === "" ? null : same$1(slice.fanMode),
188000
188938
  controls: fanControls
188001
188939
  });
188002
- 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)));
188940
+ 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)));
188003
188941
  const sceneMode = view.sceneMode;
188004
188942
  return {
188005
188943
  reading: reading("climate-control", view.isOff ? "off" : "on"),
188006
188944
  title: view.modeLabel,
188945
+ ...view.isOff || slice.fanMode === "" ? {} : { caption: t(`${view.modeLabel.en} · fan ${fanLabelOf(slice.fanMode).en}`, `${view.modeLabel.it} · ventola ${fanLabelOf(slice.fanMode).it}`) },
188007
188946
  facts,
188008
188947
  ...left.length === 0 && right.length === 0 ? {} : { tiles: {
188009
188948
  left,
@@ -188030,7 +188969,7 @@ var WATER_ON_PREFERENCE = [
188030
188969
  "performance"
188031
188970
  ];
188032
188971
  function capitalised(word) {
188033
- return same(word.charAt(0).toUpperCase() + word.slice(1).replace(/_/g, " "));
188972
+ return same$1(word.charAt(0).toUpperCase() + word.slice(1).replace(/_/g, " "));
188034
188973
  }
188035
188974
  var waterHeaterContribution = contribution("water-heater", WaterHeaterStatusSchema, (slice) => {
188036
188975
  if (slice === void 0 || slice.operationMode === null) return { reading: reading("climate-control", "unknown") };
@@ -188067,13 +189006,13 @@ var waterHeaterContribution = contribution("water-heater", WaterHeaterStatusSche
188067
189006
  icon: "flame",
188068
189007
  status: label,
188069
189008
  controls: modeControls
188070
- }, ...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))];
189009
+ }, ...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))];
188071
189010
  const level = levelWithin(slice.targetTemp, range);
188072
189011
  return {
188073
189012
  reading: reading("climate-control", isOff ? "off" : "on"),
188074
189013
  title: label,
188075
189014
  facts: status === null ? [] : [fact("climate", "flame", status)],
188076
- ...slice.currentTemp === null ? {} : { tiles: { left: [tile("Water", "Acqua", formatDegrees(slice.currentTemp))] } },
189015
+ ...slice.currentTemp === null ? {} : { tiles: { left: [tile$1("Water", "Acqua", formatDegrees(slice.currentTemp))] } },
188077
189016
  scene: {
188078
189017
  ...isOff ? {} : { mode: "heat" },
188079
189018
  ...level === null ? {} : { level }
@@ -188091,11 +189030,12 @@ var waterHeaterContribution = contribution("water-heater", WaterHeaterStatusSche
188091
189030
  var heatingValveContribution = contribution("heating-valve", HeatingValveStatusSchema, (slice) => {
188092
189031
  const position = slice?.position ?? null;
188093
189032
  if (position === null) return { reading: reading("sensor", "unknown") };
188094
- const text = same(`${Math.round(position)}%`);
189033
+ const text = same$1(`${Math.round(position)}%`);
188095
189034
  return {
188096
189035
  reading: reading("sensor", position > 0 ? "running" : "idle"),
188097
189036
  facts: [fact("valve", "gauge", t(`Valve ${text.en}`, `Valvola ${text.it}`))],
188098
- tiles: { right: [tile("Valve", "Valvola", text.en)] },
189037
+ tiles: { right: [tile$1("Valve", "Valvola", text.en)] },
189038
+ ...position > 0 ? { caption: t(`Heating · valve ${text.en}`, `Riscalda · valvola ${text.it}`) } : {},
188099
189039
  scene: { level: position / 100 }
188100
189040
  };
188101
189041
  });
@@ -188104,9 +189044,9 @@ function sensorFragment(value, id, icon, en, it, text) {
188104
189044
  if (value === null) return { reading: reading("sensor", "unknown") };
188105
189045
  return {
188106
189046
  reading: reading("sensor", "on"),
188107
- title: same(text),
188108
- facts: [fact(id, icon, same(text))],
188109
- tiles: { right: [tile(en, it, text)] }
189047
+ title: same$1(text),
189048
+ facts: [fact(id, icon, same$1(text))],
189049
+ tiles: { right: [tile$1(en, it, text)] }
188110
189050
  };
188111
189051
  }
188112
189052
  var temperatureContribution = contribution("temperature-sensor", TemperatureSensorStatusSchema, (slice) => sensorFragment(slice?.temperature ?? null, "temperature", "thermometer", "Temperature", "Temperatura", formatDegrees(slice?.temperature ?? 0)));
@@ -188161,8 +189101,8 @@ var CLIMATE_FAMILY_CONTRIBUTIONS = {
188161
189101
  return {
188162
189102
  reading: reading("sensor", "on"),
188163
189103
  ...slice.aqi === void 0 ? {} : { title: airQualityWord(slice.aqi) },
188164
- facts: parts.map((p) => fact("air-quality", "wind", same(`${p.label} ${p.value}`))),
188165
- tiles: { right: parts.slice(0, 2).map((p) => tile(p.label, p.label, p.value)) }
189104
+ facts: parts.map((p) => fact("air-quality", "wind", same$1(`${p.label} ${p.value}`))),
189105
+ tiles: { right: parts.slice(0, 2).map((p) => tile$1(p.label, p.label, p.value)) }
188166
189106
  };
188167
189107
  }),
188168
189108
  "carbon-monoxide": contribution("carbon-monoxide", CarbonMonoxideStatusSchema, (slice) => {
@@ -188177,15 +189117,270 @@ var CLIMATE_FAMILY_CONTRIBUTIONS = {
188177
189117
  "numeric-sensor": numericContribution,
188178
189118
  "enum-sensor": enumContribution
188179
189119
  };
189120
+ /**
189121
+ * The heat pump's contribution to a hero (D1026): the compressor scene, every
189122
+ * circuit as a row with its own label and icon, the powers as pills (the
189123
+ * instantaneous COP is "—" when it cannot be computed) and a "System" group with
189124
+ * one selector per mode. Values and their limits come from the slice, which the
189125
+ * gateway filled: a selector with no allowed value is not drawn, a missing
189126
+ * reading is never a 0 (D393).
189127
+ */
189128
+ var CAP = "heat-pump-control";
189129
+ var same = (text) => t(text, text);
189130
+ /** The words of the values the gateway names; a value not listed is drawn as the gateway wrote it. */
189131
+ var VALUE_LABELS = {
189132
+ off: t("Off", "Off"),
189133
+ on: t("On", "On"),
189134
+ auto: t("Auto", "Auto"),
189135
+ manual: t("Manual", "Manuale"),
189136
+ low: t("Low", "Bassa"),
189137
+ high: t("High", "Alta"),
189138
+ eco: t("Eco", "Eco"),
189139
+ heat: t("Heat", "Caldo"),
189140
+ cool: t("Cool", "Freddo"),
189141
+ heatCool: t("Heat/cool", "Caldo/freddo"),
189142
+ ownprogram: t("Programme", "Programma")
189143
+ };
189144
+ function valueLabel(value) {
189145
+ const known = VALUE_LABELS[value];
189146
+ if (known !== void 0) return known;
189147
+ const holiday = /^hm(\d+)$/.exec(value);
189148
+ if (holiday?.[1] !== void 0) return t(`Programme ${holiday[1]}`, `Programma ${holiday[1]}`);
189149
+ return same(value);
189150
+ }
189151
+ function optionLabels(allowed) {
189152
+ return Object.fromEntries(allowed.map((value) => [value, valueLabel(value)]));
189153
+ }
189154
+ function picker(id, label, setting, method, args, valueArg = "mode") {
189155
+ return {
189156
+ kind: "picker",
189157
+ id,
189158
+ label,
189159
+ current: setting.value,
189160
+ options: [...setting.allowed],
189161
+ optionLabels: optionLabels(setting.allowed),
189162
+ call: {
189163
+ cap: CAP,
189164
+ method,
189165
+ args: { ...args }
189166
+ },
189167
+ valueArg
189168
+ };
189169
+ }
189170
+ /** A selector exists only where the gateway named values to choose from. */
189171
+ function choosable(setting) {
189172
+ return setting !== null && setting.allowed.length > 0;
189173
+ }
189174
+ function circuitControl(circuit) {
189175
+ const args = { circuitId: circuit.id };
189176
+ if (circuit.kind === "dhw" && choosable(circuit.temperatureLevel)) return picker(`heat-pump.${circuit.id}.level`, t("Level", "Livello"), circuit.temperatureLevel, "setDhwTemperatureLevel", args, "level");
189177
+ if (!choosable(circuit.operationMode)) return null;
189178
+ const method = circuit.kind === "dhw" ? "setDhwOperationMode" : "setCircuitOperationMode";
189179
+ return picker(`heat-pump.${circuit.id}.mode`, t("Mode", "Modalità"), circuit.operationMode, method, args);
189180
+ }
189181
+ /** A circuit with no reading is still a row: it shows that nothing is known, not nothing. */
189182
+ var UNKNOWN_STATUS = same("—");
189183
+ function circuitRow(circuit) {
189184
+ const control = circuitControl(circuit);
189185
+ const status = thermalStatusText(circuit.targetTemp, circuit.currentTemp) ?? UNKNOWN_STATUS;
189186
+ return {
189187
+ id: "circuit",
189188
+ label: same(circuit.label),
189189
+ icon: circuit.icon,
189190
+ status,
189191
+ controls: control === null ? [] : [control]
189192
+ };
189193
+ }
189194
+ var kilowatts = (watts) => `${Number((watts / 1e3).toFixed(2))} kW`;
189195
+ /** A COP that cannot be computed is still the pill: "—", never an absent reading (D393). */
189196
+ function copPill(cop) {
189197
+ if (cop === null) return {
189198
+ icon: "gauge",
189199
+ text: t("Instantaneous COP —", "COP istantaneo —"),
189200
+ tone: "muted"
189201
+ };
189202
+ const text = String(Number(cop.toFixed(1)));
189203
+ return {
189204
+ icon: "gauge",
189205
+ text: t(`Instantaneous COP ${text}`, `COP istantaneo ${text}`),
189206
+ tone: "success"
189207
+ };
189208
+ }
189209
+ function powerPills(status) {
189210
+ const { thermalW, electricalW } = status.power;
189211
+ const pills = [];
189212
+ if (thermalW !== null) pills.push({
189213
+ icon: "flame",
189214
+ text: t(`Thermal ${kilowatts(thermalW)}`, `Termica ${kilowatts(thermalW)}`),
189215
+ tone: "muted"
189216
+ });
189217
+ if (electricalW !== null) pills.push({
189218
+ icon: "zap",
189219
+ text: t(`Electrical ${kilowatts(electricalW)}`, `Elettrica ${kilowatts(electricalW)}`),
189220
+ tone: "muted"
189221
+ });
189222
+ pills.push(copPill(heatPumpInstantCop(status.power)));
189223
+ return pills;
189224
+ }
189225
+ /** The independent system modes, in the order the card draws them. */
189226
+ var SYSTEM_MODES = [
189227
+ {
189228
+ key: "silent",
189229
+ label: t("Silent", "Silenzioso"),
189230
+ icon: "volume-x",
189231
+ method: "setSilentMode"
189232
+ },
189233
+ {
189234
+ key: "away",
189235
+ label: t("Away", "Assente"),
189236
+ icon: "plane",
189237
+ method: "setAwayMode"
189238
+ },
189239
+ {
189240
+ key: "additionalHeater",
189241
+ label: t("Additional heater", "Riscaldatore aggiuntivo"),
189242
+ icon: "flame",
189243
+ method: "setAdditionalHeaterMode"
189244
+ },
189245
+ {
189246
+ key: "holiday",
189247
+ label: t("Holiday", "Vacanza"),
189248
+ icon: "tree-palm",
189249
+ method: "setHolidayMode"
189250
+ }
189251
+ ];
189252
+ var SYSTEM_GROUP = t("System", "Sistema");
189253
+ var PROGRAMME = /^hm\d+$/;
189254
+ /**
189255
+ * Holiday is two segments, off / programme. Choosing "programme" keeps the programme
189256
+ * that is set, else the first one the gateway allowed, so a write never leaves
189257
+ * `allowed`. The full hm1..hm8 pick is not in the hero (D1026). A holiday whose values
189258
+ * are not programmes keeps the plain selector.
189259
+ */
189260
+ function holidayRow(def, setting) {
189261
+ if (!setting.allowed.includes("off")) return null;
189262
+ const current = setting.value !== null && PROGRAMME.test(setting.value) ? setting.value : null;
189263
+ const programme = current ?? setting.allowed.find((v) => PROGRAMME.test(v));
189264
+ if (programme === void 0) return null;
189265
+ const control = picker("heat-pump.system.holiday", def.label, {
189266
+ value: setting.value,
189267
+ allowed: ["off", programme]
189268
+ }, def.method, {});
189269
+ const number = programme.slice(2);
189270
+ return {
189271
+ id: "system-mode",
189272
+ label: def.label,
189273
+ group: SYSTEM_GROUP,
189274
+ icon: def.icon,
189275
+ status: current === null ? null : t(`Programme ${number}`, `Programma ${number}`),
189276
+ controls: [control.kind === "picker" ? {
189277
+ ...control,
189278
+ optionLabels: {
189279
+ off: t("Off", "Off"),
189280
+ [programme]: t("Programme", "Programma")
189281
+ }
189282
+ } : control]
189283
+ };
189284
+ }
189285
+ function systemRows(status) {
189286
+ const rows = [];
189287
+ for (const def of SYSTEM_MODES) {
189288
+ const setting = status.system[def.key];
189289
+ if (!choosable(setting)) continue;
189290
+ if (def.key === "holiday") {
189291
+ const holiday = holidayRow(def, setting);
189292
+ if (holiday !== null) {
189293
+ rows.push(holiday);
189294
+ continue;
189295
+ }
189296
+ }
189297
+ rows.push({
189298
+ id: "system-mode",
189299
+ label: def.label,
189300
+ group: SYSTEM_GROUP,
189301
+ icon: def.icon,
189302
+ status: null,
189303
+ controls: [picker(`heat-pump.system.${def.key}`, def.label, setting, def.method, {})]
189304
+ });
189305
+ }
189306
+ return rows;
189307
+ }
189308
+ function tile(en, it, value) {
189309
+ return {
189310
+ label: t(en, it),
189311
+ value: same(value)
189312
+ };
189313
+ }
189314
+ function tilesOf$1(status) {
189315
+ const { supply, return: back, outdoor } = status.temperatures;
189316
+ const left = [];
189317
+ const right = [];
189318
+ if (supply !== null) left.push(tile("Supply", "Mandata", formatDegrees(supply)));
189319
+ if (back !== null) left.push(tile("Return", "Ritorno", formatDegrees(back)));
189320
+ if (outdoor !== null) right.push(tile("Outdoor", "Esterna", formatDegrees(outdoor)));
189321
+ if (status.waterPressureBar !== null) right.push(tile("Pressure", "Pressione", `${Number(status.waterPressureBar.toFixed(1))} bar`));
189322
+ return {
189323
+ left,
189324
+ right
189325
+ };
189326
+ }
189327
+ function isRunning(status) {
189328
+ const { compressorPct, electricalW } = status.power;
189329
+ if (compressorPct !== null) return compressorPct > 0;
189330
+ if (electricalW !== null) return electricalW > 0;
189331
+ return null;
189332
+ }
189333
+ var HEAT_PUMP_FAMILY_CONTRIBUTIONS = { "heat-pump-status": contribution("heat-pump-status", HeatPumpStatusSchema, (slice) => {
189334
+ if (slice === void 0) return { reading: reading("climate-control", "unknown") };
189335
+ const running = isRunning(slice);
189336
+ const facts = [];
189337
+ if (slice.power.electricalW !== null) facts.push(fact("power", "zap", same(`${Math.round(slice.power.electricalW)} W`)));
189338
+ if (slice.power.compressorPct !== null) facts.push(fact("level", "gauge", t(`Compressor ${Math.round(slice.power.compressorPct)} %`, `Compressore ${Math.round(slice.power.compressorPct)} %`)));
189339
+ const charging = slice.circuits.find((c) => c.active === true);
189340
+ const tiles = tilesOf$1(slice);
189341
+ const pills = powerPills(slice);
189342
+ const rows = [
189343
+ ...slice.circuits.map(circuitRow),
189344
+ ...pills.length === 0 ? [] : [{
189345
+ id: "heat-pump-power",
189346
+ icon: "zap",
189347
+ status: null,
189348
+ controls: [],
189349
+ pills: [...pills]
189350
+ }],
189351
+ ...systemRows(slice)
189352
+ ];
189353
+ return {
189354
+ reading: reading("climate-control", running === true ? "running" : running === false ? "idle" : "on"),
189355
+ title: t("Heat pump", "Pompa di calore"),
189356
+ ...charging === void 0 ? {} : { caption: t(`${charging.label} · heating`.toUpperCase(), `${charging.label} · in riscaldamento`.toUpperCase()) },
189357
+ facts,
189358
+ ...tiles.left.length === 0 && tiles.right.length === 0 ? {} : { tiles },
189359
+ ...slice.power.electricalW === null ? {} : { consumption: {
189360
+ priority: 1,
189361
+ slot: {
189362
+ kind: "power",
189363
+ watts: slice.power.electricalW,
189364
+ detail: slice.power.thermalW === null ? [] : [{
189365
+ label: t("Thermal", "Termica"),
189366
+ value: Math.round(slice.power.thermalW),
189367
+ unit: "W"
189368
+ }]
189369
+ }
189370
+ } },
189371
+ rows
189372
+ };
189373
+ }) };
188180
189374
  [
188181
189375
  ...Object.values(ACCESS_FAMILY_CONTRIBUTIONS),
188182
189376
  ...Object.values(DEVICES_FAMILY_CONTRIBUTIONS),
188183
189377
  ...Object.values(GROUPS_FAMILY_CONTRIBUTIONS),
188184
189378
  ...Object.values(ACTUATORS_FAMILY_CONTRIBUTIONS),
188185
189379
  ...Object.values(SENSORS_FAMILY_CONTRIBUTIONS),
188186
- ...Object.values(CLIMATE_FAMILY_CONTRIBUTIONS)
189380
+ ...Object.values(CLIMATE_FAMILY_CONTRIBUTIONS),
189381
+ ...Object.values(HEAT_PUMP_FAMILY_CONTRIBUTIONS)
188187
189382
  ];
188188
- 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;
189383
+ 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;
188189
189384
  /**
188190
189385
  * Who looks like what (D1023). One look per {@link DeviceType}, refined by a
188191
189386
  * {@link DeviceRole} where the role changes how the device reads (a leak
@@ -188575,7 +189770,7 @@ lookOf({
188575
189770
  ({ ...lookOf({
188576
189771
  icon: "shield-check",
188577
189772
  on: [
188578
- "success",
189773
+ "danger",
188579
189774
  "glow",
188580
189775
  "halo"
188581
189776
  ],
@@ -188813,8 +190008,24 @@ lookOf({
188813
190008
  idle: INFO,
188814
190009
  standby: MUTED
188815
190010
  });
190011
+ lookOf({
190012
+ icon: "thermometer-sun",
190013
+ on: [
190014
+ "warning",
190015
+ "heat-rise",
190016
+ "rise"
190017
+ ],
190018
+ off: MUTED,
190019
+ running: [
190020
+ "warning",
190021
+ "heat-rise",
190022
+ "rise"
190023
+ ],
190024
+ idle: INFO,
190025
+ standby: MUTED
190026
+ });
188816
190027
  DeviceType.Climate, DeviceType.Thermostat;
188817
- 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;
190028
+ 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;
188818
190029
  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;
188819
190030
  Object.freeze({
188820
190031
  "accessories.getStatus": {
@@ -189195,13 +190406,6 @@ Object.freeze({
189195
190406
  access: "view",
189196
190407
  role: "admin"
189197
190408
  },
189198
- "addonSettings.getIntegrationFormSchema": {
189199
- capName: "addon-settings",
189200
- capScope: "system",
189201
- addonId: null,
189202
- access: "view",
189203
- role: "admin"
189204
- },
189205
190409
  "addonSettings.getScopedSettings": {
189206
190410
  capName: "addon-settings",
189207
190411
  capScope: "system",
@@ -190049,6 +191253,27 @@ Object.freeze({
190049
191253
  access: "create",
190050
191254
  role: "viewer"
190051
191255
  },
191256
+ "clusterUpdate.getClusterUpdateJob": {
191257
+ capName: "cluster-update",
191258
+ capScope: "system",
191259
+ addonId: null,
191260
+ access: "view",
191261
+ role: "admin"
191262
+ },
191263
+ "clusterUpdate.previewClusterUpdate": {
191264
+ capName: "cluster-update",
191265
+ capScope: "system",
191266
+ addonId: null,
191267
+ access: "view",
191268
+ role: "admin"
191269
+ },
191270
+ "clusterUpdate.startClusterUpdate": {
191271
+ capName: "cluster-update",
191272
+ capScope: "system",
191273
+ addonId: null,
191274
+ access: "create",
191275
+ role: "admin"
191276
+ },
190052
191277
  "color.getStatus": {
190053
191278
  capName: "color",
190054
191279
  capScope: "device",
@@ -190651,41 +191876,6 @@ Object.freeze({
190651
191876
  access: "create",
190652
191877
  role: "admin"
190653
191878
  },
190654
- "deviceDiscovery.adoptDevice": {
190655
- capName: "device-discovery",
190656
- capScope: "device",
190657
- addonId: null,
190658
- access: "create",
190659
- role: "admin"
190660
- },
190661
- "deviceDiscovery.getStatus": {
190662
- capName: "device-discovery",
190663
- capScope: "device",
190664
- addonId: null,
190665
- access: "view",
190666
- role: "viewer"
190667
- },
190668
- "deviceDiscovery.listDiscovered": {
190669
- capName: "device-discovery",
190670
- capScope: "device",
190671
- addonId: null,
190672
- access: "view",
190673
- role: "viewer"
190674
- },
190675
- "deviceDiscovery.refreshDiscovery": {
190676
- capName: "device-discovery",
190677
- capScope: "device",
190678
- addonId: null,
190679
- access: "create",
190680
- role: "admin"
190681
- },
190682
- "deviceDiscovery.releaseDevice": {
190683
- capName: "device-discovery",
190684
- capScope: "device",
190685
- addonId: null,
190686
- access: "create",
190687
- role: "admin"
190688
- },
190689
191879
  "deviceExport.applyDeviceSettingsPatch": {
190690
191880
  capName: "device-export",
190691
191881
  capScope: "system",
@@ -190987,6 +192177,13 @@ Object.freeze({
190987
192177
  access: "create",
190988
192178
  role: "admin"
190989
192179
  },
192180
+ "deviceManager.checkDeviceTemplates": {
192181
+ capName: "device-manager",
192182
+ capScope: "system",
192183
+ addonId: null,
192184
+ access: "view",
192185
+ role: "admin"
192186
+ },
190990
192187
  "deviceManager.cleanupDeletedDevicesData": {
190991
192188
  capName: "device-manager",
190992
192189
  capScope: "system",
@@ -191386,6 +192583,13 @@ Object.freeze({
191386
192583
  access: "create",
191387
192584
  role: "admin"
191388
192585
  },
192586
+ "deviceManager.renderDeviceTemplates": {
192587
+ capName: "device-manager",
192588
+ capScope: "system",
192589
+ addonId: null,
192590
+ access: "view",
192591
+ role: "admin"
192592
+ },
191389
192593
  "deviceManager.reportDiscoveryObservations": {
191390
192594
  capName: "device-manager",
191391
192595
  capScope: "system",
@@ -191407,6 +192611,13 @@ Object.freeze({
191407
192611
  access: "create",
191408
192612
  role: "admin"
191409
192613
  },
192614
+ "deviceManager.search": {
192615
+ capName: "device-manager",
192616
+ capScope: "system",
192617
+ addonId: null,
192618
+ access: "view",
192619
+ role: "viewer"
192620
+ },
191410
192621
  "deviceManager.setAlias": {
191411
192622
  capName: "device-manager",
191412
192623
  capScope: "system",
@@ -191498,6 +192709,13 @@ Object.freeze({
191498
192709
  access: "create",
191499
192710
  role: "admin"
191500
192711
  },
192712
+ "deviceManager.setPrimaryChildPreference": {
192713
+ capName: "device-manager",
192714
+ capScope: "system",
192715
+ addonId: null,
192716
+ access: "create",
192717
+ role: "admin"
192718
+ },
191501
192719
  "deviceManager.setRole": {
191502
192720
  capName: "device-manager",
191503
192721
  capScope: "system",
@@ -192317,6 +193535,111 @@ Object.freeze({
192317
193535
  access: "view",
192318
193536
  role: "viewer"
192319
193537
  },
193538
+ "heatPumpControl.setAdditionalHeaterMode": {
193539
+ capName: "heat-pump-control",
193540
+ capScope: "device",
193541
+ addonId: null,
193542
+ access: "create",
193543
+ role: "viewer"
193544
+ },
193545
+ "heatPumpControl.setAwayMode": {
193546
+ capName: "heat-pump-control",
193547
+ capScope: "device",
193548
+ addonId: null,
193549
+ access: "create",
193550
+ role: "viewer"
193551
+ },
193552
+ "heatPumpControl.setCircuitComfortSetpoint": {
193553
+ capName: "heat-pump-control",
193554
+ capScope: "device",
193555
+ addonId: null,
193556
+ access: "create",
193557
+ role: "viewer"
193558
+ },
193559
+ "heatPumpControl.setCircuitEcoSetpoint": {
193560
+ capName: "heat-pump-control",
193561
+ capScope: "device",
193562
+ addonId: null,
193563
+ access: "create",
193564
+ role: "viewer"
193565
+ },
193566
+ "heatPumpControl.setCircuitHeatCoolMode": {
193567
+ capName: "heat-pump-control",
193568
+ capScope: "device",
193569
+ addonId: null,
193570
+ access: "create",
193571
+ role: "viewer"
193572
+ },
193573
+ "heatPumpControl.setCircuitMaxFlowTemp": {
193574
+ capName: "heat-pump-control",
193575
+ capScope: "device",
193576
+ addonId: null,
193577
+ access: "create",
193578
+ role: "viewer"
193579
+ },
193580
+ "heatPumpControl.setCircuitOperationMode": {
193581
+ capName: "heat-pump-control",
193582
+ capScope: "device",
193583
+ addonId: null,
193584
+ access: "create",
193585
+ role: "viewer"
193586
+ },
193587
+ "heatPumpControl.setCircuitSummerWinter": {
193588
+ capName: "heat-pump-control",
193589
+ capScope: "device",
193590
+ addonId: null,
193591
+ access: "create",
193592
+ role: "viewer"
193593
+ },
193594
+ "heatPumpControl.setDhwChargeDuration": {
193595
+ capName: "heat-pump-control",
193596
+ capScope: "device",
193597
+ addonId: null,
193598
+ access: "create",
193599
+ role: "viewer"
193600
+ },
193601
+ "heatPumpControl.setDhwOperationMode": {
193602
+ capName: "heat-pump-control",
193603
+ capScope: "device",
193604
+ addonId: null,
193605
+ access: "create",
193606
+ role: "viewer"
193607
+ },
193608
+ "heatPumpControl.setDhwTemperatureLevel": {
193609
+ capName: "heat-pump-control",
193610
+ capScope: "device",
193611
+ addonId: null,
193612
+ access: "create",
193613
+ role: "viewer"
193614
+ },
193615
+ "heatPumpControl.setHolidayMode": {
193616
+ capName: "heat-pump-control",
193617
+ capScope: "device",
193618
+ addonId: null,
193619
+ access: "create",
193620
+ role: "viewer"
193621
+ },
193622
+ "heatPumpControl.setSilentMode": {
193623
+ capName: "heat-pump-control",
193624
+ capScope: "device",
193625
+ addonId: null,
193626
+ access: "create",
193627
+ role: "viewer"
193628
+ },
193629
+ "heatPumpControl.startExtraHotWater": {
193630
+ capName: "heat-pump-control",
193631
+ capScope: "device",
193632
+ addonId: null,
193633
+ access: "create",
193634
+ role: "viewer"
193635
+ },
193636
+ "heatPumpStatus.getStatus": {
193637
+ capName: "heat-pump-status",
193638
+ capScope: "device",
193639
+ addonId: null,
193640
+ access: "view",
193641
+ role: "viewer"
193642
+ },
192320
193643
  "heroLayout.getHeroModel": {
192321
193644
  capName: "hero-layout",
192322
193645
  capScope: "system",
@@ -194074,13 +195397,6 @@ Object.freeze({
194074
195397
  access: "create",
194075
195398
  role: "admin"
194076
195399
  },
194077
- "notificationRules.createSequence": {
194078
- capName: "notification-rules",
194079
- capScope: "system",
194080
- addonId: null,
194081
- access: "create",
194082
- role: "admin"
194083
- },
194084
195400
  "notificationRules.createSnooze": {
194085
195401
  capName: "notification-rules",
194086
195402
  capScope: "system",
@@ -194102,13 +195418,6 @@ Object.freeze({
194102
195418
  access: "delete",
194103
195419
  role: "admin"
194104
195420
  },
194105
- "notificationRules.deleteSequence": {
194106
- capName: "notification-rules",
194107
- capScope: "system",
194108
- addonId: null,
194109
- access: "delete",
194110
- role: "admin"
194111
- },
194112
195421
  "notificationRules.getAlarmConfig": {
194113
195422
  capName: "notification-rules",
194114
195423
  capScope: "system",
@@ -194158,13 +195467,6 @@ Object.freeze({
194158
195467
  access: "view",
194159
195468
  role: "admin"
194160
195469
  },
194161
- "notificationRules.getSequence": {
194162
- capName: "notification-rules",
194163
- capScope: "system",
194164
- addonId: null,
194165
- access: "view",
194166
- role: "admin"
194167
- },
194168
195470
  "notificationRules.getTemplateCatalog": {
194169
195471
  capName: "notification-rules",
194170
195472
  capScope: "system",
@@ -194186,13 +195488,6 @@ Object.freeze({
194186
195488
  access: "view",
194187
195489
  role: "admin"
194188
195490
  },
194189
- "notificationRules.listSequences": {
194190
- capName: "notification-rules",
194191
- capScope: "system",
194192
- addonId: null,
194193
- access: "view",
194194
- role: "admin"
194195
- },
194196
195491
  "notificationRules.listSnoozes": {
194197
195492
  capName: "notification-rules",
194198
195493
  capScope: "system",
@@ -194263,13 +195558,6 @@ Object.freeze({
194263
195558
  access: "create",
194264
195559
  role: "admin"
194265
195560
  },
194266
- "notificationRules.updateSequence": {
194267
- capName: "notification-rules",
194268
- capScope: "system",
194269
- addonId: null,
194270
- access: "create",
194271
- role: "admin"
194272
- },
194273
195561
  "notifier.cancel": {
194274
195562
  capName: "notifier",
194275
195563
  capScope: "device",
@@ -194354,21 +195642,21 @@ Object.freeze({
194354
195642
  access: "view",
194355
195643
  role: "admin"
194356
195644
  },
194357
- "osdManager.getSourceCatalog": {
195645
+ "osdManager.listTemplates": {
194358
195646
  capName: "osd-manager",
194359
195647
  capScope: "system",
194360
195648
  addonId: null,
194361
195649
  access: "view",
194362
195650
  role: "admin"
194363
195651
  },
194364
- "osdManager.listTemplates": {
195652
+ "osdManager.previewSlot": {
194365
195653
  capName: "osd-manager",
194366
195654
  capScope: "system",
194367
195655
  addonId: null,
194368
- access: "view",
195656
+ access: "create",
194369
195657
  role: "admin"
194370
195658
  },
194371
- "osdManager.previewSlot": {
195659
+ "osdManager.previewTemplate": {
194372
195660
  capName: "osd-manager",
194373
195661
  capScope: "system",
194374
195662
  addonId: null,
@@ -196067,28 +197355,28 @@ Object.freeze({
196067
197355
  capScope: "device",
196068
197356
  addonId: null,
196069
197357
  access: "create",
196070
- role: "admin"
197358
+ role: "viewer"
196071
197359
  },
196072
197360
  "powerSource.getStatus": {
196073
197361
  capName: "power-source",
196074
197362
  capScope: "device",
196075
197363
  addonId: null,
196076
197364
  access: "view",
196077
- role: "admin"
197365
+ role: "viewer"
196078
197366
  },
196079
197367
  "powerSource.powerOff": {
196080
197368
  capName: "power-source",
196081
197369
  capScope: "device",
196082
197370
  addonId: null,
196083
197371
  access: "create",
196084
- role: "admin"
197372
+ role: "viewer"
196085
197373
  },
196086
197374
  "powerSource.powerOn": {
196087
197375
  capName: "power-source",
196088
197376
  capScope: "device",
196089
197377
  addonId: null,
196090
197378
  access: "create",
196091
- role: "admin"
197379
+ role: "viewer"
196092
197380
  },
196093
197381
  "presence.getStatus": {
196094
197382
  capName: "presence",
@@ -197224,13 +198512,6 @@ Object.freeze({
197224
198512
  access: "create",
197225
198513
  role: "admin"
197226
198514
  },
197227
- "smtpProvider.verify": {
197228
- capName: "smtp-provider",
197229
- capScope: "system",
197230
- addonId: null,
197231
- access: "view",
197232
- role: "admin"
197233
- },
197234
198515
  "snapshot.applyDeviceSettingsPatch": {
197235
198516
  capName: "snapshot",
197236
198517
  capScope: "device",
@@ -199163,8 +200444,26 @@ function projectAction(cap, action) {
199163
200444
  };
199164
200445
  }
199165
200446
  Object.entries(CAP_VOCABULARY_BY_NAME).flatMap(([cap, entry]) => entry.scope === "device" ? (entry.actions ?? []).map((a) => projectAction(cap, a)) : []);
199166
- 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;
200447
+ 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;
199167
200448
  DeviceFeature.BatteryOperated;
200449
+ function bound(cap, methods = [], authority = "reported") {
200450
+ return {
200451
+ kind: "cap",
200452
+ cap,
200453
+ methods,
200454
+ authority
200455
+ };
200456
+ }
200457
+ function derived(cap, methods = []) {
200458
+ return bound(cap, methods, "derived");
200459
+ }
200460
+ DeviceFeature.BatteryOperated, DeviceFeature.Rebootable, derived("reboot", ["reboot"]), DeviceFeature.Resyncable, DeviceFeature.NativeSnapshot, DeviceFeature.DoorbellButton, derived("doorbell"), DeviceFeature.TwoWayAudio, derived("intercom", [
200461
+ "startTalkSession",
200462
+ "pushTalkAudio",
200463
+ "endTalkSession"
200464
+ ]), 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");
200465
+ var ALL_FEATURES = Object.values(DeviceFeature);
200466
+ new Set(ALL_FEATURES);
199168
200467
  DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher;
199169
200468
  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.";
199170
200469
  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.";
@@ -199356,7 +200655,6 @@ function createRuntimeStateBridge(params) {
199356
200655
  getStatus
199357
200656
  };
199358
200657
  }
199359
- string().min(1).max(4096);
199360
200658
  Object.freeze({
199361
200659
  "accessories.getStatus": [{
199362
200660
  name: "deviceId",
@@ -199787,35 +201085,6 @@ Object.freeze({
199787
201085
  form: "single",
199788
201086
  optional: false
199789
201087
  }],
199790
- "deviceDiscovery.adoptDevice": [{
199791
- name: "deviceId",
199792
- form: "single",
199793
- optional: false
199794
- }],
199795
- "deviceDiscovery.getStatus": [{
199796
- name: "deviceId",
199797
- form: "single",
199798
- optional: false
199799
- }],
199800
- "deviceDiscovery.listDiscovered": [{
199801
- name: "deviceId",
199802
- form: "single",
199803
- optional: false
199804
- }],
199805
- "deviceDiscovery.refreshDiscovery": [{
199806
- name: "deviceId",
199807
- form: "single",
199808
- optional: false
199809
- }],
199810
- "deviceDiscovery.releaseDevice": [{
199811
- name: "childDeviceId",
199812
- form: "single",
199813
- optional: false
199814
- }, {
199815
- name: "deviceId",
199816
- form: "single",
199817
- optional: false
199818
- }],
199819
201088
  "deviceExport.applyDeviceSettingsPatch": [{
199820
201089
  name: "deviceId",
199821
201090
  form: "single",
@@ -200094,6 +201363,11 @@ Object.freeze({
200094
201363
  form: "single",
200095
201364
  optional: false
200096
201365
  }],
201366
+ "deviceManager.setPrimaryChildPreference": [{
201367
+ name: "deviceId",
201368
+ form: "single",
201369
+ optional: false
201370
+ }],
200097
201371
  "deviceManager.setRole": [{
200098
201372
  name: "deviceId",
200099
201373
  form: "single",
@@ -200439,6 +201713,81 @@ Object.freeze({
200439
201713
  form: "single",
200440
201714
  optional: false
200441
201715
  }],
201716
+ "heatPumpControl.setAdditionalHeaterMode": [{
201717
+ name: "deviceId",
201718
+ form: "single",
201719
+ optional: false
201720
+ }],
201721
+ "heatPumpControl.setAwayMode": [{
201722
+ name: "deviceId",
201723
+ form: "single",
201724
+ optional: false
201725
+ }],
201726
+ "heatPumpControl.setCircuitComfortSetpoint": [{
201727
+ name: "deviceId",
201728
+ form: "single",
201729
+ optional: false
201730
+ }],
201731
+ "heatPumpControl.setCircuitEcoSetpoint": [{
201732
+ name: "deviceId",
201733
+ form: "single",
201734
+ optional: false
201735
+ }],
201736
+ "heatPumpControl.setCircuitHeatCoolMode": [{
201737
+ name: "deviceId",
201738
+ form: "single",
201739
+ optional: false
201740
+ }],
201741
+ "heatPumpControl.setCircuitMaxFlowTemp": [{
201742
+ name: "deviceId",
201743
+ form: "single",
201744
+ optional: false
201745
+ }],
201746
+ "heatPumpControl.setCircuitOperationMode": [{
201747
+ name: "deviceId",
201748
+ form: "single",
201749
+ optional: false
201750
+ }],
201751
+ "heatPumpControl.setCircuitSummerWinter": [{
201752
+ name: "deviceId",
201753
+ form: "single",
201754
+ optional: false
201755
+ }],
201756
+ "heatPumpControl.setDhwChargeDuration": [{
201757
+ name: "deviceId",
201758
+ form: "single",
201759
+ optional: false
201760
+ }],
201761
+ "heatPumpControl.setDhwOperationMode": [{
201762
+ name: "deviceId",
201763
+ form: "single",
201764
+ optional: false
201765
+ }],
201766
+ "heatPumpControl.setDhwTemperatureLevel": [{
201767
+ name: "deviceId",
201768
+ form: "single",
201769
+ optional: false
201770
+ }],
201771
+ "heatPumpControl.setHolidayMode": [{
201772
+ name: "deviceId",
201773
+ form: "single",
201774
+ optional: false
201775
+ }],
201776
+ "heatPumpControl.setSilentMode": [{
201777
+ name: "deviceId",
201778
+ form: "single",
201779
+ optional: false
201780
+ }],
201781
+ "heatPumpControl.startExtraHotWater": [{
201782
+ name: "deviceId",
201783
+ form: "single",
201784
+ optional: false
201785
+ }],
201786
+ "heatPumpStatus.getStatus": [{
201787
+ name: "deviceId",
201788
+ form: "single",
201789
+ optional: false
201790
+ }],
200442
201791
  "heroLayout.getHeroModel": [{
200443
201792
  name: "deviceId",
200444
201793
  form: "single",
@@ -200898,12 +202247,12 @@ Object.freeze({
200898
202247
  form: "single",
200899
202248
  optional: false
200900
202249
  }],
200901
- "osdManager.getSourceCatalog": [{
202250
+ "osdManager.previewSlot": [{
200902
202251
  name: "deviceId",
200903
202252
  form: "single",
200904
202253
  optional: false
200905
202254
  }],
200906
- "osdManager.previewSlot": [{
202255
+ "osdManager.previewTemplate": [{
200907
202256
  name: "deviceId",
200908
202257
  form: "single",
200909
202258
  optional: false
@@ -203487,7 +204836,9 @@ var TimelapseRuleInputSchema = object({
203487
204836
  /** Classes the notification counts — see {@link ReportClassesField}. */
203488
204837
  reportClasses: ReportClassesField.optional(),
203489
204838
  /** Canonical notification priority ordinal (1..5); per-target overridable. */
203490
- priority: PriorityField.default(3)
204839
+ priority: PriorityField.default(3),
204840
+ /** Per-target settings keyed by target id (D1032) — absent = every target follows the rule. */
204841
+ targetOverrides: NcTargetOverridesSchema.optional()
203491
204842
  });
203492
204843
  object({
203493
204844
  name: NameField.optional(),
@@ -203503,7 +204854,9 @@ object({
203503
204854
  previewText: PreviewTextField.optional(),
203504
204855
  previewMode: PreviewModeField.optional(),
203505
204856
  reportClasses: ReportClassesField.optional(),
203506
- priority: PriorityField.optional()
204857
+ priority: PriorityField.optional(),
204858
+ /** Per-target settings keyed by target id (D1032) — absent = every target follows the rule. */
204859
+ targetOverrides: NcTargetOverridesSchema.optional()
203507
204860
  });
203508
204861
  TimelapseRuleInputSchema.extend({
203509
204862
  id: string(),
@@ -211861,6 +213214,19 @@ var HUB_DISCOVERY_REFRESH_TIMEOUT_MS = 8e3;
211861
213214
  var HUB_CHILD_SLEEP_RECONCILE_MS = 6e4;
211862
213215
  var HUB_RECONNECT_BASE_MS = 2e3;
211863
213216
  var HUB_RECONNECT_MAX_MS = 3e4;
213217
+ /**
213218
+ * Threshold for marking an adopted child offline when missing from consecutive refreshes.
213219
+ * 10 minutes covers ~3 default refresh cycles + transient firmware latency without
213220
+ * false-flagging battery cams that take a few cycles to wake into the list.
213221
+ */
213222
+ var HUB_MISSING_OFFLINE_MS = 10 * 6e4;
213223
+ /**
213224
+ * Longer grace for a child flagged asleep that drops off a non-empty hub list. A sleeping battery
213225
+ * camera may vanish from the summary for hours, but `battery.sleeping` is a persisted slice: a
213226
+ * camera that died or was unplugged while flagged asleep must still go offline eventually.
213227
+ * Measured from the last time the hub actually LISTED the child.
213228
+ */
213229
+ var SLEEPING_MISSING_OFFLINE_MS = 360 * 6e4;
211864
213230
  var UNROUTED_LOG_THROTTLE_MS = 6e4;
211865
213231
  /**
211866
213232
  * ONE Reolink NVR / Home Hub: a single Baichuan control + event socket fronting N channels,
@@ -211893,6 +213259,10 @@ var ReolinkHubSession = class {
211893
213259
  #refreshInFlight = null;
211894
213260
  /** Wall-clock ms of the last refresh that listed each child (by device id). */
211895
213261
  #childLastSeenAt = /* @__PURE__ */ new Map();
213262
+ /** The empty-list warning fired and the list has not been non-empty since. */
213263
+ #emptyListWarned = false;
213264
+ /** Children THIS session marked offline for being missing from the list (the only ones it may restore). */
213265
+ #offlineByMissing = /* @__PURE__ */ new Set();
211896
213266
  /** Channels the last good refresh listed but nobody adopted: their pushes are expected drops. */
211897
213267
  #knownUnadoptedChannels = /* @__PURE__ */ new Set();
211898
213268
  #unroutedLoggedAt = /* @__PURE__ */ new Map();
@@ -212191,13 +213561,25 @@ var ReolinkHubSession = class {
212191
213561
  */
212192
213562
  reconcileChildOnline(channels) {
212193
213563
  const now = this.#now();
213564
+ const cameras = this.#deps.children().filter((c) => c.channel !== void 0 && c.type === DeviceType.Camera);
213565
+ if (channels.length === 0 && cameras.length > 0) {
213566
+ if (!this.#emptyListWarned) {
213567
+ this.#emptyListWarned = true;
213568
+ this.#logger.warn("Reolink hub: channel list came back empty with adopted children — online state left unchanged", {
213569
+ tags: { integrationId: this.integrationId },
213570
+ meta: { adopted: cameras.length }
213571
+ });
213572
+ }
213573
+ return;
213574
+ }
213575
+ if (channels.length > 0) this.#emptyListWarned = false;
212194
213576
  const listed = new Set(channels.map((c) => c.channel));
212195
- for (const child of this.#deps.children()) {
213577
+ for (const child of cameras) {
212196
213578
  const ch = child.channel;
212197
213579
  if (ch === void 0) continue;
212198
- if (child.type !== DeviceType.Camera) continue;
212199
213580
  if (listed.has(ch)) {
212200
213581
  this.#childLastSeenAt.set(child.id, now);
213582
+ this.#offlineByMissing.delete(child.id);
212201
213583
  if (!child.online) {
212202
213584
  child.markOnline(true);
212203
213585
  this.#logger.info("Reolink hub: adopted child back online", {
@@ -212210,10 +213592,28 @@ var ReolinkHubSession = class {
212210
213592
  }
212211
213593
  continue;
212212
213594
  }
212213
- const lastSeen = this.#childLastSeenAt.get(child.id) ?? 0;
212214
- const missingMs = lastSeen > 0 ? now - lastSeen : Number.POSITIVE_INFINITY;
212215
- if (missingMs >= 6e5 && child.online) {
213595
+ let lastSeen = this.#childLastSeenAt.get(child.id);
213596
+ if (lastSeen === void 0) {
213597
+ lastSeen = now;
213598
+ this.#childLastSeenAt.set(child.id, now);
213599
+ }
213600
+ if (child.sleeping && !child.online && this.#offlineByMissing.has(child.id) && now - lastSeen < 216e5) {
213601
+ this.#offlineByMissing.delete(child.id);
213602
+ child.markOnline(true);
213603
+ this.#logger.info("Reolink hub: sleeping child restored to online", {
213604
+ tags: {
213605
+ deviceId: child.id,
213606
+ deviceName: child.name
213607
+ },
213608
+ meta: { channel: ch }
213609
+ });
213610
+ continue;
213611
+ }
213612
+ const graceMs = child.sleeping ? SLEEPING_MISSING_OFFLINE_MS : HUB_MISSING_OFFLINE_MS;
213613
+ const missingMs = now - lastSeen;
213614
+ if (missingMs >= graceMs && child.online) {
212216
213615
  child.markOnline(false);
213616
+ this.#offlineByMissing.add(child.id);
212217
213617
  this.#logger.warn("Reolink hub: adopted child marked offline (missing from the hub list)", {
212218
213618
  tags: {
212219
213619
  deviceId: child.id,
@@ -216335,6 +217735,9 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
216335
217735
  get online() {
216336
217736
  return camera.online;
216337
217737
  },
217738
+ get sleeping() {
217739
+ return camera.sleeping;
217740
+ },
216338
217741
  get debugGeneral() {
216339
217742
  return camera.config.get("debugGeneral") === true;
216340
217743
  },