@camstack/addon-provider-homematic 1.2.199 → 1.2.200

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (18) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/_stub.js +2 -2
  3. package/dist/{_virtual_mf-localSharedImportMap___mfe_internal__addon_provider_homematic_page-DDcL1t5T.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_provider_homematic_page-qmc1Dkr5.mjs} +4 -4
  4. package/dist/_virtual_mf___mfe_internal__addon_provider_homematic_page__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-DELdD34C.mjs +26 -0
  5. package/dist/addon-provider-homematic.css +1 -1
  6. package/dist/addon.js +370 -175
  7. package/dist/addon.mjs +370 -175
  8. package/dist/{hostInit-C0MhIUdL.mjs → hostInit-DD3ofn9q.mjs} +3 -3
  9. package/dist/remoteEntry.js +1 -1
  10. package/dist/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__addon_provider_homematic_page__remoteEntry_js-DKU9EFsI.mjs → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__addon_provider_homematic_page__remoteEntry_js-C1yOQF9B.mjs} +1 -1
  11. package/dist/widgets/_stub.js +1 -1
  12. package/dist/widgets/{_virtual_mf-localSharedImportMap___mfe_internal__addon_provider_homematic_widgets-BZgCnc-f.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_provider_homematic_widgets-BIJK_-Yo.mjs} +2 -2
  13. package/dist/widgets/_virtual_mf___mfe_internal__addon_provider_homematic_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-CcB6r27y.mjs +26 -0
  14. package/dist/widgets/{hostInit-Chcfw46X.mjs → hostInit-B6-zj1pa.mjs} +2 -2
  15. package/dist/widgets/remoteEntry.js +1 -1
  16. package/package.json +3 -3
  17. package/dist/_virtual_mf___mfe_internal__addon_provider_homematic_page__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-JVtI9IQh.mjs +0 -26
  18. package/dist/widgets/_virtual_mf___mfe_internal__addon_provider_homematic_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-BEMWyRfG.mjs +0 -26
