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