@camstack/server 1.2.812 → 1.2.814
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 +14 -0
- package/dist/api/core/cap-providers.js +50 -343
- package/dist/api/trpc/generated-cap-routers.js +9 -0
- package/dist/core/addon/addon-registry.service.js +31 -1
- package/dist/core/addon/addon-settings-provider.js +7 -1
- package/dist/core/addon/instance-lifecycle.js +454 -0
- package/dist/core/addon/instance-links.service.js +22 -14
- package/dist/core/moleculer/moleculer.service.js +15 -1
- package/package.json +10 -10
- package/system/dist/{agent-https-a3mE4PW4.js → agent-https-Dwbpz4K6.js} +1 -1
- package/system/dist/{agent-https-CyEBY3RB.mjs → agent-https-eMihTWJ4.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 +1 -1
- 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 +1 -1
- 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 +2 -2
- 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/blocks-instances.d.ts +22 -0
- package/system/dist/builtins/core-blocks/core-blocks.addon.d.ts +2 -0
- package/system/dist/builtins/core-blocks/core-blocks.addon.js +210 -10
- package/system/dist/builtins/core-blocks/core-blocks.addon.mjs +200 -10
- package/system/dist/builtins/core-blocks/hero-layout-service.d.ts +7 -0
- package/system/dist/builtins/core-blocks/remote-service.d.ts +3 -0
- package/system/dist/builtins/core-blocks/timed-run/timed-run-service.d.ts +7 -0
- 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 +4 -4
- package/system/dist/builtins/keychain/index.mjs +4 -4
- 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 +2 -2
- 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 +1 -1
- package/system/dist/builtins/platform-probe/index.js +1 -1
- package/system/dist/builtins/platform-probe/index.mjs +1 -1
- 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 +1 -1
- 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 +3 -3
- package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +3 -3
- 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 +284 -284
- package/system/dist/builtins/winston-logging/index.js +1 -1
- package/system/dist/builtins/winston-logging/index.mjs +1 -1
- package/system/dist/{capture-engine-ByF-6AFH.mjs → capture-engine-CYPDOIF6.mjs} +1 -1
- package/system/dist/{capture-engine-BO9mSlY-.js → capture-engine-uxR5sOQN.js} +1 -1
- package/system/dist/{composition-sources-AziMFo7T.mjs → composition-sources-CU3p3INI.mjs} +1 -1
- package/system/dist/{composition-sources-BMJUPUh2.js → composition-sources-DkvntZci.js} +1 -1
- package/system/dist/{constants-CjRlgRlu.js → constants-BP-Txn_J.js} +1 -1
- package/system/dist/{constants-CTikgsC_.mjs → constants-DMFJ6Fky.mjs} +1 -1
- package/system/dist/{device-ca-Dxl6kVcJ.js → device-ca-D-0zxmFi.js} +1 -1
- package/system/dist/{device-ca-CNRlFqFC.mjs → device-ca-tmcd_VBC.mjs} +1 -1
- package/system/dist/{dist-CkJnelZr.js → dist-CznnwtQ8.js} +756 -73
- package/system/dist/{dist-BPq13Y8j.mjs → dist-DmCVWvtK.mjs} +727 -68
- package/system/dist/file-host-worker.js +1 -1
- package/system/dist/file-host-worker.mjs +1 -1
- package/system/dist/{hub-mdns-ciao-CrjItezp.mjs → hub-mdns-ciao-DbwyiHD5.mjs} +2 -2
- package/system/dist/{hub-mdns-ciao-Cx6yJBl9.js → hub-mdns-ciao-FTf16-JR.js} +2 -2
- package/system/dist/index.js +8 -8
- package/system/dist/index.mjs +8 -8
- package/system/dist/{legacy-integration-rows-door-Dxcqwc-w.mjs → legacy-integration-rows-door-CASQgifG.mjs} +1 -1
- package/system/dist/{legacy-integration-rows-door-CKM-LxvL.js → legacy-integration-rows-door-gW0xpMJI.js} +1 -1
- package/system/dist/{restore-archive-BQWOdGAB.js → restore-archive-B9TEFWRE.js} +1 -1
- package/system/dist/{restore-archive-r3zTdLKr.mjs → restore-archive-DlaC_gyl.mjs} +82 -82
- package/system/dist/{wal-maintenance-zJ4-ORo6.mjs → wal-maintenance-Cn164tp0.mjs} +0 -0
- package/system/dist/{wal-maintenance-CiCgL4Hp.js → wal-maintenance-Da2Rozz6.js} +0 -0
- package/system/package.json +5 -1
|
@@ -803,7 +803,7 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
|
803
803
|
return EventCategory;
|
|
804
804
|
}({});
|
|
805
805
|
//#endregion
|
|
806
|
-
//#region ../types/dist/device-type-
|
|
806
|
+
//#region ../types/dist/device-type-CbDhVwFP.mjs
|
|
807
807
|
/**
|
|
808
808
|
import { errMsg } from '@camstack/types'
|
|
809
809
|
* Extract a human-readable message from an unknown error value.
|
|
@@ -972,6 +972,13 @@ var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
|
|
|
972
972
|
* (`featuresOfBoundCaps`). Gates the quick-run control in the viewer.
|
|
973
973
|
*/
|
|
974
974
|
DeviceFeature["TimedRun"] = "timed-run";
|
|
975
|
+
/**
|
|
976
|
+
* Device binds a plain `switch` cap. Derived from the bindings
|
|
977
|
+
* (`featuresOfBoundCaps`) for a composed device, whose switch is bound by the
|
|
978
|
+
* composition and not by a driver: an appliance (a heater behind a smart
|
|
979
|
+
* plug) has no control of its own, so a surface reads this as its on/off.
|
|
980
|
+
*/
|
|
981
|
+
DeviceFeature["Switch"] = "switch";
|
|
975
982
|
/** Light supports rgb-triplet color via `color` cap. */
|
|
976
983
|
DeviceFeature["LightColorRgb"] = "light-color-rgb";
|
|
977
984
|
/** Light supports HSV color via `color` cap. */
|
|
@@ -1204,7 +1211,7 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
|
|
|
1204
1211
|
return DeviceRole;
|
|
1205
1212
|
}({});
|
|
1206
1213
|
//#endregion
|
|
1207
|
-
//#region ../types/dist/sleep-
|
|
1214
|
+
//#region ../types/dist/sleep-CqvzKIq2.mjs
|
|
1208
1215
|
/**
|
|
1209
1216
|
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
1210
1217
|
* window to float samples (D455).
|
|
@@ -5475,6 +5482,21 @@ function defineRecordKinds(specs) {
|
|
|
5475
5482
|
return out;
|
|
5476
5483
|
}
|
|
5477
5484
|
/**
|
|
5485
|
+
* Entry kinds (D881): every list of user-created entries (notification
|
|
5486
|
+
* targets, brokers, LLM profiles) is ONE record kind with an id, a name and a
|
|
5487
|
+
* kind-specific body, and the admin UI lists/adds/edits/deletes all of them
|
|
5488
|
+
* through the `record-entries` capability with password fields derived from
|
|
5489
|
+
* the schema (`.meta({ secret: true })`).
|
|
5490
|
+
*/
|
|
5491
|
+
/** The body of a plain entry: a name and the fields the kind adds. */
|
|
5492
|
+
function entryBody(shape) {
|
|
5493
|
+
return zod.z.object({
|
|
5494
|
+
name: zod.z.string().min(1),
|
|
5495
|
+
enabled: zod.z.boolean().optional(),
|
|
5496
|
+
...shape
|
|
5497
|
+
});
|
|
5498
|
+
}
|
|
5499
|
+
/**
|
|
5478
5500
|
* Declare one entry kind. An entry is configuration: never trimmed by the
|
|
5479
5501
|
* engine, never aged, belonging to no device.
|
|
5480
5502
|
*/
|
|
@@ -13629,7 +13651,7 @@ function sleep(ms) {
|
|
|
13629
13651
|
return new Promise((resolve) => setTimeout(resolve, Math.max(0, ms)));
|
|
13630
13652
|
}
|
|
13631
13653
|
//#endregion
|
|
13632
|
-
//#region ../types/dist/composition-
|
|
13654
|
+
//#region ../types/dist/composition-CXCX78IR.mjs
|
|
13633
13655
|
var AUDIO_ENCODER_BY_CODEC = {
|
|
13634
13656
|
opus: "libopus",
|
|
13635
13657
|
aac: "aac",
|
|
@@ -51788,6 +51810,90 @@ var controlCapability = {
|
|
|
51788
51810
|
*/
|
|
51789
51811
|
history: "none"
|
|
51790
51812
|
};
|
|
51813
|
+
var IrCodecError = class extends Error {
|
|
51814
|
+
code;
|
|
51815
|
+
constructor(code, message) {
|
|
51816
|
+
super(message);
|
|
51817
|
+
this.name = "IrCodecError";
|
|
51818
|
+
this.code = code;
|
|
51819
|
+
}
|
|
51820
|
+
};
|
|
51821
|
+
/**
|
|
51822
|
+
* A pulse train in signed microseconds: mark (+) first, then space (-), strictly
|
|
51823
|
+
* alternating, no zeros, 2..1024 entries.
|
|
51824
|
+
*/
|
|
51825
|
+
var IrTimingsSchema = zod.z.array(zod.z.number().int()).min(2).max(1024).superRefine((timings, ctx) => {
|
|
51826
|
+
timings.forEach((value, index) => {
|
|
51827
|
+
const expectMark = index % 2 === 0;
|
|
51828
|
+
if (value === 0 || value > 0 !== expectMark) ctx.addIssue({
|
|
51829
|
+
code: "custom",
|
|
51830
|
+
message: `timing ${index} must be a non-zero ${expectMark ? "mark (positive)" : "space (negative)"}`,
|
|
51831
|
+
path: [index]
|
|
51832
|
+
});
|
|
51833
|
+
});
|
|
51834
|
+
});
|
|
51835
|
+
/** Per-command transmit options. Every key is optional; a transmitter applies what it can. */
|
|
51836
|
+
var TransmitSettingsSchema = zod.z.object({
|
|
51837
|
+
carrierHz: zod.z.number().int().positive().optional(),
|
|
51838
|
+
dutyCyclePercent: zod.z.number().int().min(1).max(100).optional(),
|
|
51839
|
+
repeat: zod.z.number().int().min(0).max(20).optional(),
|
|
51840
|
+
repeatDelayMs: zod.z.number().int().min(0).optional()
|
|
51841
|
+
});
|
|
51842
|
+
/** One Pronto frequency-word unit, in microseconds, per unit of the word. */
|
|
51843
|
+
var PRONTO_CLOCK_US = .241246;
|
|
51844
|
+
var LEARNED_FORM = 0;
|
|
51845
|
+
/**
|
|
51846
|
+
* Decode a learned (0000 form) Pronto hex string. The intro burst is followed by
|
|
51847
|
+
* the repeat burst once; a different form is refused with `pronto-unsupported-form`.
|
|
51848
|
+
*/
|
|
51849
|
+
function decodePronto(code) {
|
|
51850
|
+
const words = code.trim().split(/\s+/).filter((w) => w.length > 0);
|
|
51851
|
+
if (words.length < 4) throw new IrCodecError("pronto-malformed", `Pronto code needs at least 4 words, got ${words.length}`);
|
|
51852
|
+
const values = words.map((w) => /^[0-9a-fA-F]{1,4}$/.test(w) ? parseInt(w, 16) : NaN);
|
|
51853
|
+
if (values.some((v) => Number.isNaN(v))) throw new IrCodecError("pronto-malformed", "Pronto code must be 4-digit hexadecimal words");
|
|
51854
|
+
const [form, freqWord, introCount, repeatCount] = values;
|
|
51855
|
+
if (form === void 0 || freqWord === void 0 || introCount === void 0 || repeatCount === void 0) throw new IrCodecError("pronto-malformed", "Pronto header incomplete");
|
|
51856
|
+
if (form !== LEARNED_FORM) throw new IrCodecError("pronto-unsupported-form", `Pronto form ${words[0] ?? ""} is not supported, only the learned 0000 form`);
|
|
51857
|
+
if (freqWord === 0) throw new IrCodecError("pronto-malformed", "Pronto frequency word is zero");
|
|
51858
|
+
const pairs = introCount + repeatCount;
|
|
51859
|
+
if (pairs === 0 || values.length !== 4 + pairs * 2) throw new IrCodecError("pronto-malformed", `Pronto declares ${pairs} burst pairs but carries ${(values.length - 4) / 2} word pairs`);
|
|
51860
|
+
const unitUs = freqWord * PRONTO_CLOCK_US;
|
|
51861
|
+
const timings = values.slice(4).map((count, index) => {
|
|
51862
|
+
const us = Math.max(1, Math.round(count * unitUs));
|
|
51863
|
+
return index % 2 === 0 ? us : -us;
|
|
51864
|
+
});
|
|
51865
|
+
const checked = IrTimingsSchema.safeParse(timings);
|
|
51866
|
+
if (!checked.success) throw new IrCodecError("invalid-timings", `Pronto decoded to invalid timings: ${checked.error.message}`);
|
|
51867
|
+
return {
|
|
51868
|
+
timings: checked.data,
|
|
51869
|
+
carrierHz: Math.round(1e6 / unitUs)
|
|
51870
|
+
};
|
|
51871
|
+
}
|
|
51872
|
+
/** What a remote command stores: a raw pulse train, or a learned Pronto code. */
|
|
51873
|
+
var IrPayloadSchema = zod.z.discriminatedUnion("kind", [zod.z.object({
|
|
51874
|
+
kind: zod.z.literal("raw"),
|
|
51875
|
+
timings: zod.z.array(zod.z.number().int()),
|
|
51876
|
+
settings: TransmitSettingsSchema.optional()
|
|
51877
|
+
}), zod.z.object({
|
|
51878
|
+
kind: zod.z.literal("pronto"),
|
|
51879
|
+
code: zod.z.string()
|
|
51880
|
+
})]);
|
|
51881
|
+
/** Resolve a payload to what `ir-transmitter.send` takes. Throws `IrCodecError`. */
|
|
51882
|
+
function toTimings(payload) {
|
|
51883
|
+
if (payload.kind === "pronto") {
|
|
51884
|
+
const decoded = decodePronto(payload.code);
|
|
51885
|
+
return {
|
|
51886
|
+
timings: decoded.timings,
|
|
51887
|
+
settings: { carrierHz: decoded.carrierHz }
|
|
51888
|
+
};
|
|
51889
|
+
}
|
|
51890
|
+
const checked = IrTimingsSchema.safeParse(payload.timings);
|
|
51891
|
+
if (!checked.success) throw new IrCodecError("invalid-timings", checked.error.message);
|
|
51892
|
+
return {
|
|
51893
|
+
timings: checked.data,
|
|
51894
|
+
settings: payload.settings ?? {}
|
|
51895
|
+
};
|
|
51896
|
+
}
|
|
51791
51897
|
/**
|
|
51792
51898
|
* The role vocabulary of a remote (D963): what a button MEANS, independent of
|
|
51793
51899
|
* how it is wired. A layout template places buttons by role; a device binds a
|
|
@@ -51875,11 +51981,18 @@ var RemoteRoleSchema = zod.z.string().refine(isRemoteRole, { message: "a role is
|
|
|
51875
51981
|
* a voice command or `playMedia` names.
|
|
51876
51982
|
* - `sequence`: a name and explicit steps — bound roles pressed in order
|
|
51877
51983
|
* (an input key, a menu macro such as `source, down, down, ok`).
|
|
51984
|
+
* - `ir`: a name and one infrared code of its own (raw timings or a Pronto
|
|
51985
|
+
* string), sent through a named transmitter (planning#464). It presses no
|
|
51986
|
+
* button: a source the remote's layout has no key for.
|
|
51878
51987
|
*
|
|
51879
51988
|
* The name and the number resolve to the SAME declared source. A number no
|
|
51880
51989
|
* `digits` source declares is not a channel: it is refused, never guessed.
|
|
51881
51990
|
*/
|
|
51882
|
-
var REMOTE_SOURCE_KINDS = [
|
|
51991
|
+
var REMOTE_SOURCE_KINDS = [
|
|
51992
|
+
"digits",
|
|
51993
|
+
"sequence",
|
|
51994
|
+
"ir"
|
|
51995
|
+
];
|
|
51883
51996
|
zod.z.enum(REMOTE_SOURCE_KINDS);
|
|
51884
51997
|
var REMOTE_SOURCE_ID_RE = /^[a-z0-9][a-z0-9_-]{0,47}$/;
|
|
51885
51998
|
var CHANNEL_NUMBER_RE = new RegExp(`^[0-9]{1,6}$`);
|
|
@@ -51899,11 +52012,43 @@ var RemoteSequenceSourceSchema = zod.z.object({
|
|
|
51899
52012
|
kind: zod.z.literal("sequence"),
|
|
51900
52013
|
steps: zod.z.array(RemoteRoleSchema).min(1).max(16)
|
|
51901
52014
|
});
|
|
51902
|
-
var
|
|
52015
|
+
var RemoteIrSourceSchema = zod.z.object({
|
|
52016
|
+
...sourceBase,
|
|
52017
|
+
kind: zod.z.literal("ir"),
|
|
52018
|
+
/** The `ir-transmitter` device the code is sent through. */
|
|
52019
|
+
transmitterId: zod.z.number().int().nonnegative(),
|
|
52020
|
+
/** The code itself; whether a transmitter could send it is `irSourceProblem`. */
|
|
52021
|
+
payload: IrPayloadSchema
|
|
52022
|
+
});
|
|
52023
|
+
var RemoteSourceSchema = zod.z.discriminatedUnion("kind", [
|
|
52024
|
+
RemoteDigitsSourceSchema,
|
|
52025
|
+
RemoteSequenceSourceSchema,
|
|
52026
|
+
RemoteIrSourceSchema
|
|
52027
|
+
]);
|
|
51903
52028
|
var REMOTE_STEP_DELAY_MAX_MS = 3e3;
|
|
51904
|
-
/**
|
|
52029
|
+
/**
|
|
52030
|
+
* The roles a source presses, in order. A `digits` number is its digit roles;
|
|
52031
|
+
* an `ir` source presses none — it carries its own code.
|
|
52032
|
+
*/
|
|
51905
52033
|
function remoteSourceSteps(source) {
|
|
51906
|
-
|
|
52034
|
+
switch (source.kind) {
|
|
52035
|
+
case "sequence": return source.steps;
|
|
52036
|
+
case "digits": return Array.from(source.number, (digit) => `digit_${digit}`);
|
|
52037
|
+
case "ir": return [];
|
|
52038
|
+
}
|
|
52039
|
+
}
|
|
52040
|
+
/**
|
|
52041
|
+
* Why an `ir` source's code could not be sent (the codec's own words), or null
|
|
52042
|
+
* when it resolves to a pulse train. The schema refuses on it; the editor shows it.
|
|
52043
|
+
*/
|
|
52044
|
+
function irSourceProblem(source) {
|
|
52045
|
+
try {
|
|
52046
|
+
toTimings(source.payload);
|
|
52047
|
+
return null;
|
|
52048
|
+
} catch (err) {
|
|
52049
|
+
if (err instanceof IrCodecError) return err.message;
|
|
52050
|
+
throw err;
|
|
52051
|
+
}
|
|
51907
52052
|
}
|
|
51908
52053
|
function same(a, b) {
|
|
51909
52054
|
return a.trim().toLowerCase() === b.trim().toLowerCase();
|
|
@@ -52705,7 +52850,8 @@ var CAP_CUSTOMIZE_CATALOG = {
|
|
|
52705
52850
|
kind: "constant",
|
|
52706
52851
|
path: "offSeconds",
|
|
52707
52852
|
value: 10,
|
|
52708
|
-
when: "add"
|
|
52853
|
+
when: "add",
|
|
52854
|
+
formerValues: [0]
|
|
52709
52855
|
}, {
|
|
52710
52856
|
kind: "clock",
|
|
52711
52857
|
path: "lastFetchedAt",
|
|
@@ -62763,8 +62909,9 @@ var heatingValveCapability = {
|
|
|
62763
62909
|
*
|
|
62764
62910
|
* "Heat for 30 minutes", "run the fountain pump for 2 minutes": the device has
|
|
62765
62911
|
* no timer of its own, so the hub keeps one. `runFor` turns the device on and
|
|
62766
|
-
* records a deadline; `cancel`
|
|
62767
|
-
* forgets it; at the deadline
|
|
62912
|
+
* records a deadline; `cancel` switches the device off and forgets the deadline,
|
|
62913
|
+
* and the device being switched off by hand just forgets it; at the deadline
|
|
62914
|
+
* the hub issues the off once.
|
|
62768
62915
|
*
|
|
62769
62916
|
* The deadline is DURABLE: it is a row in the records store, so a hub restart
|
|
62770
62917
|
* neither loses a pending off nor leaves the device running past its time. At
|
|
@@ -62895,7 +63042,7 @@ var timedRunCapability = {
|
|
|
62895
63042
|
kind: "mutation",
|
|
62896
63043
|
auth: "protected"
|
|
62897
63044
|
}),
|
|
62898
|
-
/**
|
|
63045
|
+
/** Stop the run: switch the device off (once) and forget the pending off. Nothing armed: nothing is sent. */
|
|
62899
63046
|
cancel: method(zod.z.object({ deviceId: zod.z.number().int() }), zod.z.void(), {
|
|
62900
63047
|
kind: "mutation",
|
|
62901
63048
|
auth: "protected"
|
|
@@ -62977,6 +63124,168 @@ var StateLookSchema = zod.z.object({
|
|
|
62977
63124
|
background: HeroBackgroundTokenSchema,
|
|
62978
63125
|
animation: HeroAnimationSchema
|
|
62979
63126
|
});
|
|
63127
|
+
var HeroSceneIdSchema = zod.z.enum([
|
|
63128
|
+
"ac",
|
|
63129
|
+
"thermostat",
|
|
63130
|
+
"heater",
|
|
63131
|
+
"fan",
|
|
63132
|
+
"washer",
|
|
63133
|
+
"dryer",
|
|
63134
|
+
"dishwasher",
|
|
63135
|
+
"pet-fountain",
|
|
63136
|
+
"pet-feeder",
|
|
63137
|
+
"vacuum",
|
|
63138
|
+
"lawn-mower",
|
|
63139
|
+
"tv",
|
|
63140
|
+
"speaker",
|
|
63141
|
+
"camera",
|
|
63142
|
+
"light",
|
|
63143
|
+
"cover",
|
|
63144
|
+
"lock",
|
|
63145
|
+
"alarm",
|
|
63146
|
+
"siren",
|
|
63147
|
+
"sensor-sparkline",
|
|
63148
|
+
"contact",
|
|
63149
|
+
"presence",
|
|
63150
|
+
"weather",
|
|
63151
|
+
"plug",
|
|
63152
|
+
"button",
|
|
63153
|
+
"update",
|
|
63154
|
+
"control-dial",
|
|
63155
|
+
"event-stream",
|
|
63156
|
+
"gateway",
|
|
63157
|
+
"generic"
|
|
63158
|
+
]);
|
|
63159
|
+
var HeroSceneModeSchema = zod.z.enum([
|
|
63160
|
+
"cool",
|
|
63161
|
+
"heat",
|
|
63162
|
+
"dry",
|
|
63163
|
+
"fan",
|
|
63164
|
+
"auto",
|
|
63165
|
+
"playing",
|
|
63166
|
+
"paused",
|
|
63167
|
+
"open",
|
|
63168
|
+
"closed"
|
|
63169
|
+
]);
|
|
63170
|
+
/** The scene as the model carries it. `null` = the device did not say (never a guess). */
|
|
63171
|
+
var HeroSceneSchema = zod.z.object({
|
|
63172
|
+
id: HeroSceneIdSchema,
|
|
63173
|
+
mode: HeroSceneModeSchema.nullable(),
|
|
63174
|
+
/** 0..1: volume, cover position, cycle progress. */
|
|
63175
|
+
level: zod.z.number().min(0).max(1).nullable()
|
|
63176
|
+
});
|
|
63177
|
+
var HERO_SCENE_BY_TYPE = {
|
|
63178
|
+
[DeviceType.Camera]: "camera",
|
|
63179
|
+
[DeviceType.Hub]: "gateway",
|
|
63180
|
+
[DeviceType.Light]: "light",
|
|
63181
|
+
[DeviceType.Siren]: "siren",
|
|
63182
|
+
[DeviceType.Switch]: "plug",
|
|
63183
|
+
[DeviceType.Sensor]: "sensor-sparkline",
|
|
63184
|
+
[DeviceType.Thermostat]: "thermostat",
|
|
63185
|
+
[DeviceType.Climate]: "ac",
|
|
63186
|
+
[DeviceType.Button]: "button",
|
|
63187
|
+
[DeviceType.EventEmitter]: "event-stream",
|
|
63188
|
+
[DeviceType.Update]: "update",
|
|
63189
|
+
[DeviceType.Generic]: "generic",
|
|
63190
|
+
[DeviceType.Notifier]: "event-stream",
|
|
63191
|
+
[DeviceType.Script]: "event-stream",
|
|
63192
|
+
[DeviceType.Automation]: "event-stream",
|
|
63193
|
+
[DeviceType.Lock]: "lock",
|
|
63194
|
+
[DeviceType.Cover]: "cover",
|
|
63195
|
+
[DeviceType.Valve]: "control-dial",
|
|
63196
|
+
[DeviceType.Humidifier]: "control-dial",
|
|
63197
|
+
[DeviceType.WaterHeater]: "heater",
|
|
63198
|
+
[DeviceType.Fan]: "fan",
|
|
63199
|
+
[DeviceType.MediaPlayer]: "tv",
|
|
63200
|
+
[DeviceType.AlarmPanel]: "alarm",
|
|
63201
|
+
[DeviceType.Control]: "control-dial",
|
|
63202
|
+
[DeviceType.Presence]: "presence",
|
|
63203
|
+
[DeviceType.Weather]: "weather",
|
|
63204
|
+
[DeviceType.Vacuum]: "vacuum",
|
|
63205
|
+
[DeviceType.LawnMower]: "lawn-mower",
|
|
63206
|
+
[DeviceType.Container]: "generic",
|
|
63207
|
+
[DeviceType.Image]: "camera",
|
|
63208
|
+
[DeviceType.PetFeeder]: "pet-feeder",
|
|
63209
|
+
[DeviceType.PetFountain]: "pet-fountain",
|
|
63210
|
+
[DeviceType.Dishwasher]: "dishwasher",
|
|
63211
|
+
[DeviceType.Washer]: "washer",
|
|
63212
|
+
[DeviceType.Heater]: "heater",
|
|
63213
|
+
[DeviceType.Dryer]: "dryer",
|
|
63214
|
+
[DeviceType.Gateway]: "gateway"
|
|
63215
|
+
};
|
|
63216
|
+
/** `inherit` = the type's scene. A role only refines a type. */
|
|
63217
|
+
var HERO_SCENE_BY_ROLE = {
|
|
63218
|
+
[DeviceRole.Siren]: "siren",
|
|
63219
|
+
[DeviceRole.Floodlight]: "light",
|
|
63220
|
+
[DeviceRole.Spotlight]: "light",
|
|
63221
|
+
[DeviceRole.PirSensor]: "presence",
|
|
63222
|
+
[DeviceRole.Chime]: "speaker",
|
|
63223
|
+
[DeviceRole.Autotrack]: "inherit",
|
|
63224
|
+
[DeviceRole.Nightvision]: "inherit",
|
|
63225
|
+
[DeviceRole.PrivacyMask]: "inherit",
|
|
63226
|
+
[DeviceRole.Doorbell]: "inherit",
|
|
63227
|
+
[DeviceRole.CoverBlind]: "inherit",
|
|
63228
|
+
[DeviceRole.CoverShutter]: "inherit",
|
|
63229
|
+
[DeviceRole.CoverAwning]: "inherit",
|
|
63230
|
+
[DeviceRole.CoverCurtain]: "inherit",
|
|
63231
|
+
[DeviceRole.CoverGarage]: "inherit",
|
|
63232
|
+
[DeviceRole.CoverGate]: "inherit",
|
|
63233
|
+
[DeviceRole.CoverDoor]: "inherit",
|
|
63234
|
+
[DeviceRole.CoverWindow]: "inherit",
|
|
63235
|
+
[DeviceRole.BinaryHelper]: "inherit",
|
|
63236
|
+
[DeviceRole.Outlet]: "plug",
|
|
63237
|
+
[DeviceRole.MotionSensor]: "presence",
|
|
63238
|
+
[DeviceRole.ContactSensor]: "contact",
|
|
63239
|
+
[DeviceRole.LeakSensor]: "inherit",
|
|
63240
|
+
[DeviceRole.SmokeSensor]: "alarm",
|
|
63241
|
+
[DeviceRole.COSensor]: "alarm",
|
|
63242
|
+
[DeviceRole.GasSensor]: "alarm",
|
|
63243
|
+
[DeviceRole.TamperSensor]: "inherit",
|
|
63244
|
+
[DeviceRole.VibrationSensor]: "inherit",
|
|
63245
|
+
[DeviceRole.ConnectivitySensor]: "inherit",
|
|
63246
|
+
[DeviceRole.SoundSensor]: "inherit",
|
|
63247
|
+
[DeviceRole.BinarySensor]: "inherit",
|
|
63248
|
+
[DeviceRole.TemperatureSensor]: "sensor-sparkline",
|
|
63249
|
+
[DeviceRole.HumiditySensor]: "sensor-sparkline",
|
|
63250
|
+
[DeviceRole.AmbientLightSensor]: "inherit",
|
|
63251
|
+
[DeviceRole.PressureSensor]: "weather",
|
|
63252
|
+
[DeviceRole.WindSensor]: "weather",
|
|
63253
|
+
[DeviceRole.RainSensor]: "weather",
|
|
63254
|
+
[DeviceRole.UvSensor]: "weather",
|
|
63255
|
+
[DeviceRole.SolarRadiationSensor]: "weather",
|
|
63256
|
+
[DeviceRole.SoilMoistureSensor]: "inherit",
|
|
63257
|
+
[DeviceRole.PowerSensor]: "plug",
|
|
63258
|
+
[DeviceRole.EnergySensor]: "plug",
|
|
63259
|
+
[DeviceRole.VoltageSensor]: "plug",
|
|
63260
|
+
[DeviceRole.CurrentSensor]: "plug",
|
|
63261
|
+
[DeviceRole.AirQualitySensor]: "inherit",
|
|
63262
|
+
[DeviceRole.BatterySensor]: "inherit",
|
|
63263
|
+
[DeviceRole.NumericSensor]: "inherit",
|
|
63264
|
+
[DeviceRole.EnumSensor]: "inherit",
|
|
63265
|
+
[DeviceRole.DateTimeSensor]: "inherit",
|
|
63266
|
+
[DeviceRole.GenericSensor]: "inherit",
|
|
63267
|
+
[DeviceRole.NumericControl]: "control-dial",
|
|
63268
|
+
[DeviceRole.SelectControl]: "control-dial",
|
|
63269
|
+
[DeviceRole.TextControl]: "inherit",
|
|
63270
|
+
[DeviceRole.DateTimeControl]: "inherit",
|
|
63271
|
+
[DeviceRole.MobilePushNotifier]: "inherit",
|
|
63272
|
+
[DeviceRole.MessagingNotifier]: "inherit",
|
|
63273
|
+
[DeviceRole.EmailNotifier]: "inherit",
|
|
63274
|
+
[DeviceRole.GenericNotifier]: "inherit",
|
|
63275
|
+
[DeviceRole.IrTransmitter]: "inherit"
|
|
63276
|
+
};
|
|
63277
|
+
function isDeviceType$2(type) {
|
|
63278
|
+
return Object.values(DeviceType).includes(type);
|
|
63279
|
+
}
|
|
63280
|
+
function isDeviceRole$1(role) {
|
|
63281
|
+
return Object.values(DeviceRole).includes(role);
|
|
63282
|
+
}
|
|
63283
|
+
/** The scene id of a (role, type) pair. Role beats type; a type this build does not know gets the terminal. */
|
|
63284
|
+
function resolveHeroSceneId(role, type) {
|
|
63285
|
+
const byRole = role !== null && isDeviceRole$1(role) ? HERO_SCENE_BY_ROLE[role] : void 0;
|
|
63286
|
+
if (byRole !== void 0 && byRole !== "inherit") return byRole;
|
|
63287
|
+
return isDeviceType$2(type) ? HERO_SCENE_BY_TYPE[type] : "generic";
|
|
63288
|
+
}
|
|
62980
63289
|
/** A string in both languages, as the cap vocabulary writes it (D920): no `t()` in the model. */
|
|
62981
63290
|
var HeroTextSchema = zod.z.object({
|
|
62982
63291
|
en: zod.z.string(),
|
|
@@ -63129,6 +63438,32 @@ var HeroStateBackdropSchema = zod.z.object({
|
|
|
63129
63438
|
token: zod.z.enum(HERO_BACKGROUNDS),
|
|
63130
63439
|
animation: zod.z.enum(HERO_ANIMATIONS)
|
|
63131
63440
|
});
|
|
63441
|
+
var HeroFactSchema = zod.z.object({
|
|
63442
|
+
id: zod.z.enum([
|
|
63443
|
+
"power",
|
|
63444
|
+
"energy",
|
|
63445
|
+
"battery",
|
|
63446
|
+
"link",
|
|
63447
|
+
"phase",
|
|
63448
|
+
"remaining",
|
|
63449
|
+
"volume",
|
|
63450
|
+
"source",
|
|
63451
|
+
"consumables"
|
|
63452
|
+
]),
|
|
63453
|
+
icon: IconKeySchema.nullable(),
|
|
63454
|
+
text: HeroTextSchema,
|
|
63455
|
+
tone: HeroToneSchema
|
|
63456
|
+
});
|
|
63457
|
+
/** A labelled value beside the scene. */
|
|
63458
|
+
var HeroSideTileSchema = zod.z.object({
|
|
63459
|
+
label: HeroTextSchema,
|
|
63460
|
+
value: HeroTextSchema,
|
|
63461
|
+
tone: HeroToneSchema.optional()
|
|
63462
|
+
});
|
|
63463
|
+
var HeroSideTilesSchema = zod.z.object({
|
|
63464
|
+
left: zod.z.array(HeroSideTileSchema).max(2),
|
|
63465
|
+
right: zod.z.array(HeroSideTileSchema).max(2)
|
|
63466
|
+
});
|
|
63132
63467
|
var HeroBackgroundSchema = zod.z.discriminatedUnion("kind", [zod.z.object({
|
|
63133
63468
|
kind: zod.z.literal("artwork"),
|
|
63134
63469
|
url: zod.z.string(),
|
|
@@ -63152,6 +63487,11 @@ var HeroModelSchema = zod.z.object({
|
|
|
63152
63487
|
stateAssumed: zod.z.boolean(),
|
|
63153
63488
|
look: StateLookSchema,
|
|
63154
63489
|
background: HeroBackgroundSchema,
|
|
63490
|
+
/** Which animated picture the hero (and the list row) draws; its motion is `look.animation`. */
|
|
63491
|
+
scene: HeroSceneSchema,
|
|
63492
|
+
/** The top line's inline facts, in order; never wraps, so a client may cut the tail. */
|
|
63493
|
+
facts: zod.z.array(HeroFactSchema),
|
|
63494
|
+
sideTiles: HeroSideTilesSchema,
|
|
63155
63495
|
/** The status line under the main icon. */
|
|
63156
63496
|
title: HeroTextSchema,
|
|
63157
63497
|
badges: zod.z.array(HeroBadgeSchema),
|
|
@@ -63167,6 +63507,93 @@ var HeroModelSchema = zod.z.object({
|
|
|
63167
63507
|
provenance: zod.z.array(HeroProvenanceSchema)
|
|
63168
63508
|
});
|
|
63169
63509
|
/**
|
|
63510
|
+
* The ROW of a device in a list (D1023 P2): four fixed zones, all taken from
|
|
63511
|
+
* the hero model and nothing else.
|
|
63512
|
+
*
|
|
63513
|
+
* 1. mini-scene the same scene id as the hero, drawn 44x44 with the state look;
|
|
63514
|
+
* 2. name + ONE status line the facts joined by " · " by the client;
|
|
63515
|
+
* 3. the type's primary inline control;
|
|
63516
|
+
* 4. a trailing fact (power, else battery, else consumables).
|
|
63517
|
+
*
|
|
63518
|
+
* Selection rules, all taken from the model:
|
|
63519
|
+
* - ONE control is ever shown: the device's own power; else the FIRST control of
|
|
63520
|
+
* the FIRST row that has any (a later row's control is never promoted). When
|
|
63521
|
+
* the model lists that part in `gated`, the row has no inline control: the
|
|
63522
|
+
* projection never falls through to another control the caller could use.
|
|
63523
|
+
* - the status line is the head (what plays, else the state) plus at most
|
|
63524
|
+
* {@link ROW_STATUS_FACTS_MAX} facts, the trailing fact excluded;
|
|
63525
|
+
* - the trailing fact is the first of power, battery, consumables.
|
|
63526
|
+
*
|
|
63527
|
+
* `projectDeviceRow` is pure and computes nothing: it selects from a
|
|
63528
|
+
* {@link HeroModel}. A row that needed a value the hero lacks would mean the
|
|
63529
|
+
* model is missing it, so the fix goes in the model.
|
|
63530
|
+
*/
|
|
63531
|
+
var HeroRowModelSchema = zod.z.object({
|
|
63532
|
+
deviceId: zod.z.number().int(),
|
|
63533
|
+
name: zod.z.string(),
|
|
63534
|
+
type: zod.z.string(),
|
|
63535
|
+
state: HeroStateSchema,
|
|
63536
|
+
stateAssumed: zod.z.boolean(),
|
|
63537
|
+
look: StateLookSchema,
|
|
63538
|
+
scene: HeroSceneSchema,
|
|
63539
|
+
/** Joined by " · ": the state (or what is playing), then the facts. */
|
|
63540
|
+
statusLine: zod.z.array(HeroTextSchema),
|
|
63541
|
+
/** `null` = the type has no inline control, or the caller may not act on it. */
|
|
63542
|
+
primary: HeroControlSchema.nullable(),
|
|
63543
|
+
trailing: HeroFactSchema.nullable()
|
|
63544
|
+
});
|
|
63545
|
+
/** The trailing fact, in order of preference. */
|
|
63546
|
+
var TRAILING_ORDER = [
|
|
63547
|
+
"power",
|
|
63548
|
+
"battery",
|
|
63549
|
+
"consumables"
|
|
63550
|
+
];
|
|
63551
|
+
function trailingOf(facts) {
|
|
63552
|
+
for (const id of TRAILING_ORDER) {
|
|
63553
|
+
const found = facts.find((f) => f.id === id);
|
|
63554
|
+
if (found !== void 0) return found;
|
|
63555
|
+
}
|
|
63556
|
+
return null;
|
|
63557
|
+
}
|
|
63558
|
+
function primaryOf(model) {
|
|
63559
|
+
const power = model.ownPower;
|
|
63560
|
+
if (power !== null) {
|
|
63561
|
+
if (model.gated.includes("own-power")) return null;
|
|
63562
|
+
return {
|
|
63563
|
+
kind: "toggle",
|
|
63564
|
+
id: "own-power",
|
|
63565
|
+
label: power.turnOn.label,
|
|
63566
|
+
on: power.on,
|
|
63567
|
+
turnOn: power.turnOn,
|
|
63568
|
+
turnOff: power.turnOff
|
|
63569
|
+
};
|
|
63570
|
+
}
|
|
63571
|
+
for (const row of model.rows) {
|
|
63572
|
+
const control = row.controls[0];
|
|
63573
|
+
if (control === void 0) continue;
|
|
63574
|
+
return model.gated.includes(row.id) ? null : control;
|
|
63575
|
+
}
|
|
63576
|
+
return null;
|
|
63577
|
+
}
|
|
63578
|
+
function statusLineOf(model, trailing) {
|
|
63579
|
+
return [model.rows.find((r) => r.id === "now-playing")?.status ?? null ?? model.title, ...model.facts.filter((f) => f !== trailing).map((f) => f.text).slice(0, 3)];
|
|
63580
|
+
}
|
|
63581
|
+
function projectDeviceRow(model) {
|
|
63582
|
+
const trailing = trailingOf(model.facts);
|
|
63583
|
+
return {
|
|
63584
|
+
deviceId: model.deviceId,
|
|
63585
|
+
name: model.name,
|
|
63586
|
+
type: model.type,
|
|
63587
|
+
state: model.state,
|
|
63588
|
+
stateAssumed: model.stateAssumed,
|
|
63589
|
+
look: model.look,
|
|
63590
|
+
scene: model.scene,
|
|
63591
|
+
statusLine: statusLineOf(model, trailing),
|
|
63592
|
+
primary: primaryOf(model),
|
|
63593
|
+
trailing
|
|
63594
|
+
};
|
|
63595
|
+
}
|
|
63596
|
+
/**
|
|
63170
63597
|
* hero-layout — what a device's hero says (D1023). Read-only: the FIXED
|
|
63171
63598
|
* layouts live in `@camstack/types` and nothing here stores or edits one.
|
|
63172
63599
|
* `getHeroModel` builds the pure model from the device's bindings and its
|
|
@@ -63182,6 +63609,11 @@ var heroInput = zod.z.object({
|
|
|
63182
63609
|
*/
|
|
63183
63610
|
canActuate: zod.z.boolean().optional()
|
|
63184
63611
|
});
|
|
63612
|
+
var rowModelsInput = zod.z.object({
|
|
63613
|
+
deviceIds: zod.z.array(zod.z.number().int().nonnegative()).max(500),
|
|
63614
|
+
/** As `canActuate` of `getHeroModel`; absent = may. */
|
|
63615
|
+
canActuate: zod.z.boolean().optional()
|
|
63616
|
+
});
|
|
63185
63617
|
var HeroLayoutRowsSchema = zod.z.object({
|
|
63186
63618
|
type: zod.z.string(),
|
|
63187
63619
|
rows: zod.z.array(HeroRowIdSchema)
|
|
@@ -63196,6 +63628,16 @@ var heroLayoutCapability = {
|
|
|
63196
63628
|
auth: "protected",
|
|
63197
63629
|
role: "viewer"
|
|
63198
63630
|
}),
|
|
63631
|
+
/**
|
|
63632
|
+
* The list rows of many devices in ONE call, projected from the same model as
|
|
63633
|
+
* the hero. One entry per requested id, in order. `null` has two meanings, both
|
|
63634
|
+
* "no row": the registry does not know the device, or reading it failed (the
|
|
63635
|
+
* provider logs that, tagged). It is never an empty row.
|
|
63636
|
+
*/
|
|
63637
|
+
getRowModels: method(rowModelsInput, zod.z.array(HeroRowModelSchema.nullable()), {
|
|
63638
|
+
auth: "protected",
|
|
63639
|
+
role: "viewer"
|
|
63640
|
+
}),
|
|
63199
63641
|
getLayout: method(zod.z.object({ deviceType: zod.z.string() }), HeroLayoutRowsSchema, {
|
|
63200
63642
|
auth: "protected",
|
|
63201
63643
|
role: "viewer"
|
|
@@ -63914,20 +64356,40 @@ var integrationInstancesCapability = {
|
|
|
63914
64356
|
instanceFormSchema: method(zod.z.object({
|
|
63915
64357
|
id: IntegrationInstanceIdSchema.nullable(),
|
|
63916
64358
|
/** The kind of the create form (`id: null`) of a provider with several. */
|
|
63917
|
-
kind: zod.z.string().min(1).optional()
|
|
64359
|
+
kind: zod.z.string().min(1).optional(),
|
|
64360
|
+
/** The wizard mode of the integration type (`getAvailableTypes`); a form may differ per mode. */
|
|
64361
|
+
mode: zod.z.enum([
|
|
64362
|
+
"standalone",
|
|
64363
|
+
"account",
|
|
64364
|
+
"broker"
|
|
64365
|
+
]).optional(),
|
|
64366
|
+
/** The discovery candidate the wizard was seeded from (`stableId`), if any. */
|
|
64367
|
+
candidateStableId: zod.z.string().min(1).optional()
|
|
63918
64368
|
}), ConfigSchemaPassthrough$2, { auth: "admin" }),
|
|
63919
64369
|
listInstances: method(zod.z.void(), zod.z.array(IntegrationInstanceSchema).readonly(), { auth: "admin" }),
|
|
63920
64370
|
getInstance: method(zod.z.object({ id: IntegrationInstanceIdSchema }), IntegrationInstanceSchema.nullable(), { auth: "admin" }),
|
|
63921
64371
|
/**
|
|
63922
64372
|
* Insert the typed record. With `id` it is stored under that id (a duplicate id is refused);
|
|
63923
64373
|
* without one the PROVIDER mints it and answers it. `kind` picks one of `describe().kinds`.
|
|
64374
|
+
*
|
|
64375
|
+
* An instance of a kind that brings devices (`role: 'devices'`) is an integration: the HUB mints
|
|
64376
|
+
* the id (the `integrations` registry id, which its devices carry), refuses the create when
|
|
64377
|
+
* `testInstance` rejects the values (D1016; a kind with no test passes and says so), writes the
|
|
64378
|
+
* registry row and the record, and removes both when either step fails. An `id` is accepted
|
|
64379
|
+
* only when it names an existing registry row of the addon.
|
|
63924
64380
|
*/
|
|
63925
64381
|
createInstance: method(zod.z.object({
|
|
63926
64382
|
id: IntegrationInstanceIdSchema.optional(),
|
|
63927
64383
|
name: zod.z.string().min(1),
|
|
63928
64384
|
kind: zod.z.string().min(1).optional(),
|
|
63929
64385
|
/** Form values written with the record (a link picked in the create dialog). */
|
|
63930
|
-
values: zod.z.record(zod.z.string(), zod.z.unknown()).optional()
|
|
64386
|
+
values: zod.z.record(zod.z.string(), zod.z.unknown()).optional(),
|
|
64387
|
+
/**
|
|
64388
|
+
* The discovery candidate (`stableId`) the instance is set up from. Kept on the integration
|
|
64389
|
+
* registry row of an instance that brings devices, so discovery stops offering a candidate
|
|
64390
|
+
* that already has its integration (D984). Ignored by an instance with no registry row.
|
|
64391
|
+
*/
|
|
64392
|
+
originStableId: zod.z.string().min(1).optional()
|
|
63931
64393
|
}), zod.z.object({ id: zod.z.string() }), {
|
|
63932
64394
|
kind: "mutation",
|
|
63933
64395
|
auth: "admin"
|
|
@@ -63948,7 +64410,11 @@ var integrationInstancesCapability = {
|
|
|
63948
64410
|
kind: "mutation",
|
|
63949
64411
|
auth: "admin"
|
|
63950
64412
|
}),
|
|
63951
|
-
/**
|
|
64413
|
+
/**
|
|
64414
|
+
* Delete the record and its keychain refs together. For an instance that brings devices the hub
|
|
64415
|
+
* also removes the integration's devices (their tombstones, D865), the registry row, and emits
|
|
64416
|
+
* `IntegrationDeleted`; a fixed builtin and an instance a link names are refused first.
|
|
64417
|
+
*/
|
|
63952
64418
|
deleteInstance: method(zod.z.object({ id: IntegrationInstanceIdSchema }), zod.z.object({ ok: zod.z.literal(true) }), {
|
|
63953
64419
|
kind: "mutation",
|
|
63954
64420
|
auth: "admin"
|
|
@@ -64182,27 +64648,6 @@ var intercomCapability = {
|
|
|
64182
64648
|
*/
|
|
64183
64649
|
history: "none"
|
|
64184
64650
|
};
|
|
64185
|
-
/**
|
|
64186
|
-
* A pulse train in signed microseconds: mark (+) first, then space (-), strictly
|
|
64187
|
-
* alternating, no zeros, 2..1024 entries.
|
|
64188
|
-
*/
|
|
64189
|
-
var IrTimingsSchema = zod.z.array(zod.z.number().int()).min(2).max(1024).superRefine((timings, ctx) => {
|
|
64190
|
-
timings.forEach((value, index) => {
|
|
64191
|
-
const expectMark = index % 2 === 0;
|
|
64192
|
-
if (value === 0 || value > 0 !== expectMark) ctx.addIssue({
|
|
64193
|
-
code: "custom",
|
|
64194
|
-
message: `timing ${index} must be a non-zero ${expectMark ? "mark (positive)" : "space (negative)"}`,
|
|
64195
|
-
path: [index]
|
|
64196
|
-
});
|
|
64197
|
-
});
|
|
64198
|
-
});
|
|
64199
|
-
/** Per-command transmit options. Every key is optional; a transmitter applies what it can. */
|
|
64200
|
-
var TransmitSettingsSchema = zod.z.object({
|
|
64201
|
-
carrierHz: zod.z.number().int().positive().optional(),
|
|
64202
|
-
dutyCyclePercent: zod.z.number().int().min(1).max(100).optional(),
|
|
64203
|
-
repeat: zod.z.number().int().min(0).max(20).optional(),
|
|
64204
|
-
repeatDelayMs: zod.z.number().int().min(0).optional()
|
|
64205
|
-
});
|
|
64206
64651
|
/** The setting keys a transmitter may declare as settable (`getInfo.settable`). */
|
|
64207
64652
|
var TransmitSettingKeySchema = zod.z.enum([
|
|
64208
64653
|
"carrierHz",
|
|
@@ -82375,7 +82820,8 @@ var powerSourceCustomize = {
|
|
|
82375
82820
|
kind: "constant",
|
|
82376
82821
|
path: "offSeconds",
|
|
82377
82822
|
value: 10,
|
|
82378
|
-
when: "add"
|
|
82823
|
+
when: "add",
|
|
82824
|
+
formerValues: [0]
|
|
82379
82825
|
}, {
|
|
82380
82826
|
kind: "clock",
|
|
82381
82827
|
path: "lastFetchedAt",
|
|
@@ -86094,6 +86540,10 @@ function refineSources(config, ctx) {
|
|
|
86094
86540
|
if (numbers.has(source.number)) fail(`channel ${source.number} is declared twice`, "number");
|
|
86095
86541
|
numbers.add(source.number);
|
|
86096
86542
|
}
|
|
86543
|
+
if (source.kind === "ir") {
|
|
86544
|
+
const problem = irSourceProblem(source);
|
|
86545
|
+
if (problem !== null) fail(problem, "payload");
|
|
86546
|
+
}
|
|
86097
86547
|
for (const role of remoteSourceSteps(source)) if (isRemoteWidgetRole(role)) fail(`"${source.name}" presses ${role}, a layout widget, not a command`, "steps");
|
|
86098
86548
|
else if (config.bindings[role] === void 0) fail(`"${source.name}" presses ${role}, which is not bound`, "steps");
|
|
86099
86549
|
});
|
|
@@ -86115,6 +86565,14 @@ function refineSources(config, ctx) {
|
|
|
86115
86565
|
}
|
|
86116
86566
|
});
|
|
86117
86567
|
}
|
|
86568
|
+
/** A stored source that was left out of a read, and why (the UI shows it). */
|
|
86569
|
+
var RemoteRefusedSourceSchema = zod.z.object({
|
|
86570
|
+
/** Position in the stored list. */
|
|
86571
|
+
index: zod.z.number().int().nonnegative(),
|
|
86572
|
+
id: zod.z.string().nullable(),
|
|
86573
|
+
name: zod.z.string().nullable(),
|
|
86574
|
+
reason: zod.z.string()
|
|
86575
|
+
});
|
|
86118
86576
|
var RemoteConfigSchema = zod.z.object({
|
|
86119
86577
|
layoutTemplateId: zod.z.string().min(1).nullable(),
|
|
86120
86578
|
/**
|
|
@@ -86132,7 +86590,13 @@ var RemoteConfigSchema = zod.z.object({
|
|
|
86132
86590
|
sources: zod.z.array(RemoteSourceSchema).max(200).default([]),
|
|
86133
86591
|
/** The pause between two steps of a source: the television's receiver, not a repeat. */
|
|
86134
86592
|
stepDelayMs: zod.z.number().int().min(100).max(REMOTE_STEP_DELAY_MAX_MS).default(500),
|
|
86135
|
-
power: zod.z.object({ mode: RemotePowerModeSchema })
|
|
86593
|
+
power: zod.z.object({ mode: RemotePowerModeSchema }),
|
|
86594
|
+
/**
|
|
86595
|
+
* READ-ONLY: sources a stored configuration carries that no longer parse,
|
|
86596
|
+
* left out of `sources` with the reason (`readStoredRemoteConfig`). Never
|
|
86597
|
+
* stored: the store strips it on write.
|
|
86598
|
+
*/
|
|
86599
|
+
refusedSources: zod.z.array(RemoteRefusedSourceSchema).optional()
|
|
86136
86600
|
}).superRefine((config, ctx) => {
|
|
86137
86601
|
const roles = Object.keys(config.bindings);
|
|
86138
86602
|
if (roles.length > 200) ctx.addIssue({
|
|
@@ -86173,6 +86637,60 @@ var RemoteConfigSchema = zod.z.object({
|
|
|
86173
86637
|
}
|
|
86174
86638
|
refineSources(config, ctx);
|
|
86175
86639
|
});
|
|
86640
|
+
var StoredSourcesShapeSchema = zod.z.looseObject({ sources: zod.z.array(zod.z.unknown()) });
|
|
86641
|
+
var SourceIdentitySchema = zod.z.object({
|
|
86642
|
+
id: zod.z.string(),
|
|
86643
|
+
name: zod.z.string()
|
|
86644
|
+
}).partial();
|
|
86645
|
+
/**
|
|
86646
|
+
* Read a STORED configuration. A single source that no longer parses (a code
|
|
86647
|
+
* the transmitter could not send, a malformed entry) must not make the whole
|
|
86648
|
+
* remote unreadable: it is left out and named in `refusedSources`, and the other
|
|
86649
|
+
* sources and the bindings load. Writing stays strict (`RemoteConfigSchema`).
|
|
86650
|
+
*/
|
|
86651
|
+
function readStoredRemoteConfig(raw) {
|
|
86652
|
+
const shape = StoredSourcesShapeSchema.safeParse(raw);
|
|
86653
|
+
if (!shape.success) return finishRead(RemoteConfigSchema.safeParse(raw));
|
|
86654
|
+
const kept = [];
|
|
86655
|
+
const refused = [];
|
|
86656
|
+
shape.data.sources.forEach((candidate, index) => {
|
|
86657
|
+
const parsed = RemoteSourceSchema.safeParse(candidate);
|
|
86658
|
+
const problem = parsed.success && parsed.data.kind === "ir" ? irSourceProblem(parsed.data) : null;
|
|
86659
|
+
if (parsed.success && problem === null) {
|
|
86660
|
+
kept.push(candidate);
|
|
86661
|
+
return;
|
|
86662
|
+
}
|
|
86663
|
+
const identity = SourceIdentitySchema.safeParse(candidate);
|
|
86664
|
+
const reason = problem ?? parsed.error?.issues[0]?.message ?? "not a source";
|
|
86665
|
+
refused.push({
|
|
86666
|
+
index,
|
|
86667
|
+
id: identity.success ? identity.data.id ?? null : null,
|
|
86668
|
+
name: identity.success ? identity.data.name ?? null : null,
|
|
86669
|
+
reason
|
|
86670
|
+
});
|
|
86671
|
+
});
|
|
86672
|
+
const read = finishRead(RemoteConfigSchema.safeParse({
|
|
86673
|
+
...shape.data,
|
|
86674
|
+
sources: kept
|
|
86675
|
+
}));
|
|
86676
|
+
if (!read.success || refused.length === 0) return read;
|
|
86677
|
+
return {
|
|
86678
|
+
success: true,
|
|
86679
|
+
data: {
|
|
86680
|
+
...read.data,
|
|
86681
|
+
refusedSources: refused
|
|
86682
|
+
}
|
|
86683
|
+
};
|
|
86684
|
+
}
|
|
86685
|
+
function finishRead(parsed) {
|
|
86686
|
+
return parsed.success ? {
|
|
86687
|
+
success: true,
|
|
86688
|
+
data: parsed.data
|
|
86689
|
+
} : {
|
|
86690
|
+
success: false,
|
|
86691
|
+
issues: parsed.error.issues.length
|
|
86692
|
+
};
|
|
86693
|
+
}
|
|
86176
86694
|
var EMPTY_REMOTE_CONFIG = {
|
|
86177
86695
|
layoutTemplateId: null,
|
|
86178
86696
|
defaultTransmitterId: null,
|
|
@@ -94310,14 +94828,6 @@ var BUILTIN_REMOTE_COMPONENTS = [
|
|
|
94310
94828
|
buttons: []
|
|
94311
94829
|
}
|
|
94312
94830
|
];
|
|
94313
|
-
zod.z.discriminatedUnion("kind", [zod.z.object({
|
|
94314
|
-
kind: zod.z.literal("raw"),
|
|
94315
|
-
timings: zod.z.array(zod.z.number().int()),
|
|
94316
|
-
settings: TransmitSettingsSchema.optional()
|
|
94317
|
-
}), zod.z.object({
|
|
94318
|
-
kind: zod.z.literal("pronto"),
|
|
94319
|
-
code: zod.z.string()
|
|
94320
|
-
})]);
|
|
94321
94831
|
/**
|
|
94322
94832
|
* Propose a running threshold from a device's own power history (planning#405).
|
|
94323
94833
|
*
|
|
@@ -96682,6 +97192,21 @@ function legacyAutoLinkIds(params) {
|
|
|
96682
97192
|
/** Marker written to a declared integration's `info`. */
|
|
96683
97193
|
var DECLARED_INTEGRATION_FIXED_KEY = "fixed";
|
|
96684
97194
|
/**
|
|
97195
|
+
* Give a declared integration its instance record, ONCE. The record is read first and left
|
|
97196
|
+
* exactly as it is when it exists (an operator's rename, a field the addon later adds): a seed
|
|
97197
|
+
* never overwrites. A read that fails throws and writes nothing (D49) — the next pass retries.
|
|
97198
|
+
* True when the record was written by this call.
|
|
97199
|
+
*/
|
|
97200
|
+
async function seedInstanceOnce(instances, seed) {
|
|
97201
|
+
const existing = await instances.getInstance({ id: seed.id });
|
|
97202
|
+
if (existing !== null && existing !== void 0) return false;
|
|
97203
|
+
await instances.createInstance({
|
|
97204
|
+
id: seed.id,
|
|
97205
|
+
name: seed.name
|
|
97206
|
+
});
|
|
97207
|
+
return true;
|
|
97208
|
+
}
|
|
97209
|
+
/**
|
|
96685
97210
|
* Strip the `<node>/<addon>` suffix a forked child carries.
|
|
96686
97211
|
*
|
|
96687
97212
|
* Comparing `ctx.kernel.localNodeId` raw skipped EVERY node — including the one
|
|
@@ -96729,7 +97254,13 @@ var DeclaredDevices = class {
|
|
|
96729
97254
|
};
|
|
96730
97255
|
}
|
|
96731
97256
|
}
|
|
96732
|
-
|
|
97257
|
+
let integrationId;
|
|
97258
|
+
if (spec.integrationId !== void 0) integrationId = spec.integrationId;
|
|
97259
|
+
else {
|
|
97260
|
+
const own = await this.ensureIntegration(spec.integrationName);
|
|
97261
|
+
integrationId = own.id;
|
|
97262
|
+
await this.seedInstance(own);
|
|
97263
|
+
}
|
|
96733
97264
|
const index = await this.readIndex();
|
|
96734
97265
|
const live = await this.readLiveByStableId();
|
|
96735
97266
|
const outcomes = [];
|
|
@@ -96737,10 +97268,11 @@ var DeclaredDevices = class {
|
|
|
96737
97268
|
const outcome = await this.applyDeclaration(declaration, integrationId, index, live);
|
|
96738
97269
|
if (outcome !== null) outcomes.push(outcome);
|
|
96739
97270
|
}
|
|
97271
|
+
const removed = await this.sweepWithdrawn(spec.devices, integrationId, index);
|
|
96740
97272
|
return {
|
|
96741
97273
|
integrationId,
|
|
96742
97274
|
devices: outcomes,
|
|
96743
|
-
removed
|
|
97275
|
+
removed,
|
|
96744
97276
|
owned: true
|
|
96745
97277
|
};
|
|
96746
97278
|
}
|
|
@@ -96764,7 +97296,10 @@ var DeclaredDevices = class {
|
|
|
96764
97296
|
integrationId: created.id,
|
|
96765
97297
|
name: integrationName
|
|
96766
97298
|
} });
|
|
96767
|
-
return
|
|
97299
|
+
return {
|
|
97300
|
+
id: created.id,
|
|
97301
|
+
name: integrationName
|
|
97302
|
+
};
|
|
96768
97303
|
}
|
|
96769
97304
|
if (existing.info?.["fixed"] !== true) {
|
|
96770
97305
|
await this.ports.updateIntegration({
|
|
@@ -96773,7 +97308,26 @@ var DeclaredDevices = class {
|
|
|
96773
97308
|
});
|
|
96774
97309
|
this.ports.logger.info("re-asserted `fixed` on a declared integration", { meta: { integrationId: existing.id } });
|
|
96775
97310
|
}
|
|
96776
|
-
return
|
|
97311
|
+
return {
|
|
97312
|
+
id: existing.id,
|
|
97313
|
+
name: existing.name ?? integrationName
|
|
97314
|
+
};
|
|
97315
|
+
}
|
|
97316
|
+
/** Seed the instance record of an integration this declarer owns; best-effort, retried next pass. */
|
|
97317
|
+
async seedInstance(integration) {
|
|
97318
|
+
const { seedInstance } = this.ports;
|
|
97319
|
+
if (seedInstance === void 0) return;
|
|
97320
|
+
try {
|
|
97321
|
+
await seedInstance({
|
|
97322
|
+
id: integration.id,
|
|
97323
|
+
name: integration.name
|
|
97324
|
+
});
|
|
97325
|
+
} catch (err) {
|
|
97326
|
+
this.ports.logger.warn("could not seed the instance record of a declared integration", {
|
|
97327
|
+
tags: { integrationId: integration.id },
|
|
97328
|
+
meta: { error: errMsg(err) }
|
|
97329
|
+
});
|
|
97330
|
+
}
|
|
96777
97331
|
}
|
|
96778
97332
|
async readIndex() {
|
|
96779
97333
|
const rows = await this.ports.listOwnDevices();
|
|
@@ -97130,6 +97684,18 @@ function reading(source, state, assumed = false) {
|
|
|
97130
97684
|
assumed
|
|
97131
97685
|
};
|
|
97132
97686
|
}
|
|
97687
|
+
function fact(id, icon, text, tone = "muted") {
|
|
97688
|
+
return {
|
|
97689
|
+
id,
|
|
97690
|
+
icon,
|
|
97691
|
+
text,
|
|
97692
|
+
tone
|
|
97693
|
+
};
|
|
97694
|
+
}
|
|
97695
|
+
function minutesLeft(seconds) {
|
|
97696
|
+
const m = Math.ceil(seconds / 60);
|
|
97697
|
+
return t(`${m} min left`, `${m} min rimanenti`);
|
|
97698
|
+
}
|
|
97133
97699
|
function deviceTypeOf(type) {
|
|
97134
97700
|
return Object.values(DeviceType).find((t) => t === type);
|
|
97135
97701
|
}
|
|
@@ -97179,7 +97745,8 @@ var runningStateContribution = contribution("running-state", RunningStateStatusS
|
|
|
97179
97745
|
detail
|
|
97180
97746
|
}
|
|
97181
97747
|
},
|
|
97182
|
-
rows: [row]
|
|
97748
|
+
rows: [row],
|
|
97749
|
+
...phase !== null && running === true ? { facts: [fact("phase", "activity", t(phase, phase), "primary")] } : {}
|
|
97183
97750
|
};
|
|
97184
97751
|
});
|
|
97185
97752
|
var powerMeterContribution = contribution("power-meter", PowerMeterStatusSchema, (slice) => {
|
|
@@ -97200,14 +97767,29 @@ var powerMeterContribution = contribution("power-meter", PowerMeterStatusSchema,
|
|
|
97200
97767
|
value: slice.current,
|
|
97201
97768
|
unit: "A"
|
|
97202
97769
|
});
|
|
97203
|
-
|
|
97204
|
-
|
|
97205
|
-
|
|
97206
|
-
|
|
97207
|
-
|
|
97208
|
-
|
|
97770
|
+
const watts = Math.round(slice.power);
|
|
97771
|
+
const text = t(`${watts} W`, `${watts} W`);
|
|
97772
|
+
return {
|
|
97773
|
+
consumption: {
|
|
97774
|
+
priority: 2,
|
|
97775
|
+
slot: {
|
|
97776
|
+
kind: "power",
|
|
97777
|
+
watts: slice.power,
|
|
97778
|
+
detail
|
|
97779
|
+
}
|
|
97780
|
+
},
|
|
97781
|
+
facts: [fact("power", "zap", text, watts > 0 ? "primary" : "muted")],
|
|
97782
|
+
tiles: {
|
|
97783
|
+
right: [{
|
|
97784
|
+
label: t("Power", "Potenza"),
|
|
97785
|
+
value: text
|
|
97786
|
+
}],
|
|
97787
|
+
...slice.energy === void 0 ? {} : { left: [{
|
|
97788
|
+
label: t("Energy", "Energia"),
|
|
97789
|
+
value: t(`${slice.energy} kWh`, `${slice.energy} kWh`)
|
|
97790
|
+
}] }
|
|
97209
97791
|
}
|
|
97210
|
-
}
|
|
97792
|
+
};
|
|
97211
97793
|
});
|
|
97212
97794
|
function batteryTone(level) {
|
|
97213
97795
|
if (level === null) return "muted";
|
|
@@ -97216,24 +97798,39 @@ function batteryTone(level) {
|
|
|
97216
97798
|
}
|
|
97217
97799
|
var batteryContribution = contribution("battery", BatteryStatusSchema, (slice) => {
|
|
97218
97800
|
const level = slice?.level ?? null;
|
|
97219
|
-
|
|
97801
|
+
const badge = {
|
|
97220
97802
|
id: "battery",
|
|
97221
97803
|
icon: "battery",
|
|
97222
97804
|
tone: batteryTone(level),
|
|
97223
97805
|
value: level,
|
|
97224
97806
|
label: level === null ? t("Battery", "Batteria") : t(`Battery ${level}%`, `Batteria ${level}%`)
|
|
97225
|
-
}
|
|
97807
|
+
};
|
|
97808
|
+
return {
|
|
97809
|
+
badges: [badge],
|
|
97810
|
+
...level === null ? {} : {
|
|
97811
|
+
facts: [fact("battery", "battery", badge.label, badge.tone)],
|
|
97812
|
+
tiles: { left: [{
|
|
97813
|
+
label: t("Battery", "Batteria"),
|
|
97814
|
+
value: t(`${level}%`, `${level}%`),
|
|
97815
|
+
tone: badge.tone
|
|
97816
|
+
}] }
|
|
97817
|
+
}
|
|
97818
|
+
};
|
|
97226
97819
|
});
|
|
97227
97820
|
var networkLinkContribution = contribution("network-link", NetworkLinkStatusSchema, (slice) => {
|
|
97228
97821
|
const signal = slice?.signal ?? null;
|
|
97229
97822
|
const known = slice !== void 0 && slice.type !== "unknown";
|
|
97230
|
-
|
|
97823
|
+
const badge = {
|
|
97231
97824
|
id: "network-link",
|
|
97232
97825
|
icon: "wifi",
|
|
97233
97826
|
tone: !known ? "muted" : signal !== null && signal < 30 ? "warning" : "success",
|
|
97234
97827
|
value: signal,
|
|
97235
97828
|
label: known ? t(slice.type, slice.type) : t("Link unknown", "Collegamento sconosciuto")
|
|
97236
|
-
}
|
|
97829
|
+
};
|
|
97830
|
+
return {
|
|
97831
|
+
badges: [badge],
|
|
97832
|
+
...known ? { facts: [fact("link", "wifi", badge.label, badge.tone)] } : {}
|
|
97833
|
+
};
|
|
97237
97834
|
});
|
|
97238
97835
|
var contactContribution = contribution("contact", ContactStatusSchema, (slice) => {
|
|
97239
97836
|
const row = {
|
|
@@ -97244,7 +97841,8 @@ var contactContribution = contribution("contact", ContactStatusSchema, (slice) =
|
|
|
97244
97841
|
};
|
|
97245
97842
|
return {
|
|
97246
97843
|
reading: reading("contact", slice === void 0 ? "unknown" : slice.entryOpen ? "on" : "off"),
|
|
97247
|
-
rows: [row]
|
|
97844
|
+
rows: [row],
|
|
97845
|
+
...slice === void 0 ? {} : { scene: { mode: slice.entryOpen ? "open" : "closed" } }
|
|
97248
97846
|
};
|
|
97249
97847
|
});
|
|
97250
97848
|
var motionTriggerContribution = contribution("motion-trigger", MotionTriggerStatusSchema, (slice) => {
|
|
@@ -97323,10 +97921,14 @@ var consumablesContribution = contribution("consumables", ConsumablesStatusSchem
|
|
|
97323
97921
|
level: item.level,
|
|
97324
97922
|
needsAttention: item.status !== null && ATTENTION_STATUSES.includes(item.status)
|
|
97325
97923
|
}));
|
|
97326
|
-
|
|
97327
|
-
|
|
97328
|
-
|
|
97329
|
-
|
|
97924
|
+
const attention = items.filter((i) => i.needsAttention).length;
|
|
97925
|
+
return {
|
|
97926
|
+
consumables: {
|
|
97927
|
+
items,
|
|
97928
|
+
attention
|
|
97929
|
+
},
|
|
97930
|
+
...attention === 0 ? {} : { facts: [fact("consumables", null, t(`${attention} to check`, `${attention} da controllare`), "warning")] }
|
|
97931
|
+
};
|
|
97330
97932
|
});
|
|
97331
97933
|
var dishwasherContribution = contribution("dishwasher", DishwasherStatusSchema, (slice) => {
|
|
97332
97934
|
const state = slice === void 0 || slice.state === "unavailable" ? "unknown" : slice.state === "running" ? "running" : slice.state === "error" ? "alert" : "idle";
|
|
@@ -97350,9 +97952,17 @@ var dishwasherContribution = contribution("dishwasher", DishwasherStatusSchema,
|
|
|
97350
97952
|
turnOff: action("appliance-power.off", t("Standby", "Standby"), "power-off", "dishwasher", "setPower", { on: false })
|
|
97351
97953
|
}]
|
|
97352
97954
|
});
|
|
97955
|
+
const remaining = slice?.remaining ?? null;
|
|
97353
97956
|
return {
|
|
97354
97957
|
reading: reading("dishwasher", state),
|
|
97355
|
-
rows
|
|
97958
|
+
rows,
|
|
97959
|
+
...remaining === null ? {} : {
|
|
97960
|
+
facts: [fact("remaining", "timer", minutesLeft(remaining), "primary")],
|
|
97961
|
+
tiles: { right: [{
|
|
97962
|
+
label: t("Left", "Rimane"),
|
|
97963
|
+
value: minutesLeft(remaining)
|
|
97964
|
+
}] }
|
|
97965
|
+
}
|
|
97356
97966
|
};
|
|
97357
97967
|
});
|
|
97358
97968
|
var has$1 = (ctx, f) => ctx.features.includes(f);
|
|
@@ -97460,8 +98070,23 @@ var HERO_CAP_CONTRIBUTIONS = [
|
|
|
97460
98070
|
}] : []
|
|
97461
98071
|
});
|
|
97462
98072
|
}
|
|
98073
|
+
const volumeNow = view.volumeKnown ? slice?.volumeLevel ?? null : null;
|
|
98074
|
+
const sourceNow = view.source === null || view.source.current === "" ? null : view.source.current;
|
|
98075
|
+
const mode = view.running === "playing" ? "playing" : view.running === "paused" ? "paused" : null;
|
|
98076
|
+
const facts = [];
|
|
98077
|
+
if (sourceNow !== null) facts.push(fact("source", "radio", t(sourceNow, sourceNow)));
|
|
98078
|
+
if (volumeNow !== null) facts.push(fact("volume", "volume-2", t(`${volumeNow}%`, `${volumeNow}%`)));
|
|
97463
98079
|
return {
|
|
97464
98080
|
reading: mediaReading(view),
|
|
98081
|
+
facts,
|
|
98082
|
+
...volumeNow === null ? {} : { tiles: { right: [{
|
|
98083
|
+
label: t("Volume", "Volume"),
|
|
98084
|
+
value: t(`${volumeNow}%`, `${volumeNow}%`)
|
|
98085
|
+
}] } },
|
|
98086
|
+
scene: {
|
|
98087
|
+
...mode === null ? {} : { mode },
|
|
98088
|
+
...volumeNow === null ? {} : { level: volumeNow / 100 }
|
|
98089
|
+
},
|
|
97465
98090
|
...view.canSwitchPower ? { ownPower: {
|
|
97466
98091
|
source: "media-player",
|
|
97467
98092
|
on: view.power === "unknown" ? null : view.power === "on",
|
|
@@ -97955,6 +98580,9 @@ function provenanceOf(cap, fragment) {
|
|
|
97955
98580
|
if (fragment.powerSupply !== void 0) ids.push("power-supply");
|
|
97956
98581
|
if (fragment.consumption !== void 0) ids.push("consumption");
|
|
97957
98582
|
if (fragment.consumables !== void 0) ids.push("consumables");
|
|
98583
|
+
if (fragment.facts !== void 0 && fragment.facts.length > 0) ids.push("facts");
|
|
98584
|
+
if (fragment.tiles !== void 0) ids.push("side-tiles");
|
|
98585
|
+
if (fragment.scene !== void 0) ids.push("scene");
|
|
97958
98586
|
if (fragment.remote !== void 0) ids.push("remote");
|
|
97959
98587
|
for (const badge of fragment.badges ?? []) ids.push(badge.id);
|
|
97960
98588
|
for (const row of fragment.rows ?? []) ids.push(row.id);
|
|
@@ -97971,6 +98599,17 @@ function consumptionOf(fragments) {
|
|
|
97971
98599
|
}
|
|
97972
98600
|
return best === null ? null : best.slot;
|
|
97973
98601
|
}
|
|
98602
|
+
function tilesOf(fragments, side) {
|
|
98603
|
+
return fragments.flatMap((f) => f.tiles?.[side] ?? []).slice(0, 2);
|
|
98604
|
+
}
|
|
98605
|
+
function sceneOf(role, type, fragments) {
|
|
98606
|
+
const parts = fragments.flatMap((f) => f.scene === void 0 ? [] : [f.scene]);
|
|
98607
|
+
return {
|
|
98608
|
+
id: resolveHeroSceneId(role, type),
|
|
98609
|
+
mode: parts.find((p) => p.mode !== void 0)?.mode ?? null,
|
|
98610
|
+
level: parts.find((p) => p.level !== void 0)?.level ?? null
|
|
98611
|
+
};
|
|
98612
|
+
}
|
|
97974
98613
|
function buildHeroModel(input) {
|
|
97975
98614
|
const { device } = input;
|
|
97976
98615
|
const ctx = {
|
|
@@ -98011,6 +98650,11 @@ function buildHeroModel(input) {
|
|
|
98011
98650
|
const powerSupply = fragments.find((f) => f.powerSupply !== void 0)?.powerSupply ?? null;
|
|
98012
98651
|
const remote = fragments.find((f) => f.remote !== void 0)?.remote ?? null;
|
|
98013
98652
|
const badges = fragments.flatMap((f) => f.badges ?? []);
|
|
98653
|
+
const facts = fragments.flatMap((f) => f.facts ?? []);
|
|
98654
|
+
const sideTiles = {
|
|
98655
|
+
left: tilesOf(fragments, "left"),
|
|
98656
|
+
right: tilesOf(fragments, "right")
|
|
98657
|
+
};
|
|
98014
98658
|
const gated = [];
|
|
98015
98659
|
if (!input.access.canActuate) {
|
|
98016
98660
|
if (ownPower !== null) gated.push("own-power");
|
|
@@ -98028,6 +98672,9 @@ function buildHeroModel(input) {
|
|
|
98028
98672
|
stateAssumed: assumed,
|
|
98029
98673
|
look,
|
|
98030
98674
|
background,
|
|
98675
|
+
scene: sceneOf(device.role, device.type, fragments),
|
|
98676
|
+
facts,
|
|
98677
|
+
sideTiles,
|
|
98031
98678
|
title: STATE_TEXT[state],
|
|
98032
98679
|
badges,
|
|
98033
98680
|
remote,
|
|
@@ -101556,6 +102203,13 @@ var METHOD_ACCESS_MAP = Object.freeze({
|
|
|
101556
102203
|
access: "view",
|
|
101557
102204
|
role: "viewer"
|
|
101558
102205
|
},
|
|
102206
|
+
"heroLayout.getRowModels": {
|
|
102207
|
+
capName: "hero-layout",
|
|
102208
|
+
capScope: "system",
|
|
102209
|
+
addonId: null,
|
|
102210
|
+
access: "view",
|
|
102211
|
+
role: "viewer"
|
|
102212
|
+
},
|
|
101559
102213
|
"humidifier.getStatus": {
|
|
101560
102214
|
capName: "humidifier",
|
|
101561
102215
|
capScope: "device",
|
|
@@ -109607,6 +110261,11 @@ Object.freeze({
|
|
|
109607
110261
|
form: "single",
|
|
109608
110262
|
optional: false
|
|
109609
110263
|
}],
|
|
110264
|
+
"heroLayout.getRowModels": [{
|
|
110265
|
+
name: "deviceIds",
|
|
110266
|
+
form: "array",
|
|
110267
|
+
optional: false
|
|
110268
|
+
}],
|
|
109610
110269
|
"humidifier.getStatus": [{
|
|
109611
110270
|
name: "deviceId",
|
|
109612
110271
|
form: "single",
|
|
@@ -114555,12 +115214,6 @@ Object.defineProperty(exports, "RemoteAssumedStateSchema", {
|
|
|
114555
115214
|
return RemoteAssumedStateSchema;
|
|
114556
115215
|
}
|
|
114557
115216
|
});
|
|
114558
|
-
Object.defineProperty(exports, "RemoteConfigSchema", {
|
|
114559
|
-
enumerable: true,
|
|
114560
|
-
get: function() {
|
|
114561
|
-
return RemoteConfigSchema;
|
|
114562
|
-
}
|
|
114563
|
-
});
|
|
114564
115217
|
Object.defineProperty(exports, "RevConflictError", {
|
|
114565
115218
|
enumerable: true,
|
|
114566
115219
|
get: function() {
|
|
@@ -115299,6 +115952,12 @@ Object.defineProperty(exports, "emitReadiness", {
|
|
|
115299
115952
|
return emitReadiness;
|
|
115300
115953
|
}
|
|
115301
115954
|
});
|
|
115955
|
+
Object.defineProperty(exports, "entryBody", {
|
|
115956
|
+
enumerable: true,
|
|
115957
|
+
get: function() {
|
|
115958
|
+
return entryBody;
|
|
115959
|
+
}
|
|
115960
|
+
});
|
|
115302
115961
|
Object.defineProperty(exports, "enumerateInferenceDevices", {
|
|
115303
115962
|
enumerable: true,
|
|
115304
115963
|
get: function() {
|
|
@@ -116067,6 +116726,12 @@ Object.defineProperty(exports, "processTimeZoneOr", {
|
|
|
116067
116726
|
return processTimeZoneOr;
|
|
116068
116727
|
}
|
|
116069
116728
|
});
|
|
116729
|
+
Object.defineProperty(exports, "projectDeviceRow", {
|
|
116730
|
+
enumerable: true,
|
|
116731
|
+
get: function() {
|
|
116732
|
+
return projectDeviceRow;
|
|
116733
|
+
}
|
|
116734
|
+
});
|
|
116070
116735
|
Object.defineProperty(exports, "proposeRunningThreshold", {
|
|
116071
116736
|
enumerable: true,
|
|
116072
116737
|
get: function() {
|
|
@@ -116079,6 +116744,12 @@ Object.defineProperty(exports, "ptzAutotrackCapability", {
|
|
|
116079
116744
|
return ptzAutotrackCapability;
|
|
116080
116745
|
}
|
|
116081
116746
|
});
|
|
116747
|
+
Object.defineProperty(exports, "readStoredRemoteConfig", {
|
|
116748
|
+
enumerable: true,
|
|
116749
|
+
get: function() {
|
|
116750
|
+
return readStoredRemoteConfig;
|
|
116751
|
+
}
|
|
116752
|
+
});
|
|
116082
116753
|
Object.defineProperty(exports, "readinessKey", {
|
|
116083
116754
|
enumerable: true,
|
|
116084
116755
|
get: function() {
|
|
@@ -116295,6 +116966,12 @@ Object.defineProperty(exports, "secretViewsOf", {
|
|
|
116295
116966
|
return secretViewsOf;
|
|
116296
116967
|
}
|
|
116297
116968
|
});
|
|
116969
|
+
Object.defineProperty(exports, "seedInstanceOnce", {
|
|
116970
|
+
enumerable: true,
|
|
116971
|
+
get: function() {
|
|
116972
|
+
return seedInstanceOnce;
|
|
116973
|
+
}
|
|
116974
|
+
});
|
|
116298
116975
|
Object.defineProperty(exports, "settingsStoreCapability", {
|
|
116299
116976
|
enumerable: true,
|
|
116300
116977
|
get: function() {
|
|
@@ -116481,6 +117158,12 @@ Object.defineProperty(exports, "toSecretFieldView", {
|
|
|
116481
117158
|
return toSecretFieldView;
|
|
116482
117159
|
}
|
|
116483
117160
|
});
|
|
117161
|
+
Object.defineProperty(exports, "toTimings", {
|
|
117162
|
+
enumerable: true,
|
|
117163
|
+
get: function() {
|
|
117164
|
+
return toTimings;
|
|
117165
|
+
}
|
|
117166
|
+
});
|
|
116484
117167
|
Object.defineProperty(exports, "transformSecretWrite", {
|
|
116485
117168
|
enumerable: true,
|
|
116486
117169
|
get: function() {
|