@camstack/types 1.2.534 → 1.2.536

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/CHANGELOG.md +18 -3
  2. package/dist/addon.js +2 -2
  3. package/dist/addon.mjs +2 -2
  4. package/dist/automation/action.d.ts +105 -0
  5. package/dist/automation/index.d.ts +1 -0
  6. package/dist/automation/recipe.d.ts +450 -6
  7. package/dist/automation/scheduler.d.ts +208 -0
  8. package/dist/automation/step-condition.d.ts +19 -0
  9. package/dist/automation/step-runner.d.ts +50 -5
  10. package/dist/automation/trace.d.ts +129 -0
  11. package/dist/capabilities/action-source.cap.d.ts +52 -0
  12. package/dist/capabilities/actions.cap.d.ts +406 -0
  13. package/dist/capabilities/core-blocks.cap.d.ts +3782 -120
  14. package/dist/capabilities/device-manager.cap.d.ts +96 -0
  15. package/dist/capabilities/fan-presets.cap.d.ts +312 -0
  16. package/dist/capabilities/heat-pump-control.cap.d.ts +83 -0
  17. package/dist/capabilities/heat-pump-status.cap.d.ts +517 -0
  18. package/dist/capabilities/hero-layout.cap.d.ts +58 -0
  19. package/dist/capabilities/index.d.ts +6 -2
  20. package/dist/capabilities/schedulers.cap.d.ts +458 -0
  21. package/dist/capabilities/timed-run.cap.d.ts +5 -0
  22. package/dist/client.js +26 -0
  23. package/dist/client.mjs +26 -0
  24. package/dist/{composition-BjHGoicU.js → composition-BxalDSTt.js} +1 -1
  25. package/dist/{composition-CXCX78IR.mjs → composition-C6TZGqUb.mjs} +1 -1
  26. package/dist/device/cap-vocabulary/entries/heat-pump.d.ts +4 -0
  27. package/dist/device/device-type.d.ts +5 -1
  28. package/dist/device/hero/build-hero-model.d.ts +2 -0
  29. package/dist/device/hero/climate-view.d.ts +4 -0
  30. package/dist/device/hero/hero-contributions-heat-pump.d.ts +2 -0
  31. package/dist/device/hero/hero-fragment.d.ts +4 -0
  32. package/dist/device/hero/hero-layout.d.ts +1 -0
  33. package/dist/device/hero/hero-look.d.ts +6 -0
  34. package/dist/device/hero/hero-model.d.ts +82 -1
  35. package/dist/device/hero/hero-row.d.ts +38 -2
  36. package/dist/device/hero/hero-scene.d.ts +4 -1
  37. package/dist/device/hero/index.d.ts +1 -1
  38. package/dist/{device-type-BaYa0UGS.js → device-type-BfvqqzRp.js} +4 -0
  39. package/dist/{device-type-CbDhVwFP.mjs → device-type-DTTZKB2I.mjs} +4 -0
  40. package/dist/expression/device-template.d.ts +80 -19
  41. package/dist/generated/addon-api.d.ts +134 -0
  42. package/dist/generated/addon-cap-facts.d.ts +1 -1
  43. package/dist/generated/cap-status-types.d.ts +3 -1
  44. package/dist/generated/capability-router-map.d.ts +8 -2
  45. package/dist/generated/customize-catalog.d.ts +1 -1
  46. package/dist/generated/device-local-state.d.ts +3 -0
  47. package/dist/generated/device-proxy.d.ts +5 -0
  48. package/dist/generated/device-scoped-caps.d.ts +1 -1
  49. package/dist/generated/history-catalog.d.ts +2 -2
  50. package/dist/generated/method-access-map.d.ts +1 -1
  51. package/dist/generated/method-device-selectors.d.ts +1 -1
  52. package/dist/generated/runtime-state-durability.d.ts +1 -1
  53. package/dist/generated/system-proxy.d.ts +1 -1
  54. package/dist/index.d.ts +2 -1
  55. package/dist/index.js +2021 -293
  56. package/dist/index.mjs +1996 -294
  57. package/dist/node.js +2 -2
  58. package/dist/node.mjs +2 -2
  59. package/dist/{sleep-DhZXJtPH.js → sleep-CCAQ_PEp.js} +201 -5
  60. package/dist/{sleep-CkinsFFb.mjs → sleep-DnVqHJc4.mjs} +201 -5
  61. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_sleep = require("./sleep-DhZXJtPH.js");
2
+ const require_sleep = require("./sleep-CCAQ_PEp.js");
3
3
  const require_event_category = require("./event-category-BC4RRerT.js");
4
- const require_device_type = require("./device-type-BaYa0UGS.js");
5
- const require_composition = require("./composition-BjHGoicU.js");
4
+ const require_device_type = require("./device-type-BfvqqzRp.js");
5
+ const require_composition = require("./composition-BxalDSTt.js");
6
6
  const require_node_color = require("./node-color.js");
7
7
  const require_convert = require("./convert-BmtM6K-5.js");
8
8
  const require_enums = require("./enums.js");
