@camstack/server 1.2.724 → 1.2.726
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/package.json +10 -6
- package/system/dist/addon-runner.js +69 -57
- package/system/dist/addon-runner.mjs +69 -57
- package/system/dist/addon-utils.mjs +1 -1
- package/system/dist/{agent-https-DslXCDRW.js → agent-https-BnvFHfIE.js} +1 -1
- package/system/dist/{agent-https-BMbnmX5u.mjs → agent-https-D0cOTQNv.mjs} +1 -1
- package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
- package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +4 -4
- package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
- package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +5 -5
- package/system/dist/builtins/alerts/alerts.addon.js +1 -1
- package/system/dist/builtins/alerts/alerts.addon.mjs +1 -1
- package/system/dist/builtins/autotrack/index.js +1 -1
- package/system/dist/builtins/autotrack/index.mjs +1 -1
- package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +2 -2
- package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +5 -5
- package/system/dist/builtins/calendars/calendars.addon.js +1 -1
- package/system/dist/builtins/calendars/calendars.addon.mjs +1 -1
- package/system/dist/builtins/camera-grid/index.js +1 -1
- package/system/dist/builtins/camera-grid/index.mjs +1 -1
- package/system/dist/builtins/composer/composer.addon.js +3 -3
- package/system/dist/builtins/composer/composer.addon.mjs +3 -3
- package/system/dist/builtins/console-logging/index.js +1 -1
- package/system/dist/builtins/console-logging/index.mjs +1 -1
- package/system/dist/builtins/core-blocks/core-blocks.addon.js +3 -3
- package/system/dist/builtins/core-blocks/core-blocks.addon.mjs +3 -3
- package/system/dist/builtins/core-blocks/power-source-service.d.ts +1 -1
- package/system/dist/builtins/device-history/device-history.addon.js +2 -2
- package/system/dist/builtins/device-history/device-history.addon.mjs +2 -2
- package/system/dist/builtins/device-manager/device-manager.addon.js +1 -1
- package/system/dist/builtins/device-manager/device-manager.addon.mjs +1 -1
- package/system/dist/builtins/hub-forwarder/index.js +1 -1
- package/system/dist/builtins/hub-forwarder/index.mjs +1 -1
- package/system/dist/builtins/keychain/index.js +3 -3
- package/system/dist/builtins/keychain/index.mjs +3 -3
- package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
- package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
- package/system/dist/builtins/local-auth/local-auth.addon.js +2 -2
- package/system/dist/builtins/local-auth/local-auth.addon.mjs +5 -5
- package/system/dist/builtins/local-network/local-network.addon.js +2 -2
- package/system/dist/builtins/local-network/local-network.addon.mjs +2 -2
- package/system/dist/builtins/loki-logging/index.js +1 -1
- package/system/dist/builtins/loki-logging/index.mjs +1 -1
- package/system/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
- package/system/dist/builtins/native-metrics/native-metrics.addon.mjs +10 -10
- package/system/dist/builtins/platform-probe/index.js +1 -1
- package/system/dist/builtins/platform-probe/index.mjs +10 -10
- package/system/dist/builtins/record-entries/index.js +1 -1
- package/system/dist/builtins/record-entries/index.mjs +1 -1
- package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
- package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
- package/system/dist/builtins/snapshot/index.js +1 -1
- package/system/dist/builtins/snapshot/index.mjs +1 -1
- package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
- package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +20 -20
- package/system/dist/builtins/sqlite-storage/index.js +1 -1
- package/system/dist/builtins/sqlite-storage/index.mjs +1 -1
- package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.js +2 -2
- package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +2 -2
- package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +1 -1
- package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +1 -1
- package/system/dist/builtins/system-config/system-config.addon.js +3 -3
- package/system/dist/builtins/system-config/system-config.addon.mjs +115 -115
- package/system/dist/builtins/winston-logging/index.js +1 -1
- package/system/dist/builtins/winston-logging/index.mjs +1 -1
- package/system/dist/{composition-sources-EXNuxmGQ.mjs → composition-sources-9gWI1PaJ.mjs} +1 -1
- package/system/dist/{composition-sources-C14epb_m.js → composition-sources-Csn9vigy.js} +1 -1
- package/system/dist/{constants-M7NtSiRo.js → constants-BUBTFwBx.js} +1 -1
- package/system/dist/{constants-DIGWBiNC.mjs → constants-DXemqoYD.mjs} +1 -1
- package/system/dist/{coral-accelerators-DBlgWB8k.mjs → coral-accelerators-BW3OcrLD.mjs} +6 -6
- package/system/dist/{custom-action-registry-oHl1xltx.mjs → custom-action-registry-BIJZBObd.mjs} +37 -37
- package/system/dist/{device-ca-3vmBP1i0.js → device-ca-BBWsIjrt.js} +1 -1
- package/system/dist/{device-ca-DZlvNBWU.mjs → device-ca-mHcd1YH_.mjs} +1 -1
- package/system/dist/{dist-DcMqHB_N.mjs → dist-AYmnm-Kz.mjs} +256 -184
- package/system/dist/{dist-M9yHiIY7.js → dist-D4jIqIYT.js} +256 -184
- package/system/dist/file-host-worker.js +1 -1
- package/system/dist/file-host-worker.mjs +1 -1
- package/system/dist/{hub-mdns-ciao-CpCKuQnK.js → hub-mdns-ciao-Cl258gjr.js} +2 -2
- package/system/dist/{hub-mdns-ciao-Czz2ssit.mjs → hub-mdns-ciao-Cx91p2V7.mjs} +2 -2
- package/system/dist/index.js +76 -64
- package/system/dist/index.mjs +293 -281
- package/system/dist/{restore-archive-Cy7jGqiD.js → restore-archive-DIU_NCSx.js} +1 -1
- package/system/dist/{restore-archive-DS4nvQ43.mjs → restore-archive-DebhY_Mj.mjs} +94 -94
- package/system/dist/{retention-Dqm_EiVq.mjs → retention-CI5_Tvdn.mjs} +1 -1
- package/system/dist/{retention-Ufa2fci-.js → retention-D0GH1QcS.js} +1 -1
- package/system/dist/{wal-maintenance-BmugbgS7.js → wal-maintenance-BA0MvGtU.js} +0 -0
- package/system/dist/{wal-maintenance-Bnb2QzYG.mjs → wal-maintenance-CJKZ2zXS.mjs} +0 -0
- package/system/package.json +1 -1
|
@@ -7942,7 +7942,7 @@ function sleep(ms) {
|
|
|
7942
7942
|
return new Promise((resolve) => setTimeout(resolve, Math.max(0, ms)));
|
|
7943
7943
|
}
|
|
7944
7944
|
//#endregion
|
|
7945
|
-
//#region ../types/dist/composition-
|
|
7945
|
+
//#region ../types/dist/composition-BiKWlUCc.mjs
|
|
7946
7946
|
var AUDIO_ENCODER_BY_CODEC = {
|
|
7947
7947
|
opus: "libopus",
|
|
7948
7948
|
aac: "aac",
|
|
@@ -10184,7 +10184,15 @@ var ApplianceHelperSpecSchema = z.object({
|
|
|
10184
10184
|
thresholdWatts: z.number().positive(),
|
|
10185
10185
|
startDwellMs: z.number().int().nonnegative(),
|
|
10186
10186
|
stopDwellMs: z.number().int().nonnegative(),
|
|
10187
|
-
member: HelperMemberSchema
|
|
10187
|
+
member: HelperMemberSchema,
|
|
10188
|
+
/**
|
|
10189
|
+
* The plug that powers the appliance (`switch.on`). Optional: when set, the
|
|
10190
|
+
* composition carries a `power-source` feature, so the hub can cut and restore
|
|
10191
|
+
* that plug (power-source link of a NEW-target composition).
|
|
10192
|
+
*/
|
|
10193
|
+
powerSwitch: HelperMemberSchema.optional(),
|
|
10194
|
+
/** How long a forced restart keeps the plug off; the cap's default when unset. */
|
|
10195
|
+
offSeconds: z.number().optional()
|
|
10188
10196
|
});
|
|
10189
10197
|
var statisticHelperObject = z.object({
|
|
10190
10198
|
kind: z.literal("statistic"),
|
|
@@ -47887,7 +47895,7 @@ var CAP_CUSTOMIZE_CATALOG = {
|
|
|
47887
47895
|
kind: "constant",
|
|
47888
47896
|
path: "phase",
|
|
47889
47897
|
value: null,
|
|
47890
|
-
when: "
|
|
47898
|
+
when: "add"
|
|
47891
47899
|
},
|
|
47892
47900
|
{
|
|
47893
47901
|
kind: "clock",
|
|
@@ -47900,6 +47908,10 @@ var CAP_CUSTOMIZE_CATALOG = {
|
|
|
47900
47908
|
sourceChangedAt: "prefer"
|
|
47901
47909
|
}
|
|
47902
47910
|
]
|
|
47911
|
+
}],
|
|
47912
|
+
overridable: [{
|
|
47913
|
+
path: "running",
|
|
47914
|
+
by: "running"
|
|
47903
47915
|
}]
|
|
47904
47916
|
}
|
|
47905
47917
|
};
|
|
@@ -48876,6 +48888,165 @@ var BY_ID = new Map(GROUP_TEMPLATES.map((template) => [template.id, template]));
|
|
|
48876
48888
|
function groupTemplate(id) {
|
|
48877
48889
|
return BY_ID.get(id) ?? null;
|
|
48878
48890
|
}
|
|
48891
|
+
var PowerSourceRefusalReasonSchema = z.enum([
|
|
48892
|
+
"no-power-source",
|
|
48893
|
+
"switch-missing",
|
|
48894
|
+
"switch-offline",
|
|
48895
|
+
"switch-unknown",
|
|
48896
|
+
"restart-in-progress",
|
|
48897
|
+
"switch-call-failed"
|
|
48898
|
+
]);
|
|
48899
|
+
var PowerSourceActionResultSchema = z.discriminatedUnion("accepted", [z.object({ accepted: z.literal(true) }), z.object({
|
|
48900
|
+
accepted: z.literal(false),
|
|
48901
|
+
reason: PowerSourceRefusalReasonSchema,
|
|
48902
|
+
/** One line for the operator, naming the switch. */
|
|
48903
|
+
message: z.string()
|
|
48904
|
+
})]);
|
|
48905
|
+
var PowerSourceInfoSchema = z.object({
|
|
48906
|
+
/** False when the device has no power source linked; the rest is then empty. */
|
|
48907
|
+
linked: z.boolean(),
|
|
48908
|
+
switchDeviceId: z.number().nullable(),
|
|
48909
|
+
switchName: z.string().nullable(),
|
|
48910
|
+
/** The switch's on/off state, or null when it is unknown. Never false for unknown (D393). */
|
|
48911
|
+
switchOn: z.boolean().nullable(),
|
|
48912
|
+
switchOnline: z.boolean().nullable(),
|
|
48913
|
+
restartInProgress: z.boolean(),
|
|
48914
|
+
offSeconds: z.number().int()
|
|
48915
|
+
});
|
|
48916
|
+
/** The composed slice: the switch state the link mirrors, plus the stored off time. */
|
|
48917
|
+
var PowerSourceStateSchema = z.object({
|
|
48918
|
+
/** Null while the switch has not reported: unknown is never `false` (D393). */
|
|
48919
|
+
switchOn: z.boolean().nullable(),
|
|
48920
|
+
offSeconds: z.number().int(),
|
|
48921
|
+
lastFetchedAt: z.number()
|
|
48922
|
+
});
|
|
48923
|
+
var POWER_SOURCE_DEVICE_TYPES = [
|
|
48924
|
+
DeviceType.Gateway,
|
|
48925
|
+
DeviceType.Hub,
|
|
48926
|
+
DeviceType.Camera,
|
|
48927
|
+
DeviceType.Sensor,
|
|
48928
|
+
DeviceType.MediaPlayer,
|
|
48929
|
+
DeviceType.Vacuum,
|
|
48930
|
+
DeviceType.Generic,
|
|
48931
|
+
DeviceType.Washer,
|
|
48932
|
+
DeviceType.Dryer,
|
|
48933
|
+
DeviceType.Dishwasher,
|
|
48934
|
+
DeviceType.PetFountain,
|
|
48935
|
+
DeviceType.Fan,
|
|
48936
|
+
DeviceType.Humidifier,
|
|
48937
|
+
DeviceType.Climate,
|
|
48938
|
+
DeviceType.WaterHeater
|
|
48939
|
+
];
|
|
48940
|
+
var powerSourceCustomize = {
|
|
48941
|
+
version: 1,
|
|
48942
|
+
targets: [{
|
|
48943
|
+
id: "switch",
|
|
48944
|
+
cardinality: "scalar",
|
|
48945
|
+
vocabulary: {
|
|
48946
|
+
cap: "power-source",
|
|
48947
|
+
stateField: "switchOn"
|
|
48948
|
+
},
|
|
48949
|
+
deviceTypes: POWER_SOURCE_DEVICE_TYPES,
|
|
48950
|
+
apply: "add",
|
|
48951
|
+
path: "switchOn",
|
|
48952
|
+
sources: [{
|
|
48953
|
+
kind: "switch",
|
|
48954
|
+
transforms: [{ kind: "identity" }]
|
|
48955
|
+
}],
|
|
48956
|
+
companions: [{
|
|
48957
|
+
kind: "constant",
|
|
48958
|
+
path: "offSeconds",
|
|
48959
|
+
value: 10,
|
|
48960
|
+
when: "add"
|
|
48961
|
+
}, {
|
|
48962
|
+
kind: "clock",
|
|
48963
|
+
path: "lastFetchedAt",
|
|
48964
|
+
when: "always"
|
|
48965
|
+
}],
|
|
48966
|
+
sourceReport: { status: "assignment-status" }
|
|
48967
|
+
}]
|
|
48968
|
+
};
|
|
48969
|
+
var deviceInput$1 = z.object({ deviceId: z.number().int().nonnegative() });
|
|
48970
|
+
var powerSourceCapability = {
|
|
48971
|
+
name: "power-source",
|
|
48972
|
+
scope: "device",
|
|
48973
|
+
mode: "singleton",
|
|
48974
|
+
deviceTypes: POWER_SOURCE_DEVICE_TYPES,
|
|
48975
|
+
methods: {
|
|
48976
|
+
getStatus: systemMethod(deviceInput$1, PowerSourceInfoSchema, { auth: "admin" }),
|
|
48977
|
+
powerOn: systemMethod(deviceInput$1, PowerSourceActionResultSchema, {
|
|
48978
|
+
kind: "mutation",
|
|
48979
|
+
auth: "admin"
|
|
48980
|
+
}),
|
|
48981
|
+
powerOff: systemMethod(deviceInput$1, PowerSourceActionResultSchema, {
|
|
48982
|
+
kind: "mutation",
|
|
48983
|
+
auth: "admin"
|
|
48984
|
+
}),
|
|
48985
|
+
forceRestart: systemMethod(deviceInput$1, PowerSourceActionResultSchema, {
|
|
48986
|
+
kind: "mutation",
|
|
48987
|
+
auth: "admin"
|
|
48988
|
+
})
|
|
48989
|
+
},
|
|
48990
|
+
runtimeState: PowerSourceStateSchema,
|
|
48991
|
+
customize: powerSourceCustomize,
|
|
48992
|
+
/**
|
|
48993
|
+
* Runtime-state durability: **session** — mirrored from the linked switch on
|
|
48994
|
+
* its next report; a restored value would outlive the reading it names.
|
|
48995
|
+
*
|
|
48996
|
+
* See `RuntimeStateDurability`. Enforced by
|
|
48997
|
+
* `scripts/check-runtime-state-durability.ts`.
|
|
48998
|
+
*/
|
|
48999
|
+
durability: "session",
|
|
49000
|
+
history: "none"
|
|
49001
|
+
};
|
|
49002
|
+
/**
|
|
49003
|
+
* Which smart switch powers a device (the `power-source` Customize extension):
|
|
49004
|
+
* the source its stored `power-source.switchOn` field reads, and the off time of
|
|
49005
|
+
* a forced restart stored beside it. Read from the STORED composition, never kept
|
|
49006
|
+
* as a second copy (D676). Shared by the hub (which acts on the switch) and the
|
|
49007
|
+
* admin UI (which shows it).
|
|
49008
|
+
*/
|
|
49009
|
+
/**
|
|
49010
|
+
* The stored off time, or the default when none is stored. A stored number out
|
|
49011
|
+
* of range is CLAMPED to the bounds (a hand-written value never refuses the
|
|
49012
|
+
* link, it just cannot cut power for an absurd time); a non-integer is rounded.
|
|
49013
|
+
*/
|
|
49014
|
+
function normalizeOffSeconds(value) {
|
|
49015
|
+
if (typeof value !== "number" || !Number.isFinite(value)) return 10;
|
|
49016
|
+
return Math.min(120, Math.max(3, Math.round(value)));
|
|
49017
|
+
}
|
|
49018
|
+
/** The constant a stored `offSeconds` field carries, or undefined when it is not a literal number. */
|
|
49019
|
+
function storedOffSeconds(composition) {
|
|
49020
|
+
const feature = composition.features.find((f) => f.cap === "power-source");
|
|
49021
|
+
if (feature === void 0 || feature.kind !== "fields") return void 0;
|
|
49022
|
+
const field = feature.fields["offSeconds"];
|
|
49023
|
+
if (field === void 0 || field.kind !== "expression") return void 0;
|
|
49024
|
+
const n = Number(field.expr);
|
|
49025
|
+
return field.expr.trim() === "" || !Number.isFinite(n) ? void 0 : n;
|
|
49026
|
+
}
|
|
49027
|
+
/**
|
|
49028
|
+
* The link a composition stores. An `existing` target names its own device; a
|
|
49029
|
+
* `new` target (an appliance helper) is the composer's own device, so the caller
|
|
49030
|
+
* passes the block id and a new-target composition without one has no link.
|
|
49031
|
+
*/
|
|
49032
|
+
function powerSourceLinkOfComposition(composition, blockId) {
|
|
49033
|
+
if (composition === null) return null;
|
|
49034
|
+
let device;
|
|
49035
|
+
if (composition.target.kind === "existing") device = composition.target.device;
|
|
49036
|
+
else if (blockId !== void 0) device = composedDeviceRef(blockId);
|
|
49037
|
+
else return null;
|
|
49038
|
+
const feature = composition.features.find((f) => f.cap === "power-source");
|
|
49039
|
+
if (feature === void 0 || feature.kind !== "fields" || feature.enabled === false) return null;
|
|
49040
|
+
const field = feature.fields["switchOn"];
|
|
49041
|
+
if (field === void 0) return null;
|
|
49042
|
+
const read = fieldReads(field).find((r) => r.cap === "switch");
|
|
49043
|
+
if (read === void 0) return null;
|
|
49044
|
+
return {
|
|
49045
|
+
device,
|
|
49046
|
+
switch: read.source,
|
|
49047
|
+
offSeconds: normalizeOffSeconds(storedOffSeconds(composition))
|
|
49048
|
+
};
|
|
49049
|
+
}
|
|
48879
49050
|
var UNSIGNED = /^\d+(?:\.\d+)?$/;
|
|
48880
49051
|
var SIGNED = /^-?\d+(?:\.\d+)?$/;
|
|
48881
49052
|
var IDENT = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
@@ -49652,6 +49823,10 @@ function expressionDraft(spec) {
|
|
|
49652
49823
|
draft: spec.output === "boolean" ? binarySensor(spec, source) : numericSensor(spec, source)
|
|
49653
49824
|
};
|
|
49654
49825
|
}
|
|
49826
|
+
/**
|
|
49827
|
+
* Project a helper spec onto the composition the composer already runs (D944).
|
|
49828
|
+
* Pure: it stores nothing. A group does not compile to `avg(...)` / `any(...)`.
|
|
49829
|
+
*/
|
|
49655
49830
|
function sameSource(a, b) {
|
|
49656
49831
|
return a.addonId === b.addonId && a.stableId === b.stableId;
|
|
49657
49832
|
}
|
|
@@ -49749,6 +49924,11 @@ function compileAppliance(spec) {
|
|
|
49749
49924
|
ok: false,
|
|
49750
49925
|
problems: [problem("member-constraint", "helper.member", "an appliance helper reads power-meter.power")]
|
|
49751
49926
|
};
|
|
49927
|
+
const powerSwitch = spec.powerSwitch;
|
|
49928
|
+
if (powerSwitch !== void 0 && (powerSwitch.cap !== "switch" || powerSwitch.fieldPath !== "on")) return {
|
|
49929
|
+
ok: false,
|
|
49930
|
+
problems: [problem("member-constraint", "helper.powerSwitch", "the power plug of an appliance helper is a switch, read at switch.on")]
|
|
49931
|
+
};
|
|
49752
49932
|
const threshold = unsignedToken(spec.thresholdWatts);
|
|
49753
49933
|
const start = unsignedToken(spec.startDwellMs);
|
|
49754
49934
|
const stop = unsignedToken(spec.stopDwellMs);
|
|
@@ -49768,30 +49948,48 @@ function compileAppliance(spec) {
|
|
|
49768
49948
|
};
|
|
49769
49949
|
const dwell = dwellExpr("gte", threshold, start, stop);
|
|
49770
49950
|
const clock = expressionSource("now");
|
|
49951
|
+
const powerSourceFeatures = powerSwitch === void 0 ? [] : [{
|
|
49952
|
+
kind: "fields",
|
|
49953
|
+
cap: "power-source",
|
|
49954
|
+
fields: {
|
|
49955
|
+
switchOn: {
|
|
49956
|
+
kind: "from",
|
|
49957
|
+
source: powerSwitch.source,
|
|
49958
|
+
cap: powerSwitch.cap,
|
|
49959
|
+
fieldPath: powerSwitch.fieldPath
|
|
49960
|
+
},
|
|
49961
|
+
offSeconds: expressionSource(String(normalizeOffSeconds(spec.offSeconds))),
|
|
49962
|
+
lastFetchedAt: clock
|
|
49963
|
+
}
|
|
49964
|
+
}];
|
|
49771
49965
|
return parseDraft({
|
|
49772
49966
|
target: {
|
|
49773
49967
|
kind: "new",
|
|
49774
49968
|
type: applianceDeviceType(spec.appliance)
|
|
49775
49969
|
},
|
|
49776
49970
|
helper: spec,
|
|
49777
|
-
features: [
|
|
49778
|
-
|
|
49779
|
-
|
|
49780
|
-
|
|
49781
|
-
|
|
49782
|
-
|
|
49783
|
-
|
|
49784
|
-
|
|
49785
|
-
|
|
49786
|
-
|
|
49787
|
-
|
|
49788
|
-
|
|
49789
|
-
|
|
49790
|
-
|
|
49791
|
-
|
|
49792
|
-
|
|
49793
|
-
|
|
49794
|
-
|
|
49971
|
+
features: [
|
|
49972
|
+
{
|
|
49973
|
+
kind: "fields",
|
|
49974
|
+
cap: "running-state",
|
|
49975
|
+
fields: {
|
|
49976
|
+
running: expressionSource(dwell, { x: read }),
|
|
49977
|
+
source: expressionSource("\"assigned\""),
|
|
49978
|
+
phase: expressionSource("null"),
|
|
49979
|
+
lastFetchedAt: clock,
|
|
49980
|
+
since: expressionSource(`latchedAt(${dwell})`, { x: read })
|
|
49981
|
+
}
|
|
49982
|
+
},
|
|
49983
|
+
{
|
|
49984
|
+
kind: "fields",
|
|
49985
|
+
cap: "power-meter",
|
|
49986
|
+
fields: {
|
|
49987
|
+
power: read,
|
|
49988
|
+
lastFetchedAt: clock
|
|
49989
|
+
}
|
|
49990
|
+
},
|
|
49991
|
+
...powerSourceFeatures
|
|
49992
|
+
]
|
|
49795
49993
|
});
|
|
49796
49994
|
}
|
|
49797
49995
|
/** Compile a helper template to a new-device composition. Refusals are named. */
|
|
@@ -50263,7 +50461,11 @@ var customizeCatalog = CAP_CUSTOMIZE_CATALOG;
|
|
|
50263
50461
|
* the catalog. No items, no commands, no field outside the list; no cap is named.
|
|
50264
50462
|
*/
|
|
50265
50463
|
function overridesOnlyDeclared(feature) {
|
|
50266
|
-
const
|
|
50464
|
+
const entry = customizeCatalog[feature.cap];
|
|
50465
|
+
const allowed = new Set((entry?.overridable ?? []).flatMap((o) => {
|
|
50466
|
+
const companions = ((entry?.targets.find((t) => t.id === o.by && t.path === o.path))?.companions ?? []).filter((c) => c.kind === "transition-time" || c.when === "always");
|
|
50467
|
+
return [o.path, ...companions.map((c) => c.path)];
|
|
50468
|
+
}));
|
|
50267
50469
|
const paths = Object.keys(feature.fields);
|
|
50268
50470
|
return paths.length > 0 && paths.every((path) => allowed.has(path)) && feature.items === void 0 && feature.commands === void 0;
|
|
50269
50471
|
}
|
|
@@ -58880,7 +59082,8 @@ var PALETTE_ENTRY_IDS = [
|
|
|
58880
59082
|
"switch",
|
|
58881
59083
|
"siren",
|
|
58882
59084
|
"button",
|
|
58883
|
-
"doorbell"
|
|
59085
|
+
"doorbell",
|
|
59086
|
+
"appliance-cycle"
|
|
58884
59087
|
];
|
|
58885
59088
|
var AUDIO_ENTRY_ID = "audio";
|
|
58886
59089
|
/** Six rungs, quiet → loud. The opaque end is the entry's hex. */
|
|
@@ -58951,7 +59154,8 @@ var CAMSTACK_HEX = {
|
|
|
58951
59154
|
switch: "#7a812a",
|
|
58952
59155
|
siren: "#ac5d7f",
|
|
58953
59156
|
button: "#b276cd",
|
|
58954
|
-
doorbell: "#0087ab"
|
|
59157
|
+
doorbell: "#0087ab",
|
|
59158
|
+
"appliance-cycle": "#2a8c8c"
|
|
58955
59159
|
};
|
|
58956
59160
|
var CAMSTACK_FALLBACK = [
|
|
58957
59161
|
"#b34dc7",
|
|
@@ -59016,7 +59220,8 @@ var HIGH_CONTRAST_HEX = {
|
|
|
59016
59220
|
switch: "#d05259",
|
|
59017
59221
|
siren: "#cd67b3",
|
|
59018
59222
|
button: "#c9746a",
|
|
59019
|
-
doorbell: "#338eeb"
|
|
59223
|
+
doorbell: "#338eeb",
|
|
59224
|
+
"appliance-cycle": "#00848a"
|
|
59020
59225
|
};
|
|
59021
59226
|
var HIGH_CONTRAST_FALLBACK = [
|
|
59022
59227
|
"#817f3b",
|
|
@@ -59081,7 +59286,8 @@ var OKABE_ITO_HEX = {
|
|
|
59081
59286
|
switch: "#ad2c4e",
|
|
59082
59287
|
siren: "#348e08",
|
|
59083
59288
|
button: "#d27303",
|
|
59084
|
-
doorbell: "#55770f"
|
|
59289
|
+
doorbell: "#55770f",
|
|
59290
|
+
"appliance-cycle": "#00737d"
|
|
59085
59291
|
};
|
|
59086
59292
|
var OKABE_ITO_FALLBACK = [
|
|
59087
59293
|
"#9a3784",
|
|
@@ -59293,6 +59499,7 @@ sub("switch", "control", "control", "switch", "Switch");
|
|
|
59293
59499
|
sub("siren", "control", "control", "siren", "Siren");
|
|
59294
59500
|
sub("button", "control", "control", "button", "Button");
|
|
59295
59501
|
sub("doorbell", "control", "control", "doorbell", "Doorbell");
|
|
59502
|
+
sub("appliance-cycle", "control", "control", "switch", "Appliance cycle");
|
|
59296
59503
|
for (const l of AUDIO_MACRO_LABELS) {
|
|
59297
59504
|
const kind = `audio-${l.id}`;
|
|
59298
59505
|
if (entries.has(kind)) continue;
|
|
@@ -69839,7 +70046,8 @@ var CAP_TO_KIND = {
|
|
|
69839
70046
|
cover: "cover",
|
|
69840
70047
|
switch: "switch",
|
|
69841
70048
|
button: "button",
|
|
69842
|
-
doorbell: "doorbell"
|
|
70049
|
+
doorbell: "doorbell",
|
|
70050
|
+
"running-state": "appliance-cycle"
|
|
69843
70051
|
};
|
|
69844
70052
|
function buildDescriptor(capName, kind) {
|
|
69845
70053
|
const t = EVENT_TAXONOMY[kind];
|
|
@@ -75559,7 +75767,7 @@ var RemoteSetConfigResultSchema = z.discriminatedUnion("status", [z.object({ sta
|
|
|
75559
75767
|
reason: z.enum(["unknown-template", "not-a-media-player"]),
|
|
75560
75768
|
detail: z.string()
|
|
75561
75769
|
})]);
|
|
75562
|
-
var deviceInput
|
|
75770
|
+
var deviceInput = z.object({ deviceId: z.number().int().nonnegative() });
|
|
75563
75771
|
var remoteCustomize = {
|
|
75564
75772
|
version: 1,
|
|
75565
75773
|
targets: [{
|
|
@@ -75577,13 +75785,13 @@ var remoteCapability = {
|
|
|
75577
75785
|
scope: "system",
|
|
75578
75786
|
mode: "singleton",
|
|
75579
75787
|
methods: {
|
|
75580
|
-
getConfig: method(deviceInput
|
|
75581
|
-
setConfig: method(deviceInput
|
|
75788
|
+
getConfig: method(deviceInput, RemoteConfigSchema, { auth: "admin" }),
|
|
75789
|
+
setConfig: method(deviceInput.extend({ config: RemoteConfigSchema }), RemoteSetConfigResultSchema, {
|
|
75582
75790
|
kind: "mutation",
|
|
75583
75791
|
auth: "admin"
|
|
75584
75792
|
}),
|
|
75585
|
-
listCommands: method(deviceInput
|
|
75586
|
-
sendCommand: method(deviceInput
|
|
75793
|
+
listCommands: method(deviceInput, RemoteCommandListSchema, { auth: "protected" }),
|
|
75794
|
+
sendCommand: method(deviceInput.extend({
|
|
75587
75795
|
role: RemoteRoleSchema,
|
|
75588
75796
|
/** Sends in a row (volume steps). */
|
|
75589
75797
|
repeat: z.number().int().min(1).max(50).default(1)
|
|
@@ -75597,7 +75805,7 @@ var remoteCapability = {
|
|
|
75597
75805
|
* The dispatch redirect calls this for every caller (UI, automation,
|
|
75598
75806
|
* exporter); `repeat` is the caller's count where it has one.
|
|
75599
75807
|
*/
|
|
75600
|
-
sendMediaCommand: method(deviceInput
|
|
75808
|
+
sendMediaCommand: method(deviceInput.extend({
|
|
75601
75809
|
command: RemoteMediaCommandSchema,
|
|
75602
75810
|
muted: z.boolean().optional(),
|
|
75603
75811
|
source: z.string().optional(),
|
|
@@ -80420,117 +80628,6 @@ var lockControlCapability = {
|
|
|
80420
80628
|
* whether persisting is worth a SQLite commit. */
|
|
80421
80629
|
volatileStateFields: ["lastChangedAt"]
|
|
80422
80630
|
};
|
|
80423
|
-
var PowerSourceRefusalReasonSchema = z.enum([
|
|
80424
|
-
"no-power-source",
|
|
80425
|
-
"switch-missing",
|
|
80426
|
-
"switch-offline",
|
|
80427
|
-
"switch-unknown",
|
|
80428
|
-
"restart-in-progress",
|
|
80429
|
-
"switch-call-failed"
|
|
80430
|
-
]);
|
|
80431
|
-
var PowerSourceActionResultSchema = z.discriminatedUnion("accepted", [z.object({ accepted: z.literal(true) }), z.object({
|
|
80432
|
-
accepted: z.literal(false),
|
|
80433
|
-
reason: PowerSourceRefusalReasonSchema,
|
|
80434
|
-
/** One line for the operator, naming the switch. */
|
|
80435
|
-
message: z.string()
|
|
80436
|
-
})]);
|
|
80437
|
-
var PowerSourceInfoSchema = z.object({
|
|
80438
|
-
/** False when the device has no power source linked; the rest is then empty. */
|
|
80439
|
-
linked: z.boolean(),
|
|
80440
|
-
switchDeviceId: z.number().nullable(),
|
|
80441
|
-
switchName: z.string().nullable(),
|
|
80442
|
-
/** The switch's on/off state, or null when it is unknown. Never false for unknown (D393). */
|
|
80443
|
-
switchOn: z.boolean().nullable(),
|
|
80444
|
-
switchOnline: z.boolean().nullable(),
|
|
80445
|
-
restartInProgress: z.boolean(),
|
|
80446
|
-
offSeconds: z.number().int()
|
|
80447
|
-
});
|
|
80448
|
-
/** The composed slice: the switch state the link mirrors, plus the stored off time. */
|
|
80449
|
-
var PowerSourceStateSchema = z.object({
|
|
80450
|
-
/** Null while the switch has not reported: unknown is never `false` (D393). */
|
|
80451
|
-
switchOn: z.boolean().nullable(),
|
|
80452
|
-
offSeconds: z.number().int(),
|
|
80453
|
-
lastFetchedAt: z.number()
|
|
80454
|
-
});
|
|
80455
|
-
var POWER_SOURCE_DEVICE_TYPES = [
|
|
80456
|
-
DeviceType.Gateway,
|
|
80457
|
-
DeviceType.Hub,
|
|
80458
|
-
DeviceType.Camera,
|
|
80459
|
-
DeviceType.Sensor,
|
|
80460
|
-
DeviceType.MediaPlayer,
|
|
80461
|
-
DeviceType.Vacuum,
|
|
80462
|
-
DeviceType.Generic,
|
|
80463
|
-
DeviceType.Washer,
|
|
80464
|
-
DeviceType.Dryer,
|
|
80465
|
-
DeviceType.Dishwasher,
|
|
80466
|
-
DeviceType.PetFountain,
|
|
80467
|
-
DeviceType.Fan,
|
|
80468
|
-
DeviceType.Humidifier,
|
|
80469
|
-
DeviceType.Climate,
|
|
80470
|
-
DeviceType.WaterHeater
|
|
80471
|
-
];
|
|
80472
|
-
var powerSourceCustomize = {
|
|
80473
|
-
version: 1,
|
|
80474
|
-
targets: [{
|
|
80475
|
-
id: "switch",
|
|
80476
|
-
cardinality: "scalar",
|
|
80477
|
-
vocabulary: {
|
|
80478
|
-
cap: "power-source",
|
|
80479
|
-
stateField: "switchOn"
|
|
80480
|
-
},
|
|
80481
|
-
deviceTypes: POWER_SOURCE_DEVICE_TYPES,
|
|
80482
|
-
apply: "add",
|
|
80483
|
-
path: "switchOn",
|
|
80484
|
-
sources: [{
|
|
80485
|
-
kind: "switch",
|
|
80486
|
-
transforms: [{ kind: "identity" }]
|
|
80487
|
-
}],
|
|
80488
|
-
companions: [{
|
|
80489
|
-
kind: "constant",
|
|
80490
|
-
path: "offSeconds",
|
|
80491
|
-
value: 10,
|
|
80492
|
-
when: "add"
|
|
80493
|
-
}, {
|
|
80494
|
-
kind: "clock",
|
|
80495
|
-
path: "lastFetchedAt",
|
|
80496
|
-
when: "always"
|
|
80497
|
-
}],
|
|
80498
|
-
sourceReport: { status: "assignment-status" }
|
|
80499
|
-
}]
|
|
80500
|
-
};
|
|
80501
|
-
var deviceInput = z.object({ deviceId: z.number().int().nonnegative() });
|
|
80502
|
-
var powerSourceCapability = {
|
|
80503
|
-
name: "power-source",
|
|
80504
|
-
scope: "device",
|
|
80505
|
-
mode: "singleton",
|
|
80506
|
-
deviceTypes: POWER_SOURCE_DEVICE_TYPES,
|
|
80507
|
-
methods: {
|
|
80508
|
-
getStatus: systemMethod(deviceInput, PowerSourceInfoSchema, { auth: "admin" }),
|
|
80509
|
-
powerOn: systemMethod(deviceInput, PowerSourceActionResultSchema, {
|
|
80510
|
-
kind: "mutation",
|
|
80511
|
-
auth: "admin"
|
|
80512
|
-
}),
|
|
80513
|
-
powerOff: systemMethod(deviceInput, PowerSourceActionResultSchema, {
|
|
80514
|
-
kind: "mutation",
|
|
80515
|
-
auth: "admin"
|
|
80516
|
-
}),
|
|
80517
|
-
forceRestart: systemMethod(deviceInput, PowerSourceActionResultSchema, {
|
|
80518
|
-
kind: "mutation",
|
|
80519
|
-
auth: "admin"
|
|
80520
|
-
})
|
|
80521
|
-
},
|
|
80522
|
-
runtimeState: PowerSourceStateSchema,
|
|
80523
|
-
customize: powerSourceCustomize,
|
|
80524
|
-
/**
|
|
80525
|
-
* Runtime-state durability: **session** — mirrored from the linked switch on
|
|
80526
|
-
* its next report; a restored value would outlive the reading it names.
|
|
80527
|
-
*
|
|
80528
|
-
* See `RuntimeStateDurability`. Enforced by
|
|
80529
|
-
* `scripts/check-runtime-state-durability.ts`.
|
|
80530
|
-
*/
|
|
80531
|
-
durability: "session",
|
|
80532
|
-
history: "none"
|
|
80533
|
-
};
|
|
80534
80631
|
/**
|
|
80535
80632
|
* A monotonic total between resets (D944). Energy uses `power-meter.energy`
|
|
80536
80633
|
* so dashboards keep one series; every other instantaneous reading lands here.
|
|
@@ -84521,6 +84618,10 @@ var RUNNING_DEVICE_TYPES = Object.values(DeviceType);
|
|
|
84521
84618
|
/** Generic Customize target for the running boolean (D936). */
|
|
84522
84619
|
var runningCustomize = {
|
|
84523
84620
|
version: 1,
|
|
84621
|
+
overridable: [{
|
|
84622
|
+
path: "running",
|
|
84623
|
+
by: "running"
|
|
84624
|
+
}],
|
|
84524
84625
|
targets: [{
|
|
84525
84626
|
id: "running",
|
|
84526
84627
|
cardinality: "scalar",
|
|
@@ -84578,7 +84679,7 @@ var runningCustomize = {
|
|
|
84578
84679
|
kind: "constant",
|
|
84579
84680
|
path: "phase",
|
|
84580
84681
|
value: null,
|
|
84581
|
-
when: "
|
|
84682
|
+
when: "add"
|
|
84582
84683
|
},
|
|
84583
84684
|
{
|
|
84584
84685
|
kind: "clock",
|
|
@@ -90999,45 +91100,6 @@ function lockDoorLinkOfComposition(composition) {
|
|
|
90999
91100
|
sensor: x.source
|
|
91000
91101
|
};
|
|
91001
91102
|
}
|
|
91002
|
-
/**
|
|
91003
|
-
* Which smart switch powers a device (the `power-source` Customize extension):
|
|
91004
|
-
* the source its stored `power-source.switchOn` field reads, and the off time of
|
|
91005
|
-
* a forced restart stored beside it. Read from the STORED composition, never kept
|
|
91006
|
-
* as a second copy (D676). Shared by the hub (which acts on the switch) and the
|
|
91007
|
-
* admin UI (which shows it).
|
|
91008
|
-
*/
|
|
91009
|
-
/**
|
|
91010
|
-
* The stored off time, or the default when none is stored. A stored number out
|
|
91011
|
-
* of range is CLAMPED to the bounds (a hand-written value never refuses the
|
|
91012
|
-
* link, it just cannot cut power for an absurd time); a non-integer is rounded.
|
|
91013
|
-
*/
|
|
91014
|
-
function normalizeOffSeconds(value) {
|
|
91015
|
-
if (typeof value !== "number" || !Number.isFinite(value)) return 10;
|
|
91016
|
-
return Math.min(120, Math.max(3, Math.round(value)));
|
|
91017
|
-
}
|
|
91018
|
-
/** The constant a stored `offSeconds` field carries, or undefined when it is not a literal number. */
|
|
91019
|
-
function storedOffSeconds(composition) {
|
|
91020
|
-
const feature = composition.features.find((f) => f.cap === "power-source");
|
|
91021
|
-
if (feature === void 0 || feature.kind !== "fields") return void 0;
|
|
91022
|
-
const field = feature.fields["offSeconds"];
|
|
91023
|
-
if (field === void 0 || field.kind !== "expression") return void 0;
|
|
91024
|
-
const n = Number(field.expr);
|
|
91025
|
-
return field.expr.trim() === "" || !Number.isFinite(n) ? void 0 : n;
|
|
91026
|
-
}
|
|
91027
|
-
function powerSourceLinkOfComposition(composition) {
|
|
91028
|
-
if (composition === null || composition.target.kind !== "existing") return null;
|
|
91029
|
-
const feature = composition.features.find((f) => f.cap === "power-source");
|
|
91030
|
-
if (feature === void 0 || feature.kind !== "fields" || feature.enabled === false) return null;
|
|
91031
|
-
const field = feature.fields["switchOn"];
|
|
91032
|
-
if (field === void 0) return null;
|
|
91033
|
-
const read = fieldReads(field).find((r) => r.cap === "switch");
|
|
91034
|
-
if (read === void 0) return null;
|
|
91035
|
-
return {
|
|
91036
|
-
device: composition.target.device,
|
|
91037
|
-
switch: read.source,
|
|
91038
|
-
offSeconds: normalizeOffSeconds(storedOffSeconds(composition))
|
|
91039
|
-
};
|
|
91040
|
-
}
|
|
91041
91103
|
SOURCE_CAPS.filter((cap) => cap !== "switch" && cap !== "motion");
|
|
91042
91104
|
String.raw`rose\(active(\d+), changed(\d+), (\d+(?:\.\d+)?)\)`;
|
|
91043
91105
|
DeviceRole.BinarySensor, DeviceRole.MotionSensor;
|
|
@@ -106726,8 +106788,17 @@ NC_AUDIO_DEFAULTS.hitPercent, NC_AUDIO_DEFAULTS.samplingSeconds;
|
|
|
106726
106788
|
*
|
|
106727
106789
|
* Pure, RN-safe: the viewer imports the support rule from here.
|
|
106728
106790
|
*/
|
|
106791
|
+
/**
|
|
106792
|
+
* Control caps that still have a raise and a clear an operator names: an
|
|
106793
|
+
* appliance cycle raises when it STARTS and clears when it FINISHES. Kept out
|
|
106794
|
+
* of `SOURCE_CAP_ACTIVE_FIELD` on purpose — that table also makes a device a
|
|
106795
|
+
* camera-sensor / recorder-trigger source, and a dishwasher is neither.
|
|
106796
|
+
*/
|
|
106797
|
+
var CYCLE_RAISED_FIELD_BY_CAP = { "running-state": "running" };
|
|
106729
106798
|
/** Event kind → the boolean field of its cap slice that means "raised". */
|
|
106730
106799
|
var NC_SENSOR_RAISED_FIELD_BY_KIND = Object.freeze(Object.fromEntries(Object.entries(EVENT_KIND_BY_CAP).flatMap(([capName, descriptor]) => {
|
|
106800
|
+
const cycleField = CYCLE_RAISED_FIELD_BY_CAP[capName];
|
|
106801
|
+
if (cycleField !== void 0) return [[descriptor.kind, cycleField]];
|
|
106731
106802
|
const field = SOURCE_CAP_ACTIVE_FIELD[capName];
|
|
106732
106803
|
if (field === void 0 || descriptor.category !== "sensor") return [];
|
|
106733
106804
|
return [[descriptor.kind, field]];
|
|
@@ -107242,6 +107313,7 @@ new Set([
|
|
|
107242
107313
|
"siren",
|
|
107243
107314
|
"button",
|
|
107244
107315
|
"doorbell",
|
|
107316
|
+
"appliance-cycle",
|
|
107245
107317
|
"audio-speech",
|
|
107246
107318
|
"audio-scream",
|
|
107247
107319
|
"audio-crying",
|