package/dist/addon.js CHANGED
@@ -47972,69 +47972,6 @@ function eventTypesOfVocabulary(vocabulary) {
47972
47972
  function findVocabularyEntry(vocabulary, eventType, sourceId) {
47973
47973
  return vocabulary.find((entry) => entry.id === eventType && entry.source?.id === sourceId);
47974
47974
  }
47975
- /**
47976
- * The link an automation made FROM a template carries (#527): which template,
47977
- * the values the operator filled in, and — when the template has since changed
47978
- * so that those values no longer fit — the problems that say why.
47979
- *
47980
- * It lives inside the recipe (`AutomationRecipe.template`), so the one row in
47981
- * `core_blocks` stays the one artefact: there is no second store of instances
47982
- * to drift from the blocks, and deleting the automation deletes the link.
47983
- * "Convert to a free automation" is dropping this field.
47984
- *
47985
- * This file depends on nothing in `recipe.ts`, so the recipe can embed it and
47986
- * the template engine (`template/automation-template.ts`) can import both.
47987
- */
47988
- /** An `event` input's value: the same three narrowing lists a `device-fired` row takes. */
47989
- var TemplateEventValueSchema = object({
47990
- eventIds: array(string().min(1)).min(1).max(64).optional(),
47991
- sourceIds: array(string().min(1)).min(1).max(64).optional(),
47992
- kinds: array(EventVocabularyKindSchema).min(1).optional()
47993
- }).refine((value) => value.eventIds !== void 0 || value.sourceIds !== void 0 || value.kinds !== void 0, { message: "an event names at least one event, part or kind" });
47994
- /** An `action` input's value: a vocabulary action and its open args. */
47995
- var TemplateActionValueSchema = object({
47996
- actionId: string().min(1),
47997
- args: record$1(string(), unknown()).optional()
47998
- });
47999
- /** The value of one non-group input. Which member is right is the input kind's to judge. */
48000
- var TemplateScalarValueSchema = union([
48001
- number$1(),
48002
- string(),
48003
- boolean(),
48004
- array(number$1().int().nonnegative()),
48005
- TemplateEventValueSchema,
48006
- TemplateActionValueSchema
48007
- ]);
48008
- var TemplateInputValueSchema = union([TemplateScalarValueSchema, array(record$1(string(), TemplateScalarValueSchema))]);
48009
- /** Input key → value. */
48010
- var TemplateInputValuesSchema = record$1(string(), TemplateInputValueSchema);
48011
- var TemplateInstanceProblemSchema = object({
48012
- code: _enum([
48013
- "missing-input",
48014
- "invalid-input",
48015
- "invalid-recipe",
48016
- "missing-template",
48017
- "edited-by-hand"
48018
- ]),
48019
- /** Dotted input address (`buttons.2.targets`); absent for a whole-recipe problem. */
48020
- input: string().optional(),
48021
- detail: string()
48022
- });
48023
- var AutomationTemplateLinkSchema = object({
48024
- templateId: string().min(1),
48025
- values: TemplateInputValuesSchema,
48026
- /**
48027
- * Fingerprint of the generated code with this literal blanked
48028
- * (`instanceCodeHash`), stamped by `generateAutomationBlock`. Code that no
48029
- * longer matches it was edited by hand, and is never regenerated over.
48030
- */
48031
- codeHash: string().optional(),
48032
- /**
48033
- * Present when the last re-expansion refused these values. The automation
48034
- * keeps running the body of its last good expansion; nothing is dropped.
48035
- */
48036
- problems: array(TemplateInstanceProblemSchema).min(1).optional()
48037
- });
48038
47975
  var ExpressionBindingSourceSchema = union([
48039
47976
  object({
48040
47977
  kind: literal("field").optional(),
@@ -48070,6 +48007,58 @@ object({
48070
48007
  path: ["expr"]
48071
48008
  });
48072
48009
  });
48010
+ Math.PI / 180;
48011
+ /**
48012
+ * WHEN something happens, as data (D983) — the one time vocabulary of the
48013
+ * scheduler and of an automation's schedule leaf. Three shapes, no cron:
48014
+ *
48015
+ * - `clock` — a wall-clock time every day (`07:30`), read in the site's zone;
48016
+ * - `sun` — a sun event (`sunrise`, `sunset`, `dawn`, `dusk`) plus or minus
48017
+ * up to twelve hours, from the site's coordinates;
48018
+ * - `date` — one local date and time (`2026-12-24T18:00`), once.
48019
+ *
48020
+ * A site is a place and its IANA zone ({@link TimeSite}). Every function here
48021
+ * is pure: the zone arithmetic uses `Intl`, no date library.
48022
+ *
48023
+ * Wall-clock honesty across a DST change: a local time that does not exist
48024
+ * (02:30 on the spring-forward day) happens at the first minute that does
48025
+ * (03:00); one that happens twice (02:30 on the fall-back day) happens at its
48026
+ * FIRST occurrence.
48027
+ */
48028
+ var SunEventSchema = _enum([
48029
+ "sunrise",
48030
+ "sunset",
48031
+ "dawn",
48032
+ "dusk"
48033
+ ]);
48034
+ var TimeSpecSchema = discriminatedUnion("kind", [
48035
+ object({
48036
+ kind: literal("clock"),
48037
+ hh: number$1().int().min(0).max(23),
48038
+ mm: number$1().int().min(0).max(59)
48039
+ }),
48040
+ object({
48041
+ kind: literal("sun"),
48042
+ event: SunEventSchema,
48043
+ /** Minutes after the event (negative: before). */
48044
+ offsetMin: number$1().int().min(-720).max(720)
48045
+ }),
48046
+ object({
48047
+ kind: literal("date"),
48048
+ /** `YYYY-MM-DDTHH:mm`, site-local. */
48049
+ local: string().regex(/^(\d{4}-\d{2}-\d{2})T([01]\d|2[0-3]):([0-5]\d)$/, "expected YYYY-MM-DDTHH:mm")
48050
+ })
48051
+ ]);
48052
+ /** A day of the week as a schedule names it. */
48053
+ var WeekdayKeySchema = _enum([
48054
+ "mon",
48055
+ "tue",
48056
+ "wed",
48057
+ "thu",
48058
+ "fri",
48059
+ "sat",
48060
+ "sun"
48061
+ ]);
48073
48062
  /**
48074
48063
  * Identity envelope for a device's upstream-system metadata.
48075
48064
  *
@@ -48462,58 +48451,6 @@ function macroOnly(macro) {
48462
48451
  };
48463
48452
  }
48464
48453
  }
48465
- Math.PI / 180;
48466
- /**
48467
- * WHEN something happens, as data (D983) — the one time vocabulary of the
48468
- * scheduler and of an automation's schedule leaf. Three shapes, no cron:
48469
- *
48470
- * - `clock` — a wall-clock time every day (`07:30`), read in the site's zone;
48471
- * - `sun` — a sun event (`sunrise`, `sunset`, `dawn`, `dusk`) plus or minus
48472
- * up to twelve hours, from the site's coordinates;
48473
- * - `date` — one local date and time (`2026-12-24T18:00`), once.
48474
- *
48475
- * A site is a place and its IANA zone ({@link TimeSite}). Every function here
48476
- * is pure: the zone arithmetic uses `Intl`, no date library.
48477
- *
48478
- * Wall-clock honesty across a DST change: a local time that does not exist
48479
- * (02:30 on the spring-forward day) happens at the first minute that does
48480
- * (03:00); one that happens twice (02:30 on the fall-back day) happens at its
48481
- * FIRST occurrence.
48482
- */
48483
- var SunEventSchema = _enum([
48484
- "sunrise",
48485
- "sunset",
48486
- "dawn",
48487
- "dusk"
48488
- ]);
48489
- var TimeSpecSchema = discriminatedUnion("kind", [
48490
- object({
48491
- kind: literal("clock"),
48492
- hh: number$1().int().min(0).max(23),
48493
- mm: number$1().int().min(0).max(59)
48494
- }),
48495
- object({
48496
- kind: literal("sun"),
48497
- event: SunEventSchema,
48498
- /** Minutes after the event (negative: before). */
48499
- offsetMin: number$1().int().min(-720).max(720)
48500
- }),
48501
- object({
48502
- kind: literal("date"),
48503
- /** `YYYY-MM-DDTHH:mm`, site-local. */
48504
- local: string().regex(/^(\d{4}-\d{2}-\d{2})T([01]\d|2[0-3]):([0-5]\d)$/, "expected YYYY-MM-DDTHH:mm")
48505
- })
48506
- ]);
48507
- /** A day of the week as a schedule names it. */
48508
- var WeekdayKeySchema = _enum([
48509
- "mon",
48510
- "tue",
48511
- "wed",
48512
- "thu",
48513
- "fri",
48514
- "sat",
48515
- "sun"
48516
- ]);
48517
48454
  /**
48518
48455
  * Hold semantics — "for N seconds" on a leaf of the `when` tree (#498).
48519
48456
  *
@@ -48770,24 +48707,33 @@ var StationaryPresentLeafSchema = object({
48770
48707
  * (`kind: 'date'`) is refused: only a clock time or a sun event makes a window
48771
48708
  * that repeats every day.
48772
48709
  */
48773
- var TimeIsLeafSchema = object({
48774
- kind: literal("time-is"),
48710
+ var timeIsWindowShape = {
48775
48711
  between: object({
48776
48712
  from: TimeSpecSchema,
48777
48713
  to: TimeSpecSchema
48778
48714
  }).optional(),
48779
48715
  days: array(WeekdayKeySchema).min(1).max(7).optional()
48780
- }).superRefine((leaf, ctx) => {
48781
- if (leaf.between === void 0 && leaf.days === void 0) ctx.addIssue({
48716
+ };
48717
+ function timeIsWindowProblems(window, ctx) {
48718
+ if (window.between === void 0 && window.days === void 0) ctx.addIssue({
48782
48719
  code: "custom",
48783
48720
  message: "a time-is leaf needs a between window, days, or both"
48784
48721
  });
48785
- for (const end of ["from", "to"]) if (leaf.between?.[end].kind === "date") ctx.addIssue({
48722
+ for (const end of ["from", "to"]) if (window.between?.[end].kind === "date") ctx.addIssue({
48786
48723
  code: "custom",
48787
48724
  message: "a one-date time cannot bound a daily window: use a clock time or a sun event",
48788
48725
  path: ["between", end]
48789
48726
  });
48790
- });
48727
+ }
48728
+ /**
48729
+ * What a `time-is` leaf holds beside its kind, judged by the leaf's own rules.
48730
+ * A template's time-window input stores exactly this.
48731
+ */
48732
+ var TimeIsWindowSchema = object(timeIsWindowShape).superRefine(timeIsWindowProblems);
48733
+ var TimeIsLeafSchema = object({
48734
+ kind: literal("time-is"),
48735
+ ...timeIsWindowShape
48736
+ }).superRefine(timeIsWindowProblems);
48791
48737
  /**
48792
48738
  * True for the run that one of the named event leaves started. It reads the
48793
48739
  * run, not a device: in the tree it is judged against the leaf that fired, in
@@ -48995,6 +48941,79 @@ function validateWhenTree(when) {
48995
48941
  return null;
48996
48942
  }
48997
48943
  /**
48944
+ * The link an automation made FROM a template carries (#527): which template,
48945
+ * the values the operator filled in, and — when the template has since changed
48946
+ * so that those values no longer fit — the problems that say why.
48947
+ *
48948
+ * It lives inside the recipe (`AutomationRecipe.template`), so the one row in
48949
+ * `core_blocks` stays the one artefact: there is no second store of instances
48950
+ * to drift from the blocks, and deleting the automation deletes the link.
48951
+ * "Convert to a free automation" is dropping this field.
48952
+ *
48953
+ * This file depends on nothing in `recipe.ts`, so the recipe can embed it and
48954
+ * the template engine (`template/automation-template.ts`) can import both.
48955
+ */
48956
+ /** An `event` input's value: the same three narrowing lists a `device-fired` row takes. */
48957
+ var TemplateEventValueSchema = object({
48958
+ eventIds: array(string().min(1)).min(1).max(64).optional(),
48959
+ sourceIds: array(string().min(1)).min(1).max(64).optional(),
48960
+ kinds: array(EventVocabularyKindSchema).min(1).optional()
48961
+ }).refine((value) => value.eventIds !== void 0 || value.sourceIds !== void 0 || value.kinds !== void 0, { message: "an event names at least one event, part or kind" });
48962
+ /** An `action` input's value: a vocabulary action and its open args. */
48963
+ var TemplateActionValueSchema = object({
48964
+ actionId: string().min(1),
48965
+ args: record$1(string(), unknown()).optional()
48966
+ });
48967
+ /**
48968
+ * A `time-window` input's value: what a `time-is` leaf holds beside its kind.
48969
+ * "No limit" is the input left without a value, never an empty object.
48970
+ */
48971
+ var TemplateTimeWindowValueSchema = TimeIsWindowSchema;
48972
+ var TemplateEntriesValueSchema = array(record$1(string(), unknown()));
48973
+ /** The value of one non-group input. Which member is right is the input kind's to judge. */
48974
+ var TemplateScalarValueSchema = union([
48975
+ number$1(),
48976
+ string(),
48977
+ boolean(),
48978
+ array(number$1().int().nonnegative()),
48979
+ TemplateEventValueSchema,
48980
+ TemplateActionValueSchema,
48981
+ TemplateTimeWindowValueSchema,
48982
+ TemplateEntriesValueSchema
48983
+ ]);
48984
+ /** What a group row holds under one key: a value, or the rows of a group it nests. */
48985
+ var TemplateRowValueSchema = union([TemplateScalarValueSchema, array(record$1(string(), TemplateScalarValueSchema))]);
48986
+ var TemplateInputValueSchema = union([TemplateScalarValueSchema, array(record$1(string(), TemplateRowValueSchema))]);
48987
+ /** Input key → value. */
48988
+ var TemplateInputValuesSchema = record$1(string(), TemplateInputValueSchema);
48989
+ var TemplateInstanceProblemSchema = object({
48990
+ code: _enum([
48991
+ "missing-input",
48992
+ "invalid-input",
48993
+ "invalid-recipe",
48994
+ "missing-template",
48995
+ "edited-by-hand"
48996
+ ]),
48997
+ /** Dotted input address (`buttons.2.targets`, `buttons.0.commands.1.targets`); absent for a whole-recipe problem. */
48998
+ input: string().optional(),
48999
+ detail: string()
49000
+ });
49001
+ var AutomationTemplateLinkSchema = object({
49002
+ templateId: string().min(1),
49003
+ values: TemplateInputValuesSchema,
49004
+ /**
49005
+ * Fingerprint of the generated code with this literal blanked
49006
+ * (`instanceCodeHash`), stamped by `generateAutomationBlock`. Code that no
49007
+ * longer matches it was edited by hand, and is never regenerated over.
49008
+ */
49009
+ codeHash: string().optional(),
49010
+ /**
49011
+ * Present when the last re-expansion refused these values. The automation
49012
+ * keeps running the body of its last good expansion; nothing is dropped.
49013
+ */
49014
+ problems: array(TemplateInstanceProblemSchema).min(1).optional()
49015
+ });
49016
+ /**
48998
49017
  * The recipe shape before the single `when` tree: a flat list of triggers
48999
49018
  * (OR'd, each an instant) and an optional condition tree. Stored recipes —
49000
49019
  * the `AUTOMATION_RECIPE` literal of every block saved so far, and whatever an
@@ -86232,7 +86251,10 @@ object({
86232
86251
  value: boolean(),
86233
86252
  at: number$1()
86234
86253
  }).nullable(),
86235
- /** The declared source last sent; unknown after a power off or a channel step. */
86254
+ /**
86255
+ * Retired: a sent source is never a state (an infrared set cannot report its
86256
+ * input). Kept only so records written before parse; nothing writes or reads it.
86257
+ */
86236
86258
  source: object({
86237
86259
  name: string(),
86238
86260
  at: number$1()
@@ -89861,31 +89883,57 @@ var TemplateSelectOptionSchema = object({
89861
89883
  value: string().min(1),
89862
89884
  label: string().min(1).max(80)
89863
89885
  });
89886
+ var SelectInputSchema = object({
89887
+ kind: literal("select"),
89888
+ ...inputBase,
89889
+ options: array(TemplateSelectOptionSchema).min(1).max(50),
89890
+ default: string().optional()
89891
+ });
89892
+ var BooleanInputSchema = object({
89893
+ kind: literal("boolean"),
89894
+ ...inputBase,
89895
+ default: boolean().optional()
89896
+ });
89897
+ /** A limit on when the automation may run; only a `gate` binding reads it. */
89898
+ var TimeWindowInputSchema = object({
89899
+ kind: literal("time-window"),
89900
+ ...inputBase
89901
+ });
89864
89902
  var TemplateScalarInputSchema = discriminatedUnion("kind", [
89903
+ object({
89904
+ kind: literal("entries"),
89905
+ ...inputBase,
89906
+ entry: _enum(["trigger", "step"]),
89907
+ allow: array(string().min(1)).min(1).max(10),
89908
+ maxItems: number$1().int().min(1).max(20).optional()
89909
+ }),
89865
89910
  DeviceInputSchema,
89866
89911
  EventInputSchema,
89867
89912
  ActionInputSchema$1,
89868
89913
  NumberInputSchema,
89869
89914
  DurationInputSchema,
89870
89915
  TextInputSchema,
89871
- object({
89872
- kind: literal("select"),
89873
- ...inputBase,
89874
- options: array(TemplateSelectOptionSchema).min(1).max(50),
89875
- default: string().optional()
89876
- }),
89877
- object({
89878
- kind: literal("boolean"),
89879
- ...inputBase,
89880
- default: boolean().optional()
89881
- })
89916
+ SelectInputSchema,
89917
+ BooleanInputSchema,
89918
+ TimeWindowInputSchema
89882
89919
  ]);
89883
- var GroupInputSchema = object({
89920
+ var groupBase = {
89884
89921
  kind: literal("group"),
89885
89922
  ...inputBase,
89886
- inputs: array(TemplateScalarInputSchema).min(1).max(10),
89923
+ /** What one row is, in the singular and lower case ("button"): "Add button". */
89924
+ rowLabel: string().min(1).max(40).optional(),
89887
89925
  minRows: number$1().int().min(0).max(20).optional(),
89888
89926
  maxRows: number$1().int().min(1).max(20).optional()
89927
+ };
89928
+ /** A group inside a group row: its rows hold values only, never another group. */
89929
+ var NestedGroupInputSchema = object({
89930
+ ...groupBase,
89931
+ inputs: array(TemplateScalarInputSchema).min(1).max(10)
89932
+ });
89933
+ var TemplateRowInputSchema = discriminatedUnion("kind", [...TemplateScalarInputSchema.options, NestedGroupInputSchema]);
89934
+ var GroupInputSchema = object({
89935
+ ...groupBase,
89936
+ inputs: array(TemplateRowInputSchema).min(1).max(10)
89889
89937
  });
89890
89938
  var TemplateInputSchema = discriminatedUnion("kind", [...TemplateScalarInputSchema.options, GroupInputSchema]);
89891
89939
  var TemplatePathSchema = array(union([string().min(1), number$1().int().nonnegative()])).max(24);
@@ -89896,41 +89944,154 @@ var TemplateValueBindingSchema = object({
89896
89944
  /** A device value written as a step target (`{ kind: 'devices', ids }`). */
89897
89945
  as: literal("target").optional()
89898
89946
  });
89899
- var TemplateRowItemBindingSchema = discriminatedUnion("kind", [TemplateValueBindingSchema, object({
89947
+ var TemplateRowIdBindingSchema = object({
89900
89948
  kind: literal("row-id"),
89901
89949
  path: TemplatePathSchema
89902
- })]);
89903
- var TemplateBindingSchema = discriminatedUnion("kind", [TemplateValueBindingSchema, object({
89904
- kind: literal("rows"),
89950
+ });
89951
+ /**
89952
+ * Appends an `entries` input's elements, verbatim, to the list at `path`. In a
89953
+ * row's bindings `input` is the row's own entries input and `path` is from the
89954
+ * row's item; at the top level, with `in`, it appends the `input` entries of
89955
+ * EVERY row of the group `in` (all buttons' triggers into one `when`), and
89956
+ * without `in` it appends a top-level entries input.
89957
+ */
89958
+ var TemplateEntriesBindingSchema = object({
89959
+ kind: literal("entries"),
89905
89960
  input: inputKey,
89906
- /** The list in the body the rows are appended to. */
89907
89961
  path: TemplatePathSchema,
89908
- /** The JSON copied once per row. */
89909
- item: unknown(),
89910
- bindings: array(TemplateRowItemBindingSchema).max(40)
89911
- })]);
89912
- function bindingProblems(payload, ctx) {
89913
- const byKey = /* @__PURE__ */ new Map();
89914
- payload.inputs.forEach((input, index) => {
89915
- if (byKey.has(input.key)) ctx.addIssue({
89916
- code: "custom",
89962
+ in: inputKey.optional()
89963
+ });
89964
+ /** What fills the item of a row that holds values only. */
89965
+ var TemplateLeafRowBindingSchema = discriminatedUnion("kind", [TemplateValueBindingSchema, TemplateRowIdBindingSchema]);
89966
+ var TemplateRowItemBindingSchema = discriminatedUnion("kind", [
89967
+ TemplateValueBindingSchema,
89968
+ TemplateEntriesBindingSchema,
89969
+ TemplateRowIdBindingSchema,
89970
+ object({
89971
+ kind: literal("row-ids"),
89972
+ /** The nested group whose rows are named. */
89973
+ input: inputKey,
89974
+ path: TemplatePathSchema
89975
+ }),
89976
+ object({
89977
+ kind: literal("rows"),
89978
+ /** The nested group, declared by the parent row's group. */
89979
+ input: inputKey,
89980
+ /** The list the nested rows are appended to, from the parent row's item. */
89981
+ path: TemplatePathSchema,
89982
+ item: unknown(),
89983
+ bindings: array(TemplateLeafRowBindingSchema).max(40)
89984
+ })
89985
+ ]);
89986
+ var TemplateBindingSchema = discriminatedUnion("kind", [
89987
+ TemplateValueBindingSchema,
89988
+ TemplateEntriesBindingSchema,
89989
+ object({
89990
+ kind: literal("rows"),
89991
+ input: inputKey,
89992
+ /**
89993
+ * A group the rows of `input` hold: the binding then appends one item per
89994
+ * NESTED row of every row, and its bindings read the nested row.
89995
+ */
89996
+ nested: inputKey.optional(),
89997
+ /** The list in the body the rows are appended to. */
89998
+ path: TemplatePathSchema,
89999
+ /** The JSON copied once per row. */
90000
+ item: unknown(),
90001
+ bindings: array(TemplateRowItemBindingSchema).max(40)
90002
+ }),
90003
+ object({
90004
+ kind: literal("gate"),
90005
+ /** A top-level `time-window` input. */
90006
+ input: inputKey,
90007
+ path: TemplatePathSchema
90008
+ })
90009
+ ]);
90010
+ /** Twice-declared keys and event / action inputs that read no device beside them. */
90011
+ function levelProblems(inputs, path, inRow = false) {
90012
+ const issues = [];
90013
+ const seen = /* @__PURE__ */ new Set();
90014
+ for (const input of inputs) {
90015
+ if (seen.has(input.key)) issues.push({
89917
90016
  message: `input "${input.key}" is declared twice`,
89918
- path: ["inputs", index]
90017
+ path
89919
90018
  });
89920
- byKey.set(input.key, input);
89921
- const siblings = input.kind === "group" ? input.inputs : payload.inputs;
89922
- for (const scalar of input.kind === "group" ? input.inputs : [input]) {
89923
- if (scalar.kind !== "event" && scalar.kind !== "action") continue;
89924
- if (scalar.deviceInput === void 0) continue;
89925
- const device = siblings.find((s) => s.key === scalar.deviceInput);
89926
- if (device === void 0 || device.kind !== "device") ctx.addIssue({
89927
- code: "custom",
89928
- message: `"${scalar.key}" reads the device input "${scalar.deviceInput}", which is not a device input beside it`,
89929
- path: ["inputs", index]
89930
- });
90019
+ seen.add(input.key);
90020
+ if (input.kind === "group") {
90021
+ issues.push(...levelProblems(input.inputs, path, true));
90022
+ continue;
89931
90023
  }
90024
+ if (input.kind === "time-window" && inRow) issues.push({
90025
+ message: `time window "${input.key}" limits the whole automation: it is not a row input`,
90026
+ path
90027
+ });
90028
+ if (input.kind !== "event" && input.kind !== "action") continue;
90029
+ if (input.deviceInput === void 0) continue;
90030
+ const device = inputs.find((sibling) => sibling.key === input.deviceInput);
90031
+ if (device === void 0 || device.kind !== "device") issues.push({
90032
+ message: `"${input.key}" reads the device input "${input.deviceInput}", which is not a device input beside it`,
90033
+ path
90034
+ });
90035
+ }
90036
+ return issues;
90037
+ }
90038
+ function nestedGroupOf(group, key) {
90039
+ const found = group.inputs.find((input) => input.key === key);
90040
+ return found !== void 0 && found.kind === "group" ? found : void 0;
90041
+ }
90042
+ function leafBindingProblems(bindings, owner) {
90043
+ const issues = [];
90044
+ for (const row of bindings) {
90045
+ if (row.kind === "row-id") continue;
90046
+ if (row.kind === "value") {
90047
+ const input = owner.inputs.find((i) => i.key === row.input);
90048
+ if (input === void 0) issues.push(`row binding names "${row.input}", which group "${owner.key}" does not declare`);
90049
+ else if (input.kind === "group") issues.push(`group "${input.key}" is bound with rows, not a value`);
90050
+ else if (input.kind === "entries") issues.push(`entries "${input.key}" are bound with entries, not a value`);
90051
+ continue;
90052
+ }
90053
+ const nested = owner.inputs.find((i) => i.key === row.input);
90054
+ if (row.kind === "entries") {
90055
+ if (nested === void 0 || nested.kind !== "entries") issues.push(`"${row.input}" is not an entries input inside "${owner.key}"`);
90056
+ continue;
90057
+ }
90058
+ if (row.kind === "row-ids") {
90059
+ if (nested === void 0 || nested.kind !== "group" && nested.kind !== "entries") issues.push(`"${row.input}" is not a group or entries input inside "${owner.key}"`);
90060
+ continue;
90061
+ }
90062
+ if (nested === void 0 || nested.kind !== "group") {
90063
+ issues.push(`"${row.input}" is not a group inside "${owner.key}"`);
90064
+ continue;
90065
+ }
90066
+ issues.push(...leafBindingProblems(row.bindings, nested));
90067
+ }
90068
+ return issues;
90069
+ }
90070
+ function rowsBindingProblems(binding, group) {
90071
+ if (binding.nested === void 0) return leafBindingProblems(binding.bindings, group);
90072
+ const nested = nestedGroupOf(group, binding.nested);
90073
+ if (nested === void 0) return [`"${binding.nested}" is not a group inside "${group.key}"`];
90074
+ return leafBindingProblems(binding.bindings, nested);
90075
+ }
90076
+ function bindingProblems(payload, ctx) {
90077
+ const byKey = /* @__PURE__ */ new Map();
90078
+ for (const input of payload.inputs) byKey.set(input.key, input);
90079
+ for (const issue of levelProblems(payload.inputs, ["inputs"])) ctx.addIssue({
90080
+ code: "custom",
90081
+ message: issue.message,
90082
+ path: [...issue.path]
89932
90083
  });
89933
90084
  payload.bindings.forEach((binding, index) => {
90085
+ if (binding.kind === "entries" && binding.in !== void 0) {
90086
+ const group = byKey.get(binding.in);
90087
+ const entries = group !== void 0 && group.kind === "group" ? group.inputs.find((i) => i.key === binding.input) : void 0;
90088
+ if (entries === void 0 || entries.kind !== "entries") ctx.addIssue({
90089
+ code: "custom",
90090
+ message: `"${binding.input}" is not an entries input inside the group "${binding.in}"`,
90091
+ path: ["bindings", index]
90092
+ });
90093
+ return;
90094
+ }
89934
90095
  const input = byKey.get(binding.input);
89935
90096
  if (input === void 0) {
89936
90097
  ctx.addIssue({
@@ -89945,6 +90106,18 @@ function bindingProblems(payload, ctx) {
89945
90106
  message: `group "${input.key}" is bound with rows, not a value`,
89946
90107
  path: ["bindings", index]
89947
90108
  });
90109
+ if (binding.kind === "entries" !== (input.kind === "entries") && binding.kind !== "rows") {
90110
+ if (binding.kind === "entries" || binding.kind === "value") ctx.addIssue({
90111
+ code: "custom",
90112
+ message: binding.kind === "entries" ? `entries bindings read an entries input: "${input.key}" is ${input.kind}` : `entries "${input.key}" are bound with entries, not a value`,
90113
+ path: ["bindings", index]
90114
+ });
90115
+ }
90116
+ if (binding.kind === "gate" !== (input.kind === "time-window")) ctx.addIssue({
90117
+ code: "custom",
90118
+ message: `a gate reads a time window and a time window is bound with a gate: "${input.key}" is ${input.kind}`,
90119
+ path: ["bindings", index]
90120
+ });
89948
90121
  if (binding.kind === "rows") {
89949
90122
  if (input.kind !== "group") {
89950
90123
  ctx.addIssue({
@@ -89954,9 +90127,9 @@ function bindingProblems(payload, ctx) {
89954
90127
  });
89955
90128
  return;
89956
90129
  }
89957
- for (const row of binding.bindings) if (row.kind === "value" && !input.inputs.some((i) => i.key === row.input)) ctx.addIssue({
90130
+ for (const message of rowsBindingProblems(binding, input)) ctx.addIssue({
89958
90131
  code: "custom",
89959
- message: `row binding names "${row.input}", which group "${input.key}" does not declare`,
90132
+ message,
89960
90133
  path: ["bindings", index]
89961
90134
  });
89962
90135
  }
@@ -140474,8 +140647,17 @@ var HmChildDevice = class extends BaseDevice {
140474
140647
  this.seedTriggerUnsubs = [];
140475
140648
  }
140476
140649
  };
140477
- function isHmOffSetpoint(target) {
140478
- return target !== null && target <= 4.5;
140650
+ //#endregion
140651
+ //#region src/homematic-decode.ts
140652
+ /** HmIP OFF is MANU with the CCU off temperature ({@link HM_OFF_SETPOINT_C}). */
140653
+ var HM_OFF_SETPOINT_C = 4.5;
140654
+ /**
140655
+ * Is `target` the off setpoint? OFF is the device's own minimum setpoint when
140656
+ * known (a HmIP-BWTH clamps the 4.5 write to its 5.0 minimum and reports 5),
140657
+ * {@link HM_OFF_SETPOINT_C} otherwise.
140658
+ */
140659
+ function isHmOffSetpoint(target, offSetpointC = HM_OFF_SETPOINT_C) {
140660
+ return target !== null && target <= offSetpointC;
140479
140661
  }
140480
140662
  /**
140481
140663
  * HmIP `SET_POINT_MODE` index → library climate mode.
@@ -140678,16 +140860,16 @@ function decodeLock(parameter, value, now) {
140678
140860
  * (current °C), HUMIDITY (%), SET_POINT_MODE (ENUM, readable mode),
140679
140861
  * BOOST_MODE (bool). `CONTROL_MODE` is write-only on HmIP and ignored here.
140680
140862
  */
140681
- function modeWithHmOffTarget(previous, target) {
140682
- if (isHmOffSetpoint(target)) return previous.mode === "auto" ? "auto" : "off";
140863
+ function modeWithHmOffTarget(previous, target, offSetpointC) {
140864
+ if (isHmOffSetpoint(target, offSetpointC)) return previous.mode === "auto" ? "auto" : "off";
140683
140865
  if (previous.mode === "off") return previous.lastActiveMode ?? "heat";
140684
140866
  return previous.mode;
140685
140867
  }
140686
- function decodeClimate(previous, parameter, value, now) {
140868
+ function decodeClimate(previous, parameter, value, now, offSetpointC = HM_OFF_SETPOINT_C) {
140687
140869
  if (parameter === "SET_POINT_TEMPERATURE" && typeof value === "number") return {
140688
140870
  ...previous,
140689
140871
  target: value,
140690
- mode: modeWithHmOffTarget(previous, value),
140872
+ mode: modeWithHmOffTarget(previous, value, offSetpointC),
140691
140873
  lastFetchedAt: now
140692
140874
  };
140693
140875
  if (parameter === "ACTUAL_TEMPERATURE" && typeof value === "number") return {
@@ -140703,7 +140885,7 @@ function decodeClimate(previous, parameter, value, now) {
140703
140885
  if (parameter === "SET_POINT_MODE") {
140704
140886
  const mode = fromHmSetPointMode(value);
140705
140887
  if (mode === null) return null;
140706
- const resolved = mode === "heat" && isHmOffSetpoint(previous.target) ? "off" : mode;
140888
+ const resolved = mode === "heat" && isHmOffSetpoint(previous.target, offSetpointC) ? "off" : mode;
140707
140889
  return {
140708
140890
  ...previous,
140709
140891
  mode: resolved,
@@ -140852,15 +141034,17 @@ var HmActuatorDevice = class extends HmChildDevice {
140852
141034
  const facade = this.requireFacade();
140853
141035
  const prev = this.runtimeState.getCapState("climate-control") ?? COLD_CLIMATE;
140854
141036
  const hmMode = toHmClimateMode(mode);
140855
- if (hmMode === "off" && prev.target !== null && prev.target > 4.5) this.climateRestoreTargetC = prev.target;
141037
+ const offC = this.climateOffSetpointC();
141038
+ if (hmMode === "off" && prev.target !== null && prev.target > offC) this.climateRestoreTargetC = prev.target;
140856
141039
  await facade.climateSetMode(this.address, channel, hmMode);
140857
- if (mode === "heat" && (prev.mode === "off" || isHmOffSetpoint(prev.target))) {
141040
+ if (hmMode === "off" && offC !== 4.5) await facade.climateSetTemperature(this.address, channel, offC);
141041
+ if (mode === "heat" && (prev.mode === "off" || isHmOffSetpoint(prev.target, offC))) {
140858
141042
  const restore = this.climateRestoreTargetC ?? 21;
140859
141043
  await facade.climateSetTemperature(this.address, channel, restore);
140860
141044
  }
140861
141045
  },
140862
141046
  setTarget: async ({ target }) => {
140863
- if (target > 4.5) this.climateRestoreTargetC = target;
141047
+ if (target > this.climateOffSetpointC()) this.climateRestoreTargetC = target;
140864
141048
  await this.requireFacade().climateSetTemperature(this.address, channel, target);
140865
141049
  },
140866
141050
  setPreset: async ({ preset }) => {
@@ -140877,6 +141061,15 @@ var HmActuatorDevice = class extends HmChildDevice {
140877
141061
  this.runtimeState.setCapState("climate-control", COLD_CLIMATE);
140878
141062
  this.registeredCap = "climate-control";
140879
141063
  }
141064
+ /**
141065
+ * The off setpoint of THIS thermostat: the entity's own minimum setpoint
141066
+ * (the library reads it from the SETPOINT datapoint metadata), else the
141067
+ * CCU default {@link HM_OFF_SETPOINT_C}.
141068
+ */
141069
+ climateOffSetpointC() {
141070
+ const entity = this.facade?.customEntities().find((e) => e.device === this.address && e.channel === this.actuatorChannel);
141071
+ return entity?.kind === "climate" ? entity.minTemp : HM_OFF_SETPOINT_C;
141072
+ }
140880
141073
  handleValueChanged(event, origin) {
140881
141074
  const now = event.ts || Date.now();
140882
141075
  const { parameter, value } = event;
@@ -140893,7 +141086,9 @@ var HmActuatorDevice = class extends HmChildDevice {
140893
141086
  if (cap === "cover") return this.applyCover(parameter, value, now, origin);
140894
141087
  if (cap === "lock-control") return this.applyLock(parameter, value, now, origin);
140895
141088
  if (cap === "climate-control") {
140896
- const next = decodeClimate(this.runtimeState.getCapState("climate-control") ?? COLD_CLIMATE, parameter, value, now);
141089
+ const prev = this.runtimeState.getCapState("climate-control") ?? COLD_CLIMATE;
141090
+ const offC = this.climateOffSetpointC();
141091
+ const next = decodeClimate(prev, parameter, value, now, offC);
140897
141092
  if (next === null && parameter === "SET_POINT_MODE") this.ctx.logger.debug("Homematic climate: SET_POINT_MODE unknown — mode unchanged", {
140898
141093
  tags: { deviceId: this.id },
140899
141094
  meta: {
@@ -140902,7 +141097,7 @@ var HmActuatorDevice = class extends HmChildDevice {
140902
141097
  }
140903
141098
  });
140904
141099
  if (next) {
140905
- if (next.target !== null && next.target > 4.5) this.climateRestoreTargetC = next.target;
141100
+ if (next.target !== null && next.target > offC) this.climateRestoreTargetC = next.target;
140906
141101
  this.runtimeState.setCapState("climate-control", next);
140907
141102
  }
140908
141103
  }