@@ -33008,11 +33008,35 @@ function normalizeStepTargets(steps) {
33008
33008
  /**
33009
33009
  * The steps an internal Action may contain: cap and wait, and nothing that can
33010
33010
  * call back into an Action — so an Action can never reach itself (no cycles).
33011
+ * This is the LEAF shape: no condition of its own.
33011
33012
  */
33012
- var ActionStepSchema = zod.z.discriminatedUnion("kind", [AutomationWaitStepSchema, AutomationCapStepSchema]);
33013
+ var LeafActionStepSchema = zod.z.discriminatedUnion("kind", [AutomationWaitStepSchema, AutomationCapStepSchema]);
33014
+ /**
33015
+ * The optional guard of a step (#472): `if` is the ONE `when` tree (D980), read
33016
+ * on the state mirror when the step is reached; `else` runs when it is false.
33017
+ * An `else` holds leaf steps only — the nesting is bounded at ONE level, so a
33018
+ * branch can never grow a tree the trace has to draw.
33019
+ */
33020
+ var stepGuardShape = {
33021
+ if: AutomationWhenSchema.optional(),
33022
+ else: zod.z.array(LeafActionStepSchema).max(10).optional()
33023
+ };
33024
+ var elseNeedsIf = {
33025
+ message: "an else list needs the condition it is the other side of (if)",
33026
+ path: ["else"]
33027
+ };
33028
+ var GuardedWaitStepSchema = AutomationWaitStepSchema.extend(stepGuardShape).refine((step) => step.else === void 0 || step.if !== void 0, elseNeedsIf);
33029
+ var GuardedCapStepSchema = AutomationCapStepBaseSchema.extend(stepGuardShape).refine((step) => step.target !== void 0 || step.deviceId !== void 0, {
33030
+ message: "a cap step needs a target",
33031
+ path: ["target"]
33032
+ }).refine((step) => step.target?.kind !== "domain" || step.actionId !== void 0, {
33033
+ message: "a domain target needs the vocabulary action it applies to (actionId)",
33034
+ path: ["actionId"]
33035
+ }).refine((step) => step.else === void 0 || step.if !== void 0, elseNeedsIf);
33036
+ var ActionStepSchema = zod.z.discriminatedUnion("kind", [GuardedWaitStepSchema, GuardedCapStepSchema]);
33013
33037
  var AutomationActionSchema = zod.z.discriminatedUnion("kind", [
33014
- AutomationWaitStepSchema,
33015
- AutomationCapStepSchema,
33038
+ GuardedWaitStepSchema,
33039
+ GuardedCapStepSchema,
33016
33040
  zod.z.object({
33017
33041
  kind: zod.z.literal("action"),
33018
33042
  /** An entry of the `actions` surface (`internal:<uuid>` or `<addonId>:<localId>`). */
@@ -33358,10 +33382,32 @@ function emitLeaf(trigger, path) {
33358
33382
  }`;
33359
33383
  }
33360
33384
  }
33385
+ /** The body of a wait or cap step, shared by a top-level step and an else step. */
33386
+ function emitLeafBody(action) {
33387
+ switch (action.kind) {
33388
+ case "wait": return ` await sleep(${j(action.seconds * 1e3)})`;
33389
+ case "cap": {
33390
+ const { target, actionId } = normalizeCapStep(action);
33391
+ return ` await actuateTarget(scope, ${j(target)}, ${j(actionId)}, ${j(action.cap)}, ${j(action.method)}, ${j(action.args ?? {})}, vars)`;
33392
+ }
33393
+ default: return null;
33394
+ }
33395
+ }
33396
+ /** A step's `if` (#472) and its else list, as the fields of a RunnableStep. */
33397
+ function emitGuard(action) {
33398
+ if (action.kind !== "wait" && action.kind !== "cap") return "";
33399
+ if (action.if === void 0) return "";
33400
+ const otherwise = (action.else ?? []).map((el) => {
33401
+ const body = emitLeafBody(el);
33402
+ return `{ meta: ${j(stepMetaOf(el))}, run: async (scope) => {\n${body ?? ""}\n } }`;
33403
+ }).join(", ");
33404
+ return ` guard: () => evaluateCondition(${j(action.if)}),${otherwise === "" ? "" : `\n otherwise: [${otherwise}],`}
33405
+ `;
33406
+ }
33361
33407
  function emitAction(action, index) {
33362
33408
  const step = (body) => ` {
33363
33409
  meta: STEP_META[${index}]!,
33364
- run: async (scope) => {
33410
+ ${emitGuard(action)} run: async (scope) => {
33365
33411
  ${body}
33366
33412
  },
33367
33413
  },`;
@@ -33414,6 +33460,7 @@ function generateAutomationBlock(input) {
33414
33460
  AutomationConditionTraceNode,
33415
33461
  AutomationRunTrace,
33416
33462
  AutomationRunVerdict,
33463
+ AutomationWhen,
33417
33464
  AutomationStepTrace,
33418
33465
  RunnableStep,
33419
33466
  StepScope,
@@ -33437,7 +33484,9 @@ import {
33437
33484
  nextOccurrence,
33438
33485
  stableIdMapOf,
33439
33486
  resolveStepArgs,
33487
+ resolveStepArgsWithTemplates,
33440
33488
  runForDevices,
33489
+ evaluateStepCondition,
33441
33490
  runSteps,
33442
33491
  validateTimeSpecForSite,
33443
33492
  zoneOnlySite,
@@ -33636,7 +33685,7 @@ export default function block(ctx: AddonContext) {
33636
33685
  fetchSlice: (deviceId, cap) => ctx.api.deviceState.getCapSlice.query({ deviceId, capName: cap }),
33637
33686
  fetchStableIds: async () => {
33638
33687
  const all = await ctx.api.deviceManager.listAll.query({})
33639
- return stableIdMapOf(all.devices)
33688
+ return stableIdMapOf(all)
33640
33689
  },
33641
33690
  })
33642
33691
  if (report.kept > 0) {
@@ -33743,6 +33792,12 @@ export default function block(ctx: AddonContext) {
33743
33792
  ctx.logger.warn('template referenced a var that was never set', { var: name })
33744
33793
  }
33745
33794
 
33795
+ /** Device value templates (D1021) render on the hub through the ONE renderer; this block keeps no copy. */
33796
+ async function renderTemplates(templates: readonly string[]) {
33797
+ const out = await ctx.api.deviceManager.renderDeviceTemplates.query({ templates: [...templates] })
33798
+ return out.results
33799
+ }
33800
+
33746
33801
  /** Substitute {{vars.x}} slots and { $var } values. Substitution only — never evaluation. */
33747
33802
  function substitute(value: unknown, vars: Record<string, unknown>): unknown {
33748
33803
  return resolveStepArgs(value, vars, warnMissingVar)
@@ -33771,7 +33826,9 @@ export default function block(ctx: AddonContext) {
33771
33826
  args: Record<string, unknown>,
33772
33827
  vars: Record<string, unknown>,
33773
33828
  ): Promise<void> {
33774
- const substituted = substitute(args, vars)
33829
+ const templated = await resolveStepArgsWithTemplates(args, vars, warnMissingVar, renderTemplates)
33830
+ if (templated.notes.length > 0) scope.setTemplateNotes(templated.notes)
33831
+ const substituted = templated.value
33775
33832
  const resolved: Record<string, unknown> =
33776
33833
  substituted !== null && typeof substituted === 'object' ? { ...substituted } : {}
33777
33834
  scope.setArgs(resolved)
@@ -33788,6 +33845,17 @@ export default function block(ctx: AddonContext) {
33788
33845
  await mutate({ ...resolved, deviceId })
33789
33846
  }
33790
33847
 
33848
+ /** A step's \`if\` (#472), read on a mirror filled for exactly its leaves, NOW (D49: unread = unknown). */
33849
+ function evaluateCondition(when: AutomationWhen) {
33850
+ return evaluateStepCondition(when, {
33851
+ fetchSlice: (deviceId, cap) => ctx.api.deviceState.getCapSlice.query({ deviceId, capName: cap }),
33852
+ fetchStableIds: async () => {
33853
+ const all = await ctx.api.deviceManager.listAll.query({})
33854
+ return stableIdMapOf(all)
33855
+ },
33856
+ })
33857
+ }
33858
+
33791
33859
  /** The THEN half, through the ONE shared step runner: stops at the first
33792
33860
  * failure (continuing past a failed step executes an intent the operator
33793
33861
  * never expressed); every step is traced, the ones after a failure (or an
@@ -33812,6 +33880,13 @@ ${recipe.actions.map((a, i) => emitAction(a, i)).join("\n")}
33812
33880
  error: failure.message,
33813
33881
  })
33814
33882
  },
33883
+ onGuardUnknown: (skipped) => {
33884
+ ctx.logger.warn('step skipped — its condition could not be read', {
33885
+ ...(skipped.deviceId === undefined ? {} : { tags: { deviceId: skipped.deviceId } }),
33886
+ step: skipped.index,
33887
+ reason: skipped.reason,
33888
+ })
33889
+ },
33815
33890
  })
33816
33891
  }
33817
33892
 
@@ -35182,7 +35257,7 @@ var StepDeviceTraceSchema = zod.z.object({
35182
35257
  outcome: zod.z.enum(["ok", "error"]),
35183
35258
  message: zod.z.string().optional()
35184
35259
  });
35185
- var AutomationStepTraceSchema = zod.z.object({
35260
+ var StepTraceBaseSchema = zod.z.object({
35186
35261
  /** `actions.<i>` */
35187
35262
  path: zod.z.string().min(1),
35188
35263
  kind: zod.z.string().min(1),
@@ -35201,15 +35276,35 @@ var AutomationStepTraceSchema = zod.z.object({
35201
35276
  * is shown as {@link REDACTED_ARG}. Absent on traces written before it existed.
35202
35277
  */
35203
35278
  args: zod.z.record(zod.z.string(), TraceValueSchema).optional(),
35204
- /** `empty`: the target resolved to no device, so nothing was done — never silently `ok`. */
35279
+ /**
35280
+ * The device values a templated arg printed as `—`, one `ref: reason` each
35281
+ * (D1021): why a sentence says "—" where a number was expected. Bounded.
35282
+ */
35283
+ templates: zod.z.array(zod.z.string()).max(20).optional(),
35284
+ /**
35285
+ * What the step's own `if` read when the step was reached (#472): `true` the
35286
+ * step ran, `false` its `else` ran (or nothing did), `unknown` a state leaf
35287
+ * could not be read, so NEITHER side ran. Absent on an unguarded step.
35288
+ */
35289
+ condition: zod.z.enum([
35290
+ "true",
35291
+ "false",
35292
+ "unknown"
35293
+ ]).optional(),
35294
+ /** Why the condition read what it read, in the evaluator's own words. */
35295
+ conditionReason: zod.z.string().optional(),
35296
+ /** `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. */
35205
35297
  outcome: zod.z.enum([
35206
35298
  "ok",
35207
35299
  "error",
35208
35300
  "not-run",
35209
- "empty"
35301
+ "empty",
35302
+ "skipped"
35210
35303
  ]),
35211
35304
  message: zod.z.string().optional()
35212
35305
  });
35306
+ /** A step trace; the `else` steps that ran are one level of the same shape (the nesting is bounded at one). */
35307
+ var AutomationStepTraceSchema = StepTraceBaseSchema.extend({ else: zod.z.array(StepTraceBaseSchema).optional() });
35213
35308
  var AutomationRunTraceSchema = zod.z.object({
35214
35309
  runId: zod.z.string().min(1),
35215
35310
  startedAt: zod.z.number(),
@@ -35545,6 +35640,7 @@ var ActionErrorCodeSchema = zod.z.enum([
35545
35640
  "invalid-variables",
35546
35641
  "invalid-steps",
35547
35642
  "not-linked",
35643
+ "template-scope",
35548
35644
  "busy"
35549
35645
  ]);
35550
35646
  /**
@@ -35594,10 +35690,53 @@ function normalizeNcAction(action) {
35594
35690
  };
35595
35691
  }
35596
35692
  //#endregion
35693
+ //#region src/automation/step-condition.ts
35694
+ /**
35695
+ * The guard of a conditional step (#472): the step's `if` is the ONE `when`
35696
+ * tree (D980), read on a {@link ConditionMirror} filled for exactly the leaves
35697
+ * the tree names, at the moment the step is reached. A state that cannot be
35698
+ * read is UNKNOWN, and unknown runs neither side (D49: a failed read changes
35699
+ * nothing, and never decides a branch).
35700
+ */
35701
+ /** Fill a mirror for the tree's leaves from `fetchers` and judge it NOW. */
35702
+ async function evaluateStepCondition(when, fetchers, now = Date.now) {
35703
+ const mirror = new ConditionMirror(collectWhenMirrorSources(when));
35704
+ await mirror.refresh(fetchers);
35705
+ const evaluation = evaluateWhenTree(when, mirror, now());
35706
+ const first = evaluation.nodes.filter((n) => n.outcome !== "pass").map((n) => n.reason)[0];
35707
+ if (evaluation.unknown) return {
35708
+ result: "unknown",
35709
+ reason: `a state the condition reads is not known${first === void 0 ? "" : ` (${first})`}`
35710
+ };
35711
+ return evaluation.pass ? {
35712
+ result: "true",
35713
+ reason: "the condition holds"
35714
+ } : {
35715
+ result: "false",
35716
+ reason: first ?? "the condition does not hold"
35717
+ };
35718
+ }
35719
+ //#endregion
35597
35720
  //#region src/automation/step-runner.ts
35598
35721
  function errorMessage(err) {
35599
35722
  return err instanceof Error ? err.message : String(err);
35600
35723
  }
35724
+ /** A guard that throws is an unknown, never a crash of the run. */
35725
+ async function readGuard(guard) {
35726
+ try {
35727
+ return await guard();
35728
+ } catch (err) {
35729
+ return {
35730
+ result: "unknown",
35731
+ reason: `the condition could not be read: ${errorMessage(err)}`
35732
+ };
35733
+ }
35734
+ }
35735
+ /** The else level of a trace is one level deep: a nested trace carries no `else` of its own. */
35736
+ function withoutElse(trace) {
35737
+ const { else: _else, ...rest } = trace;
35738
+ return rest;
35739
+ }
35601
35740
  async function runSteps(steps, options) {
35602
35741
  const traces = [];
35603
35742
  let failed = false;
@@ -35615,10 +35754,57 @@ async function runSteps(steps, options) {
35615
35754
  continue;
35616
35755
  }
35617
35756
  const startedAt = options.now();
35757
+ let guardTrace = {};
35758
+ if (step.guard !== void 0) {
35759
+ const verdict = await readGuard(step.guard);
35760
+ guardTrace = {
35761
+ condition: verdict.result,
35762
+ conditionReason: verdict.reason
35763
+ };
35764
+ if (verdict.result === "unknown") options.onGuardUnknown?.({
35765
+ index,
35766
+ path,
35767
+ reason: verdict.reason,
35768
+ deviceId: step.meta.deviceId
35769
+ });
35770
+ if (verdict.result !== "true") {
35771
+ const branch = verdict.result === "false" ? step.otherwise ?? [] : [];
35772
+ if (branch.length === 0) {
35773
+ traces.push({
35774
+ ...step.meta,
35775
+ ...guardTrace,
35776
+ path,
35777
+ startedAt,
35778
+ endedAt: options.now(),
35779
+ outcome: "skipped",
35780
+ message: verdict.result === "unknown" ? `not run: ${verdict.reason}` : `not run: the condition is false (${verdict.reason})`
35781
+ });
35782
+ continue;
35783
+ }
35784
+ const sub = await runSteps(branch, {
35785
+ ...options,
35786
+ pathPrefix: `${path}.else`
35787
+ });
35788
+ if (sub.failed) failed = true;
35789
+ else if (sub.aborted) aborted = true;
35790
+ traces.push({
35791
+ ...step.meta,
35792
+ ...guardTrace,
35793
+ path,
35794
+ startedAt,
35795
+ endedAt: options.now(),
35796
+ outcome: sub.failed ? "error" : "ok",
35797
+ ...sub.failed ? { message: "an else step failed" } : {},
35798
+ else: sub.steps.map(withoutElse)
35799
+ });
35800
+ continue;
35801
+ }
35802
+ }
35618
35803
  let deviceId = step.meta.deviceId;
35619
35804
  let sent;
35620
35805
  const perDevice = [];
35621
35806
  let emptyReason;
35807
+ let templateNotes = [];
35622
35808
  const scope = {
35623
35809
  setDeviceId: (id) => {
35624
35810
  deviceId = id;
@@ -35631,8 +35817,12 @@ async function runSteps(steps, options) {
35631
35817
  },
35632
35818
  setArgs: (args) => {
35633
35819
  sent = args;
35820
+ },
35821
+ setTemplateNotes: (notes) => {
35822
+ templateNotes = notes.slice(0, 20);
35634
35823
  }
35635
35824
  };
35825
+ const templatesTrace = () => templateNotes.length === 0 ? {} : { templates: [...templateNotes] };
35636
35826
  const argsTrace = () => sent === void 0 ? {} : { args: buildStepArgsTrace(sent) };
35637
35827
  const devicesTrace = () => perDevice.length === 0 ? {} : { devices: perDevice.slice(0, 200) };
35638
35828
  try {
@@ -35641,7 +35831,9 @@ async function runSteps(steps, options) {
35641
35831
  ...step.meta,
35642
35832
  ...deviceId === void 0 || perDevice.length > 1 ? {} : { deviceId },
35643
35833
  ...argsTrace(),
35834
+ ...templatesTrace(),
35644
35835
  ...devicesTrace(),
35836
+ ...guardTrace,
35645
35837
  path,
35646
35838
  startedAt,
35647
35839
  endedAt: options.now(),
@@ -35661,7 +35853,9 @@ async function runSteps(steps, options) {
35661
35853
  ...step.meta,
35662
35854
  ...deviceId === void 0 || perDevice.length > 1 ? {} : { deviceId },
35663
35855
  ...argsTrace(),
35856
+ ...templatesTrace(),
35664
35857
  ...devicesTrace(),
35858
+ ...guardTrace,
35665
35859
  path,
35666
35860
  startedAt,
35667
35861
  endedAt: options.now(),
@@ -35710,6 +35904,125 @@ function resolveStepArgs(value, vars, onMissing) {
35710
35904
  if (value !== null && typeof value === "object") return Object.fromEntries(Object.entries(value).map(([k, v]) => [k, resolveStepArgs(v, vars, onMissing)]));
35711
35905
  return value;
35712
35906
  }
35907
+ /** A device template that did not render: the step fails with this, never throws past `runSteps`. */
35908
+ var StepTemplateError = class extends Error {
35909
+ reason;
35910
+ constructor(reason, message) {
35911
+ super(`device template [${reason}]: ${message}`);
35912
+ this.reason = reason;
35913
+ this.name = "StepTemplateError";
35914
+ }
35915
+ };
35916
+ /**
35917
+ * A `{{vars.x}}` slot, set aside while a template renders. The slot carries a
35918
+ * nonce drawn per call, so a device value that happens to contain the sentinel
35919
+ * characters can never name a held variable.
35920
+ */
35921
+ var VAR_SLOT_OPEN = "";
35922
+ var VAR_SLOT_CLOSE = "";
35923
+ var TEMPLATE_MARKUP_RE = /\{\{|\{%/;
35924
+ function newSlotNonce() {
35925
+ return Math.random().toString(36).slice(2, 12);
35926
+ }
35927
+ function slotPattern(nonce) {
35928
+ return new RegExp(`${VAR_SLOT_OPEN}${nonce}:([A-Za-z_][A-Za-z0-9_]*)${VAR_SLOT_CLOSE}`, "g");
35929
+ }
35930
+ /** True when a string, once its `{{vars.x}}` slots are set aside, still carries template markup. */
35931
+ function carriesDeviceTemplate(text) {
35932
+ return TEMPLATE_MARKUP_RE.test(text.replace(TEMPLATE_RE, ""));
35933
+ }
35934
+ /** Every string in `value` that is a device template (D1021), de-duplicated, in walk order. */
35935
+ function collectDeviceTemplates(value) {
35936
+ const found = /* @__PURE__ */ new Set();
35937
+ const walk = (node) => {
35938
+ if (typeof node === "string") {
35939
+ if (carriesDeviceTemplate(node)) found.add(node);
35940
+ } else if (Array.isArray(node)) for (const item of node) walk(item);
35941
+ else if (node !== null && typeof node === "object") for (const item of Object.values(node)) walk(item);
35942
+ };
35943
+ walk(value);
35944
+ return [...found];
35945
+ }
35946
+ function protectVarSlots(text, nonce) {
35947
+ return text.replace(TEMPLATE_RE, (_m, key) => `${VAR_SLOT_OPEN}${nonce}:${key}${VAR_SLOT_CLOSE}`);
35948
+ }
35949
+ function restoreVarSlots(text, nonce, vars, onMissing) {
35950
+ return text.replace(slotPattern(nonce), (_m, key) => {
35951
+ const v = vars[key];
35952
+ if (v === void 0) {
35953
+ onMissing(key);
35954
+ return "";
35955
+ }
35956
+ return String(v);
35957
+ });
35958
+ }
35959
+ /**
35960
+ * {@link resolveStepArgs} plus the device templates of a step (D1021). A string
35961
+ * that carries `{{ … }}` / `{% … %}` beyond a `{{vars.x}}` slot is rendered by
35962
+ * `render` BEFORE the variables are put in, so a variable's value is data and
35963
+ * never template source (an action variable can come from a non-admin caller).
35964
+ * A refused render, or no renderer, throws {@link StepTemplateError}: the step
35965
+ * fails with the typed reason and nothing is dispatched.
35966
+ */
35967
+ async function resolveStepArgsWithTemplates(value, vars, onMissing, render) {
35968
+ const nonce = newSlotNonce();
35969
+ const sources = [];
35970
+ const indexOf = /* @__PURE__ */ new Map();
35971
+ const hold = (text) => {
35972
+ const known = indexOf.get(text);
35973
+ if (known !== void 0) return known;
35974
+ sources.push(text);
35975
+ indexOf.set(text, sources.length - 1);
35976
+ return sources.length - 1;
35977
+ };
35978
+ class Pending {
35979
+ index;
35980
+ constructor(index) {
35981
+ this.index = index;
35982
+ }
35983
+ }
35984
+ const collect = (node) => {
35985
+ if (isVarRef(node)) return resolveStepArgs(node, vars, onMissing);
35986
+ if (typeof node === "string") return carriesDeviceTemplate(node) ? new Pending(hold(protectVarSlots(node, nonce))) : resolveStepArgs(node, vars, onMissing);
35987
+ if (Array.isArray(node)) return node.map(collect);
35988
+ if (node !== null && typeof node === "object") return Object.fromEntries(Object.entries(node).map(([k, v]) => [k, collect(v)]));
35989
+ return node;
35990
+ };
35991
+ const skeleton = collect(value);
35992
+ if (sources.length === 0) return {
35993
+ value: skeleton,
35994
+ notes: []
35995
+ };
35996
+ if (render === void 0) throw new StepTemplateError("unavailable", "this node has no device template renderer");
35997
+ let answers;
35998
+ try {
35999
+ answers = await render(sources);
36000
+ } catch (err) {
36001
+ throw new StepTemplateError("unavailable", errorMessage(err));
36002
+ }
36003
+ const texts = [];
36004
+ const notes = [];
36005
+ for (const index of sources.keys()) {
36006
+ const answer = answers[index];
36007
+ if (answer === void 0) throw new StepTemplateError("unavailable", `no answer for template ${index + 1}`);
36008
+ if (!answer.ok) throw new StepTemplateError(answer.refusal.reason, answer.refusal.message);
36009
+ texts.push(restoreVarSlots(answer.text, nonce, vars, onMissing));
36010
+ for (const entry of answer.trace) {
36011
+ const note = `${entry.ref}: ${entry.reason}`;
36012
+ if (!notes.includes(note)) notes.push(note);
36013
+ }
36014
+ }
36015
+ const fill = (node) => {
36016
+ if (node instanceof Pending) return texts[node.index] ?? "";
36017
+ if (Array.isArray(node)) return node.map(fill);
36018
+ if (node !== null && typeof node === "object") return Object.fromEntries(Object.entries(node).map(([k, v]) => [k, fill(v)]));
36019
+ return node;
36020
+ };
36021
+ return {
36022
+ value: fill(skeleton),
36023
+ notes
36024
+ };
36025
+ }
35713
36026
  /** A `{ $var }` device target, resolved from the bag BEFORE dispatch. */
35714
36027
  function resolveDeviceTarget(vars, name) {
35715
36028
  const raw = vars[name];
@@ -35771,19 +36084,36 @@ async function runForDevices(deviceIds, scope, work, concurrency = 4) {
35771
36084
  * variables. Variables are substituted per step, at the moment it runs, so a
35772
36085
  * missing one fails THAT step (traced) and leaves the later ones not-run.
35773
36086
  */
36087
+ /** The guard and the else list of a step, bound to the run (#472); `{}` for an unguarded step. */
36088
+ function guardOf(step, vars, deps) {
36089
+ const when = step.if;
36090
+ if (when === void 0) return {};
36091
+ const evaluate = deps.evaluateCondition;
36092
+ return {
36093
+ guard: async () => evaluate === void 0 ? {
36094
+ result: "unknown",
36095
+ reason: "this consumer has no condition evaluator"
36096
+ } : evaluate(when),
36097
+ ...step.else === void 0 ? {} : { otherwise: buildActionSteps(step.else, vars, deps) }
36098
+ };
36099
+ }
35774
36100
  function buildActionSteps(steps, vars, deps) {
35775
36101
  return steps.map((step) => {
36102
+ const guarded = guardOf(step, vars, deps);
35776
36103
  const meta = stepMetaOfAction(step);
35777
36104
  if (step.kind === "wait") return {
35778
36105
  meta,
36106
+ ...guarded,
35779
36107
  run: () => deps.sleep(step.seconds * 1e3)
35780
36108
  };
35781
36109
  const normalized = normalizeCapStep(step);
35782
36110
  return {
35783
36111
  meta,
36112
+ ...guarded,
35784
36113
  run: async (scope) => {
35785
- const resolved = resolveStepArgs(step.args ?? {}, vars, deps.onMissingVar);
35786
- const args = isPlainRecord(resolved) ? resolved : {};
36114
+ const templated = await resolveStepArgsWithTemplates(step.args ?? {}, vars, deps.onMissingVar, deps.renderTemplates);
36115
+ if (templated.notes.length > 0) scope.setTemplateNotes(templated.notes);
36116
+ const args = isPlainRecord(templated.value) ? templated.value : {};
35787
36117
  const target = await deps.resolveTarget(normalized.target, normalized.actionId, vars, {
35788
36118
  actionId: normalized.actionId,
35789
36119
  owner: deps.owner
@@ -43197,7 +43527,7 @@ function irSourceProblem(source) {
43197
43527
  throw err;
43198
43528
  }
43199
43529
  }
43200
- function same$1(a, b) {
43530
+ function same$2(a, b) {
43201
43531
  return a.trim().toLowerCase() === b.trim().toLowerCase();
43202
43532
  }
43203
43533
  /** The `digits` source that declares this channel number, or null. */
@@ -43211,7 +43541,7 @@ function findChannelSource(sources, number) {
43211
43541
  * the number reach the same source; nothing else is guessed.
43212
43542
  */
43213
43543
  function resolveRemoteSource(sources, query) {
43214
- const byName = sources.find((source) => same$1(source.name, query));
43544
+ const byName = sources.find((source) => same$2(source.name, query));
43215
43545
  if (byName !== void 0) return byName;
43216
43546
  const byId = sources.find((source) => source.id === query.trim());
43217
43547
  if (byId !== void 0) return byId;
@@ -43579,7 +43909,8 @@ var CAP_CUSTOMIZE_CATALOG = {
43579
43909
  require_device_type.DeviceType.Washer,
43580
43910
  require_device_type.DeviceType.Heater,
43581
43911
  require_device_type.DeviceType.Dryer,
43582
- require_device_type.DeviceType.Gateway
43912
+ require_device_type.DeviceType.Gateway,
43913
+ require_device_type.DeviceType.HeatPump
43583
43914
  ],
43584
43915
  apply: "add",
43585
43916
  vocabularyCap: "consumables",
@@ -45234,7 +45565,7 @@ async function runFanOut(calls, invoke) {
45234
45565
  //#region src/generated/history-catalog.ts
45235
45566
  /**
45236
45567
  * Cap history catalog, projected from every `*.cap.ts` `history` block.
45237
- * 43 caps with series (79 series), 37 caps answered `'none'`.
45568
+ * 44 caps with series (87 series), 37 caps answered `'none'`.
45238
45569
  * Field keys are `runtimeState` paths (`a.b` into fixed objects only).
45239
45570
  */
45240
45571
  var HISTORY_CATALOG = {
@@ -45392,6 +45723,54 @@ var HISTORY_CATALOG = {
45392
45723
  },
45393
45724
  "flood": { "flooded": { kind: "boolean" } },
45394
45725
  "gas": { "detected": { kind: "boolean" } },
45726
+ "heat-pump-status": {
45727
+ "power.thermalW": {
45728
+ kind: "gauge",
45729
+ unit: "W",
45730
+ deadband: 50,
45731
+ displayName: "Thermal power"
45732
+ },
45733
+ "power.electricalW": {
45734
+ kind: "gauge",
45735
+ unit: "W",
45736
+ deadband: 50,
45737
+ displayName: "Electrical power"
45738
+ },
45739
+ "power.compressorPct": {
45740
+ kind: "gauge",
45741
+ unit: "%",
45742
+ deadband: 2,
45743
+ displayName: "Compressor"
45744
+ },
45745
+ "temperatures.supply": {
45746
+ kind: "gauge",
45747
+ unit: "°C",
45748
+ deadband: .5,
45749
+ displayName: "Supply"
45750
+ },
45751
+ "temperatures.return": {
45752
+ kind: "gauge",
45753
+ unit: "°C",
45754
+ deadband: .5,
45755
+ displayName: "Return"
45756
+ },
45757
+ "temperatures.outdoor": {
45758
+ kind: "gauge",
45759
+ unit: "°C",
45760
+ deadband: .5,
45761
+ displayName: "Outdoor"
45762
+ },
45763
+ "energy.thermalKwh": {
45764
+ kind: "counter",
45765
+ unit: "kWh",
45766
+ displayName: "Thermal energy"
45767
+ },
45768
+ "energy.electricalKwh": {
45769
+ kind: "counter",
45770
+ unit: "kWh",
45771
+ displayName: "Electrical energy"
45772
+ }
45773
+ },
45395
45774
  "heating-valve": { "position": {
45396
45775
  kind: "gauge",
45397
45776
  unit: "%",
@@ -45605,38 +45984,63 @@ var HISTORY_CATALOG = {
45605
45984
  };
45606
45985
  /**
45607
45986
  * Keyed-array series (D917), projected from every `history.items` block:
45608
- * 1 caps (3 item fields). The item key is the series SCOPE;
45987
+ * 2 caps (6 item fields). The item key is the series SCOPE;
45609
45988
  * the series key is `cap:<capName>.<path>[].<field>`.
45610
45989
  */
45611
- var HISTORY_ITEM_CATALOG = { "consumables": {
45612
- path: "items",
45613
- key: "key",
45614
- label: "label",
45615
- fields: {
45616
- "level": {
45617
- kind: "gauge",
45618
- unit: "%",
45619
- deadband: 2,
45620
- displayName: "Level"
45621
- },
45622
- "status": {
45623
- kind: "enum",
45624
- displayName: "Status",
45625
- values: [
45626
- "ok",
45627
- "low",
45628
- "empty",
45629
- "full",
45630
- "replace"
45631
- ]
45632
- },
45633
- "remaining.value": {
45634
- kind: "gauge",
45635
- deadband: 1,
45636
- displayName: "Remaining"
45990
+ var HISTORY_ITEM_CATALOG = {
45991
+ "consumables": {
45992
+ path: "items",
45993
+ key: "key",
45994
+ label: "label",
45995
+ fields: {
45996
+ "level": {
45997
+ kind: "gauge",
45998
+ unit: "%",
45999
+ deadband: 2,
46000
+ displayName: "Level"
46001
+ },
46002
+ "status": {
46003
+ kind: "enum",
46004
+ displayName: "Status",
46005
+ values: [
46006
+ "ok",
46007
+ "low",
46008
+ "empty",
46009
+ "full",
46010
+ "replace"
46011
+ ]
46012
+ },
46013
+ "remaining.value": {
46014
+ kind: "gauge",
46015
+ deadband: 1,
46016
+ displayName: "Remaining"
46017
+ }
46018
+ }
46019
+ },
46020
+ "heat-pump-status": {
46021
+ path: "circuits",
46022
+ key: "id",
46023
+ label: "label",
46024
+ fields: {
46025
+ "currentTemp": {
46026
+ kind: "gauge",
46027
+ unit: "°C",
46028
+ deadband: .5,
46029
+ displayName: "Temperature"
46030
+ },
46031
+ "targetTemp": {
46032
+ kind: "gauge",
46033
+ unit: "°C",
46034
+ minIntervalMs: 0,
46035
+ displayName: "Setpoint"
46036
+ },
46037
+ "mode": {
46038
+ kind: "enum",
46039
+ displayName: "Mode"
46040
+ }
45637
46041
  }
45638
46042
  }
45639
- } };
46043
+ };
45640
46044
  /** Caps that declared `history: 'none'`, sorted. */
45641
46045
  var HISTORY_NONE_CAPS = [
45642
46046
  "audio-metrics",
@@ -49257,6 +49661,169 @@ function checkDeviceAlias(alias, isTaken) {
49257
49661
  };
49258
49662
  }
49259
49663
  //#endregion
49664
+ //#region src/expression/device-template.ts
49665
+ /**
49666
+ * Device value templates, the parts that need no template engine (D1021).
49667
+ *
49668
+ * A template is plain text with Jinja-style `{{ … }}` / `{% … %}` blocks:
49669
+ * `{{ stufa_veranda.temperature | unit('°F') | round(1) }}`. Devices are named
49670
+ * by their alias (`device-alias.ts`); a field is `alias.field` when the field
49671
+ * name is unique across the device's capabilities, else `alias.<cap>.field`,
49672
+ * and an ambiguous `alias.field` is refused by name.
49673
+ *
49674
+ * The engine itself (nunjucks) lives ONLY in the hub's renderer
49675
+ * (`packages/system/src/builtins/device-manager/device-template/`, guard
49676
+ * `check-device-template-grammar`): it does not sandbox, so it renders only in
49677
+ * a worker thread under a wall-time budget, over frozen plain data. This file
49678
+ * is the shared vocabulary — limits, refusal reasons, the trace, and how a
49679
+ * `(alias, path)` reference resolves against a device's slices.
49680
+ */
49681
+ var DEVICE_TEMPLATE_MAX_LENGTH = 4096;
49682
+ /** Wall time a render may take, host-measured; the worker is terminated past it. */
49683
+ var DEVICE_TEMPLATE_BUDGET_MS = 50;
49684
+ var DEVICE_TEMPLATE_MAX_OUTPUT = 4096;
49685
+ /** What an unknown or unavailable value renders as. */
49686
+ var DEVICE_TEMPLATE_UNAVAILABLE = "—";
49687
+ var DeviceTemplateSchema = zod.z.string().min(1).max(DEVICE_TEMPLATE_MAX_LENGTH);
49688
+ /** The filters a template may use. Anything else is refused at parse time. */
49689
+ var DEVICE_TEMPLATE_FILTERS = [
49690
+ "unit",
49691
+ "round",
49692
+ "default",
49693
+ "since",
49694
+ "ago",
49695
+ "format",
49696
+ "upper",
49697
+ "lower",
49698
+ "title",
49699
+ "capitalize",
49700
+ "trim",
49701
+ "abs",
49702
+ "int",
49703
+ "float",
49704
+ "length",
49705
+ "d",
49706
+ "join",
49707
+ "replace",
49708
+ "first",
49709
+ "last",
49710
+ "sort",
49711
+ "reverse",
49712
+ "sum",
49713
+ "string",
49714
+ "list",
49715
+ "truncate"
49716
+ ];
49717
+ var DEVICE_TEMPLATE_REFUSAL_REASONS = [
49718
+ "too-long",
49719
+ "syntax",
49720
+ "forbidden-syntax",
49721
+ "forbidden-member",
49722
+ "unknown-filter",
49723
+ "ambiguous-field",
49724
+ "busy",
49725
+ "budget-exceeded",
49726
+ "timeout",
49727
+ "output-too-large",
49728
+ "render-failed",
49729
+ "out-of-scope",
49730
+ "unavailable"
49731
+ ];
49732
+ var DeviceTemplateRefusalSchema = zod.z.object({
49733
+ reason: zod.z.enum(DEVICE_TEMPLATE_REFUSAL_REASONS),
49734
+ message: zod.z.string()
49735
+ });
49736
+ var DEVICE_TEMPLATE_TRACE_REASONS = [
49737
+ "unknown-alias",
49738
+ "unknown-field",
49739
+ "no-field",
49740
+ "unavailable"
49741
+ ];
49742
+ var DeviceTemplateTraceEntrySchema = zod.z.object({
49743
+ ref: zod.z.string(),
49744
+ reason: zod.z.enum(DEVICE_TEMPLATE_TRACE_REASONS)
49745
+ });
49746
+ var DeviceTemplateRenderSchema = zod.z.discriminatedUnion("ok", [zod.z.object({
49747
+ ok: zod.z.literal(true),
49748
+ text: zod.z.string(),
49749
+ trace: zod.z.array(DeviceTemplateTraceEntrySchema)
49750
+ }), zod.z.object({
49751
+ ok: zod.z.literal(false),
49752
+ refusal: DeviceTemplateRefusalSchema,
49753
+ trace: zod.z.array(DeviceTemplateTraceEntrySchema)
49754
+ })]);
49755
+ /** A capability name as a template spells it: `temperature-sensor` → `temperature_sensor`. */
49756
+ function templateCapKey(cap) {
49757
+ return cap.replace(/-/g, "_");
49758
+ }
49759
+ function isRecord$3(value) {
49760
+ return typeof value === "object" && value !== null && !Array.isArray(value);
49761
+ }
49762
+ function pickPath(root, path) {
49763
+ let cursor = root;
49764
+ for (const part of path) if (Array.isArray(cursor) && typeof part === "number") cursor = cursor[part];
49765
+ else if (isRecord$3(cursor) && Object.hasOwn(cursor, String(part))) cursor = cursor[String(part)];
49766
+ else return;
49767
+ return cursor;
49768
+ }
49769
+ /**
49770
+ * Resolve the path after an alias. `<cap>.field…` when the first segment names
49771
+ * one of the device's caps; otherwise `field…` when exactly one cap carries a
49772
+ * field of that name; several caps carrying it is `ambiguous`, naming them.
49773
+ */
49774
+ function resolveTemplateRef(view, path) {
49775
+ const head = path[0];
49776
+ if (head === void 0) return {
49777
+ kind: "missing",
49778
+ reason: "no-field"
49779
+ };
49780
+ const caps = Object.keys(view.slices);
49781
+ const named = caps.find((cap) => cap === head || templateCapKey(cap) === head);
49782
+ if (named !== void 0) {
49783
+ const rest = path.slice(1);
49784
+ if (rest.length === 0) return {
49785
+ kind: "missing",
49786
+ reason: "no-field"
49787
+ };
49788
+ const value = pickPath(view.slices[named], rest);
49789
+ if (value === void 0) return {
49790
+ kind: "missing",
49791
+ reason: "unknown-field"
49792
+ };
49793
+ return {
49794
+ kind: "value",
49795
+ cap: named,
49796
+ fieldPath: rest,
49797
+ value
49798
+ };
49799
+ }
49800
+ const owners = caps.filter((cap) => {
49801
+ const slice = view.slices[cap];
49802
+ return isRecord$3(slice) && Object.hasOwn(slice, String(head));
49803
+ });
49804
+ if (owners.length === 0) return {
49805
+ kind: "missing",
49806
+ reason: "unknown-field"
49807
+ };
49808
+ const [only] = owners;
49809
+ if (owners.length > 1 || only === void 0) return {
49810
+ kind: "ambiguous",
49811
+ field: String(head),
49812
+ caps: owners
49813
+ };
49814
+ const value = pickPath(view.slices[only], path);
49815
+ if (value === void 0) return {
49816
+ kind: "missing",
49817
+ reason: "unknown-field"
49818
+ };
49819
+ return {
49820
+ kind: "value",
49821
+ cap: only,
49822
+ fieldPath: path,
49823
+ value
49824
+ };
49825
+ }
49826
+ //#endregion
49260
49827
  //#region src/device/site-zone.ts
49261
49828
  /**
49262
49829
  * A SITE ZONE — a named part of the property that several locations belong to.
@@ -50186,6 +50753,38 @@ var deviceManagerCapability = {
50186
50753
  kind: "mutation",
50187
50754
  auth: "admin"
50188
50755
  }),
50756
+ /**
50757
+ * Render device value templates (D1021). The ONE door every consumer uses:
50758
+ * an action step, a scheduler point, a notification rule, a generated
50759
+ * automation block. Admin-only (an in-process block carries the mesh
50760
+ * principal): it reads device state by alias, so a non-admin never calls it
50761
+ * directly. `allowedDeviceIds` is the set the END caller was proven to see;
50762
+ * a template naming another device answers `out-of-scope`. Answers are
50763
+ * index-aligned with `templates`.
50764
+ */
50765
+ renderDeviceTemplates: require_sleep.method(zod.z.object({
50766
+ templates: zod.z.array(DeviceTemplateSchema).max(64),
50767
+ allowedDeviceIds: zod.z.array(zod.z.number().int()).optional()
50768
+ }), zod.z.object({ results: zod.z.array(DeviceTemplateRenderSchema) }), { auth: "admin" }),
50769
+ /**
50770
+ * Vet templates without rendering them: the syntax refusal, or the devices
50771
+ * each names and whether `allowedDeviceIds` covers them. The save door and
50772
+ * the run-time scope check both ask this.
50773
+ */
50774
+ checkDeviceTemplates: require_sleep.method(zod.z.object({
50775
+ templates: zod.z.array(zod.z.string()).max(64),
50776
+ allowedDeviceIds: zod.z.array(zod.z.number().int()).optional()
50777
+ }), zod.z.object({ results: zod.z.array(zod.z.discriminatedUnion("ok", [zod.z.object({
50778
+ ok: zod.z.literal(true),
50779
+ aliases: zod.z.array(zod.z.object({
50780
+ alias: zod.z.string(),
50781
+ deviceId: zod.z.number().int().nullable(),
50782
+ allowed: zod.z.boolean()
50783
+ }))
50784
+ }), zod.z.object({
50785
+ ok: zod.z.literal(false),
50786
+ refusal: DeviceTemplateRefusalSchema
50787
+ })])) }), { auth: "admin" }),
50189
50788
  /** Update the operator-organisational location label. `null`
50190
50789
  * clears it. */
50191
50790
  setLocation: require_sleep.method(zod.z.object({
@@ -54910,6 +55509,350 @@ var groupStatusCapability = {
54910
55509
  history: "none"
54911
55510
  };
54912
55511
  //#endregion
55512
+ //#region src/capabilities/heat-pump-control.cap.ts
55513
+ /**
55514
+ * Heat pump settable surface (D1026): one typed method per parameter, never a
55515
+ * generic `set(key, value)`. The values a mode takes and the limits of a number
55516
+ * are the ones `heat-pump-status` carries (`allowed`, `min`, `max`, `step`),
55517
+ * read from the gateway; a provider refuses a value outside them. The state is
55518
+ * `heat-pump-status` — this cap has none.
55519
+ */
55520
+ var deviceId = zod.z.number().int().nonnegative();
55521
+ var circuitId = zod.z.string().min(1);
55522
+ var mode = zod.z.string().min(1);
55523
+ var temp = zod.z.number().finite();
55524
+ var heatPumpControlCapability = {
55525
+ name: "heat-pump-control",
55526
+ scope: "device",
55527
+ deviceNative: true,
55528
+ mode: "singleton",
55529
+ deviceTypes: [require_device_type.DeviceType.HeatPump],
55530
+ methods: {
55531
+ /** off / auto / on. */
55532
+ setSilentMode: require_sleep.method(zod.z.object({
55533
+ deviceId,
55534
+ mode
55535
+ }), zod.z.void(), {
55536
+ kind: "mutation",
55537
+ auth: "protected"
55538
+ }),
55539
+ /** off / on. */
55540
+ setAwayMode: require_sleep.method(zod.z.object({
55541
+ deviceId,
55542
+ mode
55543
+ }), zod.z.void(), {
55544
+ kind: "mutation",
55545
+ auth: "protected"
55546
+ }),
55547
+ /** off / manual / auto. */
55548
+ setAdditionalHeaterMode: require_sleep.method(zod.z.object({
55549
+ deviceId,
55550
+ mode
55551
+ }), zod.z.void(), {
55552
+ kind: "mutation",
55553
+ auth: "protected"
55554
+ }),
55555
+ /** off / hm1 .. hm8 (the programmes the gateway lists). */
55556
+ setHolidayMode: require_sleep.method(zod.z.object({
55557
+ deviceId,
55558
+ mode
55559
+ }), zod.z.void(), {
55560
+ kind: "mutation",
55561
+ auth: "protected"
55562
+ }),
55563
+ setCircuitOperationMode: require_sleep.method(zod.z.object({
55564
+ deviceId,
55565
+ circuitId,
55566
+ mode
55567
+ }), zod.z.void(), {
55568
+ kind: "mutation",
55569
+ auth: "protected"
55570
+ }),
55571
+ setCircuitHeatCoolMode: require_sleep.method(zod.z.object({
55572
+ deviceId,
55573
+ circuitId,
55574
+ mode
55575
+ }), zod.z.void(), {
55576
+ kind: "mutation",
55577
+ auth: "protected"
55578
+ }),
55579
+ setCircuitSummerWinter: require_sleep.method(zod.z.object({
55580
+ deviceId,
55581
+ circuitId,
55582
+ mode
55583
+ }), zod.z.void(), {
55584
+ kind: "mutation",
55585
+ auth: "protected"
55586
+ }),
55587
+ setCircuitComfortSetpoint: require_sleep.method(zod.z.object({
55588
+ deviceId,
55589
+ circuitId,
55590
+ temp
55591
+ }), zod.z.void(), {
55592
+ kind: "mutation",
55593
+ auth: "protected"
55594
+ }),
55595
+ setCircuitEcoSetpoint: require_sleep.method(zod.z.object({
55596
+ deviceId,
55597
+ circuitId,
55598
+ temp
55599
+ }), zod.z.void(), {
55600
+ kind: "mutation",
55601
+ auth: "protected"
55602
+ }),
55603
+ setCircuitMaxFlowTemp: require_sleep.method(zod.z.object({
55604
+ deviceId,
55605
+ circuitId,
55606
+ temp
55607
+ }), zod.z.void(), {
55608
+ kind: "mutation",
55609
+ auth: "protected"
55610
+ }),
55611
+ setDhwOperationMode: require_sleep.method(zod.z.object({
55612
+ deviceId,
55613
+ circuitId,
55614
+ mode
55615
+ }), zod.z.void(), {
55616
+ kind: "mutation",
55617
+ auth: "protected"
55618
+ }),
55619
+ setDhwTemperatureLevel: require_sleep.method(zod.z.object({
55620
+ deviceId,
55621
+ circuitId,
55622
+ level: mode
55623
+ }), zod.z.void(), {
55624
+ kind: "mutation",
55625
+ auth: "protected"
55626
+ }),
55627
+ setDhwChargeDuration: require_sleep.method(zod.z.object({
55628
+ deviceId,
55629
+ circuitId,
55630
+ minutes: zod.z.number().int().positive()
55631
+ }), zod.z.void(), {
55632
+ kind: "mutation",
55633
+ auth: "protected"
55634
+ }),
55635
+ /** Start an extra-hot-water charge now: an action, not a stored mode. */
55636
+ startExtraHotWater: require_sleep.method(zod.z.object({
55637
+ deviceId,
55638
+ circuitId
55639
+ }), zod.z.void(), {
55640
+ kind: "mutation",
55641
+ auth: "protected"
55642
+ })
55643
+ }
55644
+ };
55645
+ //#endregion
55646
+ //#region src/capabilities/heat-pump-status.cap.ts
55647
+ /**
55648
+ * Heat pump status (D1026): the one main, READ-ONLY cap of a heat pump. Every
55649
+ * circuit the gateway reports is an entry of `circuits[]` — heating, hot water,
55650
+ * cooling or solar, any number — so no circuit needs a device of its own to be
55651
+ * seen. The settable parameters are typed methods of `heat-pump-control`; the
55652
+ * values they take and their limits (`allowed`, `min`, `max`, `step`) are read
55653
+ * from the gateway and carried here, never written in code.
55654
+ *
55655
+ * A value the gateway did not report is `null`, never `0` (D393). The COP is not
55656
+ * a field: it is computed from the two powers at read time
55657
+ * ({@link heatPumpInstantCop}).
55658
+ */
55659
+ /** The kinds of circuit a heat pump serves. */
55660
+ var HEAT_PUMP_CIRCUIT_KINDS = [
55661
+ "heating",
55662
+ "dhw",
55663
+ "cooling",
55664
+ "solar"
55665
+ ];
55666
+ var HeatPumpCircuitKindSchema = zod.z.enum(HEAT_PUMP_CIRCUIT_KINDS);
55667
+ /** A setting that takes one of a list of values the gateway named. */
55668
+ var HeatPumpOptionSettingSchema = zod.z.object({
55669
+ /** The active value. Null when the gateway did not answer. */
55670
+ value: zod.z.string().nullable(),
55671
+ /** Values the gateway accepts, in its order. Empty = read-only here. */
55672
+ allowed: zod.z.array(zod.z.string())
55673
+ });
55674
+ /** A numeric setting with the limits the gateway named. */
55675
+ var HeatPumpRangeSettingSchema = zod.z.object({
55676
+ value: zod.z.number().nullable(),
55677
+ min: zod.z.number().nullable(),
55678
+ max: zod.z.number().nullable(),
55679
+ step: zod.z.number().nullable()
55680
+ });
55681
+ var HeatPumpCircuitSchema = zod.z.object({
55682
+ /** Gateway id of the circuit (`hc1`, `dhw1`): the key of the series. */
55683
+ id: zod.z.string().min(1),
55684
+ kind: HeatPumpCircuitKindSchema,
55685
+ label: zod.z.string(),
55686
+ icon: IconKeySchema,
55687
+ /** Measured temperature of the circuit (room, tank, collector). */
55688
+ currentTemp: zod.z.number().nullable().meta(require_sleep.readingMeta("temperature")),
55689
+ /** The setpoint in force now. */
55690
+ targetTemp: zod.z.number().nullable().meta(require_sleep.readingMeta("temperature")),
55691
+ /** The operation mode in force (mirror of `operationMode.value`, for the series). */
55692
+ mode: zod.z.string().nullable(),
55693
+ /** Whether the circuit is calling for heat right now. Null = unknown. */
55694
+ active: zod.z.boolean().nullable(),
55695
+ operationMode: HeatPumpOptionSettingSchema.nullable(),
55696
+ /** Heating circuits: heat / cool / heatCool. */
55697
+ heatCoolMode: HeatPumpOptionSettingSchema.nullable(),
55698
+ /** Heating circuits: summer / winter changeover. */
55699
+ summerWinter: HeatPumpOptionSettingSchema.nullable(),
55700
+ comfortSetpoint: HeatPumpRangeSettingSchema.nullable(),
55701
+ ecoSetpoint: HeatPumpRangeSettingSchema.nullable(),
55702
+ maxFlowTemp: HeatPumpRangeSettingSchema.nullable(),
55703
+ /** Hot water: the temperature level (off / low / high / eco). */
55704
+ temperatureLevel: HeatPumpOptionSettingSchema.nullable(),
55705
+ /** Hot water: how long a charge lasts, minutes. */
55706
+ chargeDuration: HeatPumpRangeSettingSchema.nullable(),
55707
+ /** Hot water: whether an extra-hot-water charge is running. Null = no such surface. */
55708
+ extraHotWater: zod.z.boolean().nullable()
55709
+ });
55710
+ /** The independent system modes, each with its real values. A null mode = the gateway has none. */
55711
+ var HeatPumpSystemSchema = zod.z.object({
55712
+ silent: HeatPumpOptionSettingSchema.nullable(),
55713
+ away: HeatPumpOptionSettingSchema.nullable(),
55714
+ additionalHeater: HeatPumpOptionSettingSchema.nullable(),
55715
+ holiday: HeatPumpOptionSettingSchema.nullable()
55716
+ });
55717
+ var HeatPumpPowerSchema = zod.z.object({
55718
+ thermalW: zod.z.number().nullable().meta(require_sleep.readingMeta("power")),
55719
+ electricalW: zod.z.number().nullable().meta(require_sleep.readingMeta("power")),
55720
+ /** Compressor modulation, percent. */
55721
+ compressorPct: zod.z.number().nullable().meta(require_sleep.readingMeta("percentage"))
55722
+ });
55723
+ var HeatPumpTemperaturesSchema = zod.z.object({
55724
+ supply: zod.z.number().nullable().meta(require_sleep.readingMeta("temperature")),
55725
+ return: zod.z.number().nullable().meta(require_sleep.readingMeta("temperature")),
55726
+ outdoor: zod.z.number().nullable().meta(require_sleep.readingMeta("temperature"))
55727
+ });
55728
+ /** Lifetime meters, kWh: the energy of a period is computed at read time from their difference (D944). */
55729
+ var HeatPumpEnergySchema = zod.z.object({
55730
+ thermalKwh: zod.z.number().nullable().meta(require_sleep.readingMeta("energy")),
55731
+ electricalKwh: zod.z.number().nullable().meta(require_sleep.readingMeta("energy"))
55732
+ });
55733
+ var HeatPumpStatusSchema = zod.z.object({
55734
+ circuits: zod.z.array(HeatPumpCircuitSchema),
55735
+ system: HeatPumpSystemSchema,
55736
+ power: HeatPumpPowerSchema,
55737
+ temperatures: HeatPumpTemperaturesSchema,
55738
+ energy: HeatPumpEnergySchema,
55739
+ /** Water pressure of the heating loop, bar. */
55740
+ waterPressureBar: zod.z.number().nullable(),
55741
+ /** Compressor starts since commissioning. */
55742
+ starts: zod.z.number().nullable(),
55743
+ /** Ms epoch when the slice was last read from the gateway. */
55744
+ lastFetchedAt: zod.z.number()
55745
+ });
55746
+ /**
55747
+ * The instantaneous COP: thermal over electrical power. Null unless BOTH powers
55748
+ * are known and the unit draws power — a missing reading is never a 0 or a
55749
+ * division by it (D393). Computed on every read; there is no stored value.
55750
+ */
55751
+ function heatPumpInstantCop(power) {
55752
+ const { thermalW, electricalW } = power;
55753
+ if (thermalW === null || electricalW === null || electricalW <= 0) return null;
55754
+ return thermalW / electricalW;
55755
+ }
55756
+ var heatPumpStatusCapability = {
55757
+ name: "heat-pump-status",
55758
+ scope: "device",
55759
+ deviceNative: true,
55760
+ mode: "singleton",
55761
+ deviceTypes: [require_device_type.DeviceType.HeatPump],
55762
+ methods: {},
55763
+ status: {
55764
+ schema: HeatPumpStatusSchema,
55765
+ kind: "push"
55766
+ },
55767
+ runtimeState: HeatPumpStatusSchema,
55768
+ /**
55769
+ * Runtime-state durability: **session** — a heat pump's gateway answers on the
55770
+ * next poll, so a restart that clears the slice loses nothing a reader needs
55771
+ * (the series are recorded). See `RuntimeStateDurability`.
55772
+ */
55773
+ durability: "session",
55774
+ /**
55775
+ * History (D850, D917): `circuits[]` is a keyed array — one series per circuit and
55776
+ * field, named by the circuit's label. The mode is a state (D896); the energy
55777
+ * totals are lifetime counters, the kWh of a period is computed at read time (D944).
55778
+ * The COP is never recorded: it derives from the two powers.
55779
+ */
55780
+ history: {
55781
+ fields: {
55782
+ "power.thermalW": {
55783
+ kind: "gauge",
55784
+ unit: "W",
55785
+ deadband: 50,
55786
+ displayName: "Thermal power"
55787
+ },
55788
+ "power.electricalW": {
55789
+ kind: "gauge",
55790
+ unit: "W",
55791
+ deadband: 50,
55792
+ displayName: "Electrical power"
55793
+ },
55794
+ "power.compressorPct": {
55795
+ kind: "gauge",
55796
+ unit: "%",
55797
+ deadband: 2,
55798
+ displayName: "Compressor"
55799
+ },
55800
+ "temperatures.supply": {
55801
+ kind: "gauge",
55802
+ unit: "°C",
55803
+ deadband: .5,
55804
+ displayName: "Supply"
55805
+ },
55806
+ "temperatures.return": {
55807
+ kind: "gauge",
55808
+ unit: "°C",
55809
+ deadband: .5,
55810
+ displayName: "Return"
55811
+ },
55812
+ "temperatures.outdoor": {
55813
+ kind: "gauge",
55814
+ unit: "°C",
55815
+ deadband: .5,
55816
+ displayName: "Outdoor"
55817
+ },
55818
+ "energy.thermalKwh": {
55819
+ kind: "counter",
55820
+ unit: "kWh",
55821
+ displayName: "Thermal energy"
55822
+ },
55823
+ "energy.electricalKwh": {
55824
+ kind: "counter",
55825
+ unit: "kWh",
55826
+ displayName: "Electrical energy"
55827
+ }
55828
+ },
55829
+ items: {
55830
+ path: "circuits",
55831
+ key: "id",
55832
+ label: "label",
55833
+ fields: {
55834
+ currentTemp: {
55835
+ kind: "gauge",
55836
+ unit: "°C",
55837
+ deadband: .5,
55838
+ displayName: "Temperature"
55839
+ },
55840
+ targetTemp: {
55841
+ kind: "gauge",
55842
+ unit: "°C",
55843
+ minIntervalMs: 0,
55844
+ displayName: "Setpoint"
55845
+ },
55846
+ mode: {
55847
+ kind: "enum",
55848
+ displayName: "Mode"
55849
+ }
55850
+ }
55851
+ }
55852
+ },
55853
+ volatileStateFields: ["lastFetchedAt"]
55854
+ };
55855
+ //#endregion
54913
55856
  //#region src/capabilities/heating-valve.cap.ts
54914
55857
  var HeatingValveStatusSchema = zod.z.object({
54915
55858
  /** Radiator valve opening 0 (closed) .. 100 (open). Null = not yet known. */
@@ -54979,6 +55922,17 @@ var TIMED_RUN_DEVICE_TYPES = [require_device_type.DeviceType.Heater, require_dev
54979
55922
  function timedRunLimitOf(deviceType) {
54980
55923
  return TIMED_RUN_LIMITS[deviceType] ?? null;
54981
55924
  }
55925
+ var MS_PER_SECOND = 1e3;
55926
+ var MS_PER_MINUTE = 6e4;
55927
+ /**
55928
+ * Whole units left on an armed run. Minutes and seconds both ceil, and a run
55929
+ * that has not expired yet never reads as zero.
55930
+ */
55931
+ function timedRunRemaining(activeUntil, now, unit) {
55932
+ const left = activeUntil - now;
55933
+ if (left <= 0) return 0;
55934
+ return Math.max(1, Math.ceil(left / (unit === "min" ? MS_PER_MINUTE : MS_PER_SECOND)));
55935
+ }
54982
55936
  /** Seconds in a duration of `duration` `unit`. */
54983
55937
  function timedRunSeconds(duration, unit) {
54984
55938
  return unit === "min" ? duration * 60 : duration;
@@ -55182,6 +56136,7 @@ var HERO_SCENES = [
55182
56136
  "ac",
55183
56137
  "thermostat",
55184
56138
  "heater",
56139
+ "heat-pump",
55185
56140
  "fan",
55186
56141
  "washer",
55187
56142
  "dryer",
@@ -55252,6 +56207,7 @@ var HERO_SCENE_BY_TYPE = {
55252
56207
  [require_device_type.DeviceType.Valve]: "control-dial",
55253
56208
  [require_device_type.DeviceType.Humidifier]: "control-dial",
55254
56209
  [require_device_type.DeviceType.WaterHeater]: "heater",
56210
+ [require_device_type.DeviceType.HeatPump]: "heat-pump",
55255
56211
  [require_device_type.DeviceType.Fan]: "fan",
55256
56212
  [require_device_type.DeviceType.MediaPlayer]: "tv",
55257
56213
  [require_device_type.DeviceType.AlarmPanel]: "alarm",
@@ -55374,6 +56330,7 @@ var HeroTextSchema = zod.z.object({
55374
56330
  */
55375
56331
  /** The rows a layout may carry. Each is built from the caps the device is bound to. */
55376
56332
  var HERO_ROW_IDS = [
56333
+ "progress",
55377
56334
  "run-for",
55378
56335
  "cycle",
55379
56336
  "program",
@@ -55388,6 +56345,7 @@ var HERO_ROW_IDS = [
55388
56345
  "alarm",
55389
56346
  "fan",
55390
56347
  "vacuum",
56348
+ "vacuum-suction",
55391
56349
  "mower",
55392
56350
  "feeder",
55393
56351
  "fountain",
@@ -55406,9 +56364,56 @@ var HERO_ROW_IDS = [
55406
56364
  "climate-fan",
55407
56365
  "setpoint",
55408
56366
  "channel",
55409
- "control"
56367
+ "control",
56368
+ "circuit",
56369
+ "heat-pump-power",
56370
+ "system-mode"
55410
56371
  ];
55411
56372
  var HeroRowIdSchema = zod.z.enum(HERO_ROW_IDS);
56373
+ /**
56374
+ * The label a row carries at its left ("Phase | value | action"), per row id: the
56375
+ * vocabulary of layout A, so no client names a row itself.
56376
+ */
56377
+ var HERO_ROW_LABELS = {
56378
+ progress: require_sleep.t("Progress", "Avanzamento"),
56379
+ "run-for": require_sleep.t("Run for", "Avvia per"),
56380
+ cycle: require_sleep.t("Cycle", "Ciclo"),
56381
+ program: require_sleep.t("Program", "Programma"),
56382
+ "appliance-power": require_sleep.t("Appliance", "Elettrodomestico"),
56383
+ "now-playing": require_sleep.t("Now playing", "In riproduzione"),
56384
+ playback: require_sleep.t("Playback", "Riproduzione"),
56385
+ volume: require_sleep.t("Volume", "Volume"),
56386
+ source: require_sleep.t("Source", "Sorgente"),
56387
+ contact: require_sleep.t("Door", "Porta"),
56388
+ "motion-trigger": require_sleep.t("Motion", "Movimento"),
56389
+ lock: require_sleep.t("Lock", "Serratura"),
56390
+ alarm: require_sleep.t("Alarm", "Allarme"),
56391
+ fan: require_sleep.t("Fan", "Ventola"),
56392
+ vacuum: require_sleep.t("Cleaning", "Pulizia"),
56393
+ "vacuum-suction": require_sleep.t("Suction", "Aspirazione"),
56394
+ mower: require_sleep.t("Mowing", "Taglio"),
56395
+ feeder: require_sleep.t("Feed now", "Eroga ora"),
56396
+ fountain: require_sleep.t("Pump", "Pompa"),
56397
+ "pump-cycle": require_sleep.t("Pump cycle", "Ciclo pompa"),
56398
+ automation: require_sleep.t("Automation", "Automazione"),
56399
+ script: require_sleep.t("Script", "Script"),
56400
+ "do-not-disturb": require_sleep.t("Do not disturb", "Non disturbare"),
56401
+ brightness: require_sleep.t("Brightness", "Luminosità"),
56402
+ color: require_sleep.t("Colour", "Colore"),
56403
+ cover: require_sleep.t("Position", "Posizione"),
56404
+ valve: require_sleep.t("Valve", "Valvola"),
56405
+ humidifier: require_sleep.t("Humidifier", "Umidificatore"),
56406
+ update: require_sleep.t("Firmware", "Firmware"),
56407
+ button: require_sleep.t("Action", "Azione"),
56408
+ "climate-mode": require_sleep.t("Mode", "Modalità"),
56409
+ "climate-fan": require_sleep.t("Fan", "Ventola"),
56410
+ setpoint: require_sleep.t("Setpoint", "Temperatura"),
56411
+ channel: require_sleep.t("Channel", "Canale"),
56412
+ control: require_sleep.t("Control", "Controllo"),
56413
+ circuit: require_sleep.t("Circuit", "Circuito"),
56414
+ "heat-pump-power": require_sleep.t("Power", "Potenza"),
56415
+ "system-mode": require_sleep.t("Mode", "Modalità")
56416
+ };
55412
56417
  var HeroArgValueSchema = zod.z.lazy(() => zod.z.union([
55413
56418
  zod.z.string(),
55414
56419
  zod.z.number(),
@@ -55416,6 +56421,28 @@ var HeroArgValueSchema = zod.z.lazy(() => zod.z.union([
55416
56421
  zod.z.record(zod.z.string(), HeroArgValueSchema)
55417
56422
  ]));
55418
56423
  var HeroArgsSchema = zod.z.record(zod.z.string(), HeroArgValueSchema);
56424
+ function setArgAt(args, keys, value) {
56425
+ const [head, ...rest] = keys;
56426
+ if (head === void 0) return args;
56427
+ if (rest.length === 0) return {
56428
+ ...args,
56429
+ [head]: value
56430
+ };
56431
+ const child = args[head];
56432
+ const base = typeof child === "object" ? child : {};
56433
+ return {
56434
+ ...args,
56435
+ [head]: setArgAt(base, rest, value)
56436
+ };
56437
+ }
56438
+ /**
56439
+ * `args` with the chosen value set at `path` (`level`, or `control.value` for a value
56440
+ * that lives inside a nested argument). The original is not touched; a renderer builds
56441
+ * the call of a slider or picker with this.
56442
+ */
56443
+ function heroArgsWithValue(args, path, value) {
56444
+ return setArgAt(args, path.split("."), value);
56445
+ }
55419
56446
  /** A cap method called on the hero's device. */
55420
56447
  var HeroCallSchema = zod.z.object({
55421
56448
  cap: zod.z.string(),
@@ -55472,16 +56499,32 @@ var HeroControlSchema = zod.z.discriminatedUnion("kind", [
55472
56499
  label: HeroTextSchema,
55473
56500
  current: zod.z.string().nullable(),
55474
56501
  options: zod.z.array(zod.z.string()),
56502
+ /** A readable label per option value; an option without one is drawn as its raw value. */
56503
+ optionLabels: zod.z.record(zod.z.string(), HeroTextSchema).optional(),
55475
56504
  call: HeroCallSchema,
55476
56505
  valueArg: zod.z.string()
55477
56506
  })
55478
56507
  ]);
56508
+ /** Declared by its interface: a `z.infer` of one more icon union pushes the cap's inferred type past what the compiler can print. */
56509
+ var HeroPillSchema = zod.z.object({
56510
+ icon: IconKeySchema.nullable(),
56511
+ text: HeroTextSchema,
56512
+ tone: HeroToneSchema
56513
+ });
55479
56514
  var HeroRowSchema = zod.z.object({
55480
56515
  id: HeroRowIdSchema,
56516
+ /** The row's own name when the kind's label would not tell rows of one kind apart (a circuit's label). */
56517
+ label: HeroTextSchema.optional(),
56518
+ /** A group header drawn above the row when it differs from the previous row's ("System"). */
56519
+ group: HeroTextSchema.optional(),
56520
+ /** Values drawn as pills across the row (a heat pump's powers). */
56521
+ pills: zod.z.array(HeroPillSchema).optional(),
55481
56522
  icon: IconKeySchema,
55482
56523
  /** The row's status, in words. `null` = nothing to say. */
55483
56524
  status: HeroTextSchema.nullable(),
55484
- controls: zod.z.array(HeroControlSchema)
56525
+ controls: zod.z.array(HeroControlSchema),
56526
+ /** A bar under the row's label, 0..1; `null` / absent = no bar. */
56527
+ progress: zod.z.number().min(0).max(1).nullable().optional()
55485
56528
  });
55486
56529
  var HeroDetailSchema = zod.z.object({
55487
56530
  label: HeroTextSchema,
@@ -55489,7 +56532,11 @@ var HeroDetailSchema = zod.z.object({
55489
56532
  unit: zod.z.string().nullable()
55490
56533
  });
55491
56534
  var HeroBadgeSchema = zod.z.object({
55492
- id: zod.z.enum(["battery", "network-link"]),
56535
+ id: zod.z.enum([
56536
+ "battery",
56537
+ "network-link",
56538
+ "integration"
56539
+ ]),
55493
56540
  icon: IconKeySchema,
55494
56541
  tone: HeroToneSchema,
55495
56542
  /** Percent for a battery, link quality for a link; `null` = not known. */
@@ -55538,7 +56585,13 @@ var HeroTimedRunSlotSchema = zod.z.object({
55538
56585
  activeUntil: zod.z.number().nullable(),
55539
56586
  quickRun: TimedRunQuickRunSchema,
55540
56587
  run: HeroActionSchema,
55541
- cancel: HeroActionSchema
56588
+ cancel: HeroActionSchema,
56589
+ /**
56590
+ * Whole units left (the limit's unit, ceil). `null` while nothing is armed.
56591
+ * A number, not words: the row formats it, and a text here would not fit the
56592
+ * hero-layout declaration.
56593
+ */
56594
+ remaining: zod.z.number().nullable()
55542
56595
  });
55543
56596
  var HeroPowerSupplySlotSchema = zod.z.object({
55544
56597
  /** The plug's state; `null` = unknown, never off. */
@@ -55590,7 +56643,12 @@ var HeroFactSchema = zod.z.object({
55590
56643
  var HeroSideTileSchema = zod.z.object({
55591
56644
  label: HeroTextSchema,
55592
56645
  value: HeroTextSchema,
55593
- tone: HeroToneSchema.optional()
56646
+ tone: HeroToneSchema.optional(),
56647
+ /**
56648
+ * Epoch ms when the tile reads a clock time (an appliance's end): a client prints it in
56649
+ * the viewer's own time zone; `value` is the fallback for one that cannot.
56650
+ */
56651
+ at: zod.z.number().optional()
55594
56652
  });
55595
56653
  var HeroSideTilesSchema = zod.z.object({
55596
56654
  left: zod.z.array(HeroSideTileSchema).max(2),
@@ -55626,8 +56684,12 @@ var HeroModelSchema = zod.z.object({
55626
56684
  sideTiles: HeroSideTilesSchema,
55627
56685
  /** The status line under the main icon. */
55628
56686
  title: HeroTextSchema,
56687
+ /** The scene's top line when it says more than `title`; absent = draw the title. */
56688
+ caption: HeroTextSchema.optional(),
55629
56689
  badges: zod.z.array(HeroBadgeSchema),
55630
56690
  remote: HeroRemoteSlotSchema.nullable(),
56691
+ /** The foot button that opens the device's history: "History", "Cycles", "Meals", "Access". */
56692
+ historyLabel: HeroTextSchema,
55631
56693
  consumables: HeroConsumablesSlotSchema.nullable(),
55632
56694
  consumption: HeroConsumptionSlotSchema.nullable(),
55633
56695
  ownPower: HeroOwnPowerSlotSchema.nullable(),
@@ -55650,18 +56712,31 @@ var HeroModelSchema = zod.z.object({
55650
56712
  * 4. a trailing fact (power, else battery, else consumables).
55651
56713
  *
55652
56714
  * Selection rules, all taken from the model:
55653
- * - ONE control is ever shown: the device's own power; else the FIRST control of
56715
+ * - the primary control is the device's own power; else the FIRST control of
55654
56716
  * the FIRST row that has any (a later row's control is never promoted). When
55655
56717
  * the model lists that part in `gated`, the row has no inline control: the
55656
56718
  * projection never falls through to another control the caller could use.
56719
+ * - a timed run, when the model carries the slot, sits beside that primary:
56720
+ * Run while idle, Stop while armed. Gating the slot hides the control.
55657
56721
  * - the status line is the head (what plays, else the state) plus at most
55658
- * {@link ROW_STATUS_FACTS_MAX} facts, the trailing fact excluded;
56722
+ * {@link ROW_STATUS_FACTS_MAX} facts, the trailing fact excluded, then the
56723
+ * time left on an armed timed run;
55659
56724
  * - the trailing fact is the first of power, battery, consumables.
55660
56725
  *
55661
56726
  * `projectDeviceRow` is pure and computes nothing: it selects from a
55662
56727
  * {@link HeroModel}. A row that needed a value the hero lacks would mean the
55663
56728
  * model is missing it, so the fix goes in the model.
55664
56729
  */
56730
+ /**
56731
+ * The row's timed-run control. `id` is `timed-run.run` while idle and
56732
+ * `timed-run.cancel` while armed; `duration` and `unit` are the one-tap run
56733
+ * a Run press starts.
56734
+ */
56735
+ var HeroRowTimedRunSchema = zod.z.object({
56736
+ id: zod.z.enum(["timed-run.run", "timed-run.cancel"]),
56737
+ duration: zod.z.number(),
56738
+ unit: zod.z.enum(["min", "s"])
56739
+ });
55665
56740
  var HeroRowModelSchema = zod.z.object({
55666
56741
  deviceId: zod.z.number().int(),
55667
56742
  name: zod.z.string(),
@@ -55674,6 +56749,11 @@ var HeroRowModelSchema = zod.z.object({
55674
56749
  statusLine: zod.z.array(HeroTextSchema),
55675
56750
  /** `null` = the type has no inline control, or the caller may not act on it. */
55676
56751
  primary: HeroControlSchema.nullable(),
56752
+ /**
56753
+ * Beside `primary` when the device offers a timed run: Run while idle, Stop
56754
+ * while armed. `null` when there is no slot, or the caller may not act.
56755
+ */
56756
+ timedRun: HeroRowTimedRunSchema.nullable(),
55677
56757
  trailing: HeroFactSchema.nullable()
55678
56758
  });
55679
56759
  /** The trailing fact, in order of preference. */
@@ -55710,7 +56790,30 @@ function primaryOf(model) {
55710
56790
  return null;
55711
56791
  }
55712
56792
  function statusLineOf(model, trailing) {
55713
- return [model.rows.find((r) => r.id === "now-playing")?.status ?? null ?? model.title, ...model.facts.filter((f) => f !== trailing).map((f) => f.text).slice(0, 3)];
56793
+ const head = model.rows.find((r) => r.id === "now-playing")?.status ?? null ?? model.title;
56794
+ const rest = model.facts.filter((f) => f !== trailing).map((f) => f.text).slice(0, 3);
56795
+ const slot = model.timedRun;
56796
+ if (slot === null || slot.remaining === null) return [head, ...rest];
56797
+ const word = slot.quickRun.unit === "min" ? "min" : "s";
56798
+ const left = {
56799
+ en: `${slot.remaining} ${word}`,
56800
+ it: `${slot.remaining} ${word}`
56801
+ };
56802
+ return [
56803
+ head,
56804
+ ...rest,
56805
+ left
56806
+ ];
56807
+ }
56808
+ /** Run while the slot is idle, Stop while it is armed. Hidden when the caller may not act. */
56809
+ function timedRunOf(model) {
56810
+ const slot = model.timedRun;
56811
+ if (slot === null || model.gated.includes("timed-run")) return null;
56812
+ return {
56813
+ id: slot.activeUntil === null ? "timed-run.run" : "timed-run.cancel",
56814
+ duration: slot.quickRun.duration,
56815
+ unit: slot.quickRun.unit
56816
+ };
55714
56817
  }
55715
56818
  function projectDeviceRow(model) {
55716
56819
  const trailing = trailingOf(model.facts);
@@ -55724,6 +56827,7 @@ function projectDeviceRow(model) {
55724
56827
  scene: model.scene,
55725
56828
  statusLine: statusLineOf(model, trailing),
55726
56829
  primary: primaryOf(model),
56830
+ timedRun: timedRunOf(model),
55727
56831
  trailing
55728
56832
  };
55729
56833
  }
@@ -89537,6 +90641,8 @@ var CAPABILITY_NAMES = {
89537
90641
  groupActive: "group-active",
89538
90642
  groupCommands: "group-commands",
89539
90643
  groupStatus: "group-status",
90644
+ heatPumpControl: "heat-pump-control",
90645
+ heatPumpStatus: "heat-pump-status",
89540
90646
  heatingValve: "heating-valve",
89541
90647
  heroLayout: "hero-layout",
89542
90648
  humidifier: "humidifier",
@@ -89992,6 +91098,14 @@ var CAPABILITY_ROUTER_KEYS = [
89992
91098
  key: "groupStatus",
89993
91099
  name: "group-status"
89994
91100
  },
91101
+ {
91102
+ key: "heatPumpControl",
91103
+ name: "heat-pump-control"
91104
+ },
91105
+ {
91106
+ key: "heatPumpStatus",
91107
+ name: "heat-pump-status"
91108
+ },
89995
91109
  {
89996
91110
  key: "heatingValve",
89997
91111
  name: "heating-valve"
@@ -90566,6 +91680,8 @@ var ALL_CAPABILITY_DEFINITIONS = [
90566
91680
  groupActiveCapability,
90567
91681
  groupCommandsCapability,
90568
91682
  groupStatusCapability,
91683
+ heatPumpControlCapability,
91684
+ heatPumpStatusCapability,
90569
91685
  heatingValveCapability,
90570
91686
  heroLayoutCapability,
90571
91687
  humidifierCapability,
@@ -90696,7 +91812,7 @@ var ALL_CAPABILITY_DEFINITIONS = [
90696
91812
  * step appears (an automation's actions, an action's steps, a scheduler
90697
91813
  * point's steps), and leaves everything else untouched.
90698
91814
  */
90699
- function isRecord$3(value) {
91815
+ function isRecord$2(value) {
90700
91816
  return typeof value === "object" && value !== null && !Array.isArray(value);
90701
91817
  }
90702
91818
  function expandStep(step) {
@@ -90704,7 +91820,7 @@ function expandStep(step) {
90704
91820
  if (step["kind"] !== "cap" || typeof actionId !== "string") return step;
90705
91821
  const found = require_sleep.findVocabAction(actionId);
90706
91822
  if (found === void 0) return step;
90707
- const given = isRecord$3(step["args"]) ? step["args"] : {};
91823
+ const given = isRecord$2(step["args"]) ? step["args"] : {};
90708
91824
  const args = {
90709
91825
  ...found.action.args,
90710
91826
  ...given
@@ -90718,7 +91834,7 @@ function expandStep(step) {
90718
91834
  }
90719
91835
  function expandDraft(value) {
90720
91836
  if (Array.isArray(value)) return value.map(expandDraft);
90721
- if (!isRecord$3(value)) return value;
91837
+ if (!isRecord$2(value)) return value;
90722
91838
  return expandStep(Object.fromEntries(Object.entries(value).map(([k, v]) => [k, expandDraft(v)])));
90723
91839
  }
90724
91840
  //#endregion
@@ -90805,7 +91921,7 @@ function normalise(kind, json) {
90805
91921
  /** A stable string for ordering a set's elements. */
90806
91922
  function keyOf(value) {
90807
91923
  if (Array.isArray(value)) return `[${value.map(keyOf).join(",")}]`;
90808
- if (isRecord$3(value)) return `{${Object.keys(value).filter((k) => !IGNORED_KEYS.has(k)).toSorted().map((k) => `${k}:${keyOf(value[k])}`).join(",")}}`;
91924
+ if (isRecord$2(value)) return `{${Object.keys(value).filter((k) => !IGNORED_KEYS.has(k)).toSorted().map((k) => `${k}:${keyOf(value[k])}`).join(",")}}`;
90809
91925
  if (typeof value === "string") return JSON.stringify(value.trim().toLowerCase());
90810
91926
  if (typeof value === "number") return String(Math.round(value * DECIMALS) / DECIMALS);
90811
91927
  return JSON.stringify(value) ?? "undefined";
@@ -90882,7 +91998,7 @@ function score(a, b, key) {
90882
91998
  misses: missOf(key)
90883
91999
  };
90884
92000
  if (Array.isArray(a) && Array.isArray(b)) return SET_KEYS.has(key) ? setScore(a, b, key) : orderedScore(a, b, key);
90885
- if (isRecord$3(a) && isRecord$3(b)) return objectScore(a, b);
92001
+ if (isRecord$2(a) && isRecord$2(b)) return objectScore(a, b);
90886
92002
  return keyOf(a) === keyOf(b) ? SAME : {
90887
92003
  score: 0,
90888
92004
  misses: missOf(key)
@@ -91931,7 +93047,7 @@ function validateCompositionDraft(site, json) {
91931
93047
  };
91932
93048
  }
91933
93049
  function validateDraft(kind, json, site) {
91934
- if (!isRecord$3(json)) return {
93050
+ if (!isRecord$2(json)) return {
91935
93051
  ok: false,
91936
93052
  issues: ["(root): the draft must be one JSON object"]
91937
93053
  };
@@ -98127,6 +99243,7 @@ var DEVICE_LOCAL_STATE_CAPS = {
98127
99243
  groupCommands: groupCommandsCapability,
98128
99244
  groupStatus: groupStatusCapability,
98129
99245
  heatingValve: heatingValveCapability,
99246
+ heatPumpStatus: heatPumpStatusCapability,
98130
99247
  humidifier: humidifierCapability,
98131
99248
  humiditySensor: humiditySensorCapability,
98132
99249
  image: imageCapability,
@@ -100179,6 +101296,7 @@ var DEVICE_TYPE_CONTROL_KIND = {
100179
101296
  [require_device_type.DeviceType.Valve]: "valve",
100180
101297
  [require_device_type.DeviceType.Humidifier]: "humidifier",
100181
101298
  [require_device_type.DeviceType.WaterHeater]: "water-heater",
101299
+ [require_device_type.DeviceType.HeatPump]: "dummy",
100182
101300
  [require_device_type.DeviceType.Camera]: "dummy",
100183
101301
  [require_device_type.DeviceType.Hub]: "dummy",
100184
101302
  [require_device_type.DeviceType.Switch]: "switch",
@@ -100454,6 +101572,13 @@ var lockContribution = contribution("lock-control", LockControlStatusSchema, (sl
100454
101572
  reading: reading("lock-control", words?.state ?? "unknown", false, words?.title),
100455
101573
  rows: [row$1("lock", state === "locked" || state === "locking" ? "lock" : "lock-open", joinText([title, since]), lockControls(state, ctx.features.includes(require_device_type.DeviceFeature.LockOpen)))],
100456
101574
  ...since === null || words === null ? {} : { facts: [fact("since", "clock", since, "muted")] },
101575
+ ...words === null ? {} : { tiles: { left: [{
101576
+ label: require_sleep.t("Door", "Porta"),
101577
+ value: title
101578
+ }, ...since === null ? [] : [{
101579
+ label: require_sleep.t("Since", "Da"),
101580
+ value: since
101581
+ }]] } },
100457
101582
  ...words?.door == null ? {} : { scene: { mode: words.door } }
100458
101583
  };
100459
101584
  });
@@ -100535,7 +101660,17 @@ var ACCESS_FAMILY_CONTRIBUTIONS = {
100535
101660
  return {
100536
101661
  reading: reading("alarm-panel", words?.state ?? "unknown", false, words?.title),
100537
101662
  rows: [row$1("alarm", state === "triggered" ? "shield-alert" : state === "disarmed" ? "shield-off" : "shield-check", joinText([words?.title ?? require_sleep.t("Unknown", "Sconosciuto"), since]), alarmControls(state, modes, slice?.requiresCode ?? false))],
100538
- ...since === null || words === null ? {} : { facts: [fact("since", "clock", since, state === "triggered" ? "danger" : "muted")] }
101663
+ ...since === null || words === null ? {} : { facts: [fact("since", "clock", since, state === "triggered" ? "danger" : "muted")] },
101664
+ ...words === null ? {} : { tiles: {
101665
+ left: [{
101666
+ label: require_sleep.t("Mode", "Modalità"),
101667
+ value: words.title
101668
+ }],
101669
+ ...since === null ? {} : { right: [{
101670
+ label: require_sleep.t("Since", "Da"),
101671
+ value: since
101672
+ }] }
101673
+ } }
100539
101674
  };
100540
101675
  }),
100541
101676
  "automation-control": contribution("automation-control", AutomationControlStatusSchema, (slice, ctx) => {
@@ -100601,7 +101736,7 @@ var ACCESS_FAMILY_CONTRIBUTIONS = {
100601
101736
  */
100602
101737
  var has$3 = (ctx, f) => ctx.features.includes(f);
100603
101738
  var unknownText = require_sleep.t("Unknown", "Sconosciuto");
100604
- var pct$1 = (n) => require_sleep.t(`${Math.round(n)}%`, `${Math.round(n)}%`);
101739
+ var pct$2 = (n) => require_sleep.t(`${Math.round(n)}%`, `${Math.round(n)}%`);
100605
101740
  var unit = (n) => Math.min(1, Math.max(0, n / 100));
100606
101741
  /** Battery as a fact, unless the device is also bound to the `battery` cap (it already says so). */
100607
101742
  function ownBattery(level, ctx) {
@@ -100663,7 +101798,7 @@ var fanContribution = contribution("fan-control", FanControlStatusSchema, (slice
100663
101798
  },
100664
101799
  valueArg: "direction"
100665
101800
  });
100666
- const speedText = speed === null ? null : pct$1(speed);
101801
+ const speedText = speed === null ? null : pct$2(speed);
100667
101802
  const preset = slice?.preset ?? "";
100668
101803
  const status = speed === null ? unknownText : joinText([speed === 0 ? require_sleep.t("Off", "Spento") : require_sleep.t(`Speed ${speed}%`, `Velocità ${speed}%`), preset === "" ? null : require_sleep.t(preset, preset)]);
100669
101804
  return {
@@ -100676,10 +101811,16 @@ var fanContribution = contribution("fan-control", FanControlStatusSchema, (slice
100676
101811
  }],
100677
101812
  ...speedText === null ? {} : {
100678
101813
  facts: [fact("speed", "fan", speedText, speed === 0 ? "muted" : "primary")],
100679
- tiles: { right: [{
100680
- label: require_sleep.t("Speed", "Velocità"),
100681
- value: speedText
100682
- }] },
101814
+ tiles: {
101815
+ ...slice?.oscillating == null ? {} : { left: [{
101816
+ label: require_sleep.t("Oscillation", "Oscilla"),
101817
+ value: slice.oscillating ? require_sleep.t("Yes", "Sì") : require_sleep.t("No", "No")
101818
+ }] },
101819
+ ...preset === "" ? {} : { right: [{
101820
+ label: require_sleep.t("Mode", "Modalità"),
101821
+ value: require_sleep.t(preset, preset)
101822
+ }] }
101823
+ },
100683
101824
  scene: { level: unit(speed ?? 0) }
100684
101825
  }
100685
101826
  };
@@ -100743,7 +101884,8 @@ var vacuumContribution = contribution("vacuum-control", VacuumControlStatusSchem
100743
101884
  const words = state === null ? null : VACUUM_WORDS[state];
100744
101885
  const title = state === "error" && slice?.errorLabel ? require_sleep.t(slice.errorLabel, slice.errorLabel) : words?.title;
100745
101886
  const controls = vacuumControls(state);
100746
- if (slice !== void 0 && slice.availableFanSpeeds.length > 0) controls.push({
101887
+ const suctionControls = [];
101888
+ if (slice !== void 0 && slice.availableFanSpeeds.length > 0) suctionControls.push({
100747
101889
  kind: "picker",
100748
101890
  id: "vacuum.suction",
100749
101891
  label: require_sleep.t("Suction", "Aspirazione"),
@@ -100758,22 +101900,31 @@ var vacuumContribution = contribution("vacuum-control", VacuumControlStatusSchem
100758
101900
  });
100759
101901
  if (state !== null) controls.push(vac("locate", "Locate", "Trova", "map-pin", "locate"));
100760
101902
  const progress = state === "cleaning" ? slice?.progress ?? null : null;
101903
+ const suction = slice?.fanSpeed == null || slice.fanSpeed === "" ? [] : [{
101904
+ label: require_sleep.t("Suction", "Aspirazione"),
101905
+ value: require_sleep.t(slice.fanSpeed, slice.fanSpeed)
101906
+ }];
101907
+ const suctionRows = suctionControls.length === 0 ? [] : [{
101908
+ id: "vacuum-suction",
101909
+ icon: "bot",
101910
+ status: null,
101911
+ controls: suctionControls
101912
+ }];
101913
+ const vacuumRows = [{
101914
+ id: "vacuum",
101915
+ icon: "bot",
101916
+ status: title ?? unknownText,
101917
+ controls
101918
+ }, ...suctionRows];
100761
101919
  return {
100762
101920
  reading: reading("vacuum-control", words?.state ?? "unknown", false, title),
100763
- rows: [{
100764
- id: "vacuum",
100765
- icon: "bot",
100766
- status: title ?? unknownText,
100767
- controls
100768
- }],
100769
- facts: [...ownBattery(slice?.batteryLevel ?? null, ctx), ...progress === null ? [] : [fact("progress", "activity", pct$1(progress), "primary")]],
100770
- ...progress === null ? {} : {
100771
- tiles: { right: [{
100772
- label: require_sleep.t("Progress", "Avanzamento"),
100773
- value: pct$1(progress)
100774
- }] },
100775
- scene: { level: unit(progress) }
100776
- }
101921
+ rows: vacuumRows,
101922
+ facts: [...ownBattery(slice?.batteryLevel ?? null, ctx), ...progress === null ? [] : [fact("progress", "activity", pct$2(progress), "primary")]],
101923
+ ...suction.length === 0 && progress === null ? {} : { tiles: { right: [...suction, ...progress === null ? [] : [{
101924
+ label: require_sleep.t("Progress", "Avanzamento"),
101925
+ value: pct$2(progress)
101926
+ }]] } },
101927
+ ...progress === null ? {} : { scene: { level: unit(progress) } }
100777
101928
  };
100778
101929
  });
100779
101930
  var MOWER_WORDS = {
@@ -100829,11 +101980,11 @@ var mowerContribution = contribution("lawn-mower-control", LawnMowerControlStatu
100829
101980
  status: title ?? unknownText,
100830
101981
  controls: mowerControls(activity)
100831
101982
  }],
100832
- facts: [...ownBattery(slice?.batteryLevel ?? null, ctx), ...progress === null ? [] : [fact("progress", "activity", pct$1(progress), "primary")]],
101983
+ facts: [...ownBattery(slice?.batteryLevel ?? null, ctx), ...progress === null ? [] : [fact("progress", "activity", pct$2(progress), "primary")]],
100833
101984
  ...progress === null ? {} : {
100834
101985
  tiles: { right: [{
100835
101986
  label: require_sleep.t("Progress", "Avanzamento"),
100836
- value: pct$1(progress)
101987
+ value: pct$2(progress)
100837
101988
  }] },
100838
101989
  scene: { level: unit(progress) }
100839
101990
  }
@@ -100904,10 +102055,13 @@ var feederContribution = contribution("pet-feeder", PetFeederStatusSchema, (slic
100904
102055
  ...last === null ? [] : [fact("last-run", "clock", require_sleep.t(`Last ${last} g`, `Ultimo ${last} g`))],
100905
102056
  ...ownBattery(slice?.powerSource === "battery" ? slice.batteryPower : null, ctx)
100906
102057
  ],
100907
- ...last === null ? {} : { tiles: { right: [{
102058
+ tiles: { left: [...slice?.foodLevel == null ? [] : [{
102059
+ label: require_sleep.t("Tank", "Serbatoio"),
102060
+ value: pct$2(slice.foodLevel)
102061
+ }], ...last === null ? [] : [{
100908
102062
  label: require_sleep.t("Last portion", "Ultima porzione"),
100909
102063
  value: require_sleep.t(`${last} g`, `${last} g`)
100910
- }] } }
102064
+ }]] }
100911
102065
  };
100912
102066
  });
100913
102067
  var fountainContribution = contribution("pet-fountain", PetFountainStatusSchema, (slice) => {
@@ -100935,10 +102089,13 @@ var fountainContribution = contribution("pet-fountain", PetFountainStatusSchema,
100935
102089
  }],
100936
102090
  ...level === null ? {} : {
100937
102091
  facts: [fact("level", "droplets", require_sleep.t(`Water ${Math.round(level)}%`, `Acqua ${Math.round(level)}%`), level <= 20 ? "warning" : "primary")],
100938
- tiles: { right: [{
102092
+ tiles: { left: [{
100939
102093
  label: require_sleep.t("Water", "Acqua"),
100940
- value: pct$1(level)
100941
- }] },
102094
+ value: pct$2(level)
102095
+ }, ...slice?.waterVolume == null ? [] : [{
102096
+ label: require_sleep.t("Volume", "Volume"),
102097
+ value: require_sleep.t(`${Math.round(slice.waterVolume)} ml`, `${Math.round(slice.waterVolume)} ml`)
102098
+ }]] },
100942
102099
  scene: { level: unit(level) }
100943
102100
  }
100944
102101
  };
@@ -100972,14 +102129,18 @@ var DEVICES_FAMILY_CONTRIBUTIONS = {
100972
102129
  * that does not parse reads `unknown`, never closed or off (D315/D393).
100973
102130
  */
100974
102131
  var has$2 = (ctx, f) => ctx.features.includes(f);
100975
- var pct = (n) => require_sleep.t(`${Math.round(n)}%`, `${Math.round(n)}%`);
102132
+ var pct$1 = (n) => require_sleep.t(`${Math.round(n)}%`, `${Math.round(n)}%`);
100976
102133
  var brightnessContribution = contribution("brightness", BrightnessStatusSchema, (slice) => {
100977
102134
  const level = slice?.level ?? null;
100978
102135
  return {
100979
102136
  ...level === null ? {} : { reading: reading("brightness", level > 0 ? "on" : "off") },
100980
102137
  ...level === null ? {} : {
100981
- facts: [fact("level", "sun-dim", pct(level), level > 0 ? "primary" : "muted")],
100982
- scene: { level: level / 100 }
102138
+ facts: [fact("level", "sun-dim", pct$1(level), level > 0 ? "primary" : "muted")],
102139
+ scene: { level: level / 100 },
102140
+ tiles: { left: [{
102141
+ label: require_sleep.t("Brightness", "Luminosità"),
102142
+ value: pct$1(level)
102143
+ }] }
100983
102144
  },
100984
102145
  rows: [row$1("brightness", "sun-dim", level === null ? null : require_sleep.t(`Brightness ${Math.round(level)}%`, `Luminosità ${Math.round(level)}%`), [{
100985
102146
  kind: "slider",
@@ -101188,12 +102349,16 @@ function travelFragment(s, state, position, tilt, ctx) {
101188
102349
  });
101189
102350
  return {
101190
102351
  reading: reading(s.source, words.state, false, words.title),
101191
- ...position === null ? {} : { facts: [fact("level", "arrow-up-down", pct(position))] },
102352
+ ...position === null ? {} : { facts: [fact("level", "arrow-up-down", pct$1(position))] },
102353
+ ...position === null ? {} : { tiles: { left: [{
102354
+ label: require_sleep.t("Opening", "Apertura"),
102355
+ value: pct$1(position)
102356
+ }] } },
101192
102357
  scene: {
101193
102358
  ...words.mode === null ? {} : { mode: words.mode },
101194
102359
  ...position === null ? {} : { level: position / 100 }
101195
102360
  },
101196
- rows: [row$1(s.rowId, "arrow-up-down", joinText([words.title, position !== null && state !== "open" ? pct(position) : null]), controls)]
102361
+ rows: [row$1(s.rowId, "arrow-up-down", joinText([words.title, position !== null && state !== "open" ? pct$1(position) : null]), controls)]
101197
102362
  };
101198
102363
  }
101199
102364
  var ACTUATORS_FAMILY_CONTRIBUTIONS = {
@@ -101271,10 +102436,10 @@ var ACTUATORS_FAMILY_CONTRIBUTIONS = {
101271
102436
  const now = slice.currentHumidity;
101272
102437
  return {
101273
102438
  reading: reading("humidifier", state, false, title),
101274
- ...now === null ? {} : { facts: [fact("level", "droplets", pct(now), "info")] },
102439
+ ...now === null ? {} : { facts: [fact("level", "droplets", pct$1(now), "info")] },
101275
102440
  ...slice.targetHumidity === null ? {} : { tiles: { right: [{
101276
102441
  label: require_sleep.t("Target", "Obiettivo"),
101277
- value: pct(slice.targetHumidity)
102442
+ value: pct$1(slice.targetHumidity)
101278
102443
  }] } },
101279
102444
  ...now === null ? {} : { scene: { level: now / 100 } },
101280
102445
  rows: [row$1("humidifier", "droplets", joinText([title, slice.mode === null ? null : require_sleep.t(slice.mode, slice.mode)]), controls)]
@@ -101524,17 +102689,16 @@ var weatherContribution = contribution("weather", WeatherStatusSchema, (slice, c
101524
102689
  });
101525
102690
  var updateContribution = contribution("update", UpdateStatusSchema, (slice) => {
101526
102691
  if (slice === void 0) return { reading: reading("update", "unknown") };
101527
- const { currentVersion, availableVersion, inProgress, updatable } = slice;
102692
+ const { currentVersion, availableVersion, inProgress } = slice;
101528
102693
  const pending = availableVersion !== null && availableVersion !== "" && availableVersion !== currentVersion;
101529
102694
  if (!pending && currentVersion === null && !inProgress) return { reading: reading("update", "unknown") };
101530
102695
  const state = inProgress ? "running" : pending ? "standby" : "idle";
101531
102696
  const title = inProgress ? require_sleep.t("Updating", "Aggiornamento in corso") : pending ? require_sleep.t("Update available", "Aggiornamento disponibile") : require_sleep.t("Up to date", "Aggiornato");
101532
102697
  const versions = currentVersion === null ? pending ? require_sleep.t(`${availableVersion}`, `${availableVersion}`) : null : pending ? require_sleep.t(`${currentVersion} → ${availableVersion}`, `${currentVersion} → ${availableVersion}`) : require_sleep.t(`Version ${currentVersion}`, `Versione ${currentVersion}`);
101533
- const install = pending && updatable && !inProgress ? [asAction(action("update.install", require_sleep.t("Install", "Installa"), "download", "update", "installUpdate", {}, "primary", "install"))] : [];
101534
102698
  return {
101535
102699
  reading: reading("update", state, false, title),
101536
102700
  facts: versions === null ? [] : [fact("reading", "download", versions, pending ? "warning" : "muted")],
101537
- rows: [row$1("update", "download", versions, install)]
102701
+ rows: [row$1("update", "download", versions, [])]
101538
102702
  };
101539
102703
  });
101540
102704
  var imageContribution = contribution("image", ImageStatusSchema, (slice, ctx) => {
@@ -101644,6 +102808,33 @@ var ON_MODE_PREFERENCE = [
101644
102808
  "heat",
101645
102809
  "cool"
101646
102810
  ];
102811
+ var FAN_LABEL = {
102812
+ auto: require_sleep.t("Auto", "Auto"),
102813
+ quiet: require_sleep.t("Quiet", "Silenziosa"),
102814
+ low: require_sleep.t("Low", "Bassa"),
102815
+ medium: require_sleep.t("Medium", "Media"),
102816
+ high: require_sleep.t("High", "Alta"),
102817
+ turbo: require_sleep.t("Turbo", "Turbo"),
102818
+ off: require_sleep.t("Off", "Spenta")
102819
+ };
102820
+ /** A readable label for a fan speed name; an unknown one is shown as the device reported it. */
102821
+ function fanLabelOf(fan) {
102822
+ return FAN_LABEL[fan] ?? require_sleep.t(fan, fan);
102823
+ }
102824
+ /** Short labels for a segmented control: one word each, so the segments stay on a line. */
102825
+ var MODE_SEGMENT_LABEL = {
102826
+ off: require_sleep.t("Off", "Spento"),
102827
+ heat: require_sleep.t("Heat", "Caldo"),
102828
+ cool: require_sleep.t("Cool", "Freddo"),
102829
+ auto: require_sleep.t("Auto", "Auto"),
102830
+ heat_cool: require_sleep.t("Heat/Cool", "Caldo/Freddo"),
102831
+ fan_only: require_sleep.t("Fan", "Vent."),
102832
+ dry: require_sleep.t("Dry", "Deum.")
102833
+ };
102834
+ /** The segment label of every available HVAC mode, keyed by the mode value. */
102835
+ function modeLabelsOf(modes) {
102836
+ return Object.fromEntries(modes.map((m) => [m, MODE_SEGMENT_LABEL[m]]));
102837
+ }
101647
102838
  /** 22 -> "22", 22.3 -> "22.3": a trailing zero is noise on a thermostat. */
101648
102839
  function formatDegrees(value) {
101649
102840
  return `${Number(value.toFixed(1))}°`;
@@ -101710,11 +102901,11 @@ function rangeFrom(min, max, step) {
101710
102901
  * contribute, types never do (D14). A slice that is absent or does not parse is
101711
102902
  * "not answered": the state reads unknown, no row is drawn (D315, D393).
101712
102903
  */
101713
- var same = (text) => require_sleep.t(text, text);
101714
- function tile(en, it, value) {
102904
+ var same$1 = (text) => require_sleep.t(text, text);
102905
+ function tile$1(en, it, value) {
101715
102906
  return {
101716
102907
  label: require_sleep.t(en, it),
101717
- value: same(value)
102908
+ value: same$1(value)
101718
102909
  };
101719
102910
  }
101720
102911
  function setpointSlider(id, cap, method, valueArg, value, range) {
@@ -101749,18 +102940,19 @@ var climateContribution = contribution("climate-control", ClimateControlStatusSc
101749
102940
  const status = climateStatusText(view);
101750
102941
  const facts = [];
101751
102942
  if (status !== null) facts.push(fact("climate", "thermometer", status));
101752
- if (view.humidity !== null) facts.push(fact("humidity", "droplets", same(`${Math.round(view.humidity)}%`)));
101753
- if (view.targetHumidity !== null) facts.push(fact("humidity", "droplets", same(`→ ${Math.round(view.targetHumidity)}%`)));
102943
+ if (view.humidity !== null) facts.push(fact("humidity", "droplets", same$1(`${Math.round(view.humidity)}%`)));
102944
+ if (view.targetHumidity !== null) facts.push(fact("humidity", "droplets", same$1(`→ ${Math.round(view.targetHumidity)}%`)));
101754
102945
  const left = [];
101755
102946
  const right = [];
101756
- if (view.measured !== null) left.push(tile("Indoor", "In casa", formatDegrees(view.measured)));
101757
- if (view.humidity !== null) left.push(tile("Humidity", "Umidità", `${Math.round(view.humidity)}%`));
102947
+ if (view.measured !== null) left.push(tile$1("Indoor", "In casa", formatDegrees(view.measured)));
102948
+ if (view.humidity !== null) left.push(tile$1("Humidity", "Umidità", `${Math.round(view.humidity)}%`));
101758
102949
  const modeControls = [{
101759
102950
  kind: "picker",
101760
102951
  id: "climate.mode",
101761
102952
  label: require_sleep.t("Mode", "Modalità"),
101762
102953
  current: view.mode,
101763
- options: [...view.availableModes],
102954
+ options: [...view.availableModes.filter((m) => m !== "off"), ...view.availableModes.filter((m) => m === "off")],
102955
+ optionLabels: modeLabelsOf(view.availableModes),
101764
102956
  call: {
101765
102957
  cap: "climate-control",
101766
102958
  method: "setMode",
@@ -101788,6 +102980,7 @@ var climateContribution = contribution("climate-control", ClimateControlStatusSc
101788
102980
  label: require_sleep.t("Fan", "Ventola"),
101789
102981
  current: slice.fanMode === "" ? null : slice.fanMode,
101790
102982
  options: [...slice.availableFanModes],
102983
+ optionLabels: Object.fromEntries(slice.availableFanModes.map((m) => [m, fanLabelOf(m)])),
101791
102984
  call: {
101792
102985
  cap: "climate-control",
101793
102986
  method: "setFanMode",
@@ -101813,14 +103006,15 @@ var climateContribution = contribution("climate-control", ClimateControlStatusSc
101813
103006
  if (fanControls.length > 0) rows.push({
101814
103007
  id: "climate-fan",
101815
103008
  icon: "fan",
101816
- status: slice.fanMode === "" ? null : same(slice.fanMode),
103009
+ status: slice.fanMode === "" ? null : same$1(slice.fanMode),
101817
103010
  controls: fanControls
101818
103011
  });
101819
- 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)));
103012
+ 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)));
101820
103013
  const sceneMode = view.sceneMode;
101821
103014
  return {
101822
103015
  reading: reading("climate-control", view.isOff ? "off" : "on"),
101823
103016
  title: view.modeLabel,
103017
+ ...view.isOff || slice.fanMode === "" ? {} : { caption: require_sleep.t(`${view.modeLabel.en} · fan ${fanLabelOf(slice.fanMode).en}`, `${view.modeLabel.it} · ventola ${fanLabelOf(slice.fanMode).it}`) },
101824
103018
  facts,
101825
103019
  ...left.length === 0 && right.length === 0 ? {} : { tiles: {
101826
103020
  left,
@@ -101847,7 +103041,7 @@ var WATER_ON_PREFERENCE = [
101847
103041
  "performance"
101848
103042
  ];
101849
103043
  function capitalised(word) {
101850
- return same(word.charAt(0).toUpperCase() + word.slice(1).replace(/_/g, " "));
103044
+ return same$1(word.charAt(0).toUpperCase() + word.slice(1).replace(/_/g, " "));
101851
103045
  }
101852
103046
  var waterHeaterContribution = contribution("water-heater", WaterHeaterStatusSchema, (slice) => {
101853
103047
  if (slice === void 0 || slice.operationMode === null) return { reading: reading("climate-control", "unknown") };
@@ -101884,13 +103078,13 @@ var waterHeaterContribution = contribution("water-heater", WaterHeaterStatusSche
101884
103078
  icon: "flame",
101885
103079
  status: label,
101886
103080
  controls: modeControls
101887
- }, ...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))];
103081
+ }, ...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))];
101888
103082
  const level = levelWithin(slice.targetTemp, range);
101889
103083
  return {
101890
103084
  reading: reading("climate-control", isOff ? "off" : "on"),
101891
103085
  title: label,
101892
103086
  facts: status === null ? [] : [fact("climate", "flame", status)],
101893
- ...slice.currentTemp === null ? {} : { tiles: { left: [tile("Water", "Acqua", formatDegrees(slice.currentTemp))] } },
103087
+ ...slice.currentTemp === null ? {} : { tiles: { left: [tile$1("Water", "Acqua", formatDegrees(slice.currentTemp))] } },
101894
103088
  scene: {
101895
103089
  ...isOff ? {} : { mode: "heat" },
101896
103090
  ...level === null ? {} : { level }
@@ -101908,11 +103102,12 @@ var waterHeaterContribution = contribution("water-heater", WaterHeaterStatusSche
101908
103102
  var heatingValveContribution = contribution("heating-valve", HeatingValveStatusSchema, (slice) => {
101909
103103
  const position = slice?.position ?? null;
101910
103104
  if (position === null) return { reading: reading("sensor", "unknown") };
101911
- const text = same(`${Math.round(position)}%`);
103105
+ const text = same$1(`${Math.round(position)}%`);
101912
103106
  return {
101913
103107
  reading: reading("sensor", position > 0 ? "running" : "idle"),
101914
103108
  facts: [fact("valve", "gauge", require_sleep.t(`Valve ${text.en}`, `Valvola ${text.it}`))],
101915
- tiles: { right: [tile("Valve", "Valvola", text.en)] },
103109
+ tiles: { right: [tile$1("Valve", "Valvola", text.en)] },
103110
+ ...position > 0 ? { caption: require_sleep.t(`Heating · valve ${text.en}`, `Riscalda · valvola ${text.it}`) } : {},
101916
103111
  scene: { level: position / 100 }
101917
103112
  };
101918
103113
  });
@@ -101921,9 +103116,9 @@ function sensorFragment(value, id, icon, en, it, text) {
101921
103116
  if (value === null) return { reading: reading("sensor", "unknown") };
101922
103117
  return {
101923
103118
  reading: reading("sensor", "on"),
101924
- title: same(text),
101925
- facts: [fact(id, icon, same(text))],
101926
- tiles: { right: [tile(en, it, text)] }
103119
+ title: same$1(text),
103120
+ facts: [fact(id, icon, same$1(text))],
103121
+ tiles: { right: [tile$1(en, it, text)] }
101927
103122
  };
101928
103123
  }
101929
103124
  var temperatureContribution = contribution("temperature-sensor", TemperatureSensorStatusSchema, (slice) => sensorFragment(slice?.temperature ?? null, "temperature", "thermometer", "Temperature", "Temperatura", formatDegrees(slice?.temperature ?? 0)));
@@ -101978,8 +103173,8 @@ var CLIMATE_FAMILY_CONTRIBUTIONS = {
101978
103173
  return {
101979
103174
  reading: reading("sensor", "on"),
101980
103175
  ...slice.aqi === void 0 ? {} : { title: airQualityWord(slice.aqi) },
101981
- facts: parts.map((p) => fact("air-quality", "wind", same(`${p.label} ${p.value}`))),
101982
- tiles: { right: parts.slice(0, 2).map((p) => tile(p.label, p.label, p.value)) }
103176
+ facts: parts.map((p) => fact("air-quality", "wind", same$1(`${p.label} ${p.value}`))),
103177
+ tiles: { right: parts.slice(0, 2).map((p) => tile$1(p.label, p.label, p.value)) }
101983
103178
  };
101984
103179
  }),
101985
103180
  "carbon-monoxide": contribution("carbon-monoxide", CarbonMonoxideStatusSchema, (slice) => {
@@ -101995,6 +103190,256 @@ var CLIMATE_FAMILY_CONTRIBUTIONS = {
101995
103190
  "enum-sensor": enumContribution
101996
103191
  };
101997
103192
  //#endregion
103193
+ //#region src/device/hero/hero-contributions-heat-pump.ts
103194
+ /**
103195
+ * The heat pump's contribution to a hero (D1026): the compressor scene, every
103196
+ * circuit as a row with its own label and icon, the powers as pills (the
103197
+ * instantaneous COP only when both powers are known) and a "System" group with
103198
+ * one selector per mode. Values and their limits come from the slice, which the
103199
+ * gateway filled: a selector with no allowed value is not drawn, a missing
103200
+ * reading is never a 0 (D393).
103201
+ */
103202
+ var CAP = "heat-pump-control";
103203
+ var same = (text) => require_sleep.t(text, text);
103204
+ /** The words of the values the gateway names; a value not listed is drawn as the gateway wrote it. */
103205
+ var VALUE_LABELS = {
103206
+ off: require_sleep.t("Off", "Off"),
103207
+ on: require_sleep.t("On", "On"),
103208
+ auto: require_sleep.t("Auto", "Auto"),
103209
+ manual: require_sleep.t("Manual", "Manuale"),
103210
+ low: require_sleep.t("Low", "Bassa"),
103211
+ high: require_sleep.t("High", "Alta"),
103212
+ eco: require_sleep.t("Eco", "Eco"),
103213
+ heat: require_sleep.t("Heat", "Caldo"),
103214
+ cool: require_sleep.t("Cool", "Freddo"),
103215
+ heatCool: require_sleep.t("Heat/cool", "Caldo/freddo"),
103216
+ ownprogram: require_sleep.t("Programme", "Programma")
103217
+ };
103218
+ function valueLabel(value) {
103219
+ const known = VALUE_LABELS[value];
103220
+ if (known !== void 0) return known;
103221
+ const holiday = /^hm(\d+)$/.exec(value);
103222
+ if (holiday?.[1] !== void 0) return require_sleep.t(`Programme ${holiday[1]}`, `Programma ${holiday[1]}`);
103223
+ return same(value);
103224
+ }
103225
+ function optionLabels(allowed) {
103226
+ return Object.fromEntries(allowed.map((value) => [value, valueLabel(value)]));
103227
+ }
103228
+ function picker(id, label, setting, method, args, valueArg = "mode") {
103229
+ return {
103230
+ kind: "picker",
103231
+ id,
103232
+ label,
103233
+ current: setting.value,
103234
+ options: [...setting.allowed],
103235
+ optionLabels: optionLabels(setting.allowed),
103236
+ call: {
103237
+ cap: CAP,
103238
+ method,
103239
+ args: { ...args }
103240
+ },
103241
+ valueArg
103242
+ };
103243
+ }
103244
+ /** A selector exists only where the gateway named values to choose from. */
103245
+ function choosable(setting) {
103246
+ return setting !== null && setting.allowed.length > 0;
103247
+ }
103248
+ function circuitControl(circuit) {
103249
+ const args = { circuitId: circuit.id };
103250
+ if (circuit.kind === "dhw" && choosable(circuit.temperatureLevel)) return picker(`heat-pump.${circuit.id}.level`, require_sleep.t("Level", "Livello"), circuit.temperatureLevel, "setDhwTemperatureLevel", args, "level");
103251
+ if (!choosable(circuit.operationMode)) return null;
103252
+ const method = circuit.kind === "dhw" ? "setDhwOperationMode" : "setCircuitOperationMode";
103253
+ return picker(`heat-pump.${circuit.id}.mode`, require_sleep.t("Mode", "Modalità"), circuit.operationMode, method, args);
103254
+ }
103255
+ /** A circuit with no reading is still a row: it shows that nothing is known, not nothing. */
103256
+ var UNKNOWN_STATUS = same("—");
103257
+ function circuitRow(circuit) {
103258
+ const control = circuitControl(circuit);
103259
+ const status = thermalStatusText(circuit.targetTemp, circuit.currentTemp) ?? UNKNOWN_STATUS;
103260
+ return {
103261
+ id: "circuit",
103262
+ label: same(circuit.label),
103263
+ icon: circuit.icon,
103264
+ status,
103265
+ controls: control === null ? [] : [control]
103266
+ };
103267
+ }
103268
+ var kilowatts = (watts) => `${Number((watts / 1e3).toFixed(2))} kW`;
103269
+ function powerPills(status) {
103270
+ const { thermalW, electricalW } = status.power;
103271
+ const cop = heatPumpInstantCop(status.power);
103272
+ const pills = [];
103273
+ if (thermalW !== null) pills.push({
103274
+ icon: "flame",
103275
+ text: require_sleep.t(`Thermal ${kilowatts(thermalW)}`, `Termica ${kilowatts(thermalW)}`),
103276
+ tone: "muted"
103277
+ });
103278
+ if (electricalW !== null) pills.push({
103279
+ icon: "zap",
103280
+ text: require_sleep.t(`Electrical ${kilowatts(electricalW)}`, `Elettrica ${kilowatts(electricalW)}`),
103281
+ tone: "muted"
103282
+ });
103283
+ if (cop !== null) {
103284
+ const text = String(Number(cop.toFixed(1)));
103285
+ pills.push({
103286
+ icon: "gauge",
103287
+ text: require_sleep.t(`Instantaneous COP ${text}`, `COP istantaneo ${text}`),
103288
+ tone: "success"
103289
+ });
103290
+ }
103291
+ return pills;
103292
+ }
103293
+ /** The independent system modes, in the order the card draws them. */
103294
+ var SYSTEM_MODES = [
103295
+ {
103296
+ key: "silent",
103297
+ label: require_sleep.t("Silent", "Silenzioso"),
103298
+ icon: "volume-x",
103299
+ method: "setSilentMode"
103300
+ },
103301
+ {
103302
+ key: "away",
103303
+ label: require_sleep.t("Away", "Assente"),
103304
+ icon: "plane",
103305
+ method: "setAwayMode"
103306
+ },
103307
+ {
103308
+ key: "additionalHeater",
103309
+ label: require_sleep.t("Additional heater", "Riscaldatore aggiuntivo"),
103310
+ icon: "flame",
103311
+ method: "setAdditionalHeaterMode"
103312
+ },
103313
+ {
103314
+ key: "holiday",
103315
+ label: require_sleep.t("Holiday", "Vacanza"),
103316
+ icon: "tree-palm",
103317
+ method: "setHolidayMode"
103318
+ }
103319
+ ];
103320
+ var SYSTEM_GROUP = require_sleep.t("System", "Sistema");
103321
+ var PROGRAMME = /^hm\d+$/;
103322
+ /**
103323
+ * Holiday is two segments, off / programme. Choosing "programme" keeps the programme
103324
+ * that is set, else the first one the gateway allowed, so a write never leaves
103325
+ * `allowed`. The full hm1..hm8 pick is not in the hero (D1026). A holiday whose values
103326
+ * are not programmes keeps the plain selector.
103327
+ */
103328
+ function holidayRow(def, setting) {
103329
+ if (!setting.allowed.includes("off")) return null;
103330
+ const current = setting.value !== null && PROGRAMME.test(setting.value) ? setting.value : null;
103331
+ const programme = current ?? setting.allowed.find((v) => PROGRAMME.test(v));
103332
+ if (programme === void 0) return null;
103333
+ const control = picker("heat-pump.system.holiday", def.label, {
103334
+ value: setting.value,
103335
+ allowed: ["off", programme]
103336
+ }, def.method, {});
103337
+ const number = programme.slice(2);
103338
+ return {
103339
+ id: "system-mode",
103340
+ label: def.label,
103341
+ group: SYSTEM_GROUP,
103342
+ icon: def.icon,
103343
+ status: current === null ? null : require_sleep.t(`Programme ${number}`, `Programma ${number}`),
103344
+ controls: [control.kind === "picker" ? {
103345
+ ...control,
103346
+ optionLabels: {
103347
+ off: require_sleep.t("Off", "Off"),
103348
+ [programme]: require_sleep.t("Programme", "Programma")
103349
+ }
103350
+ } : control]
103351
+ };
103352
+ }
103353
+ function systemRows(status) {
103354
+ const rows = [];
103355
+ for (const def of SYSTEM_MODES) {
103356
+ const setting = status.system[def.key];
103357
+ if (!choosable(setting)) continue;
103358
+ if (def.key === "holiday") {
103359
+ const holiday = holidayRow(def, setting);
103360
+ if (holiday !== null) {
103361
+ rows.push(holiday);
103362
+ continue;
103363
+ }
103364
+ }
103365
+ rows.push({
103366
+ id: "system-mode",
103367
+ label: def.label,
103368
+ group: SYSTEM_GROUP,
103369
+ icon: def.icon,
103370
+ status: null,
103371
+ controls: [picker(`heat-pump.system.${def.key}`, def.label, setting, def.method, {})]
103372
+ });
103373
+ }
103374
+ return rows;
103375
+ }
103376
+ function tile(en, it, value) {
103377
+ return {
103378
+ label: require_sleep.t(en, it),
103379
+ value: same(value)
103380
+ };
103381
+ }
103382
+ function tilesOf$1(status) {
103383
+ const { supply, return: back, outdoor } = status.temperatures;
103384
+ const left = [];
103385
+ const right = [];
103386
+ if (supply !== null) left.push(tile("Supply", "Mandata", formatDegrees(supply)));
103387
+ if (back !== null) left.push(tile("Return", "Ritorno", formatDegrees(back)));
103388
+ if (outdoor !== null) right.push(tile("Outdoor", "Esterna", formatDegrees(outdoor)));
103389
+ if (status.waterPressureBar !== null) right.push(tile("Pressure", "Pressione", `${Number(status.waterPressureBar.toFixed(1))} bar`));
103390
+ return {
103391
+ left,
103392
+ right
103393
+ };
103394
+ }
103395
+ function isRunning(status) {
103396
+ const { compressorPct, electricalW } = status.power;
103397
+ if (compressorPct !== null) return compressorPct > 0;
103398
+ if (electricalW !== null) return electricalW > 0;
103399
+ return null;
103400
+ }
103401
+ var HEAT_PUMP_FAMILY_CONTRIBUTIONS = { "heat-pump-status": contribution("heat-pump-status", HeatPumpStatusSchema, (slice) => {
103402
+ if (slice === void 0) return { reading: reading("climate-control", "unknown") };
103403
+ const running = isRunning(slice);
103404
+ const facts = [];
103405
+ if (slice.power.electricalW !== null) facts.push(fact("power", "zap", same(`${Math.round(slice.power.electricalW)} W`)));
103406
+ if (slice.power.compressorPct !== null) facts.push(fact("level", "gauge", require_sleep.t(`Compressor ${Math.round(slice.power.compressorPct)} %`, `Compressore ${Math.round(slice.power.compressorPct)} %`)));
103407
+ const charging = slice.circuits.find((c) => c.active === true);
103408
+ const tiles = tilesOf$1(slice);
103409
+ const pills = powerPills(slice);
103410
+ const rows = [
103411
+ ...slice.circuits.map(circuitRow),
103412
+ ...pills.length === 0 ? [] : [{
103413
+ id: "heat-pump-power",
103414
+ icon: "zap",
103415
+ status: null,
103416
+ controls: [],
103417
+ pills: [...pills]
103418
+ }],
103419
+ ...systemRows(slice)
103420
+ ];
103421
+ return {
103422
+ reading: reading("climate-control", running === true ? "running" : running === false ? "idle" : "on"),
103423
+ title: require_sleep.t("Heat pump", "Pompa di calore"),
103424
+ ...charging === void 0 ? {} : { caption: require_sleep.t(`${charging.label} · heating`.toUpperCase(), `${charging.label} · in riscaldamento`.toUpperCase()) },
103425
+ facts,
103426
+ ...tiles.left.length === 0 && tiles.right.length === 0 ? {} : { tiles },
103427
+ ...slice.power.electricalW === null ? {} : { consumption: {
103428
+ priority: 1,
103429
+ slot: {
103430
+ kind: "power",
103431
+ watts: slice.power.electricalW,
103432
+ detail: slice.power.thermalW === null ? [] : [{
103433
+ label: require_sleep.t("Thermal", "Termica"),
103434
+ value: Math.round(slice.power.thermalW),
103435
+ unit: "W"
103436
+ }]
103437
+ }
103438
+ } },
103439
+ rows
103440
+ };
103441
+ }) };
103442
+ //#endregion
101998
103443
  //#region src/device/hero/media-player-view.ts
101999
103444
  /** The position to show at `nowMs`: the reported one, advanced while playing when it is stamped. */
102000
103445
  function projectedPositionMs(status, nowMs) {
@@ -102204,6 +103649,13 @@ function minutesLeft(seconds) {
102204
103649
  const m = Math.ceil(seconds / 60);
102205
103650
  return require_sleep.t(`${m} min left`, `${m} min rimanenti`);
102206
103651
  }
103652
+ /** A time left as a tile reads it: "38 min", "1 h 12". */
103653
+ function durationText(seconds) {
103654
+ const m = Math.ceil(seconds / 60);
103655
+ if (m < 60) return require_sleep.t(`${m} min`, `${m} min`);
103656
+ const text = `${Math.floor(m / 60)} h ${String(m % 60).padStart(2, "0")}`;
103657
+ return require_sleep.t(text, text);
103658
+ }
102207
103659
  function deviceTypeOf(type) {
102208
103660
  return Object.values(require_device_type.DeviceType).find((t) => t === type);
102209
103661
  }
@@ -102220,7 +103672,7 @@ var switchContribution = contribution("switch", SwitchStatusSchema, (slice) => {
102220
103672
  }
102221
103673
  };
102222
103674
  });
102223
- var runningStateContribution = contribution("running-state", RunningStateStatusSchema, (slice) => {
103675
+ var runningStateContribution = contribution("running-state", RunningStateStatusSchema, (slice, ctx) => {
102224
103676
  const running = slice?.running ?? null;
102225
103677
  const phase = slice?.phase ?? null;
102226
103678
  const detail = [];
@@ -102234,13 +103686,6 @@ var runningStateContribution = contribution("running-state", RunningStateStatusS
102234
103686
  value: phase,
102235
103687
  unit: null
102236
103688
  });
102237
- const head = running === null ? require_sleep.t("Unknown", "Sconosciuto") : running ? require_sleep.t("Running", "In funzione") : require_sleep.t("Idle", "Inattivo");
102238
- const row = {
102239
- id: "cycle",
102240
- icon: "activity",
102241
- status: phase === null || running !== true ? head : require_sleep.t(`${head.en} · ${phase}`, `${head.it} · ${phase}`),
102242
- controls: []
102243
- };
102244
103689
  return {
102245
103690
  reading: reading("running-state", running === null ? "unknown" : running ? "running" : "idle"),
102246
103691
  consumption: {
@@ -102253,8 +103698,17 @@ var runningStateContribution = contribution("running-state", RunningStateStatusS
102253
103698
  detail
102254
103699
  }
102255
103700
  },
102256
- rows: [row],
102257
- ...phase !== null && running === true ? { facts: [fact("phase", "activity", require_sleep.t(phase, phase), "primary")] } : {}
103701
+ ...phase !== null && running === true ? { facts: [fact("phase", "activity", require_sleep.t(phase, phase), "primary")] } : {},
103702
+ ...running === true && (phase !== null || slice?.since != null) ? { tiles: {
103703
+ ...phase === null ? {} : { left: [{
103704
+ label: require_sleep.t("Phase", "Fase"),
103705
+ value: require_sleep.t(phase, phase)
103706
+ }] },
103707
+ ...slice?.since == null || elapsedText(slice.since, ctx.now) === null ? {} : { right: [{
103708
+ label: require_sleep.t("Started", "Avviata"),
103709
+ value: elapsedText(slice.since, ctx.now) ?? require_sleep.t("", "")
103710
+ }] }
103711
+ } } : {}
102258
103712
  };
102259
103713
  });
102260
103714
  var powerMeterContribution = contribution("power-meter", PowerMeterStatusSchema, (slice) => {
@@ -102287,6 +103741,7 @@ var powerMeterContribution = contribution("power-meter", PowerMeterStatusSchema,
102287
103741
  }
102288
103742
  },
102289
103743
  facts: [fact("power", "zap", text, watts > 0 ? "primary" : "muted")],
103744
+ tilesFallback: true,
102290
103745
  tiles: {
102291
103746
  right: [{
102292
103747
  label: require_sleep.t("Power", "Potenza"),
@@ -102317,6 +103772,7 @@ var batteryContribution = contribution("battery", BatteryStatusSchema, (slice) =
102317
103772
  badges: [badge],
102318
103773
  ...level === null ? {} : {
102319
103774
  facts: [fact("battery", "battery", badge.label, badge.tone)],
103775
+ tilesFallback: true,
102320
103776
  tiles: { left: [{
102321
103777
  label: require_sleep.t("Battery", "Batteria"),
102322
103778
  value: require_sleep.t(`${level}%`, `${level}%`),
@@ -102370,10 +103826,22 @@ var motionTriggerContribution = contribution("motion-trigger", MotionTriggerStat
102370
103826
  controls: [toggle]
102371
103827
  }] };
102372
103828
  });
103829
+ /** The armed run's length: "Timer 25 min". */
103830
+ function timerTile(quickRun) {
103831
+ const text = `${quickRun.duration} ${quickRun.unit}`;
103832
+ return {
103833
+ label: require_sleep.t("Timer", "Timer"),
103834
+ value: require_sleep.t(text, text)
103835
+ };
103836
+ }
103837
+ function remainingWords(amount, unit) {
103838
+ const word = unit === "min" ? "min" : "s";
103839
+ return require_sleep.t(`${amount} ${word}`, `${amount} ${word}`);
103840
+ }
102373
103841
  var timedRunContribution = contribution("timed-run", TimedRunStatusSchema, (slice, ctx) => {
102374
103842
  const type = deviceTypeOf(ctx.type);
102375
- const limit = type === void 0 ? void 0 : TIMED_RUN_LIMITS[type];
102376
- if (limit === void 0) return {};
103843
+ const limit = type === void 0 ? null : timedRunLimitOf(type);
103844
+ if (limit === null) return {};
102377
103845
  const quickRun = slice?.quickRun ?? timedRunQuickRun(limit, null);
102378
103846
  const activeUntil = slice?.activeUntil != null && slice.activeUntil > ctx.now ? slice.activeUntil : null;
102379
103847
  const runArgs = {
@@ -102383,21 +103851,26 @@ var timedRunContribution = contribution("timed-run", TimedRunStatusSchema, (slic
102383
103851
  const run = action("timed-run.run", require_sleep.t(`Run ${quickRun.duration} ${quickRun.unit}`, `Avvia ${quickRun.duration} ${quickRun.unit}`), "timer", "timed-run", "runFor", runArgs, "primary");
102384
103852
  const cancel = action("timed-run.cancel", require_sleep.t("Stop", "Ferma"), "timer-off", "timed-run", "cancel");
102385
103853
  const restart = action("timed-run.restart", require_sleep.t("Restart", "Riavvia"), "rotate-cw", "timed-run", "runFor", runArgs);
102386
- const left = activeUntil === null ? 0 : Math.max(1, Math.ceil((activeUntil - ctx.now) / 6e4));
103854
+ const remaining = activeUntil === null ? null : timedRunRemaining(activeUntil, ctx.now, quickRun.unit);
103855
+ const words = remaining === null ? null : remainingWords(remaining, quickRun.unit);
102387
103856
  const row = {
102388
103857
  id: "run-for",
102389
103858
  icon: "timer",
102390
- status: activeUntil === null ? require_sleep.t(`Run for ${quickRun.duration} ${quickRun.unit}`, `Avvia per ${quickRun.duration} ${quickRun.unit}`) : require_sleep.t(`Stops in ${left} min`, `Si ferma tra ${left} min`),
103859
+ status: words === null ? require_sleep.t(`Run for ${quickRun.duration} ${quickRun.unit}`, `Avvia per ${quickRun.duration} ${quickRun.unit}`) : require_sleep.t(`Stops in ${words.en}`, `Si ferma tra ${words.it}`),
102391
103860
  controls: activeUntil === null ? [asAction(run)] : [asAction(cancel), asAction(restart)]
102392
103861
  };
103862
+ const armed = activeUntil === null ? {} : { right: [timerTile(quickRun)] };
102393
103863
  return {
102394
103864
  timedRun: {
102395
103865
  activeUntil,
102396
103866
  quickRun,
102397
103867
  run,
102398
- cancel
103868
+ cancel,
103869
+ remaining
102399
103870
  },
102400
- rows: [row]
103871
+ rows: [row],
103872
+ tilesFallback: true,
103873
+ tiles: armed
102401
103874
  };
102402
103875
  });
102403
103876
  var powerSourceContribution = contribution("power-source", PowerSourceStateSchema, (slice, ctx) => ({ powerSupply: {
@@ -102438,15 +103911,43 @@ var consumablesContribution = contribution("consumables", ConsumablesStatusSchem
102438
103911
  ...attention === 0 ? {} : { facts: [fact("consumables", null, require_sleep.t(`${attention} to check`, `${attention} da controllare`), "warning")] }
102439
103912
  };
102440
103913
  });
102441
- var dishwasherContribution = contribution("dishwasher", DishwasherStatusSchema, (slice) => {
103914
+ var pct = (n) => require_sleep.t(`${Math.round(n)}%`, `${Math.round(n)}%`);
103915
+ var dishCycle = (id, en, it, icon, method, emphasis = "normal") => asAction(action(`cycle.${id}`, require_sleep.t(en, it), icon, "dishwasher", method, {}, emphasis));
103916
+ /** Pause / resume / stop, per what the appliance is doing; nothing while it is not running. */
103917
+ function dishwasherCycleControls(state) {
103918
+ if (state === "running") return [dishCycle("pause", "Pause", "Pausa", "pause", "pause"), dishCycle("stop", "Stop", "Stop", "square", "stop")];
103919
+ if (state === "paused") return [dishCycle("resume", "Resume", "Riprendi", "play", "resume", "primary"), dishCycle("stop", "Stop", "Stop", "square", "stop")];
103920
+ return [];
103921
+ }
103922
+ var OPERATION_WORDS = {
103923
+ Run: require_sleep.t("Running", "In corso"),
103924
+ Pause: require_sleep.t("Paused", "In pausa"),
103925
+ Finished: require_sleep.t("Finished", "Finito"),
103926
+ Ready: require_sleep.t("Ready", "Pronta"),
103927
+ Inactive: require_sleep.t("Idle", "Inattiva"),
103928
+ DelayedStart: require_sleep.t("Delayed start", "Avvio ritardato"),
103929
+ ActionRequired: require_sleep.t("Action needed", "Serve un intervento"),
103930
+ Error: require_sleep.t("Error", "Errore"),
103931
+ Aborting: require_sleep.t("Stopping", "Arresto")
103932
+ };
103933
+ var dishwasherContribution = contribution("dishwasher", DishwasherStatusSchema, (slice, ctx) => {
102442
103934
  const state = slice === void 0 || slice.state === "unavailable" ? "unknown" : slice.state === "running" ? "running" : slice.state === "error" ? "alert" : "idle";
102443
- const stop = action("program.stop", require_sleep.t("Stop", "Ferma"), "square", "dishwasher", "stop");
102444
- const rows = [{
102445
- id: "program",
102446
- icon: "utensils",
102447
- status: slice?.remaining == null ? null : require_sleep.t(`${Math.ceil(slice.remaining / 60)} min left`, `${Math.ceil(slice.remaining / 60)} min rimanenti`),
102448
- controls: slice?.state === "running" ? [asAction(stop)] : []
102449
- }];
103935
+ const rows = [];
103936
+ const progress = slice?.progress ?? null;
103937
+ if (progress !== null) rows.push({
103938
+ id: "progress",
103939
+ icon: "activity",
103940
+ status: pct(progress),
103941
+ controls: [],
103942
+ progress: progress / 100
103943
+ });
103944
+ const cycle = dishwasherCycleControls(slice?.state);
103945
+ if (cycle.length > 0) rows.push({
103946
+ id: "cycle",
103947
+ icon: "activity",
103948
+ status: null,
103949
+ controls: cycle
103950
+ });
102450
103951
  if (slice?.powerOn != null) rows.push({
102451
103952
  id: "appliance-power",
102452
103953
  icon: "power",
@@ -102461,16 +103962,32 @@ var dishwasherContribution = contribution("dishwasher", DishwasherStatusSchema,
102461
103962
  }]
102462
103963
  });
102463
103964
  const remaining = slice?.remaining ?? null;
103965
+ const phase = slice?.operationState == null ? null : OPERATION_WORDS[slice.operationState] ?? null;
103966
+ const program = slice?.program ?? slice?.selectedProgram ?? null;
103967
+ const left = [...phase === null ? [] : [{
103968
+ label: require_sleep.t("Phase", "Fase"),
103969
+ value: phase
103970
+ }], ...program === null ? [] : [{
103971
+ label: require_sleep.t("Program", "Programma"),
103972
+ value: require_sleep.t(program, program)
103973
+ }]];
102464
103974
  return {
102465
103975
  reading: reading("dishwasher", state),
102466
103976
  rows,
102467
- ...remaining === null ? {} : {
102468
- facts: [fact("remaining", "timer", minutesLeft(remaining), "primary")],
102469
- tiles: { right: [{
102470
- label: require_sleep.t("Left", "Rimane"),
102471
- value: minutesLeft(remaining)
103977
+ ...remaining === null ? {} : { facts: [fact("remaining", "timer", minutesLeft(remaining), "primary")] },
103978
+ tiles: {
103979
+ left,
103980
+ ...remaining === null ? {} : { right: [{
103981
+ label: require_sleep.t("Ends", "Fine"),
103982
+ value: minutesLeft(remaining),
103983
+ tone: "warning",
103984
+ at: ctx.now + remaining * 1e3
103985
+ }, {
103986
+ label: require_sleep.t("Left", "Restano"),
103987
+ value: durationText(remaining)
102472
103988
  }] }
102473
- }
103989
+ },
103990
+ ...progress === null ? {} : { scene: { level: progress / 100 } }
102474
103991
  };
102475
103992
  });
102476
103993
  var has$1 = (ctx, f) => ctx.features.includes(f);
@@ -102528,6 +104045,44 @@ function volumeControls(view, volumeLevel, muted) {
102528
104045
  });
102529
104046
  return controls;
102530
104047
  }
104048
+ var clock = (ms) => {
104049
+ const total = Math.max(0, Math.floor(ms / 1e3));
104050
+ const h = Math.floor(total / 3600);
104051
+ const m = Math.floor(total % 3600 / 60);
104052
+ const sec = String(total % 60).padStart(2, "0");
104053
+ return h > 0 ? `${h}:${String(m).padStart(2, "0")}:${sec}` : `${m}:${sec}`;
104054
+ };
104055
+ var REPEAT_MODES = [
104056
+ "off",
104057
+ "all",
104058
+ "one"
104059
+ ];
104060
+ /** Shuffle and repeat, drawn only when the player declares them and reports a value. */
104061
+ function modeControls(view, shuffle, repeat) {
104062
+ const controls = [];
104063
+ if (view.shuffle) controls.push({
104064
+ kind: "toggle",
104065
+ id: "playback.shuffle",
104066
+ label: require_sleep.t("Shuffle", "Casuale"),
104067
+ on: shuffle,
104068
+ turnOn: action("playback.shuffle.on", require_sleep.t("Shuffle on", "Casuale attivo"), "shuffle", "media-player", "setShuffle", { shuffle: true }),
104069
+ turnOff: action("playback.shuffle.off", require_sleep.t("Shuffle off", "Casuale disattivo"), "shuffle", "media-player", "setShuffle", { shuffle: false })
104070
+ });
104071
+ if (view.repeat) controls.push({
104072
+ kind: "picker",
104073
+ id: "playback.repeat",
104074
+ label: require_sleep.t("Repeat", "Ripeti"),
104075
+ current: repeat,
104076
+ options: [...REPEAT_MODES],
104077
+ call: {
104078
+ cap: "media-player",
104079
+ method: "setRepeat",
104080
+ args: {}
104081
+ },
104082
+ valueArg: "repeat"
104083
+ });
104084
+ return controls;
104085
+ }
102531
104086
  /** Every contributing cap, in the order their fragments are merged. */
102532
104087
  var HERO_CAP_CONTRIBUTIONS = [
102533
104088
  contribution("media-player", MediaPlayerStatusSchema, (slice, ctx) => {
@@ -102543,7 +104098,7 @@ var HERO_CAP_CONTRIBUTIONS = [
102543
104098
  controls: []
102544
104099
  });
102545
104100
  }
102546
- const playback = playbackControls(view, ctx);
104101
+ const playback = [...playbackControls(view, ctx), ...modeControls(view, slice?.shuffle ?? null, slice?.repeat ?? null)];
102547
104102
  if (playback.length > 0) rows.push({
102548
104103
  id: "playback",
102549
104104
  icon: "play",
@@ -102593,13 +104148,30 @@ var HERO_CAP_CONTRIBUTIONS = [
102593
104148
  const facts = [];
102594
104149
  if (sourceNow !== null) facts.push(fact("source", "radio", require_sleep.t(sourceNow, sourceNow)));
102595
104150
  if (volumeNow !== null) facts.push(fact("volume", "volume-2", require_sleep.t(`${volumeNow}%`, `${volumeNow}%`)));
104151
+ const duration = slice?.duration ?? null;
104152
+ const position = slice === void 0 ? null : projectedPositionMs(slice, ctx.now);
104153
+ if (position !== null && duration !== null && duration > 0) {
104154
+ const line = `${clock(position)} / ${clock(duration)}`;
104155
+ facts.push(fact("progress", "activity", require_sleep.t(line, line)));
104156
+ }
104157
+ const trackNow = slice?.currentMedia?.title ?? null;
104158
+ const mediaTiles = {
104159
+ left: [...trackNow === null ? [] : [{
104160
+ label: require_sleep.t("Track", "Brano"),
104161
+ value: require_sleep.t(trackNow, trackNow)
104162
+ }], ...sourceNow === null ? [] : [{
104163
+ label: require_sleep.t("Source", "Sorgente"),
104164
+ value: require_sleep.t(sourceNow, sourceNow)
104165
+ }]],
104166
+ right: volumeNow === null ? [] : [{
104167
+ label: require_sleep.t("Volume", "Volume"),
104168
+ value: require_sleep.t(`${volumeNow}%`, `${volumeNow}%`)
104169
+ }]
104170
+ };
102596
104171
  return {
102597
104172
  reading: mediaReading(view),
102598
104173
  facts,
102599
- ...volumeNow === null ? {} : { tiles: { right: [{
102600
- label: require_sleep.t("Volume", "Volume"),
102601
- value: require_sleep.t(`${volumeNow}%`, `${volumeNow}%`)
102602
- }] } },
104174
+ ...mediaTiles.left.length === 0 && mediaTiles.right.length === 0 ? {} : { tiles: mediaTiles },
102603
104175
  scene: {
102604
104176
  ...mode === null ? {} : { mode },
102605
104177
  ...volumeNow === null ? {} : { level: volumeNow / 100 }
@@ -102632,7 +104204,8 @@ var HERO_CAP_CONTRIBUTIONS = [
102632
104204
  ...Object.values(GROUPS_FAMILY_CONTRIBUTIONS),
102633
104205
  ...Object.values(ACTUATORS_FAMILY_CONTRIBUTIONS),
102634
104206
  ...Object.values(SENSORS_FAMILY_CONTRIBUTIONS),
102635
- ...Object.values(CLIMATE_FAMILY_CONTRIBUTIONS)
104207
+ ...Object.values(CLIMATE_FAMILY_CONTRIBUTIONS),
104208
+ ...Object.values(HEAT_PUMP_FAMILY_CONTRIBUTIONS)
102636
104209
  ];
102637
104210
  //#endregion
102638
104211
  //#region src/device/hero/hero-layout.ts
@@ -102657,9 +104230,10 @@ var MEDIA_PLAYER_LAYOUT = { rows: [
102657
104230
  "source",
102658
104231
  "do-not-disturb"
102659
104232
  ] };
102660
- var APPLIANCE_LAYOUT = { rows: ["cycle"] };
104233
+ var APPLIANCE_LAYOUT = { rows: ["progress", "cycle"] };
102661
104234
  /** Its Home Connect PowerState is a secondary row action, never the own-power slot. */
102662
104235
  var DISHWASHER_LAYOUT = { rows: [
104236
+ "progress",
102663
104237
  "cycle",
102664
104238
  "program",
102665
104239
  "appliance-power"
@@ -102669,11 +104243,17 @@ var CLIMATE_LAYOUT = { rows: [
102669
104243
  "climate-fan",
102670
104244
  "setpoint"
102671
104245
  ] };
104246
+ /** The circuits, then the power pills, then the System group, one row per mode (D1026). */
104247
+ var HEAT_PUMP_LAYOUT = { rows: [
104248
+ "circuit",
104249
+ "heat-pump-power",
104250
+ "system-mode"
104251
+ ] };
102672
104252
  var SWITCH_LAYOUT = { rows: ["motion-trigger"] };
102673
104253
  var LOCK_LAYOUT = { rows: ["lock"] };
102674
104254
  var ALARM_LAYOUT = { rows: ["alarm"] };
102675
104255
  var FAN_LAYOUT = { rows: ["fan"] };
102676
- var VACUUM_LAYOUT = { rows: ["vacuum"] };
104256
+ var VACUUM_LAYOUT = { rows: ["vacuum", "vacuum-suction"] };
102677
104257
  var MOWER_LAYOUT = { rows: ["mower"] };
102678
104258
  var FEEDER_LAYOUT = { rows: ["feeder"] };
102679
104259
  var FOUNTAIN_LAYOUT = { rows: ["fountain", "pump-cycle"] };
@@ -102712,6 +104292,7 @@ var HERO_LAYOUT_BY_TYPE = {
102712
104292
  [require_device_type.DeviceType.Valve]: VALVE_LAYOUT,
102713
104293
  [require_device_type.DeviceType.Humidifier]: HUMIDIFIER_LAYOUT,
102714
104294
  [require_device_type.DeviceType.WaterHeater]: CLIMATE_LAYOUT,
104295
+ [require_device_type.DeviceType.HeatPump]: HEAT_PUMP_LAYOUT,
102715
104296
  [require_device_type.DeviceType.Fan]: FAN_LAYOUT,
102716
104297
  [require_device_type.DeviceType.MediaPlayer]: MEDIA_PLAYER_LAYOUT,
102717
104298
  [require_device_type.DeviceType.AlarmPanel]: ALARM_LAYOUT,
@@ -103137,12 +104718,12 @@ var LOCK_LOOK = {
103137
104718
  standby: look("lock-open", "warning", "plain", "none"),
103138
104719
  off: look("lock-open", "muted", "plain", "none")
103139
104720
  };
103140
- /** The shield glows while armed, blinks red in alarm and goes quiet when disarmed. */
104721
+ /** The shield glows red while armed, blinks red in alarm and goes quiet when disarmed. */
103141
104722
  var ALARM_LOOK = {
103142
104723
  ...lookOf({
103143
104724
  icon: "shield-check",
103144
104725
  on: [
103145
- "success",
104726
+ "danger",
103146
104727
  "glow",
103147
104728
  "halo"
103148
104729
  ],
@@ -103387,6 +104968,22 @@ var WATER_HEATER_LOOK = lookOf({
103387
104968
  idle: INFO,
103388
104969
  standby: MUTED
103389
104970
  });
104971
+ var HEAT_PUMP_LOOK = lookOf({
104972
+ icon: "thermometer-sun",
104973
+ on: [
104974
+ "warning",
104975
+ "heat-rise",
104976
+ "rise"
104977
+ ],
104978
+ off: MUTED,
104979
+ running: [
104980
+ "warning",
104981
+ "heat-rise",
104982
+ "rise"
104983
+ ],
104984
+ idle: INFO,
104985
+ standby: MUTED
104986
+ });
103390
104987
  /** What a climate device draws while it is on, by mode: warm air rises, cold falls, drops dry, the fan spins. */
103391
104988
  var HERO_MODE_LOOK = {
103392
104989
  heat: look("flame", "warning", "heat-rise", "rise"),
@@ -103421,6 +105018,7 @@ var HERO_LOOK_BY_TYPE = {
103421
105018
  [require_device_type.DeviceType.Valve]: VALVE_LOOK,
103422
105019
  [require_device_type.DeviceType.Humidifier]: HUMIDIFIER_LOOK,
103423
105020
  [require_device_type.DeviceType.WaterHeater]: WATER_HEATER_LOOK,
105021
+ [require_device_type.DeviceType.HeatPump]: HEAT_PUMP_LOOK,
103424
105022
  [require_device_type.DeviceType.Fan]: FAN_LOOK,
103425
105023
  [require_device_type.DeviceType.MediaPlayer]: MEDIA_PLAYER_LOOK,
103426
105024
  [require_device_type.DeviceType.AlarmPanel]: ALARM_LOOK,
@@ -103672,7 +105270,19 @@ function consumptionOf(fragments) {
103672
105270
  return best === null ? null : best.slot;
103673
105271
  }
103674
105272
  function tilesOf(fragments, side) {
103675
- return fragments.flatMap((f) => f.tiles?.[side] ?? []).slice(0, 2);
105273
+ const own = fragments.filter((f) => f.tilesFallback !== true).flatMap((f) => f.tiles?.[side] ?? []);
105274
+ return (own.length > 0 ? own : fragments.filter((f) => f.tilesFallback === true).flatMap((f) => f.tiles?.[side] ?? [])).slice(0, 2);
105275
+ }
105276
+ /** The foot button that opens the history, named for what the device keeps. */
105277
+ function historyLabelOf(type) {
105278
+ switch (type) {
105279
+ case require_device_type.DeviceType.Washer:
105280
+ case require_device_type.DeviceType.Dryer:
105281
+ case require_device_type.DeviceType.Dishwasher: return require_sleep.t("Cycles", "Cicli");
105282
+ case require_device_type.DeviceType.PetFeeder: return require_sleep.t("Meals", "Pasti");
105283
+ case require_device_type.DeviceType.Lock: return require_sleep.t("Access", "Accessi");
105284
+ default: return require_sleep.t("History", "Storico");
105285
+ }
103676
105286
  }
103677
105287
  function sceneOf(role, type, fragments) {
103678
105288
  const parts = fragments.flatMap((f) => f.scene === void 0 ? [] : [f.scene]);
@@ -103716,20 +105326,27 @@ function buildHeroModel(input) {
103716
105326
  };
103717
105327
  const allRows = fragments.flatMap((f) => f.rows ?? []);
103718
105328
  const rows = resolveHeroLayout(device.type).rows.flatMap((id) => {
103719
- const row = allRows.find((r) => r.id === id);
103720
- return row === void 0 ? [] : [row];
105329
+ return allRows.filter((r) => r.id === id);
103721
105330
  });
103722
105331
  const ownPower = resolveOwnPower(fragments.flatMap((f) => f.ownPower === void 0 ? [] : [f.ownPower]));
103723
105332
  const timedRun = fragments.find((f) => f.timedRun !== void 0)?.timedRun ?? null;
103724
105333
  const powerSupply = fragments.find((f) => f.powerSupply !== void 0)?.powerSupply ?? null;
103725
105334
  const remote = fragments.find((f) => f.remote !== void 0)?.remote ?? null;
103726
- const badges = fragments.flatMap((f) => f.badges ?? []);
105335
+ const integration = device.integration?.trim() ?? "";
105336
+ const badges = [...integration === "" ? [] : [{
105337
+ id: "integration",
105338
+ icon: "plug",
105339
+ tone: "muted",
105340
+ value: null,
105341
+ label: require_sleep.t(integration, integration)
105342
+ }], ...fragments.flatMap((f) => f.badges ?? [])];
103727
105343
  const headline = state === "offline" || state === "unknown" ? void 0 : fragments.find((f) => f.title !== void 0)?.title;
103728
105344
  const facts = fragments.flatMap((f) => f.facts ?? []).filter((f) => headline === void 0 || f.text.en !== headline.en);
103729
105345
  const sideTiles = {
103730
105346
  left: tilesOf(fragments, "left"),
103731
105347
  right: tilesOf(fragments, "right")
103732
105348
  };
105349
+ const caption = state === "offline" || state === "unknown" ? void 0 : fragments.find((f) => f.caption !== void 0)?.caption;
103733
105350
  const gated = [];
103734
105351
  if (!input.access.canActuate) {
103735
105352
  if (ownPower !== null) gated.push("own-power");
@@ -103751,8 +105368,10 @@ function buildHeroModel(input) {
103751
105368
  facts,
103752
105369
  sideTiles,
103753
105370
  title: headline ?? title,
105371
+ ...caption === void 0 ? {} : { caption },
103754
105372
  badges,
103755
105373
  remote,
105374
+ historyLabel: historyLabelOf(device.type),
103756
105375
  consumables: fragments.find((f) => f.consumables !== void 0)?.consumables ?? null,
103757
105376
  consumption: consumptionOf(fragments),
103758
105377
  ownPower,
@@ -103821,6 +105440,7 @@ var HERO_CAP_COVERAGE = {
103821
105440
  "group-active": "contributes",
103822
105441
  "group-commands": "contributes",
103823
105442
  "group-status": "contributes",
105443
+ "heat-pump-status": "contributes",
103824
105444
  "heating-valve": "contributes",
103825
105445
  humidifier: "contributes",
103826
105446
  "humidity-sensor": "contributes",
@@ -106048,6 +107668,13 @@ var METHOD_ACCESS_MAP = Object.freeze({
106048
107668
  access: "create",
106049
107669
  role: "admin"
106050
107670
  },
107671
+ "deviceManager.checkDeviceTemplates": {
107672
+ capName: "device-manager",
107673
+ capScope: "system",
107674
+ addonId: null,
107675
+ access: "view",
107676
+ role: "admin"
107677
+ },
106051
107678
  "deviceManager.cleanupDeletedDevicesData": {
106052
107679
  capName: "device-manager",
106053
107680
  capScope: "system",
@@ -106447,6 +108074,13 @@ var METHOD_ACCESS_MAP = Object.freeze({
106447
108074
  access: "create",
106448
108075
  role: "admin"
106449
108076
  },
108077
+ "deviceManager.renderDeviceTemplates": {
108078
+ capName: "device-manager",
108079
+ capScope: "system",
108080
+ addonId: null,
108081
+ access: "view",
108082
+ role: "admin"
108083
+ },
106450
108084
  "deviceManager.reportDiscoveryObservations": {
106451
108085
  capName: "device-manager",
106452
108086
  capScope: "system",
@@ -107378,6 +109012,111 @@ var METHOD_ACCESS_MAP = Object.freeze({
107378
109012
  access: "view",
107379
109013
  role: "viewer"
107380
109014
  },
109015
+ "heatPumpControl.setAdditionalHeaterMode": {
109016
+ capName: "heat-pump-control",
109017
+ capScope: "device",
109018
+ addonId: null,
109019
+ access: "create",
109020
+ role: "viewer"
109021
+ },
109022
+ "heatPumpControl.setAwayMode": {
109023
+ capName: "heat-pump-control",
109024
+ capScope: "device",
109025
+ addonId: null,
109026
+ access: "create",
109027
+ role: "viewer"
109028
+ },
109029
+ "heatPumpControl.setCircuitComfortSetpoint": {
109030
+ capName: "heat-pump-control",
109031
+ capScope: "device",
109032
+ addonId: null,
109033
+ access: "create",
109034
+ role: "viewer"
109035
+ },
109036
+ "heatPumpControl.setCircuitEcoSetpoint": {
109037
+ capName: "heat-pump-control",
109038
+ capScope: "device",
109039
+ addonId: null,
109040
+ access: "create",
109041
+ role: "viewer"
109042
+ },
109043
+ "heatPumpControl.setCircuitHeatCoolMode": {
109044
+ capName: "heat-pump-control",
109045
+ capScope: "device",
109046
+ addonId: null,
109047
+ access: "create",
109048
+ role: "viewer"
109049
+ },
109050
+ "heatPumpControl.setCircuitMaxFlowTemp": {
109051
+ capName: "heat-pump-control",
109052
+ capScope: "device",
109053
+ addonId: null,
109054
+ access: "create",
109055
+ role: "viewer"
109056
+ },
109057
+ "heatPumpControl.setCircuitOperationMode": {
109058
+ capName: "heat-pump-control",
109059
+ capScope: "device",
109060
+ addonId: null,
109061
+ access: "create",
109062
+ role: "viewer"
109063
+ },
109064
+ "heatPumpControl.setCircuitSummerWinter": {
109065
+ capName: "heat-pump-control",
109066
+ capScope: "device",
109067
+ addonId: null,
109068
+ access: "create",
109069
+ role: "viewer"
109070
+ },
109071
+ "heatPumpControl.setDhwChargeDuration": {
109072
+ capName: "heat-pump-control",
109073
+ capScope: "device",
109074
+ addonId: null,
109075
+ access: "create",
109076
+ role: "viewer"
109077
+ },
109078
+ "heatPumpControl.setDhwOperationMode": {
109079
+ capName: "heat-pump-control",
109080
+ capScope: "device",
109081
+ addonId: null,
109082
+ access: "create",
109083
+ role: "viewer"
109084
+ },
109085
+ "heatPumpControl.setDhwTemperatureLevel": {
109086
+ capName: "heat-pump-control",
109087
+ capScope: "device",
109088
+ addonId: null,
109089
+ access: "create",
109090
+ role: "viewer"
109091
+ },
109092
+ "heatPumpControl.setHolidayMode": {
109093
+ capName: "heat-pump-control",
109094
+ capScope: "device",
109095
+ addonId: null,
109096
+ access: "create",
109097
+ role: "viewer"
109098
+ },
109099
+ "heatPumpControl.setSilentMode": {
109100
+ capName: "heat-pump-control",
109101
+ capScope: "device",
109102
+ addonId: null,
109103
+ access: "create",
109104
+ role: "viewer"
109105
+ },
109106
+ "heatPumpControl.startExtraHotWater": {
109107
+ capName: "heat-pump-control",
109108
+ capScope: "device",
109109
+ addonId: null,
109110
+ access: "create",
109111
+ role: "viewer"
109112
+ },
109113
+ "heatPumpStatus.getStatus": {
109114
+ capName: "heat-pump-status",
109115
+ capScope: "device",
109116
+ addonId: null,
109117
+ access: "view",
109118
+ role: "viewer"
109119
+ },
107381
109120
  "heroLayout.getHeroModel": {
107382
109121
  capName: "hero-layout",
107383
109122
  capScope: "system",
@@ -114261,6 +116000,8 @@ var KNOWN_CAP_NAMES = [
114261
116000
  "group-active",
114262
116001
  "group-commands",
114263
116002
  "group-status",
116003
+ "heat-pump-control",
116004
+ "heat-pump-status",
114264
116005
  "heating-valve",
114265
116006
  "hero-layout",
114266
116007
  "humidifier",
@@ -114428,6 +116169,8 @@ var DEVICE_CAP_NAMES = [
114428
116169
  "group-active",
114429
116170
  "group-commands",
114430
116171
  "group-status",
116172
+ "heat-pump-control",
116173
+ "heat-pump-status",
114431
116174
  "heating-valve",
114432
116175
  "humidifier",
114433
116176
  "humidity-sensor",
@@ -114725,6 +116468,7 @@ var DEVICE_TYPE_DO_CAPS = {
114725
116468
  [require_device_type.DeviceType.Valve]: ["valve"],
114726
116469
  [require_device_type.DeviceType.Humidifier]: ["humidifier"],
114727
116470
  [require_device_type.DeviceType.WaterHeater]: ["water-heater"],
116471
+ [require_device_type.DeviceType.HeatPump]: ["heat-pump-control"],
114728
116472
  [require_device_type.DeviceType.Fan]: ["fan-control", "switch"],
114729
116473
  [require_device_type.DeviceType.MediaPlayer]: ["media-player"],
114730
116474
  [require_device_type.DeviceType.AlarmPanel]: ["alarm-panel"],
@@ -114764,7 +116508,8 @@ function deviceDoFamily(type) {
114764
116508
  case require_device_type.DeviceType.Climate:
114765
116509
  case require_device_type.DeviceType.Thermostat:
114766
116510
  case require_device_type.DeviceType.Humidifier:
114767
- case require_device_type.DeviceType.WaterHeater: return "climate-family";
116511
+ case require_device_type.DeviceType.WaterHeater:
116512
+ case require_device_type.DeviceType.HeatPump: return "climate-family";
114768
116513
  case require_device_type.DeviceType.Cover:
114769
116514
  case require_device_type.DeviceType.Valve: return "cover-family";
114770
116515
  case require_device_type.DeviceType.Switch:
@@ -115211,7 +116956,7 @@ function applianceExport(ecosystem, deviceType) {
115211
116956
  //#endregion
115212
116957
  //#region src/device/path-util.ts
115213
116958
  /** Returns true when `x` is a non-null, non-array plain object. */
115214
- function isRecord$2(x) {
116959
+ function isRecord$1(x) {
115215
116960
  return x !== null && typeof x === "object" && !Array.isArray(x);
115216
116961
  }
115217
116962
  /** Read a dot-path (`a.b.c`) out of an object. Returns `undefined` for any
@@ -115220,7 +116965,7 @@ function getByPath(obj, path) {
115220
116965
  const parts = path.split(".");
115221
116966
  let cur = obj;
115222
116967
  for (const part of parts) {
115223
- if (!isRecord$2(cur)) return void 0;
116968
+ if (!isRecord$1(cur)) return void 0;
115224
116969
  cur = cur[part];
115225
116970
  }
115226
116971
  return cur;
@@ -115242,7 +116987,7 @@ function setByPath(obj, path, value) {
115242
116987
  const head = path.slice(0, dotIndex);
115243
116988
  const tail = path.slice(dotIndex + 1);
115244
116989
  const child = obj[head];
115245
- const childObj = isRecord$2(child) ? child : {};
116990
+ const childObj = isRecord$1(child) ? child : {};
115246
116991
  return {
115247
116992
  ...obj,
115248
116993
  [head]: setByPath(childObj, tail, value)
@@ -116295,131 +118040,6 @@ function humanizeKey(key) {
116295
118040
  return key.replace(/([A-Z])/g, " $1").replace(/[_-]/g, " ").replace(/^\w/, (c) => c.toUpperCase()).trim();
116296
118041
  }
116297
118042
  //#endregion
116298
- //#region src/expression/device-template.ts
116299
- /**
116300
- * Device value templates, the parts that need no template engine (D1021).
116301
- *
116302
- * A template is plain text with Jinja-style `{{ … }}` / `{% … %}` blocks:
116303
- * `{{ stufa_veranda.temperature | unit('°F') | round(1) }}`. Devices are named
116304
- * by their alias (`device-alias.ts`); a field is `alias.field` when the field
116305
- * name is unique across the device's capabilities, else `alias.<cap>.field`,
116306
- * and an ambiguous `alias.field` is refused by name.
116307
- *
116308
- * The engine itself (nunjucks) lives ONLY in the hub's renderer
116309
- * (`packages/system/src/builtins/device-manager/device-template/`, guard
116310
- * `check-device-template-grammar`): it does not sandbox, so it renders only in
116311
- * a worker thread under a wall-time budget, over frozen plain data. This file
116312
- * is the shared vocabulary — limits, refusal reasons, the trace, and how a
116313
- * `(alias, path)` reference resolves against a device's slices.
116314
- */
116315
- var DEVICE_TEMPLATE_MAX_LENGTH = 4096;
116316
- /** Wall time a render may take, host-measured; the worker is terminated past it. */
116317
- var DEVICE_TEMPLATE_BUDGET_MS = 50;
116318
- var DEVICE_TEMPLATE_MAX_OUTPUT = 4096;
116319
- /** What an unknown or unavailable value renders as. */
116320
- var DEVICE_TEMPLATE_UNAVAILABLE = "—";
116321
- var DeviceTemplateSchema = zod.z.string().min(1).max(DEVICE_TEMPLATE_MAX_LENGTH);
116322
- /** The filters a template may use. Anything else is refused at parse time. */
116323
- var DEVICE_TEMPLATE_FILTERS = [
116324
- "unit",
116325
- "round",
116326
- "default",
116327
- "since",
116328
- "ago",
116329
- "format",
116330
- "upper",
116331
- "lower",
116332
- "title",
116333
- "capitalize",
116334
- "trim",
116335
- "abs",
116336
- "int",
116337
- "float",
116338
- "length",
116339
- "d",
116340
- "join",
116341
- "replace",
116342
- "first",
116343
- "last",
116344
- "sort",
116345
- "reverse",
116346
- "sum",
116347
- "string",
116348
- "list",
116349
- "truncate"
116350
- ];
116351
- /** A capability name as a template spells it: `temperature-sensor` → `temperature_sensor`. */
116352
- function templateCapKey(cap) {
116353
- return cap.replace(/-/g, "_");
116354
- }
116355
- function isRecord$1(value) {
116356
- return typeof value === "object" && value !== null && !Array.isArray(value);
116357
- }
116358
- function pickPath(root, path) {
116359
- let cursor = root;
116360
- for (const part of path) if (Array.isArray(cursor) && typeof part === "number") cursor = cursor[part];
116361
- else if (isRecord$1(cursor) && Object.hasOwn(cursor, String(part))) cursor = cursor[String(part)];
116362
- else return;
116363
- return cursor;
116364
- }
116365
- /**
116366
- * Resolve the path after an alias. `<cap>.field…` when the first segment names
116367
- * one of the device's caps; otherwise `field…` when exactly one cap carries a
116368
- * field of that name; several caps carrying it is `ambiguous`, naming them.
116369
- */
116370
- function resolveTemplateRef(view, path) {
116371
- const head = path[0];
116372
- if (head === void 0) return {
116373
- kind: "missing",
116374
- reason: "no-field"
116375
- };
116376
- const caps = Object.keys(view.slices);
116377
- const named = caps.find((cap) => cap === head || templateCapKey(cap) === head);
116378
- if (named !== void 0) {
116379
- const rest = path.slice(1);
116380
- if (rest.length === 0) return {
116381
- kind: "missing",
116382
- reason: "no-field"
116383
- };
116384
- const value = pickPath(view.slices[named], rest);
116385
- if (value === void 0) return {
116386
- kind: "missing",
116387
- reason: "unknown-field"
116388
- };
116389
- return {
116390
- kind: "value",
116391
- cap: named,
116392
- fieldPath: rest,
116393
- value
116394
- };
116395
- }
116396
- const owners = caps.filter((cap) => {
116397
- const slice = view.slices[cap];
116398
- return isRecord$1(slice) && Object.hasOwn(slice, String(head));
116399
- });
116400
- if (owners.length === 0) return {
116401
- kind: "missing",
116402
- reason: "unknown-field"
116403
- };
116404
- const [only] = owners;
116405
- if (owners.length > 1 || only === void 0) return {
116406
- kind: "ambiguous",
116407
- field: String(head),
116408
- caps: owners
116409
- };
116410
- const value = pickPath(view.slices[only], path);
116411
- if (value === void 0) return {
116412
- kind: "missing",
116413
- reason: "unknown-field"
116414
- };
116415
- return {
116416
- kind: "value",
116417
- cap: only,
116418
- fieldPath: path,
116419
- value
116420
- };
116421
- }
116422
- //#endregion
116423
118043
  //#region src/generated/cap-status-types.ts
116424
118044
  /**
116425
118045
  * Runtime list of cap names with status. Used by the settings
@@ -116462,6 +118082,7 @@ var CAP_NAMES_WITH_STATUS = [
116462
118082
  "group-active",
116463
118083
  "group-commands",
116464
118084
  "group-status",
118085
+ "heat-pump-status",
116465
118086
  "heating-valve",
116466
118087
  "humidifier",
116467
118088
  "humidity-sensor",
@@ -117595,6 +119216,81 @@ var METHOD_DEVICE_SELECTORS = Object.freeze({
117595
119216
  form: "single",
117596
119217
  optional: false
117597
119218
  }],
119219
+ "heatPumpControl.setAdditionalHeaterMode": [{
119220
+ name: "deviceId",
119221
+ form: "single",
119222
+ optional: false
119223
+ }],
119224
+ "heatPumpControl.setAwayMode": [{
119225
+ name: "deviceId",
119226
+ form: "single",
119227
+ optional: false
119228
+ }],
119229
+ "heatPumpControl.setCircuitComfortSetpoint": [{
119230
+ name: "deviceId",
119231
+ form: "single",
119232
+ optional: false
119233
+ }],
119234
+ "heatPumpControl.setCircuitEcoSetpoint": [{
119235
+ name: "deviceId",
119236
+ form: "single",
119237
+ optional: false
119238
+ }],
119239
+ "heatPumpControl.setCircuitHeatCoolMode": [{
119240
+ name: "deviceId",
119241
+ form: "single",
119242
+ optional: false
119243
+ }],
119244
+ "heatPumpControl.setCircuitMaxFlowTemp": [{
119245
+ name: "deviceId",
119246
+ form: "single",
119247
+ optional: false
119248
+ }],
119249
+ "heatPumpControl.setCircuitOperationMode": [{
119250
+ name: "deviceId",
119251
+ form: "single",
119252
+ optional: false
119253
+ }],
119254
+ "heatPumpControl.setCircuitSummerWinter": [{
119255
+ name: "deviceId",
119256
+ form: "single",
119257
+ optional: false
119258
+ }],
119259
+ "heatPumpControl.setDhwChargeDuration": [{
119260
+ name: "deviceId",
119261
+ form: "single",
119262
+ optional: false
119263
+ }],
119264
+ "heatPumpControl.setDhwOperationMode": [{
119265
+ name: "deviceId",
119266
+ form: "single",
119267
+ optional: false
119268
+ }],
119269
+ "heatPumpControl.setDhwTemperatureLevel": [{
119270
+ name: "deviceId",
119271
+ form: "single",
119272
+ optional: false
119273
+ }],
119274
+ "heatPumpControl.setHolidayMode": [{
119275
+ name: "deviceId",
119276
+ form: "single",
119277
+ optional: false
119278
+ }],
119279
+ "heatPumpControl.setSilentMode": [{
119280
+ name: "deviceId",
119281
+ form: "single",
119282
+ optional: false
119283
+ }],
119284
+ "heatPumpControl.startExtraHotWater": [{
119285
+ name: "deviceId",
119286
+ form: "single",
119287
+ optional: false
119288
+ }],
119289
+ "heatPumpStatus.getStatus": [{
119290
+ name: "deviceId",
119291
+ form: "single",
119292
+ optional: false
119293
+ }],
117598
119294
  "heroLayout.getHeroModel": [{
117599
119295
  name: "deviceId",
117600
119296
  form: "single",
@@ -119786,7 +121482,7 @@ function getCapsByProviderKind(kind) {
119786
121482
  //#region src/generated/runtime-state-durability.ts
119787
121483
  /**
119788
121484
  * Per-cap runtime-state policy, projected from every `*.cap.ts` that declares
119789
- * `runtimeState`. 81 caps: 41 `restored`, 40 `session`.
121485
+ * `runtimeState`. 82 caps: 41 `restored`, 41 `session`.
119790
121486
  *
119791
121487
  * A cap absent from this map has no runtime-state slice at all. A cap PRESENT
119792
121488
  * with `durability: 'session'` has one and has decided not to keep it.
@@ -119921,6 +121617,10 @@ var RUNTIME_STATE_POLICY = {
119921
121617
  durability: "session",
119922
121618
  volatileFields: []
119923
121619
  },
121620
+ "heat-pump-status": {
121621
+ durability: "session",
121622
+ volatileFields: ["lastFetchedAt"]
121623
+ },
119924
121624
  "heating-valve": {
119925
121625
  durability: "session",
119926
121626
  volatileFields: ["lastFetchedAt"]
@@ -120941,6 +122641,8 @@ function createSystemProxy(api) {
120941
122641
  registerDevice: (input) => dispatch("deviceManager", "registerDevice", "mutation", input),
120942
122642
  removeDevice: (input) => dispatch("deviceManager", "removeDevice", "mutation", input),
120943
122643
  persistConfig: (input) => dispatch("deviceManager", "persistConfig", "mutation", input),
122644
+ renderDeviceTemplates: (input) => dispatch("deviceManager", "renderDeviceTemplates", "query", input),
122645
+ checkDeviceTemplates: (input) => dispatch("deviceManager", "checkDeviceTemplates", "query", input),
120944
122646
  getRoleDisplayDefaults: (input) => dispatch("deviceManager", "getRoleDisplayDefaults", "query", input),
120945
122647
  setRoleDisplayDefaults: (input) => dispatch("deviceManager", "setRoleDisplayDefaults", "mutation", input),
120946
122648
  listLocations: (input) => dispatch("deviceManager", "listLocations", "query", input),
@@ -133789,6 +135491,8 @@ exports.DEVICE_TEMPLATE_BUDGET_MS = DEVICE_TEMPLATE_BUDGET_MS;
133789
135491
  exports.DEVICE_TEMPLATE_FILTERS = DEVICE_TEMPLATE_FILTERS;
133790
135492
  exports.DEVICE_TEMPLATE_MAX_LENGTH = DEVICE_TEMPLATE_MAX_LENGTH;
133791
135493
  exports.DEVICE_TEMPLATE_MAX_OUTPUT = DEVICE_TEMPLATE_MAX_OUTPUT;
135494
+ exports.DEVICE_TEMPLATE_REFUSAL_REASONS = DEVICE_TEMPLATE_REFUSAL_REASONS;
135495
+ exports.DEVICE_TEMPLATE_TRACE_REASONS = DEVICE_TEMPLATE_TRACE_REASONS;
133792
135496
  exports.DEVICE_TEMPLATE_UNAVAILABLE = DEVICE_TEMPLATE_UNAVAILABLE;
133793
135497
  exports.DEVICE_TOMBSTONE_RETENTION_MS = DEVICE_TOMBSTONE_RETENTION_MS;
133794
135498
  exports.DEVICE_TRANSITIONS_MAX_PAGE = DEVICE_TRANSITIONS_MAX_PAGE;
@@ -133880,7 +135584,10 @@ exports.DeviceRuntimeState = DeviceRuntimeState;
133880
135584
  exports.DeviceSelectorSchema = DeviceSelectorSchema;
133881
135585
  exports.DeviceSignaturePurposeSchema = DeviceSignaturePurposeSchema;
133882
135586
  exports.DeviceStatusSchema = DeviceStatusSchema;
135587
+ exports.DeviceTemplateRefusalSchema = DeviceTemplateRefusalSchema;
135588
+ exports.DeviceTemplateRenderSchema = DeviceTemplateRenderSchema;
133883
135589
  exports.DeviceTemplateSchema = DeviceTemplateSchema;
135590
+ exports.DeviceTemplateTraceEntrySchema = DeviceTemplateTraceEntrySchema;
133884
135591
  exports.DeviceTombstoneSchema = DeviceTombstoneSchema;
133885
135592
  exports.DeviceTransitionSchema = require_sleep.DeviceTransitionSchema;
133886
135593
  exports.DeviceType = require_device_type.DeviceType;
@@ -134095,6 +135802,7 @@ exports.HAP_AUDIO_BASE = HAP_AUDIO_BASE;
134095
135802
  exports.HAP_AUDIO_BITRATE_KBPS = HAP_AUDIO_BITRATE_KBPS;
134096
135803
  exports.HAP_AUDIO_VBV_KBITS = HAP_AUDIO_VBV_KBITS;
134097
135804
  exports.HAP_KEYFRAME_INTERVAL_SEC = HAP_KEYFRAME_INTERVAL_SEC;
135805
+ exports.HEAT_PUMP_CIRCUIT_KINDS = HEAT_PUMP_CIRCUIT_KINDS;
134098
135806
  exports.HERO_ANIMATIONS = HERO_ANIMATIONS;
134099
135807
  exports.HERO_BACKGROUNDS = HERO_BACKGROUNDS;
134100
135808
  exports.HERO_CAP_CONTRIBUTIONS = HERO_CAP_CONTRIBUTIONS;
@@ -134105,6 +135813,7 @@ exports.HERO_LOOK_BY_ROLE = HERO_LOOK_BY_ROLE;
134105
135813
  exports.HERO_LOOK_BY_TYPE = HERO_LOOK_BY_TYPE;
134106
135814
  exports.HERO_LOOK_DEFAULT = HERO_LOOK_DEFAULT;
134107
135815
  exports.HERO_ROW_IDS = HERO_ROW_IDS;
135816
+ exports.HERO_ROW_LABELS = HERO_ROW_LABELS;
134108
135817
  exports.HERO_ROW_MODELS_MAX = HERO_ROW_MODELS_MAX;
134109
135818
  exports.HERO_SCENES = HERO_SCENES;
134110
135819
  exports.HERO_SCENE_BY_ROLE = HERO_SCENE_BY_ROLE;
@@ -134134,6 +135843,15 @@ exports.HUB_VIEWER_MOUNT = HUB_VIEWER_MOUNT;
134134
135843
  exports.HWACCEL_OPTIONS = HWACCEL_OPTIONS;
134135
135844
  exports.HardwareClassIdSchema = HardwareClassIdSchema;
134136
135845
  exports.HealthStatusSchema = HealthStatusSchema;
135846
+ exports.HeatPumpCircuitKindSchema = HeatPumpCircuitKindSchema;
135847
+ exports.HeatPumpCircuitSchema = HeatPumpCircuitSchema;
135848
+ exports.HeatPumpEnergySchema = HeatPumpEnergySchema;
135849
+ exports.HeatPumpOptionSettingSchema = HeatPumpOptionSettingSchema;
135850
+ exports.HeatPumpPowerSchema = HeatPumpPowerSchema;
135851
+ exports.HeatPumpRangeSettingSchema = HeatPumpRangeSettingSchema;
135852
+ exports.HeatPumpStatusSchema = HeatPumpStatusSchema;
135853
+ exports.HeatPumpSystemSchema = HeatPumpSystemSchema;
135854
+ exports.HeatPumpTemperaturesSchema = HeatPumpTemperaturesSchema;
134137
135855
  exports.HeatingValveStatusSchema = HeatingValveStatusSchema;
134138
135856
  exports.HelperMemberSchema = require_composition.HelperMemberSchema;
134139
135857
  exports.HelperSpecSchema = require_composition.HelperSpecSchema;
@@ -135372,6 +137090,7 @@ exports.StationarySubjectSchema = StationarySubjectSchema;
135372
137090
  exports.StatisticHelperSpecSchema = require_composition.StatisticHelperSpecSchema;
135373
137091
  exports.StatisticWindowSchema = require_composition.StatisticWindowSchema;
135374
137092
  exports.StepDeviceTraceSchema = StepDeviceTraceSchema;
137093
+ exports.StepTemplateError = StepTemplateError;
135375
137094
  exports.StorageAbortUploadInputSchema = AbortUploadInputSchema;
135376
137095
  exports.StorageAccessSchema = StorageAccessSchema;
135377
137096
  exports.StorageBeginDownloadInputSchema = BeginDownloadInputSchema;
@@ -135821,6 +137540,7 @@ exports.capabilityScopesOf = capabilityScopesOf;
135821
137540
  exports.capacityForModel = capacityForModel;
135822
137541
  exports.capacitySessionsOf = capacitySessionsOf;
135823
137542
  exports.carbonMonoxideCapability = carbonMonoxideCapability;
137543
+ exports.carriesDeviceTemplate = carriesDeviceTemplate;
135824
137544
  exports.catalogueIssues = catalogueIssues;
135825
137545
  exports.cellsToRects = cellsToRects;
135826
137546
  exports.checkDeviceAlias = checkDeviceAlias;
@@ -135854,6 +137574,7 @@ exports.clusterModelSettingKey = clusterModelSettingKey;
135854
137574
  exports.clusterStepSettingFieldsFor = clusterStepSettingFieldsFor;
135855
137575
  exports.clusterStepSettingKey = clusterStepSettingKey;
135856
137576
  exports.codecIsAccepted = codecIsAccepted;
137577
+ exports.collectDeviceTemplates = collectDeviceTemplates;
135857
137578
  exports.collectHydratedFieldEntries = require_sleep.collectHydratedFieldEntries;
135858
137579
  exports.collectHydratedFieldValues = require_sleep.collectHydratedFieldValues;
135859
137580
  exports.collectKeychainStoredKeys = require_sleep.collectKeychainStoredKeys;
@@ -136086,6 +137807,7 @@ exports.evaluateSensorLevelEdge = require_composition.evaluateSensorLevelEdge;
136086
137807
  exports.evaluateStatefulExpressionCall = require_composition.evaluateStatefulExpressionCall;
136087
137808
  exports.evaluateStationaryTrigger = evaluateStationaryTrigger;
136088
137809
  exports.evaluateStatistic = require_composition.evaluateStatistic;
137810
+ exports.evaluateStepCondition = evaluateStepCondition;
136089
137811
  exports.evaluateWhenTree = evaluateWhenTree;
136090
137812
  exports.evaluateZoneRules = evaluateZoneRules;
136091
137813
  exports.event = require_sleep.event;
@@ -136186,9 +137908,13 @@ exports.hasModelBoundOverrides = hasModelBoundOverrides;
136186
137908
  exports.hasMotionTrigger = hasMotionTrigger;
136187
137909
  exports.hasOwnRunningPowerDefaults = hasOwnRunningPowerDefaults;
136188
137910
  exports.hasUrlScheme = hasUrlScheme;
137911
+ exports.heatPumpControlCapability = heatPumpControlCapability;
137912
+ exports.heatPumpInstantCop = heatPumpInstantCop;
137913
+ exports.heatPumpStatusCapability = heatPumpStatusCapability;
136189
137914
  exports.heatingValveCapability = heatingValveCapability;
136190
137915
  exports.helperMembers = require_composition.helperMembers;
136191
137916
  exports.helperSaveProblems = helperSaveProblems;
137917
+ exports.heroArgsWithValue = heroArgsWithValue;
136192
137918
  exports.heroLayoutCapability = heroLayoutCapability;
136193
137919
  exports.heroText = require_sleep.t;
136194
137920
  exports.hfModelUrl = require_sleep.hfModelUrl;
@@ -136726,6 +138452,7 @@ exports.resolveSecretMarkers = require_sleep.resolveSecretMarkers;
136726
138452
  exports.resolveSecretViewsIn = require_sleep.resolveSecretViewsIn;
136727
138453
  exports.resolveServerName = resolveServerName;
136728
138454
  exports.resolveStepArgs = resolveStepArgs;
138455
+ exports.resolveStepArgsWithTemplates = resolveStepArgsWithTemplates;
136729
138456
  exports.resolveStreamMaps = require_composition.resolveStreamMaps;
136730
138457
  exports.resolveTemplateRef = resolveTemplateRef;
136731
138458
  exports.resolveVariantModelId = resolveVariantModelId;
@@ -136951,6 +138678,7 @@ exports.timedRunCapability = timedRunCapability;
136951
138678
  exports.timedRunLimitOf = timedRunLimitOf;
136952
138679
  exports.timedRunMaxIn = timedRunMaxIn;
136953
138680
  exports.timedRunQuickRun = timedRunQuickRun;
138681
+ exports.timedRunRemaining = timedRunRemaining;
136954
138682
  exports.timedRunSeconds = timedRunSeconds;
136955
138683
  exports.toAppLinkHubOrigin = toAppLinkHubOrigin;
136956
138684
  exports.toDeviceSummary = toDeviceSummary;