@camstack/server 1.2.840 → 1.2.842
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 +13 -0
- package/dist/api/oauth2/oauth2-routes.js +50 -6
- package/dist/api/trpc/generated-cap-routers.js +16 -0
- package/dist/core/addon/addon-registry.service.js +4 -0
- package/dist/core/addon/addon-route-request.js +18 -0
- package/dist/main.js +8 -5
- package/package.json +16 -8
- package/system/dist/addon-routes/addon-route-registry.d.ts +27 -1
- package/system/dist/addon-runner.js +7 -3
- package/system/dist/addon-runner.mjs +7 -3
- 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 +5 -5
- package/system/dist/builtins/composer/composer.addon.mjs +5 -5
- 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/composition-api.d.ts +2 -2
- package/system/dist/builtins/core-blocks/composition-sources.d.ts +9 -2
- package/system/dist/builtins/core-blocks/core-blocks.addon.d.ts +2 -0
- package/system/dist/builtins/core-blocks/core-blocks.addon.js +598 -395
- package/system/dist/builtins/core-blocks/core-blocks.addon.mjs +598 -395
- package/system/dist/builtins/core-blocks/fan-link-forward.d.ts +42 -0
- package/system/dist/builtins/core-blocks/fan-presets-service.d.ts +25 -39
- package/system/dist/builtins/core-blocks/fan-presets-wiring.d.ts +5 -3
- package/system/dist/builtins/core-blocks/migrations/helper-to-customize.d.ts +3 -1
- package/system/dist/builtins/core-blocks/power-source-service.d.ts +2 -0
- package/system/dist/builtins/core-blocks/timed-run/timed-run-service.d.ts +8 -2
- 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-bindings-store.d.ts +8 -5
- package/system/dist/builtins/device-manager/device-manager.addon.js +116 -22
- package/system/dist/builtins/device-manager/device-manager.addon.mjs +116 -22
- package/system/dist/builtins/device-manager/device-row-store.d.ts +0 -52
- 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 +21 -7
- package/system/dist/builtins/local-auth/local-auth.addon.mjs +21 -7
- package/system/dist/builtins/local-auth/oauth-grants.d.ts +9 -1
- package/system/dist/builtins/local-auth/oauth-session-manager.d.ts +8 -0
- package/system/dist/builtins/local-auth/record-kinds.d.ts +2 -0
- package/system/dist/builtins/local-network/local-network.addon.js +3 -3
- package/system/dist/builtins/local-network/local-network.addon.mjs +3 -3
- 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 +3 -3
- 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-7E2O4-UN.js → capture-engine-DSrJUGYs.js} +1 -1
- package/system/dist/{capture-engine-B5IBWIRT.mjs → capture-engine-DySELkE_.mjs} +1 -1
- package/system/dist/{composition-sources-DLtc8lSL.js → composition-sources-CNfFz3Cz.js} +32 -5
- package/system/dist/{composition-sources-Cfqn4cly.mjs → composition-sources-DZ4E9FFU.mjs} +32 -5
- package/system/dist/{constants-DjsgCnZk.mjs → constants-BEXN_b1Y.mjs} +1 -1
- package/system/dist/{constants-Cc70YreG.js → constants-DkgFDCQ7.js} +1 -1
- package/system/dist/{device-ca-CVP5h3u1.mjs → device-ca-Dk_9f4MY.mjs} +1 -1
- package/system/dist/{device-ca-C6JqeFfK.js → device-ca-sYcSz-Fv.js} +1 -1
- package/system/dist/{dist-OmrC_RZs.mjs → dist-4jAoRtpT.mjs} +1700 -363
- package/system/dist/{dist-CLnTYKFn.js → dist-LQWK1_M4.js} +1753 -374
- package/system/dist/file-host-worker.js +1 -1
- package/system/dist/file-host-worker.mjs +1 -1
- package/system/dist/{hub-identity-CKQVXf4o.mjs → hub-identity-BxGHDga-.mjs} +1 -1
- package/system/dist/{hub-identity-TrZcnJkB.js → hub-identity-haC7V8-b.js} +1 -1
- package/system/dist/{hub-mdns-ciao-C8G0K1Z1.mjs → hub-mdns-ciao-Birwi8W5.mjs} +2 -2
- package/system/dist/{hub-mdns-ciao-ocg6suyX.js → hub-mdns-ciao-zxNvdRQz.js} +2 -2
- package/system/dist/index.d.ts +1 -1
- package/system/dist/index.js +63 -13
- package/system/dist/index.mjs +62 -14
- package/system/dist/kernel/moleculer/child-addon-call-dispatch.d.ts +1 -0
- package/system/dist/{legacy-integration-rows-door-BPkJUGaX.mjs → legacy-integration-rows-door-C-hOd-lt.mjs} +1 -1
- package/system/dist/{legacy-integration-rows-door-b6CUxtXX.js → legacy-integration-rows-door-CCtcCRjZ.js} +1 -1
- package/system/dist/{rename-composition-block-N7lslQJK.js → rename-composition-block-BCZeI3eY.js} +1 -1
- package/system/dist/{rename-composition-block-DPlsP1xF.mjs → rename-composition-block-YpAVqp4W.mjs} +1 -1
- package/system/dist/{restore-archive-Btc3H-Fg.mjs → restore-archive-BpC3y50e.mjs} +1 -1
- package/system/dist/{restore-archive-CcuEoEtj.js → restore-archive-D0Nyukhb.js} +1 -1
- package/system/dist/{wal-maintenance-g7yvxLMj.mjs → wal-maintenance-C7jLVFCw.mjs} +0 -0
- package/system/dist/{wal-maintenance-B2_uCEi5.js → wal-maintenance-CRiSNk0X.js} +0 -0
- package/system/package.json +1 -1
|
@@ -803,7 +803,7 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
|
803
803
|
return EventCategory;
|
|
804
804
|
}({});
|
|
805
805
|
//#endregion
|
|
806
|
-
//#region ../types/dist/composed-stable-id-
|
|
806
|
+
//#region ../types/dist/composed-stable-id-CPp3votu.mjs
|
|
807
807
|
/**
|
|
808
808
|
import { errMsg } from '@camstack/types'
|
|
809
809
|
* Extract a human-readable message from an unknown error value.
|
|
@@ -822,12 +822,12 @@ var DeviceType = /* @__PURE__ */ function(DeviceType) {
|
|
|
822
822
|
DeviceType["Siren"] = "siren";
|
|
823
823
|
DeviceType["Switch"] = "switch";
|
|
824
824
|
DeviceType["Sensor"] = "sensor";
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
* `climate-control`
|
|
828
|
-
*
|
|
829
|
-
*
|
|
830
|
-
*
|
|
825
|
+
/** Every climate device: an air conditioner, a room thermostat, a radiator
|
|
826
|
+
* valve, a floor-heating zone, a heat-pump circuit. They share one set of
|
|
827
|
+
* controls (`climate-control`), so they are one type; WHICH kind of climate
|
|
828
|
+
* device it is is its {@link DeviceRole} (`climate-*`), which the UI and the
|
|
829
|
+
* exports branch on. The retired `thermostat` type is read as this one
|
|
830
|
+
* (`canonicalStoredDeviceType`). */
|
|
831
831
|
DeviceType["Climate"] = "climate";
|
|
832
832
|
DeviceType["Button"] = "button";
|
|
833
833
|
/** Generic stateless event emitter — carries a device's EXACT declared
|
|
@@ -918,10 +918,6 @@ var DeviceType = /* @__PURE__ */ function(DeviceType) {
|
|
|
918
918
|
/** Washing machine. A plug-built one is running while its power stays
|
|
919
919
|
* above a threshold. No program cap — that surface is the dishwasher's. */
|
|
920
920
|
DeviceType["Washer"] = "washer";
|
|
921
|
-
/** A dumb plug-in stove or heater: a switch (and, with a meter, a power
|
|
922
|
-
* reading) that only runs while the plug is on. Built from a smart plug;
|
|
923
|
-
* the `timed-run` cap switches it off again after a chosen time. */
|
|
924
|
-
DeviceType["Heater"] = "heater";
|
|
925
921
|
/** Tumble dryer. Same plug-built running surface as {@link Washer}. */
|
|
926
922
|
DeviceType["Dryer"] = "dryer";
|
|
927
923
|
/** The physical bridge box of a vendor ecosystem (Velux KLF-200, and later
|
|
@@ -1150,6 +1146,27 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
|
|
|
1150
1146
|
/** A smart plug: a `switch` whose source says it is an outlet (HA
|
|
1151
1147
|
* `device_class: outlet`). The Alexa export shows it as a SMARTPLUG. */
|
|
1152
1148
|
DeviceRole["Outlet"] = "outlet";
|
|
1149
|
+
/** A dumb plug-in stove or heater behind a switch: it runs only while the
|
|
1150
|
+
* switch is on. Offered `timed-run`, which switches it off again after a
|
|
1151
|
+
* chosen time. */
|
|
1152
|
+
DeviceRole["SwitchHeater"] = "switch-heater";
|
|
1153
|
+
/** A plain fan behind a switch (a smart plug powering it): drawn as a fan,
|
|
1154
|
+
* with the switch's on/off only. Speed or oscillation appear only when the
|
|
1155
|
+
* device also has a fan cap (D1033). */
|
|
1156
|
+
DeviceRole["SwitchFan"] = "switch-fan";
|
|
1157
|
+
/** Air conditioner / split unit: cooling, fan speed, louvres. */
|
|
1158
|
+
DeviceRole["ClimateAc"] = "climate-ac";
|
|
1159
|
+
/** Room thermostat: a setpoint and a room temperature. The default. */
|
|
1160
|
+
DeviceRole["ClimateThermostat"] = "climate-thermostat";
|
|
1161
|
+
/** Floor-heating zone actuator. */
|
|
1162
|
+
DeviceRole["ClimateFloor"] = "climate-floor";
|
|
1163
|
+
/** Radiator valve (thermostatic radiator head). */
|
|
1164
|
+
DeviceRole["ClimateRadiator"] = "climate-radiator";
|
|
1165
|
+
/** A heater with its own thermostat (stove, convector). */
|
|
1166
|
+
DeviceRole["ClimateHeater"] = "climate-heater";
|
|
1167
|
+
/** One heating/cooling circuit of a heat pump: a water loop with comfort /
|
|
1168
|
+
* eco setpoints and a heat/cool mode, no room sensor. */
|
|
1169
|
+
DeviceRole["ClimateHeatPumpCircuit"] = "climate-heat-pump-circuit";
|
|
1153
1170
|
/** Generic motion / occupancy / moving event source. Distinct from
|
|
1154
1171
|
* the camera accessory PirSensor role: that one is a camera child;
|
|
1155
1172
|
* this is a standalone HA / 3rd-party motion sensor. */
|
|
@@ -1226,7 +1243,7 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
|
|
|
1226
1243
|
*/
|
|
1227
1244
|
var COMPOSED_DEVICE_STABLE_ID_PREFIX = "composed-";
|
|
1228
1245
|
//#endregion
|
|
1229
|
-
//#region ../types/dist/sleep-
|
|
1246
|
+
//#region ../types/dist/sleep-D0roI_CZ.mjs
|
|
1230
1247
|
/**
|
|
1231
1248
|
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
1232
1249
|
* window to float samples (D455).
|
|
@@ -7772,6 +7789,50 @@ var ACTUATOR_CAP_VOCABULARY = {
|
|
|
7772
7789
|
value: false
|
|
7773
7790
|
},
|
|
7774
7791
|
args: { oscillating: false }
|
|
7792
|
+
},
|
|
7793
|
+
{
|
|
7794
|
+
id: "fan.horizontalOscillateOn",
|
|
7795
|
+
method: "setOscillationAxis",
|
|
7796
|
+
label: t("Horizontal oscillation on", "Oscillazione orizzontale attiva"),
|
|
7797
|
+
phrase: t("Start the horizontal oscillation of {device}", "Attiva l’oscillazione orizzontale di {device}"),
|
|
7798
|
+
icon: "move-horizontal",
|
|
7799
|
+
args: {
|
|
7800
|
+
axis: "horizontal",
|
|
7801
|
+
oscillating: true
|
|
7802
|
+
}
|
|
7803
|
+
},
|
|
7804
|
+
{
|
|
7805
|
+
id: "fan.horizontalOscillateOff",
|
|
7806
|
+
method: "setOscillationAxis",
|
|
7807
|
+
label: t("Horizontal oscillation off", "Oscillazione orizzontale spenta"),
|
|
7808
|
+
phrase: t("Stop the horizontal oscillation of {device}", "Ferma l’oscillazione orizzontale di {device}"),
|
|
7809
|
+
icon: "move-horizontal",
|
|
7810
|
+
args: {
|
|
7811
|
+
axis: "horizontal",
|
|
7812
|
+
oscillating: false
|
|
7813
|
+
}
|
|
7814
|
+
},
|
|
7815
|
+
{
|
|
7816
|
+
id: "fan.verticalOscillateOn",
|
|
7817
|
+
method: "setOscillationAxis",
|
|
7818
|
+
label: t("Vertical oscillation on", "Oscillazione verticale attiva"),
|
|
7819
|
+
phrase: t("Start the vertical oscillation of {device}", "Attiva l’oscillazione verticale di {device}"),
|
|
7820
|
+
icon: "move-vertical",
|
|
7821
|
+
args: {
|
|
7822
|
+
axis: "vertical",
|
|
7823
|
+
oscillating: true
|
|
7824
|
+
}
|
|
7825
|
+
},
|
|
7826
|
+
{
|
|
7827
|
+
id: "fan.verticalOscillateOff",
|
|
7828
|
+
method: "setOscillationAxis",
|
|
7829
|
+
label: t("Vertical oscillation off", "Oscillazione verticale spenta"),
|
|
7830
|
+
phrase: t("Stop the vertical oscillation of {device}", "Ferma l’oscillazione verticale di {device}"),
|
|
7831
|
+
icon: "move-vertical",
|
|
7832
|
+
args: {
|
|
7833
|
+
axis: "vertical",
|
|
7834
|
+
oscillating: false
|
|
7835
|
+
}
|
|
7775
7836
|
}
|
|
7776
7837
|
],
|
|
7777
7838
|
state: [{
|
|
@@ -12447,6 +12508,10 @@ Object.freeze({
|
|
|
12447
12508
|
"path": "lastEvent.eventType",
|
|
12448
12509
|
"valueType": "string"
|
|
12449
12510
|
},
|
|
12511
|
+
{
|
|
12512
|
+
"path": "lastEvent.sourceId",
|
|
12513
|
+
"valueType": "string"
|
|
12514
|
+
},
|
|
12450
12515
|
{
|
|
12451
12516
|
"path": "lastEvent.timestamp",
|
|
12452
12517
|
"valueType": "number"
|
|
@@ -13849,7 +13914,7 @@ function sleep(ms) {
|
|
|
13849
13914
|
return new Promise((resolve) => setTimeout(resolve, Math.max(0, ms)));
|
|
13850
13915
|
}
|
|
13851
13916
|
//#endregion
|
|
13852
|
-
//#region ../types/dist/implemented-methods-
|
|
13917
|
+
//#region ../types/dist/implemented-methods-5YMDeE3f.mjs
|
|
13853
13918
|
var AUDIO_ENCODER_BY_CODEC = {
|
|
13854
13919
|
opus: "libopus",
|
|
13855
13920
|
aac: "aac",
|
|
@@ -17198,6 +17263,22 @@ function describeUnmet(unmet) {
|
|
|
17198
17263
|
}
|
|
17199
17264
|
}
|
|
17200
17265
|
/**
|
|
17266
|
+
* The integration instance of an addon, as it appears in an address or on an
|
|
17267
|
+
* OAuth link (planning#415, D1046).
|
|
17268
|
+
*
|
|
17269
|
+
* The DEFAULT instance has two spellings on the wire and one in the code: a
|
|
17270
|
+
* path with no instance segment and a link with no instance both mean it, and
|
|
17271
|
+
* its id is the addon id. {@link oauthLinkServesInstance} is the one
|
|
17272
|
+
* comparison a per-instance route is meant to call, so nobody compares
|
|
17273
|
+
* `undefined` with an id. Nothing calls it yet: no route declares
|
|
17274
|
+
* `perInstance` (the Alexa per-instance route, T3, is the first consumer).
|
|
17275
|
+
*/
|
|
17276
|
+
/** An instance id as it may appear in a path or a query: no separator, no escape, bounded. */
|
|
17277
|
+
var ADDON_INSTANCE_ID_RE = /^[A-Za-z0-9._-]{1,64}$/;
|
|
17278
|
+
function isAddonInstanceId(value) {
|
|
17279
|
+
return ADDON_INSTANCE_ID_RE.test(value);
|
|
17280
|
+
}
|
|
17281
|
+
/**
|
|
17201
17282
|
* notification-output — canonical, capability-gated notification delivery.
|
|
17202
17283
|
*
|
|
17203
17284
|
* Apprise-derived model (see
|
|
@@ -42541,16 +42622,39 @@ function metaQuantity(schema) {
|
|
|
42541
42622
|
function quantityOfField(schema) {
|
|
42542
42623
|
return metaQuantity(schema) ?? metaQuantity(unwrapSchema(schema));
|
|
42543
42624
|
}
|
|
42625
|
+
function scalarKind(schema) {
|
|
42626
|
+
const s = unwrapSchema(schema);
|
|
42627
|
+
if (s instanceof zod.z.ZodNumber) return "number";
|
|
42628
|
+
if (s instanceof zod.z.ZodString) return "string";
|
|
42629
|
+
if (s instanceof zod.z.ZodBoolean) return "boolean";
|
|
42630
|
+
return null;
|
|
42631
|
+
}
|
|
42632
|
+
/** A union is a leaf only when EVERY member is a scalar; one object or array member keeps it out. */
|
|
42633
|
+
function unionMembersOf(s) {
|
|
42634
|
+
const members = [];
|
|
42635
|
+
for (const option of s.options) {
|
|
42636
|
+
if (!(option instanceof zod.z.ZodType)) return null;
|
|
42637
|
+
const kind = scalarKind(option);
|
|
42638
|
+
if (kind === null) return null;
|
|
42639
|
+
if (!members.includes(kind)) members.push(kind);
|
|
42640
|
+
}
|
|
42641
|
+
return members.length > 0 ? members : null;
|
|
42642
|
+
}
|
|
42544
42643
|
function leafKind(schema) {
|
|
42545
42644
|
const s = unwrapSchema(schema);
|
|
42546
42645
|
if (s instanceof zod.z.ZodEnum) return {
|
|
42547
42646
|
kind: "enum",
|
|
42548
42647
|
enumValues: s.options
|
|
42549
42648
|
};
|
|
42550
|
-
if (s instanceof zod.z.
|
|
42551
|
-
|
|
42552
|
-
|
|
42553
|
-
|
|
42649
|
+
if (s instanceof zod.z.ZodUnion) {
|
|
42650
|
+
const members = unionMembersOf(s);
|
|
42651
|
+
return members === null ? null : {
|
|
42652
|
+
kind: "union",
|
|
42653
|
+
unionMembers: members
|
|
42654
|
+
};
|
|
42655
|
+
}
|
|
42656
|
+
const scalar = scalarKind(s);
|
|
42657
|
+
return scalar === null ? null : { kind: scalar };
|
|
42554
42658
|
}
|
|
42555
42659
|
/** Walk a cap status schema into flat wireable leaf fields (dotted paths).
|
|
42556
42660
|
* Recurses into nested ZodObject (unwrapping nullable/optional/default first),
|
|
@@ -42575,6 +42679,7 @@ function enumerateSchemaFields(schema, prefix = "") {
|
|
|
42575
42679
|
path,
|
|
42576
42680
|
kind: leaf.kind,
|
|
42577
42681
|
...leaf.enumValues ? { enumValues: leaf.enumValues } : {},
|
|
42682
|
+
...leaf.unionMembers ? { unionMembers: leaf.unionMembers } : {},
|
|
42578
42683
|
...quantity !== void 0 ? { quantity } : {}
|
|
42579
42684
|
});
|
|
42580
42685
|
}
|
|
@@ -44064,9 +44169,12 @@ function convertLegacyWhen(half) {
|
|
|
44064
44169
|
* every caller — automations, Actions, and the notification centre, which runs
|
|
44065
44170
|
* only Actions (planning#473).
|
|
44066
44171
|
*/
|
|
44172
|
+
/** The longest one `wait` step lasts. It is cut by a restart of the run and does not survive a hub restart. */
|
|
44173
|
+
var WAIT_MAX_SECONDS = 3600;
|
|
44174
|
+
var WAIT_TOO_LONG = `a wait is at most one hour (${WAIT_MAX_SECONDS} s)`;
|
|
44067
44175
|
var AutomationWaitStepSchema = zod.z.object({
|
|
44068
44176
|
kind: zod.z.literal("wait"),
|
|
44069
|
-
seconds: zod.z.number().min(0).max(
|
|
44177
|
+
seconds: zod.z.number().min(0).max(WAIT_MAX_SECONDS, WAIT_TOO_LONG)
|
|
44070
44178
|
});
|
|
44071
44179
|
/** The legacy `deviceId` of a cap step: still READ, never written (D983). */
|
|
44072
44180
|
var LegacyStepDeviceSchema = zod.z.union([
|
|
@@ -44196,20 +44304,210 @@ var ActionStepSchema = zod.z.discriminatedUnion("kind", [GuardedWaitStepSchema,
|
|
|
44196
44304
|
path: ["if"]
|
|
44197
44305
|
});
|
|
44198
44306
|
});
|
|
44307
|
+
/**
|
|
44308
|
+
* Flow control of an AUTOMATION's list (#500). A standalone list (an action, a
|
|
44309
|
+
* scheduler point, a preset) stays `wait` and `cap`: it has no run of its own
|
|
44310
|
+
* to end and no variable bag to write.
|
|
44311
|
+
*/
|
|
44312
|
+
var continueOnErrorShape = {
|
|
44313
|
+
/** A failure of this step is traced `failed-continued` and the next step runs. */
|
|
44314
|
+
continueOnError: zod.z.literal(true).optional() };
|
|
44315
|
+
/** An automation's cap step: the shared guarded cap step, plus `continueOnError`. */
|
|
44316
|
+
var AutomationGuardedCapStepSchema = AutomationCapStepBaseSchema.extend({
|
|
44317
|
+
...stepGuardShape,
|
|
44318
|
+
...continueOnErrorShape
|
|
44319
|
+
}).refine((step) => step.target !== void 0 || step.deviceId !== void 0, {
|
|
44320
|
+
message: "a cap step needs a target",
|
|
44321
|
+
path: ["target"]
|
|
44322
|
+
}).refine((step) => step.target?.kind !== "domain" || step.actionId !== void 0, {
|
|
44323
|
+
message: "a domain target needs the vocabulary action it applies to (actionId)",
|
|
44324
|
+
path: ["actionId"]
|
|
44325
|
+
}).refine((step) => step.else === void 0 || step.if !== void 0, elseNeedsIf);
|
|
44326
|
+
/** End the run here, on purpose. `reason` may carry `{{vars.x}}` slots. */
|
|
44327
|
+
var AutomationStopStepSchema = zod.z.object({
|
|
44328
|
+
kind: zod.z.literal("stop"),
|
|
44329
|
+
reason: zod.z.string().min(1, "a stop needs a reason: it is what the run trace shows").max(200),
|
|
44330
|
+
/** `ok`: the run ends as a success. `failed`: it ends as a failure, with the reason. */
|
|
44331
|
+
outcome: zod.z.enum(["ok", "failed"]),
|
|
44332
|
+
/** Stop only when this reads true; false or unknown does not stop. */
|
|
44333
|
+
if: AutomationWhenSchema.optional()
|
|
44334
|
+
});
|
|
44335
|
+
var SET_VAR_NAME_RE = /^[A-Za-z_][A-Za-z0-9_]{0,39}$/;
|
|
44336
|
+
/** Names the run itself writes and reads (`leaf` is what `triggered-by` judges): a step may not overwrite them. */
|
|
44337
|
+
var RESERVED_RUN_VARS = [
|
|
44338
|
+
"kind",
|
|
44339
|
+
"leaf",
|
|
44340
|
+
"at"
|
|
44341
|
+
];
|
|
44342
|
+
/**
|
|
44343
|
+
* Write variables into the run's bag, for the steps after it. SUBSTITUTION
|
|
44344
|
+
* only, never evaluation: a text value may carry `{{vars.x}}` slots.
|
|
44345
|
+
*/
|
|
44346
|
+
var AutomationSetStepSchema = zod.z.object({
|
|
44347
|
+
kind: zod.z.literal("set"),
|
|
44348
|
+
vars: zod.z.record(zod.z.string(), zod.z.union([
|
|
44349
|
+
zod.z.string().max(500),
|
|
44350
|
+
zod.z.number(),
|
|
44351
|
+
zod.z.boolean()
|
|
44352
|
+
])).refine((vars) => Object.keys(vars).every((name) => SET_VAR_NAME_RE.test(name)), { message: "a variable name is letters, digits and _, not starting with a digit (max 40)" }).refine((vars) => Object.keys(vars).length >= 1, { message: "set needs at least one variable" }).refine((vars) => Object.keys(vars).length <= 20, { message: `set holds at most 20 variables` }).refine((vars) => Object.keys(vars).every((name) => !RESERVED_RUN_VARS.includes(name)), { message: `the names ${RESERVED_RUN_VARS.join(", ")} belong to the run and cannot be set` }),
|
|
44353
|
+
/** Set only when this reads true; false or unknown leaves the bag as it is. */
|
|
44354
|
+
if: AutomationWhenSchema.optional()
|
|
44355
|
+
});
|
|
44356
|
+
var AutomationRunActionStepSchema = zod.z.object({
|
|
44357
|
+
kind: zod.z.literal("action"),
|
|
44358
|
+
/** An entry of the `actions` surface (`internal:<uuid>` or `<addonId>:<localId>`). */
|
|
44359
|
+
actionId: zod.z.string().min(1),
|
|
44360
|
+
/** Values for the action's declared variables; the others take their default. */
|
|
44361
|
+
variables: zod.z.record(zod.z.string(), zod.z.union([
|
|
44362
|
+
zod.z.string(),
|
|
44363
|
+
zod.z.number(),
|
|
44364
|
+
zod.z.boolean()
|
|
44365
|
+
])).optional(),
|
|
44366
|
+
...continueOnErrorShape
|
|
44367
|
+
});
|
|
44368
|
+
/**
|
|
44369
|
+
* A step INSIDE a branch of a `choose`: a flow step with no condition of its
|
|
44370
|
+
* own (the branch is the condition) and no block inside it. Strict, so an `if`
|
|
44371
|
+
* written on such a step is refused rather than dropped.
|
|
44372
|
+
*/
|
|
44373
|
+
/** The longest a `wait-until` may wait: six hours. */
|
|
44374
|
+
var WAIT_UNTIL_TIMEOUT_MAX_S = 21600;
|
|
44375
|
+
/**
|
|
44376
|
+
* Pause the run until a condition is true (#500). The timeout is mandatory: a
|
|
44377
|
+
* run never waits without an end. `onTimeout` says what a wait that ran out
|
|
44378
|
+
* does: `continue` goes on to the next step, `stop` ends the run as a failure.
|
|
44379
|
+
* A condition that cannot be read is not "true": the wait goes on (D49).
|
|
44380
|
+
*/
|
|
44381
|
+
var AutomationWaitUntilStepSchema = zod.z.object({
|
|
44382
|
+
kind: zod.z.literal("wait-until"),
|
|
44383
|
+
when: AutomationWhenSchema,
|
|
44384
|
+
timeoutS: zod.z.number().int().min(1, "a wait needs a timeout of at least one second").max(WAIT_UNTIL_TIMEOUT_MAX_S, `a wait for a condition is at most six hours (${WAIT_UNTIL_TIMEOUT_MAX_S} s)`),
|
|
44385
|
+
onTimeout: zod.z.enum(["continue", "stop"])
|
|
44386
|
+
}).strict();
|
|
44387
|
+
/** The step kinds that hold steps of their own, or pause on a condition: they nest two levels at most. */
|
|
44388
|
+
var BLOCK_STEP_KINDS = [
|
|
44389
|
+
"choose",
|
|
44390
|
+
"repeat",
|
|
44391
|
+
"parallel",
|
|
44392
|
+
"wait-until"
|
|
44393
|
+
];
|
|
44394
|
+
var NEST_TOO_DEEP = `steps nest two levels at most: a step inside a nested choose or repeat can be a plain step only`;
|
|
44395
|
+
function kindOf(input) {
|
|
44396
|
+
return typeof input === "object" && input !== null ? Reflect.get(input, "kind") : void 0;
|
|
44397
|
+
}
|
|
44398
|
+
/** Where the nesting ends, a block step is refused in words rather than as an unknown kind. */
|
|
44399
|
+
function nestTooDeep(issue) {
|
|
44400
|
+
const kind = kindOf(issue.input);
|
|
44401
|
+
return typeof kind === "string" && BLOCK_STEP_KINDS.includes(kind) ? NEST_TOO_DEEP : void 0;
|
|
44402
|
+
}
|
|
44403
|
+
var plainStepSchemas = [
|
|
44404
|
+
AutomationWaitStepSchema.strict(),
|
|
44405
|
+
AutomationCapStepBaseSchema.extend(continueOnErrorShape).strict().refine((step) => step.target !== void 0 || step.deviceId !== void 0, {
|
|
44406
|
+
message: "a cap step needs a target",
|
|
44407
|
+
path: ["target"]
|
|
44408
|
+
}).refine((step) => step.target?.kind !== "domain" || step.actionId !== void 0, {
|
|
44409
|
+
message: "a domain target needs the vocabulary action it applies to (actionId)",
|
|
44410
|
+
path: ["actionId"]
|
|
44411
|
+
}),
|
|
44412
|
+
AutomationStopStepSchema.omit({ if: true }).strict(),
|
|
44413
|
+
AutomationSetStepSchema.omit({ if: true }).strict(),
|
|
44414
|
+
AutomationRunActionStepSchema.strict()
|
|
44415
|
+
];
|
|
44416
|
+
/**
|
|
44417
|
+
* A plain step: a flow step with no condition of its own and no step inside
|
|
44418
|
+
* it. The second (last) level of nesting holds these only.
|
|
44419
|
+
*/
|
|
44420
|
+
var AutomationBranchStepSchema = zod.z.discriminatedUnion("kind", plainStepSchemas, { error: nestTooDeep });
|
|
44421
|
+
/** A step that can run beside others: it writes no variable and does not end the run. */
|
|
44422
|
+
var AutomationParallelMemberSchema = AutomationBranchStepSchema.refine((step) => step.kind === "cap" || step.kind === "action" || step.kind === "wait", "a parallel holds device commands, actions and waits only: a set or a stop beside other steps has no order");
|
|
44423
|
+
/**
|
|
44424
|
+
* Several steps at once (#500): all are started together and all are awaited.
|
|
44425
|
+
* A failure fails the run once the others finished, as in a sequence; a member
|
|
44426
|
+
* marked "continue if this fails" does not.
|
|
44427
|
+
*/
|
|
44428
|
+
var AutomationParallelStepSchema = zod.z.object({
|
|
44429
|
+
kind: zod.z.literal("parallel"),
|
|
44430
|
+
steps: zod.z.array(AutomationParallelMemberSchema).min(2, "a parallel needs at least two steps").max(5, `a parallel takes at most 5 steps`)
|
|
44431
|
+
}).strict();
|
|
44432
|
+
var REPEAT_NEEDS_MAX = "a repeat on a condition needs a maximum number of iterations";
|
|
44433
|
+
/** A loop on a condition: the bound is mandatory, so a run never loops without an end. */
|
|
44434
|
+
var repeatConditionShape = {
|
|
44435
|
+
when: AutomationWhenSchema,
|
|
44436
|
+
maxIterations: zod.z.number({ error: REPEAT_NEEDS_MAX }).int().min(1, REPEAT_NEEDS_MAX).max(50, `a repeat on a condition runs at most 50 times`),
|
|
44437
|
+
/** A pause between two iterations, never after the last. */
|
|
44438
|
+
waitS: zod.z.number().int().min(1).max(WAIT_MAX_SECONDS, WAIT_TOO_LONG).optional()
|
|
44439
|
+
};
|
|
44440
|
+
/** What decides how many times a `repeat` runs. */
|
|
44441
|
+
var AutomationRepeatLoopSchema = zod.z.discriminatedUnion("by", [
|
|
44442
|
+
zod.z.object({
|
|
44443
|
+
by: zod.z.literal("count"),
|
|
44444
|
+
count: zod.z.number().int().min(1).max(20, `a repeat runs at most 20 times`)
|
|
44445
|
+
}).strict(),
|
|
44446
|
+
zod.z.object({
|
|
44447
|
+
by: zod.z.literal("while"),
|
|
44448
|
+
...repeatConditionShape
|
|
44449
|
+
}).strict(),
|
|
44450
|
+
zod.z.object({
|
|
44451
|
+
by: zod.z.literal("until"),
|
|
44452
|
+
...repeatConditionShape
|
|
44453
|
+
}).strict(),
|
|
44454
|
+
zod.z.object({
|
|
44455
|
+
by: zod.z.literal("forEach"),
|
|
44456
|
+
target: zod.z.object({
|
|
44457
|
+
kind: zod.z.literal("devices"),
|
|
44458
|
+
ids: zod.z.array(zod.z.number().int()).min(1, "a repeat over devices needs at least one device").max(50, `a repeat over devices takes at most 50 devices`)
|
|
44459
|
+
}).strict()
|
|
44460
|
+
}).strict()
|
|
44461
|
+
]);
|
|
44462
|
+
/**
|
|
44463
|
+
* The same steps several times (#500). Every form is bounded at save, so a
|
|
44464
|
+
* run cannot loop without an end. A failure or a `stop` in the steps ends the
|
|
44465
|
+
* loop and the run, as in a sequence.
|
|
44466
|
+
*/
|
|
44467
|
+
function repeatSchemaOf(step) {
|
|
44468
|
+
return zod.z.object({
|
|
44469
|
+
kind: zod.z.literal("repeat"),
|
|
44470
|
+
loop: AutomationRepeatLoopSchema,
|
|
44471
|
+
steps: zod.z.array(step).min(1, "a repeat needs at least one step").max(10, `a repeat takes at most 10 steps`)
|
|
44472
|
+
}).strict();
|
|
44473
|
+
}
|
|
44474
|
+
/**
|
|
44475
|
+
* One step, several ways (#500): the branches are read in order and the FIRST
|
|
44476
|
+
* whose condition is true runs; `else` runs when every branch is false. A
|
|
44477
|
+
* branch that cannot be read ends the choice: nothing runs, not the branches
|
|
44478
|
+
* after it and not the else (D49). The #472 `if` / `else` of a wait or cap
|
|
44479
|
+
* step is the one-branch case and stays as it is stored.
|
|
44480
|
+
*/
|
|
44481
|
+
function chooseSchemaOf(step) {
|
|
44482
|
+
const steps = zod.z.array(step).max(10);
|
|
44483
|
+
return zod.z.object({
|
|
44484
|
+
kind: zod.z.literal("choose"),
|
|
44485
|
+
branches: zod.z.array(zod.z.object({
|
|
44486
|
+
if: AutomationWhenSchema,
|
|
44487
|
+
steps: steps.min(1, "a branch needs at least one step")
|
|
44488
|
+
})).min(1, "a choose needs at least one branch").max(6, `a choose takes at most 6 branches`),
|
|
44489
|
+
else: steps.optional()
|
|
44490
|
+
});
|
|
44491
|
+
}
|
|
44492
|
+
var AutomationBodyStepSchema = zod.z.discriminatedUnion("kind", [
|
|
44493
|
+
...plainStepSchemas,
|
|
44494
|
+
AutomationWaitUntilStepSchema,
|
|
44495
|
+
AutomationParallelStepSchema,
|
|
44496
|
+
chooseSchemaOf(AutomationBranchStepSchema),
|
|
44497
|
+
repeatSchemaOf(AutomationBranchStepSchema)
|
|
44498
|
+
]);
|
|
44499
|
+
var AutomationRepeatStepSchema = repeatSchemaOf(AutomationBodyStepSchema);
|
|
44500
|
+
var AutomationChooseStepSchema = chooseSchemaOf(AutomationBodyStepSchema);
|
|
44199
44501
|
var AutomationActionSchema = zod.z.discriminatedUnion("kind", [
|
|
44200
44502
|
GuardedWaitStepSchema,
|
|
44201
|
-
|
|
44202
|
-
|
|
44203
|
-
|
|
44204
|
-
|
|
44205
|
-
|
|
44206
|
-
|
|
44207
|
-
|
|
44208
|
-
|
|
44209
|
-
zod.z.number(),
|
|
44210
|
-
zod.z.boolean()
|
|
44211
|
-
])).optional()
|
|
44212
|
-
}),
|
|
44503
|
+
AutomationGuardedCapStepSchema,
|
|
44504
|
+
AutomationStopStepSchema,
|
|
44505
|
+
AutomationSetStepSchema,
|
|
44506
|
+
AutomationChooseStepSchema,
|
|
44507
|
+
AutomationWaitUntilStepSchema,
|
|
44508
|
+
AutomationParallelStepSchema,
|
|
44509
|
+
AutomationRepeatStepSchema,
|
|
44510
|
+
AutomationRunActionStepSchema,
|
|
44213
44511
|
zod.z.object({
|
|
44214
44512
|
kind: zod.z.literal("code"),
|
|
44215
44513
|
/** Compiled into the automation's OWN block by esbuild — not a third
|
|
@@ -44272,11 +44570,6 @@ function convertLegacyRecipe(legacy) {
|
|
|
44272
44570
|
...rest
|
|
44273
44571
|
};
|
|
44274
44572
|
}
|
|
44275
|
-
/**
|
|
44276
|
-
* Where recipes are PARSED (the core-blocks cap, the MCP tool, the literal a
|
|
44277
|
-
* saved block carries): the new shape as it is, or the old shape converted to
|
|
44278
|
-
* it. The output type is always the new one.
|
|
44279
|
-
*/
|
|
44280
44573
|
var AutomationRecipeSchema = zod.z.union([CurrentAutomationRecipeSchema, LegacyAutomationRecipeSchema.transform(convertLegacyRecipe)]);
|
|
44281
44574
|
/**
|
|
44282
44575
|
* A daily window as a STATE: is this instant inside it, and when does that
|
|
@@ -45040,12 +45333,16 @@ var HoldOverrideSchema = zod.z.discriminatedUnion("mode", [zod.z.object({ mode:
|
|
|
45040
45333
|
var DEFAULT_HOLD_OVERRIDE = { mode: "respect" };
|
|
45041
45334
|
/** A missed edge up to this late still runs. */
|
|
45042
45335
|
var DEFAULT_MAX_LATE_MS = 10 * 6e4;
|
|
45336
|
+
var SchedulerStepSchema = ActionStepSchema.refine((step) => step.kind !== "wait" || step.seconds <= 300, {
|
|
45337
|
+
message: `a scheduler point waits at most five minutes (300 s); put a longer wait in an action`,
|
|
45338
|
+
path: ["seconds"]
|
|
45339
|
+
});
|
|
45043
45340
|
var SchedulerPointSchema = zod.z.object({
|
|
45044
45341
|
id: zod.z.string().min(1).max(64),
|
|
45045
45342
|
at: SchedulerTimeSpecSchema,
|
|
45046
45343
|
mode: SchedulerPointModeSchema,
|
|
45047
45344
|
/** The actions of an `edge` or `hold`; a `release` has none. */
|
|
45048
|
-
steps: zod.z.array(
|
|
45345
|
+
steps: zod.z.array(SchedulerStepSchema).max(20).default([]),
|
|
45049
45346
|
/** Checked when the point runs (an edge) or is applied (a hold). */
|
|
45050
45347
|
conditions: SchedulerStateTreeSchema.optional(),
|
|
45051
45348
|
/** Hold only; absent means `respect`. */
|
|
@@ -45417,18 +45714,46 @@ var StepTraceBaseSchema = zod.z.object({
|
|
|
45417
45714
|
]).optional(),
|
|
45418
45715
|
/** Why the condition read what it read, in the evaluator's own words. */
|
|
45419
45716
|
conditionReason: zod.z.string().optional(),
|
|
45420
|
-
/** `empty`: the target resolved to no device, so nothing was done — never silently `ok`. `skipped`: its `if` was false (or unknown) and nothing ran in its place. */
|
|
45717
|
+
/** `empty`: the target resolved to no device, so nothing was done — never silently `ok`. `skipped`: its `if` was false (or unknown) and nothing ran in its place. `failed-continued`: it failed and was marked to be passed over (#500). */
|
|
45421
45718
|
outcome: zod.z.enum([
|
|
45422
45719
|
"ok",
|
|
45423
45720
|
"error",
|
|
45424
45721
|
"not-run",
|
|
45425
45722
|
"empty",
|
|
45426
|
-
"skipped"
|
|
45723
|
+
"skipped",
|
|
45724
|
+
"failed-continued",
|
|
45725
|
+
"timed-out"
|
|
45427
45726
|
]),
|
|
45428
45727
|
message: zod.z.string().optional()
|
|
45429
45728
|
});
|
|
45729
|
+
/** What a block step adds to its row: which list ran, what each branch read, how many rounds. */
|
|
45730
|
+
var blockTraceShape = {
|
|
45731
|
+
/** A `choose` step (#500): the list that ran, `branches.<n>` or `else`. Absent when none did. */
|
|
45732
|
+
branch: zod.z.string().optional(),
|
|
45733
|
+
/** A `choose` step: what each branch read, in order, up to the one that decided. */
|
|
45734
|
+
branchChecks: zod.z.array(zod.z.object({
|
|
45735
|
+
condition: zod.z.enum([
|
|
45736
|
+
"true",
|
|
45737
|
+
"false",
|
|
45738
|
+
"unknown"
|
|
45739
|
+
]),
|
|
45740
|
+
conditionReason: zod.z.string().optional()
|
|
45741
|
+
})).optional(),
|
|
45742
|
+
/** A `repeat` step (#500): how many times its steps ran. */
|
|
45743
|
+
iterations: zod.z.number().int().optional()
|
|
45744
|
+
};
|
|
45745
|
+
/** A step one level down: it may be a block step itself, whose own steps are plain rows (the nesting ends there). */
|
|
45746
|
+
var NestedStepTraceSchema = StepTraceBaseSchema.extend({
|
|
45747
|
+
...blockTraceShape,
|
|
45748
|
+
steps: zod.z.array(StepTraceBaseSchema).optional()
|
|
45749
|
+
});
|
|
45430
45750
|
/** A step trace; the `else` steps that ran are one level of the same shape (the nesting is bounded at one). */
|
|
45431
|
-
var AutomationStepTraceSchema = StepTraceBaseSchema.extend({
|
|
45751
|
+
var AutomationStepTraceSchema = StepTraceBaseSchema.extend({
|
|
45752
|
+
else: zod.z.array(StepTraceBaseSchema).optional(),
|
|
45753
|
+
...blockTraceShape,
|
|
45754
|
+
/** A `choose` step: the steps of the list that ran. A `parallel`: its members. A `repeat`: the LAST iteration. */
|
|
45755
|
+
steps: zod.z.array(NestedStepTraceSchema).optional()
|
|
45756
|
+
});
|
|
45432
45757
|
var AutomationRunTraceSchema = zod.z.object({
|
|
45433
45758
|
runId: zod.z.string().min(1),
|
|
45434
45759
|
startedAt: zod.z.number(),
|
|
@@ -45797,6 +46122,46 @@ async function evaluateStepCondition(when, fetchers, now = Date.now, history, si
|
|
|
45797
46122
|
reason: first ?? "the condition does not hold"
|
|
45798
46123
|
};
|
|
45799
46124
|
}
|
|
46125
|
+
/**
|
|
46126
|
+
* Read the branches in order and stop at the first that decides: `true` runs
|
|
46127
|
+
* it, `unknown` ends the choice with nothing run (D49). All `false` runs the
|
|
46128
|
+
* else list, when there is one.
|
|
46129
|
+
*/
|
|
46130
|
+
async function readChoose(choose) {
|
|
46131
|
+
const checks = [];
|
|
46132
|
+
for (const [index, branch] of choose.branches.entries()) {
|
|
46133
|
+
const verdict = await readGuard(branch.guard);
|
|
46134
|
+
checks.push({
|
|
46135
|
+
condition: verdict.result,
|
|
46136
|
+
conditionReason: verdict.reason
|
|
46137
|
+
});
|
|
46138
|
+
if (verdict.result === "true") return {
|
|
46139
|
+
checks,
|
|
46140
|
+
decision: {
|
|
46141
|
+
kind: "run",
|
|
46142
|
+
branch: `branches.${index}`,
|
|
46143
|
+
steps: branch.steps
|
|
46144
|
+
}
|
|
46145
|
+
};
|
|
46146
|
+
if (verdict.result === "unknown") return {
|
|
46147
|
+
checks,
|
|
46148
|
+
decision: {
|
|
46149
|
+
kind: "unknown",
|
|
46150
|
+
index,
|
|
46151
|
+
reason: verdict.reason
|
|
46152
|
+
}
|
|
46153
|
+
};
|
|
46154
|
+
}
|
|
46155
|
+
const otherwise = choose.otherwise ?? [];
|
|
46156
|
+
return {
|
|
46157
|
+
checks,
|
|
46158
|
+
decision: otherwise.length === 0 ? { kind: "none" } : {
|
|
46159
|
+
kind: "run",
|
|
46160
|
+
branch: "else",
|
|
46161
|
+
steps: otherwise
|
|
46162
|
+
}
|
|
46163
|
+
};
|
|
46164
|
+
}
|
|
45800
46165
|
function errorMessage(err) {
|
|
45801
46166
|
return err instanceof Error ? err.message : String(err);
|
|
45802
46167
|
}
|
|
@@ -45811,17 +46176,105 @@ async function readGuard(guard) {
|
|
|
45811
46176
|
};
|
|
45812
46177
|
}
|
|
45813
46178
|
}
|
|
46179
|
+
/** A loop condition that throws ends the loop as unreadable, never a crash of the run. */
|
|
46180
|
+
async function readRepeatCheck(check, iteration) {
|
|
46181
|
+
if (check === void 0) return { go: true };
|
|
46182
|
+
try {
|
|
46183
|
+
return await check(iteration);
|
|
46184
|
+
} catch (err) {
|
|
46185
|
+
return {
|
|
46186
|
+
go: false,
|
|
46187
|
+
reason: `the condition could not be read: ${errorMessage(err)}`,
|
|
46188
|
+
unknown: true
|
|
46189
|
+
};
|
|
46190
|
+
}
|
|
46191
|
+
}
|
|
46192
|
+
/** Run a loop's steps until its count, its condition, its bound, a failure, a stop or an abort ends it. */
|
|
46193
|
+
async function runRepeat(repeat, options, path) {
|
|
46194
|
+
let iterations = 0;
|
|
46195
|
+
let last;
|
|
46196
|
+
for (;;) {
|
|
46197
|
+
if (options.isAborted()) return {
|
|
46198
|
+
iterations,
|
|
46199
|
+
last,
|
|
46200
|
+
timedOut: false
|
|
46201
|
+
};
|
|
46202
|
+
const before = await readRepeatCheck(repeat.before, iterations);
|
|
46203
|
+
if (!before.go) return {
|
|
46204
|
+
iterations,
|
|
46205
|
+
last,
|
|
46206
|
+
ended: before.reason,
|
|
46207
|
+
timedOut: false,
|
|
46208
|
+
...before.unknown === true ? { unknown: before.reason } : {}
|
|
46209
|
+
};
|
|
46210
|
+
if (iterations >= repeat.limit) return repeat.limitIsTimeout ? {
|
|
46211
|
+
iterations,
|
|
46212
|
+
last,
|
|
46213
|
+
ended: `stopped at ${repeat.limit} iterations`,
|
|
46214
|
+
timedOut: true
|
|
46215
|
+
} : {
|
|
46216
|
+
iterations,
|
|
46217
|
+
last,
|
|
46218
|
+
ended: "",
|
|
46219
|
+
timedOut: false
|
|
46220
|
+
};
|
|
46221
|
+
last = await runSteps(repeat.steps, {
|
|
46222
|
+
...options,
|
|
46223
|
+
pathPrefix: `${path}.steps`,
|
|
46224
|
+
indexOffset: 0
|
|
46225
|
+
});
|
|
46226
|
+
iterations += 1;
|
|
46227
|
+
if (last.failed || last.aborted || last.stopped !== void 0) return {
|
|
46228
|
+
iterations,
|
|
46229
|
+
last,
|
|
46230
|
+
timedOut: false
|
|
46231
|
+
};
|
|
46232
|
+
const after = await readRepeatCheck(repeat.after, iterations - 1);
|
|
46233
|
+
if (!after.go) return {
|
|
46234
|
+
iterations,
|
|
46235
|
+
last,
|
|
46236
|
+
ended: after.reason,
|
|
46237
|
+
timedOut: false,
|
|
46238
|
+
...after.unknown === true ? { unknown: after.reason } : {}
|
|
46239
|
+
};
|
|
46240
|
+
if (repeat.between !== void 0 && iterations < repeat.limit) await repeat.between();
|
|
46241
|
+
}
|
|
46242
|
+
}
|
|
45814
46243
|
/** The else level of a trace is one level deep: a nested trace carries no `else` of its own. */
|
|
45815
46244
|
function withoutElse(trace) {
|
|
45816
46245
|
const { else: _else, ...rest } = trace;
|
|
45817
46246
|
return rest;
|
|
45818
46247
|
}
|
|
46248
|
+
/** A plain row: the last level of a trace carries no list of its own. */
|
|
46249
|
+
function plainRow(trace) {
|
|
46250
|
+
const { else: _else, steps: _steps, ...rest } = trace;
|
|
46251
|
+
return rest;
|
|
46252
|
+
}
|
|
46253
|
+
/** A row one level down: it keeps its own steps as plain rows, and no `else`. */
|
|
46254
|
+
function withoutNested(trace) {
|
|
46255
|
+
const { else: _else, steps, ...rest } = trace;
|
|
46256
|
+
return steps === void 0 ? rest : {
|
|
46257
|
+
...rest,
|
|
46258
|
+
steps: steps.map(plainRow)
|
|
46259
|
+
};
|
|
46260
|
+
}
|
|
45819
46261
|
async function runSteps(steps, options) {
|
|
45820
46262
|
const traces = [];
|
|
45821
46263
|
let failed = false;
|
|
45822
46264
|
let aborted = false;
|
|
45823
|
-
|
|
46265
|
+
let stopped;
|
|
46266
|
+
for (const [position, step] of steps.entries()) {
|
|
46267
|
+
const index = position + (options.indexOffset ?? 0);
|
|
45824
46268
|
const path = `${options.pathPrefix}.${index}`;
|
|
46269
|
+
if (stopped !== void 0) {
|
|
46270
|
+
traces.push({
|
|
46271
|
+
...step.meta,
|
|
46272
|
+
path,
|
|
46273
|
+
outcome: "not-run",
|
|
46274
|
+
message: `stopped at ${stopped.path}: ${stopped.reason}`
|
|
46275
|
+
});
|
|
46276
|
+
continue;
|
|
46277
|
+
}
|
|
45825
46278
|
if (failed || aborted || options.isAborted()) {
|
|
45826
46279
|
if (!failed) aborted = true;
|
|
45827
46280
|
traces.push({
|
|
@@ -45833,6 +46286,96 @@ async function runSteps(steps, options) {
|
|
|
45833
46286
|
continue;
|
|
45834
46287
|
}
|
|
45835
46288
|
const startedAt = options.now();
|
|
46289
|
+
if (step.parallel !== void 0) {
|
|
46290
|
+
const members = await Promise.all(step.parallel.map((member, at) => runSteps([member], {
|
|
46291
|
+
...options,
|
|
46292
|
+
pathPrefix: `${path}.steps`,
|
|
46293
|
+
indexOffset: at
|
|
46294
|
+
})));
|
|
46295
|
+
const anyFailed = members.some((m) => m.failed);
|
|
46296
|
+
if (anyFailed) failed = true;
|
|
46297
|
+
else if (members.some((m) => m.aborted)) aborted = true;
|
|
46298
|
+
traces.push({
|
|
46299
|
+
...step.meta,
|
|
46300
|
+
path,
|
|
46301
|
+
startedAt,
|
|
46302
|
+
endedAt: options.now(),
|
|
46303
|
+
outcome: anyFailed ? "error" : "ok",
|
|
46304
|
+
...anyFailed ? { message: "a parallel step failed" } : {},
|
|
46305
|
+
steps: members.flatMap((m) => m.steps.map(withoutNested))
|
|
46306
|
+
});
|
|
46307
|
+
continue;
|
|
46308
|
+
}
|
|
46309
|
+
if (step.repeat !== void 0) {
|
|
46310
|
+
const loop = await runRepeat(step.repeat, options, path);
|
|
46311
|
+
const sub = loop.last;
|
|
46312
|
+
if (loop.unknown !== void 0) options.onGuardUnknown?.({
|
|
46313
|
+
index,
|
|
46314
|
+
path: `${path}.loop.when`,
|
|
46315
|
+
reason: loop.unknown,
|
|
46316
|
+
deviceId: step.meta.deviceId
|
|
46317
|
+
});
|
|
46318
|
+
const bodyFailed = loop.ended === void 0 && sub?.failed === true;
|
|
46319
|
+
if (bodyFailed) failed = true;
|
|
46320
|
+
else if (loop.ended === void 0 && sub?.stopped !== void 0) stopped = sub.stopped;
|
|
46321
|
+
else if (loop.ended === void 0) aborted = true;
|
|
46322
|
+
const times = `ran ${loop.iterations} times`;
|
|
46323
|
+
const message = bodyFailed ? `a step failed in iteration ${loop.iterations}` : loop.ended === void 0 ? times : loop.timedOut ? loop.ended : loop.ended === "" ? times : `${times}: ${loop.ended}`;
|
|
46324
|
+
traces.push({
|
|
46325
|
+
...step.meta,
|
|
46326
|
+
path,
|
|
46327
|
+
startedAt,
|
|
46328
|
+
endedAt: options.now(),
|
|
46329
|
+
outcome: bodyFailed ? "error" : loop.timedOut ? "timed-out" : "ok",
|
|
46330
|
+
message,
|
|
46331
|
+
iterations: loop.iterations,
|
|
46332
|
+
...sub === void 0 ? {} : { steps: sub.steps.map(withoutNested) }
|
|
46333
|
+
});
|
|
46334
|
+
continue;
|
|
46335
|
+
}
|
|
46336
|
+
if (step.choose !== void 0) {
|
|
46337
|
+
const reading = await readChoose(step.choose);
|
|
46338
|
+
const base = {
|
|
46339
|
+
...step.meta,
|
|
46340
|
+
path,
|
|
46341
|
+
startedAt,
|
|
46342
|
+
branchChecks: [...reading.checks]
|
|
46343
|
+
};
|
|
46344
|
+
const { decision } = reading;
|
|
46345
|
+
if (decision.kind !== "run") {
|
|
46346
|
+
if (decision.kind === "unknown") options.onGuardUnknown?.({
|
|
46347
|
+
index,
|
|
46348
|
+
path: `${path}.branches.${decision.index}.if`,
|
|
46349
|
+
reason: decision.reason,
|
|
46350
|
+
deviceId: step.meta.deviceId
|
|
46351
|
+
});
|
|
46352
|
+
traces.push({
|
|
46353
|
+
...base,
|
|
46354
|
+
endedAt: options.now(),
|
|
46355
|
+
outcome: "skipped",
|
|
46356
|
+
message: decision.kind === "unknown" ? `not run: branch ${decision.index + 1} could not be read (${decision.reason})` : "not run: no branch is true"
|
|
46357
|
+
});
|
|
46358
|
+
continue;
|
|
46359
|
+
}
|
|
46360
|
+
const listPath = decision.branch === "else" ? `${path}.else` : `${path}.${decision.branch}.steps`;
|
|
46361
|
+
const sub = await runSteps(decision.steps, {
|
|
46362
|
+
...options,
|
|
46363
|
+
pathPrefix: listPath,
|
|
46364
|
+
indexOffset: 0
|
|
46365
|
+
});
|
|
46366
|
+
if (sub.failed) failed = true;
|
|
46367
|
+
else if (sub.aborted) aborted = true;
|
|
46368
|
+
if (sub.stopped !== void 0) stopped = sub.stopped;
|
|
46369
|
+
traces.push({
|
|
46370
|
+
...base,
|
|
46371
|
+
endedAt: options.now(),
|
|
46372
|
+
outcome: sub.failed ? "error" : "ok",
|
|
46373
|
+
...sub.failed ? { message: "a step of the branch failed" } : {},
|
|
46374
|
+
branch: decision.branch,
|
|
46375
|
+
steps: sub.steps.map(withoutNested)
|
|
46376
|
+
});
|
|
46377
|
+
continue;
|
|
46378
|
+
}
|
|
45836
46379
|
let guardTrace = {};
|
|
45837
46380
|
if (step.guard !== void 0) {
|
|
45838
46381
|
const verdict = await readGuard(step.guard);
|
|
@@ -45862,10 +46405,12 @@ async function runSteps(steps, options) {
|
|
|
45862
46405
|
}
|
|
45863
46406
|
const sub = await runSteps(branch, {
|
|
45864
46407
|
...options,
|
|
45865
|
-
pathPrefix: `${path}.else
|
|
46408
|
+
pathPrefix: `${path}.else`,
|
|
46409
|
+
indexOffset: 0
|
|
45866
46410
|
});
|
|
45867
46411
|
if (sub.failed) failed = true;
|
|
45868
46412
|
else if (sub.aborted) aborted = true;
|
|
46413
|
+
if (sub.stopped !== void 0) stopped = sub.stopped;
|
|
45869
46414
|
traces.push({
|
|
45870
46415
|
...step.meta,
|
|
45871
46416
|
...guardTrace,
|
|
@@ -45883,6 +46428,7 @@ async function runSteps(steps, options) {
|
|
|
45883
46428
|
let sent;
|
|
45884
46429
|
const perDevice = [];
|
|
45885
46430
|
let emptyReason;
|
|
46431
|
+
let timedOutReason;
|
|
45886
46432
|
let templateNotes = [];
|
|
45887
46433
|
const scope = {
|
|
45888
46434
|
setDeviceId: (id) => {
|
|
@@ -45899,6 +46445,16 @@ async function runSteps(steps, options) {
|
|
|
45899
46445
|
},
|
|
45900
46446
|
setTemplateNotes: (notes) => {
|
|
45901
46447
|
templateNotes = notes.slice(0, 20);
|
|
46448
|
+
},
|
|
46449
|
+
stop: (reason, outcome) => {
|
|
46450
|
+
stopped = {
|
|
46451
|
+
reason,
|
|
46452
|
+
outcome,
|
|
46453
|
+
path
|
|
46454
|
+
};
|
|
46455
|
+
},
|
|
46456
|
+
markTimedOut: (reason) => {
|
|
46457
|
+
timedOutReason = reason;
|
|
45902
46458
|
}
|
|
45903
46459
|
};
|
|
45904
46460
|
const templatesTrace = () => templateNotes.length === 0 ? {} : { templates: [...templateNotes] };
|
|
@@ -45906,6 +46462,29 @@ async function runSteps(steps, options) {
|
|
|
45906
46462
|
const devicesTrace = () => perDevice.length === 0 ? {} : { devices: perDevice.slice(0, 200) };
|
|
45907
46463
|
try {
|
|
45908
46464
|
await step.run(scope);
|
|
46465
|
+
const stop = (() => stopped)();
|
|
46466
|
+
if (stop !== void 0) {
|
|
46467
|
+
const message = `stopped: ${stop.reason}`;
|
|
46468
|
+
if (stop.outcome === "failed") {
|
|
46469
|
+
failed = true;
|
|
46470
|
+
options.onFailure({
|
|
46471
|
+
index,
|
|
46472
|
+
path,
|
|
46473
|
+
message,
|
|
46474
|
+
deviceId
|
|
46475
|
+
});
|
|
46476
|
+
}
|
|
46477
|
+
traces.push({
|
|
46478
|
+
...step.meta,
|
|
46479
|
+
...guardTrace,
|
|
46480
|
+
path,
|
|
46481
|
+
startedAt,
|
|
46482
|
+
endedAt: options.now(),
|
|
46483
|
+
outcome: stop.outcome === "failed" ? "error" : "ok",
|
|
46484
|
+
message
|
|
46485
|
+
});
|
|
46486
|
+
continue;
|
|
46487
|
+
}
|
|
45909
46488
|
traces.push({
|
|
45910
46489
|
...step.meta,
|
|
45911
46490
|
...deviceId === void 0 || perDevice.length > 1 ? {} : { deviceId },
|
|
@@ -45916,18 +46495,27 @@ async function runSteps(steps, options) {
|
|
|
45916
46495
|
path,
|
|
45917
46496
|
startedAt,
|
|
45918
46497
|
endedAt: options.now(),
|
|
45919
|
-
outcome: emptyReason === void 0 ? "ok" : "empty",
|
|
45920
|
-
...emptyReason === void 0 ? {} : { message: emptyReason }
|
|
46498
|
+
outcome: timedOutReason !== void 0 ? "timed-out" : emptyReason === void 0 ? "ok" : "empty",
|
|
46499
|
+
...timedOutReason !== void 0 ? { message: timedOutReason } : emptyReason === void 0 ? {} : { message: emptyReason }
|
|
45921
46500
|
});
|
|
45922
46501
|
} catch (err) {
|
|
45923
|
-
failed = true;
|
|
45924
46502
|
const message = errorMessage(err);
|
|
45925
|
-
|
|
46503
|
+
const continued = step.continueOnError === true;
|
|
46504
|
+
if (continued) options.onContinuedFailure?.({
|
|
45926
46505
|
index,
|
|
45927
46506
|
path,
|
|
45928
46507
|
message,
|
|
45929
46508
|
deviceId
|
|
45930
46509
|
});
|
|
46510
|
+
else {
|
|
46511
|
+
failed = true;
|
|
46512
|
+
options.onFailure({
|
|
46513
|
+
index,
|
|
46514
|
+
path,
|
|
46515
|
+
message,
|
|
46516
|
+
deviceId
|
|
46517
|
+
});
|
|
46518
|
+
}
|
|
45931
46519
|
traces.push({
|
|
45932
46520
|
...step.meta,
|
|
45933
46521
|
...deviceId === void 0 || perDevice.length > 1 ? {} : { deviceId },
|
|
@@ -45938,7 +46526,7 @@ async function runSteps(steps, options) {
|
|
|
45938
46526
|
path,
|
|
45939
46527
|
startedAt,
|
|
45940
46528
|
endedAt: options.now(),
|
|
45941
|
-
outcome: "error",
|
|
46529
|
+
outcome: continued ? "failed-continued" : "error",
|
|
45942
46530
|
message
|
|
45943
46531
|
});
|
|
45944
46532
|
}
|
|
@@ -45946,7 +46534,8 @@ async function runSteps(steps, options) {
|
|
|
45946
46534
|
return {
|
|
45947
46535
|
steps: traces,
|
|
45948
46536
|
failed,
|
|
45949
|
-
aborted: aborted && !failed
|
|
46537
|
+
aborted: aborted && !failed,
|
|
46538
|
+
...stopped === void 0 ? {} : { stopped }
|
|
45950
46539
|
};
|
|
45951
46540
|
}
|
|
45952
46541
|
function isVarRef(value) {
|
|
@@ -46419,7 +47008,7 @@ var accessoriesCapability = {
|
|
|
46419
47008
|
DeviceType.Switch,
|
|
46420
47009
|
DeviceType.Light,
|
|
46421
47010
|
DeviceType.Sensor,
|
|
46422
|
-
DeviceType.
|
|
47011
|
+
DeviceType.Climate,
|
|
46423
47012
|
DeviceType.Cover,
|
|
46424
47013
|
DeviceType.Lock,
|
|
46425
47014
|
DeviceType.Fan,
|
|
@@ -46718,7 +47307,9 @@ var AddonHttpRouteSchema = zod.z.object({
|
|
|
46718
47307
|
]).optional(),
|
|
46719
47308
|
description: zod.z.string().optional(),
|
|
46720
47309
|
/** The hub limits this route per client address before the handler runs. */
|
|
46721
|
-
rateLimit: zod.z.enum(["auth"]).optional()
|
|
47310
|
+
rateLimit: zod.z.enum(["auth"]).optional(),
|
|
47311
|
+
/** Served once per integration instance; the handler reads `instanceId`. */
|
|
47312
|
+
perInstance: zod.z.boolean().optional()
|
|
46722
47313
|
});
|
|
46723
47314
|
/**
|
|
46724
47315
|
* Cross-process route invocation envelope. The hub captures the
|
|
@@ -46735,6 +47326,8 @@ var InvokeRequestSchema = zod.z.object({
|
|
|
46735
47326
|
query: zod.z.record(zod.z.string(), zod.z.string()),
|
|
46736
47327
|
body: zod.z.unknown(),
|
|
46737
47328
|
headers: zod.z.record(zod.z.string(), zod.z.string()),
|
|
47329
|
+
/** The instance the hub resolved for a `perInstance` route. */
|
|
47330
|
+
instanceId: zod.z.string().optional(),
|
|
46738
47331
|
user: zod.z.object({
|
|
46739
47332
|
id: zod.z.string(),
|
|
46740
47333
|
username: zod.z.string(),
|
|
@@ -49457,7 +50050,7 @@ var BATTERY_DEVICE_TYPES = [
|
|
|
49457
50050
|
DeviceType.Switch,
|
|
49458
50051
|
DeviceType.PetFeeder,
|
|
49459
50052
|
DeviceType.Container,
|
|
49460
|
-
DeviceType.
|
|
50053
|
+
DeviceType.Climate,
|
|
49461
50054
|
DeviceType.EventEmitter
|
|
49462
50055
|
];
|
|
49463
50056
|
/** Generic Customize target for the percentage reading (D936). */
|
|
@@ -51653,7 +52246,14 @@ var climateControlCapability = {
|
|
|
51653
52246
|
scope: "device",
|
|
51654
52247
|
deviceNative: true,
|
|
51655
52248
|
mode: "singleton",
|
|
51656
|
-
deviceTypes: [DeviceType.
|
|
52249
|
+
deviceTypes: [DeviceType.Climate],
|
|
52250
|
+
power: {
|
|
52251
|
+
kind: "mode",
|
|
52252
|
+
field: "mode",
|
|
52253
|
+
offValue: "off",
|
|
52254
|
+
set: "setMode",
|
|
52255
|
+
lastField: "lastActiveMode"
|
|
52256
|
+
},
|
|
51657
52257
|
methods: {
|
|
51658
52258
|
setMode: method(zod.z.object({
|
|
51659
52259
|
deviceId: zod.z.number().int().nonnegative(),
|
|
@@ -52067,7 +52667,8 @@ function describeStateField(schema, path) {
|
|
|
52067
52667
|
kind: leaf.kind,
|
|
52068
52668
|
nullable: field.safeParse(null).success,
|
|
52069
52669
|
required: !field.safeParse(void 0).success,
|
|
52070
|
-
...leaf.enumValues === void 0 ? {} : { enumValues: leaf.enumValues }
|
|
52670
|
+
...leaf.enumValues === void 0 ? {} : { enumValues: leaf.enumValues },
|
|
52671
|
+
...leaf.unionMembers === void 0 ? {} : { unionMembers: leaf.unionMembers }
|
|
52071
52672
|
};
|
|
52072
52673
|
}
|
|
52073
52674
|
function describeTopLevelStateFields(schema) {
|
|
@@ -52185,6 +52786,7 @@ var CompositionProblemCodeSchema = zod.z.enum([
|
|
|
52185
52786
|
"nested-field",
|
|
52186
52787
|
"missing-field",
|
|
52187
52788
|
"kind-mismatch",
|
|
52789
|
+
"source-kind-mismatch",
|
|
52188
52790
|
"may-be-null",
|
|
52189
52791
|
"source-missing",
|
|
52190
52792
|
"source-unreadable",
|
|
@@ -52206,7 +52808,8 @@ var CompositionProblemCodeSchema = zod.z.enum([
|
|
|
52206
52808
|
"command-method-unknown",
|
|
52207
52809
|
"command-source-unknown",
|
|
52208
52810
|
"command-input-unknown",
|
|
52209
|
-
"command-input-missing"
|
|
52811
|
+
"command-input-missing",
|
|
52812
|
+
"power-source-is-actuator"
|
|
52210
52813
|
]);
|
|
52211
52814
|
/** One refusal, named (D391). `path` points into the composition, e.g. `features[0].fields.temperature`. */
|
|
52212
52815
|
var CompositionProblemSchema = zod.z.object({
|
|
@@ -53323,6 +53926,13 @@ var mediaPlayerCapability = {
|
|
|
53323
53926
|
deviceNative: true,
|
|
53324
53927
|
mode: "singleton",
|
|
53325
53928
|
deviceTypes: [DeviceType.MediaPlayer],
|
|
53929
|
+
power: {
|
|
53930
|
+
kind: "methods",
|
|
53931
|
+
field: "state",
|
|
53932
|
+
offValues: ["off", "standby"],
|
|
53933
|
+
on: "turnOn",
|
|
53934
|
+
off: "turnOff"
|
|
53935
|
+
},
|
|
53326
53936
|
methods: {
|
|
53327
53937
|
turnOn: optionalMethod(deviceOnly, zod.z.void(), {
|
|
53328
53938
|
kind: "mutation",
|
|
@@ -53455,7 +54065,7 @@ var mediaPlayerCapability = {
|
|
|
53455
54065
|
};
|
|
53456
54066
|
/**
|
|
53457
54067
|
* Customize catalog, projected from every `*.cap.ts` `customize` block.
|
|
53458
|
-
*
|
|
54068
|
+
* 11 caps. Field keys are `runtimeState` paths. No Zod.
|
|
53459
54069
|
*/
|
|
53460
54070
|
var CAP_CUSTOMIZE_CATALOG = {
|
|
53461
54071
|
"battery": {
|
|
@@ -53470,7 +54080,7 @@ var CAP_CUSTOMIZE_CATALOG = {
|
|
|
53470
54080
|
DeviceType.Switch,
|
|
53471
54081
|
DeviceType.PetFeeder,
|
|
53472
54082
|
DeviceType.Container,
|
|
53473
|
-
DeviceType.
|
|
54083
|
+
DeviceType.Climate,
|
|
53474
54084
|
DeviceType.EventEmitter
|
|
53475
54085
|
],
|
|
53476
54086
|
apply: "add",
|
|
@@ -53526,7 +54136,6 @@ var CAP_CUSTOMIZE_CATALOG = {
|
|
|
53526
54136
|
DeviceType.Siren,
|
|
53527
54137
|
DeviceType.Switch,
|
|
53528
54138
|
DeviceType.Sensor,
|
|
53529
|
-
DeviceType.Thermostat,
|
|
53530
54139
|
DeviceType.Climate,
|
|
53531
54140
|
DeviceType.Button,
|
|
53532
54141
|
DeviceType.EventEmitter,
|
|
@@ -53554,7 +54163,6 @@ var CAP_CUSTOMIZE_CATALOG = {
|
|
|
53554
54163
|
DeviceType.PetFountain,
|
|
53555
54164
|
DeviceType.Dishwasher,
|
|
53556
54165
|
DeviceType.Washer,
|
|
53557
|
-
DeviceType.Heater,
|
|
53558
54166
|
DeviceType.Dryer,
|
|
53559
54167
|
DeviceType.Gateway,
|
|
53560
54168
|
DeviceType.HeatPump
|
|
@@ -53688,6 +54296,247 @@ var CAP_CUSTOMIZE_CATALOG = {
|
|
|
53688
54296
|
debounceMs: 2e3
|
|
53689
54297
|
}]
|
|
53690
54298
|
},
|
|
54299
|
+
"fan-control": {
|
|
54300
|
+
version: 1,
|
|
54301
|
+
targets: [
|
|
54302
|
+
{
|
|
54303
|
+
id: "horizontal-oscillating",
|
|
54304
|
+
cardinality: "scalar",
|
|
54305
|
+
deviceTypes: [DeviceType.Fan],
|
|
54306
|
+
apply: "replace",
|
|
54307
|
+
vocabularyCap: "fan-control",
|
|
54308
|
+
vocabularyStateField: "oscillating",
|
|
54309
|
+
sources: [{
|
|
54310
|
+
kind: "switch",
|
|
54311
|
+
transformKinds: ["identity"],
|
|
54312
|
+
transforms: [{ kind: "identity" }]
|
|
54313
|
+
}],
|
|
54314
|
+
sourceReport: { status: "assignment-status" },
|
|
54315
|
+
advancedExpression: false,
|
|
54316
|
+
section: "oscillation-axes",
|
|
54317
|
+
path: "oscillationAxes.horizontal.oscillating",
|
|
54318
|
+
valueKind: "boolean",
|
|
54319
|
+
nullable: true
|
|
54320
|
+
},
|
|
54321
|
+
{
|
|
54322
|
+
id: "horizontal-angle",
|
|
54323
|
+
cardinality: "scalar",
|
|
54324
|
+
deviceTypes: [DeviceType.Fan],
|
|
54325
|
+
apply: "replace",
|
|
54326
|
+
vocabularyCap: "fan-control",
|
|
54327
|
+
sources: [{
|
|
54328
|
+
kind: "numeric",
|
|
54329
|
+
transformKinds: ["identity"],
|
|
54330
|
+
transforms: [{ kind: "identity" }]
|
|
54331
|
+
}],
|
|
54332
|
+
sourceReport: { status: "assignment-status" },
|
|
54333
|
+
advancedExpression: false,
|
|
54334
|
+
section: "oscillation-axes",
|
|
54335
|
+
path: "oscillationAxes.horizontal.angle",
|
|
54336
|
+
valueKind: "number",
|
|
54337
|
+
nullable: true,
|
|
54338
|
+
companions: [
|
|
54339
|
+
{
|
|
54340
|
+
kind: "source-field",
|
|
54341
|
+
path: "oscillationAxes.horizontal.min",
|
|
54342
|
+
field: "min"
|
|
54343
|
+
},
|
|
54344
|
+
{
|
|
54345
|
+
kind: "source-field",
|
|
54346
|
+
path: "oscillationAxes.horizontal.max",
|
|
54347
|
+
field: "max"
|
|
54348
|
+
},
|
|
54349
|
+
{
|
|
54350
|
+
kind: "source-field",
|
|
54351
|
+
path: "oscillationAxes.horizontal.step",
|
|
54352
|
+
field: "step"
|
|
54353
|
+
}
|
|
54354
|
+
]
|
|
54355
|
+
},
|
|
54356
|
+
{
|
|
54357
|
+
id: "horizontal-sweepFrom",
|
|
54358
|
+
cardinality: "scalar",
|
|
54359
|
+
deviceTypes: [DeviceType.Fan],
|
|
54360
|
+
apply: "replace",
|
|
54361
|
+
vocabularyCap: "fan-control",
|
|
54362
|
+
sources: [{
|
|
54363
|
+
kind: "numeric",
|
|
54364
|
+
transformKinds: ["identity"],
|
|
54365
|
+
transforms: [{ kind: "identity" }]
|
|
54366
|
+
}],
|
|
54367
|
+
sourceReport: { status: "assignment-status" },
|
|
54368
|
+
advancedExpression: false,
|
|
54369
|
+
section: "oscillation-axes",
|
|
54370
|
+
path: "oscillationAxes.horizontal.sweepFrom",
|
|
54371
|
+
valueKind: "number",
|
|
54372
|
+
nullable: true
|
|
54373
|
+
},
|
|
54374
|
+
{
|
|
54375
|
+
id: "horizontal-sweepTo",
|
|
54376
|
+
cardinality: "scalar",
|
|
54377
|
+
deviceTypes: [DeviceType.Fan],
|
|
54378
|
+
apply: "replace",
|
|
54379
|
+
vocabularyCap: "fan-control",
|
|
54380
|
+
sources: [{
|
|
54381
|
+
kind: "numeric",
|
|
54382
|
+
transformKinds: ["identity"],
|
|
54383
|
+
transforms: [{ kind: "identity" }]
|
|
54384
|
+
}],
|
|
54385
|
+
sourceReport: { status: "assignment-status" },
|
|
54386
|
+
advancedExpression: false,
|
|
54387
|
+
section: "oscillation-axes",
|
|
54388
|
+
path: "oscillationAxes.horizontal.sweepTo",
|
|
54389
|
+
valueKind: "number",
|
|
54390
|
+
nullable: true
|
|
54391
|
+
},
|
|
54392
|
+
{
|
|
54393
|
+
id: "vertical-oscillating",
|
|
54394
|
+
cardinality: "scalar",
|
|
54395
|
+
deviceTypes: [DeviceType.Fan],
|
|
54396
|
+
apply: "replace",
|
|
54397
|
+
vocabularyCap: "fan-control",
|
|
54398
|
+
vocabularyStateField: "oscillating",
|
|
54399
|
+
sources: [{
|
|
54400
|
+
kind: "switch",
|
|
54401
|
+
transformKinds: ["identity"],
|
|
54402
|
+
transforms: [{ kind: "identity" }]
|
|
54403
|
+
}],
|
|
54404
|
+
sourceReport: { status: "assignment-status" },
|
|
54405
|
+
advancedExpression: false,
|
|
54406
|
+
section: "oscillation-axes",
|
|
54407
|
+
path: "oscillationAxes.vertical.oscillating",
|
|
54408
|
+
valueKind: "boolean",
|
|
54409
|
+
nullable: true
|
|
54410
|
+
},
|
|
54411
|
+
{
|
|
54412
|
+
id: "vertical-angle",
|
|
54413
|
+
cardinality: "scalar",
|
|
54414
|
+
deviceTypes: [DeviceType.Fan],
|
|
54415
|
+
apply: "replace",
|
|
54416
|
+
vocabularyCap: "fan-control",
|
|
54417
|
+
sources: [{
|
|
54418
|
+
kind: "numeric",
|
|
54419
|
+
transformKinds: ["identity"],
|
|
54420
|
+
transforms: [{ kind: "identity" }]
|
|
54421
|
+
}],
|
|
54422
|
+
sourceReport: { status: "assignment-status" },
|
|
54423
|
+
advancedExpression: false,
|
|
54424
|
+
section: "oscillation-axes",
|
|
54425
|
+
path: "oscillationAxes.vertical.angle",
|
|
54426
|
+
valueKind: "number",
|
|
54427
|
+
nullable: true,
|
|
54428
|
+
companions: [
|
|
54429
|
+
{
|
|
54430
|
+
kind: "source-field",
|
|
54431
|
+
path: "oscillationAxes.vertical.min",
|
|
54432
|
+
field: "min"
|
|
54433
|
+
},
|
|
54434
|
+
{
|
|
54435
|
+
kind: "source-field",
|
|
54436
|
+
path: "oscillationAxes.vertical.max",
|
|
54437
|
+
field: "max"
|
|
54438
|
+
},
|
|
54439
|
+
{
|
|
54440
|
+
kind: "source-field",
|
|
54441
|
+
path: "oscillationAxes.vertical.step",
|
|
54442
|
+
field: "step"
|
|
54443
|
+
}
|
|
54444
|
+
]
|
|
54445
|
+
},
|
|
54446
|
+
{
|
|
54447
|
+
id: "vertical-sweepFrom",
|
|
54448
|
+
cardinality: "scalar",
|
|
54449
|
+
deviceTypes: [DeviceType.Fan],
|
|
54450
|
+
apply: "replace",
|
|
54451
|
+
vocabularyCap: "fan-control",
|
|
54452
|
+
sources: [{
|
|
54453
|
+
kind: "numeric",
|
|
54454
|
+
transformKinds: ["identity"],
|
|
54455
|
+
transforms: [{ kind: "identity" }]
|
|
54456
|
+
}],
|
|
54457
|
+
sourceReport: { status: "assignment-status" },
|
|
54458
|
+
advancedExpression: false,
|
|
54459
|
+
section: "oscillation-axes",
|
|
54460
|
+
path: "oscillationAxes.vertical.sweepFrom",
|
|
54461
|
+
valueKind: "number",
|
|
54462
|
+
nullable: true
|
|
54463
|
+
},
|
|
54464
|
+
{
|
|
54465
|
+
id: "vertical-sweepTo",
|
|
54466
|
+
cardinality: "scalar",
|
|
54467
|
+
deviceTypes: [DeviceType.Fan],
|
|
54468
|
+
apply: "replace",
|
|
54469
|
+
vocabularyCap: "fan-control",
|
|
54470
|
+
sources: [{
|
|
54471
|
+
kind: "numeric",
|
|
54472
|
+
transformKinds: ["identity"],
|
|
54473
|
+
transforms: [{ kind: "identity" }]
|
|
54474
|
+
}],
|
|
54475
|
+
sourceReport: { status: "assignment-status" },
|
|
54476
|
+
advancedExpression: false,
|
|
54477
|
+
section: "oscillation-axes",
|
|
54478
|
+
path: "oscillationAxes.vertical.sweepTo",
|
|
54479
|
+
valueKind: "number",
|
|
54480
|
+
nullable: true
|
|
54481
|
+
},
|
|
54482
|
+
{
|
|
54483
|
+
id: "preset",
|
|
54484
|
+
cardinality: "scalar",
|
|
54485
|
+
deviceTypes: [DeviceType.Fan],
|
|
54486
|
+
apply: "replace",
|
|
54487
|
+
vocabularyCap: "fan-control",
|
|
54488
|
+
sources: [{
|
|
54489
|
+
kind: "field",
|
|
54490
|
+
valueKinds: ["string"],
|
|
54491
|
+
transformKinds: ["identity"],
|
|
54492
|
+
transforms: [{ kind: "identity" }]
|
|
54493
|
+
}],
|
|
54494
|
+
sourceReport: { status: "assignment-status" },
|
|
54495
|
+
advancedExpression: false,
|
|
54496
|
+
path: "preset",
|
|
54497
|
+
valueKind: "string",
|
|
54498
|
+
nullable: false
|
|
54499
|
+
}
|
|
54500
|
+
],
|
|
54501
|
+
overridable: [
|
|
54502
|
+
{
|
|
54503
|
+
path: "oscillationAxes.horizontal.oscillating",
|
|
54504
|
+
by: "horizontal-oscillating"
|
|
54505
|
+
},
|
|
54506
|
+
{
|
|
54507
|
+
path: "oscillationAxes.horizontal.angle",
|
|
54508
|
+
by: "horizontal-angle"
|
|
54509
|
+
},
|
|
54510
|
+
{
|
|
54511
|
+
path: "oscillationAxes.horizontal.sweepFrom",
|
|
54512
|
+
by: "horizontal-sweepFrom"
|
|
54513
|
+
},
|
|
54514
|
+
{
|
|
54515
|
+
path: "oscillationAxes.horizontal.sweepTo",
|
|
54516
|
+
by: "horizontal-sweepTo"
|
|
54517
|
+
},
|
|
54518
|
+
{
|
|
54519
|
+
path: "oscillationAxes.vertical.oscillating",
|
|
54520
|
+
by: "vertical-oscillating"
|
|
54521
|
+
},
|
|
54522
|
+
{
|
|
54523
|
+
path: "oscillationAxes.vertical.angle",
|
|
54524
|
+
by: "vertical-angle"
|
|
54525
|
+
},
|
|
54526
|
+
{
|
|
54527
|
+
path: "oscillationAxes.vertical.sweepFrom",
|
|
54528
|
+
by: "vertical-sweepFrom"
|
|
54529
|
+
},
|
|
54530
|
+
{
|
|
54531
|
+
path: "oscillationAxes.vertical.sweepTo",
|
|
54532
|
+
by: "vertical-sweepTo"
|
|
54533
|
+
},
|
|
54534
|
+
{
|
|
54535
|
+
path: "preset",
|
|
54536
|
+
by: "preset"
|
|
54537
|
+
}
|
|
54538
|
+
]
|
|
54539
|
+
},
|
|
53691
54540
|
"fan-presets": {
|
|
53692
54541
|
version: 1,
|
|
53693
54542
|
targets: [{
|
|
@@ -53788,7 +54637,6 @@ var CAP_CUSTOMIZE_CATALOG = {
|
|
|
53788
54637
|
DeviceType.Light,
|
|
53789
54638
|
DeviceType.Fan,
|
|
53790
54639
|
DeviceType.Climate,
|
|
53791
|
-
DeviceType.Thermostat,
|
|
53792
54640
|
DeviceType.Humidifier,
|
|
53793
54641
|
DeviceType.WaterHeater,
|
|
53794
54642
|
DeviceType.MediaPlayer,
|
|
@@ -53797,8 +54645,7 @@ var CAP_CUSTOMIZE_CATALOG = {
|
|
|
53797
54645
|
DeviceType.Dishwasher,
|
|
53798
54646
|
DeviceType.Vacuum,
|
|
53799
54647
|
DeviceType.LawnMower,
|
|
53800
|
-
DeviceType.PetFeeder
|
|
53801
|
-
DeviceType.Heater
|
|
54648
|
+
DeviceType.PetFeeder
|
|
53802
54649
|
],
|
|
53803
54650
|
apply: "add",
|
|
53804
54651
|
vocabularyCap: "power-meter",
|
|
@@ -53828,7 +54675,6 @@ var CAP_CUSTOMIZE_CATALOG = {
|
|
|
53828
54675
|
DeviceType.Light,
|
|
53829
54676
|
DeviceType.Fan,
|
|
53830
54677
|
DeviceType.Climate,
|
|
53831
|
-
DeviceType.Thermostat,
|
|
53832
54678
|
DeviceType.Humidifier,
|
|
53833
54679
|
DeviceType.WaterHeater,
|
|
53834
54680
|
DeviceType.MediaPlayer,
|
|
@@ -53837,8 +54683,7 @@ var CAP_CUSTOMIZE_CATALOG = {
|
|
|
53837
54683
|
DeviceType.Dishwasher,
|
|
53838
54684
|
DeviceType.Vacuum,
|
|
53839
54685
|
DeviceType.LawnMower,
|
|
53840
|
-
DeviceType.PetFeeder
|
|
53841
|
-
DeviceType.Heater
|
|
54686
|
+
DeviceType.PetFeeder
|
|
53842
54687
|
],
|
|
53843
54688
|
apply: "add",
|
|
53844
54689
|
vocabularyCap: "power-meter",
|
|
@@ -53868,7 +54713,6 @@ var CAP_CUSTOMIZE_CATALOG = {
|
|
|
53868
54713
|
DeviceType.Light,
|
|
53869
54714
|
DeviceType.Fan,
|
|
53870
54715
|
DeviceType.Climate,
|
|
53871
|
-
DeviceType.Thermostat,
|
|
53872
54716
|
DeviceType.Humidifier,
|
|
53873
54717
|
DeviceType.WaterHeater,
|
|
53874
54718
|
DeviceType.MediaPlayer,
|
|
@@ -53877,8 +54721,7 @@ var CAP_CUSTOMIZE_CATALOG = {
|
|
|
53877
54721
|
DeviceType.Dishwasher,
|
|
53878
54722
|
DeviceType.Vacuum,
|
|
53879
54723
|
DeviceType.LawnMower,
|
|
53880
|
-
DeviceType.PetFeeder
|
|
53881
|
-
DeviceType.Heater
|
|
54724
|
+
DeviceType.PetFeeder
|
|
53882
54725
|
],
|
|
53883
54726
|
apply: "add",
|
|
53884
54727
|
vocabularyCap: "power-meter",
|
|
@@ -53908,7 +54751,6 @@ var CAP_CUSTOMIZE_CATALOG = {
|
|
|
53908
54751
|
DeviceType.Light,
|
|
53909
54752
|
DeviceType.Fan,
|
|
53910
54753
|
DeviceType.Climate,
|
|
53911
|
-
DeviceType.Thermostat,
|
|
53912
54754
|
DeviceType.Humidifier,
|
|
53913
54755
|
DeviceType.WaterHeater,
|
|
53914
54756
|
DeviceType.MediaPlayer,
|
|
@@ -53917,8 +54759,7 @@ var CAP_CUSTOMIZE_CATALOG = {
|
|
|
53917
54759
|
DeviceType.Dishwasher,
|
|
53918
54760
|
DeviceType.Vacuum,
|
|
53919
54761
|
DeviceType.LawnMower,
|
|
53920
|
-
DeviceType.PetFeeder
|
|
53921
|
-
DeviceType.Heater
|
|
54762
|
+
DeviceType.PetFeeder
|
|
53922
54763
|
],
|
|
53923
54764
|
apply: "add",
|
|
53924
54765
|
vocabularyCap: "power-meter",
|
|
@@ -54020,9 +54861,7 @@ var CAP_CUSTOMIZE_CATALOG = {
|
|
|
54020
54861
|
DeviceType.Humidifier,
|
|
54021
54862
|
DeviceType.Fan,
|
|
54022
54863
|
DeviceType.Climate,
|
|
54023
|
-
DeviceType.
|
|
54024
|
-
DeviceType.PetFeeder,
|
|
54025
|
-
DeviceType.Heater
|
|
54864
|
+
DeviceType.PetFeeder
|
|
54026
54865
|
],
|
|
54027
54866
|
apply: "add",
|
|
54028
54867
|
vocabularyCap: "running-state",
|
|
@@ -54335,12 +55174,37 @@ function readKinds(read, lookupCap) {
|
|
|
54335
55174
|
code: "source-field-unknown",
|
|
54336
55175
|
message: `\`${read.cap}\` has no field \`${read.fieldPath}\``
|
|
54337
55176
|
};
|
|
54338
|
-
const
|
|
55177
|
+
const bases = field.kind === "union" ? field.unionMembers ?? [] : [field.kind === "enum" ? "string" : field.kind];
|
|
54339
55178
|
return {
|
|
54340
55179
|
ok: true,
|
|
54341
|
-
kinds: new Set(field.nullable ? [
|
|
55180
|
+
kinds: new Set(field.nullable ? [...bases, "null"] : bases)
|
|
54342
55181
|
};
|
|
54343
55182
|
}
|
|
55183
|
+
/** A union field is read as a source (D1034), never written: no single kind to check a source against. */
|
|
55184
|
+
function unionTargetProblem(cap, path, at) {
|
|
55185
|
+
return problem("kind-mismatch", at, `\`${cap}.${path}\` is a union — it is read as a source, never written`);
|
|
55186
|
+
}
|
|
55187
|
+
/** The one value kind a target field accepts. */
|
|
55188
|
+
function acceptedKind(target) {
|
|
55189
|
+
if (target.kind === "union") return null;
|
|
55190
|
+
return target.kind === "enum" ? "string" : target.kind;
|
|
55191
|
+
}
|
|
55192
|
+
/**
|
|
55193
|
+
* A direct read of a UNION source field (D1034) is judged by the member that
|
|
55194
|
+
* fits the target: when one does, the read produces that kind only (a reading
|
|
55195
|
+
* of another kind is UNAVAILABLE at read time, never a coerced value); when
|
|
55196
|
+
* none does, the kinds stay as they are and `compatibility` names the mismatch.
|
|
55197
|
+
*/
|
|
55198
|
+
function narrowUnionRead(source, target, kinds, lookupCap) {
|
|
55199
|
+
if (source.kind !== "from") return kinds;
|
|
55200
|
+
const def = lookupCap(source.cap);
|
|
55201
|
+
const schema = def?.runtimeState ?? def?.status?.schema;
|
|
55202
|
+
if (schema === void 0) return kinds;
|
|
55203
|
+
const field = describeStateField(schema, source.fieldPath);
|
|
55204
|
+
const accepted = acceptedKind(target);
|
|
55205
|
+
if (field?.kind !== "union" || accepted === null || !kinds.has(accepted)) return kinds;
|
|
55206
|
+
return new Set(kinds.has("null") ? [accepted, "null"] : [accepted]);
|
|
55207
|
+
}
|
|
54344
55208
|
function sourceKinds(source, lookupCap) {
|
|
54345
55209
|
if (source.kind === "from") return readKinds(source, lookupCap);
|
|
54346
55210
|
if (source.kind === "code") return {
|
|
@@ -54377,7 +55241,8 @@ function sourceKinds(source, lookupCap) {
|
|
|
54377
55241
|
};
|
|
54378
55242
|
}
|
|
54379
55243
|
function compatibility(cap, target, kinds, at) {
|
|
54380
|
-
const allowed = target
|
|
55244
|
+
const allowed = acceptedKind(target);
|
|
55245
|
+
if (allowed === null) return [unionTargetProblem(cap, target.path, at)];
|
|
54381
55246
|
const offending = [...kinds].filter((k) => k !== "null" && k !== allowed);
|
|
54382
55247
|
const problems = [];
|
|
54383
55248
|
if (offending.length > 0) problems.push(problem("kind-mismatch", at, `\`${cap}.${target.path}\` is a ${target.kind}; this source can produce ${offending.join(" or ")}`));
|
|
@@ -54486,6 +55351,7 @@ function planItemField(ctx, leaf) {
|
|
|
54486
55351
|
if (ctx.reserved.has(path)) return refused(problem("item-field-reserved", at, `\`${capName}.${itemArray.path}[].${path}\` is set by the composer itself — it takes no source`));
|
|
54487
55352
|
const tf = describeStateField(itemArray.itemSchema, path);
|
|
54488
55353
|
if (tf === null) return refused(problem("unknown-field", at, `a \`${capName}\` item has no field \`${path}\``));
|
|
55354
|
+
if (tf.kind === "union") return refused(unionTargetProblem(capName, path, at));
|
|
54489
55355
|
const kinds = sourceKinds(source, lookupCap);
|
|
54490
55356
|
if (!kinds.ok) return refused(problem(kinds.code, at, kinds.message));
|
|
54491
55357
|
const role = roleOf(source);
|
|
@@ -54511,7 +55377,7 @@ function planItemField(ctx, leaf) {
|
|
|
54511
55377
|
};
|
|
54512
55378
|
const enumProblem = enumLiteralProblem(capName, tf, source, at);
|
|
54513
55379
|
return {
|
|
54514
|
-
problems: [...compatibility(capName, tf, kinds.kinds, at), ...enumProblem === null ? [] : [enumProblem]],
|
|
55380
|
+
problems: [...compatibility(capName, tf, narrowUnionRead(source, tf, kinds.kinds, lookupCap), at), ...enumProblem === null ? [] : [enumProblem]],
|
|
54515
55381
|
fields: [plan],
|
|
54516
55382
|
features: [],
|
|
54517
55383
|
events: []
|
|
@@ -54728,7 +55594,7 @@ function numeric(input) {
|
|
|
54728
55594
|
}, ...alsoFrom === void 0 ? [] : [alsoFrom.accept]]
|
|
54729
55595
|
};
|
|
54730
55596
|
}
|
|
54731
|
-
var CLIMATE_DEVICES = [DeviceType.
|
|
55597
|
+
var CLIMATE_DEVICES = [DeviceType.Climate];
|
|
54732
55598
|
function binary(input) {
|
|
54733
55599
|
return {
|
|
54734
55600
|
...input,
|
|
@@ -55050,8 +55916,8 @@ var GROUP_TEMPLATES = [
|
|
|
55050
55916
|
actuator({
|
|
55051
55917
|
id: "climate",
|
|
55052
55918
|
summary: "Running when at least one thermostat or air conditioner is not off, or only when all of them are. Target temperature and fan are offered only when every device has them. A device that reports nothing is left out, never read as off.",
|
|
55053
|
-
deviceType: DeviceType.
|
|
55054
|
-
memberDeviceTypes: [DeviceType.
|
|
55919
|
+
deviceType: DeviceType.Climate,
|
|
55920
|
+
memberDeviceTypes: [DeviceType.Climate],
|
|
55055
55921
|
outputCap: "group-active",
|
|
55056
55922
|
outputField: "active",
|
|
55057
55923
|
member: {
|
|
@@ -56329,6 +57195,202 @@ function findCandidateCycles(candidate, stored) {
|
|
|
56329
57195
|
}];
|
|
56330
57196
|
});
|
|
56331
57197
|
}
|
|
57198
|
+
var PowerSourceRefusalReasonSchema = zod.z.enum([
|
|
57199
|
+
"no-power-source",
|
|
57200
|
+
"switch-missing",
|
|
57201
|
+
"switch-offline",
|
|
57202
|
+
"switch-unknown",
|
|
57203
|
+
"restart-in-progress",
|
|
57204
|
+
"switch-call-failed",
|
|
57205
|
+
"switch-is-actuator"
|
|
57206
|
+
]);
|
|
57207
|
+
var PowerSourceActionResultSchema = zod.z.discriminatedUnion("accepted", [zod.z.object({ accepted: zod.z.literal(true) }), zod.z.object({
|
|
57208
|
+
accepted: zod.z.literal(false),
|
|
57209
|
+
reason: PowerSourceRefusalReasonSchema,
|
|
57210
|
+
/** One line for the operator, naming the switch. */
|
|
57211
|
+
message: zod.z.string()
|
|
57212
|
+
})]);
|
|
57213
|
+
var PowerSourceInfoSchema = zod.z.object({
|
|
57214
|
+
/** False when the device has no power source linked; the rest is then empty. */
|
|
57215
|
+
linked: zod.z.boolean(),
|
|
57216
|
+
switchDeviceId: zod.z.number().nullable(),
|
|
57217
|
+
switchName: zod.z.string().nullable(),
|
|
57218
|
+
/** The switch's on/off state, or null when it is unknown. Never false for unknown (D393). */
|
|
57219
|
+
switchOn: zod.z.boolean().nullable(),
|
|
57220
|
+
switchOnline: zod.z.boolean().nullable(),
|
|
57221
|
+
restartInProgress: zod.z.boolean(),
|
|
57222
|
+
offSeconds: zod.z.number().int()
|
|
57223
|
+
});
|
|
57224
|
+
/** The composed slice: the switch state the link mirrors, plus the stored off time. */
|
|
57225
|
+
var PowerSourceStateSchema = zod.z.object({
|
|
57226
|
+
/** Null while the switch has not reported: unknown is never `false` (D393). */
|
|
57227
|
+
switchOn: zod.z.boolean().nullable(),
|
|
57228
|
+
offSeconds: zod.z.number().int(),
|
|
57229
|
+
lastFetchedAt: zod.z.number()
|
|
57230
|
+
});
|
|
57231
|
+
var POWER_SOURCE_DEVICE_TYPES = [
|
|
57232
|
+
DeviceType.Gateway,
|
|
57233
|
+
DeviceType.Camera,
|
|
57234
|
+
DeviceType.Sensor,
|
|
57235
|
+
DeviceType.MediaPlayer,
|
|
57236
|
+
DeviceType.Vacuum,
|
|
57237
|
+
DeviceType.Generic,
|
|
57238
|
+
DeviceType.Washer,
|
|
57239
|
+
DeviceType.Dryer,
|
|
57240
|
+
DeviceType.Dishwasher,
|
|
57241
|
+
DeviceType.PetFountain,
|
|
57242
|
+
DeviceType.Fan,
|
|
57243
|
+
DeviceType.Humidifier,
|
|
57244
|
+
DeviceType.Climate,
|
|
57245
|
+
DeviceType.WaterHeater
|
|
57246
|
+
];
|
|
57247
|
+
var powerSourceCustomize = {
|
|
57248
|
+
version: 1,
|
|
57249
|
+
targets: [{
|
|
57250
|
+
id: "switch",
|
|
57251
|
+
cardinality: "scalar",
|
|
57252
|
+
vocabulary: {
|
|
57253
|
+
cap: "power-source",
|
|
57254
|
+
stateField: "switchOn"
|
|
57255
|
+
},
|
|
57256
|
+
deviceTypes: POWER_SOURCE_DEVICE_TYPES,
|
|
57257
|
+
apply: "add",
|
|
57258
|
+
path: "switchOn",
|
|
57259
|
+
sources: [{
|
|
57260
|
+
kind: "switch",
|
|
57261
|
+
transforms: [{ kind: "identity" }]
|
|
57262
|
+
}],
|
|
57263
|
+
companions: [{
|
|
57264
|
+
kind: "constant",
|
|
57265
|
+
path: "offSeconds",
|
|
57266
|
+
value: 10,
|
|
57267
|
+
when: "add",
|
|
57268
|
+
formerValues: [0]
|
|
57269
|
+
}, {
|
|
57270
|
+
kind: "clock",
|
|
57271
|
+
path: "lastFetchedAt",
|
|
57272
|
+
when: "always"
|
|
57273
|
+
}],
|
|
57274
|
+
sourceReport: { status: "assignment-status" }
|
|
57275
|
+
}]
|
|
57276
|
+
};
|
|
57277
|
+
var deviceInput$2 = zod.z.object({ deviceId: zod.z.number().int().nonnegative() });
|
|
57278
|
+
var powerSourceCapability = {
|
|
57279
|
+
name: "power-source",
|
|
57280
|
+
scope: "device",
|
|
57281
|
+
mode: "singleton",
|
|
57282
|
+
deviceTypes: POWER_SOURCE_DEVICE_TYPES,
|
|
57283
|
+
methods: {
|
|
57284
|
+
getStatus: systemMethod(deviceInput$2, PowerSourceInfoSchema, { auth: "protected" }),
|
|
57285
|
+
powerOn: systemMethod(deviceInput$2, PowerSourceActionResultSchema, {
|
|
57286
|
+
kind: "mutation",
|
|
57287
|
+
auth: "protected"
|
|
57288
|
+
}),
|
|
57289
|
+
powerOff: systemMethod(deviceInput$2, PowerSourceActionResultSchema, {
|
|
57290
|
+
kind: "mutation",
|
|
57291
|
+
auth: "protected"
|
|
57292
|
+
}),
|
|
57293
|
+
forceRestart: systemMethod(deviceInput$2, PowerSourceActionResultSchema, {
|
|
57294
|
+
kind: "mutation",
|
|
57295
|
+
auth: "protected"
|
|
57296
|
+
})
|
|
57297
|
+
},
|
|
57298
|
+
runtimeState: PowerSourceStateSchema,
|
|
57299
|
+
customize: powerSourceCustomize,
|
|
57300
|
+
/**
|
|
57301
|
+
* Runtime-state durability: **session** — mirrored from the linked switch on
|
|
57302
|
+
* its next report; a restored value would outlive the reading it names.
|
|
57303
|
+
*
|
|
57304
|
+
* See `RuntimeStateDurability`. Enforced by
|
|
57305
|
+
* `scripts/check-runtime-state-durability.ts`.
|
|
57306
|
+
*/
|
|
57307
|
+
durability: "session",
|
|
57308
|
+
history: "none"
|
|
57309
|
+
};
|
|
57310
|
+
/**
|
|
57311
|
+
* Which smart switch powers a device (the `power-source` Customize extension):
|
|
57312
|
+
* the source its stored `power-source.switchOn` field reads, and the off time of
|
|
57313
|
+
* a forced restart stored beside it. Read from the STORED composition, never kept
|
|
57314
|
+
* as a second copy (D676). Shared by the hub (which acts on the switch) and the
|
|
57315
|
+
* admin UI (which shows it).
|
|
57316
|
+
*/
|
|
57317
|
+
/**
|
|
57318
|
+
* The stored off time, or the default when none is stored. A stored number out
|
|
57319
|
+
* of range is CLAMPED to the bounds (a hand-written value never refuses the
|
|
57320
|
+
* link, it just cannot cut power for an absurd time); a non-integer is rounded.
|
|
57321
|
+
*/
|
|
57322
|
+
function normalizeOffSeconds(value) {
|
|
57323
|
+
if (typeof value !== "number" || !Number.isFinite(value)) return 10;
|
|
57324
|
+
return Math.min(120, Math.max(3, Math.round(value)));
|
|
57325
|
+
}
|
|
57326
|
+
/** The constant a stored `offSeconds` field carries, or undefined when it is not a literal number. */
|
|
57327
|
+
function storedOffSeconds(composition) {
|
|
57328
|
+
const feature = composition.features.find((f) => f.cap === "power-source");
|
|
57329
|
+
if (feature === void 0 || feature.kind !== "fields") return void 0;
|
|
57330
|
+
const field = feature.fields["offSeconds"];
|
|
57331
|
+
if (field === void 0 || field.kind !== "expression") return void 0;
|
|
57332
|
+
const n = Number(field.expr);
|
|
57333
|
+
return field.expr.trim() === "" || !Number.isFinite(n) ? void 0 : n;
|
|
57334
|
+
}
|
|
57335
|
+
/**
|
|
57336
|
+
* The link a composition stores. An `existing` target names its own device; a
|
|
57337
|
+
* `new` target (a composed device) is the composer's own device, so the caller
|
|
57338
|
+
* passes the block id and a new-target composition without one has no link.
|
|
57339
|
+
*/
|
|
57340
|
+
function powerSourceLinkOfComposition(composition, blockId) {
|
|
57341
|
+
if (composition === null) return null;
|
|
57342
|
+
let device;
|
|
57343
|
+
if (composition.target.kind === "existing") device = composition.target.device;
|
|
57344
|
+
else if (blockId !== void 0) device = composedDeviceRef(blockId);
|
|
57345
|
+
else return null;
|
|
57346
|
+
const feature = composition.features.find((f) => f.cap === "power-source");
|
|
57347
|
+
if (feature === void 0 || feature.kind !== "fields" || feature.enabled === false) return null;
|
|
57348
|
+
const field = feature.fields["switchOn"];
|
|
57349
|
+
if (field === void 0) return null;
|
|
57350
|
+
const read = fieldReads(field).find((r) => r.cap === "switch");
|
|
57351
|
+
if (read === void 0) return null;
|
|
57352
|
+
return {
|
|
57353
|
+
device,
|
|
57354
|
+
switch: read.source,
|
|
57355
|
+
offSeconds: normalizeOffSeconds(storedOffSeconds(composition))
|
|
57356
|
+
};
|
|
57357
|
+
}
|
|
57358
|
+
var ACTUATOR_CAP = "switch";
|
|
57359
|
+
/**
|
|
57360
|
+
* The devices that ACT for this composition: the device itself when it is an
|
|
57361
|
+
* existing one, and every source its own `switch` feature reads or forwards a
|
|
57362
|
+
* command to (a heater's plug, every member of a switch group).
|
|
57363
|
+
*/
|
|
57364
|
+
function actuatorKeys(composition) {
|
|
57365
|
+
const keys = /* @__PURE__ */ new Set();
|
|
57366
|
+
if (composition.target.kind === "existing") keys.add(compositionSourceKey(composition.target.device));
|
|
57367
|
+
composition.features.forEach((feature, index) => {
|
|
57368
|
+
if (feature.kind !== "fields" || feature.cap !== ACTUATOR_CAP) return;
|
|
57369
|
+
if (!compositionFeatureEnabled(feature)) return;
|
|
57370
|
+
for (const source of featureSources(feature)) for (const read of fieldReads(source)) keys.add(compositionSourceKey(read.source));
|
|
57371
|
+
for (const forward of featureForwards(feature, index)) keys.add(compositionSourceKey(forward.command.source));
|
|
57372
|
+
});
|
|
57373
|
+
return keys;
|
|
57374
|
+
}
|
|
57375
|
+
/**
|
|
57376
|
+
* The supply plug is never one of the device's own actuators (#462): cutting
|
|
57377
|
+
* power through the switch that IS the device's on/off leaves nothing to
|
|
57378
|
+
* restart, and makes "power off" and "turn off" the same press. Refused at save
|
|
57379
|
+
* time (`power-source-is-actuator`) and again by the power-source provider for a
|
|
57380
|
+
* link stored before this check existed (`switch-is-actuator`).
|
|
57381
|
+
*/
|
|
57382
|
+
function powerSourceActuatorConflicts(composition) {
|
|
57383
|
+
const index = composition.features.findIndex((f) => f.cap === "power-source");
|
|
57384
|
+
const feature = composition.features[index];
|
|
57385
|
+
if (feature === void 0 || feature.kind !== "fields" || feature.enabled === false) return [];
|
|
57386
|
+
const field = feature.fields["switchOn"];
|
|
57387
|
+
if (field === void 0) return [];
|
|
57388
|
+
const actuators = actuatorKeys(composition);
|
|
57389
|
+
return fieldReads(field).filter((read) => read.cap === ACTUATOR_CAP && actuators.has(compositionSourceKey(read.source))).map((read) => ({
|
|
57390
|
+
path: `features[${index}].fields.switchOn`,
|
|
57391
|
+
switch: read.source
|
|
57392
|
+
}));
|
|
57393
|
+
}
|
|
56332
57394
|
function buildCapabilityLookup(defs) {
|
|
56333
57395
|
const byName = new Map(defs.map((d) => [d.name, d]));
|
|
56334
57396
|
return (capName) => byName.get(capName) ?? null;
|
|
@@ -56387,12 +57449,25 @@ function builtCapProblems({ def, state, fields: targetFields }, feature, at, dev
|
|
|
56387
57449
|
}
|
|
56388
57450
|
return problems;
|
|
56389
57451
|
}
|
|
56390
|
-
|
|
57452
|
+
/**
|
|
57453
|
+
* A dotted leaf is planned only on a `replace` (D1034): the feature already
|
|
57454
|
+
* passed `overridesOnlyDeclared`, so the leaf is one the cap lists in its
|
|
57455
|
+
* `overridable`, and the hub sets it into the native object. Anywhere else a
|
|
57456
|
+
* nested field is still refused.
|
|
57457
|
+
*/
|
|
57458
|
+
function stateFieldOf({ fields, state }, path, mode) {
|
|
57459
|
+
if (!path.includes(".")) return fields.get(path);
|
|
57460
|
+
if (mode !== "replace") return "nested";
|
|
57461
|
+
return describeStateField(state, path) ?? void 0;
|
|
57462
|
+
}
|
|
57463
|
+
function planTopLevelField(cap, field, mode, lookupCap) {
|
|
57464
|
+
const { def } = cap;
|
|
56391
57465
|
const { featureIndex, path, source } = field;
|
|
56392
57466
|
const fieldAt = `features[${featureIndex}].fields.${path}`;
|
|
56393
|
-
|
|
56394
|
-
|
|
57467
|
+
const tf = stateFieldOf(cap, path, mode);
|
|
57468
|
+
if (tf === "nested") return refused(problem("nested-field", fieldAt, `\`${path}\` is nested — a nested field is planned only on a declared replace (D1034)`));
|
|
56395
57469
|
if (tf === void 0) return refused(problem("unknown-field", fieldAt, `\`${def.name}\` has no field \`${path}\``));
|
|
57470
|
+
if (tf.kind === "union") return refused(unionTargetProblem(def.name, path, fieldAt));
|
|
56396
57471
|
const kinds = sourceKinds(source, lookupCap);
|
|
56397
57472
|
if (!kinds.ok) return refused(problem(kinds.code, fieldAt, kinds.message));
|
|
56398
57473
|
const role = roleOf(source);
|
|
@@ -56413,7 +57488,7 @@ function planTopLevelField({ def, fields }, field, mode, lookupCap) {
|
|
|
56413
57488
|
};
|
|
56414
57489
|
const enumProblem = enumLiteralProblem(def.name, tf, source, fieldAt);
|
|
56415
57490
|
return {
|
|
56416
|
-
problems: [...compatibility(def.name, tf, kinds.kinds, fieldAt), ...enumProblem === null ? [] : [enumProblem]],
|
|
57491
|
+
problems: [...compatibility(def.name, tf, narrowUnionRead(source, tf, kinds.kinds, lookupCap), fieldAt), ...enumProblem === null ? [] : [enumProblem]],
|
|
56417
57492
|
fields: [plan],
|
|
56418
57493
|
features: [],
|
|
56419
57494
|
events: []
|
|
@@ -56516,7 +57591,7 @@ var customizeCatalog = CAP_CUSTOMIZE_CATALOG;
|
|
|
56516
57591
|
function overridesOnlyDeclared(feature) {
|
|
56517
57592
|
const entry = customizeCatalog[feature.cap];
|
|
56518
57593
|
const allowed = new Set((entry?.overridable ?? []).flatMap((o) => {
|
|
56519
|
-
const companions = ((entry?.targets.find((t) => t.id === o.by && t.path === o.path))?.companions ?? []).filter((c) => c.kind === "transition-time" || c.when === "always");
|
|
57594
|
+
const companions = ((entry?.targets.find((t) => t.id === o.by && t.path === o.path))?.companions ?? []).filter((c) => c.kind === "transition-time" || c.kind === "source-field" || c.when === "always");
|
|
56520
57595
|
return [o.path, ...companions.map((c) => c.path)];
|
|
56521
57596
|
}));
|
|
56522
57597
|
const paths = Object.keys(feature.fields);
|
|
@@ -56587,6 +57662,20 @@ function compositionSourceRefs(composition) {
|
|
|
56587
57662
|
return [...new Map([...refs, ...forwardSourceRefs(composition)].map((r) => [compositionSourceKey(r), r])).values()];
|
|
56588
57663
|
}
|
|
56589
57664
|
/**
|
|
57665
|
+
* Every DIRECT read (`from`) of a union source field (D1034): the reads whose
|
|
57666
|
+
* source's live kind a save looks up, so a numeric control is never linked to
|
|
57667
|
+
* a string field. A read inside an expression is judged by the expression.
|
|
57668
|
+
*/
|
|
57669
|
+
function compositionUnionReads(composition, lookupCap) {
|
|
57670
|
+
return composition.features.flatMap((f) => compositionFeatureEnabled(f) && f.kind === "fields" ? featureSources(f).flatMap((source) => {
|
|
57671
|
+
if (source.kind !== "from") return [];
|
|
57672
|
+
const def = lookupCap(source.cap);
|
|
57673
|
+
const schema = def?.runtimeState ?? def?.status?.schema;
|
|
57674
|
+
if (schema === void 0) return [];
|
|
57675
|
+
return describeStateField(schema, source.fieldPath)?.kind === "union" ? [source] : [];
|
|
57676
|
+
}) : []);
|
|
57677
|
+
}
|
|
57678
|
+
/**
|
|
56590
57679
|
* The candidate's device: the existing target itself, else `self`, else a
|
|
56591
57680
|
* placeholder that cannot collide with a stored target. An existing target is
|
|
56592
57681
|
* known even on create, so a second customization of it is refused on create too.
|
|
@@ -56620,6 +57709,18 @@ function selfReadProblems(read, at, fields, self) {
|
|
|
56620
57709
|
if (isNativeCap(self.native, read.cap)) return [];
|
|
56621
57710
|
return [problem("source-capability-missing", at, `the target device (device ${self.native.deviceId}) has no native \`${read.cap}\``)];
|
|
56622
57711
|
}
|
|
57712
|
+
/**
|
|
57713
|
+
* A direct read of a union field is judged by the source's LIVE kind when the
|
|
57714
|
+
* save knew it (D1034): a numeric control feeds only a number field, a select
|
|
57715
|
+
* only a string or enum one.
|
|
57716
|
+
*/
|
|
57717
|
+
function liveKindProblems(field, read, desc, at) {
|
|
57718
|
+
if (field.source.kind !== "from") return [];
|
|
57719
|
+
const live = desc.liveKinds?.get(`${read.cap}.${read.fieldPath}`);
|
|
57720
|
+
const accepted = field.kind === "enum" ? "string" : field.kind;
|
|
57721
|
+
if (live === void 0 || live === accepted) return [];
|
|
57722
|
+
return [problem("source-kind-mismatch", at, `\`${read.cap}.${read.fieldPath}\` of device ${desc.deviceId} reads a ${live} now; \`${field.cap}.${field.path}\` takes a ${accepted}`)];
|
|
57723
|
+
}
|
|
56623
57724
|
function sourceProblems(fields, ctx, self) {
|
|
56624
57725
|
const selfKey = compositionSourceKey(self.ref);
|
|
56625
57726
|
return fields.flatMap((field) => field.reads.flatMap((read) => {
|
|
@@ -56630,7 +57731,7 @@ function sourceProblems(fields, ctx, self) {
|
|
|
56630
57731
|
if (desc === void 0 || desc.kind === "unreadable") return [problem("source-unreadable", at, `could not read source \`${key}\` (${desc === void 0 ? "it was not read" : desc.error}) — the save is refused rather than stored unchecked`)];
|
|
56631
57732
|
if (desc.kind === "absent") return [problem("source-missing", at, `source \`${key}\` does not exist`)];
|
|
56632
57733
|
if (!desc.caps.has(read.cap)) return [problem("source-capability-missing", at, `source \`${key}\` (device ${desc.deviceId}) has no \`${read.cap}\``)];
|
|
56633
|
-
return
|
|
57734
|
+
return liveKindProblems(field, read, desc, at);
|
|
56634
57735
|
}));
|
|
56635
57736
|
}
|
|
56636
57737
|
/**
|
|
@@ -56722,7 +57823,8 @@ function validateComposition(composition, ctx) {
|
|
|
56722
57823
|
...sourceProblems(plan.fields, ctx, self),
|
|
56723
57824
|
...forwardSourceProblems(composition, ctx.sources),
|
|
56724
57825
|
...cycles,
|
|
56725
|
-
...helperSaveProblems(composition, facts)
|
|
57826
|
+
...helperSaveProblems(composition, facts),
|
|
57827
|
+
...powerSourceActuatorConflicts(composition).map((c) => problem("power-source-is-actuator", c.path, `the power source \`${c.switch.stableId}\` is one of this device's own switches — pick the plug that feeds it`))
|
|
56726
57828
|
];
|
|
56727
57829
|
return {
|
|
56728
57830
|
ok: problems.length === 0,
|
|
@@ -56782,13 +57884,13 @@ function describeComposableCaps(defs, deviceType) {
|
|
|
56782
57884
|
const itemArray = def.status?.itemArray;
|
|
56783
57885
|
return {
|
|
56784
57886
|
cap: def.name,
|
|
56785
|
-
fields: fields.
|
|
57887
|
+
fields: fields.flatMap((f) => f.kind === "union" ? [] : [{
|
|
56786
57888
|
path: f.path,
|
|
56787
57889
|
kind: f.kind,
|
|
56788
57890
|
nullable: f.nullable,
|
|
56789
57891
|
required: f.required,
|
|
56790
57892
|
...f.enumValues === void 0 ? {} : { enumValues: [...f.enumValues] }
|
|
56791
|
-
})
|
|
57893
|
+
}]),
|
|
56792
57894
|
...itemArray === void 0 ? {} : { itemArray: {
|
|
56793
57895
|
path: itemArray.path,
|
|
56794
57896
|
keyField: itemArray.keyField
|
|
@@ -60220,8 +61322,14 @@ var deviceManagerCapability = {
|
|
|
60220
61322
|
"string",
|
|
60221
61323
|
"number",
|
|
60222
61324
|
"boolean",
|
|
60223
|
-
"enum"
|
|
61325
|
+
"enum",
|
|
61326
|
+
"union"
|
|
60224
61327
|
]),
|
|
61328
|
+
unionMembers: zod.z.array(zod.z.enum([
|
|
61329
|
+
"string",
|
|
61330
|
+
"number",
|
|
61331
|
+
"boolean"
|
|
61332
|
+
])).optional(),
|
|
60225
61333
|
enumValues: zod.z.array(zod.z.string()).optional(),
|
|
60226
61334
|
item: zod.z.boolean().optional(),
|
|
60227
61335
|
quantity: ReadingQuantitySchema.optional()
|
|
@@ -63185,25 +64293,71 @@ var enumSensorCapability = {
|
|
|
63185
64293
|
* whether persisting is worth a SQLite commit. */
|
|
63186
64294
|
volatileStateFields: ["lastFetchedAt", "timestamp"]
|
|
63187
64295
|
};
|
|
64296
|
+
var EventVocabularyKindSchema = zod.z.enum([
|
|
64297
|
+
"press",
|
|
64298
|
+
"long-press",
|
|
64299
|
+
"long-press-start",
|
|
64300
|
+
"release",
|
|
64301
|
+
"repeat",
|
|
64302
|
+
"double-press",
|
|
64303
|
+
"other"
|
|
64304
|
+
]);
|
|
64305
|
+
/** The part of the device an event comes from: a button, a channel. */
|
|
64306
|
+
var EventVocabularySourceSchema = zod.z.object({
|
|
64307
|
+
id: zod.z.string().min(1),
|
|
64308
|
+
label: zod.z.string().min(1)
|
|
64309
|
+
});
|
|
64310
|
+
/** One scalar field of an event's `data`, by dotted path. */
|
|
64311
|
+
var EventVocabularyFieldSchema = zod.z.object({
|
|
64312
|
+
path: zod.z.string().min(1),
|
|
64313
|
+
kind: zod.z.enum([
|
|
64314
|
+
"string",
|
|
64315
|
+
"number",
|
|
64316
|
+
"boolean",
|
|
64317
|
+
"enum"
|
|
64318
|
+
]),
|
|
64319
|
+
enumValues: zod.z.array(zod.z.string()).optional(),
|
|
64320
|
+
label: zod.z.string().min(1).optional()
|
|
64321
|
+
});
|
|
64322
|
+
var EventVocabularyEntrySchema = zod.z.object({
|
|
64323
|
+
/** The native token, verbatim. */
|
|
64324
|
+
id: zod.z.string().min(1),
|
|
64325
|
+
source: EventVocabularySourceSchema.optional(),
|
|
64326
|
+
label: zod.z.string().min(1),
|
|
64327
|
+
description: zod.z.string().optional(),
|
|
64328
|
+
kind: EventVocabularyKindSchema.optional(),
|
|
64329
|
+
payload: zod.z.array(EventVocabularyFieldSchema).optional()
|
|
64330
|
+
});
|
|
63188
64331
|
/**
|
|
63189
64332
|
* Generic stateless event emitter. Installed on a `DeviceType.EventEmitter`
|
|
63190
64333
|
* device. Carries the device's EXACT declared event vocabulary verbatim
|
|
63191
64334
|
* (NO normalization). Two shapes:
|
|
63192
|
-
* - structured source (HA `event.*` entity) → `
|
|
63193
|
-
* declared
|
|
63194
|
-
* - generic/legacy source (HA bus events, e.g. zha_event) → `
|
|
64335
|
+
* - structured source (HA `event.*` entity) → `vocabulary` is the fixed
|
|
64336
|
+
* declared set (e.g. press_short, press_long, …).
|
|
64337
|
+
* - generic/legacy source (HA bus events, e.g. zha_event) → `vocabulary`
|
|
63195
64338
|
* is [] (open) and `lastEvent.data` carries the complex payload.
|
|
64339
|
+
* `vocabulary` (D1044) names each event for a person and types it for a
|
|
64340
|
+
* rule; `eventTypes` is its list of native tokens, kept for older readers.
|
|
64341
|
+
* A fire names the part of the device it came from in `sourceId` when the
|
|
64342
|
+
* vocabulary declares sources (a remote's buttons).
|
|
63196
64343
|
* `seq` is monotonic so two identical events still produce distinct slice writes.
|
|
63197
64344
|
*/
|
|
63198
64345
|
var EventFireSchema = zod.z.object({
|
|
63199
64346
|
deviceId: zod.z.number(),
|
|
63200
64347
|
eventType: zod.z.string(),
|
|
64348
|
+
sourceId: zod.z.string().optional(),
|
|
63201
64349
|
data: zod.z.record(zod.z.string(), zod.z.unknown()).nullable(),
|
|
63202
64350
|
timestamp: zod.z.number().meta(readingMeta("none")),
|
|
63203
64351
|
seq: zod.z.number().meta(readingMeta("count"))
|
|
63204
64352
|
});
|
|
63205
64353
|
var EventEmitterStatusSchema = zod.z.object({
|
|
63206
64354
|
eventTypes: zod.z.array(zod.z.string()),
|
|
64355
|
+
/**
|
|
64356
|
+
* Required of a provider by the type. A status written before the field
|
|
64357
|
+
* existed still parses, as an empty vocabulary: read it through
|
|
64358
|
+
* `readEventVocabulary`, which then answers with the plain tokens.
|
|
64359
|
+
*/
|
|
64360
|
+
vocabulary: zod.z.array(EventVocabularyEntrySchema).default([]),
|
|
63207
64361
|
lastEvent: EventFireSchema.nullable(),
|
|
63208
64362
|
eventCountSinceStart: zod.z.number().meta(readingMeta("count"))
|
|
63209
64363
|
});
|
|
@@ -63780,8 +64934,87 @@ list: method(zod.z.void(), zod.z.array(FailureContributionSchema).readonly()) },
|
|
|
63780
64934
|
* - `FanPreset` — preset selector
|
|
63781
64935
|
* - `FanDirection` — direction toggle (ceiling fans)
|
|
63782
64936
|
* - `FanOscillating` — oscillation toggle
|
|
64937
|
+
*
|
|
64938
|
+
* Per-axis oscillation (`oscillationAxes`, `setOscillationAxis`, D1034): an air
|
|
64939
|
+
* circulator sweeps horizontally and vertically, each axis with its own
|
|
64940
|
+
* switch, fixed angle, sweep bounds and limits. A provider may report them
|
|
64941
|
+
* natively; otherwise the OPERATOR links sibling devices to each field in
|
|
64942
|
+
* Customize (a `replace` over the fields listed in `overridable` — nothing is
|
|
64943
|
+
* linked or inferred by itself), and a write to a linked field is forwarded to
|
|
64944
|
+
* its source. `oscillating` stays the single summary flag: when axes exist it
|
|
64945
|
+
* means "any axis oscillates" (`anyAxisOscillating`).
|
|
63783
64946
|
*/
|
|
63784
64947
|
var FanDirectionSchema = zod.z.enum(["forward", "reverse"]);
|
|
64948
|
+
var FAN_OSCILLATION_AXES = ["horizontal", "vertical"];
|
|
64949
|
+
var FanOscillationAxisNameSchema = zod.z.enum(FAN_OSCILLATION_AXES);
|
|
64950
|
+
/** The fields of one axis a caller may set. */
|
|
64951
|
+
var FAN_OSCILLATION_AXIS_SETTABLE = [
|
|
64952
|
+
"oscillating",
|
|
64953
|
+
"angle",
|
|
64954
|
+
"sweepFrom",
|
|
64955
|
+
"sweepTo"
|
|
64956
|
+
];
|
|
64957
|
+
var FanOscillationAxisFieldSchema = zod.z.enum(FAN_OSCILLATION_AXIS_SETTABLE);
|
|
64958
|
+
/** The limits of one axis, read from the source that serves its angle. */
|
|
64959
|
+
var FAN_OSCILLATION_AXIS_LIMITS = [
|
|
64960
|
+
"min",
|
|
64961
|
+
"max",
|
|
64962
|
+
"step"
|
|
64963
|
+
];
|
|
64964
|
+
/**
|
|
64965
|
+
* One oscillation axis. Every reading the device has not reported is `null`,
|
|
64966
|
+
* never `0` (D393): `0°` is a real position. Each leaf defaults to `null`, so
|
|
64967
|
+
* a slice that names only the leaves it knows (a Customize link of one field)
|
|
64968
|
+
* is still a whole axis.
|
|
64969
|
+
*/
|
|
64970
|
+
var FanOscillationAxisSchema = zod.z.object({
|
|
64971
|
+
/** Whether the axis sweeps. */
|
|
64972
|
+
oscillating: zod.z.boolean().nullable().default(null),
|
|
64973
|
+
/** The fixed position (degrees) the axis holds when it does not sweep. */
|
|
64974
|
+
angle: zod.z.number().nullable().default(null),
|
|
64975
|
+
/** The sweep bounds (degrees): left → right, bottom → top. */
|
|
64976
|
+
sweepFrom: zod.z.number().nullable().default(null),
|
|
64977
|
+
sweepTo: zod.z.number().nullable().default(null),
|
|
64978
|
+
/** The angles the axis accepts. Null when the device states none. */
|
|
64979
|
+
min: zod.z.number().nullable().default(null),
|
|
64980
|
+
max: zod.z.number().nullable().default(null),
|
|
64981
|
+
step: zod.z.number().nullable().default(null)
|
|
64982
|
+
});
|
|
64983
|
+
/** Both axes; an axis the device does not have is `null`. */
|
|
64984
|
+
var FanOscillationAxesSchema = zod.z.object({
|
|
64985
|
+
horizontal: FanOscillationAxisSchema.nullable().default(null),
|
|
64986
|
+
vertical: FanOscillationAxisSchema.nullable().default(null)
|
|
64987
|
+
});
|
|
64988
|
+
var FanOscillationAxisRefusalSchema = zod.z.enum([
|
|
64989
|
+
"nothing-to-set",
|
|
64990
|
+
"axis-not-linked",
|
|
64991
|
+
"out-of-range",
|
|
64992
|
+
"source-gone",
|
|
64993
|
+
"source-unknown",
|
|
64994
|
+
"source-call-failed"
|
|
64995
|
+
]);
|
|
64996
|
+
var FanOscillationAxisResultSchema = zod.z.discriminatedUnion("status", [zod.z.object({ status: zod.z.literal("applied") }), zod.z.object({
|
|
64997
|
+
status: zod.z.literal("refused"),
|
|
64998
|
+
reason: FanOscillationAxisRefusalSchema,
|
|
64999
|
+
/** The field at fault, when one is. */
|
|
65000
|
+
field: FanOscillationAxisFieldSchema.optional(),
|
|
65001
|
+
/** One line for the operator, naming the axis, the field and the source. */
|
|
65002
|
+
detail: zod.z.string(),
|
|
65003
|
+
/** Fields that DID land before the refusal (writes run in order, stop at the first failure). */
|
|
65004
|
+
applied: zod.z.array(FanOscillationAxisFieldSchema)
|
|
65005
|
+
})]);
|
|
65006
|
+
var SetOscillationAxisInputSchema = zod.z.object({
|
|
65007
|
+
deviceId: zod.z.number().int().nonnegative(),
|
|
65008
|
+
axis: FanOscillationAxisNameSchema,
|
|
65009
|
+
oscillating: zod.z.boolean().optional(),
|
|
65010
|
+
angle: zod.z.number().optional(),
|
|
65011
|
+
sweepFrom: zod.z.number().optional(),
|
|
65012
|
+
sweepTo: zod.z.number().optional()
|
|
65013
|
+
});
|
|
65014
|
+
/** The state path of one axis field: `oscillationAxes.<axis>.<field>`. */
|
|
65015
|
+
function fanAxisPath(axis, field) {
|
|
65016
|
+
return `oscillationAxes.${axis}.${field}`;
|
|
65017
|
+
}
|
|
63785
65018
|
var FanControlStatusSchema = zod.z.object({
|
|
63786
65019
|
/** Active speed as 0..100 inclusive. Null when the device has no
|
|
63787
65020
|
* speed surface (single-speed fan). */
|
|
@@ -63800,9 +65033,102 @@ var FanControlStatusSchema = zod.z.object({
|
|
|
63800
65033
|
/** Oscillation toggle. Null when the device has no oscillation
|
|
63801
65034
|
* surface. */
|
|
63802
65035
|
oscillating: zod.z.boolean().nullable(),
|
|
65036
|
+
/**
|
|
65037
|
+
* Per-axis oscillation (air circulators). Absent when the device has no
|
|
65038
|
+
* per-axis surface and nothing is linked in Customize.
|
|
65039
|
+
*/
|
|
65040
|
+
oscillationAxes: FanOscillationAxesSchema.optional(),
|
|
63803
65041
|
/** Ms epoch when the slice was last updated. */
|
|
63804
65042
|
lastChangedAt: zod.z.number()
|
|
63805
65043
|
});
|
|
65044
|
+
var FAN_CUSTOMIZE_DEVICE_TYPES = [DeviceType.Fan];
|
|
65045
|
+
/** The Customize section the axis targets are listed under. */
|
|
65046
|
+
var AXES_SECTION = "oscillation-axes";
|
|
65047
|
+
function axisOscillatingTarget(axis) {
|
|
65048
|
+
return {
|
|
65049
|
+
id: `${axis}-oscillating`,
|
|
65050
|
+
cardinality: "scalar",
|
|
65051
|
+
vocabulary: {
|
|
65052
|
+
cap: "fan-control",
|
|
65053
|
+
stateField: "oscillating"
|
|
65054
|
+
},
|
|
65055
|
+
deviceTypes: FAN_CUSTOMIZE_DEVICE_TYPES,
|
|
65056
|
+
apply: "replace",
|
|
65057
|
+
section: AXES_SECTION,
|
|
65058
|
+
path: fanAxisPath(axis, "oscillating"),
|
|
65059
|
+
sources: [{
|
|
65060
|
+
kind: "switch",
|
|
65061
|
+
transforms: [{ kind: "identity" }]
|
|
65062
|
+
}],
|
|
65063
|
+
sourceReport: { status: "assignment-status" }
|
|
65064
|
+
};
|
|
65065
|
+
}
|
|
65066
|
+
/**
|
|
65067
|
+
* A numeric axis field. The `angle` link also carries the axis limits, read
|
|
65068
|
+
* from the SAME linked control's own range (`min`/`max`/`step`), so the limits
|
|
65069
|
+
* are the source's, never guessed.
|
|
65070
|
+
*/
|
|
65071
|
+
function axisNumericTarget(axis, field) {
|
|
65072
|
+
const base = {
|
|
65073
|
+
id: `${axis}-${field}`,
|
|
65074
|
+
cardinality: "scalar",
|
|
65075
|
+
vocabulary: { cap: "fan-control" },
|
|
65076
|
+
deviceTypes: FAN_CUSTOMIZE_DEVICE_TYPES,
|
|
65077
|
+
apply: "replace",
|
|
65078
|
+
section: AXES_SECTION,
|
|
65079
|
+
path: fanAxisPath(axis, field),
|
|
65080
|
+
sources: [{
|
|
65081
|
+
kind: "numeric",
|
|
65082
|
+
transforms: [{ kind: "identity" }]
|
|
65083
|
+
}],
|
|
65084
|
+
sourceReport: { status: "assignment-status" }
|
|
65085
|
+
};
|
|
65086
|
+
if (field !== "angle") return base;
|
|
65087
|
+
return {
|
|
65088
|
+
...base,
|
|
65089
|
+
companions: FAN_OSCILLATION_AXIS_LIMITS.map((limit) => ({
|
|
65090
|
+
kind: "source-field",
|
|
65091
|
+
path: fanAxisPath(axis, limit),
|
|
65092
|
+
field: limit
|
|
65093
|
+
}))
|
|
65094
|
+
};
|
|
65095
|
+
}
|
|
65096
|
+
var AXIS_TARGETS = FAN_OSCILLATION_AXES.flatMap((axis) => [
|
|
65097
|
+
axisOscillatingTarget(axis),
|
|
65098
|
+
axisNumericTarget(axis, "angle"),
|
|
65099
|
+
axisNumericTarget(axis, "sweepFrom"),
|
|
65100
|
+
axisNumericTarget(axis, "sweepTo")
|
|
65101
|
+
]);
|
|
65102
|
+
/** A select (an enum control) the operator links to the fan's `preset`. */
|
|
65103
|
+
var PRESET_TARGET = {
|
|
65104
|
+
id: "preset",
|
|
65105
|
+
cardinality: "scalar",
|
|
65106
|
+
vocabulary: { cap: "fan-control" },
|
|
65107
|
+
deviceTypes: FAN_CUSTOMIZE_DEVICE_TYPES,
|
|
65108
|
+
apply: "replace",
|
|
65109
|
+
path: "preset",
|
|
65110
|
+
sources: [{
|
|
65111
|
+
kind: "field",
|
|
65112
|
+
valueKinds: ["string"],
|
|
65113
|
+
transforms: [{ kind: "identity" }]
|
|
65114
|
+
}],
|
|
65115
|
+
sourceReport: { status: "assignment-status" }
|
|
65116
|
+
};
|
|
65117
|
+
var FAN_CONTROL_TARGETS = [...AXIS_TARGETS, PRESET_TARGET];
|
|
65118
|
+
/**
|
|
65119
|
+
* Customize (D1034): the fan already serves `fan-control` natively, so every
|
|
65120
|
+
* target is a `replace` over a field listed in `overridable` — the axis leaves
|
|
65121
|
+
* and `preset`, nothing else. Nothing is pre-linked: the operator picks each
|
|
65122
|
+
* source (D356).
|
|
65123
|
+
*/
|
|
65124
|
+
var fanControlCustomize = {
|
|
65125
|
+
version: 1,
|
|
65126
|
+
overridable: FAN_CONTROL_TARGETS.map((target) => ({
|
|
65127
|
+
path: target.path,
|
|
65128
|
+
by: target.id
|
|
65129
|
+
})),
|
|
65130
|
+
targets: FAN_CONTROL_TARGETS
|
|
65131
|
+
};
|
|
63806
65132
|
var fanControlCapability = {
|
|
63807
65133
|
name: "fan-control",
|
|
63808
65134
|
scope: "device",
|
|
@@ -63837,6 +65163,18 @@ var fanControlCapability = {
|
|
|
63837
65163
|
}), zod.z.void(), {
|
|
63838
65164
|
kind: "mutation",
|
|
63839
65165
|
auth: "protected"
|
|
65166
|
+
}),
|
|
65167
|
+
/**
|
|
65168
|
+
* Sets one oscillation axis: its switch, fixed angle and/or sweep bounds.
|
|
65169
|
+
* Fields left out are untouched. A field linked in Customize is forwarded
|
|
65170
|
+
* to its linked source (D1034); otherwise the native provider serves it;
|
|
65171
|
+
* neither → `axis-not-linked`. Ranges are checked against the axis limits
|
|
65172
|
+
* before anything is written; writes run in order and stop at the first
|
|
65173
|
+
* failure, which the result names.
|
|
65174
|
+
*/
|
|
65175
|
+
setOscillationAxis: optionalMethod(SetOscillationAxisInputSchema, FanOscillationAxisResultSchema, {
|
|
65176
|
+
kind: "mutation",
|
|
65177
|
+
auth: "protected"
|
|
63840
65178
|
})
|
|
63841
65179
|
},
|
|
63842
65180
|
status: {
|
|
@@ -63848,6 +65186,7 @@ var fanControlCapability = {
|
|
|
63848
65186
|
* sliders read `speed` for live updates.
|
|
63849
65187
|
*/
|
|
63850
65188
|
runtimeState: FanControlStatusSchema,
|
|
65189
|
+
customize: fanControlCustomize,
|
|
63851
65190
|
/**
|
|
63852
65191
|
* Runtime-state durability: **session** — as `brightness`.
|
|
63853
65192
|
*
|
|
@@ -63867,16 +65206,33 @@ var fanControlCapability = {
|
|
|
63867
65206
|
oscillating: { kind: "boolean" }
|
|
63868
65207
|
} }
|
|
63869
65208
|
};
|
|
65209
|
+
/** One axis as a preset wants it; an absent field is left as it is. */
|
|
65210
|
+
var FanPresetAxisSchema = zod.z.object({
|
|
65211
|
+
oscillating: zod.z.boolean().optional(),
|
|
65212
|
+
angle: zod.z.number().optional(),
|
|
65213
|
+
sweepFrom: zod.z.number().optional(),
|
|
65214
|
+
sweepTo: zod.z.number().optional()
|
|
65215
|
+
});
|
|
65216
|
+
/** The fan-control state a preset sets; an absent field is left as it is. */
|
|
65217
|
+
var FanPresetStateSchema = zod.z.object({
|
|
65218
|
+
speed: zod.z.number().min(0).max(100).optional(),
|
|
65219
|
+
/** The fan's own preset mode (or the linked select's option). */
|
|
65220
|
+
preset: zod.z.string().min(1).optional(),
|
|
65221
|
+
direction: FanDirectionSchema.optional(),
|
|
65222
|
+
oscillationAxes: zod.z.object({
|
|
65223
|
+
horizontal: FanPresetAxisSchema.optional(),
|
|
65224
|
+
vertical: FanPresetAxisSchema.optional()
|
|
65225
|
+
}).optional()
|
|
65226
|
+
});
|
|
63870
65227
|
var FanPresetSchema = zod.z.object({
|
|
63871
65228
|
/** Stable key; never reused after a delete within one device's list. */
|
|
63872
65229
|
id: zod.z.string().min(1).max(64),
|
|
63873
65230
|
/** What the operator and a voice assistant call it. */
|
|
63874
65231
|
name: zod.z.string().trim().min(1).max(40),
|
|
63875
|
-
|
|
65232
|
+
state: FanPresetStateSchema
|
|
63876
65233
|
});
|
|
63877
65234
|
var FanPresetsRefusalSchema = zod.z.enum([
|
|
63878
|
-
"
|
|
63879
|
-
"bad-target",
|
|
65235
|
+
"empty-state",
|
|
63880
65236
|
"duplicate-name",
|
|
63881
65237
|
"duplicate-id",
|
|
63882
65238
|
"too-many",
|
|
@@ -63888,64 +65244,50 @@ var FanPresetsSetResultSchema = zod.z.discriminatedUnion("status", [zod.z.object
|
|
|
63888
65244
|
}), zod.z.object({
|
|
63889
65245
|
status: zod.z.literal("refused"),
|
|
63890
65246
|
reason: FanPresetsRefusalSchema,
|
|
63891
|
-
/** Names the preset
|
|
65247
|
+
/** Names the preset at fault. */
|
|
63892
65248
|
detail: zod.z.string()
|
|
63893
65249
|
})]);
|
|
63894
|
-
var
|
|
63895
|
-
|
|
65250
|
+
var FanPresetFieldResultSchema = zod.z.object({
|
|
65251
|
+
/** The state path: `speed`, `preset`, `direction`, `oscillationAxes.horizontal.angle`. */
|
|
65252
|
+
field: zod.z.string(),
|
|
63896
65253
|
outcome: zod.z.enum([
|
|
63897
65254
|
"applied",
|
|
63898
65255
|
"failed",
|
|
63899
65256
|
"not-run",
|
|
63900
65257
|
"refused"
|
|
63901
65258
|
]),
|
|
63902
|
-
deviceId: zod.z.number().int().nonnegative().optional(),
|
|
63903
|
-
cap: zod.z.string().optional(),
|
|
63904
|
-
method: zod.z.string().optional(),
|
|
63905
65259
|
/** The cause, for every outcome but `applied`. */
|
|
63906
65260
|
message: zod.z.string().optional()
|
|
63907
65261
|
});
|
|
63908
65262
|
var FanPresetApplyResultSchema = zod.z.object({
|
|
63909
|
-
/** `applied`: every
|
|
65263
|
+
/** `applied`: every field landed. `partial`: some did, one did not. `refused`: nothing ran. */
|
|
63910
65264
|
status: zod.z.enum([
|
|
63911
65265
|
"applied",
|
|
63912
65266
|
"partial",
|
|
63913
65267
|
"refused"
|
|
63914
65268
|
]),
|
|
63915
|
-
|
|
65269
|
+
fields: zod.z.array(FanPresetFieldResultSchema)
|
|
63916
65270
|
});
|
|
63917
|
-
/** The fan
|
|
65271
|
+
/** The fan-control fields a capture may take. */
|
|
63918
65272
|
var FAN_CAPTURE_FIELDS = [
|
|
63919
65273
|
"speed",
|
|
63920
|
-
"oscillating",
|
|
63921
65274
|
"direction",
|
|
63922
|
-
"preset"
|
|
65275
|
+
"preset",
|
|
65276
|
+
"oscillationAxes"
|
|
63923
65277
|
];
|
|
63924
65278
|
var FanCaptureFieldSchema = zod.z.enum(FAN_CAPTURE_FIELDS);
|
|
63925
65279
|
var FanCaptureOmissionSchema = zod.z.object({
|
|
63926
|
-
/** A
|
|
65280
|
+
/** A state path (`speed`, `oscillationAxes.vertical.angle`). */
|
|
63927
65281
|
what: zod.z.string(),
|
|
63928
|
-
/** Why no value was taken: unknown reading
|
|
65282
|
+
/** Why no value was taken: an unknown reading is never stored as 0 (D393). */
|
|
63929
65283
|
reason: zod.z.string()
|
|
63930
65284
|
});
|
|
63931
|
-
var FanCaptureGroupSchema = zod.z.enum([
|
|
63932
|
-
"fan",
|
|
63933
|
-
"oscillation",
|
|
63934
|
-
"angles"
|
|
63935
|
-
]);
|
|
63936
|
-
var FanCaptureItemSchema = zod.z.object({
|
|
63937
|
-
group: FanCaptureGroupSchema,
|
|
63938
|
-
/** What the step sets, in the operator's words (a device name, a fan field). */
|
|
63939
|
-
label: zod.z.string()
|
|
63940
|
-
});
|
|
63941
65285
|
var FanPresetCaptureResultSchema = zod.z.object({
|
|
63942
|
-
/** The
|
|
63943
|
-
|
|
63944
|
-
/** One entry per step, same order: its review group and label. */
|
|
63945
|
-
items: zod.z.array(FanCaptureItemSchema),
|
|
65286
|
+
/** The fan's CURRENT fan-control state, as a preset; NOT saved. */
|
|
65287
|
+
state: FanPresetStateSchema,
|
|
63946
65288
|
omitted: zod.z.array(FanCaptureOmissionSchema)
|
|
63947
65289
|
});
|
|
63948
|
-
var deviceInput$
|
|
65290
|
+
var deviceInput$1 = zod.z.object({ deviceId: zod.z.number().int().nonnegative() });
|
|
63949
65291
|
var fanPresetsCustomize = {
|
|
63950
65292
|
version: 1,
|
|
63951
65293
|
targets: [{
|
|
@@ -63963,28 +65305,22 @@ var fanPresetsCapability = {
|
|
|
63963
65305
|
scope: "system",
|
|
63964
65306
|
mode: "singleton",
|
|
63965
65307
|
methods: {
|
|
63966
|
-
getPresets: method(deviceInput$
|
|
63967
|
-
setPresets: method(deviceInput$
|
|
65308
|
+
getPresets: method(deviceInput$1, zod.z.array(FanPresetSchema), { auth: "protected" }),
|
|
65309
|
+
setPresets: method(deviceInput$1.extend({ presets: zod.z.array(FanPresetSchema).max(12) }), FanPresetsSetResultSchema, {
|
|
63968
65310
|
kind: "mutation",
|
|
63969
65311
|
auth: "admin"
|
|
63970
65312
|
}),
|
|
63971
|
-
applyPreset: method(deviceInput$
|
|
65313
|
+
applyPreset: method(deviceInput$1.extend({ presetId: zod.z.string().min(1) }), FanPresetApplyResultSchema, {
|
|
63972
65314
|
kind: "mutation",
|
|
63973
65315
|
auth: "protected"
|
|
63974
65316
|
}),
|
|
63975
65317
|
/**
|
|
63976
|
-
*
|
|
63977
|
-
* `fields` (all when absent)
|
|
63978
|
-
*
|
|
63979
|
-
*
|
|
63980
|
-
* oscillation, fixed angles, fan fields, speed last. A reading that is
|
|
63981
|
-
* unknown is left out and named in `omitted`, never captured as 0. Nothing
|
|
63982
|
-
* is saved.
|
|
65318
|
+
* The fan's CURRENT fan-control state as a preset: the fields named in
|
|
65319
|
+
* `fields` (all when absent), read from its merged slice — a field linked
|
|
65320
|
+
* in Customize reads its link. A reading that is unknown is left out and
|
|
65321
|
+
* named in `omitted`, never captured as 0. Nothing is saved.
|
|
63983
65322
|
*/
|
|
63984
|
-
capturePreset: method(deviceInput$
|
|
63985
|
-
fields: zod.z.array(FanCaptureFieldSchema).optional(),
|
|
63986
|
-
steps: zod.z.array(ActionStepSchema).max(20).default([])
|
|
63987
|
-
}), FanPresetCaptureResultSchema, { auth: "protected" })
|
|
65323
|
+
capturePreset: method(deviceInput$1.extend({ fields: zod.z.array(FanCaptureFieldSchema).optional() }), FanPresetCaptureResultSchema, { auth: "protected" })
|
|
63988
65324
|
},
|
|
63989
65325
|
customize: fanPresetsCustomize
|
|
63990
65326
|
};
|
|
@@ -64212,8 +65548,7 @@ var groupActiveCapability = {
|
|
|
64212
65548
|
DeviceType.Valve,
|
|
64213
65549
|
DeviceType.Lock,
|
|
64214
65550
|
DeviceType.MediaPlayer,
|
|
64215
|
-
DeviceType.Climate
|
|
64216
|
-
DeviceType.Thermostat
|
|
65551
|
+
DeviceType.Climate
|
|
64217
65552
|
],
|
|
64218
65553
|
methods: {},
|
|
64219
65554
|
status: {
|
|
@@ -64262,7 +65597,6 @@ var groupCommandsCapability = {
|
|
|
64262
65597
|
DeviceType.Valve,
|
|
64263
65598
|
DeviceType.Lock,
|
|
64264
65599
|
DeviceType.MediaPlayer,
|
|
64265
|
-
DeviceType.Thermostat,
|
|
64266
65600
|
DeviceType.Climate
|
|
64267
65601
|
],
|
|
64268
65602
|
methods: {},
|
|
@@ -64318,7 +65652,6 @@ var groupStatusCapability = {
|
|
|
64318
65652
|
DeviceType.Valve,
|
|
64319
65653
|
DeviceType.Lock,
|
|
64320
65654
|
DeviceType.MediaPlayer,
|
|
64321
|
-
DeviceType.Thermostat,
|
|
64322
65655
|
DeviceType.Climate
|
|
64323
65656
|
],
|
|
64324
65657
|
methods: {},
|
|
@@ -64674,7 +66007,7 @@ var heatingValveCapability = {
|
|
|
64674
66007
|
scope: "device",
|
|
64675
66008
|
deviceNative: true,
|
|
64676
66009
|
mode: "singleton",
|
|
64677
|
-
deviceTypes: [DeviceType.
|
|
66010
|
+
deviceTypes: [DeviceType.Climate],
|
|
64678
66011
|
methods: {},
|
|
64679
66012
|
status: {
|
|
64680
66013
|
schema: HeatingValveStatusSchema,
|
|
@@ -64704,29 +66037,41 @@ var heatingValveCapability = {
|
|
|
64704
66037
|
* retried in a loop - D49); a future one is re-armed.
|
|
64705
66038
|
*
|
|
64706
66039
|
* What a device may be run for, and for how long at most, is per device type
|
|
64707
|
-
* ({@link
|
|
66040
|
+
* and role ({@link timedRunLimitOf}): the maximum is a safety bound, not a preference,
|
|
64708
66041
|
* so a request above it is REFUSED with a typed reason, never clamped.
|
|
64709
66042
|
*/
|
|
64710
66043
|
var TimedRunUnitSchema = zod.z.enum(["s", "min"]);
|
|
64711
66044
|
zod.z.enum(["switch", "pet-fountain"]);
|
|
64712
|
-
/**
|
|
64713
|
-
var
|
|
64714
|
-
|
|
64715
|
-
|
|
64716
|
-
|
|
64717
|
-
|
|
64718
|
-
quickRunDefault: 30
|
|
64719
|
-
},
|
|
64720
|
-
[DeviceType.PetFountain]: {
|
|
64721
|
-
actuator: "pet-fountain",
|
|
64722
|
-
maxSeconds: 300,
|
|
64723
|
-
unit: "s",
|
|
64724
|
-
quickRunDefault: 60
|
|
64725
|
-
}
|
|
66045
|
+
/** A plug-in heater (switch + `switch-heater`): up to 3 h, in minutes. */
|
|
66046
|
+
var TIMED_RUN_HEATER_LIMIT = {
|
|
66047
|
+
actuator: "switch",
|
|
66048
|
+
maxSeconds: 10800,
|
|
66049
|
+
unit: "min",
|
|
66050
|
+
quickRunDefault: 30
|
|
64726
66051
|
};
|
|
64727
|
-
|
|
64728
|
-
|
|
64729
|
-
|
|
66052
|
+
/** A pet fountain's pump: up to 5 min, in seconds. */
|
|
66053
|
+
var TIMED_RUN_PET_FOUNTAIN_LIMIT = {
|
|
66054
|
+
actuator: "pet-fountain",
|
|
66055
|
+
maxSeconds: 300,
|
|
66056
|
+
unit: "s",
|
|
66057
|
+
quickRunDefault: 60
|
|
66058
|
+
};
|
|
66059
|
+
/**
|
|
66060
|
+
* The device types `timed-run` may be offered on. A `switch` is narrowed by
|
|
66061
|
+
* role ({@link TIMED_RUN_DEVICE_ROLES}): only a plug-in heater runs on a timer.
|
|
66062
|
+
*/
|
|
66063
|
+
var TIMED_RUN_DEVICE_TYPES = [DeviceType.Switch, DeviceType.PetFountain];
|
|
66064
|
+
/** The roles that make a device of these types timed-run-able (D1033). */
|
|
66065
|
+
var TIMED_RUN_DEVICE_ROLES = { [DeviceType.Switch]: [DeviceRole.SwitchHeater] };
|
|
66066
|
+
/**
|
|
66067
|
+
* The longest run of a device, by its type AND role (D1033): a `switch` is a
|
|
66068
|
+
* heater only with role `switch-heater`, a pet fountain always is what it is.
|
|
66069
|
+
* `null` - the device is not offered `timed-run`.
|
|
66070
|
+
*/
|
|
66071
|
+
function timedRunLimitOf(deviceType, role) {
|
|
66072
|
+
if (deviceType === DeviceType.PetFountain) return TIMED_RUN_PET_FOUNTAIN_LIMIT;
|
|
66073
|
+
if (deviceType === DeviceType.Switch && role === DeviceRole.SwitchHeater) return TIMED_RUN_HEATER_LIMIT;
|
|
66074
|
+
return null;
|
|
64730
66075
|
}
|
|
64731
66076
|
var MS_PER_SECOND = 1e3;
|
|
64732
66077
|
var MS_PER_MINUTE = 6e4;
|
|
@@ -64808,6 +66153,7 @@ var timedRunCapability = {
|
|
|
64808
66153
|
kind: "wrapper",
|
|
64809
66154
|
defaultActive: true,
|
|
64810
66155
|
deviceTypes: TIMED_RUN_DEVICE_TYPES,
|
|
66156
|
+
deviceRoles: TIMED_RUN_DEVICE_ROLES,
|
|
64811
66157
|
deviceConfig: { ui: {
|
|
64812
66158
|
kind: "derived-form",
|
|
64813
66159
|
builderId: "timed-run",
|
|
@@ -64978,8 +66324,7 @@ var HERO_SCENE_BY_TYPE = {
|
|
|
64978
66324
|
[DeviceType.Siren]: "siren",
|
|
64979
66325
|
[DeviceType.Switch]: "plug",
|
|
64980
66326
|
[DeviceType.Sensor]: "sensor-sparkline",
|
|
64981
|
-
[DeviceType.
|
|
64982
|
-
[DeviceType.Climate]: "ac",
|
|
66327
|
+
[DeviceType.Climate]: "thermostat",
|
|
64983
66328
|
[DeviceType.Button]: "button",
|
|
64984
66329
|
[DeviceType.EventEmitter]: "event-stream",
|
|
64985
66330
|
[DeviceType.Update]: "update",
|
|
@@ -65007,7 +66352,6 @@ var HERO_SCENE_BY_TYPE = {
|
|
|
65007
66352
|
[DeviceType.PetFountain]: "pet-fountain",
|
|
65008
66353
|
[DeviceType.Dishwasher]: "dishwasher",
|
|
65009
66354
|
[DeviceType.Washer]: "washer",
|
|
65010
|
-
[DeviceType.Heater]: "heater",
|
|
65011
66355
|
[DeviceType.Dryer]: "dryer",
|
|
65012
66356
|
[DeviceType.Gateway]: "gateway"
|
|
65013
66357
|
};
|
|
@@ -65032,6 +66376,14 @@ var HERO_SCENE_BY_ROLE = {
|
|
|
65032
66376
|
[DeviceRole.CoverWindow]: "inherit",
|
|
65033
66377
|
[DeviceRole.BinaryHelper]: "inherit",
|
|
65034
66378
|
[DeviceRole.Outlet]: "plug",
|
|
66379
|
+
[DeviceRole.SwitchHeater]: "heater",
|
|
66380
|
+
[DeviceRole.SwitchFan]: "fan",
|
|
66381
|
+
[DeviceRole.ClimateAc]: "ac",
|
|
66382
|
+
[DeviceRole.ClimateThermostat]: "inherit",
|
|
66383
|
+
[DeviceRole.ClimateFloor]: "inherit",
|
|
66384
|
+
[DeviceRole.ClimateRadiator]: "inherit",
|
|
66385
|
+
[DeviceRole.ClimateHeater]: "inherit",
|
|
66386
|
+
[DeviceRole.ClimateHeatPumpCircuit]: "inherit",
|
|
65035
66387
|
[DeviceRole.MotionSensor]: "presence",
|
|
65036
66388
|
[DeviceRole.ContactSensor]: "contact",
|
|
65037
66389
|
[DeviceRole.LeakSensor]: "inherit",
|
|
@@ -65501,10 +66853,7 @@ function trailingOf(facts) {
|
|
|
65501
66853
|
* A type whose primary is a named control, not its power: a climate row is the mode
|
|
65502
66854
|
* (which carries "off") and the setpoint, with no power toggle.
|
|
65503
66855
|
*/
|
|
65504
|
-
var ROW_PRIMARY_BY_TYPE = {
|
|
65505
|
-
[DeviceType.Climate]: "climate.mode",
|
|
65506
|
-
[DeviceType.Thermostat]: "climate.mode"
|
|
65507
|
-
};
|
|
66856
|
+
var ROW_PRIMARY_BY_TYPE = { [DeviceType.Climate]: "climate.mode" };
|
|
65508
66857
|
function primaryOf(model) {
|
|
65509
66858
|
const named = ROW_PRIMARY_BY_TYPE[model.type];
|
|
65510
66859
|
if (named !== void 0) {
|
|
@@ -65537,7 +66886,6 @@ function primaryOf(model) {
|
|
|
65537
66886
|
*/
|
|
65538
66887
|
var ROW_EXTRAS_BY_TYPE = {
|
|
65539
66888
|
[DeviceType.Climate]: ["climate.target"],
|
|
65540
|
-
[DeviceType.Thermostat]: ["climate.target"],
|
|
65541
66889
|
[DeviceType.Vacuum]: ["vacuum.base"],
|
|
65542
66890
|
[DeviceType.LawnMower]: ["mower.dock"],
|
|
65543
66891
|
[DeviceType.MediaPlayer]: ["volume.level", REMOTE_OPEN_ACTION_ID]
|
|
@@ -65656,7 +67004,11 @@ var heroLayoutCapability = {
|
|
|
65656
67004
|
auth: "protected",
|
|
65657
67005
|
role: "viewer"
|
|
65658
67006
|
}),
|
|
65659
|
-
|
|
67007
|
+
/** The fixed rows of a kind: the type, refined by the role (D1033 — a heater is a switch). */
|
|
67008
|
+
getLayout: method(zod.z.object({
|
|
67009
|
+
deviceType: zod.z.string(),
|
|
67010
|
+
role: zod.z.string().nullable().optional()
|
|
67011
|
+
}), HeroLayoutRowsSchema, {
|
|
65660
67012
|
auth: "protected",
|
|
65661
67013
|
role: "viewer"
|
|
65662
67014
|
})
|
|
@@ -65705,6 +67057,11 @@ var humidifierCapability = {
|
|
|
65705
67057
|
deviceNative: true,
|
|
65706
67058
|
mode: "singleton",
|
|
65707
67059
|
deviceTypes: [DeviceType.Humidifier],
|
|
67060
|
+
power: {
|
|
67061
|
+
kind: "field",
|
|
67062
|
+
field: "on",
|
|
67063
|
+
set: "setOn"
|
|
67064
|
+
},
|
|
65708
67065
|
methods: {
|
|
65709
67066
|
setOn: method(zod.z.object({
|
|
65710
67067
|
deviceId: zod.z.number().int().nonnegative(),
|
|
@@ -65778,7 +67135,7 @@ var humiditySensorCapability = {
|
|
|
65778
67135
|
scope: "device",
|
|
65779
67136
|
deviceNative: true,
|
|
65780
67137
|
mode: "singleton",
|
|
65781
|
-
deviceTypes: [DeviceType.Sensor, DeviceType.
|
|
67138
|
+
deviceTypes: [DeviceType.Sensor, DeviceType.Climate],
|
|
65782
67139
|
methods: {},
|
|
65783
67140
|
status: {
|
|
65784
67141
|
schema: HumiditySensorStatusSchema,
|
|
@@ -81829,7 +83186,18 @@ var OauthIntegrationDescriptorSchema = zod.z.object({
|
|
|
81829
83186
|
* The value is baked into the authorization code at `/authorize` and travels
|
|
81830
83187
|
* on the tokens, so editing this field changes FUTURE links only.
|
|
81831
83188
|
*/
|
|
81832
|
-
refreshTokenTtlSec: zod.z.union([zod.z.number().int().positive(), zod.z.literal("never")]).optional()
|
|
83189
|
+
refreshTokenTtlSec: zod.z.union([zod.z.number().int().positive(), zod.z.literal("never")]).optional(),
|
|
83190
|
+
/**
|
|
83191
|
+
* The integration instances an account can be linked to (planning#415),
|
|
83192
|
+
* beside the default one. `/api/oauth2/authorize?instance=<id>` is accepted
|
|
83193
|
+
* only for an id listed here; with no `instance=` the link is made to the
|
|
83194
|
+
* default instance, which is never listed and always accepted — it is the
|
|
83195
|
+
* address third parties already hold. Omit for a single-instance integration.
|
|
83196
|
+
*/
|
|
83197
|
+
instances: zod.z.array(zod.z.object({
|
|
83198
|
+
id: zod.z.string(),
|
|
83199
|
+
displayName: zod.z.string()
|
|
83200
|
+
})).optional()
|
|
81833
83201
|
});
|
|
81834
83202
|
var oauthIntegrationCapability = {
|
|
81835
83203
|
name: "oauth-integration",
|
|
@@ -82465,6 +83833,11 @@ var petFountainCapability = {
|
|
|
82465
83833
|
deviceNative: true,
|
|
82466
83834
|
mode: "singleton",
|
|
82467
83835
|
deviceTypes: [DeviceType.PetFountain],
|
|
83836
|
+
power: {
|
|
83837
|
+
kind: "field",
|
|
83838
|
+
field: "pumpRunning",
|
|
83839
|
+
set: "setPump"
|
|
83840
|
+
},
|
|
82468
83841
|
methods: {
|
|
82469
83842
|
/** Start or stop the pump. */
|
|
82470
83843
|
setPump: method(zod.z.object({
|
|
@@ -84579,7 +85952,6 @@ var POWER_METER_DEVICE_TYPES = [
|
|
|
84579
85952
|
DeviceType.Light,
|
|
84580
85953
|
DeviceType.Fan,
|
|
84581
85954
|
DeviceType.Climate,
|
|
84582
|
-
DeviceType.Thermostat,
|
|
84583
85955
|
DeviceType.Humidifier,
|
|
84584
85956
|
DeviceType.WaterHeater,
|
|
84585
85957
|
DeviceType.MediaPlayer,
|
|
@@ -84588,8 +85960,7 @@ var POWER_METER_DEVICE_TYPES = [
|
|
|
84588
85960
|
DeviceType.Dishwasher,
|
|
84589
85961
|
DeviceType.Vacuum,
|
|
84590
85962
|
DeviceType.LawnMower,
|
|
84591
|
-
DeviceType.PetFeeder
|
|
84592
|
-
DeviceType.Heater
|
|
85963
|
+
DeviceType.PetFeeder
|
|
84593
85964
|
];
|
|
84594
85965
|
/** Everything but a bare `Sensor`: a sensor that takes its reading from another sensor adds nothing. */
|
|
84595
85966
|
var POWER_METER_CUSTOMIZE_DEVICE_TYPES = POWER_METER_DEVICE_TYPES.filter((type) => type !== DeviceType.Sensor);
|
|
@@ -84702,117 +86073,6 @@ var powerMeterCapability = {
|
|
|
84702
86073
|
volatileStateFields: ["lastFetchedAt"],
|
|
84703
86074
|
customize: powerMeterCustomize
|
|
84704
86075
|
};
|
|
84705
|
-
var PowerSourceRefusalReasonSchema = zod.z.enum([
|
|
84706
|
-
"no-power-source",
|
|
84707
|
-
"switch-missing",
|
|
84708
|
-
"switch-offline",
|
|
84709
|
-
"switch-unknown",
|
|
84710
|
-
"restart-in-progress",
|
|
84711
|
-
"switch-call-failed"
|
|
84712
|
-
]);
|
|
84713
|
-
var PowerSourceActionResultSchema = zod.z.discriminatedUnion("accepted", [zod.z.object({ accepted: zod.z.literal(true) }), zod.z.object({
|
|
84714
|
-
accepted: zod.z.literal(false),
|
|
84715
|
-
reason: PowerSourceRefusalReasonSchema,
|
|
84716
|
-
/** One line for the operator, naming the switch. */
|
|
84717
|
-
message: zod.z.string()
|
|
84718
|
-
})]);
|
|
84719
|
-
var PowerSourceInfoSchema = zod.z.object({
|
|
84720
|
-
/** False when the device has no power source linked; the rest is then empty. */
|
|
84721
|
-
linked: zod.z.boolean(),
|
|
84722
|
-
switchDeviceId: zod.z.number().nullable(),
|
|
84723
|
-
switchName: zod.z.string().nullable(),
|
|
84724
|
-
/** The switch's on/off state, or null when it is unknown. Never false for unknown (D393). */
|
|
84725
|
-
switchOn: zod.z.boolean().nullable(),
|
|
84726
|
-
switchOnline: zod.z.boolean().nullable(),
|
|
84727
|
-
restartInProgress: zod.z.boolean(),
|
|
84728
|
-
offSeconds: zod.z.number().int()
|
|
84729
|
-
});
|
|
84730
|
-
/** The composed slice: the switch state the link mirrors, plus the stored off time. */
|
|
84731
|
-
var PowerSourceStateSchema = zod.z.object({
|
|
84732
|
-
/** Null while the switch has not reported: unknown is never `false` (D393). */
|
|
84733
|
-
switchOn: zod.z.boolean().nullable(),
|
|
84734
|
-
offSeconds: zod.z.number().int(),
|
|
84735
|
-
lastFetchedAt: zod.z.number()
|
|
84736
|
-
});
|
|
84737
|
-
var POWER_SOURCE_DEVICE_TYPES = [
|
|
84738
|
-
DeviceType.Gateway,
|
|
84739
|
-
DeviceType.Camera,
|
|
84740
|
-
DeviceType.Sensor,
|
|
84741
|
-
DeviceType.MediaPlayer,
|
|
84742
|
-
DeviceType.Vacuum,
|
|
84743
|
-
DeviceType.Generic,
|
|
84744
|
-
DeviceType.Washer,
|
|
84745
|
-
DeviceType.Dryer,
|
|
84746
|
-
DeviceType.Dishwasher,
|
|
84747
|
-
DeviceType.PetFountain,
|
|
84748
|
-
DeviceType.Fan,
|
|
84749
|
-
DeviceType.Humidifier,
|
|
84750
|
-
DeviceType.Climate,
|
|
84751
|
-
DeviceType.WaterHeater
|
|
84752
|
-
];
|
|
84753
|
-
var powerSourceCustomize = {
|
|
84754
|
-
version: 1,
|
|
84755
|
-
targets: [{
|
|
84756
|
-
id: "switch",
|
|
84757
|
-
cardinality: "scalar",
|
|
84758
|
-
vocabulary: {
|
|
84759
|
-
cap: "power-source",
|
|
84760
|
-
stateField: "switchOn"
|
|
84761
|
-
},
|
|
84762
|
-
deviceTypes: POWER_SOURCE_DEVICE_TYPES,
|
|
84763
|
-
apply: "add",
|
|
84764
|
-
path: "switchOn",
|
|
84765
|
-
sources: [{
|
|
84766
|
-
kind: "switch",
|
|
84767
|
-
transforms: [{ kind: "identity" }]
|
|
84768
|
-
}],
|
|
84769
|
-
companions: [{
|
|
84770
|
-
kind: "constant",
|
|
84771
|
-
path: "offSeconds",
|
|
84772
|
-
value: 10,
|
|
84773
|
-
when: "add",
|
|
84774
|
-
formerValues: [0]
|
|
84775
|
-
}, {
|
|
84776
|
-
kind: "clock",
|
|
84777
|
-
path: "lastFetchedAt",
|
|
84778
|
-
when: "always"
|
|
84779
|
-
}],
|
|
84780
|
-
sourceReport: { status: "assignment-status" }
|
|
84781
|
-
}]
|
|
84782
|
-
};
|
|
84783
|
-
var deviceInput$1 = zod.z.object({ deviceId: zod.z.number().int().nonnegative() });
|
|
84784
|
-
var powerSourceCapability = {
|
|
84785
|
-
name: "power-source",
|
|
84786
|
-
scope: "device",
|
|
84787
|
-
mode: "singleton",
|
|
84788
|
-
deviceTypes: POWER_SOURCE_DEVICE_TYPES,
|
|
84789
|
-
methods: {
|
|
84790
|
-
getStatus: systemMethod(deviceInput$1, PowerSourceInfoSchema, { auth: "protected" }),
|
|
84791
|
-
powerOn: systemMethod(deviceInput$1, PowerSourceActionResultSchema, {
|
|
84792
|
-
kind: "mutation",
|
|
84793
|
-
auth: "protected"
|
|
84794
|
-
}),
|
|
84795
|
-
powerOff: systemMethod(deviceInput$1, PowerSourceActionResultSchema, {
|
|
84796
|
-
kind: "mutation",
|
|
84797
|
-
auth: "protected"
|
|
84798
|
-
}),
|
|
84799
|
-
forceRestart: systemMethod(deviceInput$1, PowerSourceActionResultSchema, {
|
|
84800
|
-
kind: "mutation",
|
|
84801
|
-
auth: "protected"
|
|
84802
|
-
})
|
|
84803
|
-
},
|
|
84804
|
-
runtimeState: PowerSourceStateSchema,
|
|
84805
|
-
customize: powerSourceCustomize,
|
|
84806
|
-
/**
|
|
84807
|
-
* Runtime-state durability: **session** — mirrored from the linked switch on
|
|
84808
|
-
* its next report; a restored value would outlive the reading it names.
|
|
84809
|
-
*
|
|
84810
|
-
* See `RuntimeStateDurability`. Enforced by
|
|
84811
|
-
* `scripts/check-runtime-state-durability.ts`.
|
|
84812
|
-
*/
|
|
84813
|
-
durability: "session",
|
|
84814
|
-
history: "none"
|
|
84815
|
-
};
|
|
84816
86076
|
/**
|
|
84817
86077
|
* Presence cap. Models HA `person.*` and `device_tracker.*` entities
|
|
84818
86078
|
* on `DeviceType.Presence`. Read-only — no setters: presence is
|
|
@@ -89135,9 +90395,7 @@ var RUNNING_CUSTOMIZE_DEVICE_TYPES = [
|
|
|
89135
90395
|
DeviceType.Humidifier,
|
|
89136
90396
|
DeviceType.Fan,
|
|
89137
90397
|
DeviceType.Climate,
|
|
89138
|
-
DeviceType.
|
|
89139
|
-
DeviceType.PetFeeder,
|
|
89140
|
-
DeviceType.Heater
|
|
90398
|
+
DeviceType.PetFeeder
|
|
89141
90399
|
];
|
|
89142
90400
|
var runningStateCapability = {
|
|
89143
90401
|
name: "running-state",
|
|
@@ -90665,6 +91923,13 @@ var SsoBridgeClaimsSchema = zod.z.object({
|
|
|
90665
91923
|
/** OAuth authorization-code binding — set only on `oauth-code` tokens. */
|
|
90666
91924
|
redirectUri: zod.z.string().optional(),
|
|
90667
91925
|
integrationId: zod.z.string().optional(),
|
|
91926
|
+
/**
|
|
91927
|
+
* The integration INSTANCE an OAuth link was made for (planning#415). Set on
|
|
91928
|
+
* `oauth-code`, `oauth-access` and `oauth-refresh` tokens of a link made
|
|
91929
|
+
* with `instance=`; absent on a link to the default instance. A cloud relay
|
|
91930
|
+
* reads it off the access token to route; the hub answers from the session.
|
|
91931
|
+
*/
|
|
91932
|
+
instanceId: zod.z.string().optional(),
|
|
90668
91933
|
/** JWT ID — unique per issued code; consumed-set enforces single-use. */
|
|
90669
91934
|
jti: zod.z.string().optional(),
|
|
90670
91935
|
/** PKCE S256 challenge — set only on `oauth-code` tokens issued to a public
|
|
@@ -91762,8 +93027,7 @@ var switchCapability = {
|
|
|
91762
93027
|
DeviceType.Switch,
|
|
91763
93028
|
DeviceType.Siren,
|
|
91764
93029
|
DeviceType.Light,
|
|
91765
|
-
DeviceType.Fan
|
|
91766
|
-
DeviceType.Heater
|
|
93030
|
+
DeviceType.Fan
|
|
91767
93031
|
],
|
|
91768
93032
|
methods: { setState: method(zod.z.object({
|
|
91769
93033
|
deviceId: zod.z.number(),
|
|
@@ -92589,7 +93853,7 @@ var temperatureSensorCapability = {
|
|
|
92589
93853
|
scope: "device",
|
|
92590
93854
|
deviceNative: true,
|
|
92591
93855
|
mode: "singleton",
|
|
92592
|
-
deviceTypes: [DeviceType.Sensor, DeviceType.
|
|
93856
|
+
deviceTypes: [DeviceType.Sensor, DeviceType.Climate],
|
|
92593
93857
|
methods: {},
|
|
92594
93858
|
status: {
|
|
92595
93859
|
schema: TemperatureSensorStatusSchema,
|
|
@@ -93637,6 +94901,8 @@ var OauthSessionSummarySchema = zod.z.object({
|
|
|
93637
94901
|
userId: zod.z.string(),
|
|
93638
94902
|
username: zod.z.string(),
|
|
93639
94903
|
integrationId: zod.z.string(),
|
|
94904
|
+
/** The instance the link was made for; `null` = the default instance. */
|
|
94905
|
+
instanceId: zod.z.string().nullable().optional(),
|
|
93640
94906
|
scopes: zod.z.array(TokenScopeSchema),
|
|
93641
94907
|
createdAt: zod.z.number(),
|
|
93642
94908
|
lastUsedAt: zod.z.number(),
|
|
@@ -93765,6 +95031,9 @@ var userManagementCapability = {
|
|
|
93765
95031
|
}),
|
|
93766
95032
|
oauthIssueCode: method(zod.z.object({
|
|
93767
95033
|
integrationId: zod.z.string(),
|
|
95034
|
+
/** The integration instance the link is for. Omit for the default
|
|
95035
|
+
* instance — never pass the addon id to mean it. */
|
|
95036
|
+
instanceId: zod.z.string().optional(),
|
|
93768
95037
|
userId: zod.z.string(),
|
|
93769
95038
|
username: zod.z.string(),
|
|
93770
95039
|
scopes: zod.z.array(TokenScopeSchema),
|
|
@@ -93806,7 +95075,13 @@ var userManagementCapability = {
|
|
|
93806
95075
|
oauthVerifyAccessToken: method(zod.z.object({ token: zod.z.string() }), zod.z.object({
|
|
93807
95076
|
userId: zod.z.string(),
|
|
93808
95077
|
username: zod.z.string(),
|
|
93809
|
-
scopes: zod.z.array(TokenScopeSchema)
|
|
95078
|
+
scopes: zod.z.array(TokenScopeSchema),
|
|
95079
|
+
/** The instance the link was made for, read from the SESSION.
|
|
95080
|
+
* Absent = the default instance. `oauthLinkServesInstance` is the
|
|
95081
|
+
* helper a per-instance route calls to compare it with the instance
|
|
95082
|
+
* of its path; no route declares `perInstance` yet (the Alexa
|
|
95083
|
+
* per-instance route, T3, is the first consumer). */
|
|
95084
|
+
instanceId: zod.z.string().optional()
|
|
93810
95085
|
}).nullable(), { access: "view" }),
|
|
93811
95086
|
listExternalIdentities: method(zod.z.object({ userId: zod.z.string() }), zod.z.array(ExternalIdentitySchema), { auth: "admin" }),
|
|
93812
95087
|
/** The user an identity is linked to, or `null`. */
|
|
@@ -94573,6 +95848,13 @@ var waterHeaterCapability = {
|
|
|
94573
95848
|
deviceNative: true,
|
|
94574
95849
|
mode: "singleton",
|
|
94575
95850
|
deviceTypes: [DeviceType.WaterHeater],
|
|
95851
|
+
power: {
|
|
95852
|
+
kind: "mode",
|
|
95853
|
+
field: "operationMode",
|
|
95854
|
+
offValue: "off",
|
|
95855
|
+
set: "setOperationMode",
|
|
95856
|
+
lastField: "lastActiveMode"
|
|
95857
|
+
},
|
|
94576
95858
|
methods: {
|
|
94577
95859
|
setTargetTemp: method(zod.z.object({
|
|
94578
95860
|
deviceId: zod.z.number().int().nonnegative(),
|
|
@@ -97517,7 +98799,7 @@ function compileValue$1(input) {
|
|
|
97517
98799
|
const transform = input.draft.transform;
|
|
97518
98800
|
if (transform.kind === "identity" || transform.kind === "number") return {
|
|
97519
98801
|
ok: true,
|
|
97520
|
-
value: identityValue(read, input.sourceValueKind)
|
|
98802
|
+
value: identityValue(read, input.sourceValueKind, targetValueKind(input))
|
|
97521
98803
|
};
|
|
97522
98804
|
if (transform.kind === "invert") {
|
|
97523
98805
|
if (input.sourceValueKind !== "boolean") return fail$2("source-kind");
|
|
@@ -97530,8 +98812,16 @@ function compileValue$1(input) {
|
|
|
97530
98812
|
if (transform.kind === "linear") return linearValue$1(transform, read, input.sourceValueKind);
|
|
97531
98813
|
return fail$2("transform");
|
|
97532
98814
|
}
|
|
97533
|
-
|
|
97534
|
-
|
|
98815
|
+
/** The kind of the field a draft writes, from the catalog. */
|
|
98816
|
+
function targetValueKind(input) {
|
|
98817
|
+
return catalogTarget$4(input.draft.cap, input.draft.targetId)?.valueKind;
|
|
98818
|
+
}
|
|
98819
|
+
/**
|
|
98820
|
+
* A string reading feeds a NUMBER field through `number(x)`; a string field
|
|
98821
|
+
* (a fan `preset` linked to a select, D1034) takes the string as it is.
|
|
98822
|
+
*/
|
|
98823
|
+
function identityValue(read, valueKind, targetKind) {
|
|
98824
|
+
if (valueKind === "string" && targetKind !== "string" && targetKind !== "enum") return expression("number(x)", { x: read });
|
|
97535
98825
|
return read;
|
|
97536
98826
|
}
|
|
97537
98827
|
/**
|
|
@@ -97613,7 +98903,7 @@ function compileCompanions$1(input, target, value) {
|
|
|
97613
98903
|
});
|
|
97614
98904
|
}
|
|
97615
98905
|
function companionIncluded$1(companion, apply) {
|
|
97616
|
-
if (companion.kind === "transition-time") return true;
|
|
98906
|
+
if (companion.kind === "transition-time" || companion.kind === "source-field") return true;
|
|
97617
98907
|
return companion.when === "always" || apply === "add";
|
|
97618
98908
|
}
|
|
97619
98909
|
function companionField(input, path, companion, value) {
|
|
@@ -97629,6 +98919,10 @@ function companionField(input, path, companion, value) {
|
|
|
97629
98919
|
ok: true,
|
|
97630
98920
|
value: literal("now")
|
|
97631
98921
|
};
|
|
98922
|
+
if (companion.kind === "source-field") return {
|
|
98923
|
+
ok: true,
|
|
98924
|
+
value: fromRead(refOf$1(input.draft), input.draft.source.cap, companion.field)
|
|
98925
|
+
};
|
|
97632
98926
|
return transitionField(input, path, companion.sourceChangedAt, value);
|
|
97633
98927
|
}
|
|
97634
98928
|
function transitionField(input, path, sourceChangedAt, value) {
|
|
@@ -97782,7 +99076,12 @@ function describeRead(read) {
|
|
|
97782
99076
|
function isConfirmed(reading) {
|
|
97783
99077
|
return reading.fatal || reading.confirmed === true;
|
|
97784
99078
|
}
|
|
97785
|
-
|
|
99079
|
+
/** Whether a non-null value is of the kind a field of `kind` holds. */
|
|
99080
|
+
function valueFitsKind(value, kind) {
|
|
99081
|
+
if (value === null) return true;
|
|
99082
|
+
return typeof value === (kind === "enum" ? "string" : kind);
|
|
99083
|
+
}
|
|
99084
|
+
function fromReading(reading, read, targetKind) {
|
|
97786
99085
|
if (reading.state === "unavailable") return {
|
|
97787
99086
|
state: "unavailable",
|
|
97788
99087
|
value: null,
|
|
@@ -97790,6 +99089,13 @@ function fromReading(reading, read) {
|
|
|
97790
99089
|
fatal: reading.fatal,
|
|
97791
99090
|
confirmed: isConfirmed(reading)
|
|
97792
99091
|
};
|
|
99092
|
+
if (targetKind !== void 0 && !valueFitsKind(reading.value, targetKind)) return {
|
|
99093
|
+
state: "unavailable",
|
|
99094
|
+
value: null,
|
|
99095
|
+
reason: `${describeRead(read)}: source-kind-mismatch, it reads a ${typeof reading.value} and the field takes a ${targetKind}`,
|
|
99096
|
+
fatal: false,
|
|
99097
|
+
confirmed: true
|
|
99098
|
+
};
|
|
97793
99099
|
return {
|
|
97794
99100
|
state: reading.state,
|
|
97795
99101
|
value: reading.value,
|
|
@@ -97913,7 +99219,7 @@ function aggregateField(source, read) {
|
|
|
97913
99219
|
function evaluateCompositionField(input) {
|
|
97914
99220
|
const { source } = input;
|
|
97915
99221
|
switch (source.kind) {
|
|
97916
|
-
case "from": return fromReading(input.read(source), source);
|
|
99222
|
+
case "from": return fromReading(input.read(source), source, input.targetKind);
|
|
97917
99223
|
case "expression": return expressionOutcome(source, input.read, input.now, input.stateful);
|
|
97918
99224
|
case "aggregate": return aggregateField(source, input.read);
|
|
97919
99225
|
case "series": return {
|
|
@@ -97945,54 +99251,6 @@ function lockDoorLinkOfComposition(composition) {
|
|
|
97945
99251
|
sensor: x.source
|
|
97946
99252
|
};
|
|
97947
99253
|
}
|
|
97948
|
-
/**
|
|
97949
|
-
* Which smart switch powers a device (the `power-source` Customize extension):
|
|
97950
|
-
* the source its stored `power-source.switchOn` field reads, and the off time of
|
|
97951
|
-
* a forced restart stored beside it. Read from the STORED composition, never kept
|
|
97952
|
-
* as a second copy (D676). Shared by the hub (which acts on the switch) and the
|
|
97953
|
-
* admin UI (which shows it).
|
|
97954
|
-
*/
|
|
97955
|
-
/**
|
|
97956
|
-
* The stored off time, or the default when none is stored. A stored number out
|
|
97957
|
-
* of range is CLAMPED to the bounds (a hand-written value never refuses the
|
|
97958
|
-
* link, it just cannot cut power for an absurd time); a non-integer is rounded.
|
|
97959
|
-
*/
|
|
97960
|
-
function normalizeOffSeconds(value) {
|
|
97961
|
-
if (typeof value !== "number" || !Number.isFinite(value)) return 10;
|
|
97962
|
-
return Math.min(120, Math.max(3, Math.round(value)));
|
|
97963
|
-
}
|
|
97964
|
-
/** The constant a stored `offSeconds` field carries, or undefined when it is not a literal number. */
|
|
97965
|
-
function storedOffSeconds(composition) {
|
|
97966
|
-
const feature = composition.features.find((f) => f.cap === "power-source");
|
|
97967
|
-
if (feature === void 0 || feature.kind !== "fields") return void 0;
|
|
97968
|
-
const field = feature.fields["offSeconds"];
|
|
97969
|
-
if (field === void 0 || field.kind !== "expression") return void 0;
|
|
97970
|
-
const n = Number(field.expr);
|
|
97971
|
-
return field.expr.trim() === "" || !Number.isFinite(n) ? void 0 : n;
|
|
97972
|
-
}
|
|
97973
|
-
/**
|
|
97974
|
-
* The link a composition stores. An `existing` target names its own device; a
|
|
97975
|
-
* `new` target (a composed device) is the composer's own device, so the caller
|
|
97976
|
-
* passes the block id and a new-target composition without one has no link.
|
|
97977
|
-
*/
|
|
97978
|
-
function powerSourceLinkOfComposition(composition, blockId) {
|
|
97979
|
-
if (composition === null) return null;
|
|
97980
|
-
let device;
|
|
97981
|
-
if (composition.target.kind === "existing") device = composition.target.device;
|
|
97982
|
-
else if (blockId !== void 0) device = composedDeviceRef(blockId);
|
|
97983
|
-
else return null;
|
|
97984
|
-
const feature = composition.features.find((f) => f.cap === "power-source");
|
|
97985
|
-
if (feature === void 0 || feature.kind !== "fields" || feature.enabled === false) return null;
|
|
97986
|
-
const field = feature.fields["switchOn"];
|
|
97987
|
-
if (field === void 0) return null;
|
|
97988
|
-
const read = fieldReads(field).find((r) => r.cap === "switch");
|
|
97989
|
-
if (read === void 0) return null;
|
|
97990
|
-
return {
|
|
97991
|
-
device,
|
|
97992
|
-
switch: read.source,
|
|
97993
|
-
offSeconds: normalizeOffSeconds(storedOffSeconds(composition))
|
|
97994
|
-
};
|
|
97995
|
-
}
|
|
97996
99254
|
SOURCE_CAPS.filter((cap) => cap !== "switch" && cap !== "motion");
|
|
97997
99255
|
String.raw`rose\(active(\d+), changed(\d+), (\d+(?:\.\d+)?)\)`;
|
|
97998
99256
|
DeviceRole.BinarySensor, DeviceRole.MotionSensor;
|
|
@@ -98998,7 +100256,6 @@ function applyPrimaryChildRule(rule, children) {
|
|
|
98998
100256
|
var CONTAINER_CHILD_PRIORITY = [
|
|
98999
100257
|
"media-player",
|
|
99000
100258
|
"alarm-panel",
|
|
99001
|
-
"thermostat",
|
|
99002
100259
|
"climate",
|
|
99003
100260
|
"humidifier",
|
|
99004
100261
|
"water-heater",
|
|
@@ -99488,7 +100745,72 @@ var DeclaredDevices = class {
|
|
|
99488
100745
|
return removed;
|
|
99489
100746
|
}
|
|
99490
100747
|
};
|
|
99491
|
-
|
|
100748
|
+
/**
|
|
100749
|
+
* A device's KIND is its type plus its role (D1033): the type is the set of
|
|
100750
|
+
* controls it has, the role says which thing it is among the devices that
|
|
100751
|
+
* share those controls. A plug-in heater is a `switch` with role
|
|
100752
|
+
* `switch-heater`; an air conditioner and a radiator valve are both `climate`,
|
|
100753
|
+
* told apart by their `climate-*` role.
|
|
100754
|
+
*/
|
|
100755
|
+
/**
|
|
100756
|
+
* Type values a persisted row may still carry after the type was retired, and
|
|
100757
|
+
* the type each one is read as. The row is rewritten by the next registration
|
|
100758
|
+
* of the device (its provider stamps the live type), so this is a read alias,
|
|
100759
|
+
* not a migration.
|
|
100760
|
+
*
|
|
100761
|
+
* `heater` is deliberately absent: the only heaters were composed devices the
|
|
100762
|
+
* operator deletes. Such a row stays an unknown type, which every reader
|
|
100763
|
+
* treats as a generic device.
|
|
100764
|
+
*/
|
|
100765
|
+
var RETIRED_DEVICE_TYPES = { thermostat: DeviceType.Climate };
|
|
100766
|
+
/** The live type a stored `type` value stands for (itself unless retired). */
|
|
100767
|
+
function canonicalStoredDeviceType(stored) {
|
|
100768
|
+
return RETIRED_DEVICE_TYPES[stored] ?? stored;
|
|
100769
|
+
}
|
|
100770
|
+
/** The `climate-*` roles, in the order the role picker lists them. */
|
|
100771
|
+
var CLIMATE_ROLES = [
|
|
100772
|
+
DeviceRole.ClimateThermostat,
|
|
100773
|
+
DeviceRole.ClimateAc,
|
|
100774
|
+
DeviceRole.ClimateRadiator,
|
|
100775
|
+
DeviceRole.ClimateFloor,
|
|
100776
|
+
DeviceRole.ClimateHeater,
|
|
100777
|
+
DeviceRole.ClimateHeatPumpCircuit
|
|
100778
|
+
];
|
|
100779
|
+
function isClimateRole(role) {
|
|
100780
|
+
return CLIMATE_ROLES.some((candidate) => candidate === role);
|
|
100781
|
+
}
|
|
100782
|
+
/**
|
|
100783
|
+
* Which climate device this is. A climate device with no role, or a role that
|
|
100784
|
+
* is not a climate one, is a room thermostat: that is what most of them are,
|
|
100785
|
+
* and it is the presentation a thermostat had before the types were folded.
|
|
100786
|
+
*/
|
|
100787
|
+
function climateRoleOf(role) {
|
|
100788
|
+
return role !== null && role !== void 0 && isClimateRole(role) ? role : DeviceRole.ClimateThermostat;
|
|
100789
|
+
}
|
|
100790
|
+
/** An air conditioner: exports present it as an AC unit, not a thermostat. */
|
|
100791
|
+
function isAirConditioner(type, role) {
|
|
100792
|
+
return type === DeviceType.Climate && climateRoleOf(role) === DeviceRole.ClimateAc;
|
|
100793
|
+
}
|
|
100794
|
+
/**
|
|
100795
|
+
* Is a capability offered on a device of this type and role?
|
|
100796
|
+
*
|
|
100797
|
+
* Fails open where the old type-only gate did: no `deviceTypes` (or an empty
|
|
100798
|
+
* list) applies to every device, and an unknown type never filters (a failed
|
|
100799
|
+
* meta read must not destroy work, D49). A type the cap's `deviceRoles` names
|
|
100800
|
+
* is offered only to the roles listed there; an unknown role is NOT one of
|
|
100801
|
+
* them, so a `switch` whose role could not be read is not a heater.
|
|
100802
|
+
*/
|
|
100803
|
+
function capAppliesToDeviceKind(gate, deviceType, role) {
|
|
100804
|
+
if (deviceType === void 0) return true;
|
|
100805
|
+
const types = gate?.deviceTypes;
|
|
100806
|
+
if (!types || types.length === 0) return true;
|
|
100807
|
+
const type = types.find((candidate) => candidate === deviceType);
|
|
100808
|
+
if (type === void 0) return false;
|
|
100809
|
+
const roles = gate?.deviceRoles?.[type];
|
|
100810
|
+
if (roles === void 0) return true;
|
|
100811
|
+
return role !== null && role !== void 0 && roles.some((candidate) => candidate === role);
|
|
100812
|
+
}
|
|
100813
|
+
DeviceType.Cover, DeviceType.Valve, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.HeatPump, DeviceType.Camera, DeviceType.Hub, DeviceType.Switch, DeviceType.Siren, DeviceType.Light, DeviceType.Fan, DeviceType.Sensor, DeviceType.Climate, DeviceType.Button, DeviceType.EventEmitter, DeviceType.Update, DeviceType.Generic, DeviceType.Notifier, DeviceType.Script, DeviceType.Automation, DeviceType.Lock, DeviceType.MediaPlayer, DeviceType.AlarmPanel, DeviceType.Control, DeviceType.Presence, DeviceType.Weather, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.Container, DeviceType.Image, DeviceType.PetFeeder, DeviceType.PetFountain, DeviceType.Dishwasher, DeviceType.Washer, DeviceType.Dryer, DeviceType.Gateway;
|
|
99492
100814
|
new Set(Object.values(DeviceType));
|
|
99493
100815
|
/** True when a value is a navigable node: a plain object OR a tRPC v11 client
|
|
99494
100816
|
* proxy node (a callable `Proxy(noop)` → `typeof === 'function'`, NOT an
|
|
@@ -101700,9 +103022,6 @@ function durationText(seconds) {
|
|
|
101700
103022
|
const text = `${Math.floor(m / 60)} h ${String(m % 60).padStart(2, "0")}`;
|
|
101701
103023
|
return t(text, text);
|
|
101702
103024
|
}
|
|
101703
|
-
function deviceTypeOf(type) {
|
|
101704
|
-
return Object.values(DeviceType).find((t) => t === type);
|
|
101705
|
-
}
|
|
101706
103025
|
var switchContribution = contribution("switch", SwitchStatusSchema, (slice) => {
|
|
101707
103026
|
const on = slice?.on ?? null;
|
|
101708
103027
|
return {
|
|
@@ -101883,8 +103202,7 @@ function remainingWords(amount, unit) {
|
|
|
101883
103202
|
return t(`${amount} ${word}`, `${amount} ${word}`);
|
|
101884
103203
|
}
|
|
101885
103204
|
var timedRunContribution = contribution("timed-run", TimedRunStatusSchema, (slice, ctx) => {
|
|
101886
|
-
const
|
|
101887
|
-
const limit = type === void 0 ? null : timedRunLimitOf(type);
|
|
103205
|
+
const limit = timedRunLimitOf(ctx.type, ctx.role);
|
|
101888
103206
|
if (limit === null) return {};
|
|
101889
103207
|
const quickRun = slice?.quickRun ?? timedRunQuickRun(limit, null);
|
|
101890
103208
|
const activeUntil = slice?.activeUntil != null && slice.activeUntil > ctx.now ? slice.activeUntil : null;
|
|
@@ -102323,7 +103641,6 @@ var HERO_LAYOUT_BY_TYPE = {
|
|
|
102323
103641
|
[DeviceType.Siren]: HERO_LAYOUT_DEFAULT,
|
|
102324
103642
|
[DeviceType.Switch]: SWITCH_LAYOUT,
|
|
102325
103643
|
[DeviceType.Sensor]: HERO_LAYOUT_DEFAULT,
|
|
102326
|
-
[DeviceType.Thermostat]: CLIMATE_LAYOUT,
|
|
102327
103644
|
[DeviceType.Climate]: CLIMATE_LAYOUT,
|
|
102328
103645
|
[DeviceType.Button]: BUTTON_LAYOUT,
|
|
102329
103646
|
[DeviceType.EventEmitter]: HERO_LAYOUT_DEFAULT,
|
|
@@ -102352,7 +103669,6 @@ var HERO_LAYOUT_BY_TYPE = {
|
|
|
102352
103669
|
[DeviceType.PetFountain]: FOUNTAIN_LAYOUT,
|
|
102353
103670
|
[DeviceType.Dishwasher]: DISHWASHER_LAYOUT,
|
|
102354
103671
|
[DeviceType.Washer]: APPLIANCE_LAYOUT,
|
|
102355
|
-
[DeviceType.Heater]: HEATER_LAYOUT,
|
|
102356
103672
|
[DeviceType.Dryer]: APPLIANCE_LAYOUT,
|
|
102357
103673
|
[DeviceType.Gateway]: HERO_LAYOUT_DEFAULT
|
|
102358
103674
|
};
|
|
@@ -102360,7 +103676,8 @@ function isDeviceType$1(type) {
|
|
|
102360
103676
|
return Object.values(DeviceType).includes(type);
|
|
102361
103677
|
}
|
|
102362
103678
|
/** The layout of a type; a type this build does not know gets the default. */
|
|
102363
|
-
function resolveHeroLayout(type) {
|
|
103679
|
+
function resolveHeroLayout(type, role = null) {
|
|
103680
|
+
if (type === DeviceType.Switch && role === DeviceRole.SwitchHeater) return HEATER_LAYOUT;
|
|
102364
103681
|
return isDeviceType$1(type) ? HERO_LAYOUT_BY_TYPE[type] : HERO_LAYOUT_DEFAULT;
|
|
102365
103682
|
}
|
|
102366
103683
|
/**
|
|
@@ -103039,7 +104356,7 @@ var HERO_MODE_LOOK = {
|
|
|
103039
104356
|
open: null,
|
|
103040
104357
|
closed: null
|
|
103041
104358
|
};
|
|
103042
|
-
var MODE_LOOK_TYPES = [DeviceType.Climate
|
|
104359
|
+
var MODE_LOOK_TYPES = [DeviceType.Climate];
|
|
103043
104360
|
var HERO_LOOK_BY_TYPE = {
|
|
103044
104361
|
[DeviceType.Camera]: CAMERA_LOOK,
|
|
103045
104362
|
[DeviceType.Hub]: HERO_LOOK_DEFAULT,
|
|
@@ -103047,8 +104364,7 @@ var HERO_LOOK_BY_TYPE = {
|
|
|
103047
104364
|
[DeviceType.Siren]: HERO_LOOK_DEFAULT,
|
|
103048
104365
|
[DeviceType.Switch]: SWITCH_LOOK,
|
|
103049
104366
|
[DeviceType.Sensor]: READING_SENSOR_LOOK,
|
|
103050
|
-
[DeviceType.
|
|
103051
|
-
[DeviceType.Climate]: CLIMATE_LOOK,
|
|
104367
|
+
[DeviceType.Climate]: THERMOSTAT_LOOK,
|
|
103052
104368
|
[DeviceType.Button]: BUTTON_LOOK,
|
|
103053
104369
|
[DeviceType.EventEmitter]: EVENT_EMITTER_LOOK,
|
|
103054
104370
|
[DeviceType.Update]: UPDATE_LOOK,
|
|
@@ -103076,7 +104392,6 @@ var HERO_LOOK_BY_TYPE = {
|
|
|
103076
104392
|
[DeviceType.PetFountain]: FOUNTAIN_LOOK,
|
|
103077
104393
|
[DeviceType.Dishwasher]: DISHWASHER_LOOK,
|
|
103078
104394
|
[DeviceType.Washer]: WASHER_LOOK,
|
|
103079
|
-
[DeviceType.Heater]: HEATER_LOOK,
|
|
103080
104395
|
[DeviceType.Dryer]: DRYER_LOOK,
|
|
103081
104396
|
[DeviceType.Gateway]: HERO_LOOK_DEFAULT
|
|
103082
104397
|
};
|
|
@@ -103101,6 +104416,14 @@ var HERO_LOOK_BY_ROLE = {
|
|
|
103101
104416
|
[DeviceRole.CoverWindow]: "inherit",
|
|
103102
104417
|
[DeviceRole.BinaryHelper]: "inherit",
|
|
103103
104418
|
[DeviceRole.Outlet]: "inherit",
|
|
104419
|
+
[DeviceRole.SwitchHeater]: HEATER_LOOK,
|
|
104420
|
+
[DeviceRole.SwitchFan]: FAN_LOOK,
|
|
104421
|
+
[DeviceRole.ClimateAc]: "inherit",
|
|
104422
|
+
[DeviceRole.ClimateThermostat]: "inherit",
|
|
104423
|
+
[DeviceRole.ClimateFloor]: "inherit",
|
|
104424
|
+
[DeviceRole.ClimateRadiator]: "inherit",
|
|
104425
|
+
[DeviceRole.ClimateHeater]: "inherit",
|
|
104426
|
+
[DeviceRole.ClimateHeatPumpCircuit]: "inherit",
|
|
103104
104427
|
[DeviceRole.MotionSensor]: MOTION_LOOK,
|
|
103105
104428
|
[DeviceRole.ContactSensor]: "inherit",
|
|
103106
104429
|
[DeviceRole.LeakSensor]: LEAK_LOOK,
|
|
@@ -103158,6 +104481,7 @@ function resolveHeroLook(role, type, state, mode = null) {
|
|
|
103158
104481
|
const byMode = HERO_MODE_LOOK[mode];
|
|
103159
104482
|
if (byMode !== null) return byMode;
|
|
103160
104483
|
}
|
|
104484
|
+
if (isAirConditioner(type, role)) return CLIMATE_LOOK[state];
|
|
103161
104485
|
return ((isDeviceType(type) ? HERO_LOOK_BY_TYPE[type] : void 0) ?? HERO_LOOK_DEFAULT)[state];
|
|
103162
104486
|
}
|
|
103163
104487
|
/** The media player's offer outranks a bound switch: the player's own state is the device's. */
|
|
@@ -103328,6 +104652,7 @@ function buildHeroModel(input) {
|
|
|
103328
104652
|
const ctx = {
|
|
103329
104653
|
deviceId: device.id,
|
|
103330
104654
|
type: device.type,
|
|
104655
|
+
role: device.role,
|
|
103331
104656
|
features: input.features,
|
|
103332
104657
|
now: input.now,
|
|
103333
104658
|
running: runningOf(input),
|
|
@@ -103356,7 +104681,7 @@ function buildHeroModel(input) {
|
|
|
103356
104681
|
}
|
|
103357
104682
|
};
|
|
103358
104683
|
const allRows = fragments.flatMap((f) => f.rows ?? []);
|
|
103359
|
-
const rows = resolveHeroLayout(device.type).rows.flatMap((id) => {
|
|
104684
|
+
const rows = resolveHeroLayout(device.type, device.role).rows.flatMap((id) => {
|
|
103360
104685
|
return allRows.filter((r) => r.id === id).map((r) => HERO_SCENE_ROW_IDS.has(r.id) ? {
|
|
103361
104686
|
...r,
|
|
103362
104687
|
placement: "scene"
|
|
@@ -106812,6 +108137,13 @@ var METHOD_ACCESS_MAP = Object.freeze({
|
|
|
106812
108137
|
access: "create",
|
|
106813
108138
|
role: "viewer"
|
|
106814
108139
|
},
|
|
108140
|
+
"fanControl.setOscillationAxis": {
|
|
108141
|
+
capName: "fan-control",
|
|
108142
|
+
capScope: "device",
|
|
108143
|
+
addonId: null,
|
|
108144
|
+
access: "create",
|
|
108145
|
+
role: "viewer"
|
|
108146
|
+
},
|
|
106815
108147
|
"fanControl.setPercentage": {
|
|
106816
108148
|
capName: "fan-control",
|
|
106817
108149
|
capScope: "device",
|
|
@@ -113833,7 +115165,7 @@ function projectAction(cap, action) {
|
|
|
113833
115165
|
};
|
|
113834
115166
|
}
|
|
113835
115167
|
Object.entries(CAP_VOCABULARY_BY_NAME).flatMap(([cap, entry]) => entry.scope === "device" ? (entry.actions ?? []).map((a) => projectAction(cap, a)) : []);
|
|
113836
|
-
DeviceType.Camera, DeviceType.Hub, DeviceType.Light, DeviceType.Siren, DeviceType.Switch, DeviceType.Sensor, DeviceType.
|
|
115168
|
+
DeviceType.Camera, DeviceType.Hub, DeviceType.Light, DeviceType.Siren, DeviceType.Switch, DeviceType.Sensor, DeviceType.Climate, DeviceType.Button, DeviceType.EventEmitter, DeviceType.Update, DeviceType.Generic, DeviceType.Notifier, DeviceType.Script, DeviceType.Automation, DeviceType.Lock, DeviceType.Cover, DeviceType.Valve, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.HeatPump, DeviceType.Fan, DeviceType.MediaPlayer, DeviceType.AlarmPanel, DeviceType.Control, DeviceType.Presence, DeviceType.Weather, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.Container, DeviceType.Image, DeviceType.PetFeeder, DeviceType.PetFountain, DeviceType.Dishwasher, DeviceType.Washer, DeviceType.Dryer, DeviceType.Gateway;
|
|
113837
115169
|
DeviceFeature.BatteryOperated;
|
|
113838
115170
|
function bound(cap, methods = [], authority = "reported") {
|
|
113839
115171
|
return {
|
|
@@ -115131,6 +116463,11 @@ Object.freeze({
|
|
|
115131
116463
|
form: "single",
|
|
115132
116464
|
optional: false
|
|
115133
116465
|
}],
|
|
116466
|
+
"fanControl.setOscillationAxis": [{
|
|
116467
|
+
name: "deviceId",
|
|
116468
|
+
form: "single",
|
|
116469
|
+
optional: false
|
|
116470
|
+
}],
|
|
115134
116471
|
"fanControl.setPercentage": [{
|
|
115135
116472
|
name: "deviceId",
|
|
115136
116473
|
form: "single",
|
|
@@ -119617,12 +120954,6 @@ Object.defineProperty(exports, "ConsumableItemSchema", {
|
|
|
119617
120954
|
return ConsumableItemSchema;
|
|
119618
120955
|
}
|
|
119619
120956
|
});
|
|
119620
|
-
Object.defineProperty(exports, "ControlStatusSchema", {
|
|
119621
|
-
enumerable: true,
|
|
119622
|
-
get: function() {
|
|
119623
|
-
return ControlStatusSchema;
|
|
119624
|
-
}
|
|
119625
|
-
});
|
|
119626
120957
|
Object.defineProperty(exports, "CoreBlockSchema", {
|
|
119627
120958
|
enumerable: true,
|
|
119628
120959
|
get: function() {
|
|
@@ -119875,6 +121206,18 @@ Object.defineProperty(exports, "FAN_CAPTURE_FIELDS", {
|
|
|
119875
121206
|
return FAN_CAPTURE_FIELDS;
|
|
119876
121207
|
}
|
|
119877
121208
|
});
|
|
121209
|
+
Object.defineProperty(exports, "FAN_OSCILLATION_AXES", {
|
|
121210
|
+
enumerable: true,
|
|
121211
|
+
get: function() {
|
|
121212
|
+
return FAN_OSCILLATION_AXES;
|
|
121213
|
+
}
|
|
121214
|
+
});
|
|
121215
|
+
Object.defineProperty(exports, "FAN_OSCILLATION_AXIS_SETTABLE", {
|
|
121216
|
+
enumerable: true,
|
|
121217
|
+
get: function() {
|
|
121218
|
+
return FAN_OSCILLATION_AXIS_SETTABLE;
|
|
121219
|
+
}
|
|
121220
|
+
});
|
|
119878
121221
|
Object.defineProperty(exports, "FIRST_LEVEL_MACRO_CLASSES", {
|
|
119879
121222
|
enumerable: true,
|
|
119880
121223
|
get: function() {
|
|
@@ -120343,6 +121686,12 @@ Object.defineProperty(exports, "ServerNameSchema", {
|
|
|
120343
121686
|
return ServerNameSchema;
|
|
120344
121687
|
}
|
|
120345
121688
|
});
|
|
121689
|
+
Object.defineProperty(exports, "SetOscillationAxisInputSchema", {
|
|
121690
|
+
enumerable: true,
|
|
121691
|
+
get: function() {
|
|
121692
|
+
return SetOscillationAxisInputSchema;
|
|
121693
|
+
}
|
|
121694
|
+
});
|
|
120346
121695
|
Object.defineProperty(exports, "SsoBridgeClaimsSchema", {
|
|
120347
121696
|
enumerable: true,
|
|
120348
121697
|
get: function() {
|
|
@@ -120379,12 +121728,6 @@ Object.defineProperty(exports, "StoredRecordKindDeclarationSchema", {
|
|
|
120379
121728
|
return StoredRecordKindDeclarationSchema;
|
|
120380
121729
|
}
|
|
120381
121730
|
});
|
|
120382
|
-
Object.defineProperty(exports, "SwitchStatusSchema", {
|
|
120383
|
-
enumerable: true,
|
|
120384
|
-
get: function() {
|
|
120385
|
-
return SwitchStatusSchema;
|
|
120386
|
-
}
|
|
120387
|
-
});
|
|
120388
121731
|
Object.defineProperty(exports, "TemplateKindSchema", {
|
|
120389
121732
|
enumerable: true,
|
|
120390
121733
|
get: function() {
|
|
@@ -120643,6 +121986,18 @@ Object.defineProperty(exports, "canonicalIconKey", {
|
|
|
120643
121986
|
return canonicalIconKey;
|
|
120644
121987
|
}
|
|
120645
121988
|
});
|
|
121989
|
+
Object.defineProperty(exports, "canonicalStoredDeviceType", {
|
|
121990
|
+
enumerable: true,
|
|
121991
|
+
get: function() {
|
|
121992
|
+
return canonicalStoredDeviceType;
|
|
121993
|
+
}
|
|
121994
|
+
});
|
|
121995
|
+
Object.defineProperty(exports, "capAppliesToDeviceKind", {
|
|
121996
|
+
enumerable: true,
|
|
121997
|
+
get: function() {
|
|
121998
|
+
return capAppliesToDeviceKind;
|
|
121999
|
+
}
|
|
122000
|
+
});
|
|
120646
122001
|
Object.defineProperty(exports, "capUnitResolver", {
|
|
120647
122002
|
enumerable: true,
|
|
120648
122003
|
get: function() {
|
|
@@ -120805,6 +122160,12 @@ Object.defineProperty(exports, "compositionSourceRefs", {
|
|
|
120805
122160
|
return compositionSourceRefs;
|
|
120806
122161
|
}
|
|
120807
122162
|
});
|
|
122163
|
+
Object.defineProperty(exports, "compositionUnionReads", {
|
|
122164
|
+
enumerable: true,
|
|
122165
|
+
get: function() {
|
|
122166
|
+
return compositionUnionReads;
|
|
122167
|
+
}
|
|
122168
|
+
});
|
|
120808
122169
|
Object.defineProperty(exports, "consumablesCapability", {
|
|
120809
122170
|
enumerable: true,
|
|
120810
122171
|
get: function() {
|
|
@@ -121117,6 +122478,12 @@ Object.defineProperty(exports, "extractNestedAddonId", {
|
|
|
121117
122478
|
return extractNestedAddonId;
|
|
121118
122479
|
}
|
|
121119
122480
|
});
|
|
122481
|
+
Object.defineProperty(exports, "fanAxisPath", {
|
|
122482
|
+
enumerable: true,
|
|
122483
|
+
get: function() {
|
|
122484
|
+
return fanAxisPath;
|
|
122485
|
+
}
|
|
122486
|
+
});
|
|
121120
122487
|
Object.defineProperty(exports, "fanControlCapability", {
|
|
121121
122488
|
enumerable: true,
|
|
121122
122489
|
get: function() {
|
|
@@ -121285,6 +122652,12 @@ Object.defineProperty(exports, "interpolate", {
|
|
|
121285
122652
|
return interpolate;
|
|
121286
122653
|
}
|
|
121287
122654
|
});
|
|
122655
|
+
Object.defineProperty(exports, "isAddonInstanceId", {
|
|
122656
|
+
enumerable: true,
|
|
122657
|
+
get: function() {
|
|
122658
|
+
return isAddonInstanceId;
|
|
122659
|
+
}
|
|
122660
|
+
});
|
|
121288
122661
|
Object.defineProperty(exports, "isAlertEpisodeOpen", {
|
|
121289
122662
|
enumerable: true,
|
|
121290
122663
|
get: function() {
|
|
@@ -121795,6 +123168,12 @@ Object.defineProperty(exports, "platformProbeCapability", {
|
|
|
121795
123168
|
return platformProbeCapability;
|
|
121796
123169
|
}
|
|
121797
123170
|
});
|
|
123171
|
+
Object.defineProperty(exports, "powerSourceActuatorConflicts", {
|
|
123172
|
+
enumerable: true,
|
|
123173
|
+
get: function() {
|
|
123174
|
+
return powerSourceActuatorConflicts;
|
|
123175
|
+
}
|
|
123176
|
+
});
|
|
121798
123177
|
Object.defineProperty(exports, "powerSourceCapability", {
|
|
121799
123178
|
enumerable: true,
|
|
121800
123179
|
get: function() {
|