@camstack/addon-provider-homematic 1.2.190 → 1.2.192
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/dist/_stub.js +2 -2
- package/dist/{_virtual_mf-localSharedImportMap___mfe_internal__addon_provider_homematic_page-Q5yqYY2a.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_provider_homematic_page-DpkPuRM1.mjs} +4 -4
- package/dist/_virtual_mf___mfe_internal__addon_provider_homematic_page__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-vLxa-QXn.mjs +26 -0
- package/dist/addon-provider-homematic.css +1 -1
- package/dist/addon.js +770 -98
- package/dist/addon.mjs +770 -98
- package/dist/{hostInit-CUN01TKv.mjs → hostInit-DnCa060J.mjs} +3 -3
- package/dist/remoteEntry.js +1 -1
- package/dist/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__addon_provider_homematic_page__remoteEntry_js-BlhMmAz5.mjs → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__addon_provider_homematic_page__remoteEntry_js-BJyaKTxj.mjs} +1 -1
- package/package.json +3 -3
- package/dist/_virtual_mf___mfe_internal__addon_provider_homematic_page__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-CjAB6Xz2.mjs +0 -26
package/dist/addon.mjs
CHANGED
|
@@ -6054,7 +6054,7 @@ var ZodIssueCode = {
|
|
|
6054
6054
|
var ZodFirstPartyTypeKind;
|
|
6055
6055
|
ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
|
|
6056
6056
|
//#endregion
|
|
6057
|
-
//#region ../types/dist/sleep-
|
|
6057
|
+
//#region ../types/dist/sleep-D0roI_CZ.mjs
|
|
6058
6058
|
/**
|
|
6059
6059
|
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
6060
6060
|
* window to float samples (D455).
|
|
@@ -16209,6 +16209,10 @@ Object.freeze({
|
|
|
16209
16209
|
"path": "lastEvent.eventType",
|
|
16210
16210
|
"valueType": "string"
|
|
16211
16211
|
},
|
|
16212
|
+
{
|
|
16213
|
+
"path": "lastEvent.sourceId",
|
|
16214
|
+
"valueType": "string"
|
|
16215
|
+
},
|
|
16212
16216
|
{
|
|
16213
16217
|
"path": "lastEvent.timestamp",
|
|
16214
16218
|
"valueType": "number"
|
|
@@ -44079,6 +44083,59 @@ function macroOnly(macro) {
|
|
|
44079
44083
|
};
|
|
44080
44084
|
}
|
|
44081
44085
|
}
|
|
44086
|
+
var EventVocabularyKindSchema = _enum([
|
|
44087
|
+
"press",
|
|
44088
|
+
"long-press",
|
|
44089
|
+
"long-press-start",
|
|
44090
|
+
"release",
|
|
44091
|
+
"repeat",
|
|
44092
|
+
"double-press",
|
|
44093
|
+
"other"
|
|
44094
|
+
]);
|
|
44095
|
+
/** The part of the device an event comes from: a button, a channel. */
|
|
44096
|
+
var EventVocabularySourceSchema = object({
|
|
44097
|
+
id: string().min(1),
|
|
44098
|
+
label: string().min(1)
|
|
44099
|
+
});
|
|
44100
|
+
/** One scalar field of an event's `data`, by dotted path. */
|
|
44101
|
+
var EventVocabularyFieldSchema = object({
|
|
44102
|
+
path: string().min(1),
|
|
44103
|
+
kind: _enum([
|
|
44104
|
+
"string",
|
|
44105
|
+
"number",
|
|
44106
|
+
"boolean",
|
|
44107
|
+
"enum"
|
|
44108
|
+
]),
|
|
44109
|
+
enumValues: array(string()).optional(),
|
|
44110
|
+
label: string().min(1).optional()
|
|
44111
|
+
});
|
|
44112
|
+
var EventVocabularyEntrySchema = object({
|
|
44113
|
+
/** The native token, verbatim. */
|
|
44114
|
+
id: string().min(1),
|
|
44115
|
+
source: EventVocabularySourceSchema.optional(),
|
|
44116
|
+
label: string().min(1),
|
|
44117
|
+
description: string().optional(),
|
|
44118
|
+
kind: EventVocabularyKindSchema.optional(),
|
|
44119
|
+
payload: array(EventVocabularyFieldSchema).optional()
|
|
44120
|
+
});
|
|
44121
|
+
/**
|
|
44122
|
+
* The vocabulary of a source that declares tokens and nothing else: one
|
|
44123
|
+
* entry per token, labelled with the token itself.
|
|
44124
|
+
*/
|
|
44125
|
+
function plainEventVocabulary(eventTypes) {
|
|
44126
|
+
return [...new Set(eventTypes)].filter((eventType) => eventType !== "").map((eventType) => ({
|
|
44127
|
+
id: eventType,
|
|
44128
|
+
label: eventType
|
|
44129
|
+
}));
|
|
44130
|
+
}
|
|
44131
|
+
/** The native tokens of a vocabulary, each once, in declaration order. */
|
|
44132
|
+
function eventTypesOfVocabulary(vocabulary) {
|
|
44133
|
+
return [...new Set(vocabulary.map((entry) => entry.id))];
|
|
44134
|
+
}
|
|
44135
|
+
/** The entry a fire belongs to: same token, same source (or both without one). */
|
|
44136
|
+
function findVocabularyEntry(vocabulary, eventType, sourceId) {
|
|
44137
|
+
return vocabulary.find((entry) => entry.id === eventType && entry.source?.id === sourceId);
|
|
44138
|
+
}
|
|
44082
44139
|
Math.PI / 180;
|
|
44083
44140
|
/**
|
|
44084
44141
|
* WHEN something happens, as data (D983) — the one time vocabulary of the
|
|
@@ -44286,6 +44343,33 @@ var ScheduleLeafSchema = object({
|
|
|
44286
44343
|
/** @deprecated legacy cron — new schedules use `at`. */
|
|
44287
44344
|
cron: string().min(1).max(120).optional()
|
|
44288
44345
|
}).refine((leaf) => leaf.at === void 0 !== (leaf.cron === void 0), { message: "a schedule names exactly one of `at` (a time spec) and `cron` (legacy)" }).refine((leaf) => leaf.days === void 0 || leaf.at !== void 0, { message: "`days` goes with `at`; a cron expression carries its own days" });
|
|
44346
|
+
/**
|
|
44347
|
+
* One payload predicate of a `device-fired` row: the value at `path` inside
|
|
44348
|
+
* the fire's `data` (dotted) equals `equals`. Compared strictly, no coercion.
|
|
44349
|
+
*/
|
|
44350
|
+
var DeviceFiredMatchSchema = object({
|
|
44351
|
+
path: string().min(1).max(120),
|
|
44352
|
+
equals: union([
|
|
44353
|
+
string(),
|
|
44354
|
+
number$1(),
|
|
44355
|
+
boolean()
|
|
44356
|
+
])
|
|
44357
|
+
});
|
|
44358
|
+
/**
|
|
44359
|
+
* "fires": one device of the `event-emitter` capability reported an event
|
|
44360
|
+
* (D1045). Every list is an OR, the lists together an AND; an absent list does
|
|
44361
|
+
* not narrow. `eventIds` are the device's own tokens, `sourceIds` the parts of
|
|
44362
|
+
* the device (a button), `kinds` the shared press kinds of its vocabulary.
|
|
44363
|
+
*/
|
|
44364
|
+
var DeviceFiredLeafSchema = object({
|
|
44365
|
+
kind: literal("device-fired"),
|
|
44366
|
+
...eventLeafId,
|
|
44367
|
+
deviceId: number$1().int().nonnegative(),
|
|
44368
|
+
eventIds: array(string().min(1)).min(1).max(64).optional(),
|
|
44369
|
+
sourceIds: array(string().min(1)).min(1).max(64).optional(),
|
|
44370
|
+
kinds: array(EventVocabularyKindSchema).min(1).optional(),
|
|
44371
|
+
match: array(DeviceFiredMatchSchema).min(1).max(8).optional()
|
|
44372
|
+
});
|
|
44289
44373
|
var ManualLeafSchema = object({
|
|
44290
44374
|
kind: literal("manual"),
|
|
44291
44375
|
...eventLeafId
|
|
@@ -44427,6 +44511,7 @@ var AutomationWhenSchema = lazy(() => discriminatedUnion("kind", [
|
|
|
44427
44511
|
}),
|
|
44428
44512
|
DeviceBecomesLeafSchema,
|
|
44429
44513
|
DeviceEventLeafSchema,
|
|
44514
|
+
DeviceFiredLeafSchema,
|
|
44430
44515
|
ScheduleLeafSchema,
|
|
44431
44516
|
ManualLeafSchema,
|
|
44432
44517
|
IntervalLeafSchema,
|
|
@@ -44441,6 +44526,7 @@ var AutomationWhenSchema = lazy(() => discriminatedUnion("kind", [
|
|
|
44441
44526
|
var EVENT_KINDS = new Set([
|
|
44442
44527
|
"device-becomes",
|
|
44443
44528
|
"device-event",
|
|
44529
|
+
"device-fired",
|
|
44444
44530
|
"schedule",
|
|
44445
44531
|
"manual",
|
|
44446
44532
|
"interval",
|
|
@@ -44521,6 +44607,7 @@ function hasEmptyContainer(node) {
|
|
|
44521
44607
|
var LEAF_WORDS = {
|
|
44522
44608
|
"device-becomes": "a device value that becomes",
|
|
44523
44609
|
"device-event": "a device event",
|
|
44610
|
+
"device-fired": "a device firing an event",
|
|
44524
44611
|
schedule: "a schedule",
|
|
44525
44612
|
manual: "a manual run",
|
|
44526
44613
|
interval: "an interval",
|
|
@@ -44786,9 +44873,12 @@ function convertLegacyWhen(half) {
|
|
|
44786
44873
|
* every caller — automations, Actions, and the notification centre, which runs
|
|
44787
44874
|
* only Actions (planning#473).
|
|
44788
44875
|
*/
|
|
44876
|
+
/** The longest one `wait` step lasts. It is cut by a restart of the run and does not survive a hub restart. */
|
|
44877
|
+
var WAIT_MAX_SECONDS = 3600;
|
|
44878
|
+
var WAIT_TOO_LONG = `a wait is at most one hour (${WAIT_MAX_SECONDS} s)`;
|
|
44789
44879
|
var AutomationWaitStepSchema = object({
|
|
44790
44880
|
kind: literal("wait"),
|
|
44791
|
-
seconds: number$1().min(0).max(
|
|
44881
|
+
seconds: number$1().min(0).max(WAIT_MAX_SECONDS, WAIT_TOO_LONG)
|
|
44792
44882
|
});
|
|
44793
44883
|
/** The legacy `deviceId` of a cap step: still READ, never written (D983). */
|
|
44794
44884
|
var LegacyStepDeviceSchema = union([
|
|
@@ -44858,39 +44948,227 @@ var elseNeedsIf = {
|
|
|
44858
44948
|
path: ["else"]
|
|
44859
44949
|
};
|
|
44860
44950
|
var GuardedWaitStepSchema = AutomationWaitStepSchema.extend(stepGuardShape).refine((step) => step.else === void 0 || step.if !== void 0, elseNeedsIf);
|
|
44861
|
-
var GuardedCapStepSchema = AutomationCapStepBaseSchema.extend(stepGuardShape).refine((step) => step.target !== void 0 || step.deviceId !== void 0, {
|
|
44862
|
-
message: "a cap step needs a target",
|
|
44863
|
-
path: ["target"]
|
|
44864
|
-
}).refine((step) => step.target?.kind !== "domain" || step.actionId !== void 0, {
|
|
44865
|
-
message: "a domain target needs the vocabulary action it applies to (actionId)",
|
|
44866
|
-
path: ["actionId"]
|
|
44867
|
-
}).refine((step) => step.else === void 0 || step.if !== void 0, elseNeedsIf);
|
|
44868
44951
|
/**
|
|
44869
44952
|
* A step of a STANDALONE list (an action, a scheduler point, a preset): the
|
|
44870
44953
|
* same two step kinds an automation runs, minus a guard that reads the
|
|
44871
44954
|
* automation's trigger, which such a list does not have.
|
|
44872
44955
|
*/
|
|
44873
|
-
var ActionStepSchema = discriminatedUnion("kind", [GuardedWaitStepSchema,
|
|
44956
|
+
var ActionStepSchema = discriminatedUnion("kind", [GuardedWaitStepSchema, AutomationCapStepBaseSchema.extend(stepGuardShape).refine((step) => step.target !== void 0 || step.deviceId !== void 0, {
|
|
44957
|
+
message: "a cap step needs a target",
|
|
44958
|
+
path: ["target"]
|
|
44959
|
+
}).refine((step) => step.target?.kind !== "domain" || step.actionId !== void 0, {
|
|
44960
|
+
message: "a domain target needs the vocabulary action it applies to (actionId)",
|
|
44961
|
+
path: ["actionId"]
|
|
44962
|
+
}).refine((step) => step.else === void 0 || step.if !== void 0, elseNeedsIf)]).superRefine((step, ctx) => {
|
|
44874
44963
|
if (step.if !== void 0 && hasTriggeredByLeaves(step.if)) ctx.addIssue({
|
|
44875
44964
|
code: "custom",
|
|
44876
44965
|
message: TRIGGERED_BY_NEEDS_AUTOMATION,
|
|
44877
44966
|
path: ["if"]
|
|
44878
44967
|
});
|
|
44879
44968
|
});
|
|
44969
|
+
/**
|
|
44970
|
+
* Flow control of an AUTOMATION's list (#500). A standalone list (an action, a
|
|
44971
|
+
* scheduler point, a preset) stays `wait` and `cap`: it has no run of its own
|
|
44972
|
+
* to end and no variable bag to write.
|
|
44973
|
+
*/
|
|
44974
|
+
var continueOnErrorShape = {
|
|
44975
|
+
/** A failure of this step is traced `failed-continued` and the next step runs. */
|
|
44976
|
+
continueOnError: literal(true).optional() };
|
|
44977
|
+
/** An automation's cap step: the shared guarded cap step, plus `continueOnError`. */
|
|
44978
|
+
var AutomationGuardedCapStepSchema = AutomationCapStepBaseSchema.extend({
|
|
44979
|
+
...stepGuardShape,
|
|
44980
|
+
...continueOnErrorShape
|
|
44981
|
+
}).refine((step) => step.target !== void 0 || step.deviceId !== void 0, {
|
|
44982
|
+
message: "a cap step needs a target",
|
|
44983
|
+
path: ["target"]
|
|
44984
|
+
}).refine((step) => step.target?.kind !== "domain" || step.actionId !== void 0, {
|
|
44985
|
+
message: "a domain target needs the vocabulary action it applies to (actionId)",
|
|
44986
|
+
path: ["actionId"]
|
|
44987
|
+
}).refine((step) => step.else === void 0 || step.if !== void 0, elseNeedsIf);
|
|
44988
|
+
/** End the run here, on purpose. `reason` may carry `{{vars.x}}` slots. */
|
|
44989
|
+
var AutomationStopStepSchema = object({
|
|
44990
|
+
kind: literal("stop"),
|
|
44991
|
+
reason: string().min(1, "a stop needs a reason: it is what the run trace shows").max(200),
|
|
44992
|
+
/** `ok`: the run ends as a success. `failed`: it ends as a failure, with the reason. */
|
|
44993
|
+
outcome: _enum(["ok", "failed"]),
|
|
44994
|
+
/** Stop only when this reads true; false or unknown does not stop. */
|
|
44995
|
+
if: AutomationWhenSchema.optional()
|
|
44996
|
+
});
|
|
44997
|
+
var SET_VAR_NAME_RE = /^[A-Za-z_][A-Za-z0-9_]{0,39}$/;
|
|
44998
|
+
/** Names the run itself writes and reads (`leaf` is what `triggered-by` judges): a step may not overwrite them. */
|
|
44999
|
+
var RESERVED_RUN_VARS = [
|
|
45000
|
+
"kind",
|
|
45001
|
+
"leaf",
|
|
45002
|
+
"at"
|
|
45003
|
+
];
|
|
45004
|
+
/**
|
|
45005
|
+
* Write variables into the run's bag, for the steps after it. SUBSTITUTION
|
|
45006
|
+
* only, never evaluation: a text value may carry `{{vars.x}}` slots.
|
|
45007
|
+
*/
|
|
45008
|
+
var AutomationSetStepSchema = object({
|
|
45009
|
+
kind: literal("set"),
|
|
45010
|
+
vars: record(string(), union([
|
|
45011
|
+
string().max(500),
|
|
45012
|
+
number$1(),
|
|
45013
|
+
boolean()
|
|
45014
|
+
])).refine((vars) => Object.keys(vars).every((name) => SET_VAR_NAME_RE.test(name)), { message: "a variable name is letters, digits and _, not starting with a digit (max 40)" }).refine((vars) => Object.keys(vars).length >= 1, { message: "set needs at least one variable" }).refine((vars) => Object.keys(vars).length <= 20, { message: `set holds at most 20 variables` }).refine((vars) => Object.keys(vars).every((name) => !RESERVED_RUN_VARS.includes(name)), { message: `the names ${RESERVED_RUN_VARS.join(", ")} belong to the run and cannot be set` }),
|
|
45015
|
+
/** Set only when this reads true; false or unknown leaves the bag as it is. */
|
|
45016
|
+
if: AutomationWhenSchema.optional()
|
|
45017
|
+
});
|
|
45018
|
+
var AutomationRunActionStepSchema = object({
|
|
45019
|
+
kind: literal("action"),
|
|
45020
|
+
/** An entry of the `actions` surface (`internal:<uuid>` or `<addonId>:<localId>`). */
|
|
45021
|
+
actionId: string().min(1),
|
|
45022
|
+
/** Values for the action's declared variables; the others take their default. */
|
|
45023
|
+
variables: record(string(), union([
|
|
45024
|
+
string(),
|
|
45025
|
+
number$1(),
|
|
45026
|
+
boolean()
|
|
45027
|
+
])).optional(),
|
|
45028
|
+
...continueOnErrorShape
|
|
45029
|
+
});
|
|
45030
|
+
/**
|
|
45031
|
+
* A step INSIDE a branch of a `choose`: a flow step with no condition of its
|
|
45032
|
+
* own (the branch is the condition) and no block inside it. Strict, so an `if`
|
|
45033
|
+
* written on such a step is refused rather than dropped.
|
|
45034
|
+
*/
|
|
45035
|
+
/** The longest a `wait-until` may wait: six hours. */
|
|
45036
|
+
var WAIT_UNTIL_TIMEOUT_MAX_S = 21600;
|
|
45037
|
+
/**
|
|
45038
|
+
* Pause the run until a condition is true (#500). The timeout is mandatory: a
|
|
45039
|
+
* run never waits without an end. `onTimeout` says what a wait that ran out
|
|
45040
|
+
* does: `continue` goes on to the next step, `stop` ends the run as a failure.
|
|
45041
|
+
* A condition that cannot be read is not "true": the wait goes on (D49).
|
|
45042
|
+
*/
|
|
45043
|
+
var AutomationWaitUntilStepSchema = object({
|
|
45044
|
+
kind: literal("wait-until"),
|
|
45045
|
+
when: AutomationWhenSchema,
|
|
45046
|
+
timeoutS: number$1().int().min(1, "a wait needs a timeout of at least one second").max(WAIT_UNTIL_TIMEOUT_MAX_S, `a wait for a condition is at most six hours (${WAIT_UNTIL_TIMEOUT_MAX_S} s)`),
|
|
45047
|
+
onTimeout: _enum(["continue", "stop"])
|
|
45048
|
+
}).strict();
|
|
45049
|
+
/** The step kinds that hold steps of their own, or pause on a condition: they nest two levels at most. */
|
|
45050
|
+
var BLOCK_STEP_KINDS = [
|
|
45051
|
+
"choose",
|
|
45052
|
+
"repeat",
|
|
45053
|
+
"parallel",
|
|
45054
|
+
"wait-until"
|
|
45055
|
+
];
|
|
45056
|
+
var NEST_TOO_DEEP = `steps nest two levels at most: a step inside a nested choose or repeat can be a plain step only`;
|
|
45057
|
+
function kindOf(input) {
|
|
45058
|
+
return typeof input === "object" && input !== null ? Reflect.get(input, "kind") : void 0;
|
|
45059
|
+
}
|
|
45060
|
+
/** Where the nesting ends, a block step is refused in words rather than as an unknown kind. */
|
|
45061
|
+
function nestTooDeep(issue) {
|
|
45062
|
+
const kind = kindOf(issue.input);
|
|
45063
|
+
return typeof kind === "string" && BLOCK_STEP_KINDS.includes(kind) ? NEST_TOO_DEEP : void 0;
|
|
45064
|
+
}
|
|
45065
|
+
var plainStepSchemas = [
|
|
45066
|
+
AutomationWaitStepSchema.strict(),
|
|
45067
|
+
AutomationCapStepBaseSchema.extend(continueOnErrorShape).strict().refine((step) => step.target !== void 0 || step.deviceId !== void 0, {
|
|
45068
|
+
message: "a cap step needs a target",
|
|
45069
|
+
path: ["target"]
|
|
45070
|
+
}).refine((step) => step.target?.kind !== "domain" || step.actionId !== void 0, {
|
|
45071
|
+
message: "a domain target needs the vocabulary action it applies to (actionId)",
|
|
45072
|
+
path: ["actionId"]
|
|
45073
|
+
}),
|
|
45074
|
+
AutomationStopStepSchema.omit({ if: true }).strict(),
|
|
45075
|
+
AutomationSetStepSchema.omit({ if: true }).strict(),
|
|
45076
|
+
AutomationRunActionStepSchema.strict()
|
|
45077
|
+
];
|
|
45078
|
+
/**
|
|
45079
|
+
* A plain step: a flow step with no condition of its own and no step inside
|
|
45080
|
+
* it. The second (last) level of nesting holds these only.
|
|
45081
|
+
*/
|
|
45082
|
+
var AutomationBranchStepSchema = discriminatedUnion("kind", plainStepSchemas, { error: nestTooDeep });
|
|
45083
|
+
/** A step that can run beside others: it writes no variable and does not end the run. */
|
|
45084
|
+
var AutomationParallelMemberSchema = AutomationBranchStepSchema.refine((step) => step.kind === "cap" || step.kind === "action" || step.kind === "wait", "a parallel holds device commands, actions and waits only: a set or a stop beside other steps has no order");
|
|
45085
|
+
/**
|
|
45086
|
+
* Several steps at once (#500): all are started together and all are awaited.
|
|
45087
|
+
* A failure fails the run once the others finished, as in a sequence; a member
|
|
45088
|
+
* marked "continue if this fails" does not.
|
|
45089
|
+
*/
|
|
45090
|
+
var AutomationParallelStepSchema = object({
|
|
45091
|
+
kind: literal("parallel"),
|
|
45092
|
+
steps: array(AutomationParallelMemberSchema).min(2, "a parallel needs at least two steps").max(5, `a parallel takes at most 5 steps`)
|
|
45093
|
+
}).strict();
|
|
45094
|
+
var REPEAT_NEEDS_MAX = "a repeat on a condition needs a maximum number of iterations";
|
|
45095
|
+
/** A loop on a condition: the bound is mandatory, so a run never loops without an end. */
|
|
45096
|
+
var repeatConditionShape = {
|
|
45097
|
+
when: AutomationWhenSchema,
|
|
45098
|
+
maxIterations: number$1({ error: REPEAT_NEEDS_MAX }).int().min(1, REPEAT_NEEDS_MAX).max(50, `a repeat on a condition runs at most 50 times`),
|
|
45099
|
+
/** A pause between two iterations, never after the last. */
|
|
45100
|
+
waitS: number$1().int().min(1).max(WAIT_MAX_SECONDS, WAIT_TOO_LONG).optional()
|
|
45101
|
+
};
|
|
45102
|
+
/** What decides how many times a `repeat` runs. */
|
|
45103
|
+
var AutomationRepeatLoopSchema = discriminatedUnion("by", [
|
|
45104
|
+
object({
|
|
45105
|
+
by: literal("count"),
|
|
45106
|
+
count: number$1().int().min(1).max(20, `a repeat runs at most 20 times`)
|
|
45107
|
+
}).strict(),
|
|
45108
|
+
object({
|
|
45109
|
+
by: literal("while"),
|
|
45110
|
+
...repeatConditionShape
|
|
45111
|
+
}).strict(),
|
|
45112
|
+
object({
|
|
45113
|
+
by: literal("until"),
|
|
45114
|
+
...repeatConditionShape
|
|
45115
|
+
}).strict(),
|
|
45116
|
+
object({
|
|
45117
|
+
by: literal("forEach"),
|
|
45118
|
+
target: object({
|
|
45119
|
+
kind: literal("devices"),
|
|
45120
|
+
ids: array(number$1().int()).min(1, "a repeat over devices needs at least one device").max(50, `a repeat over devices takes at most 50 devices`)
|
|
45121
|
+
}).strict()
|
|
45122
|
+
}).strict()
|
|
45123
|
+
]);
|
|
45124
|
+
/**
|
|
45125
|
+
* The same steps several times (#500). Every form is bounded at save, so a
|
|
45126
|
+
* run cannot loop without an end. A failure or a `stop` in the steps ends the
|
|
45127
|
+
* loop and the run, as in a sequence.
|
|
45128
|
+
*/
|
|
45129
|
+
function repeatSchemaOf(step) {
|
|
45130
|
+
return object({
|
|
45131
|
+
kind: literal("repeat"),
|
|
45132
|
+
loop: AutomationRepeatLoopSchema,
|
|
45133
|
+
steps: array(step).min(1, "a repeat needs at least one step").max(10, `a repeat takes at most 10 steps`)
|
|
45134
|
+
}).strict();
|
|
45135
|
+
}
|
|
45136
|
+
/**
|
|
45137
|
+
* One step, several ways (#500): the branches are read in order and the FIRST
|
|
45138
|
+
* whose condition is true runs; `else` runs when every branch is false. A
|
|
45139
|
+
* branch that cannot be read ends the choice: nothing runs, not the branches
|
|
45140
|
+
* after it and not the else (D49). The #472 `if` / `else` of a wait or cap
|
|
45141
|
+
* step is the one-branch case and stays as it is stored.
|
|
45142
|
+
*/
|
|
45143
|
+
function chooseSchemaOf(step) {
|
|
45144
|
+
const steps = array(step).max(10);
|
|
45145
|
+
return object({
|
|
45146
|
+
kind: literal("choose"),
|
|
45147
|
+
branches: array(object({
|
|
45148
|
+
if: AutomationWhenSchema,
|
|
45149
|
+
steps: steps.min(1, "a branch needs at least one step")
|
|
45150
|
+
})).min(1, "a choose needs at least one branch").max(6, `a choose takes at most 6 branches`),
|
|
45151
|
+
else: steps.optional()
|
|
45152
|
+
});
|
|
45153
|
+
}
|
|
45154
|
+
var AutomationBodyStepSchema = discriminatedUnion("kind", [
|
|
45155
|
+
...plainStepSchemas,
|
|
45156
|
+
AutomationWaitUntilStepSchema,
|
|
45157
|
+
AutomationParallelStepSchema,
|
|
45158
|
+
chooseSchemaOf(AutomationBranchStepSchema),
|
|
45159
|
+
repeatSchemaOf(AutomationBranchStepSchema)
|
|
45160
|
+
]);
|
|
45161
|
+
var AutomationRepeatStepSchema = repeatSchemaOf(AutomationBodyStepSchema);
|
|
44880
45162
|
var AutomationActionSchema = discriminatedUnion("kind", [
|
|
44881
45163
|
GuardedWaitStepSchema,
|
|
44882
|
-
|
|
44883
|
-
|
|
44884
|
-
|
|
44885
|
-
|
|
44886
|
-
|
|
44887
|
-
|
|
44888
|
-
|
|
44889
|
-
|
|
44890
|
-
number$1(),
|
|
44891
|
-
boolean()
|
|
44892
|
-
])).optional()
|
|
44893
|
-
}),
|
|
45164
|
+
AutomationGuardedCapStepSchema,
|
|
45165
|
+
AutomationStopStepSchema,
|
|
45166
|
+
AutomationSetStepSchema,
|
|
45167
|
+
chooseSchemaOf(AutomationBodyStepSchema),
|
|
45168
|
+
AutomationWaitUntilStepSchema,
|
|
45169
|
+
AutomationParallelStepSchema,
|
|
45170
|
+
AutomationRepeatStepSchema,
|
|
45171
|
+
AutomationRunActionStepSchema,
|
|
44894
45172
|
object({
|
|
44895
45173
|
kind: literal("code"),
|
|
44896
45174
|
/** Compiled into the automation's OWN block by esbuild — not a third
|
|
@@ -44953,11 +45231,6 @@ function convertLegacyRecipe(legacy) {
|
|
|
44953
45231
|
...rest
|
|
44954
45232
|
};
|
|
44955
45233
|
}
|
|
44956
|
-
/**
|
|
44957
|
-
* Where recipes are PARSED (the core-blocks cap, the MCP tool, the literal a
|
|
44958
|
-
* saved block carries): the new shape as it is, or the old shape converted to
|
|
44959
|
-
* it. The output type is always the new one.
|
|
44960
|
-
*/
|
|
44961
45234
|
var AutomationRecipeSchema = union([CurrentAutomationRecipeSchema, LegacyAutomationRecipeSchema.transform(convertLegacyRecipe)]);
|
|
44962
45235
|
var DETECTION_DESCRIPTIONS = {
|
|
44963
45236
|
deviceId: "the camera that saw it",
|
|
@@ -44978,6 +45251,16 @@ var BECOMES_DESCRIPTIONS = {
|
|
|
44978
45251
|
from: "the value before the change, empty when it is not known",
|
|
44979
45252
|
to: "the value it changed to"
|
|
44980
45253
|
};
|
|
45254
|
+
/**
|
|
45255
|
+
* A fire's payload is offered too, as `data.<path>` (`{{vars.data.channel}}`):
|
|
45256
|
+
* those names depend on the device, so they are not in this list.
|
|
45257
|
+
*/
|
|
45258
|
+
var FIRED_DESCRIPTIONS = {
|
|
45259
|
+
deviceId: "the device that fired",
|
|
45260
|
+
eventType: "the event, as the device names it",
|
|
45261
|
+
sourceId: "the part of the device that fired (a button), empty when it names none",
|
|
45262
|
+
eventKind: "the kind of press (press, long-press …), empty when the device declares none"
|
|
45263
|
+
};
|
|
44981
45264
|
function describe$1(descriptions) {
|
|
44982
45265
|
return Object.entries(descriptions).map(([name, description]) => ({
|
|
44983
45266
|
name,
|
|
@@ -44986,12 +45269,74 @@ function describe$1(descriptions) {
|
|
|
44986
45269
|
}
|
|
44987
45270
|
describe$1(DETECTION_DESCRIPTIONS);
|
|
44988
45271
|
describe$1(STATIONARY_DESCRIPTIONS);
|
|
45272
|
+
describe$1(FIRED_DESCRIPTIONS).map((v) => v.name === "deviceId" ? {
|
|
45273
|
+
...v,
|
|
45274
|
+
hintKey: "firedDeviceId"
|
|
45275
|
+
} : v);
|
|
44989
45276
|
describe$1(BECOMES_DESCRIPTIONS).map((v) => v.name === "deviceId" ? {
|
|
44990
45277
|
...v,
|
|
44991
45278
|
hintKey: "becomesDeviceId"
|
|
44992
45279
|
} : v);
|
|
44993
45280
|
new Set(Object.values(COCO_TO_MACRO.mapping));
|
|
44994
45281
|
/**
|
|
45282
|
+
* Generic stateless event emitter. Installed on a `DeviceType.EventEmitter`
|
|
45283
|
+
* device. Carries the device's EXACT declared event vocabulary verbatim
|
|
45284
|
+
* (NO normalization). Two shapes:
|
|
45285
|
+
* - structured source (HA `event.*` entity) → `vocabulary` is the fixed
|
|
45286
|
+
* declared set (e.g. press_short, press_long, …).
|
|
45287
|
+
* - generic/legacy source (HA bus events, e.g. zha_event) → `vocabulary`
|
|
45288
|
+
* is [] (open) and `lastEvent.data` carries the complex payload.
|
|
45289
|
+
* `vocabulary` (D1044) names each event for a person and types it for a
|
|
45290
|
+
* rule; `eventTypes` is its list of native tokens, kept for older readers.
|
|
45291
|
+
* A fire names the part of the device it came from in `sourceId` when the
|
|
45292
|
+
* vocabulary declares sources (a remote's buttons).
|
|
45293
|
+
* `seq` is monotonic so two identical events still produce distinct slice writes.
|
|
45294
|
+
*/
|
|
45295
|
+
var EventFireSchema = object({
|
|
45296
|
+
deviceId: number$1(),
|
|
45297
|
+
eventType: string(),
|
|
45298
|
+
sourceId: string().optional(),
|
|
45299
|
+
data: record(string(), unknown()).nullable(),
|
|
45300
|
+
timestamp: number$1().meta(readingMeta("none")),
|
|
45301
|
+
seq: number$1().meta(readingMeta("count"))
|
|
45302
|
+
});
|
|
45303
|
+
var EventEmitterStatusSchema = object({
|
|
45304
|
+
eventTypes: array(string()),
|
|
45305
|
+
/**
|
|
45306
|
+
* Required of a provider by the type. A status written before the field
|
|
45307
|
+
* existed still parses, as an empty vocabulary: read it through
|
|
45308
|
+
* `readEventVocabulary`, which then answers with the plain tokens.
|
|
45309
|
+
*/
|
|
45310
|
+
vocabulary: array(EventVocabularyEntrySchema).default([]),
|
|
45311
|
+
lastEvent: EventFireSchema.nullable(),
|
|
45312
|
+
eventCountSinceStart: number$1().meta(readingMeta("count"))
|
|
45313
|
+
});
|
|
45314
|
+
var eventEmitterCapability = {
|
|
45315
|
+
name: "event-emitter",
|
|
45316
|
+
scope: "device",
|
|
45317
|
+
deviceNative: true,
|
|
45318
|
+
mode: "singleton",
|
|
45319
|
+
deviceTypes: [DeviceType.EventEmitter],
|
|
45320
|
+
methods: {},
|
|
45321
|
+
events: { onEvent: { data: EventFireSchema } },
|
|
45322
|
+
status: {
|
|
45323
|
+
schema: EventEmitterStatusSchema,
|
|
45324
|
+
kind: "push"
|
|
45325
|
+
},
|
|
45326
|
+
runtimeState: EventEmitterStatusSchema,
|
|
45327
|
+
/**
|
|
45328
|
+
* Runtime-state durability: **session** — `eventCountSinceStart` names its own scope.
|
|
45329
|
+
*
|
|
45330
|
+
* See `RuntimeStateDurability`. Enforced by
|
|
45331
|
+
* `scripts/check-runtime-state-durability.ts`.
|
|
45332
|
+
*/
|
|
45333
|
+
durability: "session",
|
|
45334
|
+
/**
|
|
45335
|
+
* History (D850): none — `eventCountSinceStart` resets with the addon; events live in ledgers.
|
|
45336
|
+
*/
|
|
45337
|
+
history: "none"
|
|
45338
|
+
};
|
|
45339
|
+
/**
|
|
44995
45340
|
* Schedulers (D983) — an entity that performs actions over the day.
|
|
44996
45341
|
*
|
|
44997
45342
|
* A scheduler has profiles; a profile has weekdays and a timeline of POINTS.
|
|
@@ -45042,12 +45387,16 @@ var HoldOverrideSchema = discriminatedUnion("mode", [object({ mode: literal("res
|
|
|
45042
45387
|
})]);
|
|
45043
45388
|
/** A missed edge up to this late still runs. */
|
|
45044
45389
|
var DEFAULT_MAX_LATE_MS = 10 * 6e4;
|
|
45390
|
+
var SchedulerStepSchema = ActionStepSchema.refine((step) => step.kind !== "wait" || step.seconds <= 300, {
|
|
45391
|
+
message: `a scheduler point waits at most five minutes (300 s); put a longer wait in an action`,
|
|
45392
|
+
path: ["seconds"]
|
|
45393
|
+
});
|
|
45045
45394
|
var SchedulerPointSchema = object({
|
|
45046
45395
|
id: string().min(1).max(64),
|
|
45047
45396
|
at: SchedulerTimeSpecSchema,
|
|
45048
45397
|
mode: SchedulerPointModeSchema,
|
|
45049
45398
|
/** The actions of an `edge` or `hold`; a `release` has none. */
|
|
45050
|
-
steps: array(
|
|
45399
|
+
steps: array(SchedulerStepSchema).max(20).default([]),
|
|
45051
45400
|
/** Checked when the point runs (an edge) or is applied (a hold). */
|
|
45052
45401
|
conditions: SchedulerStateTreeSchema.optional(),
|
|
45053
45402
|
/** Hold only; absent means `respect`. */
|
|
@@ -45245,6 +45594,7 @@ var AutomationConditionTraceNodeSchema = object({
|
|
|
45245
45594
|
"triggered-by",
|
|
45246
45595
|
"device-becomes",
|
|
45247
45596
|
"device-event",
|
|
45597
|
+
"device-fired",
|
|
45248
45598
|
"schedule",
|
|
45249
45599
|
"interval",
|
|
45250
45600
|
"manual",
|
|
@@ -45315,18 +45665,46 @@ var StepTraceBaseSchema = object({
|
|
|
45315
45665
|
]).optional(),
|
|
45316
45666
|
/** Why the condition read what it read, in the evaluator's own words. */
|
|
45317
45667
|
conditionReason: string().optional(),
|
|
45318
|
-
/** `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. */
|
|
45668
|
+
/** `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. `failed-continued`: it failed and was marked to be passed over (#500). */
|
|
45319
45669
|
outcome: _enum([
|
|
45320
45670
|
"ok",
|
|
45321
45671
|
"error",
|
|
45322
45672
|
"not-run",
|
|
45323
45673
|
"empty",
|
|
45324
|
-
"skipped"
|
|
45674
|
+
"skipped",
|
|
45675
|
+
"failed-continued",
|
|
45676
|
+
"timed-out"
|
|
45325
45677
|
]),
|
|
45326
45678
|
message: string().optional()
|
|
45327
45679
|
});
|
|
45680
|
+
/** What a block step adds to its row: which list ran, what each branch read, how many rounds. */
|
|
45681
|
+
var blockTraceShape = {
|
|
45682
|
+
/** A `choose` step (#500): the list that ran, `branches.<n>` or `else`. Absent when none did. */
|
|
45683
|
+
branch: string().optional(),
|
|
45684
|
+
/** A `choose` step: what each branch read, in order, up to the one that decided. */
|
|
45685
|
+
branchChecks: array(object({
|
|
45686
|
+
condition: _enum([
|
|
45687
|
+
"true",
|
|
45688
|
+
"false",
|
|
45689
|
+
"unknown"
|
|
45690
|
+
]),
|
|
45691
|
+
conditionReason: string().optional()
|
|
45692
|
+
})).optional(),
|
|
45693
|
+
/** A `repeat` step (#500): how many times its steps ran. */
|
|
45694
|
+
iterations: number$1().int().optional()
|
|
45695
|
+
};
|
|
45696
|
+
/** A step one level down: it may be a block step itself, whose own steps are plain rows (the nesting ends there). */
|
|
45697
|
+
var NestedStepTraceSchema = StepTraceBaseSchema.extend({
|
|
45698
|
+
...blockTraceShape,
|
|
45699
|
+
steps: array(StepTraceBaseSchema).optional()
|
|
45700
|
+
});
|
|
45328
45701
|
/** A step trace; the `else` steps that ran are one level of the same shape (the nesting is bounded at one). */
|
|
45329
|
-
var AutomationStepTraceSchema = StepTraceBaseSchema.extend({
|
|
45702
|
+
var AutomationStepTraceSchema = StepTraceBaseSchema.extend({
|
|
45703
|
+
else: array(StepTraceBaseSchema).optional(),
|
|
45704
|
+
...blockTraceShape,
|
|
45705
|
+
/** A `choose` step: the steps of the list that ran. A `parallel`: its members. A `repeat`: the LAST iteration. */
|
|
45706
|
+
steps: array(NestedStepTraceSchema).optional()
|
|
45707
|
+
});
|
|
45330
45708
|
var AutomationRunTraceSchema = object({
|
|
45331
45709
|
runId: string().min(1),
|
|
45332
45710
|
startedAt: number$1(),
|
|
@@ -45733,7 +46111,9 @@ var AddonHttpRouteSchema = object({
|
|
|
45733
46111
|
]).optional(),
|
|
45734
46112
|
description: string().optional(),
|
|
45735
46113
|
/** The hub limits this route per client address before the handler runs. */
|
|
45736
|
-
rateLimit: _enum(["auth"]).optional()
|
|
46114
|
+
rateLimit: _enum(["auth"]).optional(),
|
|
46115
|
+
/** Served once per integration instance; the handler reads `instanceId`. */
|
|
46116
|
+
perInstance: boolean().optional()
|
|
45737
46117
|
});
|
|
45738
46118
|
/**
|
|
45739
46119
|
* Cross-process route invocation envelope. The hub captures the
|
|
@@ -45750,6 +46130,8 @@ var InvokeRequestSchema = object({
|
|
|
45750
46130
|
query: record(string(), string()),
|
|
45751
46131
|
body: unknown(),
|
|
45752
46132
|
headers: record(string(), string()),
|
|
46133
|
+
/** The instance the hub resolved for a `perInstance` route. */
|
|
46134
|
+
instanceId: string().optional(),
|
|
45753
46135
|
user: object({
|
|
45754
46136
|
id: string(),
|
|
45755
46137
|
username: string(),
|
|
@@ -56442,53 +56824,6 @@ var enumSensorCapability = {
|
|
|
56442
56824
|
* whether persisting is worth a SQLite commit. */
|
|
56443
56825
|
volatileStateFields: ["lastFetchedAt", "timestamp"]
|
|
56444
56826
|
};
|
|
56445
|
-
/**
|
|
56446
|
-
* Generic stateless event emitter. Installed on a `DeviceType.EventEmitter`
|
|
56447
|
-
* device. Carries the device's EXACT declared event vocabulary verbatim
|
|
56448
|
-
* (NO normalization). Two shapes:
|
|
56449
|
-
* - structured source (HA `event.*` entity) → `eventTypes` is the fixed
|
|
56450
|
-
* declared vocabulary (e.g. ['press_short','press_long',...]).
|
|
56451
|
-
* - generic/legacy source (HA bus events, e.g. zha_event) → `eventTypes`
|
|
56452
|
-
* is [] (open) and `lastEvent.data` carries the complex payload.
|
|
56453
|
-
* `seq` is monotonic so two identical events still produce distinct slice writes.
|
|
56454
|
-
*/
|
|
56455
|
-
var EventFireSchema = object({
|
|
56456
|
-
deviceId: number$1(),
|
|
56457
|
-
eventType: string(),
|
|
56458
|
-
data: record(string(), unknown()).nullable(),
|
|
56459
|
-
timestamp: number$1().meta(readingMeta("none")),
|
|
56460
|
-
seq: number$1().meta(readingMeta("count"))
|
|
56461
|
-
});
|
|
56462
|
-
var EventEmitterStatusSchema = object({
|
|
56463
|
-
eventTypes: array(string()),
|
|
56464
|
-
lastEvent: EventFireSchema.nullable(),
|
|
56465
|
-
eventCountSinceStart: number$1().meta(readingMeta("count"))
|
|
56466
|
-
});
|
|
56467
|
-
var eventEmitterCapability = {
|
|
56468
|
-
name: "event-emitter",
|
|
56469
|
-
scope: "device",
|
|
56470
|
-
deviceNative: true,
|
|
56471
|
-
mode: "singleton",
|
|
56472
|
-
deviceTypes: [DeviceType.EventEmitter],
|
|
56473
|
-
methods: {},
|
|
56474
|
-
events: { onEvent: { data: EventFireSchema } },
|
|
56475
|
-
status: {
|
|
56476
|
-
schema: EventEmitterStatusSchema,
|
|
56477
|
-
kind: "push"
|
|
56478
|
-
},
|
|
56479
|
-
runtimeState: EventEmitterStatusSchema,
|
|
56480
|
-
/**
|
|
56481
|
-
* Runtime-state durability: **session** — `eventCountSinceStart` names its own scope.
|
|
56482
|
-
*
|
|
56483
|
-
* See `RuntimeStateDurability`. Enforced by
|
|
56484
|
-
* `scripts/check-runtime-state-durability.ts`.
|
|
56485
|
-
*/
|
|
56486
|
-
durability: "session",
|
|
56487
|
-
/**
|
|
56488
|
-
* History (D850): none — `eventCountSinceStart` resets with the addon; events live in ledgers.
|
|
56489
|
-
*/
|
|
56490
|
-
history: "none"
|
|
56491
|
-
};
|
|
56492
56827
|
var IdentitySchema = object({
|
|
56493
56828
|
id: string(),
|
|
56494
56829
|
name: string(),
|
|
@@ -59064,6 +59399,12 @@ var IntegrationLiteSchema = object({
|
|
|
59064
59399
|
var AvailableIntegrationTypeSchema = object({
|
|
59065
59400
|
addonId: string(),
|
|
59066
59401
|
name: string(),
|
|
59402
|
+
/**
|
|
59403
|
+
* Product name a new integration is prefilled from (`<label> - Home`).
|
|
59404
|
+
* Absent: the client uses `name`. Set when the catalog title is not the
|
|
59405
|
+
* product (Bosch SHC, MQTT).
|
|
59406
|
+
*/
|
|
59407
|
+
providerLabel: string().optional(),
|
|
59067
59408
|
description: string(),
|
|
59068
59409
|
iconUrl: string().nullable(),
|
|
59069
59410
|
color: string(),
|
|
@@ -71952,7 +72293,18 @@ var OauthIntegrationDescriptorSchema = object({
|
|
|
71952
72293
|
* The value is baked into the authorization code at `/authorize` and travels
|
|
71953
72294
|
* on the tokens, so editing this field changes FUTURE links only.
|
|
71954
72295
|
*/
|
|
71955
|
-
refreshTokenTtlSec: union([number$1().int().positive(), literal("never")]).optional()
|
|
72296
|
+
refreshTokenTtlSec: union([number$1().int().positive(), literal("never")]).optional(),
|
|
72297
|
+
/**
|
|
72298
|
+
* The integration instances an account can be linked to (planning#415),
|
|
72299
|
+
* beside the default one. `/api/oauth2/authorize?instance=<id>` is accepted
|
|
72300
|
+
* only for an id listed here; with no `instance=` the link is made to the
|
|
72301
|
+
* default instance, which is never listed and always accepted — it is the
|
|
72302
|
+
* address third parties already hold. Omit for a single-instance integration.
|
|
72303
|
+
*/
|
|
72304
|
+
instances: array(object({
|
|
72305
|
+
id: string(),
|
|
72306
|
+
displayName: string()
|
|
72307
|
+
})).optional()
|
|
71956
72308
|
});
|
|
71957
72309
|
method(_void(), OauthIntegrationDescriptorSchema, { auth: "admin" });
|
|
71958
72310
|
/**
|
|
@@ -78881,6 +79233,13 @@ var SsoBridgeClaimsSchema = object({
|
|
|
78881
79233
|
/** OAuth authorization-code binding — set only on `oauth-code` tokens. */
|
|
78882
79234
|
redirectUri: string().optional(),
|
|
78883
79235
|
integrationId: string().optional(),
|
|
79236
|
+
/**
|
|
79237
|
+
* The integration INSTANCE an OAuth link was made for (planning#415). Set on
|
|
79238
|
+
* `oauth-code`, `oauth-access` and `oauth-refresh` tokens of a link made
|
|
79239
|
+
* with `instance=`; absent on a link to the default instance. A cloud relay
|
|
79240
|
+
* reads it off the access token to route; the hub answers from the session.
|
|
79241
|
+
*/
|
|
79242
|
+
instanceId: string().optional(),
|
|
78884
79243
|
/** JWT ID — unique per issued code; consumed-set enforces single-use. */
|
|
78885
79244
|
jti: string().optional(),
|
|
78886
79245
|
/** PKCE S256 challenge — set only on `oauth-code` tokens issued to a public
|
|
@@ -81259,6 +81618,8 @@ var OauthSessionSummarySchema = object({
|
|
|
81259
81618
|
userId: string(),
|
|
81260
81619
|
username: string(),
|
|
81261
81620
|
integrationId: string(),
|
|
81621
|
+
/** The instance the link was made for; `null` = the default instance. */
|
|
81622
|
+
instanceId: string().nullable().optional(),
|
|
81262
81623
|
scopes: array(TokenScopeSchema),
|
|
81263
81624
|
createdAt: number$1(),
|
|
81264
81625
|
lastUsedAt: number$1(),
|
|
@@ -81358,6 +81719,9 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(_void(), ob
|
|
|
81358
81719
|
access: "view"
|
|
81359
81720
|
}), method(object({
|
|
81360
81721
|
integrationId: string(),
|
|
81722
|
+
/** The integration instance the link is for. Omit for the default
|
|
81723
|
+
* instance — never pass the addon id to mean it. */
|
|
81724
|
+
instanceId: string().optional(),
|
|
81361
81725
|
userId: string(),
|
|
81362
81726
|
username: string(),
|
|
81363
81727
|
scopes: array(TokenScopeSchema),
|
|
@@ -81396,7 +81760,13 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(_void(), ob
|
|
|
81396
81760
|
}), method(object({ token: string() }), object({
|
|
81397
81761
|
userId: string(),
|
|
81398
81762
|
username: string(),
|
|
81399
|
-
scopes: array(TokenScopeSchema)
|
|
81763
|
+
scopes: array(TokenScopeSchema),
|
|
81764
|
+
/** The instance the link was made for, read from the SESSION.
|
|
81765
|
+
* Absent = the default instance. `oauthLinkServesInstance` is the
|
|
81766
|
+
* helper a per-instance route calls to compare it with the instance
|
|
81767
|
+
* of its path; no route declares `perInstance` yet (the Alexa
|
|
81768
|
+
* per-instance route, T3, is the first consumer). */
|
|
81769
|
+
instanceId: string().optional()
|
|
81400
81770
|
}).nullable(), { access: "view" }), method(object({ userId: string() }), array(ExternalIdentitySchema), { auth: "admin" }), method(ExternalIdentityKeySchema, object({
|
|
81401
81771
|
userId: string(),
|
|
81402
81772
|
issuer: string()
|
|
@@ -98151,6 +98521,149 @@ function offered(received) {
|
|
|
98151
98521
|
};
|
|
98152
98522
|
}
|
|
98153
98523
|
offered(HA_AS), withheld(HOMEKIT_REASON), withheld(ALEXA_REASON), withheld(GOOGLE_REASON), withheld(MATTER_REASON);
|
|
98524
|
+
var PowerSwitchRefusedError = class extends Error {
|
|
98525
|
+
reason;
|
|
98526
|
+
constructor(reason, message) {
|
|
98527
|
+
super(message);
|
|
98528
|
+
this.name = "PowerSwitchRefusedError";
|
|
98529
|
+
this.reason = reason;
|
|
98530
|
+
}
|
|
98531
|
+
};
|
|
98532
|
+
/** `true` / `false` from the owner slice, `null` when the hinted field is
|
|
98533
|
+
* absent or not of the hinted shape. */
|
|
98534
|
+
function powerOnFromSlice(hint, slice) {
|
|
98535
|
+
const value = slice?.[hint.field];
|
|
98536
|
+
switch (hint.kind) {
|
|
98537
|
+
case "field": return typeof value === "boolean" ? value : null;
|
|
98538
|
+
case "methods": return typeof value === "string" ? !hint.offValues.includes(value) : null;
|
|
98539
|
+
case "mode": return typeof value === "string" ? value !== hint.offValue : null;
|
|
98540
|
+
}
|
|
98541
|
+
}
|
|
98542
|
+
function ownerMethod(owner, name, capName) {
|
|
98543
|
+
const fn = Reflect.get(owner, name);
|
|
98544
|
+
if (typeof fn !== "function") throw new PowerSwitchRefusedError("owner-method-missing", `${capName} provider does not serve '${name}', which its power hint names`);
|
|
98545
|
+
return async (input) => fn.call(owner, input);
|
|
98546
|
+
}
|
|
98547
|
+
async function lastNonOffMode(host, capName, hint) {
|
|
98548
|
+
const isMode = (v) => typeof v === "string" && v.length > 0 && v !== hint.offValue;
|
|
98549
|
+
const fromHub = (await host.readHubSlice(capName).catch(() => null))?.[hint.lastField];
|
|
98550
|
+
if (isMode(fromHub)) return fromHub;
|
|
98551
|
+
const local = host.runtimeState.getCapState(capName)?.[hint.lastField];
|
|
98552
|
+
return isMode(local) ? local : null;
|
|
98553
|
+
}
|
|
98554
|
+
async function applyPower(host, capName, hint, owner, on) {
|
|
98555
|
+
const deviceId = host.deviceId;
|
|
98556
|
+
switch (hint.kind) {
|
|
98557
|
+
case "field":
|
|
98558
|
+
await ownerMethod(owner, hint.set, capName)({
|
|
98559
|
+
deviceId,
|
|
98560
|
+
on
|
|
98561
|
+
});
|
|
98562
|
+
return;
|
|
98563
|
+
case "methods":
|
|
98564
|
+
await ownerMethod(owner, on ? hint.on : hint.off, capName)({ deviceId });
|
|
98565
|
+
return;
|
|
98566
|
+
case "mode": {
|
|
98567
|
+
const set = ownerMethod(owner, hint.set, capName);
|
|
98568
|
+
if (!on) {
|
|
98569
|
+
await set({
|
|
98570
|
+
deviceId,
|
|
98571
|
+
mode: hint.offValue
|
|
98572
|
+
});
|
|
98573
|
+
return;
|
|
98574
|
+
}
|
|
98575
|
+
const mode = await lastNonOffMode(host, capName, hint);
|
|
98576
|
+
if (mode === null) throw new PowerSwitchRefusedError("no-last-mode", `device ${deviceId}: ${capName} has no last non-off mode to restore; pick a mode instead`);
|
|
98577
|
+
await set({
|
|
98578
|
+
deviceId,
|
|
98579
|
+
mode
|
|
98580
|
+
});
|
|
98581
|
+
return;
|
|
98582
|
+
}
|
|
98583
|
+
}
|
|
98584
|
+
}
|
|
98585
|
+
function hintedMethods(hint) {
|
|
98586
|
+
return hint.kind === "methods" ? [hint.on, hint.off] : [hint.set];
|
|
98587
|
+
}
|
|
98588
|
+
/** Whether `owner` serves every method its cap's power hint names. A media
|
|
98589
|
+
* player whose `turnOn` / `turnOff` are not served has no power, so no switch. */
|
|
98590
|
+
function powerServedBy(hint, owner) {
|
|
98591
|
+
if (hint === void 0) return false;
|
|
98592
|
+
return hintedMethods(hint).every((name) => typeof Reflect.get(owner, name) === "function");
|
|
98593
|
+
}
|
|
98594
|
+
/** Builds the `switch` provider and starts the slice projection. Exported
|
|
98595
|
+
* for the specs; providers call `registerPowerSwitch`. */
|
|
98596
|
+
function buildPowerSwitch(host, cap, owner) {
|
|
98597
|
+
const hint = cap.power;
|
|
98598
|
+
if (hint === void 0) throw new Error(`capability '${cap.name}' has no power hint: it has no switch to project`);
|
|
98599
|
+
const read = () => powerOnFromSlice(hint, host.runtimeState.getCapState(cap.name));
|
|
98600
|
+
const project = () => {
|
|
98601
|
+
const on = read();
|
|
98602
|
+
const current = host.runtimeState.getCapState(switchCapability.name);
|
|
98603
|
+
if (current !== void 0 && current["on"] === on) return;
|
|
98604
|
+
const next = {
|
|
98605
|
+
on,
|
|
98606
|
+
lastChangedAt: Date.now()
|
|
98607
|
+
};
|
|
98608
|
+
host.runtimeState.setCapState(switchCapability.name, next);
|
|
98609
|
+
};
|
|
98610
|
+
const stop = host.runtimeState.subscribeCap(cap.name, project);
|
|
98611
|
+
if (host.runtimeState.getCapState(cap.name) !== void 0) project();
|
|
98612
|
+
return {
|
|
98613
|
+
provider: {
|
|
98614
|
+
getStatus: async () => {
|
|
98615
|
+
const current = host.runtimeState.getCapState(switchCapability.name);
|
|
98616
|
+
const lastChangedAt = typeof current?.["lastChangedAt"] === "number" ? current["lastChangedAt"] : 0;
|
|
98617
|
+
return {
|
|
98618
|
+
on: read(),
|
|
98619
|
+
lastChangedAt
|
|
98620
|
+
};
|
|
98621
|
+
},
|
|
98622
|
+
setState: async ({ on }) => applyPower(host, cap.name, hint, owner, on)
|
|
98623
|
+
},
|
|
98624
|
+
dispose: stop
|
|
98625
|
+
};
|
|
98626
|
+
}
|
|
98627
|
+
/**
|
|
98628
|
+
* Registers `switch` for a device whose `cap` carries a `power` hint, built
|
|
98629
|
+
* from `owner` (the provider the device registered for `cap`). Call it right
|
|
98630
|
+
* after `registerNativeCap(cap, owner)`.
|
|
98631
|
+
*/
|
|
98632
|
+
function registerPowerSwitch(device, cap, owner) {
|
|
98633
|
+
const deviceId = device.ctx.id;
|
|
98634
|
+
if (cap.power !== void 0 && !powerServedBy(cap.power, owner)) {
|
|
98635
|
+
device.ctx.logger.debug("power switch: owner serves no power control, no switch registered", {
|
|
98636
|
+
tags: { deviceId },
|
|
98637
|
+
meta: { capName: cap.name }
|
|
98638
|
+
});
|
|
98639
|
+
return () => {};
|
|
98640
|
+
}
|
|
98641
|
+
const host = {
|
|
98642
|
+
deviceId,
|
|
98643
|
+
runtimeState: device.runtimeState,
|
|
98644
|
+
registerNativeCap: (c, p) => device.ctx.registerNativeCap(c, p),
|
|
98645
|
+
readHubSlice: async (capName) => {
|
|
98646
|
+
try {
|
|
98647
|
+
return await device.ctx.api.deviceState.getCapSlice.query({
|
|
98648
|
+
deviceId,
|
|
98649
|
+
capName
|
|
98650
|
+
});
|
|
98651
|
+
} catch (err) {
|
|
98652
|
+
device.ctx.logger.warn("power switch: hub slice read failed", {
|
|
98653
|
+
tags: { deviceId },
|
|
98654
|
+
meta: {
|
|
98655
|
+
capName,
|
|
98656
|
+
error: err instanceof Error ? err.message : String(err)
|
|
98657
|
+
}
|
|
98658
|
+
});
|
|
98659
|
+
return null;
|
|
98660
|
+
}
|
|
98661
|
+
}
|
|
98662
|
+
};
|
|
98663
|
+
const built = buildPowerSwitch(host, cap, owner);
|
|
98664
|
+
host.registerNativeCap(switchCapability, built.provider);
|
|
98665
|
+
return built.dispose;
|
|
98666
|
+
}
|
|
98154
98667
|
Object.freeze({
|
|
98155
98668
|
"accessories.getStatus": [{
|
|
98156
98669
|
name: "deviceId",
|
|
@@ -102723,6 +103236,38 @@ function bestLocationMatch(externalName, existing, threshold = .8) {
|
|
|
102723
103236
|
return best;
|
|
102724
103237
|
}
|
|
102725
103238
|
/**
|
|
103239
|
+
* Names chosen when an integration or a Gateway device is created.
|
|
103240
|
+
* A stored name is never rewritten from these helpers.
|
|
103241
|
+
*/
|
|
103242
|
+
var HOME_SUFFIX = "Home";
|
|
103243
|
+
function collapse(value) {
|
|
103244
|
+
return value.trim().replace(/\s+/g, " ");
|
|
103245
|
+
}
|
|
103246
|
+
/** "KLF-200" → "KLF200". A hyphen between words ("Home Hub") stays. */
|
|
103247
|
+
function compactModelToken(value) {
|
|
103248
|
+
return value.replace(/([A-Za-z])-(\d)/g, "$1$2");
|
|
103249
|
+
}
|
|
103250
|
+
/** Prefill for a new integration: "<provider> - Home". The operator can edit it. */
|
|
103251
|
+
function defaultIntegrationName(providerLabel) {
|
|
103252
|
+
const label = collapse(providerLabel);
|
|
103253
|
+
if (label.length === 0) return HOME_SUFFIX;
|
|
103254
|
+
return `${label} - ${HOME_SUFFIX}`;
|
|
103255
|
+
}
|
|
103256
|
+
/**
|
|
103257
|
+
* A Gateway device: "<Brand> <Model>". An unknown model is the brand alone
|
|
103258
|
+
* (the caller passes the brand-level fallback it already has, e.g. "Velux KLF-200").
|
|
103259
|
+
*/
|
|
103260
|
+
function gatewayDeviceName(brand, model) {
|
|
103261
|
+
const brandPart = compactModelToken(collapse(brand));
|
|
103262
|
+
const raw = collapse(model ?? "");
|
|
103263
|
+
if (raw.length === 0) return brandPart;
|
|
103264
|
+
const modelPart = compactModelToken(raw);
|
|
103265
|
+
const prefix = `${brandPart.toLowerCase()} `;
|
|
103266
|
+
if (modelPart.toLowerCase() === brandPart.toLowerCase()) return brandPart;
|
|
103267
|
+
if (modelPart.toLowerCase().startsWith(prefix)) return modelPart;
|
|
103268
|
+
return `${brandPart} ${modelPart}`;
|
|
103269
|
+
}
|
|
103270
|
+
/**
|
|
102726
103271
|
* Closes the gap D49 leaves: an integration deleted while its provider was down never emits an
|
|
102727
103272
|
* event the provider sees. An integration id absent from an ANSWERED list is only a suspect; its
|
|
102728
103273
|
* devices go (through the provider's own removeDevices) when a SECOND answered read, at least
|
|
@@ -127693,9 +128238,10 @@ var HM_KEY_PRESS_DATAPOINTS = [
|
|
|
127693
128238
|
/** Set form for O(1) fire-detection membership tests. */
|
|
127694
128239
|
var HM_KEY_PRESS_SET = new Set(HM_KEY_PRESS_DATAPOINTS);
|
|
127695
128240
|
/** Cold-start event-emitter slice; vocabulary supplied per-device. */
|
|
127696
|
-
function coldEventEmitter(
|
|
128241
|
+
function coldEventEmitter(vocabulary) {
|
|
127697
128242
|
return {
|
|
127698
|
-
eventTypes:
|
|
128243
|
+
eventTypes: eventTypesOfVocabulary(vocabulary),
|
|
128244
|
+
vocabulary: [...vocabulary],
|
|
127699
128245
|
lastEvent: null,
|
|
127700
128246
|
eventCountSinceStart: 0
|
|
127701
128247
|
};
|
|
@@ -128539,7 +129085,7 @@ var HmActuatorDevice = class extends HmChildDevice {
|
|
|
128539
129085
|
}
|
|
128540
129086
|
registerClimateCap() {
|
|
128541
129087
|
const channel = this.actuatorChannel;
|
|
128542
|
-
|
|
129088
|
+
const provider = {
|
|
128543
129089
|
getStatus: async () => this.runtimeState.getCapState("climate-control") ?? COLD_CLIMATE,
|
|
128544
129090
|
setMode: async ({ mode }) => {
|
|
128545
129091
|
await this.requireFacade().climateSetMode(this.address, channel, toHmClimateMode(mode));
|
|
@@ -128555,7 +129101,9 @@ var HmActuatorDevice = class extends HmChildDevice {
|
|
|
128555
129101
|
setTargetHumidity: async () => this.unsupported("climate humidity control"),
|
|
128556
129102
|
setSwingVertical: async () => this.unsupported("climate vertical swing"),
|
|
128557
129103
|
setSwingHorizontal: async () => this.unsupported("climate horizontal swing")
|
|
128558
|
-
}
|
|
129104
|
+
};
|
|
129105
|
+
this.ctx.registerNativeCap(climateControlCapability, provider);
|
|
129106
|
+
registerPowerSwitch(this, climateControlCapability, provider);
|
|
128559
129107
|
this.runtimeState.setCapState("climate-control", COLD_CLIMATE);
|
|
128560
129108
|
this.registeredCap = "climate-control";
|
|
128561
129109
|
}
|
|
@@ -128773,6 +129321,64 @@ var HmSensorDevice = class extends HmChildDevice {
|
|
|
128773
129321
|
}
|
|
128774
129322
|
};
|
|
128775
129323
|
//#endregion
|
|
129324
|
+
//#region src/devices/hm-key-vocabulary.ts
|
|
129325
|
+
var PRESS_MEANING = {
|
|
129326
|
+
PRESS_SHORT: {
|
|
129327
|
+
label: "Short press",
|
|
129328
|
+
kind: "press"
|
|
129329
|
+
},
|
|
129330
|
+
PRESS_LONG: {
|
|
129331
|
+
label: "Long press",
|
|
129332
|
+
kind: "long-press"
|
|
129333
|
+
},
|
|
129334
|
+
PRESS_LONG_START: {
|
|
129335
|
+
label: "Long press started",
|
|
129336
|
+
kind: "long-press-start"
|
|
129337
|
+
},
|
|
129338
|
+
PRESS_LONG_RELEASE: {
|
|
129339
|
+
label: "Long press released",
|
|
129340
|
+
kind: "release"
|
|
129341
|
+
},
|
|
129342
|
+
PRESS_CONT: {
|
|
129343
|
+
label: "Long press held",
|
|
129344
|
+
kind: "repeat"
|
|
129345
|
+
}
|
|
129346
|
+
};
|
|
129347
|
+
/** The channels of a device that are buttons, in channel order. */
|
|
129348
|
+
function hmKeyChannels(device) {
|
|
129349
|
+
return mapHmDeviceChannels(device).filter(({ mapping }) => mapping.capabilities.includes("event-emitter")).map(({ channel }) => channel);
|
|
129350
|
+
}
|
|
129351
|
+
/** The presses one key channel has; the standard set when it lists none. */
|
|
129352
|
+
function pressesOf(channel) {
|
|
129353
|
+
const listed = new Set((channel.dataPoints ?? []).map((dataPoint) => dataPoint.parameter).filter((parameter) => HM_KEY_PRESS_SET.has(parameter)));
|
|
129354
|
+
if (listed.size === 0) return HM_KEY_PRESS_DATAPOINTS;
|
|
129355
|
+
return HM_KEY_PRESS_DATAPOINTS.filter((parameter) => listed.has(parameter));
|
|
129356
|
+
}
|
|
129357
|
+
function entryOf(parameter, source) {
|
|
129358
|
+
const meaning = PRESS_MEANING[parameter];
|
|
129359
|
+
if (meaning === void 0) return {
|
|
129360
|
+
id: parameter,
|
|
129361
|
+
source,
|
|
129362
|
+
label: parameter
|
|
129363
|
+
};
|
|
129364
|
+
return {
|
|
129365
|
+
id: parameter,
|
|
129366
|
+
source,
|
|
129367
|
+
label: meaning.label,
|
|
129368
|
+
kind: meaning.kind
|
|
129369
|
+
};
|
|
129370
|
+
}
|
|
129371
|
+
function hmKeyVocabulary(device) {
|
|
129372
|
+
return hmKeyChannels(device).flatMap((channel, position) => {
|
|
129373
|
+
const index = channelIndexFromAddress(channel.address) ?? String(channel.index);
|
|
129374
|
+
const source = {
|
|
129375
|
+
id: index,
|
|
129376
|
+
label: `Button ${position + 1} (channel ${index})`
|
|
129377
|
+
};
|
|
129378
|
+
return pressesOf(channel).map((parameter) => entryOf(parameter, source));
|
|
129379
|
+
});
|
|
129380
|
+
}
|
|
129381
|
+
//#endregion
|
|
128776
129382
|
//#region src/devices/hm-event-emitter-device.ts
|
|
128777
129383
|
/**
|
|
128778
129384
|
* Event-emitter child config: the persisted native press vocabulary for the
|
|
@@ -128783,31 +129389,93 @@ var hmEventEmitterSchema = hmChildSchema.extend({ eventTypes: array(string()).op
|
|
|
128783
129389
|
/**
|
|
128784
129390
|
* ONE Homematic event-emitter accessory child collapsing all of a device's key
|
|
128785
129391
|
* channels (HmIP-WRC* wall switches / HmIP-RC* remotes / KEY channels). The
|
|
128786
|
-
* event vocabulary is
|
|
128787
|
-
* datapoints (
|
|
128788
|
-
* `EventCategory.EventEmitted` with the button index (`:N` channel suffix)
|
|
128789
|
-
* `
|
|
129392
|
+
* event vocabulary is one source per key channel with that channel's native
|
|
129393
|
+
* `PRESS_*` datapoints, verbatim (`hm-key-vocabulary.ts`). Presses fire
|
|
129394
|
+
* `EventCategory.EventEmitted` with the button index (`:N` channel suffix)
|
|
129395
|
+
* as `sourceId`.
|
|
128790
129396
|
*/
|
|
128791
129397
|
var HmEventEmitterDevice = class extends HmChildDevice {
|
|
128792
|
-
|
|
129398
|
+
/** The tokens persisted at adoption: the vocabulary of last resort. */
|
|
129399
|
+
persistedEventTypes;
|
|
129400
|
+
/** The vocabulary read from the CCU's channel list, once it answered. */
|
|
129401
|
+
#declared = null;
|
|
129402
|
+
/** Fires already reported as outside the vocabulary, as `source:token`. */
|
|
129403
|
+
#undeclaredLogged = /* @__PURE__ */ new Set();
|
|
128793
129404
|
#eventSeq = 0;
|
|
128794
129405
|
#eventCount = 0;
|
|
129406
|
+
/** Unsubscribe for the integration's state-change fan-out. */
|
|
129407
|
+
#snapshotUnsub = null;
|
|
128795
129408
|
constructor(ctx) {
|
|
128796
129409
|
super(ctx, hmEventEmitterSchema);
|
|
128797
129410
|
const persisted = this.config.values.eventTypes;
|
|
128798
|
-
this.
|
|
129411
|
+
this.persistedEventTypes = persisted && persisted.length > 0 ? persisted : HM_KEY_PRESS_DATAPOINTS;
|
|
128799
129412
|
this.registerEventEmitterCap();
|
|
128800
129413
|
this.attachValueChangedListener((event) => this.decodeKeyPress(event));
|
|
129414
|
+
if (this.integrationId !== void 0) this.#snapshotUnsub = homematicFacades.onSnapshot(this.integrationId, () => this.refreshDeclaredVocabulary());
|
|
129415
|
+
}
|
|
129416
|
+
/**
|
|
129417
|
+
* Rewrite the slice with the buttons once the CCU's channel list carries
|
|
129418
|
+
* them. A no-op while it does not, and after the buttons were declared.
|
|
129419
|
+
*/
|
|
129420
|
+
refreshDeclaredVocabulary() {
|
|
129421
|
+
if (this.#declared !== null) return;
|
|
129422
|
+
const vocabulary = this.vocabulary();
|
|
129423
|
+
if (this.#declared === null) return;
|
|
129424
|
+
const current = this.runtimeState.getCapState("event-emitter");
|
|
129425
|
+
this.runtimeState.setCapState("event-emitter", {
|
|
129426
|
+
eventTypes: eventTypesOfVocabulary(vocabulary),
|
|
129427
|
+
vocabulary: [...vocabulary],
|
|
129428
|
+
lastEvent: current?.lastEvent ?? null,
|
|
129429
|
+
eventCountSinceStart: current?.eventCountSinceStart ?? 0
|
|
129430
|
+
});
|
|
129431
|
+
}
|
|
129432
|
+
async removeDevice() {
|
|
129433
|
+
this.#snapshotUnsub?.();
|
|
129434
|
+
this.#snapshotUnsub = null;
|
|
129435
|
+
await super.removeDevice();
|
|
128801
129436
|
}
|
|
128802
129437
|
registerEventEmitterCap() {
|
|
128803
|
-
this.ctx.registerNativeCap(eventEmitterCapability, { getStatus: async () => this.runtimeState.getCapState("event-emitter") ?? coldEventEmitter(this.
|
|
128804
|
-
this.runtimeState.setCapState("event-emitter", coldEventEmitter(this.
|
|
129438
|
+
this.ctx.registerNativeCap(eventEmitterCapability, { getStatus: async () => this.runtimeState.getCapState("event-emitter") ?? coldEventEmitter(this.vocabulary()) });
|
|
129439
|
+
this.runtimeState.setCapState("event-emitter", coldEventEmitter(this.vocabulary()));
|
|
129440
|
+
}
|
|
129441
|
+
/**
|
|
129442
|
+
* The buttons and their presses, read LIVE from the CCU's channel list.
|
|
129443
|
+
*
|
|
129444
|
+
* Not from the child's config: that is written once, at adoption, so a
|
|
129445
|
+
* remote adopted before the vocabulary existed would never get its
|
|
129446
|
+
* buttons. While the CCU has not answered, the persisted tokens stand in,
|
|
129447
|
+
* with no button; the next write after it answers carries the buttons.
|
|
129448
|
+
*/
|
|
129449
|
+
vocabulary() {
|
|
129450
|
+
if (this.#declared !== null) return this.#declared;
|
|
129451
|
+
const device = this.resolveHmDevice();
|
|
129452
|
+
const live = device === null ? [] : hmKeyVocabulary(device);
|
|
129453
|
+
if (live.length === 0) return plainEventVocabulary(this.persistedEventTypes);
|
|
129454
|
+
this.#declared = live;
|
|
129455
|
+
return live;
|
|
129456
|
+
}
|
|
129457
|
+
/** A press the vocabulary does not declare is delivered, and said once. */
|
|
129458
|
+
noteUndeclared(vocabulary, eventType, sourceId) {
|
|
129459
|
+
if (this.#declared === null) return;
|
|
129460
|
+
if (findVocabularyEntry(vocabulary, eventType, sourceId ?? void 0) !== void 0) return;
|
|
129461
|
+
const key = `${sourceId ?? ""}:${eventType}`;
|
|
129462
|
+
if (this.#undeclaredLogged.has(key)) return;
|
|
129463
|
+
this.#undeclaredLogged.add(key);
|
|
129464
|
+
this.ctx.logger.warn("Homematic press is not in the declared event vocabulary", {
|
|
129465
|
+
tags: { deviceId: this.ctx.id },
|
|
129466
|
+
meta: {
|
|
129467
|
+
address: this.address,
|
|
129468
|
+
eventType,
|
|
129469
|
+
sourceId
|
|
129470
|
+
}
|
|
129471
|
+
});
|
|
128805
129472
|
}
|
|
128806
129473
|
/**
|
|
128807
129474
|
* Translate a key-channel `PRESS_*` datapoint into an `EventFire`: emit
|
|
128808
129475
|
* `EventCategory.EventEmitted` on the bus and write the `event-emitter`
|
|
128809
129476
|
* slice. The `eventType` is the native datapoint name VERBATIM; the button
|
|
128810
|
-
* index (`:N` suffix of the channel address)
|
|
129477
|
+
* index (`:N` suffix of the channel address) is the fire's `sourceId`, and
|
|
129478
|
+
* stays in `data.channel` for readers older than the vocabulary.
|
|
128811
129479
|
* Non-key datapoints and value resets are ignored.
|
|
128812
129480
|
*/
|
|
128813
129481
|
decodeKeyPress(event) {
|
|
@@ -128819,6 +129487,7 @@ var HmEventEmitterDevice = class extends HmChildDevice {
|
|
|
128819
129487
|
const fire = {
|
|
128820
129488
|
deviceId: this.id,
|
|
128821
129489
|
eventType: parameter,
|
|
129490
|
+
...channelIndex !== null ? { sourceId: channelIndex } : {},
|
|
128822
129491
|
data: channelIndex !== null ? { channel: channelIndex } : {},
|
|
128823
129492
|
timestamp: now,
|
|
128824
129493
|
seq: ++this.#eventSeq
|
|
@@ -128829,8 +129498,11 @@ var HmEventEmitterDevice = class extends HmChildDevice {
|
|
|
128829
129498
|
deviceId: this.id,
|
|
128830
129499
|
addonId: this.ctx.deviceMeta.addonId
|
|
128831
129500
|
}, fire));
|
|
129501
|
+
const vocabulary = this.vocabulary();
|
|
129502
|
+
this.noteUndeclared(vocabulary, parameter, channelIndex);
|
|
128832
129503
|
const slice = {
|
|
128833
|
-
eventTypes:
|
|
129504
|
+
eventTypes: eventTypesOfVocabulary(vocabulary),
|
|
129505
|
+
vocabulary: [...vocabulary],
|
|
128834
129506
|
lastEvent: fire,
|
|
128835
129507
|
eventCountSinceStart: ++this.#eventCount
|
|
128836
129508
|
};
|
|
@@ -129538,7 +130210,7 @@ function buildCcuGatewayCandidate(input) {
|
|
|
129538
130210
|
const adoptedId = input.adopted.get(nativeId) ?? null;
|
|
129539
130211
|
return {
|
|
129540
130212
|
childNativeId: nativeId,
|
|
129541
|
-
name:
|
|
130213
|
+
name: gatewayDeviceName("Homematic", "CCU3"),
|
|
129542
130214
|
type: DeviceType.Gateway,
|
|
129543
130215
|
status: input.online ? "online" : "offline",
|
|
129544
130216
|
metadata: {
|
|
@@ -129807,7 +130479,7 @@ function buildHmAdoptionProvider(deps) {
|
|
|
129807
130479
|
const { deviceId } = await adoptGateway({
|
|
129808
130480
|
integrationId,
|
|
129809
130481
|
nativeId,
|
|
129810
|
-
name: perCandidate?.[nativeId]?.name ??
|
|
130482
|
+
name: perCandidate?.[nativeId]?.name ?? gatewayDeviceName("Homematic", "CCU3")
|
|
129811
130483
|
});
|
|
129812
130484
|
adopted.push({
|
|
129813
130485
|
childNativeId: nativeId,
|
|
@@ -130010,7 +130682,7 @@ function homematicDiscoveryCandidates(proposals) {
|
|
|
130010
130682
|
return proposals.map((found) => ({
|
|
130011
130683
|
stableId: `homematic:${found.id}`,
|
|
130012
130684
|
type: DeviceType.Gateway,
|
|
130013
|
-
suggestedName:
|
|
130685
|
+
suggestedName: defaultIntegrationName("Homematic"),
|
|
130014
130686
|
prefilledConfig: { host: found.host },
|
|
130015
130687
|
setupIntegration: true
|
|
130016
130688
|
}));
|