@camstack/addon-provider-homematic 1.2.181 → 1.2.182
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 +7 -0
- package/dist/_stub.js +2 -2
- package/dist/{_virtual_mf-localSharedImportMap___mfe_internal__addon_provider_homematic_page-UqgGIdfI.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_provider_homematic_page-JUxcy5lc.mjs} +4 -4
- package/dist/_virtual_mf___mfe_internal__addon_provider_homematic_page__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-BWuRQmat.mjs +26 -0
- package/dist/addon-provider-homematic.css +1 -1
- package/dist/addon.js +2508 -741
- package/dist/addon.mjs +2508 -741
- package/dist/{hostInit-_DiBGHlp.mjs → hostInit-8TyU_3LT.mjs} +3 -3
- package/dist/remoteEntry.js +1 -1
- package/dist/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__addon_provider_homematic_page__remoteEntry_js-B89pkD2D.mjs → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__addon_provider_homematic_page__remoteEntry_js-C1-2pWc8.mjs} +1 -1
- package/package.json +7 -3
- package/dist/_virtual_mf___mfe_internal__addon_provider_homematic_page__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-DINQBJ6Y.mjs +0 -26
package/dist/addon.js
CHANGED
|
@@ -794,7 +794,7 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
|
794
794
|
return EventCategory;
|
|
795
795
|
}({});
|
|
796
796
|
//#endregion
|
|
797
|
-
//#region ../types/dist/device-type-
|
|
797
|
+
//#region ../types/dist/device-type-D1fH5kaC.mjs
|
|
798
798
|
/**
|
|
799
799
|
import { errMsg } from '@camstack/types'
|
|
800
800
|
* Extract a human-readable message from an unknown error value.
|
|
@@ -1025,6 +1025,12 @@ var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
|
|
|
1025
1025
|
DeviceFeature["MediaPlayerPrevious"] = "media-player-previous";
|
|
1026
1026
|
/** Media player exposes stop distinct from pause. */
|
|
1027
1027
|
DeviceFeature["MediaPlayerStop"] = "media-player-stop";
|
|
1028
|
+
/** Media player exposes volume up / down in steps (an infrared TV has no level). */
|
|
1029
|
+
DeviceFeature["MediaPlayerVolumeStep"] = "media-player-volume-step";
|
|
1030
|
+
/** Media player exposes channel up / down in steps. */
|
|
1031
|
+
DeviceFeature["MediaPlayerChannelStep"] = "media-player-channel-step";
|
|
1032
|
+
/** Media player exposes power on / off. */
|
|
1033
|
+
DeviceFeature["MediaPlayerPower"] = "media-player-power";
|
|
1028
1034
|
/** Alarm panel requires a PIN code on arm/disarm. */
|
|
1029
1035
|
DeviceFeature["AlarmPinRequired"] = "alarm-pin-required";
|
|
1030
1036
|
/** Presence device carries GPS coordinates (lat/lng/accuracy) in
|
|
@@ -4561,6 +4567,12 @@ var numberProcessor = (schema, ctx, _json, _params) => {
|
|
|
4561
4567
|
var booleanProcessor = (_schema, _ctx, json, _params) => {
|
|
4562
4568
|
json.type = "boolean";
|
|
4563
4569
|
};
|
|
4570
|
+
var bigintProcessor = (_schema, ctx, _json, _params) => {
|
|
4571
|
+
if (ctx.unrepresentable === "throw") throw new Error("BigInt cannot be represented in JSON Schema");
|
|
4572
|
+
};
|
|
4573
|
+
var symbolProcessor = (_schema, ctx, _json, _params) => {
|
|
4574
|
+
if (ctx.unrepresentable === "throw") throw new Error("Symbols cannot be represented in JSON Schema");
|
|
4575
|
+
};
|
|
4564
4576
|
var nullProcessor = (_schema, ctx, json, _params) => {
|
|
4565
4577
|
if (ctx.target === "openapi-3.0") {
|
|
4566
4578
|
json.type = "string";
|
|
@@ -4568,12 +4580,17 @@ var nullProcessor = (_schema, ctx, json, _params) => {
|
|
|
4568
4580
|
json.enum = [null];
|
|
4569
4581
|
} else json.type = "null";
|
|
4570
4582
|
};
|
|
4583
|
+
var undefinedProcessor = (_schema, ctx, _json, _params) => {
|
|
4584
|
+
if (ctx.unrepresentable === "throw") throw new Error("Undefined cannot be represented in JSON Schema");
|
|
4585
|
+
};
|
|
4571
4586
|
var voidProcessor = (_schema, ctx, _json, _params) => {
|
|
4572
4587
|
if (ctx.unrepresentable === "throw") throw new Error("Void cannot be represented in JSON Schema");
|
|
4573
4588
|
};
|
|
4574
4589
|
var neverProcessor = (_schema, _ctx, json, _params) => {
|
|
4575
4590
|
json.not = {};
|
|
4576
4591
|
};
|
|
4592
|
+
var anyProcessor = (_schema, _ctx, _json, _params) => {};
|
|
4593
|
+
var unknownProcessor = (_schema, _ctx, _json, _params) => {};
|
|
4577
4594
|
var dateProcessor = (_schema, ctx, _json, _params) => {
|
|
4578
4595
|
if (ctx.unrepresentable === "throw") throw new Error("Date cannot be represented in JSON Schema");
|
|
4579
4596
|
};
|
|
@@ -4605,12 +4622,53 @@ var literalProcessor = (schema, ctx, json, _params) => {
|
|
|
4605
4622
|
json.enum = vals;
|
|
4606
4623
|
}
|
|
4607
4624
|
};
|
|
4625
|
+
var nanProcessor = (_schema, ctx, _json, _params) => {
|
|
4626
|
+
if (ctx.unrepresentable === "throw") throw new Error("NaN cannot be represented in JSON Schema");
|
|
4627
|
+
};
|
|
4628
|
+
var templateLiteralProcessor = (schema, _ctx, json, _params) => {
|
|
4629
|
+
const _json = json;
|
|
4630
|
+
const pattern = schema._zod.pattern;
|
|
4631
|
+
if (!pattern) throw new Error("Pattern not found in template literal");
|
|
4632
|
+
_json.type = "string";
|
|
4633
|
+
_json.pattern = pattern.source;
|
|
4634
|
+
};
|
|
4635
|
+
var fileProcessor = (schema, _ctx, json, _params) => {
|
|
4636
|
+
const _json = json;
|
|
4637
|
+
const file = {
|
|
4638
|
+
type: "string",
|
|
4639
|
+
format: "binary",
|
|
4640
|
+
contentEncoding: "binary"
|
|
4641
|
+
};
|
|
4642
|
+
const { minimum, maximum, mime } = schema._zod.bag;
|
|
4643
|
+
if (minimum !== void 0) file.minLength = minimum;
|
|
4644
|
+
if (maximum !== void 0) file.maxLength = maximum;
|
|
4645
|
+
if (mime) if (mime.length === 1) {
|
|
4646
|
+
file.contentMediaType = mime[0];
|
|
4647
|
+
Object.assign(_json, file);
|
|
4648
|
+
} else {
|
|
4649
|
+
Object.assign(_json, file);
|
|
4650
|
+
_json.anyOf = mime.map((m) => ({ contentMediaType: m }));
|
|
4651
|
+
}
|
|
4652
|
+
else Object.assign(_json, file);
|
|
4653
|
+
};
|
|
4654
|
+
var successProcessor = (_schema, _ctx, json, _params) => {
|
|
4655
|
+
json.type = "boolean";
|
|
4656
|
+
};
|
|
4608
4657
|
var customProcessor = (_schema, ctx, _json, _params) => {
|
|
4609
4658
|
if (ctx.unrepresentable === "throw") throw new Error("Custom types cannot be represented in JSON Schema");
|
|
4610
4659
|
};
|
|
4660
|
+
var functionProcessor = (_schema, ctx, _json, _params) => {
|
|
4661
|
+
if (ctx.unrepresentable === "throw") throw new Error("Function types cannot be represented in JSON Schema");
|
|
4662
|
+
};
|
|
4611
4663
|
var transformProcessor = (_schema, ctx, _json, _params) => {
|
|
4612
4664
|
if (ctx.unrepresentable === "throw") throw new Error("Transforms cannot be represented in JSON Schema");
|
|
4613
4665
|
};
|
|
4666
|
+
var mapProcessor = (_schema, ctx, _json, _params) => {
|
|
4667
|
+
if (ctx.unrepresentable === "throw") throw new Error("Map cannot be represented in JSON Schema");
|
|
4668
|
+
};
|
|
4669
|
+
var setProcessor = (_schema, ctx, _json, _params) => {
|
|
4670
|
+
if (ctx.unrepresentable === "throw") throw new Error("Set cannot be represented in JSON Schema");
|
|
4671
|
+
};
|
|
4614
4672
|
var arrayProcessor = (schema, ctx, _json, params) => {
|
|
4615
4673
|
const json = _json;
|
|
4616
4674
|
const def = schema._zod.def;
|
|
@@ -4815,6 +4873,12 @@ var readonlyProcessor = (schema, ctx, json, params) => {
|
|
|
4815
4873
|
seen.ref = def.innerType;
|
|
4816
4874
|
json.readOnly = true;
|
|
4817
4875
|
};
|
|
4876
|
+
var promiseProcessor = (schema, ctx, _json, params) => {
|
|
4877
|
+
const def = schema._zod.def;
|
|
4878
|
+
process$1(def.innerType, ctx, params);
|
|
4879
|
+
const seen = ctx.seen.get(schema);
|
|
4880
|
+
seen.ref = def.innerType;
|
|
4881
|
+
};
|
|
4818
4882
|
var optionalProcessor = (schema, ctx, _json, params) => {
|
|
4819
4883
|
const def = schema._zod.def;
|
|
4820
4884
|
process$1(def.innerType, ctx, params);
|
|
@@ -4827,6 +4891,81 @@ var lazyProcessor = (schema, ctx, _json, params) => {
|
|
|
4827
4891
|
const seen = ctx.seen.get(schema);
|
|
4828
4892
|
seen.ref = innerType;
|
|
4829
4893
|
};
|
|
4894
|
+
var allProcessors = {
|
|
4895
|
+
string: stringProcessor,
|
|
4896
|
+
number: numberProcessor,
|
|
4897
|
+
boolean: booleanProcessor,
|
|
4898
|
+
bigint: bigintProcessor,
|
|
4899
|
+
symbol: symbolProcessor,
|
|
4900
|
+
null: nullProcessor,
|
|
4901
|
+
undefined: undefinedProcessor,
|
|
4902
|
+
void: voidProcessor,
|
|
4903
|
+
never: neverProcessor,
|
|
4904
|
+
any: anyProcessor,
|
|
4905
|
+
unknown: unknownProcessor,
|
|
4906
|
+
date: dateProcessor,
|
|
4907
|
+
enum: enumProcessor,
|
|
4908
|
+
literal: literalProcessor,
|
|
4909
|
+
nan: nanProcessor,
|
|
4910
|
+
template_literal: templateLiteralProcessor,
|
|
4911
|
+
file: fileProcessor,
|
|
4912
|
+
success: successProcessor,
|
|
4913
|
+
custom: customProcessor,
|
|
4914
|
+
function: functionProcessor,
|
|
4915
|
+
transform: transformProcessor,
|
|
4916
|
+
map: mapProcessor,
|
|
4917
|
+
set: setProcessor,
|
|
4918
|
+
array: arrayProcessor,
|
|
4919
|
+
object: objectProcessor,
|
|
4920
|
+
union: unionProcessor,
|
|
4921
|
+
intersection: intersectionProcessor,
|
|
4922
|
+
tuple: tupleProcessor,
|
|
4923
|
+
record: recordProcessor,
|
|
4924
|
+
nullable: nullableProcessor,
|
|
4925
|
+
nonoptional: nonoptionalProcessor,
|
|
4926
|
+
default: defaultProcessor,
|
|
4927
|
+
prefault: prefaultProcessor,
|
|
4928
|
+
catch: catchProcessor,
|
|
4929
|
+
pipe: pipeProcessor,
|
|
4930
|
+
readonly: readonlyProcessor,
|
|
4931
|
+
promise: promiseProcessor,
|
|
4932
|
+
optional: optionalProcessor,
|
|
4933
|
+
lazy: lazyProcessor
|
|
4934
|
+
};
|
|
4935
|
+
function toJSONSchema(input, params) {
|
|
4936
|
+
if ("_idmap" in input) {
|
|
4937
|
+
const registry = input;
|
|
4938
|
+
const ctx = initializeContext({
|
|
4939
|
+
...params,
|
|
4940
|
+
processors: allProcessors
|
|
4941
|
+
});
|
|
4942
|
+
const defs = {};
|
|
4943
|
+
for (const entry of registry._idmap.entries()) {
|
|
4944
|
+
const [_, schema] = entry;
|
|
4945
|
+
process$1(schema, ctx);
|
|
4946
|
+
}
|
|
4947
|
+
const schemas = {};
|
|
4948
|
+
ctx.external = {
|
|
4949
|
+
registry,
|
|
4950
|
+
uri: params?.uri,
|
|
4951
|
+
defs
|
|
4952
|
+
};
|
|
4953
|
+
for (const entry of registry._idmap.entries()) {
|
|
4954
|
+
const [key, schema] = entry;
|
|
4955
|
+
extractDefs(ctx, schema);
|
|
4956
|
+
schemas[key] = finalize(ctx, schema);
|
|
4957
|
+
}
|
|
4958
|
+
if (Object.keys(defs).length > 0) schemas.__shared = { [ctx.target === "draft-2020-12" ? "$defs" : "definitions"]: defs };
|
|
4959
|
+
return { schemas };
|
|
4960
|
+
}
|
|
4961
|
+
const ctx = initializeContext({
|
|
4962
|
+
...params,
|
|
4963
|
+
processors: allProcessors
|
|
4964
|
+
});
|
|
4965
|
+
process$1(input, ctx);
|
|
4966
|
+
extractDefs(ctx, input);
|
|
4967
|
+
return finalize(ctx, input);
|
|
4968
|
+
}
|
|
4830
4969
|
//#endregion
|
|
4831
4970
|
//#region ../../node_modules/zod/v4/classic/iso.js
|
|
4832
4971
|
var ZodISODateTime = /*@__PURE__*/ $constructor("ZodISODateTime", (inst, def) => {
|
|
@@ -5851,7 +5990,7 @@ var ZodIssueCode = {
|
|
|
5851
5990
|
var ZodFirstPartyTypeKind;
|
|
5852
5991
|
ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
|
|
5853
5992
|
//#endregion
|
|
5854
|
-
//#region ../types/dist/sleep-
|
|
5993
|
+
//#region ../types/dist/sleep-D1jjWAr8.mjs
|
|
5855
5994
|
/**
|
|
5856
5995
|
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
5857
5996
|
* window to float samples (D455).
|
|
@@ -5930,6 +6069,22 @@ function buildAlawTable() {
|
|
|
5930
6069
|
}
|
|
5931
6070
|
buildUlawTable();
|
|
5932
6071
|
buildAlawTable();
|
|
6072
|
+
/**
|
|
6073
|
+
* An addon whose own migrations did not apply refuses to initialise (D987). The error is typed
|
|
6074
|
+
* so a runner hosting several addons can tell "this addon is blocked" from a crash and keep its
|
|
6075
|
+
* co-located siblings running. Recognised by NAME and shape, never `instanceof`: a forked addon
|
|
6076
|
+
* bundles its own copy of this module, so the class the runner sees is not the one that threw.
|
|
6077
|
+
*/
|
|
6078
|
+
var MIGRATIONS_BLOCKED_ERROR_NAME = "AddonMigrationsBlockedError";
|
|
6079
|
+
var AddonMigrationsBlockedError = class extends Error {
|
|
6080
|
+
/** The ledger ids that did not apply and block the owner. */
|
|
6081
|
+
migrationIds;
|
|
6082
|
+
constructor(migrationIds) {
|
|
6083
|
+
super(`migration(s) ${migrationIds.join(", ")} did not apply and block this addon — fix or retry them (migrations.retry), then restart it`);
|
|
6084
|
+
this.name = MIGRATIONS_BLOCKED_ERROR_NAME;
|
|
6085
|
+
this.migrationIds = migrationIds;
|
|
6086
|
+
}
|
|
6087
|
+
};
|
|
5933
6088
|
/** Is this field's stored value a credential? */
|
|
5934
6089
|
function isSecretConfigField(field) {
|
|
5935
6090
|
if (field.type === "password") return true;
|
|
@@ -5983,9 +6138,16 @@ function isSecretMarker(value) {
|
|
|
5983
6138
|
const ref = value["$secret"];
|
|
5984
6139
|
return typeof ref === "string" && ref.length > 0;
|
|
5985
6140
|
}
|
|
6141
|
+
/** Anything carrying a `$secret` key — a stored marker or a UI view of one. */
|
|
6142
|
+
function isSecretMarkerLike(value) {
|
|
6143
|
+
return isRecord$7(value) && Object.prototype.hasOwnProperty.call(value, "$secret");
|
|
6144
|
+
}
|
|
5986
6145
|
function isSecretClear(value) {
|
|
5987
6146
|
return isRecord$7(value) && value["$secretClear"] === true;
|
|
5988
6147
|
}
|
|
6148
|
+
function isSecretFieldView(value) {
|
|
6149
|
+
return isRecord$7(value) && value["set"] === true && isSecretMarkerLike(value);
|
|
6150
|
+
}
|
|
5989
6151
|
/**
|
|
5990
6152
|
* The UI view of a stored secret field value: a marker becomes "set", inline
|
|
5991
6153
|
* plaintext becomes "set (inline)", nothing becomes `null`. A value never
|
|
@@ -6367,6 +6529,53 @@ function emitReadiness(bus, params) {
|
|
|
6367
6529
|
ts
|
|
6368
6530
|
}));
|
|
6369
6531
|
}
|
|
6532
|
+
/** Why a catalogue entry is not a runnable body of its declared kind. */
|
|
6533
|
+
var AddonMigrationDefinitionError = class extends Error {
|
|
6534
|
+
id;
|
|
6535
|
+
constructor(id, message) {
|
|
6536
|
+
super(`${id}: ${message}`);
|
|
6537
|
+
this.id = id;
|
|
6538
|
+
this.name = "AddonMigrationDefinitionError";
|
|
6539
|
+
}
|
|
6540
|
+
};
|
|
6541
|
+
/**
|
|
6542
|
+
* Bind a catalogue to the addon's ports. Throws {@link AddonMigrationDefinitionError} when
|
|
6543
|
+
* an entry's `bodyKind` does not match the body it carries, or is `sql` (a hub-only
|
|
6544
|
+
* body). A throwing body never escapes `execute`: it is reported as a failed result.
|
|
6545
|
+
*/
|
|
6546
|
+
function defineAddonMigrations(catalogue, ports) {
|
|
6547
|
+
return catalogue.map((entry) => {
|
|
6548
|
+
const { meta } = entry;
|
|
6549
|
+
if ("plan" in entry) {
|
|
6550
|
+
if (meta.bodyKind !== "plan") throw new AddonMigrationDefinitionError(meta.id, `carries a plan body but declares "${meta.bodyKind}"`);
|
|
6551
|
+
return {
|
|
6552
|
+
meta,
|
|
6553
|
+
execute: () => guarded(async () => ({
|
|
6554
|
+
kind: "plan",
|
|
6555
|
+
plan: await entry.plan(ports)
|
|
6556
|
+
}))
|
|
6557
|
+
};
|
|
6558
|
+
}
|
|
6559
|
+
if (meta.bodyKind !== "procedure") throw new AddonMigrationDefinitionError(meta.id, `carries a procedure body but declares "${meta.bodyKind}"`);
|
|
6560
|
+
return {
|
|
6561
|
+
meta,
|
|
6562
|
+
execute: () => guarded(async () => ({
|
|
6563
|
+
kind: "procedure",
|
|
6564
|
+
result: await entry.procedure(ports)
|
|
6565
|
+
}))
|
|
6566
|
+
};
|
|
6567
|
+
});
|
|
6568
|
+
}
|
|
6569
|
+
async function guarded(work) {
|
|
6570
|
+
try {
|
|
6571
|
+
return await work();
|
|
6572
|
+
} catch (err) {
|
|
6573
|
+
return {
|
|
6574
|
+
kind: "failed",
|
|
6575
|
+
error: errMsg(err)
|
|
6576
|
+
};
|
|
6577
|
+
}
|
|
6578
|
+
}
|
|
6370
6579
|
var NOT_RUN = {
|
|
6371
6580
|
declared: false,
|
|
6372
6581
|
snapshot: null,
|
|
@@ -6381,7 +6590,7 @@ var NOT_RUN = {
|
|
|
6381
6590
|
* throws: an unreachable or refusing engine is logged and reported `declared: false`,
|
|
6382
6591
|
* because the hub (and this addon's boot) must not hang on a migration.
|
|
6383
6592
|
*/
|
|
6384
|
-
async function runAddonMigrations(host, migrations, logger) {
|
|
6593
|
+
async function runAddonMigrations(host, migrations, logger, options = {}) {
|
|
6385
6594
|
const first = migrations[0];
|
|
6386
6595
|
if (first === void 0) return NOT_RUN;
|
|
6387
6596
|
const owner = first.meta.owner;
|
|
@@ -6410,7 +6619,9 @@ async function runAddonMigrations(host, migrations, logger) {
|
|
|
6410
6619
|
else if (status === "blocked") blocked.push(id);
|
|
6411
6620
|
else skipped.push(id);
|
|
6412
6621
|
};
|
|
6622
|
+
const selected = options.only === void 0 ? null : new Set(options.only);
|
|
6413
6623
|
for (const step of declaration.steps) {
|
|
6624
|
+
if (selected !== null && !selected.has(step.id)) continue;
|
|
6414
6625
|
const bound = byId.get(step.id);
|
|
6415
6626
|
if (bound === void 0 || step.action === "skip") {
|
|
6416
6627
|
skipped.push(step.id);
|
|
@@ -6588,11 +6799,36 @@ function projectStore(store, perNodeKeys, nodeId) {
|
|
|
6588
6799
|
}
|
|
6589
6800
|
return out;
|
|
6590
6801
|
}
|
|
6802
|
+
/**
|
|
6803
|
+
* The address of one keychain value: `secret://<owner>/<scope>/<fieldPath>`.
|
|
6804
|
+
*
|
|
6805
|
+
* A ref is DETERMINISTIC from where the value lives — the owner addon, the
|
|
6806
|
+
* scope (global, one node, one device, one integration, one row of a business
|
|
6807
|
+
* collection) and the field path inside that scope — so saving the same field
|
|
6808
|
+
* twice updates the same ref, and the ref itself says which settings blob
|
|
6809
|
+
* points at it. It is also the AAD of the value's ciphertext: a ciphertext
|
|
6810
|
+
* copied onto another ref does not decrypt.
|
|
6811
|
+
*
|
|
6812
|
+
* Array items are addressed by ITEM ID, never by index
|
|
6813
|
+
* (`providers[authentik].clientSecret`), so reordering a list keeps every ref.
|
|
6814
|
+
*
|
|
6815
|
+
* Pure and browser-safe: no node builtins, no I/O.
|
|
6816
|
+
*/
|
|
6817
|
+
/** The URI scheme of every keychain ref. */
|
|
6818
|
+
var SECRET_REF_SCHEME = "secret://";
|
|
6591
6819
|
var GLOBAL_SCOPE = { kind: "global" };
|
|
6592
6820
|
/** The scope every addon-wide (not per-node, not per-device) setting lives in. */
|
|
6593
6821
|
function globalSecretScope() {
|
|
6594
6822
|
return GLOBAL_SCOPE;
|
|
6595
6823
|
}
|
|
6824
|
+
/**
|
|
6825
|
+
* An addon id as a ref owner. A hub in-process builtin's context id is
|
|
6826
|
+
* `addon:<id>`; the owner of its secrets is `<id>`, exactly as for the same
|
|
6827
|
+
* addon running forked.
|
|
6828
|
+
*/
|
|
6829
|
+
function normalizeSecretOwner(addonId) {
|
|
6830
|
+
return addonId.startsWith("addon:") ? addonId.slice(6) : addonId;
|
|
6831
|
+
}
|
|
6596
6832
|
function encodeSegment(value) {
|
|
6597
6833
|
return encodeURIComponent(value);
|
|
6598
6834
|
}
|
|
@@ -6603,6 +6839,16 @@ function decodeSegment(value) {
|
|
|
6603
6839
|
return null;
|
|
6604
6840
|
}
|
|
6605
6841
|
}
|
|
6842
|
+
/** The scope as it appears inside a ref (`global`, `node/<id>`, …). */
|
|
6843
|
+
function formatSecretScope(scope) {
|
|
6844
|
+
switch (scope.kind) {
|
|
6845
|
+
case "global": return "global";
|
|
6846
|
+
case "node": return `node/${encodeSegment(scope.nodeId)}`;
|
|
6847
|
+
case "device": return `device/${scope.deviceId}`;
|
|
6848
|
+
case "integration": return `integration/${encodeSegment(scope.integrationId)}`;
|
|
6849
|
+
case "row": return `row/${encodeSegment(scope.collection)}/${encodeSegment(scope.rowId)}`;
|
|
6850
|
+
}
|
|
6851
|
+
}
|
|
6606
6852
|
/**
|
|
6607
6853
|
* The field path of a value inside an array item, addressed by the item's id:
|
|
6608
6854
|
* `arrayItemFieldPath('providers', 'authentik', 'clientSecret')` →
|
|
@@ -6611,6 +6857,13 @@ function decodeSegment(value) {
|
|
|
6611
6857
|
function arrayItemFieldPath(arrayKey, itemId, fieldKey) {
|
|
6612
6858
|
return `${arrayKey}[${encodeSegment(itemId)}].${fieldKey}`;
|
|
6613
6859
|
}
|
|
6860
|
+
/** Build a ref. Throws on an empty owner or field path — both are bugs. */
|
|
6861
|
+
function buildSecretRef(parts) {
|
|
6862
|
+
const owner = normalizeSecretOwner(parts.owner);
|
|
6863
|
+
if (owner.length === 0) throw new Error("buildSecretRef: owner is empty");
|
|
6864
|
+
if (parts.fieldPath.length === 0) throw new Error("buildSecretRef: fieldPath is empty");
|
|
6865
|
+
return `${SECRET_REF_SCHEME}${encodeSegment(owner)}/${formatSecretScope(parts.scope)}/${parts.fieldPath}`;
|
|
6866
|
+
}
|
|
6614
6867
|
function parseScope(segments) {
|
|
6615
6868
|
switch (segments[0]) {
|
|
6616
6869
|
case "global": return {
|
|
@@ -7528,15 +7781,19 @@ var BaseAddon = class {
|
|
|
7528
7781
|
* nothing; the boot continues. A migration that FAILED (or was blocked by one)
|
|
7529
7782
|
* and declares `onFailure: 'block-owner'` makes this throw, so the addon does not
|
|
7530
7783
|
* serve data whose shape it cannot trust; `tolerate` migrations never do.
|
|
7784
|
+
*
|
|
7785
|
+
* ALWAYS pass the whole catalogue; a phase that must run only some of it passes
|
|
7786
|
+
* `{ only: [ids] }` — never a filtered catalogue (the engine would judge the
|
|
7787
|
+
* omitted applied ids "newer").
|
|
7531
7788
|
*/
|
|
7532
|
-
async runMigrations(migrations) {
|
|
7789
|
+
async runMigrations(migrations, options) {
|
|
7533
7790
|
const api = this.ctx.api.migrations;
|
|
7534
7791
|
const report = await runAddonMigrations({
|
|
7535
7792
|
declareOwner: (input) => api.declareOwner.mutate(input),
|
|
7536
7793
|
startMigration: (input) => api.startMigration.mutate(input),
|
|
7537
7794
|
finishMigration: (input) => api.finishMigration.mutate(input)
|
|
7538
|
-
}, migrations, this.ctx.logger);
|
|
7539
|
-
if (report.blockOwner.length > 0) throw new
|
|
7795
|
+
}, migrations, this.ctx.logger, options);
|
|
7796
|
+
if (report.blockOwner.length > 0) throw new AddonMigrationsBlockedError(report.blockOwner);
|
|
7540
7797
|
return report;
|
|
7541
7798
|
}
|
|
7542
7799
|
/**
|
|
@@ -7876,6 +8133,10 @@ var BaseAddon = class {
|
|
|
7876
8133
|
const stored = keychain ? await this.readAddonStoreWithRetry() : {};
|
|
7877
8134
|
const patch = {};
|
|
7878
8135
|
for (const key of keys) {
|
|
8136
|
+
if (tree.get(key)?.kind === "array") {
|
|
8137
|
+
patch[key] = [];
|
|
8138
|
+
continue;
|
|
8139
|
+
}
|
|
7879
8140
|
const keychainStored = tree.has(key) || collectSecretMarkerRefs(stored[key]).length > 0;
|
|
7880
8141
|
patch[key] = keychain && keychainStored ? SECRET_CLEAR : "";
|
|
7881
8142
|
}
|
|
@@ -8515,6 +8776,45 @@ function normalizeAddonInitResult(result) {
|
|
|
8515
8776
|
if (Array.isArray(result)) return { providers: result };
|
|
8516
8777
|
return result;
|
|
8517
8778
|
}
|
|
8779
|
+
var PREFIX = "records/";
|
|
8780
|
+
/** The base of every records failure. `detail` is the human part of the message. */
|
|
8781
|
+
var RecordsError = class extends Error {
|
|
8782
|
+
code;
|
|
8783
|
+
detail;
|
|
8784
|
+
constructor(code, detail) {
|
|
8785
|
+
super(`${PREFIX}${code}: ${detail}`);
|
|
8786
|
+
this.name = "RecordsError";
|
|
8787
|
+
this.code = code;
|
|
8788
|
+
this.detail = detail;
|
|
8789
|
+
}
|
|
8790
|
+
};
|
|
8791
|
+
/** A write guarded by `ifRev` found another revision (or an existing row for `ifRev: 0`). */
|
|
8792
|
+
var RevConflictError = class extends RecordsError {
|
|
8793
|
+
constructor(detail) {
|
|
8794
|
+
super("rev-conflict", detail);
|
|
8795
|
+
this.name = "RevConflictError";
|
|
8796
|
+
}
|
|
8797
|
+
};
|
|
8798
|
+
/** The keychain could not store or serve a value: explicit, never an empty string. */
|
|
8799
|
+
var RecordSecretUnavailableError = class extends RecordsError {
|
|
8800
|
+
constructor(detail) {
|
|
8801
|
+
super("secret-unavailable", detail);
|
|
8802
|
+
this.name = "RecordSecretUnavailableError";
|
|
8803
|
+
}
|
|
8804
|
+
};
|
|
8805
|
+
var InvalidRecordError = class extends RecordsError {
|
|
8806
|
+
constructor(detail) {
|
|
8807
|
+
super("invalid-record", detail);
|
|
8808
|
+
this.name = "InvalidRecordError";
|
|
8809
|
+
}
|
|
8810
|
+
};
|
|
8811
|
+
/** A kind declaration the engine refuses (non-additive change, bad shape, wrong file). */
|
|
8812
|
+
var DeclarationRefusedError = class extends RecordsError {
|
|
8813
|
+
constructor(detail) {
|
|
8814
|
+
super("declaration-refused", detail);
|
|
8815
|
+
this.name = "DeclarationRefusedError";
|
|
8816
|
+
}
|
|
8817
|
+
};
|
|
8518
8818
|
/** Limits and names of `ctx.records` (D881). One authority; the engine and the facade read it. */
|
|
8519
8819
|
/** The files a kind may live in. `history` is device-history's (D850), never records. */
|
|
8520
8820
|
var RECORD_DATABASES = ["settings", "events"];
|
|
@@ -8530,6 +8830,183 @@ var RECORD_DEFAULT_MAX_DATA_BYTES = 64 * 1024;
|
|
|
8530
8830
|
var RECORD_MAX_DATA_BYTES = 1024 * 1024;
|
|
8531
8831
|
var RECORD_BATCH_MAX = 1e3;
|
|
8532
8832
|
var RECORD_QUERY_MAX = 1e3;
|
|
8833
|
+
/** A kind in the `settings` file may not bound itself above this (D447: high volume is `events`). */
|
|
8834
|
+
var RECORD_SETTINGS_MAX_ROWS = 5e4;
|
|
8835
|
+
/** The `Column`-free proof prefix: a ref collection for a kind's secret fields. */
|
|
8836
|
+
var RECORD_SECRET_COLLECTION_PREFIX = "records:";
|
|
8837
|
+
/**
|
|
8838
|
+
* Secret fields of a record, addressed the way a Zod schema declares them
|
|
8839
|
+
* (`collectZodSecretPaths`): dotted keys, `[]` for "each element of this array"
|
|
8840
|
+
* (`auth.accessToken`, `headers[].value`).
|
|
8841
|
+
*
|
|
8842
|
+
* `{}` after a key means "each value of this map" (`applianceSecrets{}`): the map's own key
|
|
8843
|
+
* names the value (`applianceSecrets{fridge}`), so no id key is declared and a body that drops a
|
|
8844
|
+
* key releases exactly that key's secret.
|
|
8845
|
+
*
|
|
8846
|
+
* Array elements are matched by a DECLARED id key (`secretArrayKeys`:
|
|
8847
|
+
* `{ headers: 'name' }`), never by index, so reordering a list keeps every
|
|
8848
|
+
* keychain ref (the same rule as `arrayItemFieldPath`). The concrete path of a
|
|
8849
|
+
* leaf names its element: `headers[X-Api].value`.
|
|
8850
|
+
*
|
|
8851
|
+
* Pure and browser-safe. Nothing here mutates: every transform returns a new value.
|
|
8852
|
+
*/
|
|
8853
|
+
/** The array prefixes (declared form, e.g. `headers` or `a.headers`) of a path. */
|
|
8854
|
+
function parseSecretPath(path) {
|
|
8855
|
+
if (path.length === 0) throw new InvalidRecordError("an empty secret path");
|
|
8856
|
+
return path.split(".").map((raw) => {
|
|
8857
|
+
const each = raw.endsWith("[]");
|
|
8858
|
+
const map = raw.endsWith("{}");
|
|
8859
|
+
const key = each || map ? raw.slice(0, -2) : raw;
|
|
8860
|
+
if (key.length === 0) throw new InvalidRecordError(`secret path "${path}" has an empty segment`);
|
|
8861
|
+
return {
|
|
8862
|
+
key,
|
|
8863
|
+
each,
|
|
8864
|
+
map
|
|
8865
|
+
};
|
|
8866
|
+
});
|
|
8867
|
+
}
|
|
8868
|
+
/** The declared array prefixes of `path` that need an id key (`headers`, `a.rows`). */
|
|
8869
|
+
function secretArrayPrefixes(path) {
|
|
8870
|
+
const segments = parseSecretPath(path);
|
|
8871
|
+
const prefixes = [];
|
|
8872
|
+
const walked = [];
|
|
8873
|
+
for (const segment of segments) {
|
|
8874
|
+
walked.push(segment.key);
|
|
8875
|
+
if (segment.each) prefixes.push(walked.join("."));
|
|
8876
|
+
}
|
|
8877
|
+
return prefixes;
|
|
8878
|
+
}
|
|
8879
|
+
function isRecord$4(value) {
|
|
8880
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
8881
|
+
}
|
|
8882
|
+
function elementId(element, idKey, declared, prefix) {
|
|
8883
|
+
const id = isRecord$4(element) ? element[idKey] : void 0;
|
|
8884
|
+
if (typeof id !== "string" || id.length === 0) throw new InvalidRecordError(`"${declared}": every element of "${prefix}" needs a non-empty string "${idKey}" to carry a secret`);
|
|
8885
|
+
return id;
|
|
8886
|
+
}
|
|
8887
|
+
/**
|
|
8888
|
+
* Visit every secret leaf PRESENT in `data` (an absent branch has nothing to
|
|
8889
|
+
* visit). `replace` returns the new leaf value, or {@link REMOVE_LEAF}; the
|
|
8890
|
+
* result is a new body, `data` is untouched.
|
|
8891
|
+
*/
|
|
8892
|
+
var REMOVE_LEAF = Symbol("remove-leaf");
|
|
8893
|
+
function mapAt(node, segments, index, walkedKeys, concretePrefix, declared, arrayKeys, visit) {
|
|
8894
|
+
if (!isRecord$4(node)) return node;
|
|
8895
|
+
const segment = segments[index];
|
|
8896
|
+
if (segment === void 0) return node;
|
|
8897
|
+
if (!Object.prototype.hasOwnProperty.call(node, segment.key)) return node;
|
|
8898
|
+
const child = node[segment.key];
|
|
8899
|
+
const keys = [...walkedKeys, segment.key];
|
|
8900
|
+
const last = index === segments.length - 1;
|
|
8901
|
+
if (segment.each) {
|
|
8902
|
+
if (!Array.isArray(child)) return node;
|
|
8903
|
+
const prefix = keys.join(".");
|
|
8904
|
+
const idKey = arrayKeys[prefix];
|
|
8905
|
+
if (idKey === void 0) throw new InvalidRecordError(`"${declared}": no id key declared for the array "${prefix}"`);
|
|
8906
|
+
const mapped = child.map((element) => {
|
|
8907
|
+
const id = elementId(element, idKey, declared, prefix);
|
|
8908
|
+
const concrete = `${concretePrefix}${concretePrefix.length > 0 ? "." : ""}${segment.key}[${encodeURIComponent(id)}]`;
|
|
8909
|
+
return last ? element : mapAt(element, segments, index + 1, keys, concrete, declared, arrayKeys, visit);
|
|
8910
|
+
});
|
|
8911
|
+
return {
|
|
8912
|
+
...node,
|
|
8913
|
+
[segment.key]: mapped
|
|
8914
|
+
};
|
|
8915
|
+
}
|
|
8916
|
+
if (segment.map) {
|
|
8917
|
+
if (!isRecord$4(child)) return node;
|
|
8918
|
+
const kept = Object.entries(child).map(([mapKey, value]) => {
|
|
8919
|
+
const concrete = `${concretePrefix}${concretePrefix.length > 0 ? "." : ""}${segment.key}{${encodeURIComponent(mapKey)}}`;
|
|
8920
|
+
if (!last) return [mapKey, mapAt(value, segments, index + 1, keys, concrete, declared, arrayKeys, visit)];
|
|
8921
|
+
return [mapKey, visit({
|
|
8922
|
+
declared,
|
|
8923
|
+
concrete,
|
|
8924
|
+
value
|
|
8925
|
+
})];
|
|
8926
|
+
}).filter(([, value]) => value !== REMOVE_LEAF);
|
|
8927
|
+
return {
|
|
8928
|
+
...node,
|
|
8929
|
+
[segment.key]: Object.fromEntries(kept)
|
|
8930
|
+
};
|
|
8931
|
+
}
|
|
8932
|
+
const concrete = `${concretePrefix}${concretePrefix.length > 0 ? "." : ""}${segment.key}`;
|
|
8933
|
+
if (last) {
|
|
8934
|
+
const replacement = visit({
|
|
8935
|
+
declared,
|
|
8936
|
+
concrete,
|
|
8937
|
+
value: child
|
|
8938
|
+
});
|
|
8939
|
+
if (replacement === REMOVE_LEAF) return Object.fromEntries(Object.entries(node).filter(([key]) => key !== segment.key));
|
|
8940
|
+
return {
|
|
8941
|
+
...node,
|
|
8942
|
+
[segment.key]: replacement
|
|
8943
|
+
};
|
|
8944
|
+
}
|
|
8945
|
+
return {
|
|
8946
|
+
...node,
|
|
8947
|
+
[segment.key]: mapAt(child, segments, index + 1, keys, concrete, declared, arrayKeys, visit)
|
|
8948
|
+
};
|
|
8949
|
+
}
|
|
8950
|
+
/** Replace/remove every present secret leaf; returns a NEW body. */
|
|
8951
|
+
function mapSecretLeaves(data, paths, arrayKeys, visit) {
|
|
8952
|
+
let current = data;
|
|
8953
|
+
for (const declared of paths) current = mapAt(current, parseSecretPath(declared), 0, [], "", declared, arrayKeys, visit);
|
|
8954
|
+
return current;
|
|
8955
|
+
}
|
|
8956
|
+
/** Every present secret leaf, read-only. */
|
|
8957
|
+
function collectSecretLeaves(data, paths, arrayKeys) {
|
|
8958
|
+
const found = [];
|
|
8959
|
+
mapSecretLeaves(data, paths, arrayKeys, (leaf) => {
|
|
8960
|
+
found.push(leaf);
|
|
8961
|
+
return leaf.value;
|
|
8962
|
+
});
|
|
8963
|
+
return found;
|
|
8964
|
+
}
|
|
8965
|
+
/**
|
|
8966
|
+
* The keychain collection name a kind's secrets live under. Prefixed so a
|
|
8967
|
+
* record's refs never collide with the refs a legacy collection of the same name
|
|
8968
|
+
* already holds during an adoption.
|
|
8969
|
+
*/
|
|
8970
|
+
function recordSecretCollection(kind) {
|
|
8971
|
+
return `${RECORD_SECRET_COLLECTION_PREFIX}${kind}`;
|
|
8972
|
+
}
|
|
8973
|
+
/** The ONE ref a row's secret field may carry: the engine and the facade both build it here. */
|
|
8974
|
+
function recordSecretRef(owner, kind, rowId, concretePath) {
|
|
8975
|
+
return buildSecretRef({
|
|
8976
|
+
owner,
|
|
8977
|
+
scope: {
|
|
8978
|
+
kind: "row",
|
|
8979
|
+
collection: recordSecretCollection(kind),
|
|
8980
|
+
rowId
|
|
8981
|
+
},
|
|
8982
|
+
fieldPath: concretePath
|
|
8983
|
+
});
|
|
8984
|
+
}
|
|
8985
|
+
/**
|
|
8986
|
+
* A stored secret, as an admin read shows it: a VIEW naming the row's own
|
|
8987
|
+
* keychain ref (`set: true`), never the value and no longer the bare redaction
|
|
8988
|
+
* token. The form hands it to the secret field, which reveals the value by ref
|
|
8989
|
+
* through the audited `keychain-admin.reveal`; sent back untouched it keeps the
|
|
8990
|
+
* stored secret (the records door reads a view as KEEP).
|
|
8991
|
+
*
|
|
8992
|
+
* ONE implementation for the entries service and for every addon that serves
|
|
8993
|
+
* its own instances (`RecordIntegrationInstances`).
|
|
8994
|
+
*/
|
|
8995
|
+
function isRecord$3(value) {
|
|
8996
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
8997
|
+
}
|
|
8998
|
+
function secretViewsOf(owner, kind, id, decl, data) {
|
|
8999
|
+
if (decl.secretPaths.length === 0) return data;
|
|
9000
|
+
const shown = mapSecretLeaves(data, decl.secretPaths, decl.secretArrayKeys, (leaf) => {
|
|
9001
|
+
if (leaf.value !== "__camstack_redacted__") return leaf.value;
|
|
9002
|
+
return {
|
|
9003
|
+
$secret: recordSecretRef(owner, kind, id, leaf.concrete),
|
|
9004
|
+
v: 1,
|
|
9005
|
+
set: true
|
|
9006
|
+
};
|
|
9007
|
+
});
|
|
9008
|
+
return isRecord$3(shown) ? shown : data;
|
|
9009
|
+
}
|
|
8533
9010
|
/**
|
|
8534
9011
|
* The share-view scope kinds a share-link token can carry. The hub mints
|
|
8535
9012
|
* and validates them (`ShareViewGrantSchema` builds its
|
|
@@ -8602,7 +9079,8 @@ function isZodSecret(schema) {
|
|
|
8602
9079
|
}
|
|
8603
9080
|
/**
|
|
8604
9081
|
* Every declared secret path in a config schema: dotted keys, `[]` for "each
|
|
8605
|
-
* element of this array" (`connection.password`, `rows[].token`)
|
|
9082
|
+
* element of this array" (`connection.password`, `rows[].token`), `{}` for "each value of this
|
|
9083
|
+
* map" (`applianceSecrets{}`). A declared
|
|
8606
9084
|
* object or array is reported as one path and not descended into — everything
|
|
8607
9085
|
* under it is secret.
|
|
8608
9086
|
*/
|
|
@@ -8613,6 +9091,7 @@ function collectZodSecretPaths(schema, prefix = "") {
|
|
|
8613
9091
|
const def = defOf(layer);
|
|
8614
9092
|
if (def.type === "object" && def.shape) for (const [key, child] of Object.entries(def.shape)) paths.push(...collectZodSecretPaths(child, prefix ? `${prefix}.${key}` : key));
|
|
8615
9093
|
else if (def.type === "array" && def.element) paths.push(...collectZodSecretPaths(def.element, `${prefix}[]`));
|
|
9094
|
+
else if (def.type === "record" && def.valueType) paths.push(...collectZodSecretPaths(def.valueType, `${prefix}{}`));
|
|
8616
9095
|
else if (def.type === "union" && def.options) for (const option of def.options) paths.push(...collectZodSecretPaths(option, prefix));
|
|
8617
9096
|
else if (def.type === "intersection") {
|
|
8618
9097
|
if (def.left) paths.push(...collectZodSecretPaths(def.left, prefix));
|
|
@@ -8687,6 +9166,126 @@ var RecordKindDeclarationSchema = object({
|
|
|
8687
9166
|
}).strict();
|
|
8688
9167
|
/** The kind names: lower-case, dash separated, short enough for an index name. */
|
|
8689
9168
|
var RecordKindNameSchema = string().regex(/^[a-z][a-z0-9-]{0,47}$/);
|
|
9169
|
+
/** Cross-field rules a declaration must satisfy. Throws {@link DeclarationRefusedError}. */
|
|
9170
|
+
function assertValidDeclaration(name, decl) {
|
|
9171
|
+
const refuse = (why) => {
|
|
9172
|
+
throw new DeclarationRefusedError(`kind "${name}": ${why}`);
|
|
9173
|
+
};
|
|
9174
|
+
if (!RecordKindNameSchema.safeParse(name).success) refuse("the name must be lower-case-dashed");
|
|
9175
|
+
const seen = /* @__PURE__ */ new Set();
|
|
9176
|
+
for (const index of decl.indexes) {
|
|
9177
|
+
if (seen.has(index.name)) refuse(`index name "${index.name}" is declared twice`);
|
|
9178
|
+
seen.add(index.name);
|
|
9179
|
+
}
|
|
9180
|
+
const { retention } = decl;
|
|
9181
|
+
const hasSecrets = decl.secretPaths.length > 0;
|
|
9182
|
+
if ("ttlMs" in retention) {
|
|
9183
|
+
if (retention.from === "at" && decl.at !== "required") refuse("a ttl from \"at\" needs at: \"required\"");
|
|
9184
|
+
if (hasSecrets) refuse("a kind with secret fields cannot use engine TTL (its keychain values would be orphaned)");
|
|
9185
|
+
}
|
|
9186
|
+
if ("maxRows" in retention || "maxRowsPerDevice" in retention) {
|
|
9187
|
+
if (retention.maxRowsPerDevice !== void 0 && decl.device !== "required") refuse("maxRowsPerDevice needs device: \"required\"");
|
|
9188
|
+
if (decl.at !== "required") refuse("a row bound trims the oldest \"at\": it needs at: \"required\"");
|
|
9189
|
+
if (hasSecrets) refuse("a kind with secret fields cannot use an engine row bound");
|
|
9190
|
+
const bound = Math.max(retention.maxRows ?? 0, retention.maxRowsPerDevice ?? 0);
|
|
9191
|
+
if (decl.database === "settings" && bound > 5e4) refuse(`a row bound above ${RECORD_SETTINGS_MAX_ROWS} belongs in database: "events" (a big delete on the settings thread stalls every configuration read)`);
|
|
9192
|
+
}
|
|
9193
|
+
if (decl.deviceRemoval === "delete" && decl.device === "none") refuse("deviceRemoval: \"delete\" needs a device: \"required\" or \"optional\"");
|
|
9194
|
+
for (const path of decl.secretPaths) for (const prefix of secretArrayPrefixes(path)) if (decl.secretArrayKeys[prefix] === void 0) refuse(`secret path "${path}" crosses the array "${prefix}": declare its id key in secretArrayKeys`);
|
|
9195
|
+
}
|
|
9196
|
+
function bodyFieldsOf(schema) {
|
|
9197
|
+
return { ...toJSONSchema(schema, {
|
|
9198
|
+
unrepresentable: "any",
|
|
9199
|
+
io: "input"
|
|
9200
|
+
}) };
|
|
9201
|
+
}
|
|
9202
|
+
function isRecordLike(value) {
|
|
9203
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
9204
|
+
}
|
|
9205
|
+
/** Does every branch of the body schema carry `field`? (A discriminated union has several.) */
|
|
9206
|
+
function hasNameField(json, field) {
|
|
9207
|
+
const branches = json["oneOf"] ?? json["anyOf"];
|
|
9208
|
+
if (Array.isArray(branches)) return branches.length > 0 && branches.every((b) => isRecordLike(b) && hasNameField(b, field));
|
|
9209
|
+
const properties = json["properties"];
|
|
9210
|
+
return isRecordLike(properties) && Object.prototype.hasOwnProperty.call(properties, field);
|
|
9211
|
+
}
|
|
9212
|
+
/**
|
|
9213
|
+
* Declare the kinds of a package. The keys are the kind names. The result is
|
|
9214
|
+
* what `ctx.records.declare` sends to the engine and what `ctx.records.kind`
|
|
9215
|
+
* types its handle from.
|
|
9216
|
+
*/
|
|
9217
|
+
function defineRecordKinds(specs) {
|
|
9218
|
+
const out = {};
|
|
9219
|
+
for (const [name, spec] of Object.entries(specs)) {
|
|
9220
|
+
const secretPaths = collectZodSecretPaths(spec.schema);
|
|
9221
|
+
const nameField = spec.entry?.nameField ?? "name";
|
|
9222
|
+
const fields = bodyFieldsOf(spec.schema);
|
|
9223
|
+
if (spec.entry !== void 0 && !hasNameField(fields, nameField)) throw new DeclarationRefusedError(`kind "${name}": an entry kind's schema needs a "${nameField}" field`);
|
|
9224
|
+
const parsed = RecordKindDeclarationSchema.parse({
|
|
9225
|
+
database: spec.database,
|
|
9226
|
+
class: spec.class,
|
|
9227
|
+
writeTrigger: spec.writeTrigger,
|
|
9228
|
+
device: spec.device,
|
|
9229
|
+
at: spec.at,
|
|
9230
|
+
indexes: spec.indexes === void 0 ? void 0 : [...spec.indexes],
|
|
9231
|
+
retention: spec.retention,
|
|
9232
|
+
deviceRemoval: spec.deviceRemoval,
|
|
9233
|
+
maxDataBytes: spec.maxDataBytes,
|
|
9234
|
+
secretPaths: [...new Set([...secretPaths, ...spec.retiredSecretPaths ?? []])],
|
|
9235
|
+
secretArrayKeys: spec.secretArrayKeys === void 0 ? void 0 : { ...spec.secretArrayKeys },
|
|
9236
|
+
transactFamily: spec.transactFamily,
|
|
9237
|
+
entry: spec.entry === void 0 ? void 0 : {
|
|
9238
|
+
title: spec.entry.title,
|
|
9239
|
+
nameField,
|
|
9240
|
+
fields
|
|
9241
|
+
}
|
|
9242
|
+
});
|
|
9243
|
+
assertValidDeclaration(name, parsed);
|
|
9244
|
+
out[name] = {
|
|
9245
|
+
name,
|
|
9246
|
+
schema: spec.schema,
|
|
9247
|
+
declaration: parsed
|
|
9248
|
+
};
|
|
9249
|
+
}
|
|
9250
|
+
return out;
|
|
9251
|
+
}
|
|
9252
|
+
/**
|
|
9253
|
+
* Entry kinds (D881): every list of user-created entries (notification
|
|
9254
|
+
* targets, brokers, LLM profiles) is ONE record kind with an id, a name and a
|
|
9255
|
+
* kind-specific body, and the admin UI lists/adds/edits/deletes all of them
|
|
9256
|
+
* through the `record-entries` capability with password fields derived from
|
|
9257
|
+
* the schema (`.meta({ secret: true })`).
|
|
9258
|
+
*/
|
|
9259
|
+
/** The body of a plain entry: a name and the fields the kind adds. */
|
|
9260
|
+
function entryBody(shape) {
|
|
9261
|
+
return object({
|
|
9262
|
+
name: string().min(1),
|
|
9263
|
+
...shape
|
|
9264
|
+
});
|
|
9265
|
+
}
|
|
9266
|
+
/**
|
|
9267
|
+
* Declare one entry kind. An entry is configuration: never trimmed by the
|
|
9268
|
+
* engine, never aged, belonging to no device.
|
|
9269
|
+
*/
|
|
9270
|
+
function defineEntryKind(name, spec) {
|
|
9271
|
+
const defined = defineRecordKinds({ [name]: {
|
|
9272
|
+
schema: spec.schema,
|
|
9273
|
+
class: "config",
|
|
9274
|
+
writeTrigger: spec.writeTrigger ?? "an operator adds or edits an entry in the entries UI",
|
|
9275
|
+
retention: { none: "an entry goes only when the operator deletes it" },
|
|
9276
|
+
...spec.maxDataBytes === void 0 ? {} : { maxDataBytes: spec.maxDataBytes },
|
|
9277
|
+
...spec.database === void 0 ? {} : { database: spec.database },
|
|
9278
|
+
...spec.indexes === void 0 ? {} : { indexes: spec.indexes },
|
|
9279
|
+
...spec.secretArrayKeys === void 0 ? {} : { secretArrayKeys: spec.secretArrayKeys },
|
|
9280
|
+
...spec.retiredSecretPaths === void 0 ? {} : { retiredSecretPaths: spec.retiredSecretPaths },
|
|
9281
|
+
entry: {
|
|
9282
|
+
title: spec.title,
|
|
9283
|
+
...spec.nameField === void 0 ? {} : { nameField: spec.nameField }
|
|
9284
|
+
}
|
|
9285
|
+
} })[name];
|
|
9286
|
+
if (defined === void 0) throw new DeclarationRefusedError(`entry kind "${name}" was not built`);
|
|
9287
|
+
return defined;
|
|
9288
|
+
}
|
|
8690
9289
|
object({
|
|
8691
9290
|
field: string().min(1),
|
|
8692
9291
|
on: literal("advance")
|
|
@@ -9382,6 +9981,7 @@ var CAP_NAMES = Object.freeze([
|
|
|
9382
9981
|
"backup",
|
|
9383
9982
|
"battery",
|
|
9384
9983
|
"binary",
|
|
9984
|
+
"board-key-source",
|
|
9385
9985
|
"brightness",
|
|
9386
9986
|
"broker",
|
|
9387
9987
|
"button",
|
|
@@ -9503,6 +10103,7 @@ var CAP_NAMES = Object.freeze([
|
|
|
9503
10103
|
"privacy-mask",
|
|
9504
10104
|
"ptz",
|
|
9505
10105
|
"ptz-autotrack",
|
|
10106
|
+
"pump-cycle",
|
|
9506
10107
|
"reboot",
|
|
9507
10108
|
"record-entries",
|
|
9508
10109
|
"recording",
|
|
@@ -10795,18 +11396,6 @@ Object.freeze({
|
|
|
10795
11396
|
"path": "pumpRunning",
|
|
10796
11397
|
"valueType": "boolean"
|
|
10797
11398
|
},
|
|
10798
|
-
{
|
|
10799
|
-
"path": "pumpIntervalEnabled",
|
|
10800
|
-
"valueType": "boolean"
|
|
10801
|
-
},
|
|
10802
|
-
{
|
|
10803
|
-
"path": "pumpOnTime",
|
|
10804
|
-
"valueType": "number"
|
|
10805
|
-
},
|
|
10806
|
-
{
|
|
10807
|
-
"path": "pumpOffTime",
|
|
10808
|
-
"valueType": "number"
|
|
10809
|
-
},
|
|
10810
11399
|
{
|
|
10811
11400
|
"path": "lastDrink",
|
|
10812
11401
|
"valueType": "number"
|
|
@@ -10930,6 +11519,20 @@ Object.freeze({
|
|
|
10930
11519
|
"valueType": "number"
|
|
10931
11520
|
}
|
|
10932
11521
|
],
|
|
11522
|
+
"pump-cycle": [
|
|
11523
|
+
{
|
|
11524
|
+
"path": "enabled",
|
|
11525
|
+
"valueType": "boolean"
|
|
11526
|
+
},
|
|
11527
|
+
{
|
|
11528
|
+
"path": "onTime",
|
|
11529
|
+
"valueType": "number"
|
|
11530
|
+
},
|
|
11531
|
+
{
|
|
11532
|
+
"path": "offTime",
|
|
11533
|
+
"valueType": "number"
|
|
11534
|
+
}
|
|
11535
|
+
],
|
|
10933
11536
|
"recording-archive": [
|
|
10934
11537
|
{
|
|
10935
11538
|
"path": "deviceId",
|
|
@@ -11379,7 +11982,7 @@ object({
|
|
|
11379
11982
|
params: record(string(), union([string(), number()])).optional()
|
|
11380
11983
|
});
|
|
11381
11984
|
//#endregion
|
|
11382
|
-
//#region ../types/dist/composition-
|
|
11985
|
+
//#region ../types/dist/composition-CRNwcFYY.mjs
|
|
11383
11986
|
/**
|
|
11384
11987
|
* The ffmpeg build every CamStack node downloads, per platform and arch.
|
|
11385
11988
|
*
|
|
@@ -12142,38 +12745,6 @@ function validateExpressionSource(src) {
|
|
|
12142
12745
|
return null;
|
|
12143
12746
|
}
|
|
12144
12747
|
/**
|
|
12145
|
-
* One power reading becomes a washer, dryer or dishwasher (D944 helper).
|
|
12146
|
-
*
|
|
12147
|
-
* Standby of the control board is under 5 W; a motor or a heater is far
|
|
12148
|
-
* above that, so 5 W is the line. A door lock or a short pump spike is not
|
|
12149
|
-
* a cycle, so running starts only after 30 s above the line.
|
|
12150
|
-
*
|
|
12151
|
-
* A wash, dry or dishwasher pause (soak, heat-wait, heater off between
|
|
12152
|
-
* bursts) lasts several minutes. Ending the cycle on the first dip would
|
|
12153
|
-
* report "finished" in the middle of the program, so the stop dwell is
|
|
12154
|
-
* 10 minutes on every type. The number is stored per type so one machine
|
|
12155
|
-
* can move later without moving the others.
|
|
12156
|
-
*/
|
|
12157
|
-
var APPLIANCE_TEMPLATE_ID = "appliance";
|
|
12158
|
-
var APPLIANCE_KINDS = [
|
|
12159
|
-
"washer",
|
|
12160
|
-
"dryer",
|
|
12161
|
-
"dishwasher"
|
|
12162
|
-
];
|
|
12163
|
-
DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher;
|
|
12164
|
-
/**
|
|
12165
|
-
* A dumb plug-in stove or heater, built from a smart plug (a `Heater`).
|
|
12166
|
-
*
|
|
12167
|
-
* The plug is the actuator: `switch.setState` is a FORWARD to the plug's own
|
|
12168
|
-
* (D967), so the heater switches exactly as the plug does. Running is the
|
|
12169
|
-
* plug being on; when a power reading is also named, running is the draw
|
|
12170
|
-
* staying above the line instead (a plug left on with the stove's own
|
|
12171
|
-
* thermostat open is not heating). 50 W is far above any standby and below
|
|
12172
|
-
* the smallest radiator.
|
|
12173
|
-
*/
|
|
12174
|
-
var HEATER_TEMPLATE_ID = "heater";
|
|
12175
|
-
DeviceType.Heater;
|
|
12176
|
-
/**
|
|
12177
12748
|
* Statistics and integrals over a history read (D944).
|
|
12178
12749
|
*
|
|
12179
12750
|
* Pure: the same points always give the same answer, so a restart recomputes
|
|
@@ -12317,34 +12888,6 @@ var HelperSpecSchema = discriminatedUnion("kind", [
|
|
|
12317
12888
|
/** Actuator groups only. Readings leave this unset. */
|
|
12318
12889
|
active: ActiveCriterionSchema.optional()
|
|
12319
12890
|
}),
|
|
12320
|
-
object({
|
|
12321
|
-
kind: literal("appliance"),
|
|
12322
|
-
templateId: literal(APPLIANCE_TEMPLATE_ID),
|
|
12323
|
-
appliance: _enum(APPLIANCE_KINDS),
|
|
12324
|
-
thresholdWatts: number().positive(),
|
|
12325
|
-
startDwellMs: number().int().nonnegative(),
|
|
12326
|
-
stopDwellMs: number().int().nonnegative(),
|
|
12327
|
-
member: HelperMemberSchema,
|
|
12328
|
-
/**
|
|
12329
|
-
* The plug that powers the appliance (`switch.on`). Optional: when set, the
|
|
12330
|
-
* composition carries a `power-source` feature, so the hub can cut and restore
|
|
12331
|
-
* that plug (power-source link of a NEW-target composition).
|
|
12332
|
-
*/
|
|
12333
|
-
powerSwitch: HelperMemberSchema.optional(),
|
|
12334
|
-
/** How long a forced restart keeps the plug off; the cap's default when unset. */
|
|
12335
|
-
offSeconds: number().optional()
|
|
12336
|
-
}),
|
|
12337
|
-
object({
|
|
12338
|
-
kind: literal("heater"),
|
|
12339
|
-
templateId: literal(HEATER_TEMPLATE_ID),
|
|
12340
|
-
/** The plug, read and commanded at `switch.on`. */
|
|
12341
|
-
plug: HelperMemberSchema,
|
|
12342
|
-
/** The plug's power reading, when it has one: running is then the draw, not the switch. */
|
|
12343
|
-
meter: HelperMemberSchema.optional(),
|
|
12344
|
-
thresholdWatts: number().positive(),
|
|
12345
|
-
startDwellMs: number().int().nonnegative(),
|
|
12346
|
-
stopDwellMs: number().int().nonnegative()
|
|
12347
|
-
}),
|
|
12348
12891
|
object({
|
|
12349
12892
|
kind: literal("statistic"),
|
|
12350
12893
|
stat: _enum(STATISTIC_STATS),
|
|
@@ -12516,7 +13059,14 @@ var CompositionForwardCommandSchema = object({
|
|
|
12516
13059
|
method: string().min(1),
|
|
12517
13060
|
args: record(string().min(1), CompositionForwardArgSchema).optional()
|
|
12518
13061
|
});
|
|
12519
|
-
var CompositionCommandTargetSchema = discriminatedUnion("kind", [
|
|
13062
|
+
var CompositionCommandTargetSchema = discriminatedUnion("kind", [
|
|
13063
|
+
CompositionForwardCommandSchema,
|
|
13064
|
+
CompositionCodeSourceSchema,
|
|
13065
|
+
object({
|
|
13066
|
+
kind: literal("extension"),
|
|
13067
|
+
target: literal("remote")
|
|
13068
|
+
})
|
|
13069
|
+
]);
|
|
12520
13070
|
/** An item key inside an item-array cap (`consumables.items[<key>]`). */
|
|
12521
13071
|
var COMPOSITION_ITEM_KEY_RE = /^[a-z0-9][a-z0-9-]{0,47}$/;
|
|
12522
13072
|
/**
|
|
@@ -12561,7 +13111,7 @@ var CompositionSchema = object({
|
|
|
12561
13111
|
kind: literal("existing"),
|
|
12562
13112
|
device: CompositionSourceRefSchema
|
|
12563
13113
|
})]),
|
|
12564
|
-
features: array(CompositionFeatureSchema).min(
|
|
13114
|
+
features: array(CompositionFeatureSchema).min(0).max(16),
|
|
12565
13115
|
/**
|
|
12566
13116
|
* Present when the block is a helper template. Absent on a free
|
|
12567
13117
|
* composition (the room example, device 4603). The editor reads this,
|
|
@@ -12593,6 +13143,73 @@ var NodeColorIdSchema = _enum([
|
|
|
12593
13143
|
"node-g",
|
|
12594
13144
|
"node-h"
|
|
12595
13145
|
]);
|
|
13146
|
+
//#endregion
|
|
13147
|
+
//#region ../types/dist/index.mjs
|
|
13148
|
+
var SMTP_INBOUND_DEFAULT_PORT = 2525;
|
|
13149
|
+
var SMTP_INBOUND_DEFAULT_DOMAIN = "camstack.local";
|
|
13150
|
+
var SMTP_INBOUND_DEFAULT_MAX_MESSAGE_BYTES = 25 * 1024 * 1024;
|
|
13151
|
+
/** The text excerpt a message carries on the bus. */
|
|
13152
|
+
var SMTP_INBOUND_TEXT_MAX_CHARS = 4096;
|
|
13153
|
+
var PortSchema = number().int().min(1).max(65535);
|
|
13154
|
+
/** A recipient local-part: what stands before the `@`. */
|
|
13155
|
+
var SmtpRecipientSchema = string().min(1).max(64).regex(/^[A-Za-z0-9._+-]+$/);
|
|
13156
|
+
object({
|
|
13157
|
+
port: PortSchema.default(SMTP_INBOUND_DEFAULT_PORT),
|
|
13158
|
+
bindHost: string().min(1).default("0.0.0.0"),
|
|
13159
|
+
domain: string().min(1).default(SMTP_INBOUND_DEFAULT_DOMAIN),
|
|
13160
|
+
requireAuth: boolean().default(true),
|
|
13161
|
+
username: string().default(""),
|
|
13162
|
+
password: string().default("").meta({ secret: true }),
|
|
13163
|
+
starttls: boolean().default(false),
|
|
13164
|
+
maxMessageBytes: number().int().positive().default(SMTP_INBOUND_DEFAULT_MAX_MESSAGE_BYTES)
|
|
13165
|
+
});
|
|
13166
|
+
object({
|
|
13167
|
+
host: string().min(1).nullable(),
|
|
13168
|
+
hostReason: string().nullable(),
|
|
13169
|
+
port: PortSchema,
|
|
13170
|
+
domain: string().min(1),
|
|
13171
|
+
requireAuth: boolean(),
|
|
13172
|
+
username: string(),
|
|
13173
|
+
password: string(),
|
|
13174
|
+
starttls: boolean()
|
|
13175
|
+
});
|
|
13176
|
+
object({
|
|
13177
|
+
recipients: array(SmtpRecipientSchema).min(1),
|
|
13178
|
+
/**
|
|
13179
|
+
* Who is subscribing. A second `subscribe` with the same id REPLACES that subscriber's
|
|
13180
|
+
* recipients (the way a consumer that restarted, or lost a device, declares its set again);
|
|
13181
|
+
* a recipient held by another subscriber is refused with `smtp-inbound/recipient-claimed`.
|
|
13182
|
+
* Absent, the subscriber is anonymous and unique.
|
|
13183
|
+
*/
|
|
13184
|
+
subscriberId: string().min(1).max(64).optional()
|
|
13185
|
+
});
|
|
13186
|
+
var SmtpInboundAttachmentSchema = object({
|
|
13187
|
+
filename: string(),
|
|
13188
|
+
contentType: string(),
|
|
13189
|
+
bytes: number().int().nonnegative()
|
|
13190
|
+
});
|
|
13191
|
+
/** The payload of one `broker.message` (the key is the recipient local-part). */
|
|
13192
|
+
var SmtpInboundMessageSchema = object({
|
|
13193
|
+
/** Monotonic per mailbox; a gap tells a consumer it missed an event. */
|
|
13194
|
+
seq: number().int().positive(),
|
|
13195
|
+
messageId: string(),
|
|
13196
|
+
receivedAt: number().int().nonnegative(),
|
|
13197
|
+
from: string(),
|
|
13198
|
+
to: string(),
|
|
13199
|
+
subject: string(),
|
|
13200
|
+
text: string().max(SMTP_INBOUND_TEXT_MAX_CHARS),
|
|
13201
|
+
attachments: array(SmtpInboundAttachmentSchema)
|
|
13202
|
+
});
|
|
13203
|
+
object({
|
|
13204
|
+
/** The newest seq issued so far (0 before any mail). */
|
|
13205
|
+
lastSeq: number().int().nonnegative(),
|
|
13206
|
+
/** The oldest seq still retained; messages below it are gone. */
|
|
13207
|
+
oldestSeq: number().int().nonnegative(),
|
|
13208
|
+
messages: array(object({
|
|
13209
|
+
key: string(),
|
|
13210
|
+
message: SmtpInboundMessageSchema
|
|
13211
|
+
}))
|
|
13212
|
+
});
|
|
12596
13213
|
new Set([
|
|
12597
13214
|
"track",
|
|
12598
13215
|
"face",
|
|
@@ -12712,6 +13329,205 @@ var IntegrationInstanceRefSchema = object({
|
|
|
12712
13329
|
]),
|
|
12713
13330
|
candidateStableId: string().optional()
|
|
12714
13331
|
});
|
|
13332
|
+
/**
|
|
13333
|
+
* `RecordIntegrationInstances` - the `integration-instances` provider over ONE
|
|
13334
|
+
* entry kind, so an addon that holds a connection serves it in ~30 lines.
|
|
13335
|
+
*
|
|
13336
|
+
* Every instance is one record of the addon's own kind, keyed by the
|
|
13337
|
+
* `integrations` registry id. The records door does the secret work: a field the
|
|
13338
|
+
* kind marks `.meta({ secret: true })` is a keychain marker bound to the row, so
|
|
13339
|
+
* deleting the row deletes the secret, and one row's value is never another's.
|
|
13340
|
+
*
|
|
13341
|
+
* Patch rules for a secret (`updateInstance`): omitted, `''`, the redaction
|
|
13342
|
+
* token or the view the form was given KEEP the stored secret;
|
|
13343
|
+
* `{ $secretClear: true }` clears it; any other string replaces it.
|
|
13344
|
+
*/
|
|
13345
|
+
/** The most instances one addon lists (an integrations page, not a table). */
|
|
13346
|
+
var INSTANCES_LIST_MAX = 1e3;
|
|
13347
|
+
/** The keys of the kind's secret fields that sit at the top level of the body. */
|
|
13348
|
+
function topLevelSecretKeys(paths) {
|
|
13349
|
+
return new Set(paths.filter((p) => !p.includes(".") && !p.includes("[") && !p.includes("{")));
|
|
13350
|
+
}
|
|
13351
|
+
/** The keys of the kind's top-level MAPS whose values are secrets (`applianceSecrets{}`). */
|
|
13352
|
+
function secretMapKeys(paths) {
|
|
13353
|
+
return new Set(paths.filter((p) => p.endsWith("{}") && !p.slice(0, -2).match(/[.[{]/)).map((p) => p.slice(0, -2)));
|
|
13354
|
+
}
|
|
13355
|
+
/**
|
|
13356
|
+
* A patch value for a map of secrets: an entry that is omitted, `''`, the redaction token or the
|
|
13357
|
+
* view the form was given KEEPS its stored secret (it is left out of the merge); `{ $secretClear }`
|
|
13358
|
+
* or `null` removes the entry; any other string replaces it. Null when nothing is left to merge.
|
|
13359
|
+
*/
|
|
13360
|
+
function secretMapPatch(value) {
|
|
13361
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) return null;
|
|
13362
|
+
const out = {};
|
|
13363
|
+
for (const [key, entry] of Object.entries(value)) if (entry === null || isSecretClear(entry)) out[key] = null;
|
|
13364
|
+
else if (typeof entry === "string" && entry !== "" && entry !== "__camstack_redacted__" && !isSecretFieldView(entry)) out[key] = entry;
|
|
13365
|
+
return Object.keys(out).length > 0 ? out : null;
|
|
13366
|
+
}
|
|
13367
|
+
/** Does the kind's body schema carry an `enabled` field? */
|
|
13368
|
+
function declaresEnabled(kind) {
|
|
13369
|
+
const json = toJSONSchema(kind.schema, {
|
|
13370
|
+
unrepresentable: "any",
|
|
13371
|
+
io: "input"
|
|
13372
|
+
});
|
|
13373
|
+
const properties = Reflect.get(json, "properties");
|
|
13374
|
+
return typeof properties === "object" && properties !== null && "enabled" in properties;
|
|
13375
|
+
}
|
|
13376
|
+
var RecordIntegrationInstances = class {
|
|
13377
|
+
records;
|
|
13378
|
+
kind;
|
|
13379
|
+
hooks;
|
|
13380
|
+
handle;
|
|
13381
|
+
secretKeys;
|
|
13382
|
+
secretMaps;
|
|
13383
|
+
nameField;
|
|
13384
|
+
/** The `integrations` registry owns the on/off switch (`role: devices`); the body has none. */
|
|
13385
|
+
registryOwnsEnabled;
|
|
13386
|
+
constructor(records, kind, hooks) {
|
|
13387
|
+
this.records = records;
|
|
13388
|
+
this.kind = kind;
|
|
13389
|
+
this.hooks = hooks;
|
|
13390
|
+
this.handle = records.kind(kind);
|
|
13391
|
+
this.secretKeys = topLevelSecretKeys(kind.declaration.secretPaths);
|
|
13392
|
+
this.secretMaps = secretMapKeys(kind.declaration.secretPaths);
|
|
13393
|
+
this.nameField = kind.declaration.entry?.nameField ?? "name";
|
|
13394
|
+
this.registryOwnsEnabled = hooks.description.role === "devices";
|
|
13395
|
+
if (this.registryOwnsEnabled && declaresEnabled(kind)) throw new Error(`kind "${kind.name}": the integrations registry owns the on/off switch of a role "devices" addon, so the body must not declare "enabled"`);
|
|
13396
|
+
}
|
|
13397
|
+
/**
|
|
13398
|
+
* One instance read for the addon's own runtime; null when absent. When the keychain is
|
|
13399
|
+
* locked the row is served WITHOUT its secrets and says so (`secrets: 'unavailable'`), so the
|
|
13400
|
+
* caller can keep what it had instead of reconfiguring with an empty secret (D49).
|
|
13401
|
+
*/
|
|
13402
|
+
async readResolved(id) {
|
|
13403
|
+
try {
|
|
13404
|
+
const record = await this.handle.getResolved(id);
|
|
13405
|
+
return record === null ? null : {
|
|
13406
|
+
id,
|
|
13407
|
+
body: record.data,
|
|
13408
|
+
enabled: record.data.enabled !== false,
|
|
13409
|
+
secrets: "resolved"
|
|
13410
|
+
};
|
|
13411
|
+
} catch (err) {
|
|
13412
|
+
if (!(err instanceof RecordSecretUnavailableError)) throw err;
|
|
13413
|
+
const stored = await this.handle.get(id);
|
|
13414
|
+
if (stored === null) return null;
|
|
13415
|
+
return {
|
|
13416
|
+
id,
|
|
13417
|
+
body: Object.fromEntries(Object.entries(stored.data).filter(([key]) => !this.secretKeys.has(key))),
|
|
13418
|
+
enabled: stored.data.enabled !== false,
|
|
13419
|
+
secrets: "unavailable"
|
|
13420
|
+
};
|
|
13421
|
+
}
|
|
13422
|
+
}
|
|
13423
|
+
/** The body of {@link readResolved} alone; a locked keychain yields the row without secrets. */
|
|
13424
|
+
async getResolved(id) {
|
|
13425
|
+
return (await this.readResolved(id))?.body ?? null;
|
|
13426
|
+
}
|
|
13427
|
+
/** Every instance, secrets resolved where the keychain allows; an absent one is skipped. */
|
|
13428
|
+
async listResolved() {
|
|
13429
|
+
const page = await this.handle.query({ limit: INSTANCES_LIST_MAX });
|
|
13430
|
+
const out = [];
|
|
13431
|
+
for (const record of page.records) {
|
|
13432
|
+
const read = await this.readResolved(record.id);
|
|
13433
|
+
if (read !== null) out.push(read);
|
|
13434
|
+
}
|
|
13435
|
+
return out;
|
|
13436
|
+
}
|
|
13437
|
+
viewOf(record) {
|
|
13438
|
+
const shown = secretViewsOf(this.records.owner, this.kind.name, record.id, this.kind.declaration, record.data);
|
|
13439
|
+
const rawName = record.data[this.nameField];
|
|
13440
|
+
const kind = this.hooks.kindOf?.(record.data);
|
|
13441
|
+
const health = this.hooks.health?.(record.data, record.id);
|
|
13442
|
+
return {
|
|
13443
|
+
id: record.id,
|
|
13444
|
+
name: typeof rawName === "string" ? rawName : record.id,
|
|
13445
|
+
configured: this.hooks.configured(record.data),
|
|
13446
|
+
...this.registryOwnsEnabled ? {} : { enabled: record.data.enabled !== false },
|
|
13447
|
+
formValues: shown,
|
|
13448
|
+
...kind !== void 0 ? { kind } : {},
|
|
13449
|
+
...health?.status !== void 0 ? { status: health.status } : {},
|
|
13450
|
+
...health?.lastCheckedAt !== void 0 ? { lastCheckedAt: health.lastCheckedAt } : {}
|
|
13451
|
+
};
|
|
13452
|
+
}
|
|
13453
|
+
describe = async () => this.hooks.mintId === void 0 ? this.hooks.description : {
|
|
13454
|
+
...this.hooks.description,
|
|
13455
|
+
mintsId: true
|
|
13456
|
+
};
|
|
13457
|
+
instanceFormSchema = async ({ id }) => this.hooks.formSchema(id);
|
|
13458
|
+
listInstances = async () => {
|
|
13459
|
+
return (await this.handle.query({ limit: INSTANCES_LIST_MAX })).records.map((record) => this.viewOf(record));
|
|
13460
|
+
};
|
|
13461
|
+
getInstance = async ({ id }) => {
|
|
13462
|
+
const record = await this.handle.get(id);
|
|
13463
|
+
return record === null ? null : this.viewOf(record);
|
|
13464
|
+
};
|
|
13465
|
+
/** Insert ONE row (`ifRev: 0`: an existing id is refused, never overwritten). */
|
|
13466
|
+
createInstance = async ({ id, name, kind }) => {
|
|
13467
|
+
const minted = id ?? this.hooks.mintId?.({
|
|
13468
|
+
name,
|
|
13469
|
+
...kind !== void 0 ? { kind } : {}
|
|
13470
|
+
});
|
|
13471
|
+
if (minted === void 0) throw new Error("createInstance needs an id: this provider does not mint one");
|
|
13472
|
+
await this.handle.put({
|
|
13473
|
+
id: minted,
|
|
13474
|
+
data: this.hooks.initialBody(name, kind)
|
|
13475
|
+
}, { ifRev: 0 });
|
|
13476
|
+
await this.hooks.onChanged?.(minted, "created");
|
|
13477
|
+
return { id: minted };
|
|
13478
|
+
};
|
|
13479
|
+
updateInstance = async ({ id, name, values }) => {
|
|
13480
|
+
const patch = {};
|
|
13481
|
+
for (const [key, value] of Object.entries(values)) {
|
|
13482
|
+
if (value === void 0) continue;
|
|
13483
|
+
if (this.secretMaps.has(key)) {
|
|
13484
|
+
const entries = secretMapPatch(value);
|
|
13485
|
+
if (entries !== null) patch[key] = entries;
|
|
13486
|
+
} else if (!this.secretKeys.has(key)) patch[key] = value;
|
|
13487
|
+
else if (isSecretClear(value)) patch[key] = null;
|
|
13488
|
+
else if (typeof value === "string" && value !== "" && value !== "__camstack_redacted__" && !isSecretFieldView(value)) patch[key] = value;
|
|
13489
|
+
}
|
|
13490
|
+
if (name !== void 0) patch[this.nameField] = name;
|
|
13491
|
+
await this.handle.patch(id, patch);
|
|
13492
|
+
await this.hooks.onChanged?.(id, "updated");
|
|
13493
|
+
return { ok: true };
|
|
13494
|
+
};
|
|
13495
|
+
/** The switch lives in the record body; the addon is told so it applies it (D996). */
|
|
13496
|
+
setInstanceEnabled = async ({ id, enabled }) => {
|
|
13497
|
+
if (this.registryOwnsEnabled) throw new Error(`instance "${id}": the integrations registry owns the on/off switch of this addon; set it with integrations.update`);
|
|
13498
|
+
await this.handle.patch(id, { enabled });
|
|
13499
|
+
await this.hooks.onChanged?.(id, "enabled");
|
|
13500
|
+
return { ok: true };
|
|
13501
|
+
};
|
|
13502
|
+
/** The row and its keychain refs go together (the records door). */
|
|
13503
|
+
deleteInstance = async ({ id }) => {
|
|
13504
|
+
await this.handle.delete(id);
|
|
13505
|
+
await this.hooks.onChanged?.(id, "deleted");
|
|
13506
|
+
return { ok: true };
|
|
13507
|
+
};
|
|
13508
|
+
testInstance = async (input) => {
|
|
13509
|
+
if (this.hooks.test === void 0) return {
|
|
13510
|
+
success: false,
|
|
13511
|
+
status: "unsupported",
|
|
13512
|
+
error: "This integration declares no connection test"
|
|
13513
|
+
};
|
|
13514
|
+
return this.hooks.test(input);
|
|
13515
|
+
};
|
|
13516
|
+
/** The flat provider object to hand to `registerProvider`. */
|
|
13517
|
+
toProvider() {
|
|
13518
|
+
return {
|
|
13519
|
+
describe: this.describe,
|
|
13520
|
+
instanceFormSchema: this.instanceFormSchema,
|
|
13521
|
+
listInstances: this.listInstances,
|
|
13522
|
+
getInstance: this.getInstance,
|
|
13523
|
+
createInstance: this.createInstance,
|
|
13524
|
+
updateInstance: this.updateInstance,
|
|
13525
|
+
setInstanceEnabled: this.setInstanceEnabled,
|
|
13526
|
+
deleteInstance: this.deleteInstance,
|
|
13527
|
+
testInstance: this.testInstance
|
|
13528
|
+
};
|
|
13529
|
+
}
|
|
13530
|
+
};
|
|
12715
13531
|
var EncodeProfileSchema = object({
|
|
12716
13532
|
video: object({
|
|
12717
13533
|
codec: _enum([
|
|
@@ -13747,7 +14563,13 @@ var MigrationLedgerEntrySchema = object({
|
|
|
13747
14563
|
* joined by the engine from the catalogues it knows this boot. Absent when no
|
|
13748
14564
|
* catalogue lists the id (a newer database).
|
|
13749
14565
|
*/
|
|
13750
|
-
meta: MigrationMetaSchema.optional()
|
|
14566
|
+
meta: MigrationMetaSchema.optional(),
|
|
14567
|
+
/**
|
|
14568
|
+
* Set when this is an applied row of an addon owner whose catalogue the answering
|
|
14569
|
+
* process has not loaded (the owner has not declared yet): the row is applied, the
|
|
14570
|
+
* process just cannot judge it. Never `skipped-newer` — that needs the owner loaded.
|
|
14571
|
+
*/
|
|
14572
|
+
ownerNotLoaded: boolean().optional()
|
|
13751
14573
|
});
|
|
13752
14574
|
/** A catalogued migration that is not applied, with where it stands. */
|
|
13753
14575
|
var MigrationPendingEntrySchema = object({
|
|
@@ -13781,6 +14603,149 @@ var MigrationOwnerStepSchema = object({
|
|
|
13781
14603
|
state: union([literal("pending"), MigrationStatusSchema])
|
|
13782
14604
|
});
|
|
13783
14605
|
/**
|
|
14606
|
+
* Move an integration's legacy `integration_settings` rows into a typed record of the addon's own
|
|
14607
|
+
* kind (planning#416, the one store). The record is keyed by the `integrations` registry id, so
|
|
14608
|
+
* the integration id, the devices stamped with it and the automations that name it do not change.
|
|
14609
|
+
*
|
|
14610
|
+
* Order, so a crash or a locked keychain is safe at every point:
|
|
14611
|
+
*
|
|
14612
|
+
* 1. Phase A, read only: every row of every integration of the addon is read with its secrets
|
|
14613
|
+
* resolved. One that cannot be read (a locked keychain) throws, naming the integration, before
|
|
14614
|
+
* anything is written; `block-owner` then holds the addon.
|
|
14615
|
+
* 2. Phase B, per integration: the addon's `bodyFrom` builds the body; the record is put with
|
|
14616
|
+
* `ifRev: 0` (an existing record is never overwritten). A record this pass CREATED is read back
|
|
14617
|
+
* and every secret leaf must equal what the rows held, else the record is deleted and the pass
|
|
14618
|
+
* throws; an EXISTING record must hold every secret the rows carry, else the rows are kept and
|
|
14619
|
+
* a warning names the path. Only then are the rows (and their keychain values) cleared.
|
|
14620
|
+
*
|
|
14621
|
+
* Idempotent: an integration whose rows are gone and whose record exists is skipped, so a rerun is
|
|
14622
|
+
* a no-op. A default integration with no rows still gets its record (an empty body, D985).
|
|
14623
|
+
* Never logs or throws a secret value; messages name integration ids and secret PATHS only.
|
|
14624
|
+
*/
|
|
14625
|
+
function secretLeavesOf(body, spec) {
|
|
14626
|
+
const out = /* @__PURE__ */ new Map();
|
|
14627
|
+
for (const leaf of collectSecretLeaves(body, spec.secretPaths, spec.secretArrayKeys ?? {})) if (typeof leaf.value === "string" && leaf.value.length > 0) out.set(leaf.concrete, leaf.value);
|
|
14628
|
+
return out;
|
|
14629
|
+
}
|
|
14630
|
+
function why(err) {
|
|
14631
|
+
return err instanceof Error ? err.message : String(err);
|
|
14632
|
+
}
|
|
14633
|
+
async function moveIntegrationRowsToRecords(ports, spec) {
|
|
14634
|
+
const integrations = await ports.listIntegrations(spec.addonId);
|
|
14635
|
+
if (integrations.length === 0) return {
|
|
14636
|
+
outcome: "already-done",
|
|
14637
|
+
summary: { integrations: 0 }
|
|
14638
|
+
};
|
|
14639
|
+
const rowsOf = /* @__PURE__ */ new Map();
|
|
14640
|
+
for (const integration of integrations) try {
|
|
14641
|
+
rowsOf.set(integration.id, await ports.readRows(integration.id));
|
|
14642
|
+
} catch (err) {
|
|
14643
|
+
throw new Error(`integration '${integration.id}': the legacy settings cannot be read with their secrets (${why(err)}) - nothing moved`, { cause: err });
|
|
14644
|
+
}
|
|
14645
|
+
let created = 0;
|
|
14646
|
+
let cleared = 0;
|
|
14647
|
+
let kept = 0;
|
|
14648
|
+
for (const integration of integrations) {
|
|
14649
|
+
const values = rowsOf.get(integration.id) ?? {};
|
|
14650
|
+
const hasRows = Object.keys(values).length > 0;
|
|
14651
|
+
const body = spec.bodyFrom(values, ports, integration);
|
|
14652
|
+
const put = await ports.putRecord(integration.id, body);
|
|
14653
|
+
if (put === "created") created += 1;
|
|
14654
|
+
if (!hasRows) continue;
|
|
14655
|
+
const wanted = secretLeavesOf(body, spec);
|
|
14656
|
+
const back = await ports.readRecord(integration.id);
|
|
14657
|
+
if (back === null) throw new Error(`integration '${integration.id}': the record is gone after it was put`);
|
|
14658
|
+
const held = secretLeavesOf(back, spec);
|
|
14659
|
+
if (put === "created") {
|
|
14660
|
+
const wrong = [...wanted].filter(([path, value]) => held.get(path) !== value).map(([p]) => p);
|
|
14661
|
+
if (wrong.length > 0) {
|
|
14662
|
+
await ports.deleteRecord(integration.id);
|
|
14663
|
+
throw new Error(`integration '${integration.id}': ${wrong.join(", ")} did not read back from the record - the record was removed and the legacy settings are kept`);
|
|
14664
|
+
}
|
|
14665
|
+
} else {
|
|
14666
|
+
const missing = [...wanted].filter(([path]) => !held.has(path)).map(([p]) => p);
|
|
14667
|
+
if (missing.length > 0) {
|
|
14668
|
+
ports.warn(`integration '${integration.id}': the existing record holds no ${missing.join(", ")}; the legacy settings are kept, not cleared`);
|
|
14669
|
+
kept += 1;
|
|
14670
|
+
continue;
|
|
14671
|
+
}
|
|
14672
|
+
}
|
|
14673
|
+
await ports.clearRows(integration.id);
|
|
14674
|
+
cleared += 1;
|
|
14675
|
+
}
|
|
14676
|
+
return created === 0 && cleared === 0 ? {
|
|
14677
|
+
outcome: "already-done",
|
|
14678
|
+
summary: {
|
|
14679
|
+
integrations: integrations.length,
|
|
14680
|
+
kept
|
|
14681
|
+
}
|
|
14682
|
+
} : {
|
|
14683
|
+
outcome: "done",
|
|
14684
|
+
summary: {
|
|
14685
|
+
integrations: integrations.length,
|
|
14686
|
+
created,
|
|
14687
|
+
cleared,
|
|
14688
|
+
kept
|
|
14689
|
+
}
|
|
14690
|
+
};
|
|
14691
|
+
}
|
|
14692
|
+
/**
|
|
14693
|
+
* The addon-side ports of `moveIntegrationRowsToRecords` (planning#416): an addon runs the move
|
|
14694
|
+
* from its own process, so the legacy rows are reached through the hub (`ctx.api.integrations`:
|
|
14695
|
+
* `list`, `getSettings` - which answers the OWNER its secrets resolved - and `clearSettings`) and
|
|
14696
|
+
* the new record through the addon's own records handle. The hub deletes the rows and their
|
|
14697
|
+
* keychain values; the addon never touches the registry.
|
|
14698
|
+
*/
|
|
14699
|
+
function integrationRowsPortsOverApi(deps) {
|
|
14700
|
+
return {
|
|
14701
|
+
warn: (message) => deps.log.warn(message),
|
|
14702
|
+
listIntegrations: async (addonId) => (await deps.api.list()).filter((i) => i.addonId === addonId).map((i) => ({
|
|
14703
|
+
id: i.id,
|
|
14704
|
+
name: i.name
|
|
14705
|
+
})),
|
|
14706
|
+
readRows: (integrationId) => deps.api.getSettings({ id: integrationId }),
|
|
14707
|
+
putRecord: async (id, body) => {
|
|
14708
|
+
if (await deps.records.get(id) !== null) return "exists";
|
|
14709
|
+
try {
|
|
14710
|
+
await deps.records.put({
|
|
14711
|
+
id,
|
|
14712
|
+
data: body
|
|
14713
|
+
}, { ifRev: 0 });
|
|
14714
|
+
} catch (err) {
|
|
14715
|
+
if (err instanceof RevConflictError) return "exists";
|
|
14716
|
+
throw err;
|
|
14717
|
+
}
|
|
14718
|
+
return "created";
|
|
14719
|
+
},
|
|
14720
|
+
readRecord: async (id) => (await deps.records.getResolved(id))?.data ?? null,
|
|
14721
|
+
deleteRecord: async (id) => {
|
|
14722
|
+
await deps.records.delete(id);
|
|
14723
|
+
},
|
|
14724
|
+
clearRows: async (integrationId) => {
|
|
14725
|
+
await deps.api.clearSettings({ id: integrationId });
|
|
14726
|
+
}
|
|
14727
|
+
};
|
|
14728
|
+
}
|
|
14729
|
+
function defaultIntegrationApiOver(api) {
|
|
14730
|
+
return {
|
|
14731
|
+
list: () => api.integrations.list.query(),
|
|
14732
|
+
getSettings: (input) => api.integrations.getSettings.query(input),
|
|
14733
|
+
clearSettings: (input) => api.integrations.clearSettings.mutate(input),
|
|
14734
|
+
listDevices: (addonId) => api.deviceManager.listAll.query({
|
|
14735
|
+
addonId,
|
|
14736
|
+
projection: "slim"
|
|
14737
|
+
}),
|
|
14738
|
+
setDeviceIntegrationId: async (deviceId, integrationId) => {
|
|
14739
|
+
await api.deviceManager.setIntegrationId.mutate({
|
|
14740
|
+
deviceId,
|
|
14741
|
+
integrationId
|
|
14742
|
+
});
|
|
14743
|
+
},
|
|
14744
|
+
readDeviceHasConfig: async (deviceId) => Object.keys((await api.deviceManager.getDevice.query({ deviceId }))?.config ?? {}).length > 0,
|
|
14745
|
+
readDeviceIntegrationId: async (deviceId) => (await api.deviceManager.getDevice.query({ deviceId }))?.integrationId ?? null
|
|
14746
|
+
};
|
|
14747
|
+
}
|
|
14748
|
+
/**
|
|
13784
14749
|
* The trainer contract — what the hub hands the cloud trainer and what it
|
|
13785
14750
|
* gets back (cloud training, D805+).
|
|
13786
14751
|
*
|
|
@@ -18865,24 +19830,52 @@ var APPLIANCE_CAP_VOCABULARY = {
|
|
|
18865
19830
|
args: { on: false }
|
|
18866
19831
|
},
|
|
18867
19832
|
{
|
|
18868
|
-
id: "petFountain.
|
|
18869
|
-
method: "
|
|
19833
|
+
id: "petFountain.resetDailyConsumption",
|
|
19834
|
+
method: "resetDailyConsumption",
|
|
19835
|
+
label: t("Clear daily consumption", "Azzera il consumo giornaliero"),
|
|
19836
|
+
phrase: t("Clear the daily water consumption of {device}", "Azzera il consumo giornaliero di acqua di {device}"),
|
|
19837
|
+
icon: "rotate-ccw"
|
|
19838
|
+
}
|
|
19839
|
+
],
|
|
19840
|
+
state: [{
|
|
19841
|
+
kind: "boolean",
|
|
19842
|
+
field: "empty",
|
|
19843
|
+
label: t("Tank empty", "Serbatoio vuoto"),
|
|
19844
|
+
whenTrue: t("When the tank of {device} is empty", "Quando il serbatoio di {device} è vuoto"),
|
|
19845
|
+
whenFalse: t("When the tank of {device} is refilled", "Quando il serbatoio di {device} viene riempito"),
|
|
19846
|
+
icon: "droplet"
|
|
19847
|
+
}, {
|
|
19848
|
+
kind: "numeric",
|
|
19849
|
+
field: "waterLevel",
|
|
19850
|
+
quantity: t("the water level", "il livello dell’acqua"),
|
|
19851
|
+
label: t("Water level", "Livello dell’acqua"),
|
|
19852
|
+
unit: "%",
|
|
19853
|
+
icon: "droplets"
|
|
19854
|
+
}]
|
|
19855
|
+
},
|
|
19856
|
+
"pump-cycle": {
|
|
19857
|
+
scope: "device",
|
|
19858
|
+
noun: t("Pump cycle", "Ciclo della pompa"),
|
|
19859
|
+
actions: [
|
|
19860
|
+
{
|
|
19861
|
+
id: "pumpCycle.on",
|
|
19862
|
+
method: "setEnabled",
|
|
18870
19863
|
label: t("Pump cycle on", "Ciclo pompa attivo"),
|
|
18871
19864
|
phrase: t("Run the pump of {device} on its on/off cycle", "Fai lavorare la pompa di {device} a ciclo acceso/spento"),
|
|
18872
19865
|
icon: "timer",
|
|
18873
19866
|
args: { on: true }
|
|
18874
19867
|
},
|
|
18875
19868
|
{
|
|
18876
|
-
id: "
|
|
18877
|
-
method: "
|
|
19869
|
+
id: "pumpCycle.off",
|
|
19870
|
+
method: "setEnabled",
|
|
18878
19871
|
label: t("Pump cycle off", "Ciclo pompa spento"),
|
|
18879
19872
|
phrase: t("Run the pump of {device} continuously", "Fai lavorare la pompa di {device} in continuo"),
|
|
18880
19873
|
icon: "timer-off",
|
|
18881
19874
|
args: { on: false }
|
|
18882
19875
|
},
|
|
18883
19876
|
{
|
|
18884
|
-
id: "
|
|
18885
|
-
method: "
|
|
19877
|
+
id: "pumpCycle.onMinutes",
|
|
19878
|
+
method: "setOnMinutes",
|
|
18886
19879
|
label: t("Set pump run time", "Imposta il tempo di lavoro della pompa"),
|
|
18887
19880
|
phrase: t("Set the pump of {device} to run {minutes} minutes per cycle", "Imposta la pompa di {device} a lavorare {minutes} minuti per ciclo"),
|
|
18888
19881
|
icon: "timer",
|
|
@@ -18898,8 +19891,8 @@ var APPLIANCE_CAP_VOCABULARY = {
|
|
|
18898
19891
|
}]
|
|
18899
19892
|
},
|
|
18900
19893
|
{
|
|
18901
|
-
id: "
|
|
18902
|
-
method: "
|
|
19894
|
+
id: "pumpCycle.offMinutes",
|
|
19895
|
+
method: "setOffMinutes",
|
|
18903
19896
|
label: t("Set pump rest time", "Imposta il tempo di riposo della pompa"),
|
|
18904
19897
|
phrase: t("Set the pump of {device} to rest {minutes} minutes per cycle", "Imposta la pompa di {device} a riposare {minutes} minuti per ciclo"),
|
|
18905
19898
|
icon: "timer-off",
|
|
@@ -18913,35 +19906,63 @@ var APPLIANCE_CAP_VOCABULARY = {
|
|
|
18913
19906
|
unit: "min"
|
|
18914
19907
|
}
|
|
18915
19908
|
}]
|
|
18916
|
-
},
|
|
18917
|
-
{
|
|
18918
|
-
id: "petFountain.resetDailyConsumption",
|
|
18919
|
-
method: "resetDailyConsumption",
|
|
18920
|
-
label: t("Clear daily consumption", "Azzera il consumo giornaliero"),
|
|
18921
|
-
phrase: t("Clear the daily water consumption of {device}", "Azzera il consumo giornaliero di acqua di {device}"),
|
|
18922
|
-
icon: "rotate-ccw"
|
|
18923
19909
|
}
|
|
18924
19910
|
],
|
|
18925
19911
|
state: [{
|
|
18926
19912
|
kind: "boolean",
|
|
18927
|
-
field: "
|
|
18928
|
-
label: t("
|
|
18929
|
-
whenTrue: t("When
|
|
18930
|
-
whenFalse: t("When
|
|
18931
|
-
icon: "
|
|
18932
|
-
}, {
|
|
18933
|
-
kind: "numeric",
|
|
18934
|
-
field: "waterLevel",
|
|
18935
|
-
quantity: t("the water level", "il livello dell’acqua"),
|
|
18936
|
-
label: t("Water level", "Livello dell’acqua"),
|
|
18937
|
-
unit: "%",
|
|
18938
|
-
icon: "droplets"
|
|
19913
|
+
field: "enabled",
|
|
19914
|
+
label: t("Pump cycle", "Ciclo pompa"),
|
|
19915
|
+
whenTrue: t("When {device} starts running its pump on a cycle", "Quando {device} inizia a far lavorare la pompa a ciclo"),
|
|
19916
|
+
whenFalse: t("When {device} runs its pump continuously", "Quando {device} fa lavorare la pompa in continuo"),
|
|
19917
|
+
icon: "timer"
|
|
18939
19918
|
}]
|
|
18940
19919
|
},
|
|
18941
19920
|
"media-player": {
|
|
18942
19921
|
scope: "device",
|
|
18943
19922
|
noun: t("Media player", "Lettore multimediale"),
|
|
18944
19923
|
actions: [
|
|
19924
|
+
{
|
|
19925
|
+
id: "media.turnOn",
|
|
19926
|
+
method: "turnOn",
|
|
19927
|
+
label: t("Turn on", "Accendi"),
|
|
19928
|
+
phrase: t("Turn on {device}", "Accendi {device}"),
|
|
19929
|
+
icon: "power"
|
|
19930
|
+
},
|
|
19931
|
+
{
|
|
19932
|
+
id: "media.turnOff",
|
|
19933
|
+
method: "turnOff",
|
|
19934
|
+
label: t("Turn off", "Spegni"),
|
|
19935
|
+
phrase: t("Turn off {device}", "Spegni {device}"),
|
|
19936
|
+
icon: "power"
|
|
19937
|
+
},
|
|
19938
|
+
{
|
|
19939
|
+
id: "media.volumeUp",
|
|
19940
|
+
method: "volumeUp",
|
|
19941
|
+
label: t("Volume up", "Alza il volume"),
|
|
19942
|
+
phrase: t("Raise the volume of {device}", "Alza il volume di {device}"),
|
|
19943
|
+
icon: "volume-2"
|
|
19944
|
+
},
|
|
19945
|
+
{
|
|
19946
|
+
id: "media.volumeDown",
|
|
19947
|
+
method: "volumeDown",
|
|
19948
|
+
label: t("Volume down", "Abbassa il volume"),
|
|
19949
|
+
phrase: t("Lower the volume of {device}", "Abbassa il volume di {device}"),
|
|
19950
|
+
icon: "volume-2"
|
|
19951
|
+
},
|
|
19952
|
+
{
|
|
19953
|
+
id: "media.channelUp",
|
|
19954
|
+
method: "channelUp",
|
|
19955
|
+
label: t("Channel up", "Canale successivo"),
|
|
19956
|
+
phrase: t("Go to the next channel on {device}", "Passa al canale successivo su {device}"),
|
|
19957
|
+
icon: "skip-forward"
|
|
19958
|
+
},
|
|
19959
|
+
{
|
|
19960
|
+
id: "media.channelDown",
|
|
19961
|
+
method: "channelDown",
|
|
19962
|
+
label: t("Channel down", "Canale precedente"),
|
|
19963
|
+
phrase: t("Go to the previous channel on {device}", "Torna al canale precedente su {device}"),
|
|
19964
|
+
icon: "skip-back"
|
|
19965
|
+
},
|
|
18945
19966
|
{
|
|
18946
19967
|
id: "media.play",
|
|
18947
19968
|
method: "play",
|
|
@@ -20828,6 +21849,7 @@ var SYSTEM_CAP_VOCABULARY = {
|
|
|
20828
21849
|
"audio-analyzer": system(PIPELINE),
|
|
20829
21850
|
"audio-codec": system(INTERNAL),
|
|
20830
21851
|
"auth-provider": system(IDENTITY),
|
|
21852
|
+
"board-key-source": system(INTERNAL),
|
|
20831
21853
|
backup: system("system backups — run and restored from the Backups page"),
|
|
20832
21854
|
broker: system("message-broker connections — configured, not actuated"),
|
|
20833
21855
|
"calendar-source": system(INTERNAL),
|
|
@@ -45816,6 +46838,49 @@ var binaryCapability = {
|
|
|
45816
46838
|
volatileStateFields: ["lastChangedAt"]
|
|
45817
46839
|
};
|
|
45818
46840
|
/**
|
|
46841
|
+
* Why a board key could not be read. Typed so a caller reports the cause and
|
|
46842
|
+
* never treats "could not read" as "has no key" (D49).
|
|
46843
|
+
*/
|
|
46844
|
+
var BoardKeyFailureReasonSchema = _enum([
|
|
46845
|
+
"unknown-source",
|
|
46846
|
+
"not-admin",
|
|
46847
|
+
"no-builder",
|
|
46848
|
+
"no-ingress-url",
|
|
46849
|
+
"unreachable",
|
|
46850
|
+
"unknown-board",
|
|
46851
|
+
"no-encryption-key",
|
|
46852
|
+
"unreadable-config"
|
|
46853
|
+
]);
|
|
46854
|
+
var BoardKeySourceSchema = object({
|
|
46855
|
+
sourceId: string(),
|
|
46856
|
+
name: string()
|
|
46857
|
+
});
|
|
46858
|
+
var BoardKeyBoardSchema = object({
|
|
46859
|
+
/** The builder's file name, e.g. `kitchen.yaml`: the handle `getBoardKey` takes. */
|
|
46860
|
+
configuration: string(),
|
|
46861
|
+
/** The node name the builder gives the board. */
|
|
46862
|
+
name: string(),
|
|
46863
|
+
/** The address the builder knows the board by, when it has one. */
|
|
46864
|
+
address: string().nullable()
|
|
46865
|
+
});
|
|
46866
|
+
var BoardKeyFailureSchema = object({
|
|
46867
|
+
ok: literal(false),
|
|
46868
|
+
reason: BoardKeyFailureReasonSchema,
|
|
46869
|
+
detail: string().optional()
|
|
46870
|
+
});
|
|
46871
|
+
var ListBoardsResultSchema = discriminatedUnion("ok", [object({
|
|
46872
|
+
ok: literal(true),
|
|
46873
|
+
boards: array(BoardKeyBoardSchema).readonly()
|
|
46874
|
+
}), BoardKeyFailureSchema]);
|
|
46875
|
+
var GetBoardKeyResultSchema = discriminatedUnion("ok", [object({
|
|
46876
|
+
ok: literal(true),
|
|
46877
|
+
key: string()
|
|
46878
|
+
}), BoardKeyFailureSchema]);
|
|
46879
|
+
method(_void(), array(BoardKeySourceSchema).readonly(), { auth: "admin" }), method(object({ sourceId: string().min(1) }), ListBoardsResultSchema, { auth: "admin" }), method(object({
|
|
46880
|
+
sourceId: string().min(1),
|
|
46881
|
+
configuration: string().min(1)
|
|
46882
|
+
}), GetBoardKeyResultSchema, { auth: "admin" });
|
|
46883
|
+
/**
|
|
45819
46884
|
* Dimmable-light brightness control. Co-exists with `switch` on the
|
|
45820
46885
|
* same device — the switch toggles on/off, this cap sets the level
|
|
45821
46886
|
* applied when the light is on. Drivers map their per-vendor dim
|
|
@@ -48505,6 +49570,244 @@ var controlCapability = {
|
|
|
48505
49570
|
*/
|
|
48506
49571
|
history: "none"
|
|
48507
49572
|
};
|
|
49573
|
+
/**
|
|
49574
|
+
* Media-player cap. Models HA `media_player.*` (Sonos, Chromecast,
|
|
49575
|
+
* Apple TV, Spotify, Roku, generic OTT receivers, …) on
|
|
49576
|
+
* `DeviceType.MediaPlayer`. Disjoint from the camera streaming
|
|
49577
|
+
* surface — those use `DeviceType.Camera` + the broker pipeline.
|
|
49578
|
+
*
|
|
49579
|
+
* The cap declares a wide method surface; not every backend supports
|
|
49580
|
+
* every method. Drivers signal sub-capability via the
|
|
49581
|
+
* `DeviceFeature.MediaPlayerXxx` flags (paired one-to-one with the
|
|
49582
|
+
* corresponding method) so the UI gates buttons without a slice
|
|
49583
|
+
* fetch — same pattern as `PanTiltZoom` for cameras.
|
|
49584
|
+
*/
|
|
49585
|
+
var MediaPlayerStateSchema = _enum([
|
|
49586
|
+
"off",
|
|
49587
|
+
"on",
|
|
49588
|
+
"idle",
|
|
49589
|
+
"playing",
|
|
49590
|
+
"paused",
|
|
49591
|
+
"buffering",
|
|
49592
|
+
"standby"
|
|
49593
|
+
]);
|
|
49594
|
+
var MediaPlayerRepeatSchema = _enum([
|
|
49595
|
+
"off",
|
|
49596
|
+
"all",
|
|
49597
|
+
"one"
|
|
49598
|
+
]);
|
|
49599
|
+
var MediaInfoSchema = object({
|
|
49600
|
+
/** Free-form media kind (`music`, `tvshow`, `movie`, `app`, `channel`,
|
|
49601
|
+
* `podcast`, …). */
|
|
49602
|
+
type: string(),
|
|
49603
|
+
/** Human-readable title. */
|
|
49604
|
+
title: string(),
|
|
49605
|
+
/** Optional artist / channel / station label. */
|
|
49606
|
+
artist: string().optional(),
|
|
49607
|
+
/** Optional album / season / show name. */
|
|
49608
|
+
album: string().optional(),
|
|
49609
|
+
/** Optional cover-art / thumbnail URL. */
|
|
49610
|
+
imageUrl: string().optional()
|
|
49611
|
+
});
|
|
49612
|
+
/**
|
|
49613
|
+
* Where `state`, `volumeLevel`, `isMuted` and `source` come from. `reported`:
|
|
49614
|
+
* the device said so. `assumed`: the driver has no feedback (infrared) and
|
|
49615
|
+
* tracks what it last SENT; it moves only after a send was accepted, and a
|
|
49616
|
+
* human at the real remote makes it wrong. A UI shows an assumed value as a
|
|
49617
|
+
* guess, never as a reading.
|
|
49618
|
+
*/
|
|
49619
|
+
var MediaPlayerStateSourceSchema = _enum(["reported", "assumed"]);
|
|
49620
|
+
/** The fields of a media-player status a driver can only guess. */
|
|
49621
|
+
var MediaPlayerAssumedFieldSchema = _enum([
|
|
49622
|
+
"state",
|
|
49623
|
+
"volumeLevel",
|
|
49624
|
+
"isMuted",
|
|
49625
|
+
"source"
|
|
49626
|
+
]);
|
|
49627
|
+
var MediaPlayerStatusSchema = object({
|
|
49628
|
+
/** Playback lifecycle state. */
|
|
49629
|
+
state: MediaPlayerStateSchema,
|
|
49630
|
+
/**
|
|
49631
|
+
* Whether the state fields are readings or the driver's own bookkeeping.
|
|
49632
|
+
* A slice written before this field existed parses as `reported`.
|
|
49633
|
+
*/
|
|
49634
|
+
stateSource: MediaPlayerStateSourceSchema.default("reported"),
|
|
49635
|
+
/**
|
|
49636
|
+
* Which fields are the driver's own guess. `stateSource` is `assumed` when
|
|
49637
|
+
* this is not empty; a field not listed here is a reading even then (power
|
|
49638
|
+
* from a running-state source, mute guessed from the last send).
|
|
49639
|
+
*/
|
|
49640
|
+
assumedFields: array(MediaPlayerAssumedFieldSchema).default([]),
|
|
49641
|
+
/** Volume as 0..100 inclusive. Null when the device has no volume
|
|
49642
|
+
* surface. Pair with `DeviceFeature.MediaPlayerVolume`. */
|
|
49643
|
+
volumeLevel: number().min(0).max(100).nullable().meta(readingMeta("percentage")),
|
|
49644
|
+
/** Mute toggle distinct from volume=0. Null when no mute surface.
|
|
49645
|
+
* Pair with `DeviceFeature.MediaPlayerMute`. */
|
|
49646
|
+
isMuted: boolean().nullable(),
|
|
49647
|
+
/** Active source / input. Empty when no source surface. */
|
|
49648
|
+
source: string(),
|
|
49649
|
+
/** Selectable sources. Empty when no source surface.
|
|
49650
|
+
* Pair with `DeviceFeature.MediaPlayerSelectSource`. */
|
|
49651
|
+
availableSources: array(string()),
|
|
49652
|
+
/** Currently-playing media info. Null when nothing is playing. */
|
|
49653
|
+
currentMedia: MediaInfoSchema.nullable(),
|
|
49654
|
+
/** Current playback position in ms. Null when not seekable or
|
|
49655
|
+
* nothing is playing. Pair with `DeviceFeature.MediaPlayerSeek`. */
|
|
49656
|
+
position: number().int().nonnegative().nullable().meta(readingMeta("duration-ms")),
|
|
49657
|
+
/** Total duration of the current media in ms. Null when unknown
|
|
49658
|
+
* (live stream) or nothing is playing. */
|
|
49659
|
+
duration: number().int().nonnegative().nullable().meta(readingMeta("duration-ms")),
|
|
49660
|
+
/** Shuffle toggle. Null when no shuffle surface.
|
|
49661
|
+
* Pair with `DeviceFeature.MediaPlayerShuffle`. */
|
|
49662
|
+
shuffle: boolean().nullable(),
|
|
49663
|
+
/** Repeat mode. Null when no repeat surface.
|
|
49664
|
+
* Pair with `DeviceFeature.MediaPlayerRepeat`. */
|
|
49665
|
+
repeat: MediaPlayerRepeatSchema.nullable(),
|
|
49666
|
+
/** Ms epoch when the slice was last updated. */
|
|
49667
|
+
lastChangedAt: number()
|
|
49668
|
+
});
|
|
49669
|
+
var stepInput = object({
|
|
49670
|
+
deviceId: number().int().nonnegative(),
|
|
49671
|
+
/** How many presses: the caller's count (Alexa `volumeSteps`, `channelCount`). */
|
|
49672
|
+
steps: number().int().min(1).max(50).default(1)
|
|
49673
|
+
});
|
|
49674
|
+
var deviceOnly = object({ deviceId: number().int().nonnegative() });
|
|
49675
|
+
var mediaPlayerCapability = {
|
|
49676
|
+
name: "media-player",
|
|
49677
|
+
scope: "device",
|
|
49678
|
+
deviceNative: true,
|
|
49679
|
+
mode: "singleton",
|
|
49680
|
+
deviceTypes: [DeviceType.MediaPlayer],
|
|
49681
|
+
methods: {
|
|
49682
|
+
turnOn: method(deviceOnly, _void(), {
|
|
49683
|
+
kind: "mutation",
|
|
49684
|
+
auth: "protected"
|
|
49685
|
+
}),
|
|
49686
|
+
turnOff: method(deviceOnly, _void(), {
|
|
49687
|
+
kind: "mutation",
|
|
49688
|
+
auth: "protected"
|
|
49689
|
+
}),
|
|
49690
|
+
volumeUp: method(stepInput, _void(), {
|
|
49691
|
+
kind: "mutation",
|
|
49692
|
+
auth: "protected"
|
|
49693
|
+
}),
|
|
49694
|
+
volumeDown: method(stepInput, _void(), {
|
|
49695
|
+
kind: "mutation",
|
|
49696
|
+
auth: "protected"
|
|
49697
|
+
}),
|
|
49698
|
+
channelUp: method(stepInput, _void(), {
|
|
49699
|
+
kind: "mutation",
|
|
49700
|
+
auth: "protected"
|
|
49701
|
+
}),
|
|
49702
|
+
channelDown: method(stepInput, _void(), {
|
|
49703
|
+
kind: "mutation",
|
|
49704
|
+
auth: "protected"
|
|
49705
|
+
}),
|
|
49706
|
+
play: method(object({ deviceId: number().int().nonnegative() }), _void(), {
|
|
49707
|
+
kind: "mutation",
|
|
49708
|
+
auth: "protected"
|
|
49709
|
+
}),
|
|
49710
|
+
pause: method(object({ deviceId: number().int().nonnegative() }), _void(), {
|
|
49711
|
+
kind: "mutation",
|
|
49712
|
+
auth: "protected"
|
|
49713
|
+
}),
|
|
49714
|
+
stop: method(object({ deviceId: number().int().nonnegative() }), _void(), {
|
|
49715
|
+
kind: "mutation",
|
|
49716
|
+
auth: "protected"
|
|
49717
|
+
}),
|
|
49718
|
+
next: method(object({ deviceId: number().int().nonnegative() }), _void(), {
|
|
49719
|
+
kind: "mutation",
|
|
49720
|
+
auth: "protected"
|
|
49721
|
+
}),
|
|
49722
|
+
previous: method(object({ deviceId: number().int().nonnegative() }), _void(), {
|
|
49723
|
+
kind: "mutation",
|
|
49724
|
+
auth: "protected"
|
|
49725
|
+
}),
|
|
49726
|
+
seek: method(object({
|
|
49727
|
+
deviceId: number().int().nonnegative(),
|
|
49728
|
+
position: number().int().nonnegative()
|
|
49729
|
+
}), _void(), {
|
|
49730
|
+
kind: "mutation",
|
|
49731
|
+
auth: "protected"
|
|
49732
|
+
}),
|
|
49733
|
+
setVolume: method(object({
|
|
49734
|
+
deviceId: number().int().nonnegative(),
|
|
49735
|
+
volumeLevel: number().min(0).max(100)
|
|
49736
|
+
}), _void(), {
|
|
49737
|
+
kind: "mutation",
|
|
49738
|
+
auth: "protected"
|
|
49739
|
+
}),
|
|
49740
|
+
setMute: method(object({
|
|
49741
|
+
deviceId: number().int().nonnegative(),
|
|
49742
|
+
muted: boolean()
|
|
49743
|
+
}), _void(), {
|
|
49744
|
+
kind: "mutation",
|
|
49745
|
+
auth: "protected"
|
|
49746
|
+
}),
|
|
49747
|
+
setShuffle: method(object({
|
|
49748
|
+
deviceId: number().int().nonnegative(),
|
|
49749
|
+
shuffle: boolean()
|
|
49750
|
+
}), _void(), {
|
|
49751
|
+
kind: "mutation",
|
|
49752
|
+
auth: "protected"
|
|
49753
|
+
}),
|
|
49754
|
+
setRepeat: method(object({
|
|
49755
|
+
deviceId: number().int().nonnegative(),
|
|
49756
|
+
repeat: MediaPlayerRepeatSchema
|
|
49757
|
+
}), _void(), {
|
|
49758
|
+
kind: "mutation",
|
|
49759
|
+
auth: "protected"
|
|
49760
|
+
}),
|
|
49761
|
+
selectSource: method(object({
|
|
49762
|
+
deviceId: number().int().nonnegative(),
|
|
49763
|
+
source: string().min(1)
|
|
49764
|
+
}), _void(), {
|
|
49765
|
+
kind: "mutation",
|
|
49766
|
+
auth: "protected"
|
|
49767
|
+
}),
|
|
49768
|
+
playMedia: method(object({
|
|
49769
|
+
deviceId: number().int().nonnegative(),
|
|
49770
|
+
/** Media identifier / URL. */
|
|
49771
|
+
mediaId: string().min(1),
|
|
49772
|
+
/** Media kind (`music`, `tvshow`, `movie`, `app`, …) — provider
|
|
49773
|
+
* passes it through to the upstream service. */
|
|
49774
|
+
mediaType: string().min(1)
|
|
49775
|
+
}), _void(), {
|
|
49776
|
+
kind: "mutation",
|
|
49777
|
+
auth: "protected"
|
|
49778
|
+
})
|
|
49779
|
+
},
|
|
49780
|
+
status: {
|
|
49781
|
+
schema: MediaPlayerStatusSchema,
|
|
49782
|
+
kind: "push"
|
|
49783
|
+
},
|
|
49784
|
+
/**
|
|
49785
|
+
* Runtime-state slice — mirrored by the kernel. UI players read the
|
|
49786
|
+
* full slice for live now-playing, volume, and progress updates
|
|
49787
|
+
* without polling.
|
|
49788
|
+
*/
|
|
49789
|
+
runtimeState: MediaPlayerStatusSchema,
|
|
49790
|
+
/**
|
|
49791
|
+
* Runtime-state durability: **session** — a restored transport position describes a playback that stopped when the hub did.
|
|
49792
|
+
*
|
|
49793
|
+
* See `RuntimeStateDurability`. Enforced by
|
|
49794
|
+
* `scripts/check-runtime-state-durability.ts`.
|
|
49795
|
+
*/
|
|
49796
|
+
durability: "session",
|
|
49797
|
+
/**
|
|
49798
|
+
* History (D850): volume (a level an operator or an automation sets; the
|
|
49799
|
+
* default 10 s floor folds a slider drag into its end value) and mute.
|
|
49800
|
+
* `position` is not recorded: it moves continuously while playing.
|
|
49801
|
+
*/
|
|
49802
|
+
history: { fields: {
|
|
49803
|
+
volumeLevel: {
|
|
49804
|
+
kind: "gauge",
|
|
49805
|
+
unit: "%",
|
|
49806
|
+
deadband: 1
|
|
49807
|
+
},
|
|
49808
|
+
isMuted: { kind: "boolean" }
|
|
49809
|
+
} }
|
|
49810
|
+
};
|
|
48508
49811
|
DeviceType.Camera, DeviceType.Sensor, DeviceType.Button, DeviceType.Switch, DeviceType.PetFeeder, DeviceType.Container, DeviceType.Thermostat, DeviceType.EventEmitter, DeviceType.Camera, DeviceType.Hub, DeviceType.Light, DeviceType.Siren, DeviceType.Switch, DeviceType.Sensor, DeviceType.Thermostat, DeviceType.Climate, DeviceType.Button, DeviceType.EventEmitter, DeviceType.Update, DeviceType.Generic, DeviceType.Notifier, DeviceType.Script, DeviceType.Automation, DeviceType.Lock, DeviceType.Cover, DeviceType.Valve, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.Fan, DeviceType.MediaPlayer, DeviceType.AlarmPanel, DeviceType.Control, DeviceType.Presence, DeviceType.Weather, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.Container, DeviceType.Image, DeviceType.PetFeeder, DeviceType.PetFountain, DeviceType.Dishwasher, DeviceType.Washer, DeviceType.Heater, DeviceType.Dryer, DeviceType.Gateway, DeviceType.Camera, DeviceType.Fan, DeviceType.Lock, DeviceType.Camera, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Heater, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Heater, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Heater, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Heater, DeviceType.Gateway, DeviceType.Hub, DeviceType.Camera, DeviceType.Sensor, DeviceType.MediaPlayer, DeviceType.Vacuum, DeviceType.Generic, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.PetFountain, DeviceType.Fan, DeviceType.Humidifier, DeviceType.Climate, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.MediaPlayer, DeviceType.WaterHeater, DeviceType.Humidifier, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.PetFeeder, DeviceType.Heater;
|
|
48509
49812
|
var NUMBER = {
|
|
48510
49813
|
kind: "fixed",
|
|
@@ -48952,117 +50255,6 @@ function actuator(input) {
|
|
|
48952
50255
|
};
|
|
48953
50256
|
}
|
|
48954
50257
|
new Map(GROUP_TEMPLATES.map((template) => [template.id, template]));
|
|
48955
|
-
var PowerSourceRefusalReasonSchema = _enum([
|
|
48956
|
-
"no-power-source",
|
|
48957
|
-
"switch-missing",
|
|
48958
|
-
"switch-offline",
|
|
48959
|
-
"switch-unknown",
|
|
48960
|
-
"restart-in-progress",
|
|
48961
|
-
"switch-call-failed"
|
|
48962
|
-
]);
|
|
48963
|
-
var PowerSourceActionResultSchema = discriminatedUnion("accepted", [object({ accepted: literal(true) }), object({
|
|
48964
|
-
accepted: literal(false),
|
|
48965
|
-
reason: PowerSourceRefusalReasonSchema,
|
|
48966
|
-
/** One line for the operator, naming the switch. */
|
|
48967
|
-
message: string()
|
|
48968
|
-
})]);
|
|
48969
|
-
var PowerSourceInfoSchema = object({
|
|
48970
|
-
/** False when the device has no power source linked; the rest is then empty. */
|
|
48971
|
-
linked: boolean(),
|
|
48972
|
-
switchDeviceId: number().nullable(),
|
|
48973
|
-
switchName: string().nullable(),
|
|
48974
|
-
/** The switch's on/off state, or null when it is unknown. Never false for unknown (D393). */
|
|
48975
|
-
switchOn: boolean().nullable(),
|
|
48976
|
-
switchOnline: boolean().nullable(),
|
|
48977
|
-
restartInProgress: boolean(),
|
|
48978
|
-
offSeconds: number().int()
|
|
48979
|
-
});
|
|
48980
|
-
/** The composed slice: the switch state the link mirrors, plus the stored off time. */
|
|
48981
|
-
var PowerSourceStateSchema = object({
|
|
48982
|
-
/** Null while the switch has not reported: unknown is never `false` (D393). */
|
|
48983
|
-
switchOn: boolean().nullable(),
|
|
48984
|
-
offSeconds: number().int(),
|
|
48985
|
-
lastFetchedAt: number()
|
|
48986
|
-
});
|
|
48987
|
-
var POWER_SOURCE_DEVICE_TYPES = [
|
|
48988
|
-
DeviceType.Gateway,
|
|
48989
|
-
DeviceType.Hub,
|
|
48990
|
-
DeviceType.Camera,
|
|
48991
|
-
DeviceType.Sensor,
|
|
48992
|
-
DeviceType.MediaPlayer,
|
|
48993
|
-
DeviceType.Vacuum,
|
|
48994
|
-
DeviceType.Generic,
|
|
48995
|
-
DeviceType.Washer,
|
|
48996
|
-
DeviceType.Dryer,
|
|
48997
|
-
DeviceType.Dishwasher,
|
|
48998
|
-
DeviceType.PetFountain,
|
|
48999
|
-
DeviceType.Fan,
|
|
49000
|
-
DeviceType.Humidifier,
|
|
49001
|
-
DeviceType.Climate,
|
|
49002
|
-
DeviceType.WaterHeater
|
|
49003
|
-
];
|
|
49004
|
-
var powerSourceCustomize = {
|
|
49005
|
-
version: 1,
|
|
49006
|
-
targets: [{
|
|
49007
|
-
id: "switch",
|
|
49008
|
-
cardinality: "scalar",
|
|
49009
|
-
vocabulary: {
|
|
49010
|
-
cap: "power-source",
|
|
49011
|
-
stateField: "switchOn"
|
|
49012
|
-
},
|
|
49013
|
-
deviceTypes: POWER_SOURCE_DEVICE_TYPES,
|
|
49014
|
-
apply: "add",
|
|
49015
|
-
path: "switchOn",
|
|
49016
|
-
sources: [{
|
|
49017
|
-
kind: "switch",
|
|
49018
|
-
transforms: [{ kind: "identity" }]
|
|
49019
|
-
}],
|
|
49020
|
-
companions: [{
|
|
49021
|
-
kind: "constant",
|
|
49022
|
-
path: "offSeconds",
|
|
49023
|
-
value: 10,
|
|
49024
|
-
when: "add"
|
|
49025
|
-
}, {
|
|
49026
|
-
kind: "clock",
|
|
49027
|
-
path: "lastFetchedAt",
|
|
49028
|
-
when: "always"
|
|
49029
|
-
}],
|
|
49030
|
-
sourceReport: { status: "assignment-status" }
|
|
49031
|
-
}]
|
|
49032
|
-
};
|
|
49033
|
-
var deviceInput$2 = object({ deviceId: number().int().nonnegative() });
|
|
49034
|
-
var powerSourceCapability = {
|
|
49035
|
-
name: "power-source",
|
|
49036
|
-
scope: "device",
|
|
49037
|
-
mode: "singleton",
|
|
49038
|
-
deviceTypes: POWER_SOURCE_DEVICE_TYPES,
|
|
49039
|
-
methods: {
|
|
49040
|
-
getStatus: systemMethod(deviceInput$2, PowerSourceInfoSchema, { auth: "admin" }),
|
|
49041
|
-
powerOn: systemMethod(deviceInput$2, PowerSourceActionResultSchema, {
|
|
49042
|
-
kind: "mutation",
|
|
49043
|
-
auth: "admin"
|
|
49044
|
-
}),
|
|
49045
|
-
powerOff: systemMethod(deviceInput$2, PowerSourceActionResultSchema, {
|
|
49046
|
-
kind: "mutation",
|
|
49047
|
-
auth: "admin"
|
|
49048
|
-
}),
|
|
49049
|
-
forceRestart: systemMethod(deviceInput$2, PowerSourceActionResultSchema, {
|
|
49050
|
-
kind: "mutation",
|
|
49051
|
-
auth: "admin"
|
|
49052
|
-
})
|
|
49053
|
-
},
|
|
49054
|
-
runtimeState: PowerSourceStateSchema,
|
|
49055
|
-
customize: powerSourceCustomize,
|
|
49056
|
-
/**
|
|
49057
|
-
* Runtime-state durability: **session** — mirrored from the linked switch on
|
|
49058
|
-
* its next report; a restored value would outlive the reading it names.
|
|
49059
|
-
*
|
|
49060
|
-
* See `RuntimeStateDurability`. Enforced by
|
|
49061
|
-
* `scripts/check-runtime-state-durability.ts`.
|
|
49062
|
-
*/
|
|
49063
|
-
durability: "session",
|
|
49064
|
-
history: "none"
|
|
49065
|
-
};
|
|
49066
50258
|
DeviceFeature.LightColorRgb, DeviceFeature.LightColorHsv, DeviceFeature.LightColorMired;
|
|
49067
50259
|
DeviceType.Camera;
|
|
49068
50260
|
`${COMPOSED_DEVICE_STABLE_ID_PREFIX}`;
|
|
@@ -49090,6 +50282,165 @@ var ComposableCapabilitiesSchema = object({ caps: array(object({
|
|
|
49090
50282
|
}).optional()
|
|
49091
50283
|
})) });
|
|
49092
50284
|
/**
|
|
50285
|
+
* A saved Customize assignment (D936). The schema is the type: callers use
|
|
50286
|
+
* `z.infer`, they do not restate the shape.
|
|
50287
|
+
*/
|
|
50288
|
+
var OverrideSourceSchema = object({
|
|
50289
|
+
addonId: string().min(1),
|
|
50290
|
+
stableId: string().min(1),
|
|
50291
|
+
cap: string().min(1),
|
|
50292
|
+
fieldPath: string().min(1)
|
|
50293
|
+
});
|
|
50294
|
+
var IdentityTransformDraftSchema = object({ kind: literal("identity") });
|
|
50295
|
+
var InvertTransformDraftSchema = object({ kind: literal("invert") });
|
|
50296
|
+
var ThresholdTransformDraftSchema = object({
|
|
50297
|
+
kind: literal("threshold"),
|
|
50298
|
+
comparison: _enum(["gte", "lte"]),
|
|
50299
|
+
threshold: number(),
|
|
50300
|
+
startDwellMs: number().nonnegative(),
|
|
50301
|
+
stopDwellMs: number().nonnegative()
|
|
50302
|
+
});
|
|
50303
|
+
var CustomizeTransformDraftSchema = discriminatedUnion("kind", [
|
|
50304
|
+
IdentityTransformDraftSchema,
|
|
50305
|
+
InvertTransformDraftSchema,
|
|
50306
|
+
ThresholdTransformDraftSchema,
|
|
50307
|
+
object({
|
|
50308
|
+
kind: literal("linear"),
|
|
50309
|
+
scale: number(),
|
|
50310
|
+
offset: number(),
|
|
50311
|
+
clampMin: number().optional(),
|
|
50312
|
+
clampMax: number().optional()
|
|
50313
|
+
}),
|
|
50314
|
+
object({
|
|
50315
|
+
kind: literal("enum-map"),
|
|
50316
|
+
mapping: record(string(), string().nullable())
|
|
50317
|
+
}),
|
|
50318
|
+
object({ kind: literal("number") })
|
|
50319
|
+
]);
|
|
50320
|
+
var ScalarOverrideDraftSchema = object({
|
|
50321
|
+
kind: literal("scalar"),
|
|
50322
|
+
cap: string().min(1),
|
|
50323
|
+
targetId: string().min(1),
|
|
50324
|
+
source: OverrideSourceSchema,
|
|
50325
|
+
transform: CustomizeTransformDraftSchema
|
|
50326
|
+
});
|
|
50327
|
+
var KeyedArrayOverrideDraftSchema = object({
|
|
50328
|
+
kind: literal("keyedArray"),
|
|
50329
|
+
cap: string().min(1),
|
|
50330
|
+
targetId: string().min(1),
|
|
50331
|
+
key: string().min(1),
|
|
50332
|
+
label: string().min(1),
|
|
50333
|
+
fieldPath: string().min(1),
|
|
50334
|
+
source: OverrideSourceSchema,
|
|
50335
|
+
transform: CustomizeTransformDraftSchema
|
|
50336
|
+
});
|
|
50337
|
+
var PulseOverrideDraftSchema = object({
|
|
50338
|
+
kind: literal("pulse"),
|
|
50339
|
+
cap: string().min(1),
|
|
50340
|
+
targetId: string().min(1),
|
|
50341
|
+
enabled: boolean(),
|
|
50342
|
+
debounceMs: number().nonnegative(),
|
|
50343
|
+
edges: array(_enum([
|
|
50344
|
+
"rising",
|
|
50345
|
+
"button",
|
|
50346
|
+
"native-event"
|
|
50347
|
+
])).min(1).optional(),
|
|
50348
|
+
sources: array(OverrideSourceSchema).min(1)
|
|
50349
|
+
});
|
|
50350
|
+
var SpanSourceDraftSchema = OverrideSourceSchema.extend({ mode: _enum([
|
|
50351
|
+
"in-addition",
|
|
50352
|
+
"confirm",
|
|
50353
|
+
"replace"
|
|
50354
|
+
]).optional() });
|
|
50355
|
+
discriminatedUnion("kind", [
|
|
50356
|
+
ScalarOverrideDraftSchema,
|
|
50357
|
+
KeyedArrayOverrideDraftSchema,
|
|
50358
|
+
PulseOverrideDraftSchema,
|
|
50359
|
+
object({
|
|
50360
|
+
kind: literal("span"),
|
|
50361
|
+
cap: string().min(1),
|
|
50362
|
+
targetId: string().min(1),
|
|
50363
|
+
timeoutMs: number().nonnegative(),
|
|
50364
|
+
cooldownMs: number().nonnegative().optional(),
|
|
50365
|
+
sources: array(SpanSourceDraftSchema)
|
|
50366
|
+
})
|
|
50367
|
+
]);
|
|
50368
|
+
object({
|
|
50369
|
+
targetId: string().min(1),
|
|
50370
|
+
configured: boolean(),
|
|
50371
|
+
source: _enum(["native", "assigned"]),
|
|
50372
|
+
state: _enum([
|
|
50373
|
+
"active",
|
|
50374
|
+
"stale",
|
|
50375
|
+
"released",
|
|
50376
|
+
"unavailable"
|
|
50377
|
+
]),
|
|
50378
|
+
reason: string().nullable()
|
|
50379
|
+
});
|
|
50380
|
+
/**
|
|
50381
|
+
* What a running-threshold proposal says (planning#405). The schema is the
|
|
50382
|
+
* type: the algorithm, the capability method and the UI all read `z.infer`.
|
|
50383
|
+
*
|
|
50384
|
+
* A proposal is read-only advice: it carries the numbers it was derived from
|
|
50385
|
+
* (`evidence`) so the operator can judge it, and an `insufficient` answer names
|
|
50386
|
+
* WHY with a typed reason and the catalog defaults, never an invented number.
|
|
50387
|
+
*/
|
|
50388
|
+
var RunningProposalTierSchema = _enum(["raw", "5m"]);
|
|
50389
|
+
var RunningProposalConfidenceSchema = _enum([
|
|
50390
|
+
"high",
|
|
50391
|
+
"medium",
|
|
50392
|
+
"low"
|
|
50393
|
+
]);
|
|
50394
|
+
var RunningProposalInsufficientReasonSchema = _enum([
|
|
50395
|
+
"no-history",
|
|
50396
|
+
"span-too-short",
|
|
50397
|
+
"truncated",
|
|
50398
|
+
"no-idle-floor",
|
|
50399
|
+
"no-runs",
|
|
50400
|
+
"no-separation"
|
|
50401
|
+
]);
|
|
50402
|
+
var RunningProposalReplaySchema = object({
|
|
50403
|
+
/** Intervals the real dwell expression held true over the window. */
|
|
50404
|
+
intervals: number().int().nonnegative(),
|
|
50405
|
+
/** Intervals outside every run, or a second interval inside one. */
|
|
50406
|
+
extra: number().int().nonnegative(),
|
|
50407
|
+
/** Runs without an interval of their own (none, or merged into a neighbour). */
|
|
50408
|
+
missed: number().int().nonnegative()
|
|
50409
|
+
});
|
|
50410
|
+
var RunningProposalEvidenceSchema = object({
|
|
50411
|
+
tier: RunningProposalTierSchema,
|
|
50412
|
+
spanMs: number().nonnegative(),
|
|
50413
|
+
from: number(),
|
|
50414
|
+
to: number(),
|
|
50415
|
+
points: number().int().nonnegative(),
|
|
50416
|
+
runsFound: number().int().nonnegative(),
|
|
50417
|
+
pausesFound: number().int().nonnegative(),
|
|
50418
|
+
longestPauseMs: number().nonnegative(),
|
|
50419
|
+
idleFloorW: number(),
|
|
50420
|
+
noiseCeilingW: number(),
|
|
50421
|
+
plateauW: number(),
|
|
50422
|
+
replay: RunningProposalReplaySchema
|
|
50423
|
+
});
|
|
50424
|
+
var RunningProposalInsufficientEvidenceSchema = object({
|
|
50425
|
+
spanMs: number().nonnegative(),
|
|
50426
|
+
points: number().int().nonnegative(),
|
|
50427
|
+
runsFound: number().int().nonnegative()
|
|
50428
|
+
});
|
|
50429
|
+
var RunningThresholdProposalSchema = discriminatedUnion("state", [object({
|
|
50430
|
+
state: literal("proposal"),
|
|
50431
|
+
transform: ThresholdTransformDraftSchema,
|
|
50432
|
+
evidence: RunningProposalEvidenceSchema,
|
|
50433
|
+
confidence: RunningProposalConfidenceSchema,
|
|
50434
|
+
/** Why the confidence is not higher; empty when nothing held it back. */
|
|
50435
|
+
notes: array(string())
|
|
50436
|
+
}), object({
|
|
50437
|
+
state: literal("insufficient"),
|
|
50438
|
+
reason: RunningProposalInsufficientReasonSchema,
|
|
50439
|
+
evidence: RunningProposalInsufficientEvidenceSchema,
|
|
50440
|
+
/** The catalog defaults, offered as what stands when nothing better is known. */
|
|
50441
|
+
fallback: ThresholdTransformDraftSchema
|
|
50442
|
+
})]);
|
|
50443
|
+
/**
|
|
49093
50444
|
* The report of a one-shot "move this owner's plaintext secrets into the
|
|
49094
50445
|
* keychain" run (D878). COUNTS only - never a value, never a ref.
|
|
49095
50446
|
*
|
|
@@ -49379,6 +50730,14 @@ method(object({}), object({ blocks: array(CoreBlockSchema) }), { auth: "admin" }
|
|
|
49379
50730
|
kind: "mutation",
|
|
49380
50731
|
auth: "admin",
|
|
49381
50732
|
access: "view"
|
|
50733
|
+
}), method(object({
|
|
50734
|
+
deviceId: number().int(),
|
|
50735
|
+
cap: string().min(1),
|
|
50736
|
+
fieldPath: string().min(1),
|
|
50737
|
+
deviceType: _enum(DeviceType).optional()
|
|
50738
|
+
}), RunningThresholdProposalSchema, {
|
|
50739
|
+
auth: "admin",
|
|
50740
|
+
access: "view"
|
|
49382
50741
|
}), method(object({
|
|
49383
50742
|
blockId: string().min(1),
|
|
49384
50743
|
trace: AutomationRunTraceSchema.optional(),
|
|
@@ -50355,7 +51714,27 @@ method(object({
|
|
|
50355
51714
|
* exposes only the COMMON surface: link state, supported device
|
|
50356
51715
|
* kinds (so the UI can filter the device picker), and per-device
|
|
50357
51716
|
* expose/unexpose.
|
|
50358
|
-
|
|
51717
|
+
*
|
|
51718
|
+
* INSTANCES. One export addon can serve several independent targets (a
|
|
51719
|
+
* HomeKit bridge, a Home Assistant broker). `listInstances` names them.
|
|
51720
|
+
* `instanceId` on a READ is optional: absent = the whole addon (linked if any
|
|
51721
|
+
* enabled instance is, `exposedDeviceCount` = distinct devices, `setup` = the
|
|
51722
|
+
* default instance's); present = that instance; an id the provider does not
|
|
51723
|
+
* serve is refused with `ExportInstanceUnknownError` (`export-instance-unknown`),
|
|
51724
|
+
* never answered empty. `instanceId` on a WRITE is REQUIRED: a membership
|
|
51725
|
+
* change always names the target it changes. A single-instance provider
|
|
51726
|
+
* accepts an absent id on a read or its own id, and refuses any other.
|
|
51727
|
+
*/
|
|
51728
|
+
/** Which instance of an export addon a call addresses. Absent on a read = the whole addon. */
|
|
51729
|
+
var InstanceIdSchema$1 = string().min(1);
|
|
51730
|
+
var InstancePinSchema = object({ instanceId: InstanceIdSchema$1.optional() });
|
|
51731
|
+
/** One independent export target of an addon. */
|
|
51732
|
+
var ExportInstanceSchema = object({
|
|
51733
|
+
instanceId: InstanceIdSchema$1,
|
|
51734
|
+
name: string(),
|
|
51735
|
+
enabled: boolean(),
|
|
51736
|
+
kind: string().optional()
|
|
51737
|
+
});
|
|
50359
51738
|
var LinkStateSchema = _enum([
|
|
50360
51739
|
"unlinked",
|
|
50361
51740
|
"linked",
|
|
@@ -50406,10 +51785,14 @@ var ExposedDeviceSchema = object({
|
|
|
50406
51785
|
capabilities: array(string()).optional()
|
|
50407
51786
|
});
|
|
50408
51787
|
var ExposeInputSchema = object({
|
|
51788
|
+
instanceId: InstanceIdSchema$1,
|
|
50409
51789
|
deviceId: string(),
|
|
50410
51790
|
capabilities: array(string()).optional()
|
|
50411
51791
|
});
|
|
50412
|
-
var UnexposeInputSchema = object({
|
|
51792
|
+
var UnexposeInputSchema = object({
|
|
51793
|
+
instanceId: InstanceIdSchema$1,
|
|
51794
|
+
deviceId: string()
|
|
51795
|
+
});
|
|
50413
51796
|
/**
|
|
50414
51797
|
* What an exporter may expose besides devices (D968). An action and a
|
|
50415
51798
|
* notification target are LIST ENTRIES, never devices (D954): they enter an
|
|
@@ -50438,15 +51821,21 @@ var ExposedEntitySchema = object({
|
|
|
50438
51821
|
entity: ExportEntityRefSchema,
|
|
50439
51822
|
exposedAs: string().optional()
|
|
50440
51823
|
});
|
|
50441
|
-
var ExposeEntityInputSchema = object({
|
|
50442
|
-
|
|
50443
|
-
|
|
51824
|
+
var ExposeEntityInputSchema = object({
|
|
51825
|
+
instanceId: InstanceIdSchema$1,
|
|
51826
|
+
entity: ExportEntityRefSchema
|
|
51827
|
+
});
|
|
51828
|
+
var UnexposeEntityInputSchema = object({
|
|
51829
|
+
instanceId: InstanceIdSchema$1,
|
|
51830
|
+
entity: ExportEntityRefSchema
|
|
51831
|
+
});
|
|
51832
|
+
method(InstancePinSchema, DeviceExportStatusSchema), method(_void(), array(ExportInstanceSchema)), method(InstancePinSchema, array(DeviceKindSchema)), method(InstancePinSchema, array(ExposedDeviceSchema)), method(ExposeInputSchema, _void(), {
|
|
50444
51833
|
kind: "mutation",
|
|
50445
51834
|
auth: "admin"
|
|
50446
51835
|
}), method(UnexposeInputSchema, _void(), {
|
|
50447
51836
|
kind: "mutation",
|
|
50448
51837
|
auth: "admin"
|
|
50449
|
-
}), optionalMethod(_void(), array(ExportEntityKindSchema)), optionalMethod(
|
|
51838
|
+
}), optionalMethod(_void(), array(ExportEntityKindSchema)), optionalMethod(InstancePinSchema, array(ExposedEntitySchema)), optionalMethod(ExposeEntityInputSchema, _void(), {
|
|
50450
51839
|
kind: "mutation",
|
|
50451
51840
|
auth: "admin"
|
|
50452
51841
|
}), optionalMethod(UnexposeEntityInputSchema, _void(), {
|
|
@@ -52448,7 +53837,7 @@ var DishwasherStatusSchema = object({
|
|
|
52448
53837
|
/** Ms epoch of the last value received from the appliance; 0 = never. */
|
|
52449
53838
|
lastFetchedAt: number()
|
|
52450
53839
|
});
|
|
52451
|
-
var DeviceIdSchema$
|
|
53840
|
+
var DeviceIdSchema$2 = number().int().nonnegative();
|
|
52452
53841
|
/** A value a program option or setting can take. */
|
|
52453
53842
|
var DishwasherValueSchema = union([
|
|
52454
53843
|
boolean(),
|
|
@@ -52523,77 +53912,77 @@ var dishwasherCapability = {
|
|
|
52523
53912
|
* option feature keys; each is checked against the program's constraints.
|
|
52524
53913
|
*/
|
|
52525
53914
|
start: method(object({
|
|
52526
|
-
deviceId: DeviceIdSchema$
|
|
53915
|
+
deviceId: DeviceIdSchema$2,
|
|
52527
53916
|
program: string().min(1).optional(),
|
|
52528
53917
|
options: record(string(), DishwasherValueSchema).optional()
|
|
52529
53918
|
}), _void(), {
|
|
52530
53919
|
kind: "mutation",
|
|
52531
53920
|
auth: "protected"
|
|
52532
53921
|
}),
|
|
52533
|
-
pause: method(object({ deviceId: DeviceIdSchema$
|
|
53922
|
+
pause: method(object({ deviceId: DeviceIdSchema$2 }), _void(), {
|
|
52534
53923
|
kind: "mutation",
|
|
52535
53924
|
auth: "protected"
|
|
52536
53925
|
}),
|
|
52537
|
-
resume: method(object({ deviceId: DeviceIdSchema$
|
|
53926
|
+
resume: method(object({ deviceId: DeviceIdSchema$2 }), _void(), {
|
|
52538
53927
|
kind: "mutation",
|
|
52539
53928
|
auth: "protected"
|
|
52540
53929
|
}),
|
|
52541
|
-
stop: method(object({ deviceId: DeviceIdSchema$
|
|
53930
|
+
stop: method(object({ deviceId: DeviceIdSchema$2 }), _void(), {
|
|
52542
53931
|
kind: "mutation",
|
|
52543
53932
|
auth: "protected"
|
|
52544
53933
|
}),
|
|
52545
53934
|
/** Select (not start) a program; refused when the appliance does not offer it. */
|
|
52546
53935
|
setProgram: method(object({
|
|
52547
|
-
deviceId: DeviceIdSchema$
|
|
53936
|
+
deviceId: DeviceIdSchema$2,
|
|
52548
53937
|
program: string().min(1)
|
|
52549
53938
|
}), _void(), {
|
|
52550
53939
|
kind: "mutation",
|
|
52551
53940
|
auth: "protected"
|
|
52552
53941
|
}),
|
|
52553
53942
|
setPower: method(object({
|
|
52554
|
-
deviceId: DeviceIdSchema$
|
|
53943
|
+
deviceId: DeviceIdSchema$2,
|
|
52555
53944
|
on: boolean()
|
|
52556
53945
|
}), _void(), {
|
|
52557
53946
|
kind: "mutation",
|
|
52558
53947
|
auth: "protected"
|
|
52559
53948
|
}),
|
|
52560
53949
|
setHalfLoad: method(object({
|
|
52561
|
-
deviceId: DeviceIdSchema$
|
|
53950
|
+
deviceId: DeviceIdSchema$2,
|
|
52562
53951
|
on: boolean()
|
|
52563
53952
|
}), _void(), {
|
|
52564
53953
|
kind: "mutation",
|
|
52565
53954
|
auth: "protected"
|
|
52566
53955
|
}),
|
|
52567
53956
|
setHygienePlus: method(object({
|
|
52568
|
-
deviceId: DeviceIdSchema$
|
|
53957
|
+
deviceId: DeviceIdSchema$2,
|
|
52569
53958
|
on: boolean()
|
|
52570
53959
|
}), _void(), {
|
|
52571
53960
|
kind: "mutation",
|
|
52572
53961
|
auth: "protected"
|
|
52573
53962
|
}),
|
|
52574
53963
|
setExtraDry: method(object({
|
|
52575
|
-
deviceId: DeviceIdSchema$
|
|
53964
|
+
deviceId: DeviceIdSchema$2,
|
|
52576
53965
|
on: boolean()
|
|
52577
53966
|
}), _void(), {
|
|
52578
53967
|
kind: "mutation",
|
|
52579
53968
|
auth: "protected"
|
|
52580
53969
|
}),
|
|
52581
53970
|
setIntensiveZone: method(object({
|
|
52582
|
-
deviceId: DeviceIdSchema$
|
|
53971
|
+
deviceId: DeviceIdSchema$2,
|
|
52583
53972
|
on: boolean()
|
|
52584
53973
|
}), _void(), {
|
|
52585
53974
|
kind: "mutation",
|
|
52586
53975
|
auth: "protected"
|
|
52587
53976
|
}),
|
|
52588
53977
|
setVarioSpeedPlus: method(object({
|
|
52589
|
-
deviceId: DeviceIdSchema$
|
|
53978
|
+
deviceId: DeviceIdSchema$2,
|
|
52590
53979
|
on: boolean()
|
|
52591
53980
|
}), _void(), {
|
|
52592
53981
|
kind: "mutation",
|
|
52593
53982
|
auth: "protected"
|
|
52594
53983
|
}),
|
|
52595
53984
|
setChildLock: method(object({
|
|
52596
|
-
deviceId: DeviceIdSchema$
|
|
53985
|
+
deviceId: DeviceIdSchema$2,
|
|
52597
53986
|
on: boolean()
|
|
52598
53987
|
}), _void(), {
|
|
52599
53988
|
kind: "mutation",
|
|
@@ -52605,7 +53994,7 @@ var dishwasherCapability = {
|
|
|
52605
53994
|
* its declared range / members.
|
|
52606
53995
|
*/
|
|
52607
53996
|
setOption: method(object({
|
|
52608
|
-
deviceId: DeviceIdSchema$
|
|
53997
|
+
deviceId: DeviceIdSchema$2,
|
|
52609
53998
|
key: string().min(1),
|
|
52610
53999
|
value: DishwasherValueSchema
|
|
52611
54000
|
}), _void(), {
|
|
@@ -52613,7 +54002,7 @@ var dishwasherCapability = {
|
|
|
52613
54002
|
auth: "protected"
|
|
52614
54003
|
}),
|
|
52615
54004
|
/** What this appliance can do, from its own description — the UI is derived from it. */
|
|
52616
|
-
getOptions: method(object({ deviceId: DeviceIdSchema$
|
|
54005
|
+
getOptions: method(object({ deviceId: DeviceIdSchema$2 }), DishwasherOptionsSchema, { auth: "protected" })
|
|
52617
54006
|
},
|
|
52618
54007
|
status: {
|
|
52619
54008
|
schema: DishwasherStatusSchema,
|
|
@@ -54037,15 +55426,15 @@ var FanPresetCaptureResultSchema = object({
|
|
|
54037
55426
|
items: array(FanCaptureItemSchema),
|
|
54038
55427
|
omitted: array(FanCaptureOmissionSchema)
|
|
54039
55428
|
});
|
|
54040
|
-
var deviceInput$
|
|
55429
|
+
var deviceInput$2 = object({ deviceId: number().int().nonnegative() });
|
|
54041
55430
|
DeviceType.Fan;
|
|
54042
|
-
method(deviceInput$
|
|
55431
|
+
method(deviceInput$2, array(FanPresetSchema), { auth: "protected" }), method(deviceInput$2.extend({ presets: array(FanPresetSchema).max(12) }), FanPresetsSetResultSchema, {
|
|
54043
55432
|
kind: "mutation",
|
|
54044
55433
|
auth: "admin"
|
|
54045
|
-
}), method(deviceInput$
|
|
55434
|
+
}), method(deviceInput$2.extend({ presetId: string().min(1) }), FanPresetApplyResultSchema, {
|
|
54046
55435
|
kind: "mutation",
|
|
54047
55436
|
auth: "protected"
|
|
54048
|
-
}), method(deviceInput$
|
|
55437
|
+
}), method(deviceInput$2.extend({
|
|
54049
55438
|
fields: array(FanCaptureFieldSchema).optional(),
|
|
54050
55439
|
steps: array(ActionStepSchema).max(20).default([])
|
|
54051
55440
|
}), FanPresetCaptureResultSchema, { auth: "protected" });
|
|
@@ -54928,6 +56317,12 @@ method(_void(), array(IntegrationWithStateSchema)), method(object({ id: string()
|
|
|
54928
56317
|
}), object({ success: boolean() }), {
|
|
54929
56318
|
kind: "mutation",
|
|
54930
56319
|
auth: "admin"
|
|
56320
|
+
}), method(object({ id: string() }), object({
|
|
56321
|
+
rows: number().int().nonnegative(),
|
|
56322
|
+
secrets: number().int().nonnegative()
|
|
56323
|
+
}), {
|
|
56324
|
+
kind: "mutation",
|
|
56325
|
+
auth: "admin"
|
|
54931
56326
|
}), method(_void(), array(AvailableIntegrationTypeSchema), { auth: "admin" }), method(object({
|
|
54932
56327
|
addonId: string(),
|
|
54933
56328
|
settings: record(string(), unknown())
|
|
@@ -54956,13 +56351,65 @@ method(_void(), array(IntegrationWithStateSchema)), method(object({ id: string()
|
|
|
54956
56351
|
*/
|
|
54957
56352
|
var ConfigSchemaPassthrough$3 = custom();
|
|
54958
56353
|
var IntegrationInstanceIdSchema = string().min(1);
|
|
56354
|
+
var IntegrationInstanceModeSchema = _enum(["single", "multiple"]);
|
|
56355
|
+
/**
|
|
56356
|
+
* One kind of instance a provider can create (an adapter, an account type). The sign-in and
|
|
56357
|
+
* connect fields follow the `broker` contract (`broker.cap.ts`): `signIn.basePath` is a
|
|
56358
|
+
* hub-relative route set speaking the sign-in contract, `connectPath` / `disconnectPath` open an
|
|
56359
|
+
* interactive account link (popup) and may carry `{{brokerId}}`, which the UI replaces with the
|
|
56360
|
+
* instance id.
|
|
56361
|
+
*/
|
|
56362
|
+
var IntegrationInstanceKindSchema = object({
|
|
56363
|
+
/** Stable id of the kind, sent back as `createInstance.kind`. */
|
|
56364
|
+
id: string().min(1),
|
|
56365
|
+
label: string().min(1),
|
|
56366
|
+
/** The kind signs in through a server-held interactive session. */
|
|
56367
|
+
signIn: object({
|
|
56368
|
+
basePath: string().min(1),
|
|
56369
|
+
methods: array(_enum(["device-code", "proxy"])).optional()
|
|
56370
|
+
}).optional(),
|
|
56371
|
+
/** Relative hub path to start an interactive account link of an instance of this kind. */
|
|
56372
|
+
connectPath: string().min(1).optional(),
|
|
56373
|
+
/** Relative hub path to disconnect that account. */
|
|
56374
|
+
disconnectPath: string().min(1).optional()
|
|
56375
|
+
});
|
|
54959
56376
|
var IntegrationInstanceDescriptionSchema = object({
|
|
56377
|
+
/** What the instances are for the Integrations page; see {@link IntegrationInstanceRoleSchema}. */
|
|
56378
|
+
role: _enum([
|
|
56379
|
+
"devices",
|
|
56380
|
+
"services",
|
|
56381
|
+
"both"
|
|
56382
|
+
]),
|
|
56383
|
+
/** How the devices of an instance are found; absent means `{ mode: 'none' }`. */
|
|
56384
|
+
discovery: object({
|
|
56385
|
+
mode: _enum([
|
|
56386
|
+
"none",
|
|
56387
|
+
"lan",
|
|
56388
|
+
"account"
|
|
56389
|
+
]),
|
|
56390
|
+
scopedToInstance: boolean()
|
|
56391
|
+
}).optional(),
|
|
54960
56392
|
/** `single`: at most one instance can exist (Loki). `multiple`: an account each. */
|
|
54961
|
-
instanceMode:
|
|
56393
|
+
instanceMode: IntegrationInstanceModeSchema,
|
|
54962
56394
|
/** What the instance is, for the UI (`destination`, `relay`, `account`). */
|
|
54963
56395
|
kind: string(),
|
|
54964
56396
|
/** True when `testInstance` really probes the remote. */
|
|
54965
|
-
canTest: boolean()
|
|
56397
|
+
canTest: boolean(),
|
|
56398
|
+
/**
|
|
56399
|
+
* The kinds an instance can be of. Absent or one entry: nothing to choose; more than one: the
|
|
56400
|
+
* Add flow asks which first and sends it as `createInstance.kind`.
|
|
56401
|
+
*/
|
|
56402
|
+
kinds: array(IntegrationInstanceKindSchema).optional(),
|
|
56403
|
+
/**
|
|
56404
|
+
* The provider accepts `createInstance.id` for an id that once existed (an adopted id, because
|
|
56405
|
+
* devices carry it). The UI then offers "restore under its old id" on Add. Absent means no.
|
|
56406
|
+
*/
|
|
56407
|
+
allowRestoreId: boolean().optional(),
|
|
56408
|
+
/**
|
|
56409
|
+
* `createInstance` without an `id` works: the provider mints it. Absent means the caller must
|
|
56410
|
+
* send an id (the UI then mints an opaque one).
|
|
56411
|
+
*/
|
|
56412
|
+
mintsId: boolean().optional()
|
|
54966
56413
|
});
|
|
54967
56414
|
var IntegrationInstanceStatusSchema = object({
|
|
54968
56415
|
state: _enum([
|
|
@@ -54971,16 +56418,28 @@ var IntegrationInstanceStatusSchema = object({
|
|
|
54971
56418
|
"error",
|
|
54972
56419
|
"unknown"
|
|
54973
56420
|
]),
|
|
54974
|
-
detail: string().optional()
|
|
56421
|
+
detail: string().optional(),
|
|
56422
|
+
/** A short human word for the state ("Signed in", "Token expired"); shown instead of `state`. */
|
|
56423
|
+
label: string().optional()
|
|
54975
56424
|
});
|
|
54976
56425
|
var IntegrationInstanceSchema = object({
|
|
54977
56426
|
id: IntegrationInstanceIdSchema,
|
|
54978
56427
|
name: string(),
|
|
54979
56428
|
/** The addon's own rule (an URL is present, a client id is present...). */
|
|
54980
56429
|
configured: boolean(),
|
|
56430
|
+
/**
|
|
56431
|
+
* The instance's own on/off switch (D996), derived from the record body (`enabled !== false`,
|
|
56432
|
+
* so a row written before the field existed is on). Absent when the `integrations` registry
|
|
56433
|
+
* owns the switch (`describe().role` is `devices`): read it from the registry row.
|
|
56434
|
+
*/
|
|
56435
|
+
enabled: boolean().optional(),
|
|
56436
|
+
/** The kind of this instance (one of `describe().kinds[].id`), when the provider has kinds. */
|
|
56437
|
+
kind: string().optional(),
|
|
54981
56438
|
/** Values for the instance form; a secret is a `SecretFieldView`, never text. */
|
|
54982
56439
|
formValues: record(string(), unknown()),
|
|
54983
|
-
status: IntegrationInstanceStatusSchema.optional()
|
|
56440
|
+
status: IntegrationInstanceStatusSchema.optional(),
|
|
56441
|
+
/** Epoch ms of the last probe of the remote that produced `status`; absent when never checked. */
|
|
56442
|
+
lastCheckedAt: number().optional()
|
|
54984
56443
|
});
|
|
54985
56444
|
var IntegrationInstancePatchSchema = object({
|
|
54986
56445
|
id: IntegrationInstanceIdSchema,
|
|
@@ -54988,25 +56447,57 @@ var IntegrationInstancePatchSchema = object({
|
|
|
54988
56447
|
/** Omitted / '' / redaction token keeps a secret; `{ $secretClear: true }` clears it. */
|
|
54989
56448
|
values: record(string(), unknown())
|
|
54990
56449
|
});
|
|
54991
|
-
|
|
54992
|
-
|
|
54993
|
-
|
|
54994
|
-
|
|
54995
|
-
|
|
54996
|
-
|
|
54997
|
-
|
|
54998
|
-
|
|
54999
|
-
|
|
55000
|
-
|
|
55001
|
-
|
|
55002
|
-
|
|
55003
|
-
|
|
55004
|
-
|
|
55005
|
-
|
|
55006
|
-
|
|
55007
|
-
|
|
55008
|
-
|
|
55009
|
-
})
|
|
56450
|
+
var integrationInstancesCapability = {
|
|
56451
|
+
name: "integration-instances",
|
|
56452
|
+
scope: "system",
|
|
56453
|
+
mode: "collection",
|
|
56454
|
+
methods: {
|
|
56455
|
+
describe: method(_void(), IntegrationInstanceDescriptionSchema, { auth: "admin" }),
|
|
56456
|
+
/** The form; `id: null` is the create form. */
|
|
56457
|
+
instanceFormSchema: method(object({ id: IntegrationInstanceIdSchema.nullable() }), ConfigSchemaPassthrough$3, { auth: "admin" }),
|
|
56458
|
+
listInstances: method(_void(), array(IntegrationInstanceSchema).readonly(), { auth: "admin" }),
|
|
56459
|
+
getInstance: method(object({ id: IntegrationInstanceIdSchema }), IntegrationInstanceSchema.nullable(), { auth: "admin" }),
|
|
56460
|
+
/**
|
|
56461
|
+
* Insert the typed record. With `id` it is stored under that id (a duplicate id is refused);
|
|
56462
|
+
* without one the PROVIDER mints it and answers it. `kind` picks one of `describe().kinds`.
|
|
56463
|
+
*/
|
|
56464
|
+
createInstance: method(object({
|
|
56465
|
+
id: IntegrationInstanceIdSchema.optional(),
|
|
56466
|
+
name: string().min(1),
|
|
56467
|
+
kind: string().min(1).optional()
|
|
56468
|
+
}), object({ id: string() }), {
|
|
56469
|
+
kind: "mutation",
|
|
56470
|
+
auth: "admin"
|
|
56471
|
+
}),
|
|
56472
|
+
updateInstance: method(IntegrationInstancePatchSchema, object({ ok: literal(true) }), {
|
|
56473
|
+
kind: "mutation",
|
|
56474
|
+
auth: "admin"
|
|
56475
|
+
}),
|
|
56476
|
+
/**
|
|
56477
|
+
* Switch ONE instance on or off. A row control, not a form field: `updateInstance.values` is the
|
|
56478
|
+
* form patch (D62, D996). An off instance keeps its record and secrets and does no work.
|
|
56479
|
+
*/
|
|
56480
|
+
setInstanceEnabled: method(object({
|
|
56481
|
+
id: IntegrationInstanceIdSchema,
|
|
56482
|
+
enabled: boolean()
|
|
56483
|
+
}), object({ ok: literal(true) }), {
|
|
56484
|
+
kind: "mutation",
|
|
56485
|
+
auth: "admin"
|
|
56486
|
+
}),
|
|
56487
|
+
/** Delete the record and its keychain refs together. */
|
|
56488
|
+
deleteInstance: method(object({ id: IntegrationInstanceIdSchema }), object({ ok: literal(true) }), {
|
|
56489
|
+
kind: "mutation",
|
|
56490
|
+
auth: "admin"
|
|
56491
|
+
}),
|
|
56492
|
+
testInstance: optionalMethod(object({
|
|
56493
|
+
id: IntegrationInstanceIdSchema.nullable(),
|
|
56494
|
+
values: record(string(), unknown())
|
|
56495
|
+
}), TestConnectionResultSchema$1, {
|
|
56496
|
+
kind: "mutation",
|
|
56497
|
+
auth: "admin"
|
|
56498
|
+
})
|
|
56499
|
+
}
|
|
56500
|
+
};
|
|
55010
56501
|
/**
|
|
55011
56502
|
* Two-way audio / talk-back cap. Clients open a WebRTC audio-only
|
|
55012
56503
|
* session (server-initiated offer pattern, identical to the main
|
|
@@ -57024,6 +58515,11 @@ var LogEntrySchema = object({
|
|
|
57024
58515
|
* flight, and not asking for the next slice ends the scan.
|
|
57025
58516
|
*/
|
|
57026
58517
|
var LogReadQuerySchema = object({
|
|
58518
|
+
/**
|
|
58519
|
+
* Which destination INSTANCE answers (a destination addon may hold several records). Absent ⇒
|
|
58520
|
+
* the provider's first readable one, so a caller written before instances existed is unchanged.
|
|
58521
|
+
*/
|
|
58522
|
+
instanceId: string().min(1).max(200).optional(),
|
|
57027
58523
|
/** Correlates `cancelRead`. Caller-chosen, unique per in-flight read. */
|
|
57028
58524
|
requestId: string().min(1).max(64).optional(),
|
|
57029
58525
|
/** The device the line is about (`tags.deviceId`, numeric). */
|
|
@@ -57086,6 +58582,8 @@ var LogReadResultSchema = object({
|
|
|
57086
58582
|
/** True when `cancelRead` ended this slice early. */
|
|
57087
58583
|
cancelled: boolean().optional()
|
|
57088
58584
|
});
|
|
58585
|
+
/** Names one destination instance; absent ⇒ the provider's first readable one. */
|
|
58586
|
+
var LogInstanceSelectorSchema = object({ instanceId: string().min(1).max(200).optional() });
|
|
57089
58587
|
var LogReadCapabilitiesSchema = object({
|
|
57090
58588
|
/** False ⇒ this destination only ships lines (console, forwarder, an unconfigured Loki). */
|
|
57091
58589
|
readable: boolean(),
|
|
@@ -57104,7 +58602,7 @@ var LogReadCapabilitiesSchema = object({
|
|
|
57104
58602
|
/** How far back the store reaches, when the provider knows (days). */
|
|
57105
58603
|
retentionDays: number().nullable()
|
|
57106
58604
|
});
|
|
57107
|
-
method(LogEntrySchema, _void(), { kind: "mutation" }), optionalMethod(
|
|
58605
|
+
method(LogEntrySchema, _void(), { kind: "mutation" }), optionalMethod(LogInstanceSelectorSchema, LogReadCapabilitiesSchema, { auth: "admin" }), optionalMethod(LogReadQuerySchema, LogReadResultSchema, { auth: "admin" }), optionalMethod(object({ requestId: string().min(1).max(64) }), object({ cancelled: boolean() }), {
|
|
57108
58606
|
kind: "mutation",
|
|
57109
58607
|
auth: "admin"
|
|
57110
58608
|
});
|
|
@@ -57208,214 +58706,6 @@ var LoginMethodContributionSchema = discriminatedUnion("kind", [
|
|
|
57208
58706
|
]);
|
|
57209
58707
|
method(_void(), array(LoginMethodContributionSchema).readonly());
|
|
57210
58708
|
/**
|
|
57211
|
-
* Media-player cap. Models HA `media_player.*` (Sonos, Chromecast,
|
|
57212
|
-
* Apple TV, Spotify, Roku, generic OTT receivers, …) on
|
|
57213
|
-
* `DeviceType.MediaPlayer`. Disjoint from the camera streaming
|
|
57214
|
-
* surface — those use `DeviceType.Camera` + the broker pipeline.
|
|
57215
|
-
*
|
|
57216
|
-
* The cap declares a wide method surface; not every backend supports
|
|
57217
|
-
* every method. Drivers signal sub-capability via the
|
|
57218
|
-
* `DeviceFeature.MediaPlayerXxx` flags (paired one-to-one with the
|
|
57219
|
-
* corresponding method) so the UI gates buttons without a slice
|
|
57220
|
-
* fetch — same pattern as `PanTiltZoom` for cameras.
|
|
57221
|
-
*/
|
|
57222
|
-
var MediaPlayerStateSchema = _enum([
|
|
57223
|
-
"off",
|
|
57224
|
-
"on",
|
|
57225
|
-
"idle",
|
|
57226
|
-
"playing",
|
|
57227
|
-
"paused",
|
|
57228
|
-
"buffering",
|
|
57229
|
-
"standby"
|
|
57230
|
-
]);
|
|
57231
|
-
var MediaPlayerRepeatSchema = _enum([
|
|
57232
|
-
"off",
|
|
57233
|
-
"all",
|
|
57234
|
-
"one"
|
|
57235
|
-
]);
|
|
57236
|
-
var MediaInfoSchema = object({
|
|
57237
|
-
/** Free-form media kind (`music`, `tvshow`, `movie`, `app`, `channel`,
|
|
57238
|
-
* `podcast`, …). */
|
|
57239
|
-
type: string(),
|
|
57240
|
-
/** Human-readable title. */
|
|
57241
|
-
title: string(),
|
|
57242
|
-
/** Optional artist / channel / station label. */
|
|
57243
|
-
artist: string().optional(),
|
|
57244
|
-
/** Optional album / season / show name. */
|
|
57245
|
-
album: string().optional(),
|
|
57246
|
-
/** Optional cover-art / thumbnail URL. */
|
|
57247
|
-
imageUrl: string().optional()
|
|
57248
|
-
});
|
|
57249
|
-
/**
|
|
57250
|
-
* Where `state`, `volumeLevel`, `isMuted` and `source` come from. `reported`:
|
|
57251
|
-
* the device said so. `assumed`: the driver has no feedback (infrared) and
|
|
57252
|
-
* tracks what it last SENT; it moves only after a send was accepted, and a
|
|
57253
|
-
* human at the real remote makes it wrong. A UI shows an assumed value as a
|
|
57254
|
-
* guess, never as a reading.
|
|
57255
|
-
*/
|
|
57256
|
-
var MediaPlayerStateSourceSchema = _enum(["reported", "assumed"]);
|
|
57257
|
-
/** The fields of a media-player status a driver can only guess. */
|
|
57258
|
-
var MediaPlayerAssumedFieldSchema = _enum([
|
|
57259
|
-
"state",
|
|
57260
|
-
"volumeLevel",
|
|
57261
|
-
"isMuted",
|
|
57262
|
-
"source"
|
|
57263
|
-
]);
|
|
57264
|
-
var MediaPlayerStatusSchema = object({
|
|
57265
|
-
/** Playback lifecycle state. */
|
|
57266
|
-
state: MediaPlayerStateSchema,
|
|
57267
|
-
/**
|
|
57268
|
-
* Whether the state fields are readings or the driver's own bookkeeping.
|
|
57269
|
-
* A slice written before this field existed parses as `reported`.
|
|
57270
|
-
*/
|
|
57271
|
-
stateSource: MediaPlayerStateSourceSchema.default("reported"),
|
|
57272
|
-
/**
|
|
57273
|
-
* Which fields are the driver's own guess. `stateSource` is `assumed` when
|
|
57274
|
-
* this is not empty; a field not listed here is a reading even then (power
|
|
57275
|
-
* from a running-state source, mute guessed from the last send).
|
|
57276
|
-
*/
|
|
57277
|
-
assumedFields: array(MediaPlayerAssumedFieldSchema).default([]),
|
|
57278
|
-
/** Volume as 0..100 inclusive. Null when the device has no volume
|
|
57279
|
-
* surface. Pair with `DeviceFeature.MediaPlayerVolume`. */
|
|
57280
|
-
volumeLevel: number().min(0).max(100).nullable().meta(readingMeta("percentage")),
|
|
57281
|
-
/** Mute toggle distinct from volume=0. Null when no mute surface.
|
|
57282
|
-
* Pair with `DeviceFeature.MediaPlayerMute`. */
|
|
57283
|
-
isMuted: boolean().nullable(),
|
|
57284
|
-
/** Active source / input. Empty when no source surface. */
|
|
57285
|
-
source: string(),
|
|
57286
|
-
/** Selectable sources. Empty when no source surface.
|
|
57287
|
-
* Pair with `DeviceFeature.MediaPlayerSelectSource`. */
|
|
57288
|
-
availableSources: array(string()),
|
|
57289
|
-
/** Currently-playing media info. Null when nothing is playing. */
|
|
57290
|
-
currentMedia: MediaInfoSchema.nullable(),
|
|
57291
|
-
/** Current playback position in ms. Null when not seekable or
|
|
57292
|
-
* nothing is playing. Pair with `DeviceFeature.MediaPlayerSeek`. */
|
|
57293
|
-
position: number().int().nonnegative().nullable().meta(readingMeta("duration-ms")),
|
|
57294
|
-
/** Total duration of the current media in ms. Null when unknown
|
|
57295
|
-
* (live stream) or nothing is playing. */
|
|
57296
|
-
duration: number().int().nonnegative().nullable().meta(readingMeta("duration-ms")),
|
|
57297
|
-
/** Shuffle toggle. Null when no shuffle surface.
|
|
57298
|
-
* Pair with `DeviceFeature.MediaPlayerShuffle`. */
|
|
57299
|
-
shuffle: boolean().nullable(),
|
|
57300
|
-
/** Repeat mode. Null when no repeat surface.
|
|
57301
|
-
* Pair with `DeviceFeature.MediaPlayerRepeat`. */
|
|
57302
|
-
repeat: MediaPlayerRepeatSchema.nullable(),
|
|
57303
|
-
/** Ms epoch when the slice was last updated. */
|
|
57304
|
-
lastChangedAt: number()
|
|
57305
|
-
});
|
|
57306
|
-
var mediaPlayerCapability = {
|
|
57307
|
-
name: "media-player",
|
|
57308
|
-
scope: "device",
|
|
57309
|
-
deviceNative: true,
|
|
57310
|
-
mode: "singleton",
|
|
57311
|
-
deviceTypes: [DeviceType.MediaPlayer],
|
|
57312
|
-
methods: {
|
|
57313
|
-
play: method(object({ deviceId: number().int().nonnegative() }), _void(), {
|
|
57314
|
-
kind: "mutation",
|
|
57315
|
-
auth: "protected"
|
|
57316
|
-
}),
|
|
57317
|
-
pause: method(object({ deviceId: number().int().nonnegative() }), _void(), {
|
|
57318
|
-
kind: "mutation",
|
|
57319
|
-
auth: "protected"
|
|
57320
|
-
}),
|
|
57321
|
-
stop: method(object({ deviceId: number().int().nonnegative() }), _void(), {
|
|
57322
|
-
kind: "mutation",
|
|
57323
|
-
auth: "protected"
|
|
57324
|
-
}),
|
|
57325
|
-
next: method(object({ deviceId: number().int().nonnegative() }), _void(), {
|
|
57326
|
-
kind: "mutation",
|
|
57327
|
-
auth: "protected"
|
|
57328
|
-
}),
|
|
57329
|
-
previous: method(object({ deviceId: number().int().nonnegative() }), _void(), {
|
|
57330
|
-
kind: "mutation",
|
|
57331
|
-
auth: "protected"
|
|
57332
|
-
}),
|
|
57333
|
-
seek: method(object({
|
|
57334
|
-
deviceId: number().int().nonnegative(),
|
|
57335
|
-
position: number().int().nonnegative()
|
|
57336
|
-
}), _void(), {
|
|
57337
|
-
kind: "mutation",
|
|
57338
|
-
auth: "protected"
|
|
57339
|
-
}),
|
|
57340
|
-
setVolume: method(object({
|
|
57341
|
-
deviceId: number().int().nonnegative(),
|
|
57342
|
-
volumeLevel: number().min(0).max(100)
|
|
57343
|
-
}), _void(), {
|
|
57344
|
-
kind: "mutation",
|
|
57345
|
-
auth: "protected"
|
|
57346
|
-
}),
|
|
57347
|
-
setMute: method(object({
|
|
57348
|
-
deviceId: number().int().nonnegative(),
|
|
57349
|
-
muted: boolean()
|
|
57350
|
-
}), _void(), {
|
|
57351
|
-
kind: "mutation",
|
|
57352
|
-
auth: "protected"
|
|
57353
|
-
}),
|
|
57354
|
-
setShuffle: method(object({
|
|
57355
|
-
deviceId: number().int().nonnegative(),
|
|
57356
|
-
shuffle: boolean()
|
|
57357
|
-
}), _void(), {
|
|
57358
|
-
kind: "mutation",
|
|
57359
|
-
auth: "protected"
|
|
57360
|
-
}),
|
|
57361
|
-
setRepeat: method(object({
|
|
57362
|
-
deviceId: number().int().nonnegative(),
|
|
57363
|
-
repeat: MediaPlayerRepeatSchema
|
|
57364
|
-
}), _void(), {
|
|
57365
|
-
kind: "mutation",
|
|
57366
|
-
auth: "protected"
|
|
57367
|
-
}),
|
|
57368
|
-
selectSource: method(object({
|
|
57369
|
-
deviceId: number().int().nonnegative(),
|
|
57370
|
-
source: string().min(1)
|
|
57371
|
-
}), _void(), {
|
|
57372
|
-
kind: "mutation",
|
|
57373
|
-
auth: "protected"
|
|
57374
|
-
}),
|
|
57375
|
-
playMedia: method(object({
|
|
57376
|
-
deviceId: number().int().nonnegative(),
|
|
57377
|
-
/** Media identifier / URL. */
|
|
57378
|
-
mediaId: string().min(1),
|
|
57379
|
-
/** Media kind (`music`, `tvshow`, `movie`, `app`, …) — provider
|
|
57380
|
-
* passes it through to the upstream service. */
|
|
57381
|
-
mediaType: string().min(1)
|
|
57382
|
-
}), _void(), {
|
|
57383
|
-
kind: "mutation",
|
|
57384
|
-
auth: "protected"
|
|
57385
|
-
})
|
|
57386
|
-
},
|
|
57387
|
-
status: {
|
|
57388
|
-
schema: MediaPlayerStatusSchema,
|
|
57389
|
-
kind: "push"
|
|
57390
|
-
},
|
|
57391
|
-
/**
|
|
57392
|
-
* Runtime-state slice — mirrored by the kernel. UI players read the
|
|
57393
|
-
* full slice for live now-playing, volume, and progress updates
|
|
57394
|
-
* without polling.
|
|
57395
|
-
*/
|
|
57396
|
-
runtimeState: MediaPlayerStatusSchema,
|
|
57397
|
-
/**
|
|
57398
|
-
* Runtime-state durability: **session** — a restored transport position describes a playback that stopped when the hub did.
|
|
57399
|
-
*
|
|
57400
|
-
* See `RuntimeStateDurability`. Enforced by
|
|
57401
|
-
* `scripts/check-runtime-state-durability.ts`.
|
|
57402
|
-
*/
|
|
57403
|
-
durability: "session",
|
|
57404
|
-
/**
|
|
57405
|
-
* History (D850): volume (a level an operator or an automation sets; the
|
|
57406
|
-
* default 10 s floor folds a slider drag into its end value) and mute.
|
|
57407
|
-
* `position` is not recorded: it moves continuously while playing.
|
|
57408
|
-
*/
|
|
57409
|
-
history: { fields: {
|
|
57410
|
-
volumeLevel: {
|
|
57411
|
-
kind: "gauge",
|
|
57412
|
-
unit: "%",
|
|
57413
|
-
deadband: 1
|
|
57414
|
-
},
|
|
57415
|
-
isMuted: { kind: "boolean" }
|
|
57416
|
-
} }
|
|
57417
|
-
};
|
|
57418
|
-
/**
|
|
57419
58709
|
* mesh-network — collection cap for mesh-VPN providers.
|
|
57420
58710
|
*
|
|
57421
58711
|
* Different shape from `network-access` (public tunnels):
|
|
@@ -66174,6 +67464,21 @@ var NcTemplateVarKindSchema = _enum([
|
|
|
66174
67464
|
"sound",
|
|
66175
67465
|
"system"
|
|
66176
67466
|
]);
|
|
67467
|
+
/**
|
|
67468
|
+
* The default title/body a rule of one SITUATION is delivered with when the
|
|
67469
|
+
* operator wrote no template — served so an editor can pre-fill it (and the
|
|
67470
|
+
* operator can rebuild it from placeholders) instead of starting from a blank
|
|
67471
|
+
* box that, once saved, silently replaces it. `id` names the situation inside
|
|
67472
|
+
* a rule `kind`: `appliance-cycle` is a `sensor` rule whose device is an
|
|
67473
|
+
* appliance finishing a cycle. Texts are raw templates (`{{var}}` intact), in
|
|
67474
|
+
* the hub's current language and with its overrides applied.
|
|
67475
|
+
*/
|
|
67476
|
+
var NcTemplateDefaultSchema = object({
|
|
67477
|
+
id: _enum(["appliance-cycle"]),
|
|
67478
|
+
kind: NcRuleKindSchema,
|
|
67479
|
+
title: string(),
|
|
67480
|
+
body: string()
|
|
67481
|
+
});
|
|
66177
67482
|
/** Which producer renders a template: an ordinary rule, a timelapse, a digest. */
|
|
66178
67483
|
var NcTemplateFamilySchema = _enum([
|
|
66179
67484
|
"rule",
|
|
@@ -67029,7 +68334,11 @@ method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), m
|
|
|
67029
68334
|
}), method(object({}), object({
|
|
67030
68335
|
catalog: array(NcConditionDescriptorSchema),
|
|
67031
68336
|
taxonomy: NcTaxonomySchema.optional()
|
|
67032
|
-
})), method(object({}), object({
|
|
68337
|
+
})), method(object({}), object({
|
|
68338
|
+
vars: array(NcTemplateVarDescriptorSchema),
|
|
68339
|
+
/** Per-situation default texts; absent on a hub that predates them. */
|
|
68340
|
+
defaults: array(NcTemplateDefaultSchema)
|
|
68341
|
+
})), method(NcTemplatePreviewInputSchema, NcTemplatePreviewSchema, {
|
|
67033
68342
|
kind: "mutation",
|
|
67034
68343
|
access: "view"
|
|
67035
68344
|
}), method(object({ filter: NcHistoryFilterSchema.default({ limit: 100 }) }), object({ entries: array(NcHistoryEntrySchema) }), { auth: "admin" }), method(object({}), NcRuleLastRunsSchema, { auth: "admin" }), method(object({ artifactId: string().min(1) }), object({ url: string().nullable() }), { auth: "admin" }), method(object({}), object({ snoozes: array(NcSnoozeSchema) }), { caller: "required" }), method(object({ snooze: NcSnoozeInputSchema }), object({ snooze: NcSnoozeSchema }), {
|
|
@@ -67925,7 +69234,7 @@ var petFeederCapability = {
|
|
|
67925
69234
|
/**
|
|
67926
69235
|
* Pet water-fountain cap. Models the telemetry and the control surface of a
|
|
67927
69236
|
* circulating drinking fountain: how much water is in the tank, how much the
|
|
67928
|
-
* pet drank, whether the pump runs
|
|
69237
|
+
* pet drank, whether the pump runs.
|
|
67929
69238
|
*
|
|
67930
69239
|
* It has no native vendor provider of its own: a fountain reaches CamStack as
|
|
67931
69240
|
* a container of loose entities (a pump switch, two number boxes, a "filter
|
|
@@ -67941,8 +69250,10 @@ var petFeederCapability = {
|
|
|
67941
69250
|
* never here. Every reading may be `null`: a source that is offline or does
|
|
67942
69251
|
* not report is unknown, never zero.
|
|
67943
69252
|
*
|
|
67944
|
-
* The
|
|
67945
|
-
* cap
|
|
69253
|
+
* The pump's on/off duty cycle is model-specific and lives in the optional
|
|
69254
|
+
* `pump-cycle` cap. The filter, the cleaning and the water change are not
|
|
69255
|
+
* fields of this cap: they are items of the `consumables` cap on the same
|
|
69256
|
+
* device (kind `wear`), reset by the same forward mechanism.
|
|
67946
69257
|
*/
|
|
67947
69258
|
var PetFountainStatusSchema = object({
|
|
67948
69259
|
/** Water in the tank, 0..100 (%). Null while the source has not reported. */
|
|
@@ -67953,27 +69264,20 @@ var PetFountainStatusSchema = object({
|
|
|
67953
69264
|
empty: boolean().nullable(),
|
|
67954
69265
|
/** True while the pump is running. Null while unknown. */
|
|
67955
69266
|
pumpRunning: boolean().nullable(),
|
|
67956
|
-
/** True when the pump works on an on/off duty cycle rather than continuously. */
|
|
67957
|
-
pumpIntervalEnabled: boolean().nullable(),
|
|
67958
|
-
/** How long the pump runs per cycle, in seconds. */
|
|
67959
|
-
pumpOnTime: number().min(0).nullable().meta(readingMeta("duration")),
|
|
67960
|
-
/** How long the pump rests per cycle, in seconds. */
|
|
67961
|
-
pumpOffTime: number().min(0).nullable().meta(readingMeta("duration")),
|
|
67962
69267
|
/** Water drunk in the last drink, in litres. */
|
|
67963
69268
|
lastDrink: number().min(0).nullable().meta(readingMeta("volume")),
|
|
67964
69269
|
/** Water drunk in the current hour, in litres. */
|
|
67965
69270
|
currentHourDrink: number().min(0).nullable().meta(readingMeta("volume")),
|
|
67966
69271
|
/** Water drunk over the last 24 hours (rolling), in litres. */
|
|
67967
69272
|
last24hDrink: number().min(0).nullable().meta(readingMeta("volume")),
|
|
67968
|
-
/** Water drunk since local midnight, in litres. */
|
|
69273
|
+
/** Water drunk since local midnight, in litres. Null when the fountain has no such sensor. */
|
|
67969
69274
|
todayDrink: number().min(0).nullable().meta(readingMeta("volume")),
|
|
67970
69275
|
/** Decoded fault message. Null means healthy; a non-null string is an active fault. */
|
|
67971
69276
|
error: string().nullable(),
|
|
67972
69277
|
/** Ms epoch when the slice was last refreshed. */
|
|
67973
69278
|
lastFetchedAt: number()
|
|
67974
69279
|
});
|
|
67975
|
-
var DeviceIdSchema = number().int().nonnegative();
|
|
67976
|
-
var MinutesSchema = number().int().min(0);
|
|
69280
|
+
var DeviceIdSchema$1 = number().int().nonnegative();
|
|
67977
69281
|
var petFountainCapability = {
|
|
67978
69282
|
name: "pet-fountain",
|
|
67979
69283
|
scope: "device",
|
|
@@ -67983,38 +69287,14 @@ var petFountainCapability = {
|
|
|
67983
69287
|
methods: {
|
|
67984
69288
|
/** Start or stop the pump. */
|
|
67985
69289
|
setPump: method(object({
|
|
67986
|
-
deviceId: DeviceIdSchema,
|
|
67987
|
-
on: boolean()
|
|
67988
|
-
}), _void(), {
|
|
67989
|
-
kind: "mutation",
|
|
67990
|
-
auth: "protected"
|
|
67991
|
-
}),
|
|
67992
|
-
/** Switch the on/off duty cycle on or off (off = the pump runs continuously). */
|
|
67993
|
-
setPumpInterval: method(object({
|
|
67994
|
-
deviceId: DeviceIdSchema,
|
|
69290
|
+
deviceId: DeviceIdSchema$1,
|
|
67995
69291
|
on: boolean()
|
|
67996
69292
|
}), _void(), {
|
|
67997
69293
|
kind: "mutation",
|
|
67998
69294
|
auth: "protected"
|
|
67999
69295
|
}),
|
|
68000
|
-
/** Set how many minutes the pump runs per cycle. */
|
|
68001
|
-
setPumpOnMinutes: method(object({
|
|
68002
|
-
deviceId: DeviceIdSchema,
|
|
68003
|
-
minutes: MinutesSchema
|
|
68004
|
-
}), _void(), {
|
|
68005
|
-
kind: "mutation",
|
|
68006
|
-
auth: "protected"
|
|
68007
|
-
}),
|
|
68008
|
-
/** Set how many minutes the pump rests per cycle. */
|
|
68009
|
-
setPumpOffMinutes: method(object({
|
|
68010
|
-
deviceId: DeviceIdSchema,
|
|
68011
|
-
minutes: MinutesSchema
|
|
68012
|
-
}), _void(), {
|
|
68013
|
-
kind: "mutation",
|
|
68014
|
-
auth: "protected"
|
|
68015
|
-
}),
|
|
68016
69296
|
/** Clear the rolling daily consumption counters on the device. */
|
|
68017
|
-
resetDailyConsumption: method(object({ deviceId: DeviceIdSchema }), _void(), {
|
|
69297
|
+
resetDailyConsumption: method(object({ deviceId: DeviceIdSchema$1 }), _void(), {
|
|
68018
69298
|
kind: "mutation",
|
|
68019
69299
|
auth: "protected"
|
|
68020
69300
|
})
|
|
@@ -69649,6 +70929,14 @@ var powerMeterCapability = {
|
|
|
69649
70929
|
deviceNative: true,
|
|
69650
70930
|
mode: "singleton",
|
|
69651
70931
|
deviceTypes: POWER_METER_DEVICE_TYPES,
|
|
70932
|
+
deviceConfig: { ui: {
|
|
70933
|
+
kind: "widget",
|
|
70934
|
+
widgetId: "host/power-meter-line",
|
|
70935
|
+
tab: "power",
|
|
70936
|
+
placement: "hero",
|
|
70937
|
+
label: "Power",
|
|
70938
|
+
order: 4
|
|
70939
|
+
} },
|
|
69652
70940
|
methods: {},
|
|
69653
70941
|
status: {
|
|
69654
70942
|
schema: PowerMeterStatusSchema,
|
|
@@ -69708,6 +70996,117 @@ var powerMeterCapability = {
|
|
|
69708
70996
|
volatileStateFields: ["lastFetchedAt"],
|
|
69709
70997
|
customize: powerMeterCustomize
|
|
69710
70998
|
};
|
|
70999
|
+
var PowerSourceRefusalReasonSchema = _enum([
|
|
71000
|
+
"no-power-source",
|
|
71001
|
+
"switch-missing",
|
|
71002
|
+
"switch-offline",
|
|
71003
|
+
"switch-unknown",
|
|
71004
|
+
"restart-in-progress",
|
|
71005
|
+
"switch-call-failed"
|
|
71006
|
+
]);
|
|
71007
|
+
var PowerSourceActionResultSchema = discriminatedUnion("accepted", [object({ accepted: literal(true) }), object({
|
|
71008
|
+
accepted: literal(false),
|
|
71009
|
+
reason: PowerSourceRefusalReasonSchema,
|
|
71010
|
+
/** One line for the operator, naming the switch. */
|
|
71011
|
+
message: string()
|
|
71012
|
+
})]);
|
|
71013
|
+
var PowerSourceInfoSchema = object({
|
|
71014
|
+
/** False when the device has no power source linked; the rest is then empty. */
|
|
71015
|
+
linked: boolean(),
|
|
71016
|
+
switchDeviceId: number().nullable(),
|
|
71017
|
+
switchName: string().nullable(),
|
|
71018
|
+
/** The switch's on/off state, or null when it is unknown. Never false for unknown (D393). */
|
|
71019
|
+
switchOn: boolean().nullable(),
|
|
71020
|
+
switchOnline: boolean().nullable(),
|
|
71021
|
+
restartInProgress: boolean(),
|
|
71022
|
+
offSeconds: number().int()
|
|
71023
|
+
});
|
|
71024
|
+
/** The composed slice: the switch state the link mirrors, plus the stored off time. */
|
|
71025
|
+
var PowerSourceStateSchema = object({
|
|
71026
|
+
/** Null while the switch has not reported: unknown is never `false` (D393). */
|
|
71027
|
+
switchOn: boolean().nullable(),
|
|
71028
|
+
offSeconds: number().int(),
|
|
71029
|
+
lastFetchedAt: number()
|
|
71030
|
+
});
|
|
71031
|
+
var POWER_SOURCE_DEVICE_TYPES = [
|
|
71032
|
+
DeviceType.Gateway,
|
|
71033
|
+
DeviceType.Hub,
|
|
71034
|
+
DeviceType.Camera,
|
|
71035
|
+
DeviceType.Sensor,
|
|
71036
|
+
DeviceType.MediaPlayer,
|
|
71037
|
+
DeviceType.Vacuum,
|
|
71038
|
+
DeviceType.Generic,
|
|
71039
|
+
DeviceType.Washer,
|
|
71040
|
+
DeviceType.Dryer,
|
|
71041
|
+
DeviceType.Dishwasher,
|
|
71042
|
+
DeviceType.PetFountain,
|
|
71043
|
+
DeviceType.Fan,
|
|
71044
|
+
DeviceType.Humidifier,
|
|
71045
|
+
DeviceType.Climate,
|
|
71046
|
+
DeviceType.WaterHeater
|
|
71047
|
+
];
|
|
71048
|
+
var powerSourceCustomize = {
|
|
71049
|
+
version: 1,
|
|
71050
|
+
targets: [{
|
|
71051
|
+
id: "switch",
|
|
71052
|
+
cardinality: "scalar",
|
|
71053
|
+
vocabulary: {
|
|
71054
|
+
cap: "power-source",
|
|
71055
|
+
stateField: "switchOn"
|
|
71056
|
+
},
|
|
71057
|
+
deviceTypes: POWER_SOURCE_DEVICE_TYPES,
|
|
71058
|
+
apply: "add",
|
|
71059
|
+
path: "switchOn",
|
|
71060
|
+
sources: [{
|
|
71061
|
+
kind: "switch",
|
|
71062
|
+
transforms: [{ kind: "identity" }]
|
|
71063
|
+
}],
|
|
71064
|
+
companions: [{
|
|
71065
|
+
kind: "constant",
|
|
71066
|
+
path: "offSeconds",
|
|
71067
|
+
value: 10,
|
|
71068
|
+
when: "add"
|
|
71069
|
+
}, {
|
|
71070
|
+
kind: "clock",
|
|
71071
|
+
path: "lastFetchedAt",
|
|
71072
|
+
when: "always"
|
|
71073
|
+
}],
|
|
71074
|
+
sourceReport: { status: "assignment-status" }
|
|
71075
|
+
}]
|
|
71076
|
+
};
|
|
71077
|
+
var deviceInput$1 = object({ deviceId: number().int().nonnegative() });
|
|
71078
|
+
var powerSourceCapability = {
|
|
71079
|
+
name: "power-source",
|
|
71080
|
+
scope: "device",
|
|
71081
|
+
mode: "singleton",
|
|
71082
|
+
deviceTypes: POWER_SOURCE_DEVICE_TYPES,
|
|
71083
|
+
methods: {
|
|
71084
|
+
getStatus: systemMethod(deviceInput$1, PowerSourceInfoSchema, { auth: "admin" }),
|
|
71085
|
+
powerOn: systemMethod(deviceInput$1, PowerSourceActionResultSchema, {
|
|
71086
|
+
kind: "mutation",
|
|
71087
|
+
auth: "admin"
|
|
71088
|
+
}),
|
|
71089
|
+
powerOff: systemMethod(deviceInput$1, PowerSourceActionResultSchema, {
|
|
71090
|
+
kind: "mutation",
|
|
71091
|
+
auth: "admin"
|
|
71092
|
+
}),
|
|
71093
|
+
forceRestart: systemMethod(deviceInput$1, PowerSourceActionResultSchema, {
|
|
71094
|
+
kind: "mutation",
|
|
71095
|
+
auth: "admin"
|
|
71096
|
+
})
|
|
71097
|
+
},
|
|
71098
|
+
runtimeState: PowerSourceStateSchema,
|
|
71099
|
+
customize: powerSourceCustomize,
|
|
71100
|
+
/**
|
|
71101
|
+
* Runtime-state durability: **session** — mirrored from the linked switch on
|
|
71102
|
+
* its next report; a restored value would outlive the reading it names.
|
|
71103
|
+
*
|
|
71104
|
+
* See `RuntimeStateDurability`. Enforced by
|
|
71105
|
+
* `scripts/check-runtime-state-durability.ts`.
|
|
71106
|
+
*/
|
|
71107
|
+
durability: "session",
|
|
71108
|
+
history: "none"
|
|
71109
|
+
};
|
|
69711
71110
|
/**
|
|
69712
71111
|
* Presence cap. Models HA `person.*` and `device_tracker.*` entities
|
|
69713
71112
|
* on `DeviceType.Presence`. Read-only — no setters: presence is
|
|
@@ -70347,6 +71746,79 @@ var ptzAutotrackCapability = {
|
|
|
70347
71746
|
*/
|
|
70348
71747
|
history: "none"
|
|
70349
71748
|
};
|
|
71749
|
+
/**
|
|
71750
|
+
* The on/off duty cycle of a pet fountain's pump. Some models run the pump
|
|
71751
|
+
* continuously and have nothing to configure; others can alternate a run time
|
|
71752
|
+
* and a rest time. That is model-specific, so it is its own optional cap on the
|
|
71753
|
+
* fountain device: a fountain without cycle entities simply never composes it
|
|
71754
|
+
* (planning#366), and the `pet-fountain` cap stays the model-independent core.
|
|
71755
|
+
*
|
|
71756
|
+
* Like `pet-fountain` it has no native vendor provider: an operator BUILDS the
|
|
71757
|
+
* cycle from loose entities (a cycle switch and two number boxes) and every
|
|
71758
|
+
* method is a forward to one source entity (D659, D967). Durations are stored
|
|
71759
|
+
* in SECONDS (D944); a number box that cannot be read back leaves them `null`
|
|
71760
|
+
* — unknown, never zero (D393).
|
|
71761
|
+
*/
|
|
71762
|
+
var PumpCycleStatusSchema = object({
|
|
71763
|
+
/** True when the pump works on the on/off cycle, false when it runs continuously. Null while unknown. */
|
|
71764
|
+
enabled: boolean().nullable(),
|
|
71765
|
+
/** How long the pump runs per cycle, in seconds. Null while unknown. */
|
|
71766
|
+
onTime: number().min(0).nullable().meta(readingMeta("duration")),
|
|
71767
|
+
/** How long the pump rests per cycle, in seconds. Null while unknown. */
|
|
71768
|
+
offTime: number().min(0).nullable().meta(readingMeta("duration")),
|
|
71769
|
+
/** Ms epoch when the slice was last refreshed. */
|
|
71770
|
+
lastFetchedAt: number()
|
|
71771
|
+
});
|
|
71772
|
+
var DeviceIdSchema = number().int().nonnegative();
|
|
71773
|
+
var MinutesSchema = number().int().min(0);
|
|
71774
|
+
var pumpCycleCapability = {
|
|
71775
|
+
name: "pump-cycle",
|
|
71776
|
+
scope: "device",
|
|
71777
|
+
deviceNative: true,
|
|
71778
|
+
mode: "singleton",
|
|
71779
|
+
deviceTypes: [DeviceType.PetFountain],
|
|
71780
|
+
methods: {
|
|
71781
|
+
/** Switch the on/off duty cycle on or off (off = the pump runs continuously). */
|
|
71782
|
+
setEnabled: method(object({
|
|
71783
|
+
deviceId: DeviceIdSchema,
|
|
71784
|
+
on: boolean()
|
|
71785
|
+
}), _void(), {
|
|
71786
|
+
kind: "mutation",
|
|
71787
|
+
auth: "protected"
|
|
71788
|
+
}),
|
|
71789
|
+
/** Set how many minutes the pump runs per cycle. */
|
|
71790
|
+
setOnMinutes: method(object({
|
|
71791
|
+
deviceId: DeviceIdSchema,
|
|
71792
|
+
minutes: MinutesSchema
|
|
71793
|
+
}), _void(), {
|
|
71794
|
+
kind: "mutation",
|
|
71795
|
+
auth: "protected"
|
|
71796
|
+
}),
|
|
71797
|
+
/** Set how many minutes the pump rests per cycle. */
|
|
71798
|
+
setOffMinutes: method(object({
|
|
71799
|
+
deviceId: DeviceIdSchema,
|
|
71800
|
+
minutes: MinutesSchema
|
|
71801
|
+
}), _void(), {
|
|
71802
|
+
kind: "mutation",
|
|
71803
|
+
auth: "protected"
|
|
71804
|
+
})
|
|
71805
|
+
},
|
|
71806
|
+
status: {
|
|
71807
|
+
schema: PumpCycleStatusSchema,
|
|
71808
|
+
kind: "push"
|
|
71809
|
+
},
|
|
71810
|
+
/** Runtime-state slice — mirrored by the kernel; the hero card reads it whole. */
|
|
71811
|
+
runtimeState: PumpCycleStatusSchema,
|
|
71812
|
+
/**
|
|
71813
|
+
* Runtime-state durability: **session** — live appliance state re-published on connect.
|
|
71814
|
+
*
|
|
71815
|
+
* See `RuntimeStateDurability`. Enforced by
|
|
71816
|
+
* `scripts/check-runtime-state-durability.ts`.
|
|
71817
|
+
*/
|
|
71818
|
+
durability: "session",
|
|
71819
|
+
/** History (D850): a duty-cycle setting is not a series worth recording. */
|
|
71820
|
+
history: "none"
|
|
71821
|
+
};
|
|
70350
71822
|
DeviceType.Camera, DeviceType.Sensor, DeviceType.Switch, DeviceType.Gateway, method(object({ deviceId: number().int().nonnegative() }), object({ success: literal(true) }), {
|
|
70351
71823
|
kind: "mutation",
|
|
70352
71824
|
auth: "admin"
|
|
@@ -73137,7 +74609,13 @@ var RemoteMediaCommandSchema = _enum([
|
|
|
73137
74609
|
"next",
|
|
73138
74610
|
"previous",
|
|
73139
74611
|
"setMute",
|
|
73140
|
-
"selectSource"
|
|
74612
|
+
"selectSource",
|
|
74613
|
+
"turnOn",
|
|
74614
|
+
"turnOff",
|
|
74615
|
+
"volumeUp",
|
|
74616
|
+
"volumeDown",
|
|
74617
|
+
"channelUp",
|
|
74618
|
+
"channelDown"
|
|
73141
74619
|
]);
|
|
73142
74620
|
/** A send result, or `not-routed`: the role is not bound, so the native cap answers. */
|
|
73143
74621
|
var RemoteMediaCommandResultSchema = discriminatedUnion("status", [...RemoteSendResultSchema.options, object({ status: literal("not-routed") })]);
|
|
@@ -73158,7 +74636,7 @@ method(deviceInput, RemoteConfigSchema, { auth: "admin" }), method(deviceInput.e
|
|
|
73158
74636
|
}), RemoteSendResultSchema, {
|
|
73159
74637
|
kind: "mutation",
|
|
73160
74638
|
auth: "protected"
|
|
73161
|
-
}), method(deviceInput.extend({
|
|
74639
|
+
}), method(deviceInput, MediaPlayerStatusSchema.nullable(), { auth: "protected" }), method(deviceInput.extend({
|
|
73162
74640
|
command: RemoteMediaCommandSchema,
|
|
73163
74641
|
muted: boolean().optional(),
|
|
73164
74642
|
source: string().optional(),
|
|
@@ -75404,7 +76882,11 @@ listSignals: method(_void(), array(StreamSignalSchema).readonly()) }
|
|
|
75404
76882
|
* `getSettingsUISchema()` surface.
|
|
75405
76883
|
*/
|
|
75406
76884
|
var SwitchStatusSchema = object({
|
|
75407
|
-
|
|
76885
|
+
/**
|
|
76886
|
+
* `null` = the device has never reported its state (a measurement that
|
|
76887
|
+
* has not happened is unknown, never `false`).
|
|
76888
|
+
*/
|
|
76889
|
+
on: boolean().nullable().meta({ label: "On" }),
|
|
75408
76890
|
/** Ms epoch of the last state change. Useful for UI "X minutes ago". */
|
|
75409
76891
|
lastChangedAt: number()
|
|
75410
76892
|
});
|
|
@@ -75429,7 +76911,7 @@ var switchCapability = {
|
|
|
75429
76911
|
}) },
|
|
75430
76912
|
events: { onStateChanged: { data: object({
|
|
75431
76913
|
deviceId: number(),
|
|
75432
|
-
on: boolean(),
|
|
76914
|
+
on: boolean().nullable(),
|
|
75433
76915
|
lastChangedAt: number()
|
|
75434
76916
|
}) } },
|
|
75435
76917
|
status: {
|
|
@@ -79078,6 +80560,26 @@ function buildDescriptor(capName, kind) {
|
|
|
79078
80560
|
* contributes one entry per bound cap present in this map.
|
|
79079
80561
|
*/
|
|
79080
80562
|
var EVENT_KIND_BY_CAP = Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
|
|
80563
|
+
/**
|
|
80564
|
+
* What a remote key is CALLED and what it LOOKS like, for every role (D963),
|
|
80565
|
+
* shared by the admin UI and the viewer. A role is data on the wire; each
|
|
80566
|
+
* client resolves its name from `label` (English and Italian side by side) and
|
|
80567
|
+
* its glyph from `icon`, a lucide id from the shared icon catalogue — the
|
|
80568
|
+
* server sends an id, a client maps it to its own icon set.
|
|
80569
|
+
*
|
|
80570
|
+
* `legend` is text printed on the key INSTEAD of a glyph (a digit has no
|
|
80571
|
+
* pictogram): a client that can draw text shows it, one that cannot falls back
|
|
80572
|
+
* to `icon`.
|
|
80573
|
+
*/
|
|
80574
|
+
function digit(n) {
|
|
80575
|
+
return {
|
|
80576
|
+
label: t(n, n),
|
|
80577
|
+
icon: "hash",
|
|
80578
|
+
legend: n
|
|
80579
|
+
};
|
|
80580
|
+
}
|
|
80581
|
+
digit("0"), digit("1"), digit("2"), digit("3"), digit("4"), digit("5"), digit("6"), digit("7"), digit("8"), digit("9");
|
|
80582
|
+
DeviceFeature.MediaPlayerPower, DeviceFeature.MediaPlayerVolumeStep, DeviceFeature.MediaPlayerChannelStep, DeviceFeature.MediaPlayerMute, DeviceFeature.MediaPlayerStop, DeviceFeature.MediaPlayerNext, DeviceFeature.MediaPlayerPrevious;
|
|
79081
80583
|
var btn = (idSuffix, row, col, init) => ({
|
|
79082
80584
|
idSuffix,
|
|
79083
80585
|
row,
|
|
@@ -79204,6 +80706,34 @@ discriminatedUnion("kind", [object({
|
|
|
79204
80706
|
kind: literal("pronto"),
|
|
79205
80707
|
code: string()
|
|
79206
80708
|
})]);
|
|
80709
|
+
/**
|
|
80710
|
+
* Propose a running threshold from a device's own power history (planning#405).
|
|
80711
|
+
*
|
|
80712
|
+
* Pure and deterministic: the same series gives the same answer. The series is
|
|
80713
|
+
* a HELD-VALUE step series — a point's value stands until the next point — which
|
|
80714
|
+
* is how device-history stores a gauge, so "time at a level" is exact, not a
|
|
80715
|
+
* count of samples.
|
|
80716
|
+
*
|
|
80717
|
+
* 1. idle floor F = time-weighted median; noise ceiling N = highest value seen
|
|
80718
|
+
* near F. A device that is not near one level most of the time has no floor.
|
|
80719
|
+
* 2. coarse activity = above max(2N, N + 5 W); consecutive stretches are episodes.
|
|
80720
|
+
* 3. gaps between episodes split in two by the largest log-scale jump (>= 3x):
|
|
80721
|
+
* the short ones are pauses INSIDE a run (a soak), the long ones separate runs.
|
|
80722
|
+
* 4. T = geometric mean of N and the plateau's 10th percentile, snapped to a
|
|
80723
|
+
* grid a person would type; stop dwell covers the longest pause; start dwell
|
|
80724
|
+
* covers the longest standby blip above T.
|
|
80725
|
+
* 5. the numbers are proved by REPLAY through the real `dwell` evaluation: each
|
|
80726
|
+
* run must hold exactly one true interval and nothing may flap outside.
|
|
80727
|
+
*/
|
|
80728
|
+
var SECOND_MS = 1e3;
|
|
80729
|
+
var MINUTE_MS$1 = 60 * SECOND_MS;
|
|
80730
|
+
24 * (60 * MINUTE_MS$1);
|
|
80731
|
+
10 * MINUTE_MS$1;
|
|
80732
|
+
30 * SECOND_MS;
|
|
80733
|
+
60 * SECOND_MS;
|
|
80734
|
+
20 * MINUTE_MS$1;
|
|
80735
|
+
10 * SECOND_MS;
|
|
80736
|
+
10 * SECOND_MS;
|
|
79207
80737
|
DeviceFeature.FanSpeed, DeviceFeature.FanPreset, DeviceFeature.FanDirection, DeviceFeature.FanOscillating, DeviceFeature.CoverStoppable, DeviceFeature.CoverPositionable, DeviceFeature.CoverTilt, DeviceFeature.ValvePositionable, DeviceFeature.MediaPlayerVolume, DeviceFeature.ClimateFanMode;
|
|
79208
80738
|
SOURCE_CAPS.filter((cap) => cap !== "switch" && cap !== "motion");
|
|
79209
80739
|
String.raw`rose\(active(\d+), changed(\d+), (\d+(?:\.\d+)?)\)`;
|
|
@@ -79564,6 +81094,7 @@ var DEVICE_LOCAL_STATE_CAPS = {
|
|
|
79564
81094
|
pressureSensor: pressureSensorCapability,
|
|
79565
81095
|
privacyMask: privacyMaskCapability,
|
|
79566
81096
|
ptzAutotrack: ptzAutotrackCapability,
|
|
81097
|
+
pumpCycle: pumpCycleCapability,
|
|
79567
81098
|
recordingOnboard: recordingOnboardCapability,
|
|
79568
81099
|
recordingSignal: recordingSignalCapability,
|
|
79569
81100
|
runningState: runningStateCapability,
|
|
@@ -81748,6 +83279,27 @@ Object.freeze({
|
|
|
81748
83279
|
access: "view",
|
|
81749
83280
|
role: "viewer"
|
|
81750
83281
|
},
|
|
83282
|
+
"boardKeySource.getBoardKey": {
|
|
83283
|
+
capName: "board-key-source",
|
|
83284
|
+
capScope: "system",
|
|
83285
|
+
addonId: null,
|
|
83286
|
+
access: "view",
|
|
83287
|
+
role: "admin"
|
|
83288
|
+
},
|
|
83289
|
+
"boardKeySource.listBoards": {
|
|
83290
|
+
capName: "board-key-source",
|
|
83291
|
+
capScope: "system",
|
|
83292
|
+
addonId: null,
|
|
83293
|
+
access: "view",
|
|
83294
|
+
role: "admin"
|
|
83295
|
+
},
|
|
83296
|
+
"boardKeySource.listSources": {
|
|
83297
|
+
capName: "board-key-source",
|
|
83298
|
+
capScope: "system",
|
|
83299
|
+
addonId: null,
|
|
83300
|
+
access: "view",
|
|
83301
|
+
role: "admin"
|
|
83302
|
+
},
|
|
81751
83303
|
"brightness.getStatus": {
|
|
81752
83304
|
capName: "brightness",
|
|
81753
83305
|
capScope: "device",
|
|
@@ -82287,6 +83839,13 @@ Object.freeze({
|
|
|
82287
83839
|
access: "create",
|
|
82288
83840
|
role: "admin"
|
|
82289
83841
|
},
|
|
83842
|
+
"coreBlocks.proposeRunningThreshold": {
|
|
83843
|
+
capName: "core-blocks",
|
|
83844
|
+
capScope: "system",
|
|
83845
|
+
addonId: null,
|
|
83846
|
+
access: "view",
|
|
83847
|
+
role: "admin"
|
|
83848
|
+
},
|
|
82290
83849
|
"coreBlocks.reportAutomationRun": {
|
|
82291
83850
|
capName: "core-blocks",
|
|
82292
83851
|
capScope: "system",
|
|
@@ -82798,6 +84357,13 @@ Object.freeze({
|
|
|
82798
84357
|
access: "view",
|
|
82799
84358
|
role: "admin"
|
|
82800
84359
|
},
|
|
84360
|
+
"deviceExport.listInstances": {
|
|
84361
|
+
capName: "device-export",
|
|
84362
|
+
capScope: "system",
|
|
84363
|
+
addonId: null,
|
|
84364
|
+
access: "view",
|
|
84365
|
+
role: "admin"
|
|
84366
|
+
},
|
|
82801
84367
|
"deviceExport.listSupportedDeviceKinds": {
|
|
82802
84368
|
capName: "device-export",
|
|
82803
84369
|
capScope: "system",
|
|
@@ -84429,6 +85995,13 @@ Object.freeze({
|
|
|
84429
85995
|
access: "view",
|
|
84430
85996
|
role: "admin"
|
|
84431
85997
|
},
|
|
85998
|
+
"integrationInstances.setInstanceEnabled": {
|
|
85999
|
+
capName: "integration-instances",
|
|
86000
|
+
capScope: "system",
|
|
86001
|
+
addonId: null,
|
|
86002
|
+
access: "create",
|
|
86003
|
+
role: "admin"
|
|
86004
|
+
},
|
|
84432
86005
|
"integrationInstances.testInstance": {
|
|
84433
86006
|
capName: "integration-instances",
|
|
84434
86007
|
capScope: "system",
|
|
@@ -84443,6 +86016,13 @@ Object.freeze({
|
|
|
84443
86016
|
access: "create",
|
|
84444
86017
|
role: "admin"
|
|
84445
86018
|
},
|
|
86019
|
+
"integrations.clearSettings": {
|
|
86020
|
+
capName: "integrations",
|
|
86021
|
+
capScope: "system",
|
|
86022
|
+
addonId: null,
|
|
86023
|
+
access: "delete",
|
|
86024
|
+
role: "admin"
|
|
86025
|
+
},
|
|
84446
86026
|
"integrations.create": {
|
|
84447
86027
|
capName: "integrations",
|
|
84448
86028
|
capScope: "system",
|
|
@@ -85227,6 +86807,20 @@ Object.freeze({
|
|
|
85227
86807
|
access: "view",
|
|
85228
86808
|
role: "admin"
|
|
85229
86809
|
},
|
|
86810
|
+
"mediaPlayer.channelDown": {
|
|
86811
|
+
capName: "media-player",
|
|
86812
|
+
capScope: "device",
|
|
86813
|
+
addonId: null,
|
|
86814
|
+
access: "create",
|
|
86815
|
+
role: "viewer"
|
|
86816
|
+
},
|
|
86817
|
+
"mediaPlayer.channelUp": {
|
|
86818
|
+
capName: "media-player",
|
|
86819
|
+
capScope: "device",
|
|
86820
|
+
addonId: null,
|
|
86821
|
+
access: "create",
|
|
86822
|
+
role: "viewer"
|
|
86823
|
+
},
|
|
85230
86824
|
"mediaPlayer.getStatus": {
|
|
85231
86825
|
capName: "media-player",
|
|
85232
86826
|
capScope: "device",
|
|
@@ -85318,6 +86912,34 @@ Object.freeze({
|
|
|
85318
86912
|
access: "create",
|
|
85319
86913
|
role: "viewer"
|
|
85320
86914
|
},
|
|
86915
|
+
"mediaPlayer.turnOff": {
|
|
86916
|
+
capName: "media-player",
|
|
86917
|
+
capScope: "device",
|
|
86918
|
+
addonId: null,
|
|
86919
|
+
access: "create",
|
|
86920
|
+
role: "viewer"
|
|
86921
|
+
},
|
|
86922
|
+
"mediaPlayer.turnOn": {
|
|
86923
|
+
capName: "media-player",
|
|
86924
|
+
capScope: "device",
|
|
86925
|
+
addonId: null,
|
|
86926
|
+
access: "create",
|
|
86927
|
+
role: "viewer"
|
|
86928
|
+
},
|
|
86929
|
+
"mediaPlayer.volumeDown": {
|
|
86930
|
+
capName: "media-player",
|
|
86931
|
+
capScope: "device",
|
|
86932
|
+
addonId: null,
|
|
86933
|
+
access: "create",
|
|
86934
|
+
role: "viewer"
|
|
86935
|
+
},
|
|
86936
|
+
"mediaPlayer.volumeUp": {
|
|
86937
|
+
capName: "media-player",
|
|
86938
|
+
capScope: "device",
|
|
86939
|
+
addonId: null,
|
|
86940
|
+
access: "create",
|
|
86941
|
+
role: "viewer"
|
|
86942
|
+
},
|
|
85321
86943
|
"meshNetwork.getStatus": {
|
|
85322
86944
|
capName: "mesh-network",
|
|
85323
86945
|
capScope: "system",
|
|
@@ -86564,27 +88186,6 @@ Object.freeze({
|
|
|
86564
88186
|
access: "create",
|
|
86565
88187
|
role: "viewer"
|
|
86566
88188
|
},
|
|
86567
|
-
"petFountain.setPumpInterval": {
|
|
86568
|
-
capName: "pet-fountain",
|
|
86569
|
-
capScope: "device",
|
|
86570
|
-
addonId: null,
|
|
86571
|
-
access: "create",
|
|
86572
|
-
role: "viewer"
|
|
86573
|
-
},
|
|
86574
|
-
"petFountain.setPumpOffMinutes": {
|
|
86575
|
-
capName: "pet-fountain",
|
|
86576
|
-
capScope: "device",
|
|
86577
|
-
addonId: null,
|
|
86578
|
-
access: "create",
|
|
86579
|
-
role: "viewer"
|
|
86580
|
-
},
|
|
86581
|
-
"petFountain.setPumpOnMinutes": {
|
|
86582
|
-
capName: "pet-fountain",
|
|
86583
|
-
capScope: "device",
|
|
86584
|
-
addonId: null,
|
|
86585
|
-
access: "create",
|
|
86586
|
-
role: "viewer"
|
|
86587
|
-
},
|
|
86588
88189
|
"pipelineAnalytics.addRetrainFrameFromRecording": {
|
|
86589
88190
|
capName: "pipeline-analytics",
|
|
86590
88191
|
capScope: "device",
|
|
@@ -88363,6 +89964,34 @@ Object.freeze({
|
|
|
88363
89964
|
access: "create",
|
|
88364
89965
|
role: "admin"
|
|
88365
89966
|
},
|
|
89967
|
+
"pumpCycle.getStatus": {
|
|
89968
|
+
capName: "pump-cycle",
|
|
89969
|
+
capScope: "device",
|
|
89970
|
+
addonId: null,
|
|
89971
|
+
access: "view",
|
|
89972
|
+
role: "viewer"
|
|
89973
|
+
},
|
|
89974
|
+
"pumpCycle.setEnabled": {
|
|
89975
|
+
capName: "pump-cycle",
|
|
89976
|
+
capScope: "device",
|
|
89977
|
+
addonId: null,
|
|
89978
|
+
access: "create",
|
|
89979
|
+
role: "viewer"
|
|
89980
|
+
},
|
|
89981
|
+
"pumpCycle.setOffMinutes": {
|
|
89982
|
+
capName: "pump-cycle",
|
|
89983
|
+
capScope: "device",
|
|
89984
|
+
addonId: null,
|
|
89985
|
+
access: "create",
|
|
89986
|
+
role: "viewer"
|
|
89987
|
+
},
|
|
89988
|
+
"pumpCycle.setOnMinutes": {
|
|
89989
|
+
capName: "pump-cycle",
|
|
89990
|
+
capScope: "device",
|
|
89991
|
+
addonId: null,
|
|
89992
|
+
access: "create",
|
|
89993
|
+
role: "viewer"
|
|
89994
|
+
},
|
|
88366
89995
|
"reboot.reboot": {
|
|
88367
89996
|
capName: "reboot",
|
|
88368
89997
|
capScope: "device",
|
|
@@ -88867,6 +90496,13 @@ Object.freeze({
|
|
|
88867
90496
|
access: "create",
|
|
88868
90497
|
role: "admin"
|
|
88869
90498
|
},
|
|
90499
|
+
"remote.getAssumedStatus": {
|
|
90500
|
+
capName: "remote",
|
|
90501
|
+
capScope: "system",
|
|
90502
|
+
addonId: null,
|
|
90503
|
+
access: "view",
|
|
90504
|
+
role: "admin"
|
|
90505
|
+
},
|
|
88870
90506
|
"remote.getConfig": {
|
|
88871
90507
|
capName: "remote",
|
|
88872
90508
|
capScope: "system",
|
|
@@ -91682,6 +93318,11 @@ Object.freeze({
|
|
|
91682
93318
|
form: "single",
|
|
91683
93319
|
optional: false
|
|
91684
93320
|
}],
|
|
93321
|
+
"coreBlocks.proposeRunningThreshold": [{
|
|
93322
|
+
name: "deviceId",
|
|
93323
|
+
form: "single",
|
|
93324
|
+
optional: false
|
|
93325
|
+
}],
|
|
91685
93326
|
"cover.close": [{
|
|
91686
93327
|
name: "deviceId",
|
|
91687
93328
|
form: "single",
|
|
@@ -92533,6 +94174,16 @@ Object.freeze({
|
|
|
92533
94174
|
form: "single",
|
|
92534
94175
|
optional: true
|
|
92535
94176
|
}],
|
|
94177
|
+
"mediaPlayer.channelDown": [{
|
|
94178
|
+
name: "deviceId",
|
|
94179
|
+
form: "single",
|
|
94180
|
+
optional: false
|
|
94181
|
+
}],
|
|
94182
|
+
"mediaPlayer.channelUp": [{
|
|
94183
|
+
name: "deviceId",
|
|
94184
|
+
form: "single",
|
|
94185
|
+
optional: false
|
|
94186
|
+
}],
|
|
92536
94187
|
"mediaPlayer.getStatus": [{
|
|
92537
94188
|
name: "deviceId",
|
|
92538
94189
|
form: "single",
|
|
@@ -92598,6 +94249,26 @@ Object.freeze({
|
|
|
92598
94249
|
form: "single",
|
|
92599
94250
|
optional: false
|
|
92600
94251
|
}],
|
|
94252
|
+
"mediaPlayer.turnOff": [{
|
|
94253
|
+
name: "deviceId",
|
|
94254
|
+
form: "single",
|
|
94255
|
+
optional: false
|
|
94256
|
+
}],
|
|
94257
|
+
"mediaPlayer.turnOn": [{
|
|
94258
|
+
name: "deviceId",
|
|
94259
|
+
form: "single",
|
|
94260
|
+
optional: false
|
|
94261
|
+
}],
|
|
94262
|
+
"mediaPlayer.volumeDown": [{
|
|
94263
|
+
name: "deviceId",
|
|
94264
|
+
form: "single",
|
|
94265
|
+
optional: false
|
|
94266
|
+
}],
|
|
94267
|
+
"mediaPlayer.volumeUp": [{
|
|
94268
|
+
name: "deviceId",
|
|
94269
|
+
form: "single",
|
|
94270
|
+
optional: false
|
|
94271
|
+
}],
|
|
92601
94272
|
"meter.getStatus": [{
|
|
92602
94273
|
name: "deviceId",
|
|
92603
94274
|
form: "single",
|
|
@@ -92907,21 +94578,6 @@ Object.freeze({
|
|
|
92907
94578
|
form: "single",
|
|
92908
94579
|
optional: false
|
|
92909
94580
|
}],
|
|
92910
|
-
"petFountain.setPumpInterval": [{
|
|
92911
|
-
name: "deviceId",
|
|
92912
|
-
form: "single",
|
|
92913
|
-
optional: false
|
|
92914
|
-
}],
|
|
92915
|
-
"petFountain.setPumpOffMinutes": [{
|
|
92916
|
-
name: "deviceId",
|
|
92917
|
-
form: "single",
|
|
92918
|
-
optional: false
|
|
92919
|
-
}],
|
|
92920
|
-
"petFountain.setPumpOnMinutes": [{
|
|
92921
|
-
name: "deviceId",
|
|
92922
|
-
form: "single",
|
|
92923
|
-
optional: false
|
|
92924
|
-
}],
|
|
92925
94581
|
"pipelineAnalytics.addRetrainFrameFromRecording": [{
|
|
92926
94582
|
name: "deviceId",
|
|
92927
94583
|
form: "single",
|
|
@@ -93557,6 +95213,26 @@ Object.freeze({
|
|
|
93557
95213
|
form: "single",
|
|
93558
95214
|
optional: false
|
|
93559
95215
|
}],
|
|
95216
|
+
"pumpCycle.getStatus": [{
|
|
95217
|
+
name: "deviceId",
|
|
95218
|
+
form: "single",
|
|
95219
|
+
optional: false
|
|
95220
|
+
}],
|
|
95221
|
+
"pumpCycle.setEnabled": [{
|
|
95222
|
+
name: "deviceId",
|
|
95223
|
+
form: "single",
|
|
95224
|
+
optional: false
|
|
95225
|
+
}],
|
|
95226
|
+
"pumpCycle.setOffMinutes": [{
|
|
95227
|
+
name: "deviceId",
|
|
95228
|
+
form: "single",
|
|
95229
|
+
optional: false
|
|
95230
|
+
}],
|
|
95231
|
+
"pumpCycle.setOnMinutes": [{
|
|
95232
|
+
name: "deviceId",
|
|
95233
|
+
form: "single",
|
|
95234
|
+
optional: false
|
|
95235
|
+
}],
|
|
93560
95236
|
"reboot.reboot": [{
|
|
93561
95237
|
name: "deviceId",
|
|
93562
95238
|
form: "single",
|
|
@@ -93758,6 +95434,11 @@ Object.freeze({
|
|
|
93758
95434
|
form: "single",
|
|
93759
95435
|
optional: true
|
|
93760
95436
|
}],
|
|
95437
|
+
"remote.getAssumedStatus": [{
|
|
95438
|
+
name: "deviceId",
|
|
95439
|
+
form: "single",
|
|
95440
|
+
optional: false
|
|
95441
|
+
}],
|
|
93761
95442
|
"remote.getConfig": [{
|
|
93762
95443
|
name: "deviceId",
|
|
93763
95444
|
form: "single",
|
|
@@ -94305,99 +95986,6 @@ Object.freeze({
|
|
|
94305
95986
|
"network-access": "ingress",
|
|
94306
95987
|
"smtp-provider": "email"
|
|
94307
95988
|
});
|
|
94308
|
-
/**
|
|
94309
|
-
* A saved Customize assignment (D936). The schema is the type: callers use
|
|
94310
|
-
* `z.infer`, they do not restate the shape.
|
|
94311
|
-
*/
|
|
94312
|
-
var OverrideSourceSchema = object({
|
|
94313
|
-
addonId: string().min(1),
|
|
94314
|
-
stableId: string().min(1),
|
|
94315
|
-
cap: string().min(1),
|
|
94316
|
-
fieldPath: string().min(1)
|
|
94317
|
-
});
|
|
94318
|
-
var CustomizeTransformDraftSchema = discriminatedUnion("kind", [
|
|
94319
|
-
object({ kind: literal("identity") }),
|
|
94320
|
-
object({ kind: literal("invert") }),
|
|
94321
|
-
object({
|
|
94322
|
-
kind: literal("threshold"),
|
|
94323
|
-
comparison: _enum(["gte", "lte"]),
|
|
94324
|
-
threshold: number(),
|
|
94325
|
-
startDwellMs: number().nonnegative(),
|
|
94326
|
-
stopDwellMs: number().nonnegative()
|
|
94327
|
-
}),
|
|
94328
|
-
object({
|
|
94329
|
-
kind: literal("linear"),
|
|
94330
|
-
scale: number(),
|
|
94331
|
-
offset: number(),
|
|
94332
|
-
clampMin: number().optional(),
|
|
94333
|
-
clampMax: number().optional()
|
|
94334
|
-
}),
|
|
94335
|
-
object({
|
|
94336
|
-
kind: literal("enum-map"),
|
|
94337
|
-
mapping: record(string(), string().nullable())
|
|
94338
|
-
}),
|
|
94339
|
-
object({ kind: literal("number") })
|
|
94340
|
-
]);
|
|
94341
|
-
var ScalarOverrideDraftSchema = object({
|
|
94342
|
-
kind: literal("scalar"),
|
|
94343
|
-
cap: string().min(1),
|
|
94344
|
-
targetId: string().min(1),
|
|
94345
|
-
source: OverrideSourceSchema,
|
|
94346
|
-
transform: CustomizeTransformDraftSchema
|
|
94347
|
-
});
|
|
94348
|
-
var KeyedArrayOverrideDraftSchema = object({
|
|
94349
|
-
kind: literal("keyedArray"),
|
|
94350
|
-
cap: string().min(1),
|
|
94351
|
-
targetId: string().min(1),
|
|
94352
|
-
key: string().min(1),
|
|
94353
|
-
label: string().min(1),
|
|
94354
|
-
fieldPath: string().min(1),
|
|
94355
|
-
source: OverrideSourceSchema,
|
|
94356
|
-
transform: CustomizeTransformDraftSchema
|
|
94357
|
-
});
|
|
94358
|
-
var PulseOverrideDraftSchema = object({
|
|
94359
|
-
kind: literal("pulse"),
|
|
94360
|
-
cap: string().min(1),
|
|
94361
|
-
targetId: string().min(1),
|
|
94362
|
-
enabled: boolean(),
|
|
94363
|
-
debounceMs: number().nonnegative(),
|
|
94364
|
-
edges: array(_enum([
|
|
94365
|
-
"rising",
|
|
94366
|
-
"button",
|
|
94367
|
-
"native-event"
|
|
94368
|
-
])).min(1).optional(),
|
|
94369
|
-
sources: array(OverrideSourceSchema).min(1)
|
|
94370
|
-
});
|
|
94371
|
-
var SpanSourceDraftSchema = OverrideSourceSchema.extend({ mode: _enum([
|
|
94372
|
-
"in-addition",
|
|
94373
|
-
"confirm",
|
|
94374
|
-
"replace"
|
|
94375
|
-
]).optional() });
|
|
94376
|
-
discriminatedUnion("kind", [
|
|
94377
|
-
ScalarOverrideDraftSchema,
|
|
94378
|
-
KeyedArrayOverrideDraftSchema,
|
|
94379
|
-
PulseOverrideDraftSchema,
|
|
94380
|
-
object({
|
|
94381
|
-
kind: literal("span"),
|
|
94382
|
-
cap: string().min(1),
|
|
94383
|
-
targetId: string().min(1),
|
|
94384
|
-
timeoutMs: number().nonnegative(),
|
|
94385
|
-
cooldownMs: number().nonnegative().optional(),
|
|
94386
|
-
sources: array(SpanSourceDraftSchema)
|
|
94387
|
-
})
|
|
94388
|
-
]);
|
|
94389
|
-
object({
|
|
94390
|
-
targetId: string().min(1),
|
|
94391
|
-
configured: boolean(),
|
|
94392
|
-
source: _enum(["native", "assigned"]),
|
|
94393
|
-
state: _enum([
|
|
94394
|
-
"active",
|
|
94395
|
-
"stale",
|
|
94396
|
-
"released",
|
|
94397
|
-
"unavailable"
|
|
94398
|
-
]),
|
|
94399
|
-
reason: string().nullable()
|
|
94400
|
-
});
|
|
94401
95989
|
var G711_SCALE_CORRECTION_DB = {
|
|
94402
95990
|
PCMU: 20 * Math.log10(4),
|
|
94403
95991
|
PCMA: 20 * Math.log10(8)
|
|
@@ -95013,6 +96601,7 @@ var STATE_SUMMARY_VARS = [
|
|
|
95013
96601
|
[...RULE_TEXT],
|
|
95014
96602
|
([...RULE_TEXT], [...DEVICE_EVENTS]),
|
|
95015
96603
|
([...RULE_TEXT], [...COMBINED_ALARM]),
|
|
96604
|
+
([...RULE_TEXT], [...COMBINED_ALARM]),
|
|
95016
96605
|
([...RULE_TEXT], [...DEVICE_EVENTS]),
|
|
95017
96606
|
([...RULE_TEXT], [...BATTERY, ...CONSUMABLE]),
|
|
95018
96607
|
([...RULE_TEXT], [...CONSUMABLE]),
|
|
@@ -119909,6 +121498,83 @@ function buildCcuOverviewHandlers(deps) {
|
|
|
119909
121498
|
};
|
|
119910
121499
|
}
|
|
119911
121500
|
//#endregion
|
|
121501
|
+
//#region src/custom-actions.ts
|
|
121502
|
+
/**
|
|
121503
|
+
* Custom actions of the Homematic addon: the LAN scan behind the integration
|
|
121504
|
+
* form's CCU picker, and the CCU management page (`provider-homematic` admin
|
|
121505
|
+
* page). Reads are `query`; every CCU write is a `mutation` whose input carries
|
|
121506
|
+
* the operator's `confirmed` flag.
|
|
121507
|
+
*/
|
|
121508
|
+
var homematicActions = defineCustomActions({
|
|
121509
|
+
discoverCcu: customAction(object({}), object({
|
|
121510
|
+
hosts: array(object({
|
|
121511
|
+
host: string(),
|
|
121512
|
+
name: string(),
|
|
121513
|
+
id: string()
|
|
121514
|
+
})),
|
|
121515
|
+
summary: string()
|
|
121516
|
+
}), {
|
|
121517
|
+
kind: "mutation",
|
|
121518
|
+
auth: "admin"
|
|
121519
|
+
}),
|
|
121520
|
+
listCcus: customAction(object({}), array(CcuListItemSchema), {
|
|
121521
|
+
kind: "query",
|
|
121522
|
+
auth: "admin"
|
|
121523
|
+
}),
|
|
121524
|
+
ccuOverview: customAction(IntegrationRefSchema, CcuOverviewSchema, {
|
|
121525
|
+
kind: "query",
|
|
121526
|
+
auth: "admin"
|
|
121527
|
+
}),
|
|
121528
|
+
listServiceMessages: customAction(IntegrationRefSchema, ServiceMessagesResultSchema, {
|
|
121529
|
+
kind: "query",
|
|
121530
|
+
auth: "admin"
|
|
121531
|
+
}),
|
|
121532
|
+
listCcuDevices: customAction(IntegrationRefSchema, CcuDevicesResultSchema, {
|
|
121533
|
+
kind: "query",
|
|
121534
|
+
auth: "admin"
|
|
121535
|
+
}),
|
|
121536
|
+
listHeatingGroups: customAction(IntegrationRefSchema, HeatingOverviewSchema, {
|
|
121537
|
+
kind: "query",
|
|
121538
|
+
auth: "admin"
|
|
121539
|
+
}),
|
|
121540
|
+
createHeatingGroup: customAction(CreateGroupInputSchema, HeatingGroupSchema, {
|
|
121541
|
+
kind: "mutation",
|
|
121542
|
+
auth: "admin"
|
|
121543
|
+
}),
|
|
121544
|
+
updateHeatingGroup: customAction(UpdateGroupInputSchema, HeatingGroupSchema, {
|
|
121545
|
+
kind: "mutation",
|
|
121546
|
+
auth: "admin"
|
|
121547
|
+
}),
|
|
121548
|
+
deleteHeatingGroup: customAction(DeleteGroupInputSchema, OkResultSchema, {
|
|
121549
|
+
kind: "mutation",
|
|
121550
|
+
auth: "admin"
|
|
121551
|
+
}),
|
|
121552
|
+
ccuPairingStatus: customAction(IntegrationRefSchema, PairingStatusSchema, {
|
|
121553
|
+
kind: "query",
|
|
121554
|
+
auth: "admin"
|
|
121555
|
+
}),
|
|
121556
|
+
setCcuInstallMode: customAction(SetInstallModeInputSchema, OkResultSchema, {
|
|
121557
|
+
kind: "mutation",
|
|
121558
|
+
auth: "admin"
|
|
121559
|
+
}),
|
|
121560
|
+
deleteCcuDevice: customAction(DeleteCcuDeviceInputSchema, OkResultSchema, {
|
|
121561
|
+
kind: "mutation",
|
|
121562
|
+
auth: "admin"
|
|
121563
|
+
}),
|
|
121564
|
+
getCcuDeviceConfig: customAction(DeviceRefSchema, DeviceConfigSchema, {
|
|
121565
|
+
kind: "query",
|
|
121566
|
+
auth: "admin"
|
|
121567
|
+
}),
|
|
121568
|
+
setCcuChannelConfig: customAction(SetChannelConfigInputSchema, OkResultSchema, {
|
|
121569
|
+
kind: "mutation",
|
|
121570
|
+
auth: "admin"
|
|
121571
|
+
}),
|
|
121572
|
+
acknowledgeServiceMessage: customAction(AcknowledgeInputSchema, OkResultSchema, {
|
|
121573
|
+
kind: "mutation",
|
|
121574
|
+
auth: "admin"
|
|
121575
|
+
})
|
|
121576
|
+
});
|
|
121577
|
+
//#endregion
|
|
119912
121578
|
//#region src/callback-host.ts
|
|
119913
121579
|
/**
|
|
119914
121580
|
* Pick the hub LAN IPv4 a CCU at `ccuHost` can call back to. Prefers an
|
|
@@ -120175,83 +121841,170 @@ function buildConnectionFormSchema() {
|
|
|
120175
121841
|
}
|
|
120176
121842
|
] };
|
|
120177
121843
|
}
|
|
121844
|
+
var homematicConnectionsEntryKind = defineEntryKind("connections", {
|
|
121845
|
+
title: "Homematic CCUs",
|
|
121846
|
+
schema: entryBody({
|
|
121847
|
+
host: string().nullish(),
|
|
121848
|
+
enableHmipRf: boolean().nullish(),
|
|
121849
|
+
enableBidcosRf: boolean().nullish(),
|
|
121850
|
+
enableGroups: boolean().nullish(),
|
|
121851
|
+
enableBidcosWired: boolean().nullish(),
|
|
121852
|
+
username: string().nullish(),
|
|
121853
|
+
password: string().optional().meta({ secret: true }),
|
|
121854
|
+
callbackHost: string().nullish(),
|
|
121855
|
+
callbackPort: number().int().min(1).max(65535).nullish(),
|
|
121856
|
+
tls: boolean().nullish()
|
|
121857
|
+
}),
|
|
121858
|
+
writeTrigger: "an operator adds, edits or removes a Homematic CCU"
|
|
121859
|
+
});
|
|
121860
|
+
/** Every kind this addon declares, keyed by its name. */
|
|
121861
|
+
var homematicRecordKinds = { connections: homematicConnectionsEntryKind };
|
|
121862
|
+
/** The record body as the flat settings the connection schema parses: no name, no unset keys. */
|
|
121863
|
+
function connectionSettingsOf(body) {
|
|
121864
|
+
const out = {};
|
|
121865
|
+
for (const [key, value] of Object.entries(body)) {
|
|
121866
|
+
if (key === "name" || value === null || value === void 0) continue;
|
|
121867
|
+
out[key] = value;
|
|
121868
|
+
}
|
|
121869
|
+
return out;
|
|
121870
|
+
}
|
|
121871
|
+
function settingsReadOf(resolved) {
|
|
121872
|
+
return resolved === null ? {
|
|
121873
|
+
values: {},
|
|
121874
|
+
secretsLocked: false
|
|
121875
|
+
} : {
|
|
121876
|
+
values: connectionSettingsOf(resolved.body),
|
|
121877
|
+
secretsLocked: resolved.secrets === "unavailable"
|
|
121878
|
+
};
|
|
121879
|
+
}
|
|
121880
|
+
function buildHomematicInstances(records, deps) {
|
|
121881
|
+
return new RecordIntegrationInstances(records, homematicConnectionsEntryKind, {
|
|
121882
|
+
description: {
|
|
121883
|
+
role: "devices",
|
|
121884
|
+
discovery: {
|
|
121885
|
+
mode: "lan",
|
|
121886
|
+
scopedToInstance: false
|
|
121887
|
+
},
|
|
121888
|
+
instanceMode: "multiple",
|
|
121889
|
+
kind: "connection",
|
|
121890
|
+
canTest: false
|
|
121891
|
+
},
|
|
121892
|
+
formSchema: () => buildConnectionFormSchema(),
|
|
121893
|
+
initialBody: (name) => ({ name }),
|
|
121894
|
+
configured: (body) => (body.host ?? "").trim().length > 0,
|
|
121895
|
+
onChanged: () => deps.onChanged()
|
|
121896
|
+
});
|
|
121897
|
+
}
|
|
121898
|
+
/** The ONE reader of a CCU's connection: the integration's record, never the legacy rows. */
|
|
121899
|
+
async function readCcuConnection(instances, integrationId) {
|
|
121900
|
+
const read = settingsReadOf(await instances.readResolved(integrationId));
|
|
121901
|
+
return {
|
|
121902
|
+
connection: connectionFromSettings(read.values),
|
|
121903
|
+
secretsLocked: read.secretsLocked
|
|
121904
|
+
};
|
|
121905
|
+
}
|
|
121906
|
+
/** The hosts of the CCUs already set up, for discovery to leave out; an unreadable one is skipped. */
|
|
121907
|
+
async function knownCcuHostsOf(deps) {
|
|
121908
|
+
const hosts = [];
|
|
121909
|
+
for (const id of deps.integrationIds) try {
|
|
121910
|
+
const { connection } = await readCcuConnection(deps.instances, id);
|
|
121911
|
+
if (connection !== null) hosts.push(connection.host);
|
|
121912
|
+
} catch (err) {
|
|
121913
|
+
deps.onUnreadable(id, err);
|
|
121914
|
+
}
|
|
121915
|
+
return hosts;
|
|
121916
|
+
}
|
|
120178
121917
|
//#endregion
|
|
120179
|
-
//#region src/
|
|
121918
|
+
//#region src/migrations/integration-rows-to-record.ts
|
|
120180
121919
|
/**
|
|
120181
|
-
*
|
|
120182
|
-
*
|
|
120183
|
-
*
|
|
120184
|
-
*
|
|
121920
|
+
* Every Homematic integration moves from legacy `integration_settings` rows into its own
|
|
121921
|
+
* `connections` record under the registry id (planning#416, D1007): the CCU connection the live
|
|
121922
|
+
* session dials, the WebUI password a keychain secret declared by the kind. Each integration's
|
|
121923
|
+
* record is built from ITS OWN rows, never from another's. Only the integration configuration
|
|
121924
|
+
* moves: adopted devices, their stable ids and their history are not touched.
|
|
121925
|
+
*
|
|
121926
|
+
* Keys nothing reads any more are named in a warning, by key, and dropped with the rows once the
|
|
121927
|
+
* record has been read back; a value of the wrong type is left out and named by key as well.
|
|
120185
121928
|
*/
|
|
120186
|
-
var
|
|
120187
|
-
|
|
120188
|
-
|
|
120189
|
-
|
|
120190
|
-
|
|
120191
|
-
|
|
120192
|
-
|
|
120193
|
-
|
|
120194
|
-
|
|
120195
|
-
|
|
120196
|
-
|
|
120197
|
-
|
|
120198
|
-
|
|
120199
|
-
|
|
120200
|
-
|
|
120201
|
-
|
|
120202
|
-
|
|
120203
|
-
|
|
120204
|
-
|
|
120205
|
-
}
|
|
120206
|
-
|
|
120207
|
-
|
|
120208
|
-
|
|
120209
|
-
|
|
120210
|
-
|
|
120211
|
-
|
|
120212
|
-
|
|
120213
|
-
|
|
120214
|
-
|
|
120215
|
-
|
|
120216
|
-
|
|
120217
|
-
|
|
120218
|
-
|
|
120219
|
-
|
|
120220
|
-
|
|
120221
|
-
|
|
120222
|
-
|
|
120223
|
-
|
|
120224
|
-
|
|
120225
|
-
}
|
|
120226
|
-
|
|
120227
|
-
|
|
120228
|
-
|
|
120229
|
-
|
|
120230
|
-
|
|
120231
|
-
|
|
120232
|
-
|
|
120233
|
-
}
|
|
120234
|
-
|
|
120235
|
-
|
|
120236
|
-
|
|
120237
|
-
|
|
120238
|
-
|
|
120239
|
-
|
|
120240
|
-
|
|
120241
|
-
})
|
|
120242
|
-
|
|
120243
|
-
|
|
120244
|
-
|
|
120245
|
-
|
|
120246
|
-
|
|
120247
|
-
|
|
120248
|
-
|
|
120249
|
-
|
|
120250
|
-
|
|
120251
|
-
|
|
120252
|
-
|
|
121929
|
+
var HOMEMATIC_ROWS_TO_RECORD_ID = "provider-homematic/2026-11-05-integration-rows-to-record";
|
|
121930
|
+
var TEXT_KEYS = [
|
|
121931
|
+
"host",
|
|
121932
|
+
"username",
|
|
121933
|
+
"callbackHost"
|
|
121934
|
+
];
|
|
121935
|
+
var FLAG_KEYS = [
|
|
121936
|
+
"enableHmipRf",
|
|
121937
|
+
"enableBidcosRf",
|
|
121938
|
+
"enableGroups",
|
|
121939
|
+
"enableBidcosWired",
|
|
121940
|
+
"tls"
|
|
121941
|
+
];
|
|
121942
|
+
function portOf(value) {
|
|
121943
|
+
const n = typeof value === "string" && value.trim() !== "" ? Number(value) : value;
|
|
121944
|
+
return typeof n === "number" && Number.isInteger(n) && n >= 1 && n <= 65535 ? n : null;
|
|
121945
|
+
}
|
|
121946
|
+
/** The record body of one integration, from its resolved legacy rows. Never logs a value. */
|
|
121947
|
+
function homematicBodyFromRows(values, log, integration) {
|
|
121948
|
+
const body = { name: integration.name };
|
|
121949
|
+
const unusable = [];
|
|
121950
|
+
const known = new Set([
|
|
121951
|
+
"password",
|
|
121952
|
+
"callbackPort",
|
|
121953
|
+
...TEXT_KEYS,
|
|
121954
|
+
...FLAG_KEYS
|
|
121955
|
+
]);
|
|
121956
|
+
for (const key of TEXT_KEYS) {
|
|
121957
|
+
if (!(key in values)) continue;
|
|
121958
|
+
const raw = values[key];
|
|
121959
|
+
if (typeof raw === "string") {
|
|
121960
|
+
if (raw.trim() !== "") body[key] = raw.trim();
|
|
121961
|
+
} else unusable.push(key);
|
|
121962
|
+
}
|
|
121963
|
+
for (const key of FLAG_KEYS) {
|
|
121964
|
+
if (!(key in values)) continue;
|
|
121965
|
+
const raw = values[key];
|
|
121966
|
+
if (typeof raw === "boolean") body[key] = raw;
|
|
121967
|
+
else unusable.push(key);
|
|
121968
|
+
}
|
|
121969
|
+
if ("callbackPort" in values) {
|
|
121970
|
+
const raw = values["callbackPort"];
|
|
121971
|
+
if (raw !== "" && raw !== null) {
|
|
121972
|
+
const port = portOf(raw);
|
|
121973
|
+
if (port === null) unusable.push("callbackPort");
|
|
121974
|
+
else body["callbackPort"] = port;
|
|
121975
|
+
}
|
|
121976
|
+
}
|
|
121977
|
+
if ("password" in values) {
|
|
121978
|
+
const password = values["password"];
|
|
121979
|
+
if (typeof password === "string") {
|
|
121980
|
+
if (password.length > 0) body["password"] = password;
|
|
121981
|
+
} else unusable.push("password");
|
|
121982
|
+
}
|
|
121983
|
+
const unknown = Object.keys(values).filter((key) => !known.has(key));
|
|
121984
|
+
if (unknown.length > 0) log.warn(`integration '${integration.id}': legacy settings nothing reads any more are dropped: ${unknown.join(", ")}`);
|
|
121985
|
+
if (unusable.length > 0) log.warn(`integration '${integration.id}': legacy settings with an unusable value are left out: ${unusable.join(", ")}`);
|
|
121986
|
+
return homematicConnectionsEntryKind.schema.parse(body);
|
|
121987
|
+
}
|
|
121988
|
+
var HOMEMATIC_ROWS_TO_RECORD_MIGRATION = {
|
|
121989
|
+
meta: {
|
|
121990
|
+
id: HOMEMATIC_ROWS_TO_RECORD_ID,
|
|
121991
|
+
owner: "provider-homematic",
|
|
121992
|
+
level: "addon-state",
|
|
121993
|
+
seq: 1,
|
|
121994
|
+
dependsOn: [],
|
|
121995
|
+
store: "settings",
|
|
121996
|
+
scope: "cluster",
|
|
121997
|
+
onFailure: "block-owner",
|
|
121998
|
+
bodyKind: "procedure",
|
|
121999
|
+
description: "Move every Homematic CCU integration into its own connection record keyed by its registry id, the WebUI password as a keychain secret, then clear its legacy integration settings rows; adopted devices are not touched",
|
|
122000
|
+
fixtureMark: "a legacy setting key the migration does not know"
|
|
122001
|
+
},
|
|
122002
|
+
procedure: (ports) => moveIntegrationRowsToRecords(ports, {
|
|
122003
|
+
addonId: "provider-homematic",
|
|
122004
|
+
secretPaths: homematicConnectionsEntryKind.declaration.secretPaths,
|
|
122005
|
+
bodyFrom: homematicBodyFromRows
|
|
120253
122006
|
})
|
|
120254
|
-
}
|
|
122007
|
+
};
|
|
120255
122008
|
//#endregion
|
|
120256
122009
|
//#region src/homematic-facade-resolver.ts
|
|
120257
122010
|
/**
|
|
@@ -123782,11 +125535,26 @@ var HomematicProviderAddon = class extends BaseDeviceProvider {
|
|
|
123782
125535
|
/** Live per-integration CCU sessions, or null before init / after shutdown. */
|
|
123783
125536
|
integrationReconciler = null;
|
|
123784
125537
|
clients = null;
|
|
125538
|
+
instances = null;
|
|
123785
125539
|
constructor() {
|
|
123786
125540
|
super({});
|
|
123787
125541
|
}
|
|
123788
125542
|
async onInitialize() {
|
|
123789
125543
|
const regs = this.providerRegistrationsFromSuper(await super.onInitialize());
|
|
125544
|
+
const records = this.ctx.records;
|
|
125545
|
+
if (records === void 0) throw new Error("provider-homematic: ctx.records is required (hub-only addon)");
|
|
125546
|
+
await records.declare(homematicRecordKinds);
|
|
125547
|
+
const instances = buildHomematicInstances(records, { onChanged: () => this.reconcileIntegrations() });
|
|
125548
|
+
this.instances = instances;
|
|
125549
|
+
await this.runMigrations(defineAddonMigrations([HOMEMATIC_ROWS_TO_RECORD_MIGRATION], integrationRowsPortsOverApi({
|
|
125550
|
+
api: defaultIntegrationApiOver(this.ctx.api),
|
|
125551
|
+
records: records.kind({
|
|
125552
|
+
name: homematicConnectionsEntryKind.name,
|
|
125553
|
+
declaration: homematicConnectionsEntryKind.declaration,
|
|
125554
|
+
schema: record(string(), unknown())
|
|
125555
|
+
}),
|
|
125556
|
+
log: { warn: (message) => this.ctx.logger.warn(message) }
|
|
125557
|
+
})));
|
|
123790
125558
|
this.clients = new HmClientRegistry(this.ctx.logger);
|
|
123791
125559
|
this.clients.setOnConnected((integrationId) => {
|
|
123792
125560
|
this.ctx.logger.info("Homematic: CCU connected", { meta: { integrationId } });
|
|
@@ -123802,6 +125570,10 @@ var HomematicProviderAddon = class extends BaseDeviceProvider {
|
|
|
123802
125570
|
return {
|
|
123803
125571
|
providers: [
|
|
123804
125572
|
...regs,
|
|
125573
|
+
{
|
|
125574
|
+
capability: integrationInstancesCapability,
|
|
125575
|
+
provider: instances.toProvider()
|
|
125576
|
+
},
|
|
123805
125577
|
{
|
|
123806
125578
|
capability: deviceAdoptionCapability,
|
|
123807
125579
|
provider: this.buildAdoptionProvider()
|
|
@@ -123875,8 +125647,9 @@ var HomematicProviderAddon = class extends BaseDeviceProvider {
|
|
|
123875
125647
|
homematicFacades.clear();
|
|
123876
125648
|
await super.onShutdown();
|
|
123877
125649
|
}
|
|
123878
|
-
|
|
123879
|
-
|
|
125650
|
+
requireInstances() {
|
|
125651
|
+
if (!this.instances) throw new Error("Homematic provider not initialised");
|
|
125652
|
+
return this.instances;
|
|
123880
125653
|
}
|
|
123881
125654
|
/**
|
|
123882
125655
|
* Stable id, integration-scoped so two CCUs exposing the same device address
|
|
@@ -123923,20 +125696,14 @@ var HomematicProviderAddon = class extends BaseDeviceProvider {
|
|
|
123923
125696
|
async knownCcuHosts() {
|
|
123924
125697
|
try {
|
|
123925
125698
|
const all = await this.ctx.api.integrations.list.query();
|
|
123926
|
-
|
|
123927
|
-
|
|
123928
|
-
|
|
123929
|
-
|
|
123930
|
-
|
|
123931
|
-
|
|
123932
|
-
}
|
|
123933
|
-
|
|
123934
|
-
tags: { integrationId: integration.id },
|
|
123935
|
-
meta: { error: errMsg(err) }
|
|
123936
|
-
});
|
|
123937
|
-
}
|
|
123938
|
-
}
|
|
123939
|
-
return hosts;
|
|
125699
|
+
return await knownCcuHostsOf({
|
|
125700
|
+
instances: this.requireInstances(),
|
|
125701
|
+
integrationIds: all.filter((i) => i.addonId === this.ctx.id).map((i) => i.id),
|
|
125702
|
+
onUnreadable: (integrationId, err) => this.ctx.logger.warn("Homematic discovery: settings read failed", {
|
|
125703
|
+
tags: { integrationId },
|
|
125704
|
+
meta: { error: errMsg(err) }
|
|
125705
|
+
})
|
|
125706
|
+
});
|
|
123940
125707
|
} catch (err) {
|
|
123941
125708
|
this.ctx.logger.warn("Homematic discovery: integration list failed", { meta: { error: errMsg(err) } });
|
|
123942
125709
|
return [];
|
|
@@ -123991,8 +125758,8 @@ var HomematicProviderAddon = class extends BaseDeviceProvider {
|
|
|
123991
125758
|
},
|
|
123992
125759
|
listIntegrations: () => this.ctx.api.integrations.list.query(),
|
|
123993
125760
|
applySettings: async (integration) => {
|
|
123994
|
-
const connection =
|
|
123995
|
-
if (!connection) return false;
|
|
125761
|
+
const { connection, secretsLocked } = await readCcuConnection(this.requireInstances(), integration.id);
|
|
125762
|
+
if (secretsLocked || !connection) return false;
|
|
123996
125763
|
await this.requireClients().upsert(integration.id, integration.name, connection);
|
|
123997
125764
|
return true;
|
|
123998
125765
|
},
|