@camstack/addon-provider-homematic 1.2.190 → 1.2.191
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 +11 -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-BxV9YeD6.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-DsJZKFzR.mjs +26 -0
- package/dist/addon-provider-homematic.css +1 -1
- package/dist/addon.js +640 -51
- package/dist/addon.mjs +640 -51
- package/dist/{hostInit-CUN01TKv.mjs → hostInit-CVYnx4wT.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-DtvMyC4I.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.js
CHANGED
|
@@ -6053,7 +6053,7 @@ var ZodIssueCode = {
|
|
|
6053
6053
|
var ZodFirstPartyTypeKind;
|
|
6054
6054
|
ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
|
|
6055
6055
|
//#endregion
|
|
6056
|
-
//#region ../types/dist/sleep-
|
|
6056
|
+
//#region ../types/dist/sleep-D0roI_CZ.mjs
|
|
6057
6057
|
/**
|
|
6058
6058
|
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
6059
6059
|
* window to float samples (D455).
|
|
@@ -16208,6 +16208,10 @@ Object.freeze({
|
|
|
16208
16208
|
"path": "lastEvent.eventType",
|
|
16209
16209
|
"valueType": "string"
|
|
16210
16210
|
},
|
|
16211
|
+
{
|
|
16212
|
+
"path": "lastEvent.sourceId",
|
|
16213
|
+
"valueType": "string"
|
|
16214
|
+
},
|
|
16211
16215
|
{
|
|
16212
16216
|
"path": "lastEvent.timestamp",
|
|
16213
16217
|
"valueType": "number"
|
|
@@ -44785,9 +44789,12 @@ function convertLegacyWhen(half) {
|
|
|
44785
44789
|
* every caller — automations, Actions, and the notification centre, which runs
|
|
44786
44790
|
* only Actions (planning#473).
|
|
44787
44791
|
*/
|
|
44792
|
+
/** The longest one `wait` step lasts. It is cut by a restart of the run and does not survive a hub restart. */
|
|
44793
|
+
var WAIT_MAX_SECONDS = 3600;
|
|
44794
|
+
var WAIT_TOO_LONG = `a wait is at most one hour (${WAIT_MAX_SECONDS} s)`;
|
|
44788
44795
|
var AutomationWaitStepSchema = object({
|
|
44789
44796
|
kind: literal("wait"),
|
|
44790
|
-
seconds: number$1().min(0).max(
|
|
44797
|
+
seconds: number$1().min(0).max(WAIT_MAX_SECONDS, WAIT_TOO_LONG)
|
|
44791
44798
|
});
|
|
44792
44799
|
/** The legacy `deviceId` of a cap step: still READ, never written (D983). */
|
|
44793
44800
|
var LegacyStepDeviceSchema = union([
|
|
@@ -44857,39 +44864,227 @@ var elseNeedsIf = {
|
|
|
44857
44864
|
path: ["else"]
|
|
44858
44865
|
};
|
|
44859
44866
|
var GuardedWaitStepSchema = AutomationWaitStepSchema.extend(stepGuardShape).refine((step) => step.else === void 0 || step.if !== void 0, elseNeedsIf);
|
|
44860
|
-
var GuardedCapStepSchema = AutomationCapStepBaseSchema.extend(stepGuardShape).refine((step) => step.target !== void 0 || step.deviceId !== void 0, {
|
|
44861
|
-
message: "a cap step needs a target",
|
|
44862
|
-
path: ["target"]
|
|
44863
|
-
}).refine((step) => step.target?.kind !== "domain" || step.actionId !== void 0, {
|
|
44864
|
-
message: "a domain target needs the vocabulary action it applies to (actionId)",
|
|
44865
|
-
path: ["actionId"]
|
|
44866
|
-
}).refine((step) => step.else === void 0 || step.if !== void 0, elseNeedsIf);
|
|
44867
44867
|
/**
|
|
44868
44868
|
* A step of a STANDALONE list (an action, a scheduler point, a preset): the
|
|
44869
44869
|
* same two step kinds an automation runs, minus a guard that reads the
|
|
44870
44870
|
* automation's trigger, which such a list does not have.
|
|
44871
44871
|
*/
|
|
44872
|
-
var ActionStepSchema = discriminatedUnion("kind", [GuardedWaitStepSchema,
|
|
44872
|
+
var ActionStepSchema = discriminatedUnion("kind", [GuardedWaitStepSchema, AutomationCapStepBaseSchema.extend(stepGuardShape).refine((step) => step.target !== void 0 || step.deviceId !== void 0, {
|
|
44873
|
+
message: "a cap step needs a target",
|
|
44874
|
+
path: ["target"]
|
|
44875
|
+
}).refine((step) => step.target?.kind !== "domain" || step.actionId !== void 0, {
|
|
44876
|
+
message: "a domain target needs the vocabulary action it applies to (actionId)",
|
|
44877
|
+
path: ["actionId"]
|
|
44878
|
+
}).refine((step) => step.else === void 0 || step.if !== void 0, elseNeedsIf)]).superRefine((step, ctx) => {
|
|
44873
44879
|
if (step.if !== void 0 && hasTriggeredByLeaves(step.if)) ctx.addIssue({
|
|
44874
44880
|
code: "custom",
|
|
44875
44881
|
message: TRIGGERED_BY_NEEDS_AUTOMATION,
|
|
44876
44882
|
path: ["if"]
|
|
44877
44883
|
});
|
|
44878
44884
|
});
|
|
44885
|
+
/**
|
|
44886
|
+
* Flow control of an AUTOMATION's list (#500). A standalone list (an action, a
|
|
44887
|
+
* scheduler point, a preset) stays `wait` and `cap`: it has no run of its own
|
|
44888
|
+
* to end and no variable bag to write.
|
|
44889
|
+
*/
|
|
44890
|
+
var continueOnErrorShape = {
|
|
44891
|
+
/** A failure of this step is traced `failed-continued` and the next step runs. */
|
|
44892
|
+
continueOnError: literal(true).optional() };
|
|
44893
|
+
/** An automation's cap step: the shared guarded cap step, plus `continueOnError`. */
|
|
44894
|
+
var AutomationGuardedCapStepSchema = AutomationCapStepBaseSchema.extend({
|
|
44895
|
+
...stepGuardShape,
|
|
44896
|
+
...continueOnErrorShape
|
|
44897
|
+
}).refine((step) => step.target !== void 0 || step.deviceId !== void 0, {
|
|
44898
|
+
message: "a cap step needs a target",
|
|
44899
|
+
path: ["target"]
|
|
44900
|
+
}).refine((step) => step.target?.kind !== "domain" || step.actionId !== void 0, {
|
|
44901
|
+
message: "a domain target needs the vocabulary action it applies to (actionId)",
|
|
44902
|
+
path: ["actionId"]
|
|
44903
|
+
}).refine((step) => step.else === void 0 || step.if !== void 0, elseNeedsIf);
|
|
44904
|
+
/** End the run here, on purpose. `reason` may carry `{{vars.x}}` slots. */
|
|
44905
|
+
var AutomationStopStepSchema = object({
|
|
44906
|
+
kind: literal("stop"),
|
|
44907
|
+
reason: string().min(1, "a stop needs a reason: it is what the run trace shows").max(200),
|
|
44908
|
+
/** `ok`: the run ends as a success. `failed`: it ends as a failure, with the reason. */
|
|
44909
|
+
outcome: _enum(["ok", "failed"]),
|
|
44910
|
+
/** Stop only when this reads true; false or unknown does not stop. */
|
|
44911
|
+
if: AutomationWhenSchema.optional()
|
|
44912
|
+
});
|
|
44913
|
+
var SET_VAR_NAME_RE = /^[A-Za-z_][A-Za-z0-9_]{0,39}$/;
|
|
44914
|
+
/** Names the run itself writes and reads (`leaf` is what `triggered-by` judges): a step may not overwrite them. */
|
|
44915
|
+
var RESERVED_RUN_VARS = [
|
|
44916
|
+
"kind",
|
|
44917
|
+
"leaf",
|
|
44918
|
+
"at"
|
|
44919
|
+
];
|
|
44920
|
+
/**
|
|
44921
|
+
* Write variables into the run's bag, for the steps after it. SUBSTITUTION
|
|
44922
|
+
* only, never evaluation: a text value may carry `{{vars.x}}` slots.
|
|
44923
|
+
*/
|
|
44924
|
+
var AutomationSetStepSchema = object({
|
|
44925
|
+
kind: literal("set"),
|
|
44926
|
+
vars: record(string(), union([
|
|
44927
|
+
string().max(500),
|
|
44928
|
+
number$1(),
|
|
44929
|
+
boolean()
|
|
44930
|
+
])).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` }),
|
|
44931
|
+
/** Set only when this reads true; false or unknown leaves the bag as it is. */
|
|
44932
|
+
if: AutomationWhenSchema.optional()
|
|
44933
|
+
});
|
|
44934
|
+
var AutomationRunActionStepSchema = object({
|
|
44935
|
+
kind: literal("action"),
|
|
44936
|
+
/** An entry of the `actions` surface (`internal:<uuid>` or `<addonId>:<localId>`). */
|
|
44937
|
+
actionId: string().min(1),
|
|
44938
|
+
/** Values for the action's declared variables; the others take their default. */
|
|
44939
|
+
variables: record(string(), union([
|
|
44940
|
+
string(),
|
|
44941
|
+
number$1(),
|
|
44942
|
+
boolean()
|
|
44943
|
+
])).optional(),
|
|
44944
|
+
...continueOnErrorShape
|
|
44945
|
+
});
|
|
44946
|
+
/**
|
|
44947
|
+
* A step INSIDE a branch of a `choose`: a flow step with no condition of its
|
|
44948
|
+
* own (the branch is the condition) and no block inside it. Strict, so an `if`
|
|
44949
|
+
* written on such a step is refused rather than dropped.
|
|
44950
|
+
*/
|
|
44951
|
+
/** The longest a `wait-until` may wait: six hours. */
|
|
44952
|
+
var WAIT_UNTIL_TIMEOUT_MAX_S = 21600;
|
|
44953
|
+
/**
|
|
44954
|
+
* Pause the run until a condition is true (#500). The timeout is mandatory: a
|
|
44955
|
+
* run never waits without an end. `onTimeout` says what a wait that ran out
|
|
44956
|
+
* does: `continue` goes on to the next step, `stop` ends the run as a failure.
|
|
44957
|
+
* A condition that cannot be read is not "true": the wait goes on (D49).
|
|
44958
|
+
*/
|
|
44959
|
+
var AutomationWaitUntilStepSchema = object({
|
|
44960
|
+
kind: literal("wait-until"),
|
|
44961
|
+
when: AutomationWhenSchema,
|
|
44962
|
+
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)`),
|
|
44963
|
+
onTimeout: _enum(["continue", "stop"])
|
|
44964
|
+
}).strict();
|
|
44965
|
+
/** The step kinds that hold steps of their own, or pause on a condition: they nest two levels at most. */
|
|
44966
|
+
var BLOCK_STEP_KINDS = [
|
|
44967
|
+
"choose",
|
|
44968
|
+
"repeat",
|
|
44969
|
+
"parallel",
|
|
44970
|
+
"wait-until"
|
|
44971
|
+
];
|
|
44972
|
+
var NEST_TOO_DEEP = `steps nest two levels at most: a step inside a nested choose or repeat can be a plain step only`;
|
|
44973
|
+
function kindOf(input) {
|
|
44974
|
+
return typeof input === "object" && input !== null ? Reflect.get(input, "kind") : void 0;
|
|
44975
|
+
}
|
|
44976
|
+
/** Where the nesting ends, a block step is refused in words rather than as an unknown kind. */
|
|
44977
|
+
function nestTooDeep(issue) {
|
|
44978
|
+
const kind = kindOf(issue.input);
|
|
44979
|
+
return typeof kind === "string" && BLOCK_STEP_KINDS.includes(kind) ? NEST_TOO_DEEP : void 0;
|
|
44980
|
+
}
|
|
44981
|
+
var plainStepSchemas = [
|
|
44982
|
+
AutomationWaitStepSchema.strict(),
|
|
44983
|
+
AutomationCapStepBaseSchema.extend(continueOnErrorShape).strict().refine((step) => step.target !== void 0 || step.deviceId !== void 0, {
|
|
44984
|
+
message: "a cap step needs a target",
|
|
44985
|
+
path: ["target"]
|
|
44986
|
+
}).refine((step) => step.target?.kind !== "domain" || step.actionId !== void 0, {
|
|
44987
|
+
message: "a domain target needs the vocabulary action it applies to (actionId)",
|
|
44988
|
+
path: ["actionId"]
|
|
44989
|
+
}),
|
|
44990
|
+
AutomationStopStepSchema.omit({ if: true }).strict(),
|
|
44991
|
+
AutomationSetStepSchema.omit({ if: true }).strict(),
|
|
44992
|
+
AutomationRunActionStepSchema.strict()
|
|
44993
|
+
];
|
|
44994
|
+
/**
|
|
44995
|
+
* A plain step: a flow step with no condition of its own and no step inside
|
|
44996
|
+
* it. The second (last) level of nesting holds these only.
|
|
44997
|
+
*/
|
|
44998
|
+
var AutomationBranchStepSchema = discriminatedUnion("kind", plainStepSchemas, { error: nestTooDeep });
|
|
44999
|
+
/** A step that can run beside others: it writes no variable and does not end the run. */
|
|
45000
|
+
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");
|
|
45001
|
+
/**
|
|
45002
|
+
* Several steps at once (#500): all are started together and all are awaited.
|
|
45003
|
+
* A failure fails the run once the others finished, as in a sequence; a member
|
|
45004
|
+
* marked "continue if this fails" does not.
|
|
45005
|
+
*/
|
|
45006
|
+
var AutomationParallelStepSchema = object({
|
|
45007
|
+
kind: literal("parallel"),
|
|
45008
|
+
steps: array(AutomationParallelMemberSchema).min(2, "a parallel needs at least two steps").max(5, `a parallel takes at most 5 steps`)
|
|
45009
|
+
}).strict();
|
|
45010
|
+
var REPEAT_NEEDS_MAX = "a repeat on a condition needs a maximum number of iterations";
|
|
45011
|
+
/** A loop on a condition: the bound is mandatory, so a run never loops without an end. */
|
|
45012
|
+
var repeatConditionShape = {
|
|
45013
|
+
when: AutomationWhenSchema,
|
|
45014
|
+
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`),
|
|
45015
|
+
/** A pause between two iterations, never after the last. */
|
|
45016
|
+
waitS: number$1().int().min(1).max(WAIT_MAX_SECONDS, WAIT_TOO_LONG).optional()
|
|
45017
|
+
};
|
|
45018
|
+
/** What decides how many times a `repeat` runs. */
|
|
45019
|
+
var AutomationRepeatLoopSchema = discriminatedUnion("by", [
|
|
45020
|
+
object({
|
|
45021
|
+
by: literal("count"),
|
|
45022
|
+
count: number$1().int().min(1).max(20, `a repeat runs at most 20 times`)
|
|
45023
|
+
}).strict(),
|
|
45024
|
+
object({
|
|
45025
|
+
by: literal("while"),
|
|
45026
|
+
...repeatConditionShape
|
|
45027
|
+
}).strict(),
|
|
45028
|
+
object({
|
|
45029
|
+
by: literal("until"),
|
|
45030
|
+
...repeatConditionShape
|
|
45031
|
+
}).strict(),
|
|
45032
|
+
object({
|
|
45033
|
+
by: literal("forEach"),
|
|
45034
|
+
target: object({
|
|
45035
|
+
kind: literal("devices"),
|
|
45036
|
+
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`)
|
|
45037
|
+
}).strict()
|
|
45038
|
+
}).strict()
|
|
45039
|
+
]);
|
|
45040
|
+
/**
|
|
45041
|
+
* The same steps several times (#500). Every form is bounded at save, so a
|
|
45042
|
+
* run cannot loop without an end. A failure or a `stop` in the steps ends the
|
|
45043
|
+
* loop and the run, as in a sequence.
|
|
45044
|
+
*/
|
|
45045
|
+
function repeatSchemaOf(step) {
|
|
45046
|
+
return object({
|
|
45047
|
+
kind: literal("repeat"),
|
|
45048
|
+
loop: AutomationRepeatLoopSchema,
|
|
45049
|
+
steps: array(step).min(1, "a repeat needs at least one step").max(10, `a repeat takes at most 10 steps`)
|
|
45050
|
+
}).strict();
|
|
45051
|
+
}
|
|
45052
|
+
/**
|
|
45053
|
+
* One step, several ways (#500): the branches are read in order and the FIRST
|
|
45054
|
+
* whose condition is true runs; `else` runs when every branch is false. A
|
|
45055
|
+
* branch that cannot be read ends the choice: nothing runs, not the branches
|
|
45056
|
+
* after it and not the else (D49). The #472 `if` / `else` of a wait or cap
|
|
45057
|
+
* step is the one-branch case and stays as it is stored.
|
|
45058
|
+
*/
|
|
45059
|
+
function chooseSchemaOf(step) {
|
|
45060
|
+
const steps = array(step).max(10);
|
|
45061
|
+
return object({
|
|
45062
|
+
kind: literal("choose"),
|
|
45063
|
+
branches: array(object({
|
|
45064
|
+
if: AutomationWhenSchema,
|
|
45065
|
+
steps: steps.min(1, "a branch needs at least one step")
|
|
45066
|
+
})).min(1, "a choose needs at least one branch").max(6, `a choose takes at most 6 branches`),
|
|
45067
|
+
else: steps.optional()
|
|
45068
|
+
});
|
|
45069
|
+
}
|
|
45070
|
+
var AutomationBodyStepSchema = discriminatedUnion("kind", [
|
|
45071
|
+
...plainStepSchemas,
|
|
45072
|
+
AutomationWaitUntilStepSchema,
|
|
45073
|
+
AutomationParallelStepSchema,
|
|
45074
|
+
chooseSchemaOf(AutomationBranchStepSchema),
|
|
45075
|
+
repeatSchemaOf(AutomationBranchStepSchema)
|
|
45076
|
+
]);
|
|
45077
|
+
var AutomationRepeatStepSchema = repeatSchemaOf(AutomationBodyStepSchema);
|
|
44879
45078
|
var AutomationActionSchema = discriminatedUnion("kind", [
|
|
44880
45079
|
GuardedWaitStepSchema,
|
|
44881
|
-
|
|
44882
|
-
|
|
44883
|
-
|
|
44884
|
-
|
|
44885
|
-
|
|
44886
|
-
|
|
44887
|
-
|
|
44888
|
-
|
|
44889
|
-
number$1(),
|
|
44890
|
-
boolean()
|
|
44891
|
-
])).optional()
|
|
44892
|
-
}),
|
|
45080
|
+
AutomationGuardedCapStepSchema,
|
|
45081
|
+
AutomationStopStepSchema,
|
|
45082
|
+
AutomationSetStepSchema,
|
|
45083
|
+
chooseSchemaOf(AutomationBodyStepSchema),
|
|
45084
|
+
AutomationWaitUntilStepSchema,
|
|
45085
|
+
AutomationParallelStepSchema,
|
|
45086
|
+
AutomationRepeatStepSchema,
|
|
45087
|
+
AutomationRunActionStepSchema,
|
|
44893
45088
|
object({
|
|
44894
45089
|
kind: literal("code"),
|
|
44895
45090
|
/** Compiled into the automation's OWN block by esbuild — not a third
|
|
@@ -44952,11 +45147,6 @@ function convertLegacyRecipe(legacy) {
|
|
|
44952
45147
|
...rest
|
|
44953
45148
|
};
|
|
44954
45149
|
}
|
|
44955
|
-
/**
|
|
44956
|
-
* Where recipes are PARSED (the core-blocks cap, the MCP tool, the literal a
|
|
44957
|
-
* saved block carries): the new shape as it is, or the old shape converted to
|
|
44958
|
-
* it. The output type is always the new one.
|
|
44959
|
-
*/
|
|
44960
45150
|
var AutomationRecipeSchema = union([CurrentAutomationRecipeSchema, LegacyAutomationRecipeSchema.transform(convertLegacyRecipe)]);
|
|
44961
45151
|
var DETECTION_DESCRIPTIONS = {
|
|
44962
45152
|
deviceId: "the camera that saw it",
|
|
@@ -45041,12 +45231,16 @@ var HoldOverrideSchema = discriminatedUnion("mode", [object({ mode: literal("res
|
|
|
45041
45231
|
})]);
|
|
45042
45232
|
/** A missed edge up to this late still runs. */
|
|
45043
45233
|
var DEFAULT_MAX_LATE_MS = 10 * 6e4;
|
|
45234
|
+
var SchedulerStepSchema = ActionStepSchema.refine((step) => step.kind !== "wait" || step.seconds <= 300, {
|
|
45235
|
+
message: `a scheduler point waits at most five minutes (300 s); put a longer wait in an action`,
|
|
45236
|
+
path: ["seconds"]
|
|
45237
|
+
});
|
|
45044
45238
|
var SchedulerPointSchema = object({
|
|
45045
45239
|
id: string().min(1).max(64),
|
|
45046
45240
|
at: SchedulerTimeSpecSchema,
|
|
45047
45241
|
mode: SchedulerPointModeSchema,
|
|
45048
45242
|
/** The actions of an `edge` or `hold`; a `release` has none. */
|
|
45049
|
-
steps: array(
|
|
45243
|
+
steps: array(SchedulerStepSchema).max(20).default([]),
|
|
45050
45244
|
/** Checked when the point runs (an edge) or is applied (a hold). */
|
|
45051
45245
|
conditions: SchedulerStateTreeSchema.optional(),
|
|
45052
45246
|
/** Hold only; absent means `respect`. */
|
|
@@ -45314,18 +45508,46 @@ var StepTraceBaseSchema = object({
|
|
|
45314
45508
|
]).optional(),
|
|
45315
45509
|
/** Why the condition read what it read, in the evaluator's own words. */
|
|
45316
45510
|
conditionReason: string().optional(),
|
|
45317
|
-
/** `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. */
|
|
45511
|
+
/** `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). */
|
|
45318
45512
|
outcome: _enum([
|
|
45319
45513
|
"ok",
|
|
45320
45514
|
"error",
|
|
45321
45515
|
"not-run",
|
|
45322
45516
|
"empty",
|
|
45323
|
-
"skipped"
|
|
45517
|
+
"skipped",
|
|
45518
|
+
"failed-continued",
|
|
45519
|
+
"timed-out"
|
|
45324
45520
|
]),
|
|
45325
45521
|
message: string().optional()
|
|
45326
45522
|
});
|
|
45523
|
+
/** What a block step adds to its row: which list ran, what each branch read, how many rounds. */
|
|
45524
|
+
var blockTraceShape = {
|
|
45525
|
+
/** A `choose` step (#500): the list that ran, `branches.<n>` or `else`. Absent when none did. */
|
|
45526
|
+
branch: string().optional(),
|
|
45527
|
+
/** A `choose` step: what each branch read, in order, up to the one that decided. */
|
|
45528
|
+
branchChecks: array(object({
|
|
45529
|
+
condition: _enum([
|
|
45530
|
+
"true",
|
|
45531
|
+
"false",
|
|
45532
|
+
"unknown"
|
|
45533
|
+
]),
|
|
45534
|
+
conditionReason: string().optional()
|
|
45535
|
+
})).optional(),
|
|
45536
|
+
/** A `repeat` step (#500): how many times its steps ran. */
|
|
45537
|
+
iterations: number$1().int().optional()
|
|
45538
|
+
};
|
|
45539
|
+
/** A step one level down: it may be a block step itself, whose own steps are plain rows (the nesting ends there). */
|
|
45540
|
+
var NestedStepTraceSchema = StepTraceBaseSchema.extend({
|
|
45541
|
+
...blockTraceShape,
|
|
45542
|
+
steps: array(StepTraceBaseSchema).optional()
|
|
45543
|
+
});
|
|
45327
45544
|
/** A step trace; the `else` steps that ran are one level of the same shape (the nesting is bounded at one). */
|
|
45328
|
-
var AutomationStepTraceSchema = StepTraceBaseSchema.extend({
|
|
45545
|
+
var AutomationStepTraceSchema = StepTraceBaseSchema.extend({
|
|
45546
|
+
else: array(StepTraceBaseSchema).optional(),
|
|
45547
|
+
...blockTraceShape,
|
|
45548
|
+
/** A `choose` step: the steps of the list that ran. A `parallel`: its members. A `repeat`: the LAST iteration. */
|
|
45549
|
+
steps: array(NestedStepTraceSchema).optional()
|
|
45550
|
+
});
|
|
45329
45551
|
var AutomationRunTraceSchema = object({
|
|
45330
45552
|
runId: string().min(1),
|
|
45331
45553
|
startedAt: number$1(),
|
|
@@ -45732,7 +45954,9 @@ var AddonHttpRouteSchema = object({
|
|
|
45732
45954
|
]).optional(),
|
|
45733
45955
|
description: string().optional(),
|
|
45734
45956
|
/** The hub limits this route per client address before the handler runs. */
|
|
45735
|
-
rateLimit: _enum(["auth"]).optional()
|
|
45957
|
+
rateLimit: _enum(["auth"]).optional(),
|
|
45958
|
+
/** Served once per integration instance; the handler reads `instanceId`. */
|
|
45959
|
+
perInstance: boolean().optional()
|
|
45736
45960
|
});
|
|
45737
45961
|
/**
|
|
45738
45962
|
* Cross-process route invocation envelope. The hub captures the
|
|
@@ -45749,6 +45973,8 @@ var InvokeRequestSchema = object({
|
|
|
45749
45973
|
query: record(string(), string()),
|
|
45750
45974
|
body: unknown(),
|
|
45751
45975
|
headers: record(string(), string()),
|
|
45976
|
+
/** The instance the hub resolved for a `perInstance` route. */
|
|
45977
|
+
instanceId: string().optional(),
|
|
45752
45978
|
user: object({
|
|
45753
45979
|
id: string(),
|
|
45754
45980
|
username: string(),
|
|
@@ -56441,25 +56667,89 @@ var enumSensorCapability = {
|
|
|
56441
56667
|
* whether persisting is worth a SQLite commit. */
|
|
56442
56668
|
volatileStateFields: ["lastFetchedAt", "timestamp"]
|
|
56443
56669
|
};
|
|
56670
|
+
var EventVocabularyKindSchema = _enum([
|
|
56671
|
+
"press",
|
|
56672
|
+
"long-press",
|
|
56673
|
+
"long-press-start",
|
|
56674
|
+
"release",
|
|
56675
|
+
"repeat",
|
|
56676
|
+
"double-press",
|
|
56677
|
+
"other"
|
|
56678
|
+
]);
|
|
56679
|
+
/** The part of the device an event comes from: a button, a channel. */
|
|
56680
|
+
var EventVocabularySourceSchema = object({
|
|
56681
|
+
id: string().min(1),
|
|
56682
|
+
label: string().min(1)
|
|
56683
|
+
});
|
|
56684
|
+
/** One scalar field of an event's `data`, by dotted path. */
|
|
56685
|
+
var EventVocabularyFieldSchema = object({
|
|
56686
|
+
path: string().min(1),
|
|
56687
|
+
kind: _enum([
|
|
56688
|
+
"string",
|
|
56689
|
+
"number",
|
|
56690
|
+
"boolean",
|
|
56691
|
+
"enum"
|
|
56692
|
+
]),
|
|
56693
|
+
enumValues: array(string()).optional(),
|
|
56694
|
+
label: string().min(1).optional()
|
|
56695
|
+
});
|
|
56696
|
+
var EventVocabularyEntrySchema = object({
|
|
56697
|
+
/** The native token, verbatim. */
|
|
56698
|
+
id: string().min(1),
|
|
56699
|
+
source: EventVocabularySourceSchema.optional(),
|
|
56700
|
+
label: string().min(1),
|
|
56701
|
+
description: string().optional(),
|
|
56702
|
+
kind: EventVocabularyKindSchema.optional(),
|
|
56703
|
+
payload: array(EventVocabularyFieldSchema).optional()
|
|
56704
|
+
});
|
|
56705
|
+
/**
|
|
56706
|
+
* The vocabulary of a source that declares tokens and nothing else: one
|
|
56707
|
+
* entry per token, labelled with the token itself.
|
|
56708
|
+
*/
|
|
56709
|
+
function plainEventVocabulary(eventTypes) {
|
|
56710
|
+
return [...new Set(eventTypes)].filter((eventType) => eventType !== "").map((eventType) => ({
|
|
56711
|
+
id: eventType,
|
|
56712
|
+
label: eventType
|
|
56713
|
+
}));
|
|
56714
|
+
}
|
|
56715
|
+
/** The native tokens of a vocabulary, each once, in declaration order. */
|
|
56716
|
+
function eventTypesOfVocabulary(vocabulary) {
|
|
56717
|
+
return [...new Set(vocabulary.map((entry) => entry.id))];
|
|
56718
|
+
}
|
|
56719
|
+
/** The entry a fire belongs to: same token, same source (or both without one). */
|
|
56720
|
+
function findVocabularyEntry(vocabulary, eventType, sourceId) {
|
|
56721
|
+
return vocabulary.find((entry) => entry.id === eventType && entry.source?.id === sourceId);
|
|
56722
|
+
}
|
|
56444
56723
|
/**
|
|
56445
56724
|
* Generic stateless event emitter. Installed on a `DeviceType.EventEmitter`
|
|
56446
56725
|
* device. Carries the device's EXACT declared event vocabulary verbatim
|
|
56447
56726
|
* (NO normalization). Two shapes:
|
|
56448
|
-
* - structured source (HA `event.*` entity) → `
|
|
56449
|
-
* declared
|
|
56450
|
-
* - generic/legacy source (HA bus events, e.g. zha_event) → `
|
|
56727
|
+
* - structured source (HA `event.*` entity) → `vocabulary` is the fixed
|
|
56728
|
+
* declared set (e.g. press_short, press_long, …).
|
|
56729
|
+
* - generic/legacy source (HA bus events, e.g. zha_event) → `vocabulary`
|
|
56451
56730
|
* is [] (open) and `lastEvent.data` carries the complex payload.
|
|
56731
|
+
* `vocabulary` (D1044) names each event for a person and types it for a
|
|
56732
|
+
* rule; `eventTypes` is its list of native tokens, kept for older readers.
|
|
56733
|
+
* A fire names the part of the device it came from in `sourceId` when the
|
|
56734
|
+
* vocabulary declares sources (a remote's buttons).
|
|
56452
56735
|
* `seq` is monotonic so two identical events still produce distinct slice writes.
|
|
56453
56736
|
*/
|
|
56454
56737
|
var EventFireSchema = object({
|
|
56455
56738
|
deviceId: number$1(),
|
|
56456
56739
|
eventType: string(),
|
|
56740
|
+
sourceId: string().optional(),
|
|
56457
56741
|
data: record(string(), unknown()).nullable(),
|
|
56458
56742
|
timestamp: number$1().meta(readingMeta("none")),
|
|
56459
56743
|
seq: number$1().meta(readingMeta("count"))
|
|
56460
56744
|
});
|
|
56461
56745
|
var EventEmitterStatusSchema = object({
|
|
56462
56746
|
eventTypes: array(string()),
|
|
56747
|
+
/**
|
|
56748
|
+
* Required of a provider by the type. A status written before the field
|
|
56749
|
+
* existed still parses, as an empty vocabulary: read it through
|
|
56750
|
+
* `readEventVocabulary`, which then answers with the plain tokens.
|
|
56751
|
+
*/
|
|
56752
|
+
vocabulary: array(EventVocabularyEntrySchema).default([]),
|
|
56463
56753
|
lastEvent: EventFireSchema.nullable(),
|
|
56464
56754
|
eventCountSinceStart: number$1().meta(readingMeta("count"))
|
|
56465
56755
|
});
|
|
@@ -71951,7 +72241,18 @@ var OauthIntegrationDescriptorSchema = object({
|
|
|
71951
72241
|
* The value is baked into the authorization code at `/authorize` and travels
|
|
71952
72242
|
* on the tokens, so editing this field changes FUTURE links only.
|
|
71953
72243
|
*/
|
|
71954
|
-
refreshTokenTtlSec: union([number$1().int().positive(), literal("never")]).optional()
|
|
72244
|
+
refreshTokenTtlSec: union([number$1().int().positive(), literal("never")]).optional(),
|
|
72245
|
+
/**
|
|
72246
|
+
* The integration instances an account can be linked to (planning#415),
|
|
72247
|
+
* beside the default one. `/api/oauth2/authorize?instance=<id>` is accepted
|
|
72248
|
+
* only for an id listed here; with no `instance=` the link is made to the
|
|
72249
|
+
* default instance, which is never listed and always accepted — it is the
|
|
72250
|
+
* address third parties already hold. Omit for a single-instance integration.
|
|
72251
|
+
*/
|
|
72252
|
+
instances: array(object({
|
|
72253
|
+
id: string(),
|
|
72254
|
+
displayName: string()
|
|
72255
|
+
})).optional()
|
|
71955
72256
|
});
|
|
71956
72257
|
method(_void(), OauthIntegrationDescriptorSchema, { auth: "admin" });
|
|
71957
72258
|
/**
|
|
@@ -78880,6 +79181,13 @@ var SsoBridgeClaimsSchema = object({
|
|
|
78880
79181
|
/** OAuth authorization-code binding — set only on `oauth-code` tokens. */
|
|
78881
79182
|
redirectUri: string().optional(),
|
|
78882
79183
|
integrationId: string().optional(),
|
|
79184
|
+
/**
|
|
79185
|
+
* The integration INSTANCE an OAuth link was made for (planning#415). Set on
|
|
79186
|
+
* `oauth-code`, `oauth-access` and `oauth-refresh` tokens of a link made
|
|
79187
|
+
* with `instance=`; absent on a link to the default instance. A cloud relay
|
|
79188
|
+
* reads it off the access token to route; the hub answers from the session.
|
|
79189
|
+
*/
|
|
79190
|
+
instanceId: string().optional(),
|
|
78883
79191
|
/** JWT ID — unique per issued code; consumed-set enforces single-use. */
|
|
78884
79192
|
jti: string().optional(),
|
|
78885
79193
|
/** PKCE S256 challenge — set only on `oauth-code` tokens issued to a public
|
|
@@ -81258,6 +81566,8 @@ var OauthSessionSummarySchema = object({
|
|
|
81258
81566
|
userId: string(),
|
|
81259
81567
|
username: string(),
|
|
81260
81568
|
integrationId: string(),
|
|
81569
|
+
/** The instance the link was made for; `null` = the default instance. */
|
|
81570
|
+
instanceId: string().nullable().optional(),
|
|
81261
81571
|
scopes: array(TokenScopeSchema),
|
|
81262
81572
|
createdAt: number$1(),
|
|
81263
81573
|
lastUsedAt: number$1(),
|
|
@@ -81357,6 +81667,9 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(_void(), ob
|
|
|
81357
81667
|
access: "view"
|
|
81358
81668
|
}), method(object({
|
|
81359
81669
|
integrationId: string(),
|
|
81670
|
+
/** The integration instance the link is for. Omit for the default
|
|
81671
|
+
* instance — never pass the addon id to mean it. */
|
|
81672
|
+
instanceId: string().optional(),
|
|
81360
81673
|
userId: string(),
|
|
81361
81674
|
username: string(),
|
|
81362
81675
|
scopes: array(TokenScopeSchema),
|
|
@@ -81395,7 +81708,13 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(_void(), ob
|
|
|
81395
81708
|
}), method(object({ token: string() }), object({
|
|
81396
81709
|
userId: string(),
|
|
81397
81710
|
username: string(),
|
|
81398
|
-
scopes: array(TokenScopeSchema)
|
|
81711
|
+
scopes: array(TokenScopeSchema),
|
|
81712
|
+
/** The instance the link was made for, read from the SESSION.
|
|
81713
|
+
* Absent = the default instance. `oauthLinkServesInstance` is the
|
|
81714
|
+
* helper a per-instance route calls to compare it with the instance
|
|
81715
|
+
* of its path; no route declares `perInstance` yet (the Alexa
|
|
81716
|
+
* per-instance route, T3, is the first consumer). */
|
|
81717
|
+
instanceId: string().optional()
|
|
81399
81718
|
}).nullable(), { access: "view" }), method(object({ userId: string() }), array(ExternalIdentitySchema), { auth: "admin" }), method(ExternalIdentityKeySchema, object({
|
|
81400
81719
|
userId: string(),
|
|
81401
81720
|
issuer: string()
|
|
@@ -98150,6 +98469,149 @@ function offered(received) {
|
|
|
98150
98469
|
};
|
|
98151
98470
|
}
|
|
98152
98471
|
offered(HA_AS), withheld(HOMEKIT_REASON), withheld(ALEXA_REASON), withheld(GOOGLE_REASON), withheld(MATTER_REASON);
|
|
98472
|
+
var PowerSwitchRefusedError = class extends Error {
|
|
98473
|
+
reason;
|
|
98474
|
+
constructor(reason, message) {
|
|
98475
|
+
super(message);
|
|
98476
|
+
this.name = "PowerSwitchRefusedError";
|
|
98477
|
+
this.reason = reason;
|
|
98478
|
+
}
|
|
98479
|
+
};
|
|
98480
|
+
/** `true` / `false` from the owner slice, `null` when the hinted field is
|
|
98481
|
+
* absent or not of the hinted shape. */
|
|
98482
|
+
function powerOnFromSlice(hint, slice) {
|
|
98483
|
+
const value = slice?.[hint.field];
|
|
98484
|
+
switch (hint.kind) {
|
|
98485
|
+
case "field": return typeof value === "boolean" ? value : null;
|
|
98486
|
+
case "methods": return typeof value === "string" ? !hint.offValues.includes(value) : null;
|
|
98487
|
+
case "mode": return typeof value === "string" ? value !== hint.offValue : null;
|
|
98488
|
+
}
|
|
98489
|
+
}
|
|
98490
|
+
function ownerMethod(owner, name, capName) {
|
|
98491
|
+
const fn = Reflect.get(owner, name);
|
|
98492
|
+
if (typeof fn !== "function") throw new PowerSwitchRefusedError("owner-method-missing", `${capName} provider does not serve '${name}', which its power hint names`);
|
|
98493
|
+
return async (input) => fn.call(owner, input);
|
|
98494
|
+
}
|
|
98495
|
+
async function lastNonOffMode(host, capName, hint) {
|
|
98496
|
+
const isMode = (v) => typeof v === "string" && v.length > 0 && v !== hint.offValue;
|
|
98497
|
+
const fromHub = (await host.readHubSlice(capName).catch(() => null))?.[hint.lastField];
|
|
98498
|
+
if (isMode(fromHub)) return fromHub;
|
|
98499
|
+
const local = host.runtimeState.getCapState(capName)?.[hint.lastField];
|
|
98500
|
+
return isMode(local) ? local : null;
|
|
98501
|
+
}
|
|
98502
|
+
async function applyPower(host, capName, hint, owner, on) {
|
|
98503
|
+
const deviceId = host.deviceId;
|
|
98504
|
+
switch (hint.kind) {
|
|
98505
|
+
case "field":
|
|
98506
|
+
await ownerMethod(owner, hint.set, capName)({
|
|
98507
|
+
deviceId,
|
|
98508
|
+
on
|
|
98509
|
+
});
|
|
98510
|
+
return;
|
|
98511
|
+
case "methods":
|
|
98512
|
+
await ownerMethod(owner, on ? hint.on : hint.off, capName)({ deviceId });
|
|
98513
|
+
return;
|
|
98514
|
+
case "mode": {
|
|
98515
|
+
const set = ownerMethod(owner, hint.set, capName);
|
|
98516
|
+
if (!on) {
|
|
98517
|
+
await set({
|
|
98518
|
+
deviceId,
|
|
98519
|
+
mode: hint.offValue
|
|
98520
|
+
});
|
|
98521
|
+
return;
|
|
98522
|
+
}
|
|
98523
|
+
const mode = await lastNonOffMode(host, capName, hint);
|
|
98524
|
+
if (mode === null) throw new PowerSwitchRefusedError("no-last-mode", `device ${deviceId}: ${capName} has no last non-off mode to restore; pick a mode instead`);
|
|
98525
|
+
await set({
|
|
98526
|
+
deviceId,
|
|
98527
|
+
mode
|
|
98528
|
+
});
|
|
98529
|
+
return;
|
|
98530
|
+
}
|
|
98531
|
+
}
|
|
98532
|
+
}
|
|
98533
|
+
function hintedMethods(hint) {
|
|
98534
|
+
return hint.kind === "methods" ? [hint.on, hint.off] : [hint.set];
|
|
98535
|
+
}
|
|
98536
|
+
/** Whether `owner` serves every method its cap's power hint names. A media
|
|
98537
|
+
* player whose `turnOn` / `turnOff` are not served has no power, so no switch. */
|
|
98538
|
+
function powerServedBy(hint, owner) {
|
|
98539
|
+
if (hint === void 0) return false;
|
|
98540
|
+
return hintedMethods(hint).every((name) => typeof Reflect.get(owner, name) === "function");
|
|
98541
|
+
}
|
|
98542
|
+
/** Builds the `switch` provider and starts the slice projection. Exported
|
|
98543
|
+
* for the specs; providers call `registerPowerSwitch`. */
|
|
98544
|
+
function buildPowerSwitch(host, cap, owner) {
|
|
98545
|
+
const hint = cap.power;
|
|
98546
|
+
if (hint === void 0) throw new Error(`capability '${cap.name}' has no power hint: it has no switch to project`);
|
|
98547
|
+
const read = () => powerOnFromSlice(hint, host.runtimeState.getCapState(cap.name));
|
|
98548
|
+
const project = () => {
|
|
98549
|
+
const on = read();
|
|
98550
|
+
const current = host.runtimeState.getCapState(switchCapability.name);
|
|
98551
|
+
if (current !== void 0 && current["on"] === on) return;
|
|
98552
|
+
const next = {
|
|
98553
|
+
on,
|
|
98554
|
+
lastChangedAt: Date.now()
|
|
98555
|
+
};
|
|
98556
|
+
host.runtimeState.setCapState(switchCapability.name, next);
|
|
98557
|
+
};
|
|
98558
|
+
const stop = host.runtimeState.subscribeCap(cap.name, project);
|
|
98559
|
+
if (host.runtimeState.getCapState(cap.name) !== void 0) project();
|
|
98560
|
+
return {
|
|
98561
|
+
provider: {
|
|
98562
|
+
getStatus: async () => {
|
|
98563
|
+
const current = host.runtimeState.getCapState(switchCapability.name);
|
|
98564
|
+
const lastChangedAt = typeof current?.["lastChangedAt"] === "number" ? current["lastChangedAt"] : 0;
|
|
98565
|
+
return {
|
|
98566
|
+
on: read(),
|
|
98567
|
+
lastChangedAt
|
|
98568
|
+
};
|
|
98569
|
+
},
|
|
98570
|
+
setState: async ({ on }) => applyPower(host, cap.name, hint, owner, on)
|
|
98571
|
+
},
|
|
98572
|
+
dispose: stop
|
|
98573
|
+
};
|
|
98574
|
+
}
|
|
98575
|
+
/**
|
|
98576
|
+
* Registers `switch` for a device whose `cap` carries a `power` hint, built
|
|
98577
|
+
* from `owner` (the provider the device registered for `cap`). Call it right
|
|
98578
|
+
* after `registerNativeCap(cap, owner)`.
|
|
98579
|
+
*/
|
|
98580
|
+
function registerPowerSwitch(device, cap, owner) {
|
|
98581
|
+
const deviceId = device.ctx.id;
|
|
98582
|
+
if (cap.power !== void 0 && !powerServedBy(cap.power, owner)) {
|
|
98583
|
+
device.ctx.logger.debug("power switch: owner serves no power control, no switch registered", {
|
|
98584
|
+
tags: { deviceId },
|
|
98585
|
+
meta: { capName: cap.name }
|
|
98586
|
+
});
|
|
98587
|
+
return () => {};
|
|
98588
|
+
}
|
|
98589
|
+
const host = {
|
|
98590
|
+
deviceId,
|
|
98591
|
+
runtimeState: device.runtimeState,
|
|
98592
|
+
registerNativeCap: (c, p) => device.ctx.registerNativeCap(c, p),
|
|
98593
|
+
readHubSlice: async (capName) => {
|
|
98594
|
+
try {
|
|
98595
|
+
return await device.ctx.api.deviceState.getCapSlice.query({
|
|
98596
|
+
deviceId,
|
|
98597
|
+
capName
|
|
98598
|
+
});
|
|
98599
|
+
} catch (err) {
|
|
98600
|
+
device.ctx.logger.warn("power switch: hub slice read failed", {
|
|
98601
|
+
tags: { deviceId },
|
|
98602
|
+
meta: {
|
|
98603
|
+
capName,
|
|
98604
|
+
error: err instanceof Error ? err.message : String(err)
|
|
98605
|
+
}
|
|
98606
|
+
});
|
|
98607
|
+
return null;
|
|
98608
|
+
}
|
|
98609
|
+
}
|
|
98610
|
+
};
|
|
98611
|
+
const built = buildPowerSwitch(host, cap, owner);
|
|
98612
|
+
host.registerNativeCap(switchCapability, built.provider);
|
|
98613
|
+
return built.dispose;
|
|
98614
|
+
}
|
|
98153
98615
|
Object.freeze({
|
|
98154
98616
|
"accessories.getStatus": [{
|
|
98155
98617
|
name: "deviceId",
|
|
@@ -127692,9 +128154,10 @@ var HM_KEY_PRESS_DATAPOINTS = [
|
|
|
127692
128154
|
/** Set form for O(1) fire-detection membership tests. */
|
|
127693
128155
|
var HM_KEY_PRESS_SET = new Set(HM_KEY_PRESS_DATAPOINTS);
|
|
127694
128156
|
/** Cold-start event-emitter slice; vocabulary supplied per-device. */
|
|
127695
|
-
function coldEventEmitter(
|
|
128157
|
+
function coldEventEmitter(vocabulary) {
|
|
127696
128158
|
return {
|
|
127697
|
-
eventTypes:
|
|
128159
|
+
eventTypes: eventTypesOfVocabulary(vocabulary),
|
|
128160
|
+
vocabulary: [...vocabulary],
|
|
127698
128161
|
lastEvent: null,
|
|
127699
128162
|
eventCountSinceStart: 0
|
|
127700
128163
|
};
|
|
@@ -128538,7 +129001,7 @@ var HmActuatorDevice = class extends HmChildDevice {
|
|
|
128538
129001
|
}
|
|
128539
129002
|
registerClimateCap() {
|
|
128540
129003
|
const channel = this.actuatorChannel;
|
|
128541
|
-
|
|
129004
|
+
const provider = {
|
|
128542
129005
|
getStatus: async () => this.runtimeState.getCapState("climate-control") ?? COLD_CLIMATE,
|
|
128543
129006
|
setMode: async ({ mode }) => {
|
|
128544
129007
|
await this.requireFacade().climateSetMode(this.address, channel, toHmClimateMode(mode));
|
|
@@ -128554,7 +129017,9 @@ var HmActuatorDevice = class extends HmChildDevice {
|
|
|
128554
129017
|
setTargetHumidity: async () => this.unsupported("climate humidity control"),
|
|
128555
129018
|
setSwingVertical: async () => this.unsupported("climate vertical swing"),
|
|
128556
129019
|
setSwingHorizontal: async () => this.unsupported("climate horizontal swing")
|
|
128557
|
-
}
|
|
129020
|
+
};
|
|
129021
|
+
this.ctx.registerNativeCap(climateControlCapability, provider);
|
|
129022
|
+
registerPowerSwitch(this, climateControlCapability, provider);
|
|
128558
129023
|
this.runtimeState.setCapState("climate-control", COLD_CLIMATE);
|
|
128559
129024
|
this.registeredCap = "climate-control";
|
|
128560
129025
|
}
|
|
@@ -128772,6 +129237,64 @@ var HmSensorDevice = class extends HmChildDevice {
|
|
|
128772
129237
|
}
|
|
128773
129238
|
};
|
|
128774
129239
|
//#endregion
|
|
129240
|
+
//#region src/devices/hm-key-vocabulary.ts
|
|
129241
|
+
var PRESS_MEANING = {
|
|
129242
|
+
PRESS_SHORT: {
|
|
129243
|
+
label: "Short press",
|
|
129244
|
+
kind: "press"
|
|
129245
|
+
},
|
|
129246
|
+
PRESS_LONG: {
|
|
129247
|
+
label: "Long press",
|
|
129248
|
+
kind: "long-press"
|
|
129249
|
+
},
|
|
129250
|
+
PRESS_LONG_START: {
|
|
129251
|
+
label: "Long press started",
|
|
129252
|
+
kind: "long-press-start"
|
|
129253
|
+
},
|
|
129254
|
+
PRESS_LONG_RELEASE: {
|
|
129255
|
+
label: "Long press released",
|
|
129256
|
+
kind: "release"
|
|
129257
|
+
},
|
|
129258
|
+
PRESS_CONT: {
|
|
129259
|
+
label: "Long press held",
|
|
129260
|
+
kind: "repeat"
|
|
129261
|
+
}
|
|
129262
|
+
};
|
|
129263
|
+
/** The channels of a device that are buttons, in channel order. */
|
|
129264
|
+
function hmKeyChannels(device) {
|
|
129265
|
+
return mapHmDeviceChannels(device).filter(({ mapping }) => mapping.capabilities.includes("event-emitter")).map(({ channel }) => channel);
|
|
129266
|
+
}
|
|
129267
|
+
/** The presses one key channel has; the standard set when it lists none. */
|
|
129268
|
+
function pressesOf(channel) {
|
|
129269
|
+
const listed = new Set((channel.dataPoints ?? []).map((dataPoint) => dataPoint.parameter).filter((parameter) => HM_KEY_PRESS_SET.has(parameter)));
|
|
129270
|
+
if (listed.size === 0) return HM_KEY_PRESS_DATAPOINTS;
|
|
129271
|
+
return HM_KEY_PRESS_DATAPOINTS.filter((parameter) => listed.has(parameter));
|
|
129272
|
+
}
|
|
129273
|
+
function entryOf(parameter, source) {
|
|
129274
|
+
const meaning = PRESS_MEANING[parameter];
|
|
129275
|
+
if (meaning === void 0) return {
|
|
129276
|
+
id: parameter,
|
|
129277
|
+
source,
|
|
129278
|
+
label: parameter
|
|
129279
|
+
};
|
|
129280
|
+
return {
|
|
129281
|
+
id: parameter,
|
|
129282
|
+
source,
|
|
129283
|
+
label: meaning.label,
|
|
129284
|
+
kind: meaning.kind
|
|
129285
|
+
};
|
|
129286
|
+
}
|
|
129287
|
+
function hmKeyVocabulary(device) {
|
|
129288
|
+
return hmKeyChannels(device).flatMap((channel, position) => {
|
|
129289
|
+
const index = channelIndexFromAddress(channel.address) ?? String(channel.index);
|
|
129290
|
+
const source = {
|
|
129291
|
+
id: index,
|
|
129292
|
+
label: `Button ${position + 1} (channel ${index})`
|
|
129293
|
+
};
|
|
129294
|
+
return pressesOf(channel).map((parameter) => entryOf(parameter, source));
|
|
129295
|
+
});
|
|
129296
|
+
}
|
|
129297
|
+
//#endregion
|
|
128775
129298
|
//#region src/devices/hm-event-emitter-device.ts
|
|
128776
129299
|
/**
|
|
128777
129300
|
* Event-emitter child config: the persisted native press vocabulary for the
|
|
@@ -128782,31 +129305,93 @@ var hmEventEmitterSchema = hmChildSchema.extend({ eventTypes: array(string()).op
|
|
|
128782
129305
|
/**
|
|
128783
129306
|
* ONE Homematic event-emitter accessory child collapsing all of a device's key
|
|
128784
129307
|
* channels (HmIP-WRC* wall switches / HmIP-RC* remotes / KEY channels). The
|
|
128785
|
-
* event vocabulary is
|
|
128786
|
-
* datapoints (
|
|
128787
|
-
* `EventCategory.EventEmitted` with the button index (`:N` channel suffix)
|
|
128788
|
-
* `
|
|
129308
|
+
* event vocabulary is one source per key channel with that channel's native
|
|
129309
|
+
* `PRESS_*` datapoints, verbatim (`hm-key-vocabulary.ts`). Presses fire
|
|
129310
|
+
* `EventCategory.EventEmitted` with the button index (`:N` channel suffix)
|
|
129311
|
+
* as `sourceId`.
|
|
128789
129312
|
*/
|
|
128790
129313
|
var HmEventEmitterDevice = class extends HmChildDevice {
|
|
128791
|
-
|
|
129314
|
+
/** The tokens persisted at adoption: the vocabulary of last resort. */
|
|
129315
|
+
persistedEventTypes;
|
|
129316
|
+
/** The vocabulary read from the CCU's channel list, once it answered. */
|
|
129317
|
+
#declared = null;
|
|
129318
|
+
/** Fires already reported as outside the vocabulary, as `source:token`. */
|
|
129319
|
+
#undeclaredLogged = /* @__PURE__ */ new Set();
|
|
128792
129320
|
#eventSeq = 0;
|
|
128793
129321
|
#eventCount = 0;
|
|
129322
|
+
/** Unsubscribe for the integration's state-change fan-out. */
|
|
129323
|
+
#snapshotUnsub = null;
|
|
128794
129324
|
constructor(ctx) {
|
|
128795
129325
|
super(ctx, hmEventEmitterSchema);
|
|
128796
129326
|
const persisted = this.config.values.eventTypes;
|
|
128797
|
-
this.
|
|
129327
|
+
this.persistedEventTypes = persisted && persisted.length > 0 ? persisted : HM_KEY_PRESS_DATAPOINTS;
|
|
128798
129328
|
this.registerEventEmitterCap();
|
|
128799
129329
|
this.attachValueChangedListener((event) => this.decodeKeyPress(event));
|
|
129330
|
+
if (this.integrationId !== void 0) this.#snapshotUnsub = homematicFacades.onSnapshot(this.integrationId, () => this.refreshDeclaredVocabulary());
|
|
129331
|
+
}
|
|
129332
|
+
/**
|
|
129333
|
+
* Rewrite the slice with the buttons once the CCU's channel list carries
|
|
129334
|
+
* them. A no-op while it does not, and after the buttons were declared.
|
|
129335
|
+
*/
|
|
129336
|
+
refreshDeclaredVocabulary() {
|
|
129337
|
+
if (this.#declared !== null) return;
|
|
129338
|
+
const vocabulary = this.vocabulary();
|
|
129339
|
+
if (this.#declared === null) return;
|
|
129340
|
+
const current = this.runtimeState.getCapState("event-emitter");
|
|
129341
|
+
this.runtimeState.setCapState("event-emitter", {
|
|
129342
|
+
eventTypes: eventTypesOfVocabulary(vocabulary),
|
|
129343
|
+
vocabulary: [...vocabulary],
|
|
129344
|
+
lastEvent: current?.lastEvent ?? null,
|
|
129345
|
+
eventCountSinceStart: current?.eventCountSinceStart ?? 0
|
|
129346
|
+
});
|
|
129347
|
+
}
|
|
129348
|
+
async removeDevice() {
|
|
129349
|
+
this.#snapshotUnsub?.();
|
|
129350
|
+
this.#snapshotUnsub = null;
|
|
129351
|
+
await super.removeDevice();
|
|
128800
129352
|
}
|
|
128801
129353
|
registerEventEmitterCap() {
|
|
128802
|
-
this.ctx.registerNativeCap(eventEmitterCapability, { getStatus: async () => this.runtimeState.getCapState("event-emitter") ?? coldEventEmitter(this.
|
|
128803
|
-
this.runtimeState.setCapState("event-emitter", coldEventEmitter(this.
|
|
129354
|
+
this.ctx.registerNativeCap(eventEmitterCapability, { getStatus: async () => this.runtimeState.getCapState("event-emitter") ?? coldEventEmitter(this.vocabulary()) });
|
|
129355
|
+
this.runtimeState.setCapState("event-emitter", coldEventEmitter(this.vocabulary()));
|
|
129356
|
+
}
|
|
129357
|
+
/**
|
|
129358
|
+
* The buttons and their presses, read LIVE from the CCU's channel list.
|
|
129359
|
+
*
|
|
129360
|
+
* Not from the child's config: that is written once, at adoption, so a
|
|
129361
|
+
* remote adopted before the vocabulary existed would never get its
|
|
129362
|
+
* buttons. While the CCU has not answered, the persisted tokens stand in,
|
|
129363
|
+
* with no button; the next write after it answers carries the buttons.
|
|
129364
|
+
*/
|
|
129365
|
+
vocabulary() {
|
|
129366
|
+
if (this.#declared !== null) return this.#declared;
|
|
129367
|
+
const device = this.resolveHmDevice();
|
|
129368
|
+
const live = device === null ? [] : hmKeyVocabulary(device);
|
|
129369
|
+
if (live.length === 0) return plainEventVocabulary(this.persistedEventTypes);
|
|
129370
|
+
this.#declared = live;
|
|
129371
|
+
return live;
|
|
129372
|
+
}
|
|
129373
|
+
/** A press the vocabulary does not declare is delivered, and said once. */
|
|
129374
|
+
noteUndeclared(vocabulary, eventType, sourceId) {
|
|
129375
|
+
if (this.#declared === null) return;
|
|
129376
|
+
if (findVocabularyEntry(vocabulary, eventType, sourceId ?? void 0) !== void 0) return;
|
|
129377
|
+
const key = `${sourceId ?? ""}:${eventType}`;
|
|
129378
|
+
if (this.#undeclaredLogged.has(key)) return;
|
|
129379
|
+
this.#undeclaredLogged.add(key);
|
|
129380
|
+
this.ctx.logger.warn("Homematic press is not in the declared event vocabulary", {
|
|
129381
|
+
tags: { deviceId: this.ctx.id },
|
|
129382
|
+
meta: {
|
|
129383
|
+
address: this.address,
|
|
129384
|
+
eventType,
|
|
129385
|
+
sourceId
|
|
129386
|
+
}
|
|
129387
|
+
});
|
|
128804
129388
|
}
|
|
128805
129389
|
/**
|
|
128806
129390
|
* Translate a key-channel `PRESS_*` datapoint into an `EventFire`: emit
|
|
128807
129391
|
* `EventCategory.EventEmitted` on the bus and write the `event-emitter`
|
|
128808
129392
|
* slice. The `eventType` is the native datapoint name VERBATIM; the button
|
|
128809
|
-
* index (`:N` suffix of the channel address)
|
|
129393
|
+
* index (`:N` suffix of the channel address) is the fire's `sourceId`, and
|
|
129394
|
+
* stays in `data.channel` for readers older than the vocabulary.
|
|
128810
129395
|
* Non-key datapoints and value resets are ignored.
|
|
128811
129396
|
*/
|
|
128812
129397
|
decodeKeyPress(event) {
|
|
@@ -128818,6 +129403,7 @@ var HmEventEmitterDevice = class extends HmChildDevice {
|
|
|
128818
129403
|
const fire = {
|
|
128819
129404
|
deviceId: this.id,
|
|
128820
129405
|
eventType: parameter,
|
|
129406
|
+
...channelIndex !== null ? { sourceId: channelIndex } : {},
|
|
128821
129407
|
data: channelIndex !== null ? { channel: channelIndex } : {},
|
|
128822
129408
|
timestamp: now,
|
|
128823
129409
|
seq: ++this.#eventSeq
|
|
@@ -128828,8 +129414,11 @@ var HmEventEmitterDevice = class extends HmChildDevice {
|
|
|
128828
129414
|
deviceId: this.id,
|
|
128829
129415
|
addonId: this.ctx.deviceMeta.addonId
|
|
128830
129416
|
}, fire));
|
|
129417
|
+
const vocabulary = this.vocabulary();
|
|
129418
|
+
this.noteUndeclared(vocabulary, parameter, channelIndex);
|
|
128831
129419
|
const slice = {
|
|
128832
|
-
eventTypes:
|
|
129420
|
+
eventTypes: eventTypesOfVocabulary(vocabulary),
|
|
129421
|
+
vocabulary: [...vocabulary],
|
|
128833
129422
|
lastEvent: fire,
|
|
128834
129423
|
eventCountSinceStart: ++this.#eventCount
|
|
128835
129424
|
};
|