@camstack/types 1.2.561 → 1.2.562
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 +12 -0
- package/dist/addon/instances-of-cap.d.ts +7 -2
- package/dist/addon.js +2 -2
- package/dist/addon.mjs +2 -2
- package/dist/automation/codegen.d.ts +6 -0
- package/dist/automation/recipe-literal.d.ts +35 -0
- package/dist/automation/recipe.d.ts +46 -0
- package/dist/automation/template-link.d.ts +206 -0
- package/dist/capabilities/energy-system.cap.d.ts +281 -0
- package/dist/capabilities/index.d.ts +4 -2
- package/dist/capabilities/integration-instances.cap.d.ts +9 -0
- package/dist/capabilities/template.cap.d.ts +39 -2
- package/dist/client.js +8 -0
- package/dist/client.mjs +8 -0
- package/dist/{composed-stable-id-iddnCQ51.mjs → composed-stable-id-B3wcvtvW.mjs} +4 -0
- package/dist/{composed-stable-id-BmJ_5GiE.js → composed-stable-id-Bp33yrYi.js} +4 -0
- package/dist/device/device-control-resolution.d.ts +1 -1
- package/dist/device/device-icon.d.ts +1 -0
- package/dist/device/device-type.d.ts +5 -1
- package/dist/device/hero/hero-layout.d.ts +1 -0
- package/dist/device/hero/hero-look.d.ts +6 -0
- package/dist/device/hero/hero-scene.d.ts +1 -0
- package/dist/generated/addon-api.d.ts +14 -0
- package/dist/generated/addon-cap-facts.d.ts +1 -1
- package/dist/generated/cap-status-types.d.ts +3 -1
- package/dist/generated/cap-vocabulary.d.ts +1 -1
- package/dist/generated/capability-router-map.d.ts +5 -2
- package/dist/generated/customize-catalog.d.ts +1 -1
- package/dist/generated/device-local-state.d.ts +3 -0
- package/dist/generated/device-proxy.d.ts +3 -0
- package/dist/generated/device-scoped-caps.d.ts +1 -1
- package/dist/generated/history-catalog.d.ts +1 -1
- package/dist/generated/method-access-map.d.ts +1 -1
- package/dist/generated/method-device-selectors.d.ts +1 -1
- package/dist/generated/runtime-state-durability.d.ts +1 -1
- package/dist/{implemented-methods-CfaRR_ki.js → implemented-methods-CDYOCn9a.js} +1 -1
- package/dist/{implemented-methods-CSTk6zYK.mjs → implemented-methods-CgUBu6uM.mjs} +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.js +1505 -171
- package/dist/index.mjs +1458 -172
- package/dist/node.js +2 -2
- package/dist/node.mjs +2 -2
- package/dist/{sleep-CcUFeK6k.js → sleep-Cb2px0Nb.js} +105 -3
- package/dist/{sleep-C9PbO6Nb.mjs → sleep-Cykc2bzi.mjs} +105 -3
- package/dist/template/automation-template.d.ts +782 -0
- package/dist/template/builtin-automation-templates.d.ts +17 -0
- package/dist/template/template-kinds.d.ts +4 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_sleep = require("./sleep-
|
|
2
|
+
const require_sleep = require("./sleep-Cb2px0Nb.js");
|
|
3
3
|
const require_event_category = require("./event-category-Ps2LC8dN.js");
|
|
4
|
-
const require_composed_stable_id = require("./composed-stable-id-
|
|
5
|
-
const require_implemented_methods = require("./implemented-methods-
|
|
4
|
+
const require_composed_stable_id = require("./composed-stable-id-Bp33yrYi.js");
|
|
5
|
+
const require_implemented_methods = require("./implemented-methods-CDYOCn9a.js");
|
|
6
6
|
const require_node_color = require("./node-color.js");
|
|
7
7
|
const require_convert = require("./convert-BmtM6K-5.js");
|
|
8
8
|
const require_enums = require("./enums.js");
|
|
@@ -1364,11 +1364,18 @@ var notificationOutputCapability = {
|
|
|
1364
1364
|
};
|
|
1365
1365
|
//#endregion
|
|
1366
1366
|
//#region src/addon/instances-of-cap.ts
|
|
1367
|
+
/**
|
|
1368
|
+
* The kind's instances answer for `cap`: it is the kind's `functionCap`, or one the kind declares in
|
|
1369
|
+
* `alsoServes`. The one rule a link (a picker, a resolver, a delete guard) matches a target by.
|
|
1370
|
+
*/
|
|
1371
|
+
function kindServesCap(kind, cap) {
|
|
1372
|
+
return kind.functionCap === cap || (kind.alsoServes ?? []).includes(cap);
|
|
1373
|
+
}
|
|
1367
1374
|
async function instancesOfCap(source, cap, filter = {}) {
|
|
1368
1375
|
const instances = [];
|
|
1369
1376
|
const unreadable = [];
|
|
1370
1377
|
for (const addonId of await source.holders(cap)) try {
|
|
1371
|
-
const kinds = ((await source.describe(addonId)).kinds ?? []).filter((kind) => kind
|
|
1378
|
+
const kinds = ((await source.describe(addonId)).kinds ?? []).filter((kind) => kindServesCap(kind, cap));
|
|
1372
1379
|
if (kinds.length === 0) continue;
|
|
1373
1380
|
for (const instance of await source.listInstances(addonId)) {
|
|
1374
1381
|
const kind = kinds.find((candidate) => candidate.id === instance.kind);
|
|
@@ -1680,7 +1687,9 @@ function notificationTargetParts(records, spec) {
|
|
|
1680
1687
|
label: descriptor.label,
|
|
1681
1688
|
functionCap: NOTIFICATION_OUTPUT_CAP,
|
|
1682
1689
|
role: "services",
|
|
1683
|
-
canTest
|
|
1690
|
+
canTest,
|
|
1691
|
+
...descriptor.iconUrl !== void 0 ? { iconUrl: descriptor.iconUrl } : {},
|
|
1692
|
+
...descriptor.iconMediaType !== void 0 ? { iconMediaType: descriptor.iconMediaType } : {}
|
|
1684
1693
|
};
|
|
1685
1694
|
return [{
|
|
1686
1695
|
kind,
|
|
@@ -5742,12 +5751,12 @@ function toStreamSourceEntry(stream) {
|
|
|
5742
5751
|
function isString(v) {
|
|
5743
5752
|
return typeof v === "string";
|
|
5744
5753
|
}
|
|
5745
|
-
function isRecord$
|
|
5754
|
+
function isRecord$7(v) {
|
|
5746
5755
|
return typeof v === "object" && v !== null && !Array.isArray(v);
|
|
5747
5756
|
}
|
|
5748
5757
|
function parseStreamEntry(v) {
|
|
5749
5758
|
if (isString(v) && v.trim()) return { url: v };
|
|
5750
|
-
if (isRecord$
|
|
5759
|
+
if (isRecord$7(v) && isString(v["url"]) && v["url"].trim()) return {
|
|
5751
5760
|
url: v["url"],
|
|
5752
5761
|
label: isString(v["label"]) ? v["label"] : void 0
|
|
5753
5762
|
};
|
|
@@ -6388,20 +6397,20 @@ var SURVIVING_TRIGGER_KEYS = [
|
|
|
6388
6397
|
"objectClasses",
|
|
6389
6398
|
"sensorDeviceIds"
|
|
6390
6399
|
];
|
|
6391
|
-
function isRecord$
|
|
6400
|
+
function isRecord$6(value) {
|
|
6392
6401
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6393
6402
|
}
|
|
6394
6403
|
function listensToLegacySignal(band) {
|
|
6395
|
-
return isRecord$
|
|
6404
|
+
return isRecord$6(band) && isRecord$6(band.triggers) && band.triggers.deviceSignal === true;
|
|
6396
6405
|
}
|
|
6397
6406
|
function hasSurvivingTrigger(band) {
|
|
6398
6407
|
const triggers = band.triggers;
|
|
6399
|
-
if (!isRecord$
|
|
6408
|
+
if (!isRecord$6(triggers)) return false;
|
|
6400
6409
|
return SURVIVING_TRIGGER_KEYS.some((key) => triggers[key] !== void 0);
|
|
6401
6410
|
}
|
|
6402
6411
|
function withoutLegacySignal(band) {
|
|
6403
6412
|
const triggers = band.triggers;
|
|
6404
|
-
if (!isRecord$
|
|
6413
|
+
if (!isRecord$6(triggers)) return band;
|
|
6405
6414
|
const { deviceSignal: _retired, ...rest } = triggers;
|
|
6406
6415
|
return {
|
|
6407
6416
|
...band,
|
|
@@ -6431,11 +6440,11 @@ function migrateLegacyDeviceSignalConfig(raw) {
|
|
|
6431
6440
|
migrated: false,
|
|
6432
6441
|
strippedOnly: false
|
|
6433
6442
|
};
|
|
6434
|
-
if (!isRecord$
|
|
6443
|
+
if (!isRecord$6(raw) || !Array.isArray(raw.bands)) return unchanged;
|
|
6435
6444
|
if (!raw.bands.some(listensToLegacySignal)) return unchanged;
|
|
6436
6445
|
const kept = [];
|
|
6437
6446
|
for (const band of raw.bands) {
|
|
6438
|
-
if (!listensToLegacySignal(band) || !isRecord$
|
|
6447
|
+
if (!listensToLegacySignal(band) || !isRecord$6(band)) {
|
|
6439
6448
|
kept.push(band);
|
|
6440
6449
|
continue;
|
|
6441
6450
|
}
|
|
@@ -31175,6 +31184,211 @@ var ActionTargetResolver = class {
|
|
|
31175
31184
|
}
|
|
31176
31185
|
};
|
|
31177
31186
|
//#endregion
|
|
31187
|
+
//#region src/capabilities/event-vocabulary.ts
|
|
31188
|
+
/**
|
|
31189
|
+
* The declared vocabulary of an `event-emitter` device (D1044): what the
|
|
31190
|
+
* device can fire, named for a person and typed for a rule.
|
|
31191
|
+
*
|
|
31192
|
+
* `id` is the native token, verbatim. `kind` is the meaning shared by every
|
|
31193
|
+
* integration, so "any long press" can be asked without knowing a vendor's
|
|
31194
|
+
* token. A device with several buttons declares one entry per button and
|
|
31195
|
+
* token: an entry is identified by its token AND its source.
|
|
31196
|
+
*/
|
|
31197
|
+
/** The cross-integration meaning of an event. */
|
|
31198
|
+
var EVENT_VOCABULARY_KINDS = [
|
|
31199
|
+
"press",
|
|
31200
|
+
"long-press",
|
|
31201
|
+
"long-press-start",
|
|
31202
|
+
"release",
|
|
31203
|
+
"repeat",
|
|
31204
|
+
"double-press",
|
|
31205
|
+
"other"
|
|
31206
|
+
];
|
|
31207
|
+
var EventVocabularyKindSchema = zod.z.enum(EVENT_VOCABULARY_KINDS);
|
|
31208
|
+
/** The part of the device an event comes from: a button, a channel. */
|
|
31209
|
+
var EventVocabularySourceSchema = zod.z.object({
|
|
31210
|
+
id: zod.z.string().min(1),
|
|
31211
|
+
label: zod.z.string().min(1)
|
|
31212
|
+
});
|
|
31213
|
+
/** One scalar field of an event's `data`, by dotted path. */
|
|
31214
|
+
var EventVocabularyFieldSchema = zod.z.object({
|
|
31215
|
+
path: zod.z.string().min(1),
|
|
31216
|
+
kind: zod.z.enum([
|
|
31217
|
+
"string",
|
|
31218
|
+
"number",
|
|
31219
|
+
"boolean",
|
|
31220
|
+
"enum"
|
|
31221
|
+
]),
|
|
31222
|
+
enumValues: zod.z.array(zod.z.string()).optional(),
|
|
31223
|
+
label: zod.z.string().min(1).optional()
|
|
31224
|
+
});
|
|
31225
|
+
var EventVocabularyEntrySchema = zod.z.object({
|
|
31226
|
+
/** The native token, verbatim. */
|
|
31227
|
+
id: zod.z.string().min(1),
|
|
31228
|
+
source: EventVocabularySourceSchema.optional(),
|
|
31229
|
+
label: zod.z.string().min(1),
|
|
31230
|
+
description: zod.z.string().optional(),
|
|
31231
|
+
kind: EventVocabularyKindSchema.optional(),
|
|
31232
|
+
payload: zod.z.array(EventVocabularyFieldSchema).optional()
|
|
31233
|
+
});
|
|
31234
|
+
/**
|
|
31235
|
+
* The vocabulary of a source that declares tokens and nothing else: one
|
|
31236
|
+
* entry per token, labelled with the token itself.
|
|
31237
|
+
*/
|
|
31238
|
+
function plainEventVocabulary(eventTypes) {
|
|
31239
|
+
return [...new Set(eventTypes)].filter((eventType) => eventType !== "").map((eventType) => ({
|
|
31240
|
+
id: eventType,
|
|
31241
|
+
label: eventType
|
|
31242
|
+
}));
|
|
31243
|
+
}
|
|
31244
|
+
/**
|
|
31245
|
+
* Tokens many integrations use for a button, by their normalised spelling
|
|
31246
|
+
* (lower case, words joined by `_`). Exact matches only: a token that
|
|
31247
|
+
* merely contains one of these words gets no kind.
|
|
31248
|
+
*/
|
|
31249
|
+
var CONVENTIONAL_KINDS = {
|
|
31250
|
+
press: "press",
|
|
31251
|
+
pressed: "press",
|
|
31252
|
+
single: "press",
|
|
31253
|
+
single_press: "press",
|
|
31254
|
+
single_click: "press",
|
|
31255
|
+
short_press: "press",
|
|
31256
|
+
press_short: "press",
|
|
31257
|
+
click: "press",
|
|
31258
|
+
initial_press: "press",
|
|
31259
|
+
long_press: "long-press",
|
|
31260
|
+
press_long: "long-press",
|
|
31261
|
+
long_click: "long-press",
|
|
31262
|
+
hold: "long-press",
|
|
31263
|
+
long_press_start: "long-press-start",
|
|
31264
|
+
press_long_start: "long-press-start",
|
|
31265
|
+
release: "release",
|
|
31266
|
+
released: "release",
|
|
31267
|
+
long_release: "release",
|
|
31268
|
+
long_press_release: "release",
|
|
31269
|
+
press_long_release: "release",
|
|
31270
|
+
short_release: "release",
|
|
31271
|
+
repeat: "repeat",
|
|
31272
|
+
hold_repeat: "repeat",
|
|
31273
|
+
press_cont: "repeat",
|
|
31274
|
+
double_press: "double-press",
|
|
31275
|
+
double_click: "double-press",
|
|
31276
|
+
double: "double-press",
|
|
31277
|
+
multi_press_2: "double-press"
|
|
31278
|
+
};
|
|
31279
|
+
function normalisedToken(token) {
|
|
31280
|
+
return token.trim().toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "");
|
|
31281
|
+
}
|
|
31282
|
+
function readableToken(token) {
|
|
31283
|
+
const words = normalisedToken(token).replace(/_/g, " ");
|
|
31284
|
+
if (words === "") return token;
|
|
31285
|
+
return `${words.charAt(0).toUpperCase()}${words.slice(1)}`;
|
|
31286
|
+
}
|
|
31287
|
+
/**
|
|
31288
|
+
* The vocabulary of a source that declares tokens only, read by convention:
|
|
31289
|
+
* a readable label, and the shared kind when the token is one many
|
|
31290
|
+
* integrations use for a button. The token itself is kept verbatim.
|
|
31291
|
+
*/
|
|
31292
|
+
function conventionalEventVocabulary(eventTypes) {
|
|
31293
|
+
return plainEventVocabulary(eventTypes).map((entry) => {
|
|
31294
|
+
const kind = CONVENTIONAL_KINDS[normalisedToken(entry.id)];
|
|
31295
|
+
const label = readableToken(entry.id);
|
|
31296
|
+
return kind === void 0 ? {
|
|
31297
|
+
id: entry.id,
|
|
31298
|
+
label
|
|
31299
|
+
} : {
|
|
31300
|
+
id: entry.id,
|
|
31301
|
+
label,
|
|
31302
|
+
kind
|
|
31303
|
+
};
|
|
31304
|
+
});
|
|
31305
|
+
}
|
|
31306
|
+
/** The native tokens of a vocabulary, each once, in declaration order. */
|
|
31307
|
+
function eventTypesOfVocabulary(vocabulary) {
|
|
31308
|
+
return [...new Set(vocabulary.map((entry) => entry.id))];
|
|
31309
|
+
}
|
|
31310
|
+
/**
|
|
31311
|
+
* The vocabulary to show and match against. A status with none declared
|
|
31312
|
+
* answers with its plain tokens, so an older provider is still usable.
|
|
31313
|
+
*/
|
|
31314
|
+
function readEventVocabulary(status) {
|
|
31315
|
+
const declared = status.vocabulary;
|
|
31316
|
+
if (declared !== void 0 && declared.length > 0) return declared;
|
|
31317
|
+
return plainEventVocabulary(status.eventTypes);
|
|
31318
|
+
}
|
|
31319
|
+
/** The entry a fire belongs to: same token, same source (or both without one). */
|
|
31320
|
+
function findVocabularyEntry(vocabulary, eventType, sourceId) {
|
|
31321
|
+
return vocabulary.find((entry) => entry.id === eventType && entry.source?.id === sourceId);
|
|
31322
|
+
}
|
|
31323
|
+
//#endregion
|
|
31324
|
+
//#region src/automation/template-link.ts
|
|
31325
|
+
/**
|
|
31326
|
+
* The link an automation made FROM a template carries (#527): which template,
|
|
31327
|
+
* the values the operator filled in, and — when the template has since changed
|
|
31328
|
+
* so that those values no longer fit — the problems that say why.
|
|
31329
|
+
*
|
|
31330
|
+
* It lives inside the recipe (`AutomationRecipe.template`), so the one row in
|
|
31331
|
+
* `core_blocks` stays the one artefact: there is no second store of instances
|
|
31332
|
+
* to drift from the blocks, and deleting the automation deletes the link.
|
|
31333
|
+
* "Convert to a free automation" is dropping this field.
|
|
31334
|
+
*
|
|
31335
|
+
* This file depends on nothing in `recipe.ts`, so the recipe can embed it and
|
|
31336
|
+
* the template engine (`template/automation-template.ts`) can import both.
|
|
31337
|
+
*/
|
|
31338
|
+
/** An `event` input's value: the same three narrowing lists a `device-fired` row takes. */
|
|
31339
|
+
var TemplateEventValueSchema = zod.z.object({
|
|
31340
|
+
eventIds: zod.z.array(zod.z.string().min(1)).min(1).max(64).optional(),
|
|
31341
|
+
sourceIds: zod.z.array(zod.z.string().min(1)).min(1).max(64).optional(),
|
|
31342
|
+
kinds: zod.z.array(EventVocabularyKindSchema).min(1).optional()
|
|
31343
|
+
}).refine((value) => value.eventIds !== void 0 || value.sourceIds !== void 0 || value.kinds !== void 0, { message: "an event names at least one event, part or kind" });
|
|
31344
|
+
/** An `action` input's value: a vocabulary action and its open args. */
|
|
31345
|
+
var TemplateActionValueSchema = zod.z.object({
|
|
31346
|
+
actionId: zod.z.string().min(1),
|
|
31347
|
+
args: zod.z.record(zod.z.string(), zod.z.unknown()).optional()
|
|
31348
|
+
});
|
|
31349
|
+
/** The value of one non-group input. Which member is right is the input kind's to judge. */
|
|
31350
|
+
var TemplateScalarValueSchema = zod.z.union([
|
|
31351
|
+
zod.z.number(),
|
|
31352
|
+
zod.z.string(),
|
|
31353
|
+
zod.z.boolean(),
|
|
31354
|
+
zod.z.array(zod.z.number().int().nonnegative()),
|
|
31355
|
+
TemplateEventValueSchema,
|
|
31356
|
+
TemplateActionValueSchema
|
|
31357
|
+
]);
|
|
31358
|
+
/** One row of a repeatable group: row-input key → value. */
|
|
31359
|
+
var TemplateGroupRowSchema = zod.z.record(zod.z.string(), TemplateScalarValueSchema);
|
|
31360
|
+
var TemplateInputValueSchema = zod.z.union([TemplateScalarValueSchema, zod.z.array(TemplateGroupRowSchema)]);
|
|
31361
|
+
/** Input key → value. */
|
|
31362
|
+
var TemplateInputValuesSchema = zod.z.record(zod.z.string(), TemplateInputValueSchema);
|
|
31363
|
+
var TEMPLATE_INSTANCE_PROBLEM_CODES = [
|
|
31364
|
+
"missing-input",
|
|
31365
|
+
"invalid-input",
|
|
31366
|
+
"invalid-recipe",
|
|
31367
|
+
"missing-template",
|
|
31368
|
+
"edited-by-hand"
|
|
31369
|
+
];
|
|
31370
|
+
var TemplateInstanceProblemSchema = zod.z.object({
|
|
31371
|
+
code: zod.z.enum(TEMPLATE_INSTANCE_PROBLEM_CODES),
|
|
31372
|
+
/** Dotted input address (`buttons.2.targets`); absent for a whole-recipe problem. */
|
|
31373
|
+
input: zod.z.string().optional(),
|
|
31374
|
+
detail: zod.z.string()
|
|
31375
|
+
});
|
|
31376
|
+
var AutomationTemplateLinkSchema = zod.z.object({
|
|
31377
|
+
templateId: zod.z.string().min(1),
|
|
31378
|
+
values: TemplateInputValuesSchema,
|
|
31379
|
+
/**
|
|
31380
|
+
* Fingerprint of the generated code with this literal blanked
|
|
31381
|
+
* (`instanceCodeHash`), stamped by `generateAutomationBlock`. Code that no
|
|
31382
|
+
* longer matches it was edited by hand, and is never regenerated over.
|
|
31383
|
+
*/
|
|
31384
|
+
codeHash: zod.z.string().optional(),
|
|
31385
|
+
/**
|
|
31386
|
+
* Present when the last re-expansion refused these values. The automation
|
|
31387
|
+
* keeps running the body of its last good expansion; nothing is dropped.
|
|
31388
|
+
*/
|
|
31389
|
+
problems: zod.z.array(TemplateInstanceProblemSchema).min(1).optional()
|
|
31390
|
+
});
|
|
31391
|
+
//#endregion
|
|
31178
31392
|
//#region src/expression/binding-source.ts
|
|
31179
31393
|
/**
|
|
31180
31394
|
* What an expression's named bindings READ from.
|
|
@@ -32224,143 +32438,6 @@ function anySubjectMatches(subjects, observed) {
|
|
|
32224
32438
|
};
|
|
32225
32439
|
}
|
|
32226
32440
|
//#endregion
|
|
32227
|
-
//#region src/capabilities/event-vocabulary.ts
|
|
32228
|
-
/**
|
|
32229
|
-
* The declared vocabulary of an `event-emitter` device (D1044): what the
|
|
32230
|
-
* device can fire, named for a person and typed for a rule.
|
|
32231
|
-
*
|
|
32232
|
-
* `id` is the native token, verbatim. `kind` is the meaning shared by every
|
|
32233
|
-
* integration, so "any long press" can be asked without knowing a vendor's
|
|
32234
|
-
* token. A device with several buttons declares one entry per button and
|
|
32235
|
-
* token: an entry is identified by its token AND its source.
|
|
32236
|
-
*/
|
|
32237
|
-
/** The cross-integration meaning of an event. */
|
|
32238
|
-
var EVENT_VOCABULARY_KINDS = [
|
|
32239
|
-
"press",
|
|
32240
|
-
"long-press",
|
|
32241
|
-
"long-press-start",
|
|
32242
|
-
"release",
|
|
32243
|
-
"repeat",
|
|
32244
|
-
"double-press",
|
|
32245
|
-
"other"
|
|
32246
|
-
];
|
|
32247
|
-
var EventVocabularyKindSchema = zod.z.enum(EVENT_VOCABULARY_KINDS);
|
|
32248
|
-
/** The part of the device an event comes from: a button, a channel. */
|
|
32249
|
-
var EventVocabularySourceSchema = zod.z.object({
|
|
32250
|
-
id: zod.z.string().min(1),
|
|
32251
|
-
label: zod.z.string().min(1)
|
|
32252
|
-
});
|
|
32253
|
-
/** One scalar field of an event's `data`, by dotted path. */
|
|
32254
|
-
var EventVocabularyFieldSchema = zod.z.object({
|
|
32255
|
-
path: zod.z.string().min(1),
|
|
32256
|
-
kind: zod.z.enum([
|
|
32257
|
-
"string",
|
|
32258
|
-
"number",
|
|
32259
|
-
"boolean",
|
|
32260
|
-
"enum"
|
|
32261
|
-
]),
|
|
32262
|
-
enumValues: zod.z.array(zod.z.string()).optional(),
|
|
32263
|
-
label: zod.z.string().min(1).optional()
|
|
32264
|
-
});
|
|
32265
|
-
var EventVocabularyEntrySchema = zod.z.object({
|
|
32266
|
-
/** The native token, verbatim. */
|
|
32267
|
-
id: zod.z.string().min(1),
|
|
32268
|
-
source: EventVocabularySourceSchema.optional(),
|
|
32269
|
-
label: zod.z.string().min(1),
|
|
32270
|
-
description: zod.z.string().optional(),
|
|
32271
|
-
kind: EventVocabularyKindSchema.optional(),
|
|
32272
|
-
payload: zod.z.array(EventVocabularyFieldSchema).optional()
|
|
32273
|
-
});
|
|
32274
|
-
/**
|
|
32275
|
-
* The vocabulary of a source that declares tokens and nothing else: one
|
|
32276
|
-
* entry per token, labelled with the token itself.
|
|
32277
|
-
*/
|
|
32278
|
-
function plainEventVocabulary(eventTypes) {
|
|
32279
|
-
return [...new Set(eventTypes)].filter((eventType) => eventType !== "").map((eventType) => ({
|
|
32280
|
-
id: eventType,
|
|
32281
|
-
label: eventType
|
|
32282
|
-
}));
|
|
32283
|
-
}
|
|
32284
|
-
/**
|
|
32285
|
-
* Tokens many integrations use for a button, by their normalised spelling
|
|
32286
|
-
* (lower case, words joined by `_`). Exact matches only: a token that
|
|
32287
|
-
* merely contains one of these words gets no kind.
|
|
32288
|
-
*/
|
|
32289
|
-
var CONVENTIONAL_KINDS = {
|
|
32290
|
-
press: "press",
|
|
32291
|
-
pressed: "press",
|
|
32292
|
-
single: "press",
|
|
32293
|
-
single_press: "press",
|
|
32294
|
-
single_click: "press",
|
|
32295
|
-
short_press: "press",
|
|
32296
|
-
press_short: "press",
|
|
32297
|
-
click: "press",
|
|
32298
|
-
initial_press: "press",
|
|
32299
|
-
long_press: "long-press",
|
|
32300
|
-
press_long: "long-press",
|
|
32301
|
-
long_click: "long-press",
|
|
32302
|
-
hold: "long-press",
|
|
32303
|
-
long_press_start: "long-press-start",
|
|
32304
|
-
press_long_start: "long-press-start",
|
|
32305
|
-
release: "release",
|
|
32306
|
-
released: "release",
|
|
32307
|
-
long_release: "release",
|
|
32308
|
-
long_press_release: "release",
|
|
32309
|
-
press_long_release: "release",
|
|
32310
|
-
short_release: "release",
|
|
32311
|
-
repeat: "repeat",
|
|
32312
|
-
hold_repeat: "repeat",
|
|
32313
|
-
press_cont: "repeat",
|
|
32314
|
-
double_press: "double-press",
|
|
32315
|
-
double_click: "double-press",
|
|
32316
|
-
double: "double-press",
|
|
32317
|
-
multi_press_2: "double-press"
|
|
32318
|
-
};
|
|
32319
|
-
function normalisedToken(token) {
|
|
32320
|
-
return token.trim().toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "");
|
|
32321
|
-
}
|
|
32322
|
-
function readableToken(token) {
|
|
32323
|
-
const words = normalisedToken(token).replace(/_/g, " ");
|
|
32324
|
-
if (words === "") return token;
|
|
32325
|
-
return `${words.charAt(0).toUpperCase()}${words.slice(1)}`;
|
|
32326
|
-
}
|
|
32327
|
-
/**
|
|
32328
|
-
* The vocabulary of a source that declares tokens only, read by convention:
|
|
32329
|
-
* a readable label, and the shared kind when the token is one many
|
|
32330
|
-
* integrations use for a button. The token itself is kept verbatim.
|
|
32331
|
-
*/
|
|
32332
|
-
function conventionalEventVocabulary(eventTypes) {
|
|
32333
|
-
return plainEventVocabulary(eventTypes).map((entry) => {
|
|
32334
|
-
const kind = CONVENTIONAL_KINDS[normalisedToken(entry.id)];
|
|
32335
|
-
const label = readableToken(entry.id);
|
|
32336
|
-
return kind === void 0 ? {
|
|
32337
|
-
id: entry.id,
|
|
32338
|
-
label
|
|
32339
|
-
} : {
|
|
32340
|
-
id: entry.id,
|
|
32341
|
-
label,
|
|
32342
|
-
kind
|
|
32343
|
-
};
|
|
32344
|
-
});
|
|
32345
|
-
}
|
|
32346
|
-
/** The native tokens of a vocabulary, each once, in declaration order. */
|
|
32347
|
-
function eventTypesOfVocabulary(vocabulary) {
|
|
32348
|
-
return [...new Set(vocabulary.map((entry) => entry.id))];
|
|
32349
|
-
}
|
|
32350
|
-
/**
|
|
32351
|
-
* The vocabulary to show and match against. A status with none declared
|
|
32352
|
-
* answers with its plain tokens, so an older provider is still usable.
|
|
32353
|
-
*/
|
|
32354
|
-
function readEventVocabulary(status) {
|
|
32355
|
-
const declared = status.vocabulary;
|
|
32356
|
-
if (declared !== void 0 && declared.length > 0) return declared;
|
|
32357
|
-
return plainEventVocabulary(status.eventTypes);
|
|
32358
|
-
}
|
|
32359
|
-
/** The entry a fire belongs to: same token, same source (or both without one). */
|
|
32360
|
-
function findVocabularyEntry(vocabulary, eventType, sourceId) {
|
|
32361
|
-
return vocabulary.find((entry) => entry.id === eventType && entry.source?.id === sourceId);
|
|
32362
|
-
}
|
|
32363
|
-
//#endregion
|
|
32364
32441
|
//#region src/time/solar.ts
|
|
32365
32442
|
/**
|
|
32366
32443
|
* Where the sun is, from a latitude and a longitude — the one solar
|
|
@@ -33991,7 +34068,13 @@ var CurrentAutomationRecipeSchema = zod.z.object({
|
|
|
33991
34068
|
actions: zod.z.array(AutomationActionSchema),
|
|
33992
34069
|
runMode: AutomationRunModeSchema.optional(),
|
|
33993
34070
|
/** How many run traces the automation keeps (default {@link DEFAULT_TRACE_KEEP}). */
|
|
33994
|
-
keepTraces: zod.z.number().int().min(1).max(100).optional()
|
|
34071
|
+
keepTraces: zod.z.number().int().min(1).max(100).optional(),
|
|
34072
|
+
/**
|
|
34073
|
+
* Set when the automation was made from a template (#527): the template and
|
|
34074
|
+
* the values filled in. The rest of the recipe is then the expansion, which
|
|
34075
|
+
* the template engine rewrites when the template changes.
|
|
34076
|
+
*/
|
|
34077
|
+
template: AutomationTemplateLinkSchema.optional()
|
|
33995
34078
|
});
|
|
33996
34079
|
/** A recipe as it was stored before the single tree. Read-only: nothing writes this. */
|
|
33997
34080
|
var LegacyAutomationRecipeSchema = zod.z.object({
|
|
@@ -36170,6 +36253,105 @@ function evaluateConditionTree(cond, reader, now) {
|
|
|
36170
36253
|
return evaluateWhenTree(convertLegacyCondition(cond), reader, now, { rootPath: "conditions" });
|
|
36171
36254
|
}
|
|
36172
36255
|
//#endregion
|
|
36256
|
+
//#region src/automation/recipe-literal.ts
|
|
36257
|
+
/**
|
|
36258
|
+
* Reads the `AUTOMATION_RECIPE` literal `generateAutomationBlock` embeds in a
|
|
36259
|
+
* block's code — parsed as JSON, never evaluated — for code that runs where the
|
|
36260
|
+
* admin UI's reader does not (the hub re-expanding template instances, #527).
|
|
36261
|
+
*
|
|
36262
|
+
* A brace scan, not a regex: the recipe nests. Strings are tracked so a `}`
|
|
36263
|
+
* inside a device name cannot close the object early; the value is
|
|
36264
|
+
* `JSON.stringify` output, so `"` is the only quote that can open one.
|
|
36265
|
+
*/
|
|
36266
|
+
/** The declaration the generator emits, matched whole. */
|
|
36267
|
+
var AUTOMATION_RECIPE_DECLARATION = "const AUTOMATION_RECIPE =";
|
|
36268
|
+
/** The JSON text of the literal, or null when the code declares none. */
|
|
36269
|
+
function findRecipeLiteralJson(code) {
|
|
36270
|
+
const declStart = code.indexOf(AUTOMATION_RECIPE_DECLARATION);
|
|
36271
|
+
if (declStart < 0) return null;
|
|
36272
|
+
const start = code.indexOf("{", declStart + 25);
|
|
36273
|
+
if (start < 0) return null;
|
|
36274
|
+
let depth = 0;
|
|
36275
|
+
let inString = false;
|
|
36276
|
+
let escaped = false;
|
|
36277
|
+
for (let i = start; i < code.length; i += 1) {
|
|
36278
|
+
const ch = code.charAt(i);
|
|
36279
|
+
if (inString) {
|
|
36280
|
+
if (escaped) escaped = false;
|
|
36281
|
+
else if (ch === "\\") escaped = true;
|
|
36282
|
+
else if (ch === "\"") inString = false;
|
|
36283
|
+
continue;
|
|
36284
|
+
}
|
|
36285
|
+
if (ch === "\"") {
|
|
36286
|
+
inString = true;
|
|
36287
|
+
continue;
|
|
36288
|
+
}
|
|
36289
|
+
if (ch === "{") depth += 1;
|
|
36290
|
+
else if (ch === "}") {
|
|
36291
|
+
depth -= 1;
|
|
36292
|
+
if (depth === 0) return code.slice(start, i + 1);
|
|
36293
|
+
}
|
|
36294
|
+
}
|
|
36295
|
+
return null;
|
|
36296
|
+
}
|
|
36297
|
+
function readRecipeLiteral(code) {
|
|
36298
|
+
const json = findRecipeLiteralJson(code);
|
|
36299
|
+
if (json === null) return { status: "none" };
|
|
36300
|
+
let raw;
|
|
36301
|
+
try {
|
|
36302
|
+
raw = JSON.parse(json);
|
|
36303
|
+
} catch (error) {
|
|
36304
|
+
return {
|
|
36305
|
+
status: "invalid",
|
|
36306
|
+
detail: error instanceof Error ? error.message : String(error)
|
|
36307
|
+
};
|
|
36308
|
+
}
|
|
36309
|
+
const parsed = AutomationRecipeSchema.safeParse(raw);
|
|
36310
|
+
if (parsed.success) return {
|
|
36311
|
+
status: "recipe",
|
|
36312
|
+
recipe: parsed.data
|
|
36313
|
+
};
|
|
36314
|
+
const first = parsed.error.issues[0];
|
|
36315
|
+
return {
|
|
36316
|
+
status: "invalid",
|
|
36317
|
+
detail: first === void 0 ? "not a recipe" : `${first.path.join(".")}: ${first.message}`
|
|
36318
|
+
};
|
|
36319
|
+
}
|
|
36320
|
+
/** Where the literal's JSON sits in the code, or null when there is none. */
|
|
36321
|
+
function literalSpan(code) {
|
|
36322
|
+
const json = findRecipeLiteralJson(code);
|
|
36323
|
+
if (json === null) return null;
|
|
36324
|
+
const start = code.indexOf(json, code.indexOf(AUTOMATION_RECIPE_DECLARATION));
|
|
36325
|
+
return {
|
|
36326
|
+
start,
|
|
36327
|
+
end: start + json.length
|
|
36328
|
+
};
|
|
36329
|
+
}
|
|
36330
|
+
/** FNV-1a, 32 bit, hex: a fingerprint, not a security boundary. */
|
|
36331
|
+
function fnv1a(text) {
|
|
36332
|
+
let hash = 2166136261;
|
|
36333
|
+
for (let i = 0; i < text.length; i += 1) {
|
|
36334
|
+
hash ^= text.charCodeAt(i);
|
|
36335
|
+
hash = Math.imul(hash, 16777619) >>> 0;
|
|
36336
|
+
}
|
|
36337
|
+
return hash.toString(16).padStart(8, "0");
|
|
36338
|
+
}
|
|
36339
|
+
/**
|
|
36340
|
+
* The fingerprint of a block's code with its recipe literal blanked, so the
|
|
36341
|
+
* hash a literal carries does not change the hash. Null when there is no literal.
|
|
36342
|
+
*/
|
|
36343
|
+
function instanceCodeHash(code) {
|
|
36344
|
+
const span = literalSpan(code);
|
|
36345
|
+
if (span === null) return null;
|
|
36346
|
+
return fnv1a(`${code.slice(0, span.start)}{}${code.slice(span.end)}`);
|
|
36347
|
+
}
|
|
36348
|
+
/** The same code with only its recipe literal replaced; everything else is kept byte for byte. */
|
|
36349
|
+
function replaceRecipeLiteral(code, recipe) {
|
|
36350
|
+
const span = literalSpan(code);
|
|
36351
|
+
if (span === null) return null;
|
|
36352
|
+
return `${code.slice(0, span.start)}${JSON.stringify(recipe, null, 2)}${code.slice(span.end)}`;
|
|
36353
|
+
}
|
|
36354
|
+
//#endregion
|
|
36173
36355
|
//#region src/automation/trigger-variables.ts
|
|
36174
36356
|
var DETECTION_DESCRIPTIONS = {
|
|
36175
36357
|
deviceId: "the camera that saw it",
|
|
@@ -36688,7 +36870,41 @@ function emitAction(action, index) {
|
|
|
36688
36870
|
* discover that, but it is the last place it can still be caught before code
|
|
36689
36871
|
* that the operator did not author starts running.
|
|
36690
36872
|
*/
|
|
36873
|
+
/**
|
|
36874
|
+
* An instance of an automation template (#527) also carries the fingerprint of
|
|
36875
|
+
* the code it was generated as (`template.codeHash`), so the hub can tell a
|
|
36876
|
+
* block edited by hand from one it may regenerate. The fingerprint blanks the
|
|
36877
|
+
* literal, so stamping it does not change it.
|
|
36878
|
+
*/
|
|
36691
36879
|
function generateAutomationBlock(input) {
|
|
36880
|
+
const link = input.recipe.template;
|
|
36881
|
+
if (link === void 0) return renderAutomationBlock(input);
|
|
36882
|
+
const unstamped = {
|
|
36883
|
+
templateId: link.templateId,
|
|
36884
|
+
values: link.values,
|
|
36885
|
+
...link.problems === void 0 ? {} : { problems: link.problems }
|
|
36886
|
+
};
|
|
36887
|
+
const first = renderAutomationBlock({
|
|
36888
|
+
...input,
|
|
36889
|
+
recipe: {
|
|
36890
|
+
...input.recipe,
|
|
36891
|
+
template: unstamped
|
|
36892
|
+
}
|
|
36893
|
+
});
|
|
36894
|
+
const codeHash = instanceCodeHash(first);
|
|
36895
|
+
if (codeHash === null) return first;
|
|
36896
|
+
return renderAutomationBlock({
|
|
36897
|
+
...input,
|
|
36898
|
+
recipe: {
|
|
36899
|
+
...input.recipe,
|
|
36900
|
+
template: {
|
|
36901
|
+
...unstamped,
|
|
36902
|
+
codeHash
|
|
36903
|
+
}
|
|
36904
|
+
}
|
|
36905
|
+
});
|
|
36906
|
+
}
|
|
36907
|
+
function renderAutomationBlock(input) {
|
|
36692
36908
|
const boundsError = validateRecipeBounds(input.recipe);
|
|
36693
36909
|
if (boundsError !== null) throw new Error(`cannot generate an automation from an invalid recipe: ${boundsError}`);
|
|
36694
36910
|
const { name, recipe } = input;
|
|
@@ -37794,10 +38010,10 @@ var eventEmitterCapability = {
|
|
|
37794
38010
|
/** How deep a payload is walked, and how many variables one fire may add. */
|
|
37795
38011
|
var MAX_DATA_DEPTH = 3;
|
|
37796
38012
|
var MAX_DATA_VARS = 32;
|
|
37797
|
-
function isScalar(value) {
|
|
38013
|
+
function isScalar$1(value) {
|
|
37798
38014
|
return typeof value === "string" || typeof value === "number" || typeof value === "boolean";
|
|
37799
38015
|
}
|
|
37800
|
-
function isRecord$
|
|
38016
|
+
function isRecord$5(value) {
|
|
37801
38017
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
37802
38018
|
}
|
|
37803
38019
|
/** The scalars of a fire's payload as `data.<path>` variables; lists and nulls are left out. */
|
|
@@ -37805,20 +38021,20 @@ function firedDataVars(data) {
|
|
|
37805
38021
|
const out = {};
|
|
37806
38022
|
const walk = (value, path, depth) => {
|
|
37807
38023
|
if (Object.keys(out).length >= MAX_DATA_VARS) return;
|
|
37808
|
-
if (isScalar(value)) {
|
|
38024
|
+
if (isScalar$1(value)) {
|
|
37809
38025
|
out[path] = value;
|
|
37810
38026
|
return;
|
|
37811
38027
|
}
|
|
37812
|
-
if (!isRecord$
|
|
38028
|
+
if (!isRecord$5(value) || depth >= MAX_DATA_DEPTH) return;
|
|
37813
38029
|
for (const [key, child] of Object.entries(value)) walk(child, `${path}.${key}`, depth + 1);
|
|
37814
38030
|
};
|
|
37815
|
-
if (isRecord$
|
|
38031
|
+
if (isRecord$5(data)) for (const [key, child] of Object.entries(data)) walk(child, `data.${key}`, 1);
|
|
37816
38032
|
return out;
|
|
37817
38033
|
}
|
|
37818
38034
|
function readPath(data, path) {
|
|
37819
38035
|
let cursor = data;
|
|
37820
38036
|
for (const part of path.split(".")) {
|
|
37821
|
-
if (!isRecord$
|
|
38037
|
+
if (!isRecord$5(cursor)) return void 0;
|
|
37822
38038
|
cursor = cursor[part];
|
|
37823
38039
|
}
|
|
37824
38040
|
return cursor;
|
|
@@ -48518,7 +48734,8 @@ var CAP_CUSTOMIZE_CATALOG = {
|
|
|
48518
48734
|
require_composed_stable_id.DeviceType.Washer,
|
|
48519
48735
|
require_composed_stable_id.DeviceType.Dryer,
|
|
48520
48736
|
require_composed_stable_id.DeviceType.Gateway,
|
|
48521
|
-
require_composed_stable_id.DeviceType.HeatPump
|
|
48737
|
+
require_composed_stable_id.DeviceType.HeatPump,
|
|
48738
|
+
require_composed_stable_id.DeviceType.EnergySystem
|
|
48522
48739
|
],
|
|
48523
48740
|
apply: "add",
|
|
48524
48741
|
vocabularyCap: "consumables",
|
|
@@ -50341,7 +50558,7 @@ function groupTemplate(id) {
|
|
|
50341
50558
|
//#region src/generated/history-catalog.ts
|
|
50342
50559
|
/**
|
|
50343
50560
|
* Cap history catalog, projected from every `*.cap.ts` `history` block.
|
|
50344
|
-
*
|
|
50561
|
+
* 45 caps with series (103 series), 37 caps answered `'none'`.
|
|
50345
50562
|
* Field keys are `runtimeState` paths (`a.b` into fixed objects only).
|
|
50346
50563
|
*/
|
|
50347
50564
|
var HISTORY_CATALOG = {
|
|
@@ -50485,6 +50702,85 @@ var HISTORY_CATALOG = {
|
|
|
50485
50702
|
"powerOn": { kind: "boolean" }
|
|
50486
50703
|
},
|
|
50487
50704
|
"do-not-disturb": { "enabled": { kind: "boolean" } },
|
|
50705
|
+
"energy-system": {
|
|
50706
|
+
"solar.powerW": {
|
|
50707
|
+
kind: "gauge",
|
|
50708
|
+
unit: "W",
|
|
50709
|
+
deadband: 50,
|
|
50710
|
+
displayName: "Solar power"
|
|
50711
|
+
},
|
|
50712
|
+
"solar.energyKwh": {
|
|
50713
|
+
kind: "counter",
|
|
50714
|
+
unit: "kWh",
|
|
50715
|
+
displayName: "Solar energy"
|
|
50716
|
+
},
|
|
50717
|
+
"grid.powerW": {
|
|
50718
|
+
kind: "gauge",
|
|
50719
|
+
unit: "W",
|
|
50720
|
+
deadband: 50,
|
|
50721
|
+
displayName: "Grid power"
|
|
50722
|
+
},
|
|
50723
|
+
"grid.importKwh": {
|
|
50724
|
+
kind: "counter",
|
|
50725
|
+
unit: "kWh",
|
|
50726
|
+
displayName: "Grid import"
|
|
50727
|
+
},
|
|
50728
|
+
"grid.exportKwh": {
|
|
50729
|
+
kind: "counter",
|
|
50730
|
+
unit: "kWh",
|
|
50731
|
+
displayName: "Grid export"
|
|
50732
|
+
},
|
|
50733
|
+
"house.powerW": {
|
|
50734
|
+
kind: "gauge",
|
|
50735
|
+
unit: "W",
|
|
50736
|
+
deadband: 50,
|
|
50737
|
+
displayName: "House power"
|
|
50738
|
+
},
|
|
50739
|
+
"house.energyKwh": {
|
|
50740
|
+
kind: "counter",
|
|
50741
|
+
unit: "kWh",
|
|
50742
|
+
displayName: "House energy"
|
|
50743
|
+
},
|
|
50744
|
+
"heatPump.powerW": {
|
|
50745
|
+
kind: "gauge",
|
|
50746
|
+
unit: "W",
|
|
50747
|
+
deadband: 50,
|
|
50748
|
+
displayName: "Heat pump power"
|
|
50749
|
+
},
|
|
50750
|
+
"heatPump.energyKwh": {
|
|
50751
|
+
kind: "counter",
|
|
50752
|
+
unit: "kWh",
|
|
50753
|
+
displayName: "Heat pump energy"
|
|
50754
|
+
},
|
|
50755
|
+
"storage.stateOfChargePct": {
|
|
50756
|
+
kind: "gauge",
|
|
50757
|
+
unit: "%",
|
|
50758
|
+
deadband: 1,
|
|
50759
|
+
displayName: "Storage charge"
|
|
50760
|
+
},
|
|
50761
|
+
"storage.storedKwh": {
|
|
50762
|
+
kind: "gauge",
|
|
50763
|
+
unit: "kWh",
|
|
50764
|
+
deadband: .05,
|
|
50765
|
+
displayName: "Stored energy"
|
|
50766
|
+
},
|
|
50767
|
+
"storage.powerW": {
|
|
50768
|
+
kind: "gauge",
|
|
50769
|
+
unit: "W",
|
|
50770
|
+
deadband: 50,
|
|
50771
|
+
displayName: "Storage power"
|
|
50772
|
+
},
|
|
50773
|
+
"storage.chargedKwh": {
|
|
50774
|
+
kind: "counter",
|
|
50775
|
+
unit: "kWh",
|
|
50776
|
+
displayName: "Storage charged"
|
|
50777
|
+
},
|
|
50778
|
+
"storage.dischargedKwh": {
|
|
50779
|
+
kind: "counter",
|
|
50780
|
+
unit: "kWh",
|
|
50781
|
+
displayName: "Storage discharged"
|
|
50782
|
+
}
|
|
50783
|
+
},
|
|
50488
50784
|
"enum-sensor": { "value": {
|
|
50489
50785
|
kind: "enum",
|
|
50490
50786
|
skipWhenSet: "timestamp"
|
|
@@ -54987,13 +55283,13 @@ var DeviceTemplateRenderSchema = zod.z.discriminatedUnion("ok", [zod.z.object({
|
|
|
54987
55283
|
function templateCapKey(cap) {
|
|
54988
55284
|
return cap.replace(/-/g, "_");
|
|
54989
55285
|
}
|
|
54990
|
-
function isRecord$
|
|
55286
|
+
function isRecord$4(value) {
|
|
54991
55287
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
54992
55288
|
}
|
|
54993
55289
|
function pickPath(root, path) {
|
|
54994
55290
|
let cursor = root;
|
|
54995
55291
|
for (const part of path) if (Array.isArray(cursor) && typeof part === "number") cursor = cursor[part];
|
|
54996
|
-
else if (isRecord$
|
|
55292
|
+
else if (isRecord$4(cursor) && Object.hasOwn(cursor, String(part))) cursor = cursor[String(part)];
|
|
54997
55293
|
else return;
|
|
54998
55294
|
return cursor;
|
|
54999
55295
|
}
|
|
@@ -55030,7 +55326,7 @@ function resolveTemplateRef(view, path) {
|
|
|
55030
55326
|
}
|
|
55031
55327
|
const owners = caps.filter((cap) => {
|
|
55032
55328
|
const slice = view.slices[cap];
|
|
55033
|
-
return isRecord$
|
|
55329
|
+
return isRecord$4(slice) && Object.hasOwn(slice, String(head));
|
|
55034
55330
|
});
|
|
55035
55331
|
if (owners.length === 0) return {
|
|
55036
55332
|
kind: "missing",
|
|
@@ -59930,6 +60226,200 @@ var embeddingEncoderCapability = {
|
|
|
59930
60226
|
vocabulary: { notOperatorFacing: require_sleep.NOT_A_DEVICE.ML }
|
|
59931
60227
|
};
|
|
59932
60228
|
//#endregion
|
|
60229
|
+
//#region src/capabilities/energy-system.cap.ts
|
|
60230
|
+
/**
|
|
60231
|
+
* Energy system (#513): the one READ-ONLY cap of a home energy installation —
|
|
60232
|
+
* solar production, the grid connection, the house, a heat pump where the
|
|
60233
|
+
* system meters one, and the storage. Each part is a branch of one bus.
|
|
60234
|
+
*
|
|
60235
|
+
* A part the system does not have is `null` (the whole object); a value the
|
|
60236
|
+
* system did not report is `null`, never `0` (D393).
|
|
60237
|
+
*
|
|
60238
|
+
* Signs, all in watts:
|
|
60239
|
+
* - `solar.powerW`, `house.powerW`, `heatPump.powerW` are magnitudes (≥ 0);
|
|
60240
|
+
* - `grid.powerW` is + importing, − exporting;
|
|
60241
|
+
* - `storage.powerW` is + charging, − discharging.
|
|
60242
|
+
*
|
|
60243
|
+
* The storage is a FIELD of this model, never the `battery` cap: that cap says
|
|
60244
|
+
* a device runs on a battery and feeds the low-battery alerts, and a home
|
|
60245
|
+
* storage at 19 % is not a device about to go flat (#522).
|
|
60246
|
+
*
|
|
60247
|
+
* Lifetime kWh are counters (D944); a `…TodayKwh` is the system's own day total.
|
|
60248
|
+
* The self-consumption share is not a field: it derives at read time
|
|
60249
|
+
* ({@link energySystemSelfConsumptionPct}).
|
|
60250
|
+
*/
|
|
60251
|
+
/** Production: the panels. */
|
|
60252
|
+
var EnergySolarSchema = zod.z.object({
|
|
60253
|
+
powerW: zod.z.number().nullable().meta(require_sleep.readingMeta("power")),
|
|
60254
|
+
/** Lifetime production, kWh. */
|
|
60255
|
+
energyKwh: zod.z.number().nullable().meta(require_sleep.readingMeta("energy")),
|
|
60256
|
+
/** Produced today, kWh. */
|
|
60257
|
+
todayKwh: zod.z.number().nullable().meta(require_sleep.readingMeta("energy"))
|
|
60258
|
+
});
|
|
60259
|
+
/** The grid connection: + import, − export. */
|
|
60260
|
+
var EnergyGridSchema = zod.z.object({
|
|
60261
|
+
powerW: zod.z.number().nullable().meta(require_sleep.readingMeta("power")),
|
|
60262
|
+
/** Lifetime imported, kWh. */
|
|
60263
|
+
importKwh: zod.z.number().nullable().meta(require_sleep.readingMeta("energy")),
|
|
60264
|
+
/** Lifetime exported, kWh. */
|
|
60265
|
+
exportKwh: zod.z.number().nullable().meta(require_sleep.readingMeta("energy")),
|
|
60266
|
+
importTodayKwh: zod.z.number().nullable().meta(require_sleep.readingMeta("energy")),
|
|
60267
|
+
exportTodayKwh: zod.z.number().nullable().meta(require_sleep.readingMeta("energy"))
|
|
60268
|
+
});
|
|
60269
|
+
/** A consumer on the bus (the house, the heat pump): power and energy drawn. */
|
|
60270
|
+
var EnergyConsumerSchema = zod.z.object({
|
|
60271
|
+
powerW: zod.z.number().nullable().meta(require_sleep.readingMeta("power")),
|
|
60272
|
+
/** Lifetime consumption, kWh. */
|
|
60273
|
+
energyKwh: zod.z.number().nullable().meta(require_sleep.readingMeta("energy")),
|
|
60274
|
+
/** Consumed today, kWh. */
|
|
60275
|
+
todayKwh: zod.z.number().nullable().meta(require_sleep.readingMeta("energy"))
|
|
60276
|
+
});
|
|
60277
|
+
/** The home storage (accumulo): + charging, − discharging. */
|
|
60278
|
+
var EnergyStorageSchema = zod.z.object({
|
|
60279
|
+
/** State of charge, 0..100. */
|
|
60280
|
+
stateOfChargePct: zod.z.number().nullable().meta(require_sleep.readingMeta("percentage")),
|
|
60281
|
+
/** Energy held now, kWh. */
|
|
60282
|
+
storedKwh: zod.z.number().nullable().meta(require_sleep.readingMeta("energy")),
|
|
60283
|
+
/** Usable capacity, kWh. */
|
|
60284
|
+
capacityKwh: zod.z.number().nullable().meta(require_sleep.readingMeta("energy")),
|
|
60285
|
+
powerW: zod.z.number().nullable().meta(require_sleep.readingMeta("power")),
|
|
60286
|
+
/** Lifetime charged, kWh. */
|
|
60287
|
+
chargedKwh: zod.z.number().nullable().meta(require_sleep.readingMeta("energy")),
|
|
60288
|
+
/** Lifetime discharged, kWh. */
|
|
60289
|
+
dischargedKwh: zod.z.number().nullable().meta(require_sleep.readingMeta("energy")),
|
|
60290
|
+
chargedTodayKwh: zod.z.number().nullable().meta(require_sleep.readingMeta("energy")),
|
|
60291
|
+
dischargedTodayKwh: zod.z.number().nullable().meta(require_sleep.readingMeta("energy"))
|
|
60292
|
+
});
|
|
60293
|
+
var EnergySystemStatusSchema = zod.z.object({
|
|
60294
|
+
solar: EnergySolarSchema.nullable(),
|
|
60295
|
+
grid: EnergyGridSchema.nullable(),
|
|
60296
|
+
house: EnergyConsumerSchema.nullable(),
|
|
60297
|
+
heatPump: EnergyConsumerSchema.nullable(),
|
|
60298
|
+
storage: EnergyStorageSchema.nullable(),
|
|
60299
|
+
/** Ms epoch when the slice was last read from the system. */
|
|
60300
|
+
lastFetchedAt: zod.z.number()
|
|
60301
|
+
});
|
|
60302
|
+
/**
|
|
60303
|
+
* Today's self-consumption: the share of today's production that was not
|
|
60304
|
+
* exported, in percent. Null unless both totals are known and something was
|
|
60305
|
+
* produced — a missing total is never a 0 or a division by it (D393).
|
|
60306
|
+
*/
|
|
60307
|
+
function energySystemSelfConsumptionPct(status) {
|
|
60308
|
+
const produced = status.solar?.todayKwh ?? null;
|
|
60309
|
+
const exported = status.grid?.exportTodayKwh ?? null;
|
|
60310
|
+
if (produced === null || exported === null || produced <= 0) return null;
|
|
60311
|
+
return Math.max(0, Math.min(100, (produced - exported) / produced * 100));
|
|
60312
|
+
}
|
|
60313
|
+
var energySystemCapability = {
|
|
60314
|
+
name: "energy-system",
|
|
60315
|
+
scope: "device",
|
|
60316
|
+
deviceNative: true,
|
|
60317
|
+
mode: "singleton",
|
|
60318
|
+
deviceTypes: [require_composed_stable_id.DeviceType.EnergySystem],
|
|
60319
|
+
methods: {},
|
|
60320
|
+
status: {
|
|
60321
|
+
schema: EnergySystemStatusSchema,
|
|
60322
|
+
kind: "push"
|
|
60323
|
+
},
|
|
60324
|
+
runtimeState: EnergySystemStatusSchema,
|
|
60325
|
+
/**
|
|
60326
|
+
* Runtime-state durability: **session** — the system answers on the next
|
|
60327
|
+
* poll, so a restart that clears the slice loses nothing a reader needs (the
|
|
60328
|
+
* series are recorded). See `RuntimeStateDurability`.
|
|
60329
|
+
*/
|
|
60330
|
+
durability: "session",
|
|
60331
|
+
/**
|
|
60332
|
+
* History (D850): every power is a gauge, every lifetime kWh a counter (the
|
|
60333
|
+
* kWh of a period is computed at read time, D944). A part the system does not
|
|
60334
|
+
* have is null and records nothing. Day totals are not recorded: they are the
|
|
60335
|
+
* counters' difference over the day.
|
|
60336
|
+
*/
|
|
60337
|
+
history: { fields: {
|
|
60338
|
+
"solar.powerW": {
|
|
60339
|
+
kind: "gauge",
|
|
60340
|
+
unit: "W",
|
|
60341
|
+
deadband: 50,
|
|
60342
|
+
displayName: "Solar power"
|
|
60343
|
+
},
|
|
60344
|
+
"solar.energyKwh": {
|
|
60345
|
+
kind: "counter",
|
|
60346
|
+
unit: "kWh",
|
|
60347
|
+
displayName: "Solar energy"
|
|
60348
|
+
},
|
|
60349
|
+
"grid.powerW": {
|
|
60350
|
+
kind: "gauge",
|
|
60351
|
+
unit: "W",
|
|
60352
|
+
deadband: 50,
|
|
60353
|
+
displayName: "Grid power"
|
|
60354
|
+
},
|
|
60355
|
+
"grid.importKwh": {
|
|
60356
|
+
kind: "counter",
|
|
60357
|
+
unit: "kWh",
|
|
60358
|
+
displayName: "Grid import"
|
|
60359
|
+
},
|
|
60360
|
+
"grid.exportKwh": {
|
|
60361
|
+
kind: "counter",
|
|
60362
|
+
unit: "kWh",
|
|
60363
|
+
displayName: "Grid export"
|
|
60364
|
+
},
|
|
60365
|
+
"house.powerW": {
|
|
60366
|
+
kind: "gauge",
|
|
60367
|
+
unit: "W",
|
|
60368
|
+
deadband: 50,
|
|
60369
|
+
displayName: "House power"
|
|
60370
|
+
},
|
|
60371
|
+
"house.energyKwh": {
|
|
60372
|
+
kind: "counter",
|
|
60373
|
+
unit: "kWh",
|
|
60374
|
+
displayName: "House energy"
|
|
60375
|
+
},
|
|
60376
|
+
"heatPump.powerW": {
|
|
60377
|
+
kind: "gauge",
|
|
60378
|
+
unit: "W",
|
|
60379
|
+
deadband: 50,
|
|
60380
|
+
displayName: "Heat pump power"
|
|
60381
|
+
},
|
|
60382
|
+
"heatPump.energyKwh": {
|
|
60383
|
+
kind: "counter",
|
|
60384
|
+
unit: "kWh",
|
|
60385
|
+
displayName: "Heat pump energy"
|
|
60386
|
+
},
|
|
60387
|
+
"storage.stateOfChargePct": {
|
|
60388
|
+
kind: "gauge",
|
|
60389
|
+
unit: "%",
|
|
60390
|
+
deadband: 1,
|
|
60391
|
+
displayName: "Storage charge"
|
|
60392
|
+
},
|
|
60393
|
+
"storage.storedKwh": {
|
|
60394
|
+
kind: "gauge",
|
|
60395
|
+
unit: "kWh",
|
|
60396
|
+
deadband: .05,
|
|
60397
|
+
displayName: "Stored energy"
|
|
60398
|
+
},
|
|
60399
|
+
"storage.powerW": {
|
|
60400
|
+
kind: "gauge",
|
|
60401
|
+
unit: "W",
|
|
60402
|
+
deadband: 50,
|
|
60403
|
+
displayName: "Storage power"
|
|
60404
|
+
},
|
|
60405
|
+
"storage.chargedKwh": {
|
|
60406
|
+
kind: "counter",
|
|
60407
|
+
unit: "kWh",
|
|
60408
|
+
displayName: "Storage charged"
|
|
60409
|
+
},
|
|
60410
|
+
"storage.dischargedKwh": {
|
|
60411
|
+
kind: "counter",
|
|
60412
|
+
unit: "kWh",
|
|
60413
|
+
displayName: "Storage discharged"
|
|
60414
|
+
}
|
|
60415
|
+
} },
|
|
60416
|
+
volatileStateFields: ["lastFetchedAt"],
|
|
60417
|
+
vocabulary: {
|
|
60418
|
+
noun: require_sleep.t("Energy system", "Sistema energetico"),
|
|
60419
|
+
order: 4020
|
|
60420
|
+
}
|
|
60421
|
+
};
|
|
60422
|
+
//#endregion
|
|
59933
60423
|
//#region src/capabilities/enum-sensor.cap.ts
|
|
59934
60424
|
/**
|
|
59935
60425
|
* Enum-state sensor — a string value picked from a finite option set.
|
|
@@ -62853,6 +63343,7 @@ var HERO_SCENE_BY_TYPE = {
|
|
|
62853
63343
|
[require_composed_stable_id.DeviceType.Humidifier]: "control-dial",
|
|
62854
63344
|
[require_composed_stable_id.DeviceType.WaterHeater]: "heater",
|
|
62855
63345
|
[require_composed_stable_id.DeviceType.HeatPump]: "heat-pump",
|
|
63346
|
+
[require_composed_stable_id.DeviceType.EnergySystem]: "generic",
|
|
62856
63347
|
[require_composed_stable_id.DeviceType.Fan]: "fan",
|
|
62857
63348
|
[require_composed_stable_id.DeviceType.MediaPlayer]: "tv",
|
|
62858
63349
|
[require_composed_stable_id.DeviceType.AlarmPanel]: "alarm",
|
|
@@ -64388,6 +64879,19 @@ var IntegrationInstanceKindSchema = zod.z.object({
|
|
|
64388
64879
|
* finds the instances whose kind names it; absent takes the kind `id`.
|
|
64389
64880
|
*/
|
|
64390
64881
|
brokerKind: zod.z.string().min(1).optional(),
|
|
64882
|
+
/**
|
|
64883
|
+
* Other function caps an instance of this kind also serves (a Google account sends mail, so it
|
|
64884
|
+
* serves `smtp-provider` beside being a `broker`). A link to one of these caps lists and accepts
|
|
64885
|
+
* the instance; a page section stays the kinds whose `functionCap` it names. Absent means none.
|
|
64886
|
+
*/
|
|
64887
|
+
alsoServes: zod.z.array(zod.z.string().min(1)).optional(),
|
|
64888
|
+
/**
|
|
64889
|
+
* The kind's own icon (a brand mark), hub-relative or a `data:` URI. Absent: the client shows
|
|
64890
|
+
* the provider addon's icon.
|
|
64891
|
+
*/
|
|
64892
|
+
iconUrl: zod.z.string().min(1).optional(),
|
|
64893
|
+
/** The media type `iconUrl` serves (`image/svg+xml`, `image/png`); the URL carries no extension. */
|
|
64894
|
+
iconMediaType: zod.z.string().min(1).optional(),
|
|
64391
64895
|
/** What instances of this kind are for the Integrations page; absent takes the provider's `role`. */
|
|
64392
64896
|
role: IntegrationInstanceRoleSchema.optional(),
|
|
64393
64897
|
/** `testInstance` really probes the remote for this kind; absent takes the provider's `canTest`. */
|
|
@@ -95842,19 +96346,534 @@ var temperatureSensorCapability = {
|
|
|
95842
96346
|
}
|
|
95843
96347
|
};
|
|
95844
96348
|
//#endregion
|
|
96349
|
+
//#region src/template/automation-template.ts
|
|
96350
|
+
/**
|
|
96351
|
+
* Automation templates (#527): the `automation` kind of the template store
|
|
96352
|
+
* (D963). A template is an automation BODY plus declared, typed INPUTS and the
|
|
96353
|
+
* BINDINGS that say where each input's value lands in the body. Creating an
|
|
96354
|
+
* automation from a template asks only for the inputs; the instance stores the
|
|
96355
|
+
* template id and the values (`AutomationRecipe.template`) and is EXPANDED into
|
|
96356
|
+
* an ordinary recipe — same codegen, same engine, same traces.
|
|
96357
|
+
*
|
|
96358
|
+
* The body is not a recipe until it is expanded (a choose with no branch yet,
|
|
96359
|
+
* a leaf with no device), so it is stored as JSON and judged only after the
|
|
96360
|
+
* expansion, by `AutomationRecipeSchema`.
|
|
96361
|
+
*
|
|
96362
|
+
* Bindings are paths into the body:
|
|
96363
|
+
* - `value` writes one input's value at a path. Device, number, duration,
|
|
96364
|
+
* text, select and boolean values REPLACE what is there (a device with
|
|
96365
|
+
* `as: 'target'` becomes `{ kind: 'devices', ids }`); event and action values
|
|
96366
|
+
* MERGE into the object at the path (a `device-fired` row, a command step).
|
|
96367
|
+
* - `rows` appends one copy of `item` per row of a repeatable group to the list
|
|
96368
|
+
* at the path, each copy filled by its own row-relative bindings; `row-id`
|
|
96369
|
+
* writes `<group>-<index>`, so a row's event leaf and the branch that reads it
|
|
96370
|
+
* (`triggered-by`) agree on one name.
|
|
96371
|
+
*
|
|
96372
|
+
* Everything here is pure: the admin UI expands on save and the hub re-expands
|
|
96373
|
+
* every instance when a template changes, with the same function.
|
|
96374
|
+
*/
|
|
96375
|
+
var TEMPLATE_INPUT_KEY_RE = /^[A-Za-z][A-Za-z0-9_]{0,39}$/;
|
|
96376
|
+
var inputKey = zod.z.string().regex(TEMPLATE_INPUT_KEY_RE);
|
|
96377
|
+
var inputBase = {
|
|
96378
|
+
key: inputKey,
|
|
96379
|
+
label: zod.z.string().min(1).max(80),
|
|
96380
|
+
description: zod.z.string().max(300).optional(),
|
|
96381
|
+
/** Absent means required. */
|
|
96382
|
+
optional: zod.z.literal(true).optional()
|
|
96383
|
+
};
|
|
96384
|
+
var TemplateDeviceFilterSchema = zod.z.object({
|
|
96385
|
+
/** Only devices that offer this capability. */
|
|
96386
|
+
capability: zod.z.string().min(1).optional(),
|
|
96387
|
+
/** Only devices of this role / device type (`light`, `switch`, `button`). */
|
|
96388
|
+
role: zod.z.string().min(1).optional()
|
|
96389
|
+
});
|
|
96390
|
+
var DeviceInputSchema = zod.z.object({
|
|
96391
|
+
kind: zod.z.literal("device"),
|
|
96392
|
+
...inputBase,
|
|
96393
|
+
multiple: zod.z.literal(true).optional(),
|
|
96394
|
+
filter: TemplateDeviceFilterSchema.optional()
|
|
96395
|
+
});
|
|
96396
|
+
var EventInputSchema = zod.z.object({
|
|
96397
|
+
kind: zod.z.literal("event"),
|
|
96398
|
+
...inputBase,
|
|
96399
|
+
/** The device input (same level) whose event vocabulary is offered (D1044). */
|
|
96400
|
+
deviceInput: inputKey
|
|
96401
|
+
});
|
|
96402
|
+
var ActionInputSchema$1 = zod.z.object({
|
|
96403
|
+
kind: zod.z.literal("action"),
|
|
96404
|
+
...inputBase,
|
|
96405
|
+
/** The device input (same level) whose actions are offered; absent offers all (D1050). */
|
|
96406
|
+
deviceInput: inputKey.optional()
|
|
96407
|
+
});
|
|
96408
|
+
var NumberInputSchema = zod.z.object({
|
|
96409
|
+
kind: zod.z.literal("number"),
|
|
96410
|
+
...inputBase,
|
|
96411
|
+
min: zod.z.number().optional(),
|
|
96412
|
+
max: zod.z.number().optional(),
|
|
96413
|
+
default: zod.z.number().optional()
|
|
96414
|
+
});
|
|
96415
|
+
var DurationInputSchema = zod.z.object({
|
|
96416
|
+
kind: zod.z.literal("duration"),
|
|
96417
|
+
...inputBase,
|
|
96418
|
+
/** Seconds. */
|
|
96419
|
+
min: zod.z.number().nonnegative().optional(),
|
|
96420
|
+
max: zod.z.number().nonnegative().optional(),
|
|
96421
|
+
default: zod.z.number().nonnegative().optional()
|
|
96422
|
+
});
|
|
96423
|
+
var TextInputSchema = zod.z.object({
|
|
96424
|
+
kind: zod.z.literal("text"),
|
|
96425
|
+
...inputBase,
|
|
96426
|
+
maxLength: zod.z.number().int().min(1).max(2e3).optional(),
|
|
96427
|
+
default: zod.z.string().optional()
|
|
96428
|
+
});
|
|
96429
|
+
var TemplateSelectOptionSchema = zod.z.object({
|
|
96430
|
+
value: zod.z.string().min(1),
|
|
96431
|
+
label: zod.z.string().min(1).max(80)
|
|
96432
|
+
});
|
|
96433
|
+
var SelectInputSchema = zod.z.object({
|
|
96434
|
+
kind: zod.z.literal("select"),
|
|
96435
|
+
...inputBase,
|
|
96436
|
+
options: zod.z.array(TemplateSelectOptionSchema).min(1).max(50),
|
|
96437
|
+
default: zod.z.string().optional()
|
|
96438
|
+
});
|
|
96439
|
+
var BooleanInputSchema = zod.z.object({
|
|
96440
|
+
kind: zod.z.literal("boolean"),
|
|
96441
|
+
...inputBase,
|
|
96442
|
+
default: zod.z.boolean().optional()
|
|
96443
|
+
});
|
|
96444
|
+
var TemplateScalarInputSchema = zod.z.discriminatedUnion("kind", [
|
|
96445
|
+
DeviceInputSchema,
|
|
96446
|
+
EventInputSchema,
|
|
96447
|
+
ActionInputSchema$1,
|
|
96448
|
+
NumberInputSchema,
|
|
96449
|
+
DurationInputSchema,
|
|
96450
|
+
TextInputSchema,
|
|
96451
|
+
SelectInputSchema,
|
|
96452
|
+
BooleanInputSchema
|
|
96453
|
+
]);
|
|
96454
|
+
var TEMPLATE_GROUP_ROWS_MAX = 20;
|
|
96455
|
+
var GroupInputSchema = zod.z.object({
|
|
96456
|
+
kind: zod.z.literal("group"),
|
|
96457
|
+
...inputBase,
|
|
96458
|
+
inputs: zod.z.array(TemplateScalarInputSchema).min(1).max(10),
|
|
96459
|
+
minRows: zod.z.number().int().min(0).max(20).optional(),
|
|
96460
|
+
maxRows: zod.z.number().int().min(1).max(20).optional()
|
|
96461
|
+
});
|
|
96462
|
+
var TemplateInputSchema = zod.z.discriminatedUnion("kind", [...TemplateScalarInputSchema.options, GroupInputSchema]);
|
|
96463
|
+
var TemplatePathSchema = zod.z.array(zod.z.union([zod.z.string().min(1), zod.z.number().int().nonnegative()])).max(24);
|
|
96464
|
+
var TemplateValueBindingSchema = zod.z.object({
|
|
96465
|
+
kind: zod.z.literal("value"),
|
|
96466
|
+
input: inputKey,
|
|
96467
|
+
path: TemplatePathSchema,
|
|
96468
|
+
/** A device value written as a step target (`{ kind: 'devices', ids }`). */
|
|
96469
|
+
as: zod.z.literal("target").optional()
|
|
96470
|
+
});
|
|
96471
|
+
var TemplateRowIdBindingSchema = zod.z.object({
|
|
96472
|
+
kind: zod.z.literal("row-id"),
|
|
96473
|
+
path: TemplatePathSchema
|
|
96474
|
+
});
|
|
96475
|
+
var TemplateRowItemBindingSchema = zod.z.discriminatedUnion("kind", [TemplateValueBindingSchema, TemplateRowIdBindingSchema]);
|
|
96476
|
+
var TemplateRowsBindingSchema = zod.z.object({
|
|
96477
|
+
kind: zod.z.literal("rows"),
|
|
96478
|
+
input: inputKey,
|
|
96479
|
+
/** The list in the body the rows are appended to. */
|
|
96480
|
+
path: TemplatePathSchema,
|
|
96481
|
+
/** The JSON copied once per row. */
|
|
96482
|
+
item: zod.z.unknown(),
|
|
96483
|
+
bindings: zod.z.array(TemplateRowItemBindingSchema).max(40)
|
|
96484
|
+
});
|
|
96485
|
+
var TemplateBindingSchema = zod.z.discriminatedUnion("kind", [TemplateValueBindingSchema, TemplateRowsBindingSchema]);
|
|
96486
|
+
var AUTOMATION_TEMPLATE_VERSION = 1;
|
|
96487
|
+
function bindingProblems(payload, ctx) {
|
|
96488
|
+
const byKey = /* @__PURE__ */ new Map();
|
|
96489
|
+
payload.inputs.forEach((input, index) => {
|
|
96490
|
+
if (byKey.has(input.key)) ctx.addIssue({
|
|
96491
|
+
code: "custom",
|
|
96492
|
+
message: `input "${input.key}" is declared twice`,
|
|
96493
|
+
path: ["inputs", index]
|
|
96494
|
+
});
|
|
96495
|
+
byKey.set(input.key, input);
|
|
96496
|
+
const siblings = input.kind === "group" ? input.inputs : payload.inputs;
|
|
96497
|
+
for (const scalar of input.kind === "group" ? input.inputs : [input]) {
|
|
96498
|
+
if (scalar.kind !== "event" && scalar.kind !== "action") continue;
|
|
96499
|
+
if (scalar.deviceInput === void 0) continue;
|
|
96500
|
+
const device = siblings.find((s) => s.key === scalar.deviceInput);
|
|
96501
|
+
if (device === void 0 || device.kind !== "device") ctx.addIssue({
|
|
96502
|
+
code: "custom",
|
|
96503
|
+
message: `"${scalar.key}" reads the device input "${scalar.deviceInput}", which is not a device input beside it`,
|
|
96504
|
+
path: ["inputs", index]
|
|
96505
|
+
});
|
|
96506
|
+
}
|
|
96507
|
+
});
|
|
96508
|
+
payload.bindings.forEach((binding, index) => {
|
|
96509
|
+
const input = byKey.get(binding.input);
|
|
96510
|
+
if (input === void 0) {
|
|
96511
|
+
ctx.addIssue({
|
|
96512
|
+
code: "custom",
|
|
96513
|
+
message: `binding names the undeclared input "${binding.input}"`,
|
|
96514
|
+
path: ["bindings", index]
|
|
96515
|
+
});
|
|
96516
|
+
return;
|
|
96517
|
+
}
|
|
96518
|
+
if (binding.kind === "value" && input.kind === "group") ctx.addIssue({
|
|
96519
|
+
code: "custom",
|
|
96520
|
+
message: `group "${input.key}" is bound with rows, not a value`,
|
|
96521
|
+
path: ["bindings", index]
|
|
96522
|
+
});
|
|
96523
|
+
if (binding.kind === "rows") {
|
|
96524
|
+
if (input.kind !== "group") {
|
|
96525
|
+
ctx.addIssue({
|
|
96526
|
+
code: "custom",
|
|
96527
|
+
message: `rows need a group input, "${input.key}" is ${input.kind}`,
|
|
96528
|
+
path: ["bindings", index]
|
|
96529
|
+
});
|
|
96530
|
+
return;
|
|
96531
|
+
}
|
|
96532
|
+
for (const row of binding.bindings) if (row.kind === "value" && !input.inputs.some((i) => i.key === row.input)) ctx.addIssue({
|
|
96533
|
+
code: "custom",
|
|
96534
|
+
message: `row binding names "${row.input}", which group "${input.key}" does not declare`,
|
|
96535
|
+
path: ["bindings", index]
|
|
96536
|
+
});
|
|
96537
|
+
}
|
|
96538
|
+
});
|
|
96539
|
+
}
|
|
96540
|
+
var AutomationTemplatePayloadSchema = zod.z.object({
|
|
96541
|
+
version: zod.z.literal(1),
|
|
96542
|
+
description: zod.z.string().max(500).optional(),
|
|
96543
|
+
/** The automation body; a recipe once the inputs are written into it. */
|
|
96544
|
+
body: zod.z.record(zod.z.string(), zod.z.unknown()),
|
|
96545
|
+
inputs: zod.z.array(TemplateInputSchema).max(30),
|
|
96546
|
+
bindings: zod.z.array(TemplateBindingSchema).max(100)
|
|
96547
|
+
}).superRefine(bindingProblems);
|
|
96548
|
+
function valueProblem(input, value) {
|
|
96549
|
+
switch (input.kind) {
|
|
96550
|
+
case "device":
|
|
96551
|
+
if (input.multiple === true) return Array.isArray(value) && value.length > 0 && value.every((v) => typeof v === "number" && Number.isInteger(v) && v >= 0) ? null : "pick at least one device";
|
|
96552
|
+
return typeof value === "number" && Number.isInteger(value) && value >= 0 ? null : "pick one device";
|
|
96553
|
+
case "event": return TemplateEventValueSchema.safeParse(value).success ? null : "pick an event";
|
|
96554
|
+
case "action": {
|
|
96555
|
+
const parsed = TemplateActionValueSchema.safeParse(value);
|
|
96556
|
+
if (!parsed.success) return "pick an action";
|
|
96557
|
+
return require_sleep.findVocabAction(parsed.data.actionId) === void 0 ? `"${parsed.data.actionId}" is not a vocabulary action` : null;
|
|
96558
|
+
}
|
|
96559
|
+
case "number":
|
|
96560
|
+
case "duration":
|
|
96561
|
+
if (typeof value !== "number" || !Number.isFinite(value)) return "a number is required";
|
|
96562
|
+
if (input.min !== void 0 && value < input.min) return `at least ${input.min}`;
|
|
96563
|
+
if (input.max !== void 0 && value > input.max) return `at most ${input.max}`;
|
|
96564
|
+
return null;
|
|
96565
|
+
case "text":
|
|
96566
|
+
if (typeof value !== "string") return "text is required";
|
|
96567
|
+
return input.maxLength !== void 0 && value.length > input.maxLength ? `at most ${input.maxLength} characters` : null;
|
|
96568
|
+
case "select": return typeof value === "string" && input.options.some((o) => o.value === value) ? null : "pick one of the options";
|
|
96569
|
+
case "boolean": return typeof value === "boolean" ? null : "on or off";
|
|
96570
|
+
}
|
|
96571
|
+
}
|
|
96572
|
+
function defaultOf(input) {
|
|
96573
|
+
switch (input.kind) {
|
|
96574
|
+
case "number":
|
|
96575
|
+
case "duration":
|
|
96576
|
+
case "text":
|
|
96577
|
+
case "select":
|
|
96578
|
+
case "boolean": return input.default;
|
|
96579
|
+
default: return;
|
|
96580
|
+
}
|
|
96581
|
+
}
|
|
96582
|
+
function isScalar(value) {
|
|
96583
|
+
return !(Array.isArray(value) && value.some((v) => typeof v === "object" && v !== null));
|
|
96584
|
+
}
|
|
96585
|
+
function isRowList(value) {
|
|
96586
|
+
return Array.isArray(value) && value.every((v) => typeof v === "object" && v !== null && !Array.isArray(v));
|
|
96587
|
+
}
|
|
96588
|
+
function resolveScalars(inputs, values, prefix, problems) {
|
|
96589
|
+
const out = /* @__PURE__ */ new Map();
|
|
96590
|
+
for (const input of inputs) {
|
|
96591
|
+
const address = `${prefix}${input.key}`;
|
|
96592
|
+
const raw = values[input.key] ?? defaultOf(input);
|
|
96593
|
+
if (raw === void 0) {
|
|
96594
|
+
if (input.optional !== true) problems.push({
|
|
96595
|
+
code: "missing-input",
|
|
96596
|
+
input: address,
|
|
96597
|
+
detail: `"${input.label}" is required`
|
|
96598
|
+
});
|
|
96599
|
+
continue;
|
|
96600
|
+
}
|
|
96601
|
+
const problem = isScalar(raw) ? valueProblem(input, raw) : "a single value is required";
|
|
96602
|
+
if (problem !== null || !isScalar(raw)) {
|
|
96603
|
+
problems.push({
|
|
96604
|
+
code: "invalid-input",
|
|
96605
|
+
input: address,
|
|
96606
|
+
detail: problem ?? "invalid value"
|
|
96607
|
+
});
|
|
96608
|
+
continue;
|
|
96609
|
+
}
|
|
96610
|
+
out.set(input.key, raw);
|
|
96611
|
+
}
|
|
96612
|
+
return out;
|
|
96613
|
+
}
|
|
96614
|
+
function resolveValues(payload, values, problems) {
|
|
96615
|
+
const scalars = resolveScalars(payload.inputs.filter((i) => i.kind !== "group"), values, "", problems);
|
|
96616
|
+
const groups = /* @__PURE__ */ new Map();
|
|
96617
|
+
for (const input of payload.inputs) {
|
|
96618
|
+
if (input.kind !== "group") continue;
|
|
96619
|
+
const raw = values[input.key] ?? [];
|
|
96620
|
+
if (!isRowList(raw)) {
|
|
96621
|
+
problems.push({
|
|
96622
|
+
code: "invalid-input",
|
|
96623
|
+
input: input.key,
|
|
96624
|
+
detail: "a list of rows is required"
|
|
96625
|
+
});
|
|
96626
|
+
continue;
|
|
96627
|
+
}
|
|
96628
|
+
const min = input.minRows ?? (input.optional === true ? 0 : 1);
|
|
96629
|
+
const max = input.maxRows ?? 20;
|
|
96630
|
+
if (raw.length < min) {
|
|
96631
|
+
problems.push({
|
|
96632
|
+
code: raw.length === 0 ? "missing-input" : "invalid-input",
|
|
96633
|
+
input: input.key,
|
|
96634
|
+
detail: `"${input.label}" needs at least ${min} row(s)`
|
|
96635
|
+
});
|
|
96636
|
+
continue;
|
|
96637
|
+
}
|
|
96638
|
+
if (raw.length > max) {
|
|
96639
|
+
problems.push({
|
|
96640
|
+
code: "invalid-input",
|
|
96641
|
+
input: input.key,
|
|
96642
|
+
detail: `"${input.label}" takes at most ${max} row(s)`
|
|
96643
|
+
});
|
|
96644
|
+
continue;
|
|
96645
|
+
}
|
|
96646
|
+
groups.set(input.key, raw.map((row, index) => resolveScalars(input.inputs, row, `${input.key}.${index}.`, problems)));
|
|
96647
|
+
}
|
|
96648
|
+
return {
|
|
96649
|
+
scalars,
|
|
96650
|
+
groups
|
|
96651
|
+
};
|
|
96652
|
+
}
|
|
96653
|
+
function isRecord$3(value) {
|
|
96654
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
96655
|
+
}
|
|
96656
|
+
var PathError = class extends Error {};
|
|
96657
|
+
function getAt(root, path) {
|
|
96658
|
+
let node = root;
|
|
96659
|
+
for (const segment of path) if (typeof segment === "number") node = Array.isArray(node) ? node[segment] : void 0;
|
|
96660
|
+
else node = isRecord$3(node) ? node[segment] : void 0;
|
|
96661
|
+
return node;
|
|
96662
|
+
}
|
|
96663
|
+
/** `root` with `value` at `path`; missing containers are created, a wrong one throws. */
|
|
96664
|
+
function setAt(root, path, value) {
|
|
96665
|
+
const [head, ...rest] = path;
|
|
96666
|
+
if (head === void 0) return value;
|
|
96667
|
+
if (typeof head === "number") {
|
|
96668
|
+
const list = root === void 0 ? [] : root;
|
|
96669
|
+
if (!Array.isArray(list)) throw new PathError(`expected a list at index ${head}`);
|
|
96670
|
+
const next = [...list];
|
|
96671
|
+
next[head] = setAt(list[head], rest, value);
|
|
96672
|
+
return next;
|
|
96673
|
+
}
|
|
96674
|
+
const object = root === void 0 ? {} : root;
|
|
96675
|
+
if (!isRecord$3(object)) throw new PathError(`expected an object at "${head}"`);
|
|
96676
|
+
return {
|
|
96677
|
+
...object,
|
|
96678
|
+
[head]: setAt(object[head], rest, value)
|
|
96679
|
+
};
|
|
96680
|
+
}
|
|
96681
|
+
var EVENT_FIELDS = [
|
|
96682
|
+
"eventIds",
|
|
96683
|
+
"sourceIds",
|
|
96684
|
+
"kinds"
|
|
96685
|
+
];
|
|
96686
|
+
var ACTION_FIELDS = [
|
|
96687
|
+
"actionId",
|
|
96688
|
+
"args",
|
|
96689
|
+
"argUnits"
|
|
96690
|
+
];
|
|
96691
|
+
function mergeInto(current, drop, patch) {
|
|
96692
|
+
const base = isRecord$3(current) ? current : {};
|
|
96693
|
+
return {
|
|
96694
|
+
...Object.fromEntries(Object.entries(base).filter(([k]) => !drop.includes(k))),
|
|
96695
|
+
...patch
|
|
96696
|
+
};
|
|
96697
|
+
}
|
|
96698
|
+
function writeValue(root, binding, input, value) {
|
|
96699
|
+
switch (input.kind) {
|
|
96700
|
+
case "event": return setAt(root, binding.path, mergeInto(getAt(root, binding.path), EVENT_FIELDS, TemplateEventValueSchema.parse(value)));
|
|
96701
|
+
case "action": return setAt(root, binding.path, mergeInto(getAt(root, binding.path), ACTION_FIELDS, TemplateActionValueSchema.parse(value)));
|
|
96702
|
+
case "device":
|
|
96703
|
+
if (binding.as === "target") {
|
|
96704
|
+
const ids = Array.isArray(value) ? value : [value];
|
|
96705
|
+
return setAt(root, binding.path, {
|
|
96706
|
+
kind: "devices",
|
|
96707
|
+
ids
|
|
96708
|
+
});
|
|
96709
|
+
}
|
|
96710
|
+
return setAt(root, binding.path, value);
|
|
96711
|
+
default: return setAt(root, binding.path, value);
|
|
96712
|
+
}
|
|
96713
|
+
}
|
|
96714
|
+
function applyRows(root, binding, group, rows) {
|
|
96715
|
+
const existing = getAt(root, binding.path);
|
|
96716
|
+
const list = existing === void 0 ? [] : existing;
|
|
96717
|
+
if (!Array.isArray(list)) throw new PathError(`rows of "${group.key}" need a list`);
|
|
96718
|
+
const items = rows.map((row, index) => {
|
|
96719
|
+
let item = binding.item;
|
|
96720
|
+
for (const rowBinding of binding.bindings) {
|
|
96721
|
+
if (rowBinding.kind === "row-id") {
|
|
96722
|
+
item = setAt(item, rowBinding.path, `${group.key}-${index}`);
|
|
96723
|
+
continue;
|
|
96724
|
+
}
|
|
96725
|
+
const input = group.inputs.find((i) => i.key === rowBinding.input);
|
|
96726
|
+
const value = row.get(rowBinding.input);
|
|
96727
|
+
if (input === void 0 || value === void 0) continue;
|
|
96728
|
+
item = writeValue(item, rowBinding, input, value);
|
|
96729
|
+
}
|
|
96730
|
+
return item;
|
|
96731
|
+
});
|
|
96732
|
+
return setAt(root, binding.path, [...list, ...items]);
|
|
96733
|
+
}
|
|
96734
|
+
/** The body with the values written in, as a recipe — or every reason it is not one. */
|
|
96735
|
+
function expandAutomationTemplate(payload, values) {
|
|
96736
|
+
const problems = [];
|
|
96737
|
+
const resolved = resolveValues(payload, values, problems);
|
|
96738
|
+
if (problems.length > 0) return {
|
|
96739
|
+
ok: false,
|
|
96740
|
+
problems
|
|
96741
|
+
};
|
|
96742
|
+
let body = payload.body;
|
|
96743
|
+
try {
|
|
96744
|
+
for (const binding of payload.bindings) {
|
|
96745
|
+
const input = payload.inputs.find((i) => i.key === binding.input);
|
|
96746
|
+
if (input === void 0) continue;
|
|
96747
|
+
if (binding.kind === "rows") {
|
|
96748
|
+
if (input.kind !== "group") continue;
|
|
96749
|
+
body = applyRows(body, binding, input, resolved.groups.get(input.key) ?? []);
|
|
96750
|
+
continue;
|
|
96751
|
+
}
|
|
96752
|
+
if (input.kind === "group") continue;
|
|
96753
|
+
const value = resolved.scalars.get(input.key);
|
|
96754
|
+
if (value === void 0) continue;
|
|
96755
|
+
body = writeValue(body, binding, input, value);
|
|
96756
|
+
}
|
|
96757
|
+
} catch (error) {
|
|
96758
|
+
if (!(error instanceof PathError)) throw error;
|
|
96759
|
+
return {
|
|
96760
|
+
ok: false,
|
|
96761
|
+
problems: [{
|
|
96762
|
+
code: "invalid-recipe",
|
|
96763
|
+
detail: error.message
|
|
96764
|
+
}]
|
|
96765
|
+
};
|
|
96766
|
+
}
|
|
96767
|
+
const parsed = AutomationRecipeSchema.safeParse(body);
|
|
96768
|
+
if (!parsed.success) return {
|
|
96769
|
+
ok: false,
|
|
96770
|
+
problems: parsed.error.issues.slice(0, 5).map((issue) => ({
|
|
96771
|
+
code: "invalid-recipe",
|
|
96772
|
+
detail: `${issue.path.join(".")}: ${issue.message}`
|
|
96773
|
+
}))
|
|
96774
|
+
};
|
|
96775
|
+
const { template: _ignored, ...recipe } = parsed.data;
|
|
96776
|
+
return {
|
|
96777
|
+
ok: true,
|
|
96778
|
+
recipe
|
|
96779
|
+
};
|
|
96780
|
+
}
|
|
96781
|
+
/** A new instance: the expansion, linked to its template. */
|
|
96782
|
+
function instantiateAutomationTemplate(templateId, payload, values) {
|
|
96783
|
+
const expanded = expandAutomationTemplate(payload, values);
|
|
96784
|
+
if (!expanded.ok) return expanded;
|
|
96785
|
+
return {
|
|
96786
|
+
ok: true,
|
|
96787
|
+
recipe: {
|
|
96788
|
+
...expanded.recipe,
|
|
96789
|
+
template: {
|
|
96790
|
+
templateId,
|
|
96791
|
+
values
|
|
96792
|
+
}
|
|
96793
|
+
}
|
|
96794
|
+
};
|
|
96795
|
+
}
|
|
96796
|
+
/**
|
|
96797
|
+
* An instance after its template changed (or vanished, `payload === null`):
|
|
96798
|
+
* re-expanded when its values still fit, otherwise its previous body kept and
|
|
96799
|
+
* the link flagged with the problems. Never dropped.
|
|
96800
|
+
*/
|
|
96801
|
+
function reexpandAutomationInstance(payload, current) {
|
|
96802
|
+
const link = current.template;
|
|
96803
|
+
if (link === void 0) return {
|
|
96804
|
+
recipe: current,
|
|
96805
|
+
flagged: false
|
|
96806
|
+
};
|
|
96807
|
+
const expanded = payload === null ? {
|
|
96808
|
+
ok: false,
|
|
96809
|
+
problems: [{
|
|
96810
|
+
code: "missing-template",
|
|
96811
|
+
detail: `template "${link.templateId}" is gone`
|
|
96812
|
+
}]
|
|
96813
|
+
} : expandAutomationTemplate(payload, link.values);
|
|
96814
|
+
if (expanded.ok) return {
|
|
96815
|
+
recipe: {
|
|
96816
|
+
...expanded.recipe,
|
|
96817
|
+
template: {
|
|
96818
|
+
templateId: link.templateId,
|
|
96819
|
+
values: link.values
|
|
96820
|
+
}
|
|
96821
|
+
},
|
|
96822
|
+
flagged: false
|
|
96823
|
+
};
|
|
96824
|
+
const [first, ...rest] = expanded.problems;
|
|
96825
|
+
if (first === void 0) return {
|
|
96826
|
+
recipe: current,
|
|
96827
|
+
flagged: false
|
|
96828
|
+
};
|
|
96829
|
+
return {
|
|
96830
|
+
recipe: {
|
|
96831
|
+
...current,
|
|
96832
|
+
template: {
|
|
96833
|
+
...link,
|
|
96834
|
+
problems: [first, ...rest]
|
|
96835
|
+
}
|
|
96836
|
+
},
|
|
96837
|
+
flagged: true
|
|
96838
|
+
};
|
|
96839
|
+
}
|
|
96840
|
+
/** "Convert to a free automation": the expansion as it is, without the link. */
|
|
96841
|
+
function detachAutomationInstance(recipe) {
|
|
96842
|
+
const { template: _link, ...free } = recipe;
|
|
96843
|
+
return free;
|
|
96844
|
+
}
|
|
96845
|
+
var AUTOMATION_TEMPLATE_EXPORT_FORMAT = "camstack.automation-template";
|
|
96846
|
+
var AutomationTemplateExportSchema = zod.z.object({
|
|
96847
|
+
format: zod.z.literal(AUTOMATION_TEMPLATE_EXPORT_FORMAT),
|
|
96848
|
+
version: zod.z.literal(1),
|
|
96849
|
+
name: zod.z.string().min(1).max(120),
|
|
96850
|
+
payload: AutomationTemplatePayloadSchema
|
|
96851
|
+
});
|
|
96852
|
+
function exportAutomationTemplate(name, payload) {
|
|
96853
|
+
return {
|
|
96854
|
+
format: AUTOMATION_TEMPLATE_EXPORT_FORMAT,
|
|
96855
|
+
version: 1,
|
|
96856
|
+
name,
|
|
96857
|
+
payload
|
|
96858
|
+
};
|
|
96859
|
+
}
|
|
96860
|
+
//#endregion
|
|
95845
96861
|
//#region src/template/template-kinds.ts
|
|
95846
96862
|
/**
|
|
95847
96863
|
* Template kinds (D963). A template is a named, reusable piece of operator
|
|
95848
|
-
* data that more than one device points at —
|
|
95849
|
-
*
|
|
96864
|
+
* data that more than one device points at — the button grid of a remote,
|
|
96865
|
+
* and an automation body with declared inputs (#527). The store is generic: it keeps `{ id, kind, name, payload }` and
|
|
95850
96866
|
* knows nothing of a remote. Only the SYSTEM declares kinds, here: each kind
|
|
95851
96867
|
* names the schema its payload must satisfy. Adding a kind is adding a member
|
|
95852
96868
|
* to `TEMPLATE_KINDS` and a payload schema; the compiler refuses one without
|
|
95853
96869
|
* the other.
|
|
95854
96870
|
*/
|
|
95855
|
-
var TEMPLATE_KINDS = ["remote"];
|
|
96871
|
+
var TEMPLATE_KINDS = ["remote", "automation"];
|
|
95856
96872
|
var TemplateKindSchema = zod.z.enum(TEMPLATE_KINDS);
|
|
95857
|
-
var TEMPLATE_PAYLOAD_SCHEMAS = {
|
|
96873
|
+
var TEMPLATE_PAYLOAD_SCHEMAS = {
|
|
96874
|
+
remote: RemoteLayoutPayloadSchema,
|
|
96875
|
+
automation: AutomationTemplatePayloadSchema
|
|
96876
|
+
};
|
|
95858
96877
|
function isTemplateKind(value) {
|
|
95859
96878
|
return TemplateKindSchema.safeParse(value).success;
|
|
95860
96879
|
}
|
|
@@ -95878,7 +96897,9 @@ function checkTemplatePayload(kind, payload) {
|
|
|
95878
96897
|
* button grid of a remote) and the schema each payload must satisfy are
|
|
95879
96898
|
* declared by the system in `template-kinds.ts`. Nothing here is specific to a
|
|
95880
96899
|
* kind: the engine validates a payload against its kind's schema and, on a
|
|
95881
|
-
* delete, asks the kind's owner whether anything still points at the record
|
|
96900
|
+
* delete, asks the kind's owner whether anything still points at the record
|
|
96901
|
+
* (a device's remote, an automation made from the template). Saving an
|
|
96902
|
+
* `automation` template re-expands every automation made from it (#527).
|
|
95882
96903
|
*
|
|
95883
96904
|
* Every refusal is a typed result — a UI says "unknown kind" or names the
|
|
95884
96905
|
* devices that still use a template, without parsing text.
|
|
@@ -95890,9 +96911,15 @@ var TemplateRecordSchema = zod.z.object({
|
|
|
95890
96911
|
/** Shaped by the kind; `checkTemplatePayload(kind, payload)` reads it. */
|
|
95891
96912
|
payload: zod.z.unknown(),
|
|
95892
96913
|
createdAt: zod.z.number(),
|
|
95893
|
-
updatedAt: zod.z.number()
|
|
96914
|
+
updatedAt: zod.z.number(),
|
|
96915
|
+
/** Shipped with CamStack (`builtin:` ids): listed beside the operator's, never updated or deleted. */
|
|
96916
|
+
builtIn: zod.z.literal(true).optional()
|
|
95894
96917
|
});
|
|
95895
|
-
var TEMPLATE_WRITE_REFUSALS = [
|
|
96918
|
+
var TEMPLATE_WRITE_REFUSALS = [
|
|
96919
|
+
"invalid-payload",
|
|
96920
|
+
"not-found",
|
|
96921
|
+
"read-only"
|
|
96922
|
+
];
|
|
95896
96923
|
var TemplateWriteResultSchema = zod.z.discriminatedUnion("status", [zod.z.object({
|
|
95897
96924
|
status: zod.z.literal("saved"),
|
|
95898
96925
|
template: TemplateRecordSchema
|
|
@@ -95906,12 +96933,19 @@ var TemplateUserSchema = zod.z.object({
|
|
|
95906
96933
|
deviceId: zod.z.number().int().nonnegative(),
|
|
95907
96934
|
name: zod.z.string()
|
|
95908
96935
|
});
|
|
96936
|
+
/** An automation made from a template (#527): a core block whose recipe links to it. */
|
|
96937
|
+
var TemplateAutomationUserSchema = zod.z.object({
|
|
96938
|
+
blockId: zod.z.string().min(1),
|
|
96939
|
+
name: zod.z.string()
|
|
96940
|
+
});
|
|
95909
96941
|
var TemplateDeleteResultSchema = zod.z.discriminatedUnion("status", [
|
|
95910
96942
|
zod.z.object({ status: zod.z.literal("deleted") }),
|
|
95911
96943
|
zod.z.object({ status: zod.z.literal("not-found") }),
|
|
96944
|
+
zod.z.object({ status: zod.z.literal("read-only") }),
|
|
95912
96945
|
zod.z.object({
|
|
95913
96946
|
status: zod.z.literal("in-use"),
|
|
95914
|
-
devices: zod.z.array(TemplateUserSchema)
|
|
96947
|
+
devices: zod.z.array(TemplateUserSchema),
|
|
96948
|
+
automations: zod.z.array(TemplateAutomationUserSchema)
|
|
95915
96949
|
})
|
|
95916
96950
|
]);
|
|
95917
96951
|
var templateCapability = {
|
|
@@ -99513,6 +100547,7 @@ var CAPABILITY_NAMES = {
|
|
|
99513
100547
|
doNotDisturb: "do-not-disturb",
|
|
99514
100548
|
doorbell: "doorbell",
|
|
99515
100549
|
embeddingEncoder: "embedding-encoder",
|
|
100550
|
+
energySystem: "energy-system",
|
|
99516
100551
|
enumSensor: "enum-sensor",
|
|
99517
100552
|
eventEmitter: "event-emitter",
|
|
99518
100553
|
faceGallery: "face-gallery",
|
|
@@ -99931,6 +100966,10 @@ var CAPABILITY_ROUTER_KEYS = [
|
|
|
99931
100966
|
key: "embeddingEncoder",
|
|
99932
100967
|
name: "embedding-encoder"
|
|
99933
100968
|
},
|
|
100969
|
+
{
|
|
100970
|
+
key: "energySystem",
|
|
100971
|
+
name: "energy-system"
|
|
100972
|
+
},
|
|
99934
100973
|
{
|
|
99935
100974
|
key: "enumSensor",
|
|
99936
100975
|
name: "enum-sensor"
|
|
@@ -100552,6 +101591,7 @@ var ALL_CAPABILITY_DEFINITIONS = [
|
|
|
100552
101591
|
doNotDisturbCapability,
|
|
100553
101592
|
doorbellCapability,
|
|
100554
101593
|
embeddingEncoderCapability,
|
|
101594
|
+
energySystemCapability,
|
|
100555
101595
|
enumSensorCapability,
|
|
100556
101596
|
eventEmitterCapability,
|
|
100557
101597
|
faceGalleryCapability,
|
|
@@ -104010,6 +105050,227 @@ function flipperIrDraft(file, target) {
|
|
|
104010
105050
|
};
|
|
104011
105051
|
}
|
|
104012
105052
|
//#endregion
|
|
105053
|
+
//#region src/template/builtin-automation-templates.ts
|
|
105054
|
+
/**
|
|
105055
|
+
* Automation templates shipped with CamStack (#527). They are read-only records
|
|
105056
|
+
* of the template store: `template.list` returns them beside the operator's
|
|
105057
|
+
* own, under `builtin:` ids, and an update or delete of one is refused. They
|
|
105058
|
+
* are code, not seeded rows, so a new release changes them without a
|
|
105059
|
+
* migration and nothing an operator saved is ever overwritten.
|
|
105060
|
+
*/
|
|
105061
|
+
var BUILTIN_TEMPLATE_ID_PREFIX = "builtin:";
|
|
105062
|
+
var BUILTIN_AUTOMATION_TEMPLATES = [{
|
|
105063
|
+
id: `${BUILTIN_TEMPLATE_ID_PREFIX}buttons-to-devices`,
|
|
105064
|
+
name: "Buttons → devices",
|
|
105065
|
+
payload: {
|
|
105066
|
+
version: 1,
|
|
105067
|
+
description: "Each row: when a button sends an event, run an action on a set of devices.",
|
|
105068
|
+
body: {
|
|
105069
|
+
when: {
|
|
105070
|
+
kind: "any",
|
|
105071
|
+
children: []
|
|
105072
|
+
},
|
|
105073
|
+
actions: [{
|
|
105074
|
+
kind: "choose",
|
|
105075
|
+
branches: []
|
|
105076
|
+
}],
|
|
105077
|
+
runMode: {
|
|
105078
|
+
mode: "queued",
|
|
105079
|
+
max: 5
|
|
105080
|
+
}
|
|
105081
|
+
},
|
|
105082
|
+
inputs: [{
|
|
105083
|
+
kind: "group",
|
|
105084
|
+
key: "buttons",
|
|
105085
|
+
label: "Buttons",
|
|
105086
|
+
maxRows: 6,
|
|
105087
|
+
inputs: [
|
|
105088
|
+
{
|
|
105089
|
+
kind: "device",
|
|
105090
|
+
key: "button",
|
|
105091
|
+
label: "Button",
|
|
105092
|
+
filter: { capability: "event-emitter" }
|
|
105093
|
+
},
|
|
105094
|
+
{
|
|
105095
|
+
kind: "event",
|
|
105096
|
+
key: "event",
|
|
105097
|
+
label: "Event",
|
|
105098
|
+
deviceInput: "button"
|
|
105099
|
+
},
|
|
105100
|
+
{
|
|
105101
|
+
kind: "device",
|
|
105102
|
+
key: "targets",
|
|
105103
|
+
label: "Devices",
|
|
105104
|
+
multiple: true
|
|
105105
|
+
},
|
|
105106
|
+
{
|
|
105107
|
+
kind: "action",
|
|
105108
|
+
key: "action",
|
|
105109
|
+
label: "Action",
|
|
105110
|
+
deviceInput: "targets"
|
|
105111
|
+
}
|
|
105112
|
+
]
|
|
105113
|
+
}],
|
|
105114
|
+
bindings: [{
|
|
105115
|
+
kind: "rows",
|
|
105116
|
+
input: "buttons",
|
|
105117
|
+
path: ["when", "children"],
|
|
105118
|
+
item: { kind: "device-fired" },
|
|
105119
|
+
bindings: [
|
|
105120
|
+
{
|
|
105121
|
+
kind: "row-id",
|
|
105122
|
+
path: ["id"]
|
|
105123
|
+
},
|
|
105124
|
+
{
|
|
105125
|
+
kind: "value",
|
|
105126
|
+
input: "button",
|
|
105127
|
+
path: ["deviceId"]
|
|
105128
|
+
},
|
|
105129
|
+
{
|
|
105130
|
+
kind: "value",
|
|
105131
|
+
input: "event",
|
|
105132
|
+
path: []
|
|
105133
|
+
}
|
|
105134
|
+
]
|
|
105135
|
+
}, {
|
|
105136
|
+
kind: "rows",
|
|
105137
|
+
input: "buttons",
|
|
105138
|
+
path: [
|
|
105139
|
+
"actions",
|
|
105140
|
+
0,
|
|
105141
|
+
"branches"
|
|
105142
|
+
],
|
|
105143
|
+
item: {
|
|
105144
|
+
if: {
|
|
105145
|
+
kind: "triggered-by",
|
|
105146
|
+
leafIds: []
|
|
105147
|
+
},
|
|
105148
|
+
steps: [{ kind: "command" }]
|
|
105149
|
+
},
|
|
105150
|
+
bindings: [
|
|
105151
|
+
{
|
|
105152
|
+
kind: "row-id",
|
|
105153
|
+
path: [
|
|
105154
|
+
"if",
|
|
105155
|
+
"leafIds",
|
|
105156
|
+
0
|
|
105157
|
+
]
|
|
105158
|
+
},
|
|
105159
|
+
{
|
|
105160
|
+
kind: "value",
|
|
105161
|
+
input: "targets",
|
|
105162
|
+
path: [
|
|
105163
|
+
"steps",
|
|
105164
|
+
0,
|
|
105165
|
+
"target"
|
|
105166
|
+
],
|
|
105167
|
+
as: "target"
|
|
105168
|
+
},
|
|
105169
|
+
{
|
|
105170
|
+
kind: "value",
|
|
105171
|
+
input: "action",
|
|
105172
|
+
path: ["steps", 0]
|
|
105173
|
+
}
|
|
105174
|
+
]
|
|
105175
|
+
}]
|
|
105176
|
+
}
|
|
105177
|
+
}, {
|
|
105178
|
+
id: `${BUILTIN_TEMPLATE_ID_PREFIX}motion-light`,
|
|
105179
|
+
name: "Motion → light, off after a delay",
|
|
105180
|
+
payload: {
|
|
105181
|
+
version: 1,
|
|
105182
|
+
description: "Turns lights on when a motion sensor detects motion and off once it has been quiet for the delay. New motion restarts the delay.",
|
|
105183
|
+
body: {
|
|
105184
|
+
when: {
|
|
105185
|
+
kind: "device-becomes",
|
|
105186
|
+
cap: "motion",
|
|
105187
|
+
fieldPath: "detected",
|
|
105188
|
+
becomes: true
|
|
105189
|
+
},
|
|
105190
|
+
actions: [
|
|
105191
|
+
{
|
|
105192
|
+
kind: "command",
|
|
105193
|
+
actionId: "switch.on"
|
|
105194
|
+
},
|
|
105195
|
+
{
|
|
105196
|
+
kind: "wait",
|
|
105197
|
+
seconds: 300
|
|
105198
|
+
},
|
|
105199
|
+
{
|
|
105200
|
+
kind: "command",
|
|
105201
|
+
actionId: "switch.off"
|
|
105202
|
+
}
|
|
105203
|
+
],
|
|
105204
|
+
runMode: { mode: "restart" }
|
|
105205
|
+
},
|
|
105206
|
+
inputs: [
|
|
105207
|
+
{
|
|
105208
|
+
kind: "device",
|
|
105209
|
+
key: "sensor",
|
|
105210
|
+
label: "Motion sensor",
|
|
105211
|
+
filter: { capability: "motion" }
|
|
105212
|
+
},
|
|
105213
|
+
{
|
|
105214
|
+
kind: "device",
|
|
105215
|
+
key: "lights",
|
|
105216
|
+
label: "Lights",
|
|
105217
|
+
multiple: true,
|
|
105218
|
+
filter: { capability: "switch" }
|
|
105219
|
+
},
|
|
105220
|
+
{
|
|
105221
|
+
kind: "duration",
|
|
105222
|
+
key: "delay",
|
|
105223
|
+
label: "Off after (seconds)",
|
|
105224
|
+
min: 10,
|
|
105225
|
+
max: 3600,
|
|
105226
|
+
default: 300
|
|
105227
|
+
}
|
|
105228
|
+
],
|
|
105229
|
+
bindings: [
|
|
105230
|
+
{
|
|
105231
|
+
kind: "value",
|
|
105232
|
+
input: "sensor",
|
|
105233
|
+
path: ["when", "deviceId"]
|
|
105234
|
+
},
|
|
105235
|
+
{
|
|
105236
|
+
kind: "value",
|
|
105237
|
+
input: "lights",
|
|
105238
|
+
path: [
|
|
105239
|
+
"actions",
|
|
105240
|
+
0,
|
|
105241
|
+
"target"
|
|
105242
|
+
],
|
|
105243
|
+
as: "target"
|
|
105244
|
+
},
|
|
105245
|
+
{
|
|
105246
|
+
kind: "value",
|
|
105247
|
+
input: "delay",
|
|
105248
|
+
path: [
|
|
105249
|
+
"actions",
|
|
105250
|
+
1,
|
|
105251
|
+
"seconds"
|
|
105252
|
+
]
|
|
105253
|
+
},
|
|
105254
|
+
{
|
|
105255
|
+
kind: "value",
|
|
105256
|
+
input: "lights",
|
|
105257
|
+
path: [
|
|
105258
|
+
"actions",
|
|
105259
|
+
2,
|
|
105260
|
+
"target"
|
|
105261
|
+
],
|
|
105262
|
+
as: "target"
|
|
105263
|
+
}
|
|
105264
|
+
]
|
|
105265
|
+
}
|
|
105266
|
+
}];
|
|
105267
|
+
function isBuiltinTemplateId(id) {
|
|
105268
|
+
return id.startsWith(BUILTIN_TEMPLATE_ID_PREFIX);
|
|
105269
|
+
}
|
|
105270
|
+
function builtinAutomationTemplate(id) {
|
|
105271
|
+
return BUILTIN_AUTOMATION_TEMPLATES.find((t) => t.id === id);
|
|
105272
|
+
}
|
|
105273
|
+
//#endregion
|
|
104013
105274
|
//#region src/running-state/from-operation.ts
|
|
104014
105275
|
function programStartFromRemaining(running, remainingSeconds, fetchedAt) {
|
|
104015
105276
|
if (!running || remainingSeconds === null || remainingSeconds === void 0) return null;
|
|
@@ -107956,6 +109217,7 @@ var DEVICE_LOCAL_STATE_CAPS = {
|
|
|
107956
109217
|
dishwasher: dishwasherCapability,
|
|
107957
109218
|
doNotDisturb: doNotDisturbCapability,
|
|
107958
109219
|
doorbell: doorbellCapability,
|
|
109220
|
+
energySystem: energySystemCapability,
|
|
107959
109221
|
enumSensor: enumSensorCapability,
|
|
107960
109222
|
eventEmitter: eventEmitterCapability,
|
|
107961
109223
|
fanControl: fanControlCapability,
|
|
@@ -110089,6 +111351,7 @@ var DEVICE_TYPE_CONTROL_KIND = {
|
|
|
110089
111351
|
[require_composed_stable_id.DeviceType.Humidifier]: "humidifier",
|
|
110090
111352
|
[require_composed_stable_id.DeviceType.WaterHeater]: "water-heater",
|
|
110091
111353
|
[require_composed_stable_id.DeviceType.HeatPump]: "dummy",
|
|
111354
|
+
[require_composed_stable_id.DeviceType.EnergySystem]: "energy-system",
|
|
110092
111355
|
[require_composed_stable_id.DeviceType.Camera]: "dummy",
|
|
110093
111356
|
[require_composed_stable_id.DeviceType.Hub]: "dummy",
|
|
110094
111357
|
[require_composed_stable_id.DeviceType.Switch]: "switch",
|
|
@@ -113125,6 +114388,7 @@ var HERO_LAYOUT_BY_TYPE = {
|
|
|
113125
114388
|
[require_composed_stable_id.DeviceType.Humidifier]: HUMIDIFIER_LAYOUT,
|
|
113126
114389
|
[require_composed_stable_id.DeviceType.WaterHeater]: CLIMATE_LAYOUT,
|
|
113127
114390
|
[require_composed_stable_id.DeviceType.HeatPump]: HEAT_PUMP_LAYOUT,
|
|
114391
|
+
[require_composed_stable_id.DeviceType.EnergySystem]: HERO_LAYOUT_DEFAULT,
|
|
113128
114392
|
[require_composed_stable_id.DeviceType.Fan]: FAN_LAYOUT,
|
|
113129
114393
|
[require_composed_stable_id.DeviceType.MediaPlayer]: MEDIA_PLAYER_LAYOUT,
|
|
113130
114394
|
[require_composed_stable_id.DeviceType.AlarmPanel]: ALARM_LAYOUT,
|
|
@@ -113850,6 +115114,7 @@ var HERO_LOOK_BY_TYPE = {
|
|
|
113850
115114
|
[require_composed_stable_id.DeviceType.Humidifier]: HUMIDIFIER_LOOK,
|
|
113851
115115
|
[require_composed_stable_id.DeviceType.WaterHeater]: WATER_HEATER_LOOK,
|
|
113852
115116
|
[require_composed_stable_id.DeviceType.HeatPump]: HEAT_PUMP_LOOK,
|
|
115117
|
+
[require_composed_stable_id.DeviceType.EnergySystem]: HERO_LOOK_DEFAULT,
|
|
113853
115118
|
[require_composed_stable_id.DeviceType.Fan]: FAN_LOOK,
|
|
113854
115119
|
[require_composed_stable_id.DeviceType.MediaPlayer]: MEDIA_PLAYER_LOOK,
|
|
113855
115120
|
[require_composed_stable_id.DeviceType.AlarmPanel]: ALARM_LOOK,
|
|
@@ -114299,6 +115564,7 @@ var HERO_CAP_COVERAGE = {
|
|
|
114299
115564
|
"group-commands": "contributes",
|
|
114300
115565
|
"group-status": "contributes",
|
|
114301
115566
|
"heat-pump-status": "contributes",
|
|
115567
|
+
"energy-system": { none: "drawn by the energy-system device card (the energy-flow scene), which replaces the hero on the device page" },
|
|
114302
115568
|
"heating-valve": "contributes",
|
|
114303
115569
|
humidifier: "contributes",
|
|
114304
115570
|
"humidity-sensor": "contributes",
|
|
@@ -117626,6 +118892,13 @@ var METHOD_ACCESS_MAP = Object.freeze({
|
|
|
117626
118892
|
access: "delete",
|
|
117627
118893
|
role: "admin"
|
|
117628
118894
|
},
|
|
118895
|
+
"energySystem.getStatus": {
|
|
118896
|
+
capName: "energy-system",
|
|
118897
|
+
capScope: "device",
|
|
118898
|
+
addonId: null,
|
|
118899
|
+
access: "view",
|
|
118900
|
+
role: "viewer"
|
|
118901
|
+
},
|
|
117629
118902
|
"enumSensor.getStatus": {
|
|
117630
118903
|
capName: "enum-sensor",
|
|
117631
118904
|
capScope: "device",
|
|
@@ -124846,6 +126119,7 @@ var KNOWN_CAP_NAMES = [
|
|
|
124846
126119
|
"do-not-disturb",
|
|
124847
126120
|
"doorbell",
|
|
124848
126121
|
"embedding-encoder",
|
|
126122
|
+
"energy-system",
|
|
124849
126123
|
"enum-sensor",
|
|
124850
126124
|
"event-emitter",
|
|
124851
126125
|
"face-gallery",
|
|
@@ -125018,6 +126292,7 @@ var DEVICE_CAP_NAMES = [
|
|
|
125018
126292
|
"dishwasher",
|
|
125019
126293
|
"do-not-disturb",
|
|
125020
126294
|
"doorbell",
|
|
126295
|
+
"energy-system",
|
|
125021
126296
|
"enum-sensor",
|
|
125022
126297
|
"event-emitter",
|
|
125023
126298
|
"fan-control",
|
|
@@ -125748,6 +127023,7 @@ var DEVICE_TYPE_ICON = {
|
|
|
125748
127023
|
[require_composed_stable_id.DeviceType.Sensor]: "activity",
|
|
125749
127024
|
[require_composed_stable_id.DeviceType.Climate]: "thermometer",
|
|
125750
127025
|
[require_composed_stable_id.DeviceType.HeatPump]: "flame",
|
|
127026
|
+
[require_composed_stable_id.DeviceType.EnergySystem]: "solar-panel",
|
|
125751
127027
|
[require_composed_stable_id.DeviceType.Button]: "circle-dot",
|
|
125752
127028
|
[require_composed_stable_id.DeviceType.EventEmitter]: "zap",
|
|
125753
127029
|
[require_composed_stable_id.DeviceType.Update]: "refresh-cw",
|
|
@@ -127134,6 +128410,7 @@ var CAP_NAMES_WITH_STATUS = [
|
|
|
127134
128410
|
"dishwasher",
|
|
127135
128411
|
"do-not-disturb",
|
|
127136
128412
|
"doorbell",
|
|
128413
|
+
"energy-system",
|
|
127137
128414
|
"enum-sensor",
|
|
127138
128415
|
"event-emitter",
|
|
127139
128416
|
"fan-control",
|
|
@@ -128149,6 +129426,11 @@ var METHOD_DEVICE_SELECTORS = Object.freeze({
|
|
|
128149
129426
|
form: "single",
|
|
128150
129427
|
optional: false
|
|
128151
129428
|
}],
|
|
129429
|
+
"energySystem.getStatus": [{
|
|
129430
|
+
name: "deviceId",
|
|
129431
|
+
form: "single",
|
|
129432
|
+
optional: false
|
|
129433
|
+
}],
|
|
128152
129434
|
"enumSensor.getStatus": [{
|
|
128153
129435
|
name: "deviceId",
|
|
128154
129436
|
form: "single",
|
|
@@ -130530,7 +131812,7 @@ function getCapsByProviderKind(kind) {
|
|
|
130530
131812
|
//#region src/generated/runtime-state-durability.ts
|
|
130531
131813
|
/**
|
|
130532
131814
|
* Per-cap runtime-state policy, projected from every `*.cap.ts` that declares
|
|
130533
|
-
* `runtimeState`.
|
|
131815
|
+
* `runtimeState`. 83 caps: 42 `restored`, 41 `session`.
|
|
130534
131816
|
*
|
|
130535
131817
|
* A cap absent from this map has no runtime-state slice at all. A cap PRESENT
|
|
130536
131818
|
* with `durability: 'session'` has one and has decided not to keep it.
|
|
@@ -130625,6 +131907,10 @@ var RUNTIME_STATE_POLICY = {
|
|
|
130625
131907
|
durability: "restored",
|
|
130626
131908
|
volatileFields: []
|
|
130627
131909
|
},
|
|
131910
|
+
"energy-system": {
|
|
131911
|
+
durability: "session",
|
|
131912
|
+
volatileFields: ["lastFetchedAt"]
|
|
131913
|
+
},
|
|
130628
131914
|
"enum-sensor": {
|
|
130629
131915
|
durability: "restored",
|
|
130630
131916
|
volatileFields: ["lastFetchedAt", "timestamp"]
|
|
@@ -144305,6 +145591,9 @@ exports.AUTOMATIC_HUB_ADDRESS_FLAGS = AUTOMATIC_HUB_ADDRESS_FLAGS;
|
|
|
144305
145591
|
exports.AUTOMATION_LEAF_CATALOG = AUTOMATION_LEAF_CATALOG;
|
|
144306
145592
|
exports.AUTOMATION_LEAF_CATEGORIES = AUTOMATION_LEAF_CATEGORIES;
|
|
144307
145593
|
exports.AUTOMATION_LEAF_KINDS = AUTOMATION_LEAF_KINDS;
|
|
145594
|
+
exports.AUTOMATION_RECIPE_DECLARATION = AUTOMATION_RECIPE_DECLARATION;
|
|
145595
|
+
exports.AUTOMATION_TEMPLATE_EXPORT_FORMAT = AUTOMATION_TEMPLATE_EXPORT_FORMAT;
|
|
145596
|
+
exports.AUTOMATION_TEMPLATE_VERSION = AUTOMATION_TEMPLATE_VERSION;
|
|
144308
145597
|
exports.AUTO_SHARE_HEADROOM = AUTO_SHARE_HEADROOM;
|
|
144309
145598
|
exports.AUTO_TUNE_FAMILY = AUTO_TUNE_FAMILY;
|
|
144310
145599
|
exports.AcceleratorComputeSchema = AcceleratorComputeSchema;
|
|
@@ -144429,6 +145718,9 @@ exports.AutomationSetStepSchema = AutomationSetStepSchema;
|
|
|
144429
145718
|
exports.AutomationStateDocSchema = AutomationStateDocSchema;
|
|
144430
145719
|
exports.AutomationStepTraceSchema = AutomationStepTraceSchema;
|
|
144431
145720
|
exports.AutomationStopStepSchema = AutomationStopStepSchema;
|
|
145721
|
+
exports.AutomationTemplateExportSchema = AutomationTemplateExportSchema;
|
|
145722
|
+
exports.AutomationTemplateLinkSchema = AutomationTemplateLinkSchema;
|
|
145723
|
+
exports.AutomationTemplatePayloadSchema = AutomationTemplatePayloadSchema;
|
|
144432
145724
|
exports.AutomationTriggerTraceSchema = AutomationTriggerTraceSchema;
|
|
144433
145725
|
exports.AutomationWaitStepSchema = AutomationWaitStepSchema;
|
|
144434
145726
|
exports.AutomationWaitUntilStepSchema = AutomationWaitUntilStepSchema;
|
|
@@ -144442,8 +145734,10 @@ exports.BENCH_ROOT_STEP_ID = BENCH_ROOT_STEP_ID;
|
|
|
144442
145734
|
exports.BINARY_AGGREGATES = require_implemented_methods.BINARY_AGGREGATES;
|
|
144443
145735
|
exports.BIRTH_DECISION_DEFAULT_LIMIT = BIRTH_DECISION_DEFAULT_LIMIT;
|
|
144444
145736
|
exports.BOOT_RECOVERY_BACKOFF_MS = require_sleep.BOOT_RECOVERY_BACKOFF_MS;
|
|
145737
|
+
exports.BUILTIN_AUTOMATION_TEMPLATES = BUILTIN_AUTOMATION_TEMPLATES;
|
|
144445
145738
|
exports.BUILTIN_REMOTE_COMPONENTS = BUILTIN_REMOTE_COMPONENTS;
|
|
144446
145739
|
exports.BUILTIN_RESULT_KINDS = BUILTIN_RESULT_KINDS;
|
|
145740
|
+
exports.BUILTIN_TEMPLATE_ID_PREFIX = BUILTIN_TEMPLATE_ID_PREFIX;
|
|
144447
145741
|
exports.BackgroundRunRegistry = BackgroundRunRegistry;
|
|
144448
145742
|
exports.BacklightModeSchema = BacklightModeSchema;
|
|
144449
145743
|
exports.BackupArchiveEncryptionSchema = BackupArchiveEncryptionSchema;
|
|
@@ -145048,6 +146342,11 @@ exports.EmbeddingRefusalCodeSchema = EmbeddingRefusalCodeSchema;
|
|
|
145048
146342
|
exports.EmbeddingResultSchema = EmbeddingResultSchema;
|
|
145049
146343
|
exports.EmbeddingTowerSchema = EmbeddingTowerSchema;
|
|
145050
146344
|
exports.EncodeProfileSchema = EncodeProfileSchema;
|
|
146345
|
+
exports.EnergyConsumerSchema = EnergyConsumerSchema;
|
|
146346
|
+
exports.EnergyGridSchema = EnergyGridSchema;
|
|
146347
|
+
exports.EnergySolarSchema = EnergySolarSchema;
|
|
146348
|
+
exports.EnergyStorageSchema = EnergyStorageSchema;
|
|
146349
|
+
exports.EnergySystemStatusSchema = EnergySystemStatusSchema;
|
|
145051
146350
|
exports.EnrichedWidgetMetadataSchema = EnrichedWidgetMetadataSchema;
|
|
145052
146351
|
exports.EnrollSelfInputSchema = EnrollSelfInputSchema;
|
|
145053
146352
|
exports.EntryDescriptorSchema = require_sleep.EntryDescriptorSchema;
|
|
@@ -146607,6 +147906,9 @@ exports.SystemHeldSecretNameSchema = SystemHeldSecretNameSchema;
|
|
|
146607
147906
|
exports.SystemMetricsSchema = SystemMetricsSchema;
|
|
146608
147907
|
exports.SystemMirror = SystemMirror;
|
|
146609
147908
|
exports.TARGET_OWNER_KEY = TARGET_OWNER_KEY;
|
|
147909
|
+
exports.TEMPLATE_GROUP_ROWS_MAX = TEMPLATE_GROUP_ROWS_MAX;
|
|
147910
|
+
exports.TEMPLATE_INPUT_KEY_RE = TEMPLATE_INPUT_KEY_RE;
|
|
147911
|
+
exports.TEMPLATE_INSTANCE_PROBLEM_CODES = TEMPLATE_INSTANCE_PROBLEM_CODES;
|
|
146610
147912
|
exports.TEMPLATE_KINDS = TEMPLATE_KINDS;
|
|
146611
147913
|
exports.TEMPLATE_PAYLOAD_SCHEMAS = TEMPLATE_PAYLOAD_SCHEMAS;
|
|
146612
147914
|
exports.TEMPLATE_WRITE_REFUSALS = TEMPLATE_WRITE_REFUSALS;
|
|
@@ -146630,10 +147932,28 @@ exports.TargetKindSchema = TargetKindSchema;
|
|
|
146630
147932
|
exports.TargetKindTextCapsSchema = TargetKindTextCapsSchema;
|
|
146631
147933
|
exports.TargetSchema = TargetSchema;
|
|
146632
147934
|
exports.TemperatureSensorStatusSchema = TemperatureSensorStatusSchema;
|
|
147935
|
+
exports.TemplateActionValueSchema = TemplateActionValueSchema;
|
|
147936
|
+
exports.TemplateAutomationUserSchema = TemplateAutomationUserSchema;
|
|
147937
|
+
exports.TemplateBindingSchema = TemplateBindingSchema;
|
|
146633
147938
|
exports.TemplateDeleteResultSchema = TemplateDeleteResultSchema;
|
|
147939
|
+
exports.TemplateDeviceFilterSchema = TemplateDeviceFilterSchema;
|
|
147940
|
+
exports.TemplateEventValueSchema = TemplateEventValueSchema;
|
|
147941
|
+
exports.TemplateGroupRowSchema = TemplateGroupRowSchema;
|
|
147942
|
+
exports.TemplateInputSchema = TemplateInputSchema;
|
|
147943
|
+
exports.TemplateInputValueSchema = TemplateInputValueSchema;
|
|
147944
|
+
exports.TemplateInputValuesSchema = TemplateInputValuesSchema;
|
|
147945
|
+
exports.TemplateInstanceProblemSchema = TemplateInstanceProblemSchema;
|
|
146634
147946
|
exports.TemplateKindSchema = TemplateKindSchema;
|
|
147947
|
+
exports.TemplatePathSchema = TemplatePathSchema;
|
|
146635
147948
|
exports.TemplateRecordSchema = TemplateRecordSchema;
|
|
147949
|
+
exports.TemplateRowIdBindingSchema = TemplateRowIdBindingSchema;
|
|
147950
|
+
exports.TemplateRowItemBindingSchema = TemplateRowItemBindingSchema;
|
|
147951
|
+
exports.TemplateRowsBindingSchema = TemplateRowsBindingSchema;
|
|
147952
|
+
exports.TemplateScalarInputSchema = TemplateScalarInputSchema;
|
|
147953
|
+
exports.TemplateScalarValueSchema = TemplateScalarValueSchema;
|
|
147954
|
+
exports.TemplateSelectOptionSchema = TemplateSelectOptionSchema;
|
|
146636
147955
|
exports.TemplateUserSchema = TemplateUserSchema;
|
|
147956
|
+
exports.TemplateValueBindingSchema = TemplateValueBindingSchema;
|
|
146637
147957
|
exports.TemplateWriteResultSchema = TemplateWriteResultSchema;
|
|
146638
147958
|
exports.TerminalInstanceInfoSchema = TerminalInstanceInfoSchema;
|
|
146639
147959
|
exports.TerminalLegacyCameraSchema = TerminalLegacyCameraSchema;
|
|
@@ -146967,6 +148287,7 @@ exports.buildVideoArgs = require_implemented_methods.buildVideoArgs;
|
|
|
146967
148287
|
exports.buildViewerLink = buildViewerLink;
|
|
146968
148288
|
exports.buildVocabularySlice = buildVocabularySlice;
|
|
146969
148289
|
exports.builtCapabilityBlockers = builtCapabilityBlockers;
|
|
148290
|
+
exports.builtinAutomationTemplate = builtinAutomationTemplate;
|
|
146970
148291
|
exports.builtinRemoteComponent = builtinRemoteComponent;
|
|
146971
148292
|
exports.bundledCamstack = bundledCamstack;
|
|
146972
148293
|
exports.buttonCapability = buttonCapability;
|
|
@@ -147197,6 +148518,7 @@ exports.describeSystemEventDeliveryProblem = describeSystemEventDeliveryProblem;
|
|
|
147197
148518
|
exports.describeSystemEventFamilyProblem = describeSystemEventFamilyProblem;
|
|
147198
148519
|
exports.describeTopLevelStateFields = describeTopLevelStateFields;
|
|
147199
148520
|
exports.describeUnmet = describeUnmet;
|
|
148521
|
+
exports.detachAutomationInstance = detachAutomationInstance;
|
|
147200
148522
|
exports.detectAccessRole = detectAccessRole;
|
|
147201
148523
|
exports.detectionClassMatches = detectionClassMatches;
|
|
147202
148524
|
exports.detectionPipelineCapability = detectionPipelineCapability;
|
|
@@ -147256,6 +148578,8 @@ exports.encodeProfileFromStreamShape = encodeProfileFromStreamShape;
|
|
|
147256
148578
|
exports.encodeSamsung = encodeSamsung;
|
|
147257
148579
|
exports.encodeTuya = encodeTuya;
|
|
147258
148580
|
exports.encodeVectorBase64 = encodeVectorBase64;
|
|
148581
|
+
exports.energySystemCapability = energySystemCapability;
|
|
148582
|
+
exports.energySystemSelfConsumptionPct = energySystemSelfConsumptionPct;
|
|
147259
148583
|
exports.ensureAlarmProfiles = ensureAlarmProfiles;
|
|
147260
148584
|
exports.entryBody = require_sleep.entryBody;
|
|
147261
148585
|
exports.enumSensorCapability = enumSensorCapability;
|
|
@@ -147290,9 +148614,11 @@ exports.eventTypesOfVocabulary = eventTypesOfVocabulary;
|
|
|
147290
148614
|
exports.evictionPolicyForMode = evictionPolicyForMode;
|
|
147291
148615
|
exports.evictionPolicyOfLocation = evictionPolicyOfLocation;
|
|
147292
148616
|
exports.expandAudioChunkToF32le = require_sleep.expandAudioChunkToF32le;
|
|
148617
|
+
exports.expandAutomationTemplate = expandAutomationTemplate;
|
|
147293
148618
|
exports.expandCapMethods = require_sleep.expandCapMethods;
|
|
147294
148619
|
exports.expandContainer = expandContainer;
|
|
147295
148620
|
exports.expandSystemEventClasses = expandSystemEventClasses;
|
|
148621
|
+
exports.exportAutomationTemplate = exportAutomationTemplate;
|
|
147296
148622
|
exports.exportSubjectOf = exportSubjectOf;
|
|
147297
148623
|
exports.exposeBlockDevices = exposeBlockDevices;
|
|
147298
148624
|
exports.exposedNamePatch = exposedNamePatch;
|
|
@@ -147330,6 +148656,7 @@ exports.findCandidateCycles = findCandidateCycles;
|
|
|
147330
148656
|
exports.findChannelSource = findChannelSource;
|
|
147331
148657
|
exports.findCompositionCycles = findCompositionCycles;
|
|
147332
148658
|
exports.findMigrationsBlocked = require_sleep.findMigrationsBlocked;
|
|
148659
|
+
exports.findRecipeLiteralJson = findRecipeLiteralJson;
|
|
147333
148660
|
exports.findTimezone = findTimezone;
|
|
147334
148661
|
exports.findVocabAction = require_sleep.findVocabAction;
|
|
147335
148662
|
exports.findVocabularyEntry = findVocabularyEntry;
|
|
@@ -147430,9 +148757,11 @@ exports.ingestReading = ingestReading;
|
|
|
147430
148757
|
exports.initialPoolMemoryState = initialPoolMemoryState;
|
|
147431
148758
|
exports.insertComponent = insertComponent;
|
|
147432
148759
|
exports.instanceApiOverTargets = instanceApiOverTargets;
|
|
148760
|
+
exports.instanceCodeHash = instanceCodeHash;
|
|
147433
148761
|
exports.instanceSourceOverApi = instanceSourceOverApi;
|
|
147434
148762
|
exports.instancesOfCap = instancesOfCap;
|
|
147435
148763
|
exports.instantKindsOf = instantKindsOf;
|
|
148764
|
+
exports.instantiateAutomationTemplate = instantiateAutomationTemplate;
|
|
147436
148765
|
exports.integralCadenceMs = require_implemented_methods.integralCadenceMs;
|
|
147437
148766
|
exports.integralDraft = integralDraft;
|
|
147438
148767
|
exports.integrateReading = require_implemented_methods.integrateReading;
|
|
@@ -147472,6 +148801,7 @@ exports.isAudioRule = isAudioRule;
|
|
|
147472
148801
|
exports.isAutomaticShareSource = isAutomaticShareSource;
|
|
147473
148802
|
exports.isBaseConditionKey = isBaseConditionKey;
|
|
147474
148803
|
exports.isBatteryPresenceFault = isBatteryPresenceFault;
|
|
148804
|
+
exports.isBuiltinTemplateId = isBuiltinTemplateId;
|
|
147475
148805
|
exports.isClusterScopedStep = isClusterScopedStep;
|
|
147476
148806
|
exports.isCollectionArrayMethod = isCollectionArrayMethod;
|
|
147477
148807
|
exports.isCommand = require_sleep.isCommand;
|
|
@@ -147569,6 +148899,7 @@ exports.kebabToCamel = kebabToCamel;
|
|
|
147569
148899
|
exports.keychainAdminCapability = keychainAdminCapability;
|
|
147570
148900
|
exports.keychainCapability = keychainCapability;
|
|
147571
148901
|
exports.kindOfValue = kindOfValue;
|
|
148902
|
+
exports.kindServesCap = kindServesCap;
|
|
147572
148903
|
exports.kindsForDiscriminator = kindsForDiscriminator;
|
|
147573
148904
|
exports.knownSecretCount = require_sleep.knownSecretCount;
|
|
147574
148905
|
exports.knownValues = knownValues;
|
|
@@ -147867,6 +149198,7 @@ exports.readKeyedArrayItems = readKeyedArrayItems;
|
|
|
147867
149198
|
exports.readMotionTriggeredBy = readMotionTriggeredBy;
|
|
147868
149199
|
exports.readNativeLeaseOverride = readNativeLeaseOverride;
|
|
147869
149200
|
exports.readNodePin = require_sleep.readNodePin;
|
|
149201
|
+
exports.readRecipeLiteral = readRecipeLiteral;
|
|
147870
149202
|
exports.readRecoveryRecipe = readRecoveryRecipe;
|
|
147871
149203
|
exports.readRecoveryRecipeForSteps = readRecoveryRecipeForSteps;
|
|
147872
149204
|
exports.readStoredRemoteConfig = readStoredRemoteConfig;
|
|
@@ -147897,6 +149229,7 @@ exports.rectsOverlap = rectsOverlap;
|
|
|
147897
149229
|
exports.rectsToCells = rectsToCells;
|
|
147898
149230
|
exports.reducePoints = reducePoints;
|
|
147899
149231
|
exports.reducerForActive = reducerForActive;
|
|
149232
|
+
exports.reexpandAutomationInstance = reexpandAutomationInstance;
|
|
147900
149233
|
exports.registerKnownSecret = require_sleep.registerKnownSecret;
|
|
147901
149234
|
exports.registerPowerSwitch = registerPowerSwitch;
|
|
147902
149235
|
exports.registrySwitchPortsOver = require_sleep.registrySwitchPortsOver;
|
|
@@ -147914,6 +149247,7 @@ exports.removeScalarTarget = removeScalarTarget;
|
|
|
147914
149247
|
exports.renameAlarmProfile = renameAlarmProfile;
|
|
147915
149248
|
exports.renderVocabPhrase = renderVocabPhrase;
|
|
147916
149249
|
exports.repeatCheck = repeatCheck;
|
|
149250
|
+
exports.replaceRecipeLiteral = replaceRecipeLiteral;
|
|
147917
149251
|
exports.replacedFieldKeys = replacedFieldKeys;
|
|
147918
149252
|
exports.replayDwellIntervals = replayDwellIntervals;
|
|
147919
149253
|
exports.reportIsScalable = reportIsScalable;
|