@camstack/addon-export-alexa 1.2.193 → 1.2.195
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/export-alexa.addon.js +1054 -400
- package/dist/export-alexa.addon.mjs +1054 -400
- package/lambda-template/README.md +1 -0
- package/lambda-template/authorize-page.js +5 -0
- package/lambda-template/index.js +31 -8
- package/package.json +2 -2
|
@@ -808,7 +808,7 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
|
808
808
|
return EventCategory;
|
|
809
809
|
}({});
|
|
810
810
|
//#endregion
|
|
811
|
-
//#region ../types/dist/composed-stable-id-
|
|
811
|
+
//#region ../types/dist/composed-stable-id-CPp3votu.mjs
|
|
812
812
|
/**
|
|
813
813
|
import { errMsg } from '@camstack/types'
|
|
814
814
|
* Extract a human-readable message from an unknown error value.
|
|
@@ -821,17 +821,18 @@ function errMsg$1(err) {
|
|
|
821
821
|
}
|
|
822
822
|
var DeviceType = /* @__PURE__ */ function(DeviceType) {
|
|
823
823
|
DeviceType["Camera"] = "camera";
|
|
824
|
+
/** Legacy stored value, read only by the hub-to-integration migrations; no live device carries it. */
|
|
824
825
|
DeviceType["Hub"] = "hub";
|
|
825
826
|
DeviceType["Light"] = "light";
|
|
826
827
|
DeviceType["Siren"] = "siren";
|
|
827
828
|
DeviceType["Switch"] = "switch";
|
|
828
829
|
DeviceType["Sensor"] = "sensor";
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
* `climate-control`
|
|
832
|
-
*
|
|
833
|
-
*
|
|
834
|
-
*
|
|
830
|
+
/** Every climate device: an air conditioner, a room thermostat, a radiator
|
|
831
|
+
* valve, a floor-heating zone, a heat-pump circuit. They share one set of
|
|
832
|
+
* controls (`climate-control`), so they are one type; WHICH kind of climate
|
|
833
|
+
* device it is is its {@link DeviceRole} (`climate-*`), which the UI and the
|
|
834
|
+
* exports branch on. The retired `thermostat` type is read as this one
|
|
835
|
+
* (`canonicalStoredDeviceType`). */
|
|
835
836
|
DeviceType["Climate"] = "climate";
|
|
836
837
|
DeviceType["Button"] = "button";
|
|
837
838
|
/** Generic stateless event emitter — carries a device's EXACT declared
|
|
@@ -922,10 +923,6 @@ var DeviceType = /* @__PURE__ */ function(DeviceType) {
|
|
|
922
923
|
/** Washing machine. A plug-built one is running while its power stays
|
|
923
924
|
* above a threshold. No program cap — that surface is the dishwasher's. */
|
|
924
925
|
DeviceType["Washer"] = "washer";
|
|
925
|
-
/** A dumb plug-in stove or heater: a switch (and, with a meter, a power
|
|
926
|
-
* reading) that only runs while the plug is on. Built from a smart plug;
|
|
927
|
-
* the `timed-run` cap switches it off again after a chosen time. */
|
|
928
|
-
DeviceType["Heater"] = "heater";
|
|
929
926
|
/** Tumble dryer. Same plug-built running surface as {@link Washer}. */
|
|
930
927
|
DeviceType["Dryer"] = "dryer";
|
|
931
928
|
/** The physical bridge box of a vendor ecosystem (Velux KLF-200, and later
|
|
@@ -1145,6 +1142,27 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
|
|
|
1145
1142
|
/** A smart plug: a `switch` whose source says it is an outlet (HA
|
|
1146
1143
|
* `device_class: outlet`). The Alexa export shows it as a SMARTPLUG. */
|
|
1147
1144
|
DeviceRole["Outlet"] = "outlet";
|
|
1145
|
+
/** A dumb plug-in stove or heater behind a switch: it runs only while the
|
|
1146
|
+
* switch is on. Offered `timed-run`, which switches it off again after a
|
|
1147
|
+
* chosen time. */
|
|
1148
|
+
DeviceRole["SwitchHeater"] = "switch-heater";
|
|
1149
|
+
/** A plain fan behind a switch (a smart plug powering it): drawn as a fan,
|
|
1150
|
+
* with the switch's on/off only. Speed or oscillation appear only when the
|
|
1151
|
+
* device also has a fan cap (D1033). */
|
|
1152
|
+
DeviceRole["SwitchFan"] = "switch-fan";
|
|
1153
|
+
/** Air conditioner / split unit: cooling, fan speed, louvres. */
|
|
1154
|
+
DeviceRole["ClimateAc"] = "climate-ac";
|
|
1155
|
+
/** Room thermostat: a setpoint and a room temperature. The default. */
|
|
1156
|
+
DeviceRole["ClimateThermostat"] = "climate-thermostat";
|
|
1157
|
+
/** Floor-heating zone actuator. */
|
|
1158
|
+
DeviceRole["ClimateFloor"] = "climate-floor";
|
|
1159
|
+
/** Radiator valve (thermostatic radiator head). */
|
|
1160
|
+
DeviceRole["ClimateRadiator"] = "climate-radiator";
|
|
1161
|
+
/** A heater with its own thermostat (stove, convector). */
|
|
1162
|
+
DeviceRole["ClimateHeater"] = "climate-heater";
|
|
1163
|
+
/** One heating/cooling circuit of a heat pump: a water loop with comfort /
|
|
1164
|
+
* eco setpoints and a heat/cool mode, no room sensor. */
|
|
1165
|
+
DeviceRole["ClimateHeatPumpCircuit"] = "climate-heat-pump-circuit";
|
|
1148
1166
|
/** Generic motion / occupancy / moving event source. Distinct from
|
|
1149
1167
|
* the camera accessory PirSensor role: that one is a camera child;
|
|
1150
1168
|
* this is a standalone HA / 3rd-party motion sensor. */
|
|
@@ -6032,7 +6050,7 @@ var ZodIssueCode = {
|
|
|
6032
6050
|
var ZodFirstPartyTypeKind;
|
|
6033
6051
|
ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
|
|
6034
6052
|
//#endregion
|
|
6035
|
-
//#region ../types/dist/sleep-
|
|
6053
|
+
//#region ../types/dist/sleep-D0roI_CZ.mjs
|
|
6036
6054
|
/**
|
|
6037
6055
|
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
6038
6056
|
* window to float samples (D455).
|
|
@@ -11721,6 +11739,50 @@ var ACTUATOR_CAP_VOCABULARY = {
|
|
|
11721
11739
|
value: false
|
|
11722
11740
|
},
|
|
11723
11741
|
args: { oscillating: false }
|
|
11742
|
+
},
|
|
11743
|
+
{
|
|
11744
|
+
id: "fan.horizontalOscillateOn",
|
|
11745
|
+
method: "setOscillationAxis",
|
|
11746
|
+
label: t("Horizontal oscillation on", "Oscillazione orizzontale attiva"),
|
|
11747
|
+
phrase: t("Start the horizontal oscillation of {device}", "Attiva l’oscillazione orizzontale di {device}"),
|
|
11748
|
+
icon: "move-horizontal",
|
|
11749
|
+
args: {
|
|
11750
|
+
axis: "horizontal",
|
|
11751
|
+
oscillating: true
|
|
11752
|
+
}
|
|
11753
|
+
},
|
|
11754
|
+
{
|
|
11755
|
+
id: "fan.horizontalOscillateOff",
|
|
11756
|
+
method: "setOscillationAxis",
|
|
11757
|
+
label: t("Horizontal oscillation off", "Oscillazione orizzontale spenta"),
|
|
11758
|
+
phrase: t("Stop the horizontal oscillation of {device}", "Ferma l’oscillazione orizzontale di {device}"),
|
|
11759
|
+
icon: "move-horizontal",
|
|
11760
|
+
args: {
|
|
11761
|
+
axis: "horizontal",
|
|
11762
|
+
oscillating: false
|
|
11763
|
+
}
|
|
11764
|
+
},
|
|
11765
|
+
{
|
|
11766
|
+
id: "fan.verticalOscillateOn",
|
|
11767
|
+
method: "setOscillationAxis",
|
|
11768
|
+
label: t("Vertical oscillation on", "Oscillazione verticale attiva"),
|
|
11769
|
+
phrase: t("Start the vertical oscillation of {device}", "Attiva l’oscillazione verticale di {device}"),
|
|
11770
|
+
icon: "move-vertical",
|
|
11771
|
+
args: {
|
|
11772
|
+
axis: "vertical",
|
|
11773
|
+
oscillating: true
|
|
11774
|
+
}
|
|
11775
|
+
},
|
|
11776
|
+
{
|
|
11777
|
+
id: "fan.verticalOscillateOff",
|
|
11778
|
+
method: "setOscillationAxis",
|
|
11779
|
+
label: t("Vertical oscillation off", "Oscillazione verticale spenta"),
|
|
11780
|
+
phrase: t("Stop the vertical oscillation of {device}", "Ferma l’oscillazione verticale di {device}"),
|
|
11781
|
+
icon: "move-vertical",
|
|
11782
|
+
args: {
|
|
11783
|
+
axis: "vertical",
|
|
11784
|
+
oscillating: false
|
|
11785
|
+
}
|
|
11724
11786
|
}
|
|
11725
11787
|
],
|
|
11726
11788
|
state: [{
|
|
@@ -13810,10 +13872,6 @@ var CAMERA_CAP_VOCABULARY = {
|
|
|
13810
13872
|
scope: "device",
|
|
13811
13873
|
noun: t("Admin link", "Link di amministrazione")
|
|
13812
13874
|
},
|
|
13813
|
-
"device-discovery": {
|
|
13814
|
-
scope: "device",
|
|
13815
|
-
noun: t("Discovery", "Rilevamento dispositivi")
|
|
13816
|
-
},
|
|
13817
13875
|
"device-extension": {
|
|
13818
13876
|
scope: "device",
|
|
13819
13877
|
noun: t("Device extension", "Estensione del dispositivo")
|
|
@@ -15293,7 +15351,6 @@ var CAP_NAMES = Object.freeze([
|
|
|
15293
15351
|
"device-admin-link",
|
|
15294
15352
|
"device-adoption",
|
|
15295
15353
|
"device-credentials",
|
|
15296
|
-
"device-discovery",
|
|
15297
15354
|
"device-export",
|
|
15298
15355
|
"device-extension",
|
|
15299
15356
|
"device-history",
|
|
@@ -15915,13 +15972,6 @@ Object.freeze({
|
|
|
15915
15972
|
"valueType": "string"
|
|
15916
15973
|
}
|
|
15917
15974
|
],
|
|
15918
|
-
"device-discovery": [{
|
|
15919
|
-
"path": "lastDiscoveryAt",
|
|
15920
|
-
"valueType": "number"
|
|
15921
|
-
}, {
|
|
15922
|
-
"path": "lastError",
|
|
15923
|
-
"valueType": "string"
|
|
15924
|
-
}],
|
|
15925
15975
|
"device-export": [
|
|
15926
15976
|
{
|
|
15927
15977
|
"path": "linkState",
|
|
@@ -16110,6 +16160,10 @@ Object.freeze({
|
|
|
16110
16160
|
"path": "lastEvent.eventType",
|
|
16111
16161
|
"valueType": "string"
|
|
16112
16162
|
},
|
|
16163
|
+
{
|
|
16164
|
+
"path": "lastEvent.sourceId",
|
|
16165
|
+
"valueType": "string"
|
|
16166
|
+
},
|
|
16113
16167
|
{
|
|
16114
16168
|
"path": "lastEvent.timestamp",
|
|
16115
16169
|
"valueType": "number"
|
|
@@ -17373,7 +17427,7 @@ Object.freeze({
|
|
|
17373
17427
|
}
|
|
17374
17428
|
});
|
|
17375
17429
|
//#endregion
|
|
17376
|
-
//#region ../types/dist/implemented-methods-
|
|
17430
|
+
//#region ../types/dist/implemented-methods-5YMDeE3f.mjs
|
|
17377
17431
|
/**
|
|
17378
17432
|
* The ffmpeg build every CamStack node downloads, per platform and arch.
|
|
17379
17433
|
*
|
|
@@ -19130,6 +19184,7 @@ function buildAddonRouteProvider(id, routes) {
|
|
|
19130
19184
|
query: input.query,
|
|
19131
19185
|
body: input.body,
|
|
19132
19186
|
headers: input.headers,
|
|
19187
|
+
...match.route.perInstance === true && input.instanceId !== void 0 ? { instanceId: input.instanceId } : {},
|
|
19133
19188
|
...input.user ? { user: input.user } : {},
|
|
19134
19189
|
...input.scopedToken !== void 0 ? { scopedToken: input.scopedToken } : {}
|
|
19135
19190
|
};
|
|
@@ -19197,6 +19252,18 @@ function buildCapturingReply(envelope) {
|
|
|
19197
19252
|
};
|
|
19198
19253
|
return wrapper;
|
|
19199
19254
|
}
|
|
19255
|
+
/** The instance a link was made for, with the default one spelled as the addon id. */
|
|
19256
|
+
function oauthLinkInstanceId(link, addonId) {
|
|
19257
|
+
return link.instanceId ?? addonId;
|
|
19258
|
+
}
|
|
19259
|
+
/**
|
|
19260
|
+
* True when a verified link may be used on a request addressed to
|
|
19261
|
+
* `requestInstanceId` (`AddonHttpRequest.instanceId`, absent on a route that
|
|
19262
|
+
* is not per-instance, which is the default instance).
|
|
19263
|
+
*/
|
|
19264
|
+
function oauthLinkServesInstance(link, requestInstanceId, addonId) {
|
|
19265
|
+
return oauthLinkInstanceId(link, addonId) === (requestInstanceId ?? addonId);
|
|
19266
|
+
}
|
|
19200
19267
|
/**
|
|
19201
19268
|
* notification-output — canonical, capability-gated notification delivery.
|
|
19202
19269
|
*
|
|
@@ -43985,6 +44052,41 @@ function macroOnly(macro) {
|
|
|
43985
44052
|
};
|
|
43986
44053
|
}
|
|
43987
44054
|
}
|
|
44055
|
+
var EventVocabularyKindSchema = _enum([
|
|
44056
|
+
"press",
|
|
44057
|
+
"long-press",
|
|
44058
|
+
"long-press-start",
|
|
44059
|
+
"release",
|
|
44060
|
+
"repeat",
|
|
44061
|
+
"double-press",
|
|
44062
|
+
"other"
|
|
44063
|
+
]);
|
|
44064
|
+
/** The part of the device an event comes from: a button, a channel. */
|
|
44065
|
+
var EventVocabularySourceSchema = object({
|
|
44066
|
+
id: string().min(1),
|
|
44067
|
+
label: string().min(1)
|
|
44068
|
+
});
|
|
44069
|
+
/** One scalar field of an event's `data`, by dotted path. */
|
|
44070
|
+
var EventVocabularyFieldSchema = object({
|
|
44071
|
+
path: string().min(1),
|
|
44072
|
+
kind: _enum([
|
|
44073
|
+
"string",
|
|
44074
|
+
"number",
|
|
44075
|
+
"boolean",
|
|
44076
|
+
"enum"
|
|
44077
|
+
]),
|
|
44078
|
+
enumValues: array(string()).optional(),
|
|
44079
|
+
label: string().min(1).optional()
|
|
44080
|
+
});
|
|
44081
|
+
var EventVocabularyEntrySchema = object({
|
|
44082
|
+
/** The native token, verbatim. */
|
|
44083
|
+
id: string().min(1),
|
|
44084
|
+
source: EventVocabularySourceSchema.optional(),
|
|
44085
|
+
label: string().min(1),
|
|
44086
|
+
description: string().optional(),
|
|
44087
|
+
kind: EventVocabularyKindSchema.optional(),
|
|
44088
|
+
payload: array(EventVocabularyFieldSchema).optional()
|
|
44089
|
+
});
|
|
43988
44090
|
Math.PI / 180;
|
|
43989
44091
|
/**
|
|
43990
44092
|
* WHEN something happens, as data (D983) — the one time vocabulary of the
|
|
@@ -44106,6 +44208,13 @@ var AutomationConditionOperatorSchema = _enum([
|
|
|
44106
44208
|
"in"
|
|
44107
44209
|
]);
|
|
44108
44210
|
/**
|
|
44211
|
+
* The stable name of an event leaf. A path (`when.0.1`) moves when a row is
|
|
44212
|
+
* reordered; the id does not, so a `triggered-by` leaf keeps pointing at the
|
|
44213
|
+
* same row. Optional: a leaf nothing refers to needs none.
|
|
44214
|
+
*/
|
|
44215
|
+
var EVENT_LEAF_ID_RE = /^[A-Za-z0-9_-]{1,40}$/;
|
|
44216
|
+
var eventLeafId = { id: string().regex(EVENT_LEAF_ID_RE).optional() };
|
|
44217
|
+
/**
|
|
44109
44218
|
* D8 compliance, and it is the reason a "becomes" leaf is not merely an event
|
|
44110
44219
|
* subscription: it evaluates against the **state mirror**, which is reconciled,
|
|
44111
44220
|
* and an event only WAKES the evaluation. A dropped event therefore DELAYS a
|
|
@@ -44113,6 +44222,7 @@ var AutomationConditionOperatorSchema = _enum([
|
|
|
44113
44222
|
*/
|
|
44114
44223
|
var DeviceBecomesLeafSchema = object({
|
|
44115
44224
|
kind: literal("device-becomes"),
|
|
44225
|
+
...eventLeafId,
|
|
44116
44226
|
deviceId: number$1().int().nonnegative(),
|
|
44117
44227
|
cap: string().min(1),
|
|
44118
44228
|
fieldPath: string().min(1),
|
|
@@ -44165,6 +44275,7 @@ var DeviceBecomesLeafSchema = object({
|
|
|
44165
44275
|
});
|
|
44166
44276
|
var DeviceEventLeafSchema = object({
|
|
44167
44277
|
kind: literal("device-event"),
|
|
44278
|
+
...eventLeafId,
|
|
44168
44279
|
/** An `EventCategory` value. */
|
|
44169
44280
|
category: string().min(1),
|
|
44170
44281
|
deviceId: number$1().int().nonnegative().optional()
|
|
@@ -44177,18 +44288,51 @@ var DeviceEventLeafSchema = object({
|
|
|
44177
44288
|
*/
|
|
44178
44289
|
var ScheduleLeafSchema = object({
|
|
44179
44290
|
kind: literal("schedule"),
|
|
44291
|
+
...eventLeafId,
|
|
44180
44292
|
at: TimeSpecSchema.optional(),
|
|
44181
44293
|
days: array(WeekdayKeySchema).min(1).max(7).optional(),
|
|
44182
44294
|
/** @deprecated legacy cron — new schedules use `at`. */
|
|
44183
44295
|
cron: string().min(1).max(120).optional()
|
|
44184
44296
|
}).refine((leaf) => leaf.at === void 0 !== (leaf.cron === void 0), { message: "a schedule names exactly one of `at` (a time spec) and `cron` (legacy)" }).refine((leaf) => leaf.days === void 0 || leaf.at !== void 0, { message: "`days` goes with `at`; a cron expression carries its own days" });
|
|
44185
|
-
|
|
44297
|
+
/**
|
|
44298
|
+
* One payload predicate of a `device-fired` row: the value at `path` inside
|
|
44299
|
+
* the fire's `data` (dotted) equals `equals`. Compared strictly, no coercion.
|
|
44300
|
+
*/
|
|
44301
|
+
var DeviceFiredMatchSchema = object({
|
|
44302
|
+
path: string().min(1).max(120),
|
|
44303
|
+
equals: union([
|
|
44304
|
+
string(),
|
|
44305
|
+
number$1(),
|
|
44306
|
+
boolean()
|
|
44307
|
+
])
|
|
44308
|
+
});
|
|
44309
|
+
/**
|
|
44310
|
+
* "fires": one device of the `event-emitter` capability reported an event
|
|
44311
|
+
* (D1045). Every list is an OR, the lists together an AND; an absent list does
|
|
44312
|
+
* not narrow. `eventIds` are the device's own tokens, `sourceIds` the parts of
|
|
44313
|
+
* the device (a button), `kinds` the shared press kinds of its vocabulary.
|
|
44314
|
+
*/
|
|
44315
|
+
var DeviceFiredLeafSchema = object({
|
|
44316
|
+
kind: literal("device-fired"),
|
|
44317
|
+
...eventLeafId,
|
|
44318
|
+
deviceId: number$1().int().nonnegative(),
|
|
44319
|
+
eventIds: array(string().min(1)).min(1).max(64).optional(),
|
|
44320
|
+
sourceIds: array(string().min(1)).min(1).max(64).optional(),
|
|
44321
|
+
kinds: array(EventVocabularyKindSchema).min(1).optional(),
|
|
44322
|
+
match: array(DeviceFiredMatchSchema).min(1).max(8).optional()
|
|
44323
|
+
});
|
|
44324
|
+
var ManualLeafSchema = object({
|
|
44325
|
+
kind: literal("manual"),
|
|
44326
|
+
...eventLeafId
|
|
44327
|
+
});
|
|
44186
44328
|
var IntervalLeafSchema = object({
|
|
44187
44329
|
kind: literal("interval"),
|
|
44330
|
+
...eventLeafId,
|
|
44188
44331
|
minutes: number$1().int().min(1).max(1440)
|
|
44189
44332
|
});
|
|
44190
44333
|
var DetectionLeafSchema = object({
|
|
44191
44334
|
kind: literal("detection"),
|
|
44335
|
+
...eventLeafId,
|
|
44192
44336
|
/** One macro class each, optionally narrowed by a label; a track of any listed subject fires. */
|
|
44193
44337
|
subjects: array(DetectionSubjectSchema).min(1),
|
|
44194
44338
|
deviceIds: array(number$1().int().nonnegative()).min(1),
|
|
@@ -44199,6 +44343,7 @@ var DetectionLeafSchema = object({
|
|
|
44199
44343
|
});
|
|
44200
44344
|
var StationaryLeafSchema = object({
|
|
44201
44345
|
kind: literal("stationary"),
|
|
44346
|
+
...eventLeafId,
|
|
44202
44347
|
deviceIds: array(number$1().int().nonnegative()).min(1),
|
|
44203
44348
|
subjects: array(StationarySubjectSchema).min(1).optional(),
|
|
44204
44349
|
zones: array(string().min(1)).min(1).optional(),
|
|
@@ -44244,6 +44389,41 @@ var StationaryPresentLeafSchema = object({
|
|
|
44244
44389
|
minCount: number$1().int().positive().optional()
|
|
44245
44390
|
});
|
|
44246
44391
|
/**
|
|
44392
|
+
* True while the site-local clock is inside a daily window and/or on one of
|
|
44393
|
+
* the named days. `days` names the local day a window STARTS on, so
|
|
44394
|
+
* 22:00-06:00 on weekdays is still inside at 01:00 Saturday. A one-date spec
|
|
44395
|
+
* (`kind: 'date'`) is refused: only a clock time or a sun event makes a window
|
|
44396
|
+
* that repeats every day.
|
|
44397
|
+
*/
|
|
44398
|
+
var TimeIsLeafSchema = object({
|
|
44399
|
+
kind: literal("time-is"),
|
|
44400
|
+
between: object({
|
|
44401
|
+
from: TimeSpecSchema,
|
|
44402
|
+
to: TimeSpecSchema
|
|
44403
|
+
}).optional(),
|
|
44404
|
+
days: array(WeekdayKeySchema).min(1).max(7).optional()
|
|
44405
|
+
}).superRefine((leaf, ctx) => {
|
|
44406
|
+
if (leaf.between === void 0 && leaf.days === void 0) ctx.addIssue({
|
|
44407
|
+
code: "custom",
|
|
44408
|
+
message: "a time-is leaf needs a between window, days, or both"
|
|
44409
|
+
});
|
|
44410
|
+
for (const end of ["from", "to"]) if (leaf.between?.[end].kind === "date") ctx.addIssue({
|
|
44411
|
+
code: "custom",
|
|
44412
|
+
message: "a one-date time cannot bound a daily window: use a clock time or a sun event",
|
|
44413
|
+
path: ["between", end]
|
|
44414
|
+
});
|
|
44415
|
+
});
|
|
44416
|
+
/**
|
|
44417
|
+
* True for the run that one of the named event leaves started. It reads the
|
|
44418
|
+
* run, not a device: in the tree it is judged against the leaf that fired, in
|
|
44419
|
+
* a step guard against the trigger the run carries. A run no event leaf
|
|
44420
|
+
* started (a state-only tree becoming true) is false.
|
|
44421
|
+
*/
|
|
44422
|
+
var TriggeredByLeafSchema = object({
|
|
44423
|
+
kind: literal("triggered-by"),
|
|
44424
|
+
leafIds: array(string().regex(EVENT_LEAF_ID_RE)).min(1).max(20)
|
|
44425
|
+
});
|
|
44426
|
+
/**
|
|
44247
44427
|
* The escape hatch: the bounded expression engine over named device bindings.
|
|
44248
44428
|
* Declared as a plain object so a discriminated union can read `kind`; the
|
|
44249
44429
|
* author-time validation is the SAME function `ExpressionSourceSchema` runs.
|
|
@@ -44282,6 +44462,7 @@ var AutomationWhenSchema = lazy(() => discriminatedUnion("kind", [
|
|
|
44282
44462
|
}),
|
|
44283
44463
|
DeviceBecomesLeafSchema,
|
|
44284
44464
|
DeviceEventLeafSchema,
|
|
44465
|
+
DeviceFiredLeafSchema,
|
|
44285
44466
|
ScheduleLeafSchema,
|
|
44286
44467
|
ManualLeafSchema,
|
|
44287
44468
|
IntervalLeafSchema,
|
|
@@ -44289,11 +44470,14 @@ var AutomationWhenSchema = lazy(() => discriminatedUnion("kind", [
|
|
|
44289
44470
|
StationaryLeafSchema,
|
|
44290
44471
|
DeviceIsLeafSchema,
|
|
44291
44472
|
StationaryPresentLeafSchema,
|
|
44292
|
-
ExpressionLeafSchema
|
|
44473
|
+
ExpressionLeafSchema,
|
|
44474
|
+
TimeIsLeafSchema,
|
|
44475
|
+
TriggeredByLeafSchema
|
|
44293
44476
|
]));
|
|
44294
44477
|
var EVENT_KINDS = new Set([
|
|
44295
44478
|
"device-becomes",
|
|
44296
44479
|
"device-event",
|
|
44480
|
+
"device-fired",
|
|
44297
44481
|
"schedule",
|
|
44298
44482
|
"manual",
|
|
44299
44483
|
"interval",
|
|
@@ -44343,6 +44527,28 @@ function hasEventLeaves(node) {
|
|
|
44343
44527
|
});
|
|
44344
44528
|
return found;
|
|
44345
44529
|
}
|
|
44530
|
+
/** The event leaves of the tree that carry an id, in tree order. */
|
|
44531
|
+
function identifiedEventLeaves(when) {
|
|
44532
|
+
const found = [];
|
|
44533
|
+
forEachLeaf(when, (leaf, path) => {
|
|
44534
|
+
if (isEventLeaf(leaf) && leaf.id !== void 0) found.push({
|
|
44535
|
+
id: leaf.id,
|
|
44536
|
+
path,
|
|
44537
|
+
leaf
|
|
44538
|
+
});
|
|
44539
|
+
});
|
|
44540
|
+
return found;
|
|
44541
|
+
}
|
|
44542
|
+
/** Does the tree hold a `triggered-by` leaf? */
|
|
44543
|
+
function hasTriggeredByLeaves(when) {
|
|
44544
|
+
let found = false;
|
|
44545
|
+
forEachLeaf(when, (leaf) => {
|
|
44546
|
+
if (leaf.kind === "triggered-by") found = true;
|
|
44547
|
+
});
|
|
44548
|
+
return found;
|
|
44549
|
+
}
|
|
44550
|
+
/** Why a `triggered-by` leaf is refused outside an automation: there is no trigger row to name. */
|
|
44551
|
+
var TRIGGERED_BY_NEEDS_AUTOMATION = "\"triggered by\" reads which trigger started an automation — an action or a scheduler has no trigger rows, so it could never be true here";
|
|
44346
44552
|
function hasEmptyContainer(node) {
|
|
44347
44553
|
if (isLeaf(node)) return false;
|
|
44348
44554
|
if (node.kind === "not") return hasEmptyContainer(node.child);
|
|
@@ -44352,6 +44558,7 @@ function hasEmptyContainer(node) {
|
|
|
44352
44558
|
var LEAF_WORDS = {
|
|
44353
44559
|
"device-becomes": "a device value that becomes",
|
|
44354
44560
|
"device-event": "a device event",
|
|
44561
|
+
"device-fired": "a device firing an event",
|
|
44355
44562
|
schedule: "a schedule",
|
|
44356
44563
|
manual: "a manual run",
|
|
44357
44564
|
interval: "an interval",
|
|
@@ -44401,6 +44608,11 @@ function validateWhenTree(when) {
|
|
|
44401
44608
|
if (depth > 4) return `the rules nest ${depth} levels deep — the limit is 4. "not (any of …)" is the same as "all of (not …)", which is one level shallower`;
|
|
44402
44609
|
const leaves = countWhenLeaves(when);
|
|
44403
44610
|
if (leaves > 32) return `the rules use ${leaves} rows — the limit is 32`;
|
|
44611
|
+
const seen = /* @__PURE__ */ new Set();
|
|
44612
|
+
for (const entry of identifiedEventLeaves(when)) {
|
|
44613
|
+
if (seen.has(entry.id)) return `two trigger rows share the id "${entry.id}" — an id names one row`;
|
|
44614
|
+
seen.add(entry.id);
|
|
44615
|
+
}
|
|
44404
44616
|
const need = eventNeed(when, "when", false);
|
|
44405
44617
|
if ("error" in need) return need.error;
|
|
44406
44618
|
const [first, second] = need.paths;
|
|
@@ -44612,9 +44824,12 @@ function convertLegacyWhen(half) {
|
|
|
44612
44824
|
* every caller — automations, Actions, and the notification centre, which runs
|
|
44613
44825
|
* only Actions (planning#473).
|
|
44614
44826
|
*/
|
|
44827
|
+
/** The longest one `wait` step lasts. It is cut by a restart of the run and does not survive a hub restart. */
|
|
44828
|
+
var WAIT_MAX_SECONDS = 3600;
|
|
44829
|
+
var WAIT_TOO_LONG = `a wait is at most one hour (${WAIT_MAX_SECONDS} s)`;
|
|
44615
44830
|
var AutomationWaitStepSchema = object({
|
|
44616
44831
|
kind: literal("wait"),
|
|
44617
|
-
seconds: number$1().min(0).max(
|
|
44832
|
+
seconds: number$1().min(0).max(WAIT_MAX_SECONDS, WAIT_TOO_LONG)
|
|
44618
44833
|
});
|
|
44619
44834
|
/** The legacy `deviceId` of a cap step: still READ, never written (D983). */
|
|
44620
44835
|
var LegacyStepDeviceSchema = union([
|
|
@@ -44684,28 +44899,227 @@ var elseNeedsIf = {
|
|
|
44684
44899
|
path: ["else"]
|
|
44685
44900
|
};
|
|
44686
44901
|
var GuardedWaitStepSchema = AutomationWaitStepSchema.extend(stepGuardShape).refine((step) => step.else === void 0 || step.if !== void 0, elseNeedsIf);
|
|
44687
|
-
|
|
44902
|
+
/**
|
|
44903
|
+
* A step of a STANDALONE list (an action, a scheduler point, a preset): the
|
|
44904
|
+
* same two step kinds an automation runs, minus a guard that reads the
|
|
44905
|
+
* automation's trigger, which such a list does not have.
|
|
44906
|
+
*/
|
|
44907
|
+
var ActionStepSchema = discriminatedUnion("kind", [GuardedWaitStepSchema, AutomationCapStepBaseSchema.extend(stepGuardShape).refine((step) => step.target !== void 0 || step.deviceId !== void 0, {
|
|
44908
|
+
message: "a cap step needs a target",
|
|
44909
|
+
path: ["target"]
|
|
44910
|
+
}).refine((step) => step.target?.kind !== "domain" || step.actionId !== void 0, {
|
|
44911
|
+
message: "a domain target needs the vocabulary action it applies to (actionId)",
|
|
44912
|
+
path: ["actionId"]
|
|
44913
|
+
}).refine((step) => step.else === void 0 || step.if !== void 0, elseNeedsIf)]).superRefine((step, ctx) => {
|
|
44914
|
+
if (step.if !== void 0 && hasTriggeredByLeaves(step.if)) ctx.addIssue({
|
|
44915
|
+
code: "custom",
|
|
44916
|
+
message: TRIGGERED_BY_NEEDS_AUTOMATION,
|
|
44917
|
+
path: ["if"]
|
|
44918
|
+
});
|
|
44919
|
+
});
|
|
44920
|
+
/**
|
|
44921
|
+
* Flow control of an AUTOMATION's list (#500). A standalone list (an action, a
|
|
44922
|
+
* scheduler point, a preset) stays `wait` and `cap`: it has no run of its own
|
|
44923
|
+
* to end and no variable bag to write.
|
|
44924
|
+
*/
|
|
44925
|
+
var continueOnErrorShape = {
|
|
44926
|
+
/** A failure of this step is traced `failed-continued` and the next step runs. */
|
|
44927
|
+
continueOnError: literal(true).optional() };
|
|
44928
|
+
/** An automation's cap step: the shared guarded cap step, plus `continueOnError`. */
|
|
44929
|
+
var AutomationGuardedCapStepSchema = AutomationCapStepBaseSchema.extend({
|
|
44930
|
+
...stepGuardShape,
|
|
44931
|
+
...continueOnErrorShape
|
|
44932
|
+
}).refine((step) => step.target !== void 0 || step.deviceId !== void 0, {
|
|
44688
44933
|
message: "a cap step needs a target",
|
|
44689
44934
|
path: ["target"]
|
|
44690
44935
|
}).refine((step) => step.target?.kind !== "domain" || step.actionId !== void 0, {
|
|
44691
44936
|
message: "a domain target needs the vocabulary action it applies to (actionId)",
|
|
44692
44937
|
path: ["actionId"]
|
|
44693
44938
|
}).refine((step) => step.else === void 0 || step.if !== void 0, elseNeedsIf);
|
|
44694
|
-
|
|
44939
|
+
/** End the run here, on purpose. `reason` may carry `{{vars.x}}` slots. */
|
|
44940
|
+
var AutomationStopStepSchema = object({
|
|
44941
|
+
kind: literal("stop"),
|
|
44942
|
+
reason: string().min(1, "a stop needs a reason: it is what the run trace shows").max(200),
|
|
44943
|
+
/** `ok`: the run ends as a success. `failed`: it ends as a failure, with the reason. */
|
|
44944
|
+
outcome: _enum(["ok", "failed"]),
|
|
44945
|
+
/** Stop only when this reads true; false or unknown does not stop. */
|
|
44946
|
+
if: AutomationWhenSchema.optional()
|
|
44947
|
+
});
|
|
44948
|
+
var SET_VAR_NAME_RE = /^[A-Za-z_][A-Za-z0-9_]{0,39}$/;
|
|
44949
|
+
/** Names the run itself writes and reads (`leaf` is what `triggered-by` judges): a step may not overwrite them. */
|
|
44950
|
+
var RESERVED_RUN_VARS = [
|
|
44951
|
+
"kind",
|
|
44952
|
+
"leaf",
|
|
44953
|
+
"at"
|
|
44954
|
+
];
|
|
44955
|
+
/**
|
|
44956
|
+
* Write variables into the run's bag, for the steps after it. SUBSTITUTION
|
|
44957
|
+
* only, never evaluation: a text value may carry `{{vars.x}}` slots.
|
|
44958
|
+
*/
|
|
44959
|
+
var AutomationSetStepSchema = object({
|
|
44960
|
+
kind: literal("set"),
|
|
44961
|
+
vars: record(string(), union([
|
|
44962
|
+
string().max(500),
|
|
44963
|
+
number$1(),
|
|
44964
|
+
boolean()
|
|
44965
|
+
])).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` }),
|
|
44966
|
+
/** Set only when this reads true; false or unknown leaves the bag as it is. */
|
|
44967
|
+
if: AutomationWhenSchema.optional()
|
|
44968
|
+
});
|
|
44969
|
+
var AutomationRunActionStepSchema = object({
|
|
44970
|
+
kind: literal("action"),
|
|
44971
|
+
/** An entry of the `actions` surface (`internal:<uuid>` or `<addonId>:<localId>`). */
|
|
44972
|
+
actionId: string().min(1),
|
|
44973
|
+
/** Values for the action's declared variables; the others take their default. */
|
|
44974
|
+
variables: record(string(), union([
|
|
44975
|
+
string(),
|
|
44976
|
+
number$1(),
|
|
44977
|
+
boolean()
|
|
44978
|
+
])).optional(),
|
|
44979
|
+
...continueOnErrorShape
|
|
44980
|
+
});
|
|
44981
|
+
/**
|
|
44982
|
+
* A step INSIDE a branch of a `choose`: a flow step with no condition of its
|
|
44983
|
+
* own (the branch is the condition) and no block inside it. Strict, so an `if`
|
|
44984
|
+
* written on such a step is refused rather than dropped.
|
|
44985
|
+
*/
|
|
44986
|
+
/** The longest a `wait-until` may wait: six hours. */
|
|
44987
|
+
var WAIT_UNTIL_TIMEOUT_MAX_S = 21600;
|
|
44988
|
+
/**
|
|
44989
|
+
* Pause the run until a condition is true (#500). The timeout is mandatory: a
|
|
44990
|
+
* run never waits without an end. `onTimeout` says what a wait that ran out
|
|
44991
|
+
* does: `continue` goes on to the next step, `stop` ends the run as a failure.
|
|
44992
|
+
* A condition that cannot be read is not "true": the wait goes on (D49).
|
|
44993
|
+
*/
|
|
44994
|
+
var AutomationWaitUntilStepSchema = object({
|
|
44995
|
+
kind: literal("wait-until"),
|
|
44996
|
+
when: AutomationWhenSchema,
|
|
44997
|
+
timeoutS: number$1().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)`),
|
|
44998
|
+
onTimeout: _enum(["continue", "stop"])
|
|
44999
|
+
}).strict();
|
|
45000
|
+
/** The step kinds that hold steps of their own, or pause on a condition: they nest two levels at most. */
|
|
45001
|
+
var BLOCK_STEP_KINDS = [
|
|
45002
|
+
"choose",
|
|
45003
|
+
"repeat",
|
|
45004
|
+
"parallel",
|
|
45005
|
+
"wait-until"
|
|
45006
|
+
];
|
|
45007
|
+
var NEST_TOO_DEEP = `steps nest two levels at most: a step inside a nested choose or repeat can be a plain step only`;
|
|
45008
|
+
function kindOf(input) {
|
|
45009
|
+
return typeof input === "object" && input !== null ? Reflect.get(input, "kind") : void 0;
|
|
45010
|
+
}
|
|
45011
|
+
/** Where the nesting ends, a block step is refused in words rather than as an unknown kind. */
|
|
45012
|
+
function nestTooDeep(issue) {
|
|
45013
|
+
const kind = kindOf(issue.input);
|
|
45014
|
+
return typeof kind === "string" && BLOCK_STEP_KINDS.includes(kind) ? NEST_TOO_DEEP : void 0;
|
|
45015
|
+
}
|
|
45016
|
+
var plainStepSchemas = [
|
|
45017
|
+
AutomationWaitStepSchema.strict(),
|
|
45018
|
+
AutomationCapStepBaseSchema.extend(continueOnErrorShape).strict().refine((step) => step.target !== void 0 || step.deviceId !== void 0, {
|
|
45019
|
+
message: "a cap step needs a target",
|
|
45020
|
+
path: ["target"]
|
|
45021
|
+
}).refine((step) => step.target?.kind !== "domain" || step.actionId !== void 0, {
|
|
45022
|
+
message: "a domain target needs the vocabulary action it applies to (actionId)",
|
|
45023
|
+
path: ["actionId"]
|
|
45024
|
+
}),
|
|
45025
|
+
AutomationStopStepSchema.omit({ if: true }).strict(),
|
|
45026
|
+
AutomationSetStepSchema.omit({ if: true }).strict(),
|
|
45027
|
+
AutomationRunActionStepSchema.strict()
|
|
45028
|
+
];
|
|
45029
|
+
/**
|
|
45030
|
+
* A plain step: a flow step with no condition of its own and no step inside
|
|
45031
|
+
* it. The second (last) level of nesting holds these only.
|
|
45032
|
+
*/
|
|
45033
|
+
var AutomationBranchStepSchema = discriminatedUnion("kind", plainStepSchemas, { error: nestTooDeep });
|
|
45034
|
+
/** A step that can run beside others: it writes no variable and does not end the run. */
|
|
45035
|
+
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");
|
|
45036
|
+
/**
|
|
45037
|
+
* Several steps at once (#500): all are started together and all are awaited.
|
|
45038
|
+
* A failure fails the run once the others finished, as in a sequence; a member
|
|
45039
|
+
* marked "continue if this fails" does not.
|
|
45040
|
+
*/
|
|
45041
|
+
var AutomationParallelStepSchema = object({
|
|
45042
|
+
kind: literal("parallel"),
|
|
45043
|
+
steps: array(AutomationParallelMemberSchema).min(2, "a parallel needs at least two steps").max(5, `a parallel takes at most 5 steps`)
|
|
45044
|
+
}).strict();
|
|
45045
|
+
var REPEAT_NEEDS_MAX = "a repeat on a condition needs a maximum number of iterations";
|
|
45046
|
+
/** A loop on a condition: the bound is mandatory, so a run never loops without an end. */
|
|
45047
|
+
var repeatConditionShape = {
|
|
45048
|
+
when: AutomationWhenSchema,
|
|
45049
|
+
maxIterations: number$1({ error: REPEAT_NEEDS_MAX }).int().min(1, REPEAT_NEEDS_MAX).max(50, `a repeat on a condition runs at most 50 times`),
|
|
45050
|
+
/** A pause between two iterations, never after the last. */
|
|
45051
|
+
waitS: number$1().int().min(1).max(WAIT_MAX_SECONDS, WAIT_TOO_LONG).optional()
|
|
45052
|
+
};
|
|
45053
|
+
/** What decides how many times a `repeat` runs. */
|
|
45054
|
+
var AutomationRepeatLoopSchema = discriminatedUnion("by", [
|
|
45055
|
+
object({
|
|
45056
|
+
by: literal("count"),
|
|
45057
|
+
count: number$1().int().min(1).max(20, `a repeat runs at most 20 times`)
|
|
45058
|
+
}).strict(),
|
|
45059
|
+
object({
|
|
45060
|
+
by: literal("while"),
|
|
45061
|
+
...repeatConditionShape
|
|
45062
|
+
}).strict(),
|
|
45063
|
+
object({
|
|
45064
|
+
by: literal("until"),
|
|
45065
|
+
...repeatConditionShape
|
|
45066
|
+
}).strict(),
|
|
45067
|
+
object({
|
|
45068
|
+
by: literal("forEach"),
|
|
45069
|
+
target: object({
|
|
45070
|
+
kind: literal("devices"),
|
|
45071
|
+
ids: array(number$1().int()).min(1, "a repeat over devices needs at least one device").max(50, `a repeat over devices takes at most 50 devices`)
|
|
45072
|
+
}).strict()
|
|
45073
|
+
}).strict()
|
|
45074
|
+
]);
|
|
45075
|
+
/**
|
|
45076
|
+
* The same steps several times (#500). Every form is bounded at save, so a
|
|
45077
|
+
* run cannot loop without an end. A failure or a `stop` in the steps ends the
|
|
45078
|
+
* loop and the run, as in a sequence.
|
|
45079
|
+
*/
|
|
45080
|
+
function repeatSchemaOf(step) {
|
|
45081
|
+
return object({
|
|
45082
|
+
kind: literal("repeat"),
|
|
45083
|
+
loop: AutomationRepeatLoopSchema,
|
|
45084
|
+
steps: array(step).min(1, "a repeat needs at least one step").max(10, `a repeat takes at most 10 steps`)
|
|
45085
|
+
}).strict();
|
|
45086
|
+
}
|
|
45087
|
+
/**
|
|
45088
|
+
* One step, several ways (#500): the branches are read in order and the FIRST
|
|
45089
|
+
* whose condition is true runs; `else` runs when every branch is false. A
|
|
45090
|
+
* branch that cannot be read ends the choice: nothing runs, not the branches
|
|
45091
|
+
* after it and not the else (D49). The #472 `if` / `else` of a wait or cap
|
|
45092
|
+
* step is the one-branch case and stays as it is stored.
|
|
45093
|
+
*/
|
|
45094
|
+
function chooseSchemaOf(step) {
|
|
45095
|
+
const steps = array(step).max(10);
|
|
45096
|
+
return object({
|
|
45097
|
+
kind: literal("choose"),
|
|
45098
|
+
branches: array(object({
|
|
45099
|
+
if: AutomationWhenSchema,
|
|
45100
|
+
steps: steps.min(1, "a branch needs at least one step")
|
|
45101
|
+
})).min(1, "a choose needs at least one branch").max(6, `a choose takes at most 6 branches`),
|
|
45102
|
+
else: steps.optional()
|
|
45103
|
+
});
|
|
45104
|
+
}
|
|
45105
|
+
var AutomationBodyStepSchema = discriminatedUnion("kind", [
|
|
45106
|
+
...plainStepSchemas,
|
|
45107
|
+
AutomationWaitUntilStepSchema,
|
|
45108
|
+
AutomationParallelStepSchema,
|
|
45109
|
+
chooseSchemaOf(AutomationBranchStepSchema),
|
|
45110
|
+
repeatSchemaOf(AutomationBranchStepSchema)
|
|
45111
|
+
]);
|
|
45112
|
+
var AutomationRepeatStepSchema = repeatSchemaOf(AutomationBodyStepSchema);
|
|
44695
45113
|
var AutomationActionSchema = discriminatedUnion("kind", [
|
|
44696
45114
|
GuardedWaitStepSchema,
|
|
44697
|
-
|
|
44698
|
-
|
|
44699
|
-
|
|
44700
|
-
|
|
44701
|
-
|
|
44702
|
-
|
|
44703
|
-
|
|
44704
|
-
|
|
44705
|
-
number$1(),
|
|
44706
|
-
boolean()
|
|
44707
|
-
])).optional()
|
|
44708
|
-
}),
|
|
45115
|
+
AutomationGuardedCapStepSchema,
|
|
45116
|
+
AutomationStopStepSchema,
|
|
45117
|
+
AutomationSetStepSchema,
|
|
45118
|
+
chooseSchemaOf(AutomationBodyStepSchema),
|
|
45119
|
+
AutomationWaitUntilStepSchema,
|
|
45120
|
+
AutomationParallelStepSchema,
|
|
45121
|
+
AutomationRepeatStepSchema,
|
|
45122
|
+
AutomationRunActionStepSchema,
|
|
44709
45123
|
object({
|
|
44710
45124
|
kind: literal("code"),
|
|
44711
45125
|
/** Compiled into the automation's OWN block by esbuild — not a third
|
|
@@ -44768,11 +45182,6 @@ function convertLegacyRecipe(legacy) {
|
|
|
44768
45182
|
...rest
|
|
44769
45183
|
};
|
|
44770
45184
|
}
|
|
44771
|
-
/**
|
|
44772
|
-
* Where recipes are PARSED (the core-blocks cap, the MCP tool, the literal a
|
|
44773
|
-
* saved block carries): the new shape as it is, or the old shape converted to
|
|
44774
|
-
* it. The output type is always the new one.
|
|
44775
|
-
*/
|
|
44776
45185
|
var AutomationRecipeSchema = union([CurrentAutomationRecipeSchema, LegacyAutomationRecipeSchema.transform(convertLegacyRecipe)]);
|
|
44777
45186
|
var DETECTION_DESCRIPTIONS = {
|
|
44778
45187
|
deviceId: "the camera that saw it",
|
|
@@ -44788,6 +45197,21 @@ var STATIONARY_DESCRIPTIONS = {
|
|
|
44788
45197
|
phase: "appeared or departed",
|
|
44789
45198
|
entryId: "the stopped object"
|
|
44790
45199
|
};
|
|
45200
|
+
var BECOMES_DESCRIPTIONS = {
|
|
45201
|
+
deviceId: "the device that changed",
|
|
45202
|
+
from: "the value before the change, empty when it is not known",
|
|
45203
|
+
to: "the value it changed to"
|
|
45204
|
+
};
|
|
45205
|
+
/**
|
|
45206
|
+
* A fire's payload is offered too, as `data.<path>` (`{{vars.data.channel}}`):
|
|
45207
|
+
* those names depend on the device, so they are not in this list.
|
|
45208
|
+
*/
|
|
45209
|
+
var FIRED_DESCRIPTIONS = {
|
|
45210
|
+
deviceId: "the device that fired",
|
|
45211
|
+
eventType: "the event, as the device names it",
|
|
45212
|
+
sourceId: "the part of the device that fired (a button), empty when it names none",
|
|
45213
|
+
eventKind: "the kind of press (press, long-press …), empty when the device declares none"
|
|
45214
|
+
};
|
|
44791
45215
|
function describe$1(descriptions) {
|
|
44792
45216
|
return Object.entries(descriptions).map(([name, description]) => ({
|
|
44793
45217
|
name,
|
|
@@ -44796,8 +45220,50 @@ function describe$1(descriptions) {
|
|
|
44796
45220
|
}
|
|
44797
45221
|
describe$1(DETECTION_DESCRIPTIONS);
|
|
44798
45222
|
describe$1(STATIONARY_DESCRIPTIONS);
|
|
45223
|
+
describe$1(FIRED_DESCRIPTIONS).map((v) => v.name === "deviceId" ? {
|
|
45224
|
+
...v,
|
|
45225
|
+
hintKey: "firedDeviceId"
|
|
45226
|
+
} : v);
|
|
45227
|
+
describe$1(BECOMES_DESCRIPTIONS).map((v) => v.name === "deviceId" ? {
|
|
45228
|
+
...v,
|
|
45229
|
+
hintKey: "becomesDeviceId"
|
|
45230
|
+
} : v);
|
|
44799
45231
|
new Set(Object.values(COCO_TO_MACRO.mapping));
|
|
44800
45232
|
/**
|
|
45233
|
+
* Generic stateless event emitter. Installed on a `DeviceType.EventEmitter`
|
|
45234
|
+
* device. Carries the device's EXACT declared event vocabulary verbatim
|
|
45235
|
+
* (NO normalization). Two shapes:
|
|
45236
|
+
* - structured source (HA `event.*` entity) → `vocabulary` is the fixed
|
|
45237
|
+
* declared set (e.g. press_short, press_long, …).
|
|
45238
|
+
* - generic/legacy source (HA bus events, e.g. zha_event) → `vocabulary`
|
|
45239
|
+
* is [] (open) and `lastEvent.data` carries the complex payload.
|
|
45240
|
+
* `vocabulary` (D1044) names each event for a person and types it for a
|
|
45241
|
+
* rule; `eventTypes` is its list of native tokens, kept for older readers.
|
|
45242
|
+
* A fire names the part of the device it came from in `sourceId` when the
|
|
45243
|
+
* vocabulary declares sources (a remote's buttons).
|
|
45244
|
+
* `seq` is monotonic so two identical events still produce distinct slice writes.
|
|
45245
|
+
*/
|
|
45246
|
+
var EventFireSchema = object({
|
|
45247
|
+
deviceId: number$1(),
|
|
45248
|
+
eventType: string(),
|
|
45249
|
+
sourceId: string().optional(),
|
|
45250
|
+
data: record(string(), unknown()).nullable(),
|
|
45251
|
+
timestamp: number$1().meta(readingMeta("none")),
|
|
45252
|
+
seq: number$1().meta(readingMeta("count"))
|
|
45253
|
+
});
|
|
45254
|
+
var EventEmitterStatusSchema = object({
|
|
45255
|
+
eventTypes: array(string()),
|
|
45256
|
+
/**
|
|
45257
|
+
* Required of a provider by the type. A status written before the field
|
|
45258
|
+
* existed still parses, as an empty vocabulary: read it through
|
|
45259
|
+
* `readEventVocabulary`, which then answers with the plain tokens.
|
|
45260
|
+
*/
|
|
45261
|
+
vocabulary: array(EventVocabularyEntrySchema).default([]),
|
|
45262
|
+
lastEvent: EventFireSchema.nullable(),
|
|
45263
|
+
eventCountSinceStart: number$1().meta(readingMeta("count"))
|
|
45264
|
+
});
|
|
45265
|
+
DeviceType.EventEmitter;
|
|
45266
|
+
/**
|
|
44801
45267
|
* Schedulers (D983) — an entity that performs actions over the day.
|
|
44802
45268
|
*
|
|
44803
45269
|
* A scheduler has profiles; a profile has weekdays and a timeline of POINTS.
|
|
@@ -44820,6 +45286,13 @@ var SchedulerStateTreeSchema = AutomationWhenSchema.superRefine((when, ctx) => {
|
|
|
44820
45286
|
});
|
|
44821
45287
|
return;
|
|
44822
45288
|
}
|
|
45289
|
+
if (hasTriggeredByLeaves(when)) {
|
|
45290
|
+
ctx.addIssue({
|
|
45291
|
+
code: "custom",
|
|
45292
|
+
message: TRIGGERED_BY_NEEDS_AUTOMATION
|
|
45293
|
+
});
|
|
45294
|
+
return;
|
|
45295
|
+
}
|
|
44823
45296
|
const problem = validateWhenTree(when);
|
|
44824
45297
|
if (problem !== null) ctx.addIssue({
|
|
44825
45298
|
code: "custom",
|
|
@@ -44841,12 +45314,16 @@ var HoldOverrideSchema = discriminatedUnion("mode", [object({ mode: literal("res
|
|
|
44841
45314
|
})]);
|
|
44842
45315
|
/** A missed edge up to this late still runs. */
|
|
44843
45316
|
var DEFAULT_MAX_LATE_MS = 10 * 6e4;
|
|
45317
|
+
var SchedulerStepSchema = ActionStepSchema.refine((step) => step.kind !== "wait" || step.seconds <= 300, {
|
|
45318
|
+
message: `a scheduler point waits at most five minutes (300 s); put a longer wait in an action`,
|
|
45319
|
+
path: ["seconds"]
|
|
45320
|
+
});
|
|
44844
45321
|
var SchedulerPointSchema = object({
|
|
44845
45322
|
id: string().min(1).max(64),
|
|
44846
45323
|
at: SchedulerTimeSpecSchema,
|
|
44847
45324
|
mode: SchedulerPointModeSchema,
|
|
44848
45325
|
/** The actions of an `edge` or `hold`; a `release` has none. */
|
|
44849
|
-
steps: array(
|
|
45326
|
+
steps: array(SchedulerStepSchema).max(20).default([]),
|
|
44850
45327
|
/** Checked when the point runs (an edge) or is applied (a hold). */
|
|
44851
45328
|
conditions: SchedulerStateTreeSchema.optional(),
|
|
44852
45329
|
/** Hold only; absent means `respect`. */
|
|
@@ -45040,8 +45517,11 @@ var AutomationConditionTraceNodeSchema = object({
|
|
|
45040
45517
|
"device-is",
|
|
45041
45518
|
"expression",
|
|
45042
45519
|
"stationary-present",
|
|
45520
|
+
"time-is",
|
|
45521
|
+
"triggered-by",
|
|
45043
45522
|
"device-becomes",
|
|
45044
45523
|
"device-event",
|
|
45524
|
+
"device-fired",
|
|
45045
45525
|
"schedule",
|
|
45046
45526
|
"interval",
|
|
45047
45527
|
"manual",
|
|
@@ -45112,18 +45592,46 @@ var StepTraceBaseSchema = object({
|
|
|
45112
45592
|
]).optional(),
|
|
45113
45593
|
/** Why the condition read what it read, in the evaluator's own words. */
|
|
45114
45594
|
conditionReason: string().optional(),
|
|
45115
|
-
/** `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. */
|
|
45595
|
+
/** `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). */
|
|
45116
45596
|
outcome: _enum([
|
|
45117
45597
|
"ok",
|
|
45118
45598
|
"error",
|
|
45119
45599
|
"not-run",
|
|
45120
45600
|
"empty",
|
|
45121
|
-
"skipped"
|
|
45601
|
+
"skipped",
|
|
45602
|
+
"failed-continued",
|
|
45603
|
+
"timed-out"
|
|
45122
45604
|
]),
|
|
45123
45605
|
message: string().optional()
|
|
45124
45606
|
});
|
|
45607
|
+
/** What a block step adds to its row: which list ran, what each branch read, how many rounds. */
|
|
45608
|
+
var blockTraceShape = {
|
|
45609
|
+
/** A `choose` step (#500): the list that ran, `branches.<n>` or `else`. Absent when none did. */
|
|
45610
|
+
branch: string().optional(),
|
|
45611
|
+
/** A `choose` step: what each branch read, in order, up to the one that decided. */
|
|
45612
|
+
branchChecks: array(object({
|
|
45613
|
+
condition: _enum([
|
|
45614
|
+
"true",
|
|
45615
|
+
"false",
|
|
45616
|
+
"unknown"
|
|
45617
|
+
]),
|
|
45618
|
+
conditionReason: string().optional()
|
|
45619
|
+
})).optional(),
|
|
45620
|
+
/** A `repeat` step (#500): how many times its steps ran. */
|
|
45621
|
+
iterations: number$1().int().optional()
|
|
45622
|
+
};
|
|
45623
|
+
/** A step one level down: it may be a block step itself, whose own steps are plain rows (the nesting ends there). */
|
|
45624
|
+
var NestedStepTraceSchema = StepTraceBaseSchema.extend({
|
|
45625
|
+
...blockTraceShape,
|
|
45626
|
+
steps: array(StepTraceBaseSchema).optional()
|
|
45627
|
+
});
|
|
45125
45628
|
/** A step trace; the `else` steps that ran are one level of the same shape (the nesting is bounded at one). */
|
|
45126
|
-
var AutomationStepTraceSchema = StepTraceBaseSchema.extend({
|
|
45629
|
+
var AutomationStepTraceSchema = StepTraceBaseSchema.extend({
|
|
45630
|
+
else: array(StepTraceBaseSchema).optional(),
|
|
45631
|
+
...blockTraceShape,
|
|
45632
|
+
/** A `choose` step: the steps of the list that ran. A `parallel`: its members. A `repeat`: the LAST iteration. */
|
|
45633
|
+
steps: array(NestedStepTraceSchema).optional()
|
|
45634
|
+
});
|
|
45127
45635
|
var AutomationRunTraceSchema = object({
|
|
45128
45636
|
runId: string().min(1),
|
|
45129
45637
|
startedAt: number$1(),
|
|
@@ -45456,7 +45964,7 @@ object({
|
|
|
45456
45964
|
* is irrelevant; the array is treated as a set by consumers. */
|
|
45457
45965
|
hiddenChildIds: array(number$1()).readonly()
|
|
45458
45966
|
});
|
|
45459
|
-
DeviceType.Camera, DeviceType.
|
|
45967
|
+
DeviceType.Camera, DeviceType.Switch, DeviceType.Light, DeviceType.Sensor, DeviceType.Climate, DeviceType.Cover, DeviceType.Lock, DeviceType.Fan, DeviceType.MediaPlayer, DeviceType.AlarmPanel, DeviceType.Generic, method(object({
|
|
45460
45968
|
deviceId: number$1().int().nonnegative(),
|
|
45461
45969
|
childDeviceId: number$1().int().nonnegative(),
|
|
45462
45970
|
hidden: boolean()
|
|
@@ -45613,7 +46121,9 @@ var AddonHttpRouteSchema = object({
|
|
|
45613
46121
|
]).optional(),
|
|
45614
46122
|
description: string().optional(),
|
|
45615
46123
|
/** The hub limits this route per client address before the handler runs. */
|
|
45616
|
-
rateLimit: _enum(["auth"]).optional()
|
|
46124
|
+
rateLimit: _enum(["auth"]).optional(),
|
|
46125
|
+
/** Served once per integration instance; the handler reads `instanceId`. */
|
|
46126
|
+
perInstance: boolean().optional()
|
|
45617
46127
|
});
|
|
45618
46128
|
/**
|
|
45619
46129
|
* Cross-process route invocation envelope. The hub captures the
|
|
@@ -45630,6 +46140,8 @@ var InvokeRequestSchema = object({
|
|
|
45630
46140
|
query: record(string(), string()),
|
|
45631
46141
|
body: unknown(),
|
|
45632
46142
|
headers: record(string(), string()),
|
|
46143
|
+
/** The instance the hub resolved for a `perInstance` route. */
|
|
46144
|
+
instanceId: string().optional(),
|
|
45633
46145
|
user: object({
|
|
45634
46146
|
id: string(),
|
|
45635
46147
|
username: string(),
|
|
@@ -47567,7 +48079,7 @@ var BatteryStatusSchema = object({
|
|
|
47567
48079
|
*/
|
|
47568
48080
|
binary: boolean().optional().meta({ label: "Binary indicator" })
|
|
47569
48081
|
});
|
|
47570
|
-
DeviceType.Camera, DeviceType.Sensor, DeviceType.Button, DeviceType.Switch, DeviceType.PetFeeder, DeviceType.Container, DeviceType.
|
|
48082
|
+
DeviceType.Camera, DeviceType.Sensor, DeviceType.Button, DeviceType.Switch, DeviceType.PetFeeder, DeviceType.Container, DeviceType.Climate, DeviceType.EventEmitter;
|
|
47571
48083
|
method(object({
|
|
47572
48084
|
deviceId: number$1(),
|
|
47573
48085
|
/** Bound on the wait. Sensible range 3000–10000ms. */
|
|
@@ -48990,7 +49502,7 @@ var ClimateControlStatusSchema = object({
|
|
|
48990
49502
|
/** Ms epoch when the slice was last updated (push or command). */
|
|
48991
49503
|
lastFetchedAt: number$1()
|
|
48992
49504
|
});
|
|
48993
|
-
DeviceType.
|
|
49505
|
+
DeviceType.Climate, method(object({
|
|
48994
49506
|
deviceId: number$1().int().nonnegative(),
|
|
48995
49507
|
mode: HvacModeSchema
|
|
48996
49508
|
}), _void(), {
|
|
@@ -49281,6 +49793,7 @@ var CompositionProblemSchema = object({
|
|
|
49281
49793
|
"nested-field",
|
|
49282
49794
|
"missing-field",
|
|
49283
49795
|
"kind-mismatch",
|
|
49796
|
+
"source-kind-mismatch",
|
|
49284
49797
|
"may-be-null",
|
|
49285
49798
|
"source-missing",
|
|
49286
49799
|
"source-unreadable",
|
|
@@ -49302,7 +49815,8 @@ var CompositionProblemSchema = object({
|
|
|
49302
49815
|
"command-method-unknown",
|
|
49303
49816
|
"command-source-unknown",
|
|
49304
49817
|
"command-input-unknown",
|
|
49305
|
-
"command-input-missing"
|
|
49818
|
+
"command-input-missing",
|
|
49819
|
+
"power-source-is-actuator"
|
|
49306
49820
|
]),
|
|
49307
49821
|
path: string(),
|
|
49308
49822
|
message: string()
|
|
@@ -50125,7 +50639,7 @@ DeviceType.MediaPlayer, optionalMethod(deviceOnly, _void(), {
|
|
|
50125
50639
|
kind: "mutation",
|
|
50126
50640
|
auth: "protected"
|
|
50127
50641
|
});
|
|
50128
|
-
DeviceType.Camera, DeviceType.Sensor, DeviceType.Button, DeviceType.Switch, DeviceType.PetFeeder, DeviceType.Container, DeviceType.
|
|
50642
|
+
DeviceType.Camera, DeviceType.Sensor, DeviceType.Button, DeviceType.Switch, DeviceType.PetFeeder, DeviceType.Container, DeviceType.Climate, DeviceType.EventEmitter, 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.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, DeviceType.HeatPump, DeviceType.Camera, DeviceType.Fan, DeviceType.Fan, DeviceType.Fan, DeviceType.Fan, DeviceType.Fan, DeviceType.Fan, DeviceType.Fan, DeviceType.Fan, DeviceType.Fan, DeviceType.Fan, DeviceType.Lock, DeviceType.Camera, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Gateway, DeviceType.Camera, DeviceType.Sensor, DeviceType.MediaPlayer, DeviceType.Vacuum, DeviceType.Generic, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.PetFountain, DeviceType.Fan, DeviceType.Humidifier, DeviceType.Climate, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.MediaPlayer, DeviceType.WaterHeater, DeviceType.Humidifier, DeviceType.Fan, DeviceType.Climate, DeviceType.PetFeeder, DeviceType.MediaPlayer;
|
|
50129
50643
|
var NUMBER = {
|
|
50130
50644
|
kind: "fixed",
|
|
50131
50645
|
result: ["number"]
|
|
@@ -50208,7 +50722,7 @@ function numeric(input) {
|
|
|
50208
50722
|
}, ...alsoFrom === void 0 ? [] : [alsoFrom.accept]]
|
|
50209
50723
|
};
|
|
50210
50724
|
}
|
|
50211
|
-
var CLIMATE_DEVICES = [DeviceType.
|
|
50725
|
+
var CLIMATE_DEVICES = [DeviceType.Climate];
|
|
50212
50726
|
function binary(input) {
|
|
50213
50727
|
return {
|
|
50214
50728
|
...input,
|
|
@@ -50530,8 +51044,8 @@ var GROUP_TEMPLATES = [
|
|
|
50530
51044
|
actuator({
|
|
50531
51045
|
id: "climate",
|
|
50532
51046
|
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.",
|
|
50533
|
-
deviceType: DeviceType.
|
|
50534
|
-
memberDeviceTypes: [DeviceType.
|
|
51047
|
+
deviceType: DeviceType.Climate,
|
|
51048
|
+
memberDeviceTypes: [DeviceType.Climate],
|
|
50535
51049
|
outputCap: "group-active",
|
|
50536
51050
|
outputField: "active",
|
|
50537
51051
|
member: {
|
|
@@ -50574,6 +51088,50 @@ function actuator(input) {
|
|
|
50574
51088
|
new Map(GROUP_TEMPLATES.map((template) => [template.id, template]));
|
|
50575
51089
|
DeviceFeature.LightColorRgb, DeviceFeature.LightColorHsv, DeviceFeature.LightColorMired;
|
|
50576
51090
|
DeviceType.Camera;
|
|
51091
|
+
var PowerSourceRefusalReasonSchema = _enum([
|
|
51092
|
+
"no-power-source",
|
|
51093
|
+
"switch-missing",
|
|
51094
|
+
"switch-offline",
|
|
51095
|
+
"switch-unknown",
|
|
51096
|
+
"restart-in-progress",
|
|
51097
|
+
"switch-call-failed",
|
|
51098
|
+
"switch-is-actuator"
|
|
51099
|
+
]);
|
|
51100
|
+
var PowerSourceActionResultSchema = discriminatedUnion("accepted", [object({ accepted: literal(true) }), object({
|
|
51101
|
+
accepted: literal(false),
|
|
51102
|
+
reason: PowerSourceRefusalReasonSchema,
|
|
51103
|
+
/** One line for the operator, naming the switch. */
|
|
51104
|
+
message: string()
|
|
51105
|
+
})]);
|
|
51106
|
+
var PowerSourceInfoSchema = object({
|
|
51107
|
+
/** False when the device has no power source linked; the rest is then empty. */
|
|
51108
|
+
linked: boolean(),
|
|
51109
|
+
switchDeviceId: number$1().nullable(),
|
|
51110
|
+
switchName: string().nullable(),
|
|
51111
|
+
/** The switch's on/off state, or null when it is unknown. Never false for unknown (D393). */
|
|
51112
|
+
switchOn: boolean().nullable(),
|
|
51113
|
+
switchOnline: boolean().nullable(),
|
|
51114
|
+
restartInProgress: boolean(),
|
|
51115
|
+
offSeconds: number$1().int()
|
|
51116
|
+
});
|
|
51117
|
+
object({
|
|
51118
|
+
/** Null while the switch has not reported: unknown is never `false` (D393). */
|
|
51119
|
+
switchOn: boolean().nullable(),
|
|
51120
|
+
offSeconds: number$1().int(),
|
|
51121
|
+
lastFetchedAt: number$1()
|
|
51122
|
+
});
|
|
51123
|
+
DeviceType.Gateway, DeviceType.Camera, DeviceType.Sensor, DeviceType.MediaPlayer, DeviceType.Vacuum, DeviceType.Generic, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.PetFountain, DeviceType.Fan, DeviceType.Humidifier, DeviceType.Climate, DeviceType.WaterHeater;
|
|
51124
|
+
var deviceInput$2 = object({ deviceId: number$1().int().nonnegative() });
|
|
51125
|
+
systemMethod(deviceInput$2, PowerSourceInfoSchema, { auth: "protected" }), systemMethod(deviceInput$2, PowerSourceActionResultSchema, {
|
|
51126
|
+
kind: "mutation",
|
|
51127
|
+
auth: "protected"
|
|
51128
|
+
}), systemMethod(deviceInput$2, PowerSourceActionResultSchema, {
|
|
51129
|
+
kind: "mutation",
|
|
51130
|
+
auth: "protected"
|
|
51131
|
+
}), systemMethod(deviceInput$2, PowerSourceActionResultSchema, {
|
|
51132
|
+
kind: "mutation",
|
|
51133
|
+
auth: "protected"
|
|
51134
|
+
});
|
|
50577
51135
|
`${COMPOSED_DEVICE_STABLE_ID_PREFIX}`;
|
|
50578
51136
|
/**
|
|
50579
51137
|
* What a composition may BUILD on a device type (G2, D676): the caps a new
|
|
@@ -51518,27 +52076,35 @@ var DeviceAdminLinkSchema = object({
|
|
|
51518
52076
|
});
|
|
51519
52077
|
method(object({ deviceId: number$1().int().nonnegative() }), DeviceAdminLinkSchema.nullable(), { auth: "admin" });
|
|
51520
52078
|
/**
|
|
51521
|
-
* device-
|
|
51522
|
-
*
|
|
51523
|
-
*
|
|
51524
|
-
*
|
|
51525
|
-
*
|
|
51526
|
-
*
|
|
51527
|
-
*
|
|
51528
|
-
*
|
|
51529
|
-
*
|
|
51530
|
-
*
|
|
51531
|
-
*
|
|
51532
|
-
*
|
|
51533
|
-
*
|
|
51534
|
-
*
|
|
51535
|
-
*
|
|
51536
|
-
*
|
|
51537
|
-
*
|
|
51538
|
-
|
|
51539
|
-
|
|
51540
|
-
*
|
|
51541
|
-
*
|
|
52079
|
+
* `device-adoption` — generic discovery + adoption surface,
|
|
52080
|
+
* system-scoped collection (one provider per integration addon), routed
|
|
52081
|
+
* by explicit `{ addonId }` on direct `deviceAdoption.*` calls — the same
|
|
52082
|
+
* pin model as `connection-test`. The admin UI keeps using
|
|
52083
|
+
* `deviceManager.adoption*` (which already threads `addonId`). The de-HA-ified
|
|
52084
|
+
* successor to `ha-discovery`:
|
|
52085
|
+
* keyed by `integrationId` (the addon resolves integrationId → broker
|
|
52086
|
+
* internally) rather than a connection-specific `brokerId`, and it
|
|
52087
|
+
* OWNS the shared `DiscoveredChildDevice` candidate type
|
|
52088
|
+
* (declared below) so a single shared adoption modal renders any integration's
|
|
52089
|
+
* candidate tree.
|
|
52090
|
+
*
|
|
52091
|
+
* UI flow (Integrations page → integration detail):
|
|
52092
|
+
* 1. `listCandidates({integrationId, page, pageSize, filter})` →
|
|
52093
|
+
* paginated candidate list, each row collapsed.
|
|
52094
|
+
* 2. User expands a row → `getCandidate({integrationId,
|
|
52095
|
+
* childNativeId})` returns the single candidate (with its nested
|
|
52096
|
+
* `children`) for the accordion render.
|
|
52097
|
+
* 3. User clicks "Adopt" on one or more candidates →
|
|
52098
|
+
* `adopt({integrationId, childNativeIds, perCandidate?})`
|
|
52099
|
+
* materialises one parent CamStack device per candidate plus its
|
|
52100
|
+
* accessory children. `perCandidate[childNativeId]` carries an
|
|
52101
|
+
* optional display-name override + a `hiddenChildIds` pre-hide set
|
|
52102
|
+
* (the parent's `accessories.hiddenChildIds` gates UI visibility).
|
|
52103
|
+
* 4. User clicks "Release" → `release({integrationId, camDeviceId})`
|
|
52104
|
+
* removes the parent + every child from the kernel registry.
|
|
52105
|
+
*/
|
|
52106
|
+
/**
|
|
52107
|
+
* Status enum for a discovered device. Generic enough for
|
|
51542
52108
|
* battery cams, awake cams, and unreachable cams alike.
|
|
51543
52109
|
*/
|
|
51544
52110
|
var DiscoveredChildStatusSchema = _enum([
|
|
@@ -51555,12 +52121,12 @@ var DiscoveredChildDeviceSchema = lazy(() => object({
|
|
|
51555
52121
|
/** DeviceType the child should be created with on adopt. */
|
|
51556
52122
|
type: _enum(DeviceType),
|
|
51557
52123
|
status: DiscoveredChildStatusSchema,
|
|
51558
|
-
/** Free-form integration-specific metadata surfaced in the
|
|
52124
|
+
/** Free-form integration-specific metadata surfaced in the adoption modal. */
|
|
51559
52125
|
metadata: object({
|
|
51560
52126
|
model: string().optional(),
|
|
51561
52127
|
serialNumber: string().optional(),
|
|
51562
52128
|
uid: string().optional(),
|
|
51563
|
-
/** Reolink: 0-based channel index inside the parent NVR
|
|
52129
|
+
/** Reolink: 0-based channel index inside the parent NVR. */
|
|
51564
52130
|
rtspChannel: number$1().int().nonnegative().optional(),
|
|
51565
52131
|
isBattery: boolean().optional(),
|
|
51566
52132
|
isDoorbell: boolean().optional(),
|
|
@@ -51576,86 +52142,24 @@ var DiscoveredChildDeviceSchema = lazy(() => object({
|
|
|
51576
52142
|
}).default({}),
|
|
51577
52143
|
/**
|
|
51578
52144
|
* `true` when the framework already created a child device for this
|
|
51579
|
-
* `childNativeId` under the current parent. The
|
|
52145
|
+
* `childNativeId` under the current parent. The adoption modal uses it to
|
|
51580
52146
|
* gate the Add/Remove button and surface the existing `deviceId`.
|
|
51581
52147
|
*/
|
|
51582
52148
|
alreadyAdopted: boolean(),
|
|
51583
52149
|
/** When `alreadyAdopted=true`, the framework-assigned child device id. */
|
|
51584
52150
|
adoptedDeviceId: number$1().int().nonnegative().nullable(),
|
|
51585
|
-
/** Capability names the candidate advertises — integrations populate,
|
|
52151
|
+
/** Capability names the candidate advertises — integrations populate, flat enumerations omit. */
|
|
51586
52152
|
capabilities: array(string()).readonly().optional(),
|
|
51587
|
-
/** Feature flags the candidate advertises — integrations populate,
|
|
52153
|
+
/** Feature flags the candidate advertises — integrations populate, flat enumerations omit. */
|
|
51588
52154
|
features: array(string()).readonly().optional(),
|
|
51589
52155
|
/** Upstream-system identity + rendering hints for the candidate. */
|
|
51590
52156
|
sourceInfo: SourceInfoSchema.optional(),
|
|
51591
|
-
/** Nested entity-children for accordion preview — integrations populate,
|
|
52157
|
+
/** Nested entity-children for accordion preview — integrations populate, flat enumerations omit. */
|
|
51592
52158
|
children: array(DiscoveredChildDeviceSchema).readonly().optional(),
|
|
51593
52159
|
/** `childNativeId` of the gateway candidate in the same list this device sits behind. */
|
|
51594
52160
|
parentStableId: string().optional()
|
|
51595
52161
|
}));
|
|
51596
52162
|
/**
|
|
51597
|
-
* Status block — populated by the integration after each
|
|
51598
|
-
* `refreshDiscovery` (or push-driven update). The runtime-state slice
|
|
51599
|
-
* is what the panel reads via the per-device proxy; `getStatus`
|
|
51600
|
-
* returns the same payload via the codegen'd auto-injection.
|
|
51601
|
-
*/
|
|
51602
|
-
var DeviceDiscoveryStatusSchema = object({
|
|
51603
|
-
discovered: array(DiscoveredChildDeviceSchema),
|
|
51604
|
-
/** Wall-clock ms of the last successful enumeration. */
|
|
51605
|
-
lastDiscoveryAt: number$1().int().nonnegative().nullable(),
|
|
51606
|
-
/** Last error surfaced from the source (rendered as a banner). */
|
|
51607
|
-
lastError: string().nullable()
|
|
51608
|
-
});
|
|
51609
|
-
DeviceType.Hub, DeviceDiscoveryStatusSchema.extend({ lastFetchedAt: number$1().int().nonnegative() }), method(object({ deviceId: number$1().int().nonnegative() }), array(DiscoveredChildDeviceSchema).readonly()), method(object({ deviceId: number$1().int().nonnegative() }), array(DiscoveredChildDeviceSchema).readonly(), {
|
|
51610
|
-
kind: "mutation",
|
|
51611
|
-
auth: "admin"
|
|
51612
|
-
}), method(object({
|
|
51613
|
-
deviceId: number$1().int().nonnegative(),
|
|
51614
|
-
childNativeId: string(),
|
|
51615
|
-
/** Optional override for the child's display name. */
|
|
51616
|
-
name: string().optional()
|
|
51617
|
-
}), object({
|
|
51618
|
-
deviceId: number$1().int().nonnegative(),
|
|
51619
|
-
stableId: string()
|
|
51620
|
-
}), {
|
|
51621
|
-
kind: "mutation",
|
|
51622
|
-
auth: "admin"
|
|
51623
|
-
}), method(object({
|
|
51624
|
-
deviceId: number$1().int().nonnegative(),
|
|
51625
|
-
childDeviceId: number$1().int().nonnegative()
|
|
51626
|
-
}), _void(), {
|
|
51627
|
-
kind: "mutation",
|
|
51628
|
-
auth: "admin"
|
|
51629
|
-
});
|
|
51630
|
-
/**
|
|
51631
|
-
* `device-adoption` — generic discovery + adoption surface,
|
|
51632
|
-
* system-scoped collection (one provider per integration addon), routed
|
|
51633
|
-
* by explicit `{ addonId }` on direct `deviceAdoption.*` calls — the same
|
|
51634
|
-
* pin model as `connection-test`. The admin UI keeps using
|
|
51635
|
-
* `deviceManager.adoption*` (which already threads `addonId`). The de-HA-ified
|
|
51636
|
-
* successor to `ha-discovery`:
|
|
51637
|
-
* keyed by `integrationId` (the addon resolves integrationId → broker
|
|
51638
|
-
* internally) rather than a connection-specific `brokerId`, and it
|
|
51639
|
-
* REUSES the shared `DiscoveredChildDevice` candidate type from
|
|
51640
|
-
* `device-discovery.cap.ts` so a single shared adoption panel renders
|
|
51641
|
-
* any integration's candidate tree.
|
|
51642
|
-
*
|
|
51643
|
-
* UI flow (Integrations page → integration detail):
|
|
51644
|
-
* 1. `listCandidates({integrationId, page, pageSize, filter})` →
|
|
51645
|
-
* paginated candidate list, each row collapsed.
|
|
51646
|
-
* 2. User expands a row → `getCandidate({integrationId,
|
|
51647
|
-
* childNativeId})` returns the single candidate (with its nested
|
|
51648
|
-
* `children`) for the accordion render.
|
|
51649
|
-
* 3. User clicks "Adopt" on one or more candidates →
|
|
51650
|
-
* `adopt({integrationId, childNativeIds, perCandidate?})`
|
|
51651
|
-
* materialises one parent CamStack device per candidate plus its
|
|
51652
|
-
* accessory children. `perCandidate[childNativeId]` carries an
|
|
51653
|
-
* optional display-name override + a `hiddenChildIds` pre-hide set
|
|
51654
|
-
* (the parent's `accessories.hiddenChildIds` gates UI visibility).
|
|
51655
|
-
* 4. User clicks "Release" → `release({integrationId, camDeviceId})`
|
|
51656
|
-
* removes the parent + every child from the kernel registry.
|
|
51657
|
-
*/
|
|
51658
|
-
/**
|
|
51659
52163
|
* Provider-declared discovery *granularity* filter (the keystone of the
|
|
51660
52164
|
* single-entity-import design). A provider advertises which discovery
|
|
51661
52165
|
* granularities it supports via `listCandidateFilters`; the operator picks
|
|
@@ -53022,8 +53526,14 @@ method(object({
|
|
|
53022
53526
|
"string",
|
|
53023
53527
|
"number",
|
|
53024
53528
|
"boolean",
|
|
53025
|
-
"enum"
|
|
53529
|
+
"enum",
|
|
53530
|
+
"union"
|
|
53026
53531
|
]),
|
|
53532
|
+
unionMembers: array(_enum([
|
|
53533
|
+
"string",
|
|
53534
|
+
"number",
|
|
53535
|
+
"boolean"
|
|
53536
|
+
])).optional(),
|
|
53027
53537
|
enumValues: array(string()).optional(),
|
|
53028
53538
|
item: boolean().optional(),
|
|
53029
53539
|
quantity: ReadingQuantitySchema.optional()
|
|
@@ -54889,29 +55399,6 @@ var EnumSensorStatusSchema = object({
|
|
|
54889
55399
|
lastFetchedAt: number$1()
|
|
54890
55400
|
});
|
|
54891
55401
|
DeviceType.Sensor;
|
|
54892
|
-
/**
|
|
54893
|
-
* Generic stateless event emitter. Installed on a `DeviceType.EventEmitter`
|
|
54894
|
-
* device. Carries the device's EXACT declared event vocabulary verbatim
|
|
54895
|
-
* (NO normalization). Two shapes:
|
|
54896
|
-
* - structured source (HA `event.*` entity) → `eventTypes` is the fixed
|
|
54897
|
-
* declared vocabulary (e.g. ['press_short','press_long',...]).
|
|
54898
|
-
* - generic/legacy source (HA bus events, e.g. zha_event) → `eventTypes`
|
|
54899
|
-
* is [] (open) and `lastEvent.data` carries the complex payload.
|
|
54900
|
-
* `seq` is monotonic so two identical events still produce distinct slice writes.
|
|
54901
|
-
*/
|
|
54902
|
-
var EventFireSchema = object({
|
|
54903
|
-
deviceId: number$1(),
|
|
54904
|
-
eventType: string(),
|
|
54905
|
-
data: record(string(), unknown()).nullable(),
|
|
54906
|
-
timestamp: number$1().meta(readingMeta("none")),
|
|
54907
|
-
seq: number$1().meta(readingMeta("count"))
|
|
54908
|
-
});
|
|
54909
|
-
var EventEmitterStatusSchema = object({
|
|
54910
|
-
eventTypes: array(string()),
|
|
54911
|
-
lastEvent: EventFireSchema.nullable(),
|
|
54912
|
-
eventCountSinceStart: number$1().meta(readingMeta("count"))
|
|
54913
|
-
});
|
|
54914
|
-
DeviceType.EventEmitter;
|
|
54915
55402
|
var IdentitySchema = object({
|
|
54916
55403
|
id: string(),
|
|
54917
55404
|
name: string(),
|
|
@@ -55401,8 +55888,85 @@ method(_void(), array(FailureContributionSchema).readonly());
|
|
|
55401
55888
|
* - `FanPreset` — preset selector
|
|
55402
55889
|
* - `FanDirection` — direction toggle (ceiling fans)
|
|
55403
55890
|
* - `FanOscillating` — oscillation toggle
|
|
55891
|
+
*
|
|
55892
|
+
* Per-axis oscillation (`oscillationAxes`, `setOscillationAxis`, D1034): an air
|
|
55893
|
+
* circulator sweeps horizontally and vertically, each axis with its own
|
|
55894
|
+
* switch, fixed angle, sweep bounds and limits. A provider may report them
|
|
55895
|
+
* natively; otherwise the OPERATOR links sibling devices to each field in
|
|
55896
|
+
* Customize (a `replace` over the fields listed in `overridable` — nothing is
|
|
55897
|
+
* linked or inferred by itself), and a write to a linked field is forwarded to
|
|
55898
|
+
* its source. `oscillating` stays the single summary flag: when axes exist it
|
|
55899
|
+
* means "any axis oscillates" (`anyAxisOscillating`).
|
|
55404
55900
|
*/
|
|
55405
55901
|
var FanDirectionSchema = _enum(["forward", "reverse"]);
|
|
55902
|
+
var FAN_OSCILLATION_AXES = ["horizontal", "vertical"];
|
|
55903
|
+
var FanOscillationAxisNameSchema = _enum(FAN_OSCILLATION_AXES);
|
|
55904
|
+
var FanOscillationAxisFieldSchema = _enum([
|
|
55905
|
+
"oscillating",
|
|
55906
|
+
"angle",
|
|
55907
|
+
"sweepFrom",
|
|
55908
|
+
"sweepTo"
|
|
55909
|
+
]);
|
|
55910
|
+
/** The limits of one axis, read from the source that serves its angle. */
|
|
55911
|
+
var FAN_OSCILLATION_AXIS_LIMITS = [
|
|
55912
|
+
"min",
|
|
55913
|
+
"max",
|
|
55914
|
+
"step"
|
|
55915
|
+
];
|
|
55916
|
+
/**
|
|
55917
|
+
* One oscillation axis. Every reading the device has not reported is `null`,
|
|
55918
|
+
* never `0` (D393): `0°` is a real position. Each leaf defaults to `null`, so
|
|
55919
|
+
* a slice that names only the leaves it knows (a Customize link of one field)
|
|
55920
|
+
* is still a whole axis.
|
|
55921
|
+
*/
|
|
55922
|
+
var FanOscillationAxisSchema = object({
|
|
55923
|
+
/** Whether the axis sweeps. */
|
|
55924
|
+
oscillating: boolean().nullable().default(null),
|
|
55925
|
+
/** The fixed position (degrees) the axis holds when it does not sweep. */
|
|
55926
|
+
angle: number$1().nullable().default(null),
|
|
55927
|
+
/** The sweep bounds (degrees): left → right, bottom → top. */
|
|
55928
|
+
sweepFrom: number$1().nullable().default(null),
|
|
55929
|
+
sweepTo: number$1().nullable().default(null),
|
|
55930
|
+
/** The angles the axis accepts. Null when the device states none. */
|
|
55931
|
+
min: number$1().nullable().default(null),
|
|
55932
|
+
max: number$1().nullable().default(null),
|
|
55933
|
+
step: number$1().nullable().default(null)
|
|
55934
|
+
});
|
|
55935
|
+
/** Both axes; an axis the device does not have is `null`. */
|
|
55936
|
+
var FanOscillationAxesSchema = object({
|
|
55937
|
+
horizontal: FanOscillationAxisSchema.nullable().default(null),
|
|
55938
|
+
vertical: FanOscillationAxisSchema.nullable().default(null)
|
|
55939
|
+
});
|
|
55940
|
+
var FanOscillationAxisRefusalSchema = _enum([
|
|
55941
|
+
"nothing-to-set",
|
|
55942
|
+
"axis-not-linked",
|
|
55943
|
+
"out-of-range",
|
|
55944
|
+
"source-gone",
|
|
55945
|
+
"source-unknown",
|
|
55946
|
+
"source-call-failed"
|
|
55947
|
+
]);
|
|
55948
|
+
var FanOscillationAxisResultSchema = discriminatedUnion("status", [object({ status: literal("applied") }), object({
|
|
55949
|
+
status: literal("refused"),
|
|
55950
|
+
reason: FanOscillationAxisRefusalSchema,
|
|
55951
|
+
/** The field at fault, when one is. */
|
|
55952
|
+
field: FanOscillationAxisFieldSchema.optional(),
|
|
55953
|
+
/** One line for the operator, naming the axis, the field and the source. */
|
|
55954
|
+
detail: string(),
|
|
55955
|
+
/** Fields that DID land before the refusal (writes run in order, stop at the first failure). */
|
|
55956
|
+
applied: array(FanOscillationAxisFieldSchema)
|
|
55957
|
+
})]);
|
|
55958
|
+
var SetOscillationAxisInputSchema = object({
|
|
55959
|
+
deviceId: number$1().int().nonnegative(),
|
|
55960
|
+
axis: FanOscillationAxisNameSchema,
|
|
55961
|
+
oscillating: boolean().optional(),
|
|
55962
|
+
angle: number$1().optional(),
|
|
55963
|
+
sweepFrom: number$1().optional(),
|
|
55964
|
+
sweepTo: number$1().optional()
|
|
55965
|
+
});
|
|
55966
|
+
/** The state path of one axis field: `oscillationAxes.<axis>.<field>`. */
|
|
55967
|
+
function fanAxisPath(axis, field) {
|
|
55968
|
+
return `oscillationAxes.${axis}.${field}`;
|
|
55969
|
+
}
|
|
55406
55970
|
var FanControlStatusSchema = object({
|
|
55407
55971
|
/** Active speed as 0..100 inclusive. Null when the device has no
|
|
55408
55972
|
* speed surface (single-speed fan). */
|
|
@@ -55421,9 +55985,91 @@ var FanControlStatusSchema = object({
|
|
|
55421
55985
|
/** Oscillation toggle. Null when the device has no oscillation
|
|
55422
55986
|
* surface. */
|
|
55423
55987
|
oscillating: boolean().nullable(),
|
|
55988
|
+
/**
|
|
55989
|
+
* Per-axis oscillation (air circulators). Absent when the device has no
|
|
55990
|
+
* per-axis surface and nothing is linked in Customize.
|
|
55991
|
+
*/
|
|
55992
|
+
oscillationAxes: FanOscillationAxesSchema.optional(),
|
|
55424
55993
|
/** Ms epoch when the slice was last updated. */
|
|
55425
55994
|
lastChangedAt: number$1()
|
|
55426
55995
|
});
|
|
55996
|
+
var FAN_CUSTOMIZE_DEVICE_TYPES = [DeviceType.Fan];
|
|
55997
|
+
/** The Customize section the axis targets are listed under. */
|
|
55998
|
+
var AXES_SECTION = "oscillation-axes";
|
|
55999
|
+
function axisOscillatingTarget(axis) {
|
|
56000
|
+
return {
|
|
56001
|
+
id: `${axis}-oscillating`,
|
|
56002
|
+
cardinality: "scalar",
|
|
56003
|
+
vocabulary: {
|
|
56004
|
+
cap: "fan-control",
|
|
56005
|
+
stateField: "oscillating"
|
|
56006
|
+
},
|
|
56007
|
+
deviceTypes: FAN_CUSTOMIZE_DEVICE_TYPES,
|
|
56008
|
+
apply: "replace",
|
|
56009
|
+
section: AXES_SECTION,
|
|
56010
|
+
path: fanAxisPath(axis, "oscillating"),
|
|
56011
|
+
sources: [{
|
|
56012
|
+
kind: "switch",
|
|
56013
|
+
transforms: [{ kind: "identity" }]
|
|
56014
|
+
}],
|
|
56015
|
+
sourceReport: { status: "assignment-status" }
|
|
56016
|
+
};
|
|
56017
|
+
}
|
|
56018
|
+
/**
|
|
56019
|
+
* A numeric axis field. The `angle` link also carries the axis limits, read
|
|
56020
|
+
* from the SAME linked control's own range (`min`/`max`/`step`), so the limits
|
|
56021
|
+
* are the source's, never guessed.
|
|
56022
|
+
*/
|
|
56023
|
+
function axisNumericTarget(axis, field) {
|
|
56024
|
+
const base = {
|
|
56025
|
+
id: `${axis}-${field}`,
|
|
56026
|
+
cardinality: "scalar",
|
|
56027
|
+
vocabulary: { cap: "fan-control" },
|
|
56028
|
+
deviceTypes: FAN_CUSTOMIZE_DEVICE_TYPES,
|
|
56029
|
+
apply: "replace",
|
|
56030
|
+
section: AXES_SECTION,
|
|
56031
|
+
path: fanAxisPath(axis, field),
|
|
56032
|
+
sources: [{
|
|
56033
|
+
kind: "numeric",
|
|
56034
|
+
transforms: [{ kind: "identity" }]
|
|
56035
|
+
}],
|
|
56036
|
+
sourceReport: { status: "assignment-status" }
|
|
56037
|
+
};
|
|
56038
|
+
if (field !== "angle") return base;
|
|
56039
|
+
return {
|
|
56040
|
+
...base,
|
|
56041
|
+
companions: FAN_OSCILLATION_AXIS_LIMITS.map((limit) => ({
|
|
56042
|
+
kind: "source-field",
|
|
56043
|
+
path: fanAxisPath(axis, limit),
|
|
56044
|
+
field: limit
|
|
56045
|
+
}))
|
|
56046
|
+
};
|
|
56047
|
+
}
|
|
56048
|
+
var AXIS_TARGETS = FAN_OSCILLATION_AXES.flatMap((axis) => [
|
|
56049
|
+
axisOscillatingTarget(axis),
|
|
56050
|
+
axisNumericTarget(axis, "angle"),
|
|
56051
|
+
axisNumericTarget(axis, "sweepFrom"),
|
|
56052
|
+
axisNumericTarget(axis, "sweepTo")
|
|
56053
|
+
]);
|
|
56054
|
+
/** A select (an enum control) the operator links to the fan's `preset`. */
|
|
56055
|
+
var PRESET_TARGET = {
|
|
56056
|
+
id: "preset",
|
|
56057
|
+
cardinality: "scalar",
|
|
56058
|
+
vocabulary: { cap: "fan-control" },
|
|
56059
|
+
deviceTypes: FAN_CUSTOMIZE_DEVICE_TYPES,
|
|
56060
|
+
apply: "replace",
|
|
56061
|
+
path: "preset",
|
|
56062
|
+
sources: [{
|
|
56063
|
+
kind: "field",
|
|
56064
|
+
valueKinds: ["string"],
|
|
56065
|
+
transforms: [{ kind: "identity" }]
|
|
56066
|
+
}],
|
|
56067
|
+
sourceReport: { status: "assignment-status" }
|
|
56068
|
+
};
|
|
56069
|
+
[...AXIS_TARGETS, PRESET_TARGET].map((target) => ({
|
|
56070
|
+
path: target.path,
|
|
56071
|
+
by: target.id
|
|
56072
|
+
}));
|
|
55427
56073
|
DeviceType.Fan, optionalMethod(object({
|
|
55428
56074
|
deviceId: number$1().int().nonnegative(),
|
|
55429
56075
|
speed: number$1().min(0).max(100)
|
|
@@ -55448,17 +56094,37 @@ DeviceType.Fan, optionalMethod(object({
|
|
|
55448
56094
|
}), _void(), {
|
|
55449
56095
|
kind: "mutation",
|
|
55450
56096
|
auth: "protected"
|
|
56097
|
+
}), optionalMethod(SetOscillationAxisInputSchema, FanOscillationAxisResultSchema, {
|
|
56098
|
+
kind: "mutation",
|
|
56099
|
+
auth: "protected"
|
|
56100
|
+
});
|
|
56101
|
+
/** One axis as a preset wants it; an absent field is left as it is. */
|
|
56102
|
+
var FanPresetAxisSchema = object({
|
|
56103
|
+
oscillating: boolean().optional(),
|
|
56104
|
+
angle: number$1().optional(),
|
|
56105
|
+
sweepFrom: number$1().optional(),
|
|
56106
|
+
sweepTo: number$1().optional()
|
|
56107
|
+
});
|
|
56108
|
+
/** The fan-control state a preset sets; an absent field is left as it is. */
|
|
56109
|
+
var FanPresetStateSchema = object({
|
|
56110
|
+
speed: number$1().min(0).max(100).optional(),
|
|
56111
|
+
/** The fan's own preset mode (or the linked select's option). */
|
|
56112
|
+
preset: string().min(1).optional(),
|
|
56113
|
+
direction: FanDirectionSchema.optional(),
|
|
56114
|
+
oscillationAxes: object({
|
|
56115
|
+
horizontal: FanPresetAxisSchema.optional(),
|
|
56116
|
+
vertical: FanPresetAxisSchema.optional()
|
|
56117
|
+
}).optional()
|
|
55451
56118
|
});
|
|
55452
56119
|
var FanPresetSchema = object({
|
|
55453
56120
|
/** Stable key; never reused after a delete within one device's list. */
|
|
55454
56121
|
id: string().min(1).max(64),
|
|
55455
56122
|
/** What the operator and a voice assistant call it. */
|
|
55456
56123
|
name: string().trim().min(1).max(40),
|
|
55457
|
-
|
|
56124
|
+
state: FanPresetStateSchema
|
|
55458
56125
|
});
|
|
55459
56126
|
var FanPresetsRefusalSchema = _enum([
|
|
55460
|
-
"
|
|
55461
|
-
"bad-target",
|
|
56127
|
+
"empty-state",
|
|
55462
56128
|
"duplicate-name",
|
|
55463
56129
|
"duplicate-id",
|
|
55464
56130
|
"too-many",
|
|
@@ -55470,72 +56136,55 @@ var FanPresetsSetResultSchema = discriminatedUnion("status", [object({
|
|
|
55470
56136
|
}), object({
|
|
55471
56137
|
status: literal("refused"),
|
|
55472
56138
|
reason: FanPresetsRefusalSchema,
|
|
55473
|
-
/** Names the preset
|
|
56139
|
+
/** Names the preset at fault. */
|
|
55474
56140
|
detail: string()
|
|
55475
56141
|
})]);
|
|
55476
|
-
var
|
|
55477
|
-
|
|
56142
|
+
var FanPresetFieldResultSchema = object({
|
|
56143
|
+
/** The state path: `speed`, `preset`, `direction`, `oscillationAxes.horizontal.angle`. */
|
|
56144
|
+
field: string(),
|
|
55478
56145
|
outcome: _enum([
|
|
55479
56146
|
"applied",
|
|
55480
56147
|
"failed",
|
|
55481
56148
|
"not-run",
|
|
55482
56149
|
"refused"
|
|
55483
56150
|
]),
|
|
55484
|
-
deviceId: number$1().int().nonnegative().optional(),
|
|
55485
|
-
cap: string().optional(),
|
|
55486
|
-
method: string().optional(),
|
|
55487
56151
|
/** The cause, for every outcome but `applied`. */
|
|
55488
56152
|
message: string().optional()
|
|
55489
56153
|
});
|
|
55490
56154
|
var FanPresetApplyResultSchema = object({
|
|
55491
|
-
/** `applied`: every
|
|
56155
|
+
/** `applied`: every field landed. `partial`: some did, one did not. `refused`: nothing ran. */
|
|
55492
56156
|
status: _enum([
|
|
55493
56157
|
"applied",
|
|
55494
56158
|
"partial",
|
|
55495
56159
|
"refused"
|
|
55496
56160
|
]),
|
|
55497
|
-
|
|
56161
|
+
fields: array(FanPresetFieldResultSchema)
|
|
55498
56162
|
});
|
|
55499
56163
|
var FanCaptureFieldSchema = _enum([
|
|
55500
56164
|
"speed",
|
|
55501
|
-
"oscillating",
|
|
55502
56165
|
"direction",
|
|
55503
|
-
"preset"
|
|
56166
|
+
"preset",
|
|
56167
|
+
"oscillationAxes"
|
|
55504
56168
|
]);
|
|
55505
|
-
var FanCaptureOmissionSchema = object({
|
|
55506
|
-
/** A fan field (`speed`) or `step <n>` for a sibling step. */
|
|
55507
|
-
what: string(),
|
|
55508
|
-
/** Why no value was taken: unknown reading (never stored as 0, D393), or a step that cannot be read. */
|
|
55509
|
-
reason: string()
|
|
55510
|
-
});
|
|
55511
|
-
var FanCaptureItemSchema = object({
|
|
55512
|
-
group: _enum([
|
|
55513
|
-
"fan",
|
|
55514
|
-
"oscillation",
|
|
55515
|
-
"angles"
|
|
55516
|
-
]),
|
|
55517
|
-
/** What the step sets, in the operator's words (a device name, a fan field). */
|
|
55518
|
-
label: string()
|
|
55519
|
-
});
|
|
55520
56169
|
var FanPresetCaptureResultSchema = object({
|
|
55521
|
-
/** The
|
|
55522
|
-
|
|
55523
|
-
|
|
55524
|
-
|
|
55525
|
-
|
|
56170
|
+
/** The fan's CURRENT fan-control state, as a preset; NOT saved. */
|
|
56171
|
+
state: FanPresetStateSchema,
|
|
56172
|
+
omitted: array(object({
|
|
56173
|
+
/** A state path (`speed`, `oscillationAxes.vertical.angle`). */
|
|
56174
|
+
what: string(),
|
|
56175
|
+
/** Why no value was taken: an unknown reading is never stored as 0 (D393). */
|
|
56176
|
+
reason: string()
|
|
56177
|
+
}))
|
|
55526
56178
|
});
|
|
55527
|
-
var deviceInput$
|
|
56179
|
+
var deviceInput$1 = object({ deviceId: number$1().int().nonnegative() });
|
|
55528
56180
|
DeviceType.Fan;
|
|
55529
|
-
method(deviceInput$
|
|
56181
|
+
method(deviceInput$1, array(FanPresetSchema), { auth: "protected" }), method(deviceInput$1.extend({ presets: array(FanPresetSchema).max(12) }), FanPresetsSetResultSchema, {
|
|
55530
56182
|
kind: "mutation",
|
|
55531
56183
|
auth: "admin"
|
|
55532
|
-
}), method(deviceInput$
|
|
56184
|
+
}), method(deviceInput$1.extend({ presetId: string().min(1) }), FanPresetApplyResultSchema, {
|
|
55533
56185
|
kind: "mutation",
|
|
55534
56186
|
auth: "protected"
|
|
55535
|
-
}), method(deviceInput$
|
|
55536
|
-
fields: array(FanCaptureFieldSchema).optional(),
|
|
55537
|
-
steps: array(ActionStepSchema).max(20).default([])
|
|
55538
|
-
}), FanPresetCaptureResultSchema, { auth: "protected" });
|
|
56187
|
+
}), method(deviceInput$1.extend({ fields: array(FanCaptureFieldSchema).optional() }), FanPresetCaptureResultSchema, { auth: "protected" });
|
|
55539
56188
|
/**
|
|
55540
56189
|
* Per-device feature/identity probe slice. Holds the runtime-resolved
|
|
55541
56190
|
* truth about what a device CAN do — which the kernel uses to:
|
|
@@ -55659,7 +56308,7 @@ var GroupActiveSchema = object({
|
|
|
55659
56308
|
/** Ms epoch when the slice was last updated. */
|
|
55660
56309
|
lastChangedAt: number$1()
|
|
55661
56310
|
});
|
|
55662
|
-
DeviceType.Cover, DeviceType.Valve, DeviceType.Lock, DeviceType.MediaPlayer, DeviceType.Climate
|
|
56311
|
+
DeviceType.Cover, DeviceType.Valve, DeviceType.Lock, DeviceType.MediaPlayer, DeviceType.Climate;
|
|
55663
56312
|
var GroupCommandsSchema = object({
|
|
55664
56313
|
/** One row per member that has been commanded. A later command replaces that member's row. */
|
|
55665
56314
|
results: array(object({
|
|
@@ -55671,7 +56320,7 @@ results: array(object({
|
|
|
55671
56320
|
/** Ms epoch of the attempt. */
|
|
55672
56321
|
at: number$1()
|
|
55673
56322
|
})) });
|
|
55674
|
-
DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Cover, DeviceType.Valve, DeviceType.Lock, DeviceType.MediaPlayer, DeviceType.
|
|
56323
|
+
DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Cover, DeviceType.Valve, DeviceType.Lock, DeviceType.MediaPlayer, DeviceType.Climate;
|
|
55675
56324
|
/**
|
|
55676
56325
|
* How many members of a helper group answered (D944). Counts are integers,
|
|
55677
56326
|
* not measurements: zero included is a real count, never a stand-in reading.
|
|
@@ -55695,7 +56344,7 @@ var GroupStatusSchema = object({
|
|
|
55695
56344
|
label: "Members"
|
|
55696
56345
|
}))
|
|
55697
56346
|
});
|
|
55698
|
-
DeviceType.Sensor, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Cover, DeviceType.Valve, DeviceType.Lock, DeviceType.MediaPlayer, DeviceType.
|
|
56347
|
+
DeviceType.Sensor, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Cover, DeviceType.Valve, DeviceType.Lock, DeviceType.MediaPlayer, DeviceType.Climate;
|
|
55699
56348
|
/**
|
|
55700
56349
|
* Heat pump settable surface (D1026): one typed method per parameter, never a
|
|
55701
56350
|
* generic `set(key, value)`. The values a mode takes and the limits of a number
|
|
@@ -55903,7 +56552,7 @@ var HeatingValveStatusSchema = object({
|
|
|
55903
56552
|
/** Ms epoch when the slice was last updated (push or poll). */
|
|
55904
56553
|
lastFetchedAt: number$1()
|
|
55905
56554
|
});
|
|
55906
|
-
DeviceType.
|
|
56555
|
+
DeviceType.Climate;
|
|
55907
56556
|
/**
|
|
55908
56557
|
* timed-run - run a device for a chosen time, then stop it (D993).
|
|
55909
56558
|
*
|
|
@@ -55919,13 +56568,13 @@ DeviceType.Thermostat;
|
|
|
55919
56568
|
* retried in a loop - D49); a future one is re-armed.
|
|
55920
56569
|
*
|
|
55921
56570
|
* What a device may be run for, and for how long at most, is per device type
|
|
55922
|
-
* ({@link
|
|
56571
|
+
* and role ({@link timedRunLimitOf}): the maximum is a safety bound, not a preference,
|
|
55923
56572
|
* so a request above it is REFUSED with a typed reason, never clamped.
|
|
55924
56573
|
*/
|
|
55925
56574
|
var TimedRunUnitSchema = _enum(["s", "min"]);
|
|
55926
56575
|
_enum(["switch", "pet-fountain"]);
|
|
55927
|
-
DeviceType.
|
|
55928
|
-
DeviceType.
|
|
56576
|
+
DeviceType.Switch, DeviceType.PetFountain;
|
|
56577
|
+
DeviceType.Switch, DeviceRole.SwitchHeater;
|
|
55929
56578
|
/** One duration, as the one-tap run asks for it. */
|
|
55930
56579
|
var TimedRunQuickRunSchema = object({
|
|
55931
56580
|
duration: number$1().positive().finite(),
|
|
@@ -56097,8 +56746,8 @@ var HeroSceneSchema = object({
|
|
|
56097
56746
|
/** 0..1: volume, cover position, cycle progress. */
|
|
56098
56747
|
level: number$1().min(0).max(1).nullable()
|
|
56099
56748
|
});
|
|
56100
|
-
DeviceType.Camera, DeviceType.Hub, DeviceType.Light, DeviceType.Siren, DeviceType.Switch, DeviceType.Sensor, DeviceType.
|
|
56101
|
-
DeviceRole.Siren, DeviceRole.Floodlight, DeviceRole.Spotlight, DeviceRole.PirSensor, DeviceRole.Chime, DeviceRole.Autotrack, DeviceRole.Nightvision, DeviceRole.PrivacyMask, DeviceRole.Doorbell, DeviceRole.CoverBlind, DeviceRole.CoverShutter, DeviceRole.CoverAwning, DeviceRole.CoverCurtain, DeviceRole.CoverGarage, DeviceRole.CoverGate, DeviceRole.CoverDoor, DeviceRole.CoverWindow, DeviceRole.BinaryHelper, DeviceRole.Outlet, DeviceRole.MotionSensor, DeviceRole.ContactSensor, DeviceRole.LeakSensor, DeviceRole.SmokeSensor, DeviceRole.COSensor, DeviceRole.GasSensor, DeviceRole.TamperSensor, DeviceRole.VibrationSensor, DeviceRole.ConnectivitySensor, DeviceRole.SoundSensor, DeviceRole.BinarySensor, DeviceRole.TemperatureSensor, DeviceRole.HumiditySensor, DeviceRole.AmbientLightSensor, DeviceRole.PressureSensor, DeviceRole.WindSensor, DeviceRole.RainSensor, DeviceRole.UvSensor, DeviceRole.SolarRadiationSensor, DeviceRole.SoilMoistureSensor, DeviceRole.PowerSensor, DeviceRole.EnergySensor, DeviceRole.VoltageSensor, DeviceRole.CurrentSensor, DeviceRole.AirQualitySensor, DeviceRole.BatterySensor, DeviceRole.NumericSensor, DeviceRole.EnumSensor, DeviceRole.DateTimeSensor, DeviceRole.GenericSensor, DeviceRole.NumericControl, DeviceRole.SelectControl, DeviceRole.TextControl, DeviceRole.DateTimeControl, DeviceRole.MobilePushNotifier, DeviceRole.MessagingNotifier, DeviceRole.EmailNotifier, DeviceRole.GenericNotifier, DeviceRole.IrTransmitter;
|
|
56749
|
+
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;
|
|
56750
|
+
DeviceRole.Siren, DeviceRole.Floodlight, DeviceRole.Spotlight, DeviceRole.PirSensor, DeviceRole.Chime, DeviceRole.Autotrack, DeviceRole.Nightvision, DeviceRole.PrivacyMask, DeviceRole.Doorbell, DeviceRole.CoverBlind, DeviceRole.CoverShutter, DeviceRole.CoverAwning, DeviceRole.CoverCurtain, DeviceRole.CoverGarage, DeviceRole.CoverGate, DeviceRole.CoverDoor, DeviceRole.CoverWindow, DeviceRole.BinaryHelper, DeviceRole.Outlet, DeviceRole.SwitchHeater, DeviceRole.SwitchFan, DeviceRole.ClimateAc, DeviceRole.ClimateThermostat, DeviceRole.ClimateFloor, DeviceRole.ClimateRadiator, DeviceRole.ClimateHeater, DeviceRole.ClimateHeatPumpCircuit, DeviceRole.MotionSensor, DeviceRole.ContactSensor, DeviceRole.LeakSensor, DeviceRole.SmokeSensor, DeviceRole.COSensor, DeviceRole.GasSensor, DeviceRole.TamperSensor, DeviceRole.VibrationSensor, DeviceRole.ConnectivitySensor, DeviceRole.SoundSensor, DeviceRole.BinarySensor, DeviceRole.TemperatureSensor, DeviceRole.HumiditySensor, DeviceRole.AmbientLightSensor, DeviceRole.PressureSensor, DeviceRole.WindSensor, DeviceRole.RainSensor, DeviceRole.UvSensor, DeviceRole.SolarRadiationSensor, DeviceRole.SoilMoistureSensor, DeviceRole.PowerSensor, DeviceRole.EnergySensor, DeviceRole.VoltageSensor, DeviceRole.CurrentSensor, DeviceRole.AirQualitySensor, DeviceRole.BatterySensor, DeviceRole.NumericSensor, DeviceRole.EnumSensor, DeviceRole.DateTimeSensor, DeviceRole.GenericSensor, DeviceRole.NumericControl, DeviceRole.SelectControl, DeviceRole.TextControl, DeviceRole.DateTimeControl, DeviceRole.MobilePushNotifier, DeviceRole.MessagingNotifier, DeviceRole.EmailNotifier, DeviceRole.GenericNotifier, DeviceRole.IrTransmitter;
|
|
56102
56751
|
/** A string in both languages, as the cap vocabulary writes it (D920): no `t()` in the model. */
|
|
56103
56752
|
var HeroTextSchema = object({
|
|
56104
56753
|
en: string(),
|
|
@@ -56483,8 +57132,8 @@ var HeroRowModelSchema = object({
|
|
|
56483
57132
|
extras: array(HeroControlSchema).max(2).optional(),
|
|
56484
57133
|
trailing: HeroFactSchema.nullable()
|
|
56485
57134
|
});
|
|
56486
|
-
DeviceType.Climate
|
|
56487
|
-
DeviceType.Climate, DeviceType.
|
|
57135
|
+
DeviceType.Climate;
|
|
57136
|
+
DeviceType.Climate, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.MediaPlayer;
|
|
56488
57137
|
/**
|
|
56489
57138
|
* hero-layout — what a device's hero says (D1023). Read-only: the FIXED
|
|
56490
57139
|
* layouts live in `@camstack/types` and nothing here stores or edits one.
|
|
@@ -56516,7 +57165,10 @@ method(heroInput, HeroModelSchema.nullable(), {
|
|
|
56516
57165
|
}), method(rowModelsInput, array(HeroRowModelSchema.nullable()), {
|
|
56517
57166
|
auth: "protected",
|
|
56518
57167
|
role: "viewer"
|
|
56519
|
-
}), method(object({
|
|
57168
|
+
}), method(object({
|
|
57169
|
+
deviceType: string(),
|
|
57170
|
+
role: string().nullable().optional()
|
|
57171
|
+
}), HeroLayoutRowsSchema, {
|
|
56520
57172
|
auth: "protected",
|
|
56521
57173
|
role: "viewer"
|
|
56522
57174
|
});
|
|
@@ -56593,7 +57245,7 @@ var HumiditySensorStatusSchema = object({
|
|
|
56593
57245
|
/** Ms epoch when the slice was last updated. */
|
|
56594
57246
|
lastFetchedAt: number$1()
|
|
56595
57247
|
});
|
|
56596
|
-
DeviceType.Sensor, DeviceType.
|
|
57248
|
+
DeviceType.Sensor, DeviceType.Climate;
|
|
56597
57249
|
/**
|
|
56598
57250
|
* Image display cap. Models a single still image exposed by an integration —
|
|
56599
57251
|
* a snapshot, a chart, a generated picture, or a robot's cleaning-map render.
|
|
@@ -68937,7 +69589,18 @@ var OauthIntegrationDescriptorSchema = object({
|
|
|
68937
69589
|
* The value is baked into the authorization code at `/authorize` and travels
|
|
68938
69590
|
* on the tokens, so editing this field changes FUTURE links only.
|
|
68939
69591
|
*/
|
|
68940
|
-
refreshTokenTtlSec: union([number$1().int().positive(), literal("never")]).optional()
|
|
69592
|
+
refreshTokenTtlSec: union([number$1().int().positive(), literal("never")]).optional(),
|
|
69593
|
+
/**
|
|
69594
|
+
* The integration instances an account can be linked to (planning#415),
|
|
69595
|
+
* beside the default one. `/api/oauth2/authorize?instance=<id>` is accepted
|
|
69596
|
+
* only for an id listed here; with no `instance=` the link is made to the
|
|
69597
|
+
* default instance, which is never listed and always accepted — it is the
|
|
69598
|
+
* address third parties already hold. Omit for a single-instance integration.
|
|
69599
|
+
*/
|
|
69600
|
+
instances: array(object({
|
|
69601
|
+
id: string(),
|
|
69602
|
+
displayName: string()
|
|
69603
|
+
})).optional()
|
|
68941
69604
|
});
|
|
68942
69605
|
var oauthIntegrationCapability = {
|
|
68943
69606
|
name: "oauth-integration",
|
|
@@ -70887,7 +71550,6 @@ object({
|
|
|
70887
71550
|
DeviceType.Light,
|
|
70888
71551
|
DeviceType.Fan,
|
|
70889
71552
|
DeviceType.Climate,
|
|
70890
|
-
DeviceType.Thermostat,
|
|
70891
71553
|
DeviceType.Humidifier,
|
|
70892
71554
|
DeviceType.WaterHeater,
|
|
70893
71555
|
DeviceType.MediaPlayer,
|
|
@@ -70896,52 +71558,8 @@ object({
|
|
|
70896
71558
|
DeviceType.Dishwasher,
|
|
70897
71559
|
DeviceType.Vacuum,
|
|
70898
71560
|
DeviceType.LawnMower,
|
|
70899
|
-
DeviceType.PetFeeder
|
|
70900
|
-
DeviceType.Heater
|
|
71561
|
+
DeviceType.PetFeeder
|
|
70901
71562
|
].filter((type) => type !== DeviceType.Sensor);
|
|
70902
|
-
var PowerSourceRefusalReasonSchema = _enum([
|
|
70903
|
-
"no-power-source",
|
|
70904
|
-
"switch-missing",
|
|
70905
|
-
"switch-offline",
|
|
70906
|
-
"switch-unknown",
|
|
70907
|
-
"restart-in-progress",
|
|
70908
|
-
"switch-call-failed"
|
|
70909
|
-
]);
|
|
70910
|
-
var PowerSourceActionResultSchema = discriminatedUnion("accepted", [object({ accepted: literal(true) }), object({
|
|
70911
|
-
accepted: literal(false),
|
|
70912
|
-
reason: PowerSourceRefusalReasonSchema,
|
|
70913
|
-
/** One line for the operator, naming the switch. */
|
|
70914
|
-
message: string()
|
|
70915
|
-
})]);
|
|
70916
|
-
var PowerSourceInfoSchema = object({
|
|
70917
|
-
/** False when the device has no power source linked; the rest is then empty. */
|
|
70918
|
-
linked: boolean(),
|
|
70919
|
-
switchDeviceId: number$1().nullable(),
|
|
70920
|
-
switchName: string().nullable(),
|
|
70921
|
-
/** The switch's on/off state, or null when it is unknown. Never false for unknown (D393). */
|
|
70922
|
-
switchOn: boolean().nullable(),
|
|
70923
|
-
switchOnline: boolean().nullable(),
|
|
70924
|
-
restartInProgress: boolean(),
|
|
70925
|
-
offSeconds: number$1().int()
|
|
70926
|
-
});
|
|
70927
|
-
object({
|
|
70928
|
-
/** Null while the switch has not reported: unknown is never `false` (D393). */
|
|
70929
|
-
switchOn: boolean().nullable(),
|
|
70930
|
-
offSeconds: number$1().int(),
|
|
70931
|
-
lastFetchedAt: number$1()
|
|
70932
|
-
});
|
|
70933
|
-
DeviceType.Gateway, DeviceType.Hub, DeviceType.Camera, DeviceType.Sensor, DeviceType.MediaPlayer, DeviceType.Vacuum, DeviceType.Generic, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.PetFountain, DeviceType.Fan, DeviceType.Humidifier, DeviceType.Climate, DeviceType.WaterHeater;
|
|
70934
|
-
var deviceInput$1 = object({ deviceId: number$1().int().nonnegative() });
|
|
70935
|
-
systemMethod(deviceInput$1, PowerSourceInfoSchema, { auth: "protected" }), systemMethod(deviceInput$1, PowerSourceActionResultSchema, {
|
|
70936
|
-
kind: "mutation",
|
|
70937
|
-
auth: "protected"
|
|
70938
|
-
}), systemMethod(deviceInput$1, PowerSourceActionResultSchema, {
|
|
70939
|
-
kind: "mutation",
|
|
70940
|
-
auth: "protected"
|
|
70941
|
-
}), systemMethod(deviceInput$1, PowerSourceActionResultSchema, {
|
|
70942
|
-
kind: "mutation",
|
|
70943
|
-
auth: "protected"
|
|
70944
|
-
});
|
|
70945
71563
|
/**
|
|
70946
71564
|
* Presence cap. Models HA `person.*` and `device_tracker.*` entities
|
|
70947
71565
|
* on `DeviceType.Presence`. Read-only — no setters: presence is
|
|
@@ -74069,7 +74687,7 @@ object({
|
|
|
74069
74687
|
phase: string().nullable()
|
|
74070
74688
|
});
|
|
74071
74689
|
Object.values(DeviceType);
|
|
74072
|
-
DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.MediaPlayer, DeviceType.WaterHeater, DeviceType.Humidifier, DeviceType.Fan, DeviceType.Climate, DeviceType.
|
|
74690
|
+
DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.MediaPlayer, DeviceType.WaterHeater, DeviceType.Humidifier, DeviceType.Fan, DeviceType.Climate, DeviceType.PetFeeder;
|
|
74073
74691
|
/**
|
|
74074
74692
|
* scene-monitor — device-scoped reference-region state cap. An operator marks
|
|
74075
74693
|
* a rect ROI on a camera frame and names one or more states; the engine
|
|
@@ -75127,6 +75745,13 @@ var SsoBridgeClaimsSchema = object({
|
|
|
75127
75745
|
/** OAuth authorization-code binding — set only on `oauth-code` tokens. */
|
|
75128
75746
|
redirectUri: string().optional(),
|
|
75129
75747
|
integrationId: string().optional(),
|
|
75748
|
+
/**
|
|
75749
|
+
* The integration INSTANCE an OAuth link was made for (planning#415). Set on
|
|
75750
|
+
* `oauth-code`, `oauth-access` and `oauth-refresh` tokens of a link made
|
|
75751
|
+
* with `instance=`; absent on a link to the default instance. A cloud relay
|
|
75752
|
+
* reads it off the access token to route; the hub answers from the session.
|
|
75753
|
+
*/
|
|
75754
|
+
instanceId: string().optional(),
|
|
75130
75755
|
/** JWT ID — unique per issued code; consumed-set enforces single-use. */
|
|
75131
75756
|
jti: string().optional(),
|
|
75132
75757
|
/** PKCE S256 challenge — set only on `oauth-code` tokens issued to a public
|
|
@@ -75770,7 +76395,7 @@ var SwitchStatusSchema = object({
|
|
|
75770
76395
|
/** Ms epoch of the last state change. Useful for UI "X minutes ago". */
|
|
75771
76396
|
lastChangedAt: number$1()
|
|
75772
76397
|
});
|
|
75773
|
-
DeviceType.Switch, DeviceType.Siren, DeviceType.Light, DeviceType.Fan,
|
|
76398
|
+
DeviceType.Switch, DeviceType.Siren, DeviceType.Light, DeviceType.Fan, method(object({
|
|
75774
76399
|
deviceId: number$1(),
|
|
75775
76400
|
on: boolean()
|
|
75776
76401
|
}), _void(), {
|
|
@@ -76395,7 +77020,7 @@ var TemperatureSensorStatusSchema = object({
|
|
|
76395
77020
|
/** Ms epoch when the slice was last updated (push or poll). */
|
|
76396
77021
|
lastFetchedAt: number$1()
|
|
76397
77022
|
});
|
|
76398
|
-
DeviceType.Sensor, DeviceType.
|
|
77023
|
+
DeviceType.Sensor, DeviceType.Climate;
|
|
76399
77024
|
var TemplateKindSchema = _enum(["remote"]);
|
|
76400
77025
|
/**
|
|
76401
77026
|
* template — the generic store of reusable, named operator data (D963). A
|
|
@@ -77215,6 +77840,8 @@ var OauthSessionSummarySchema = object({
|
|
|
77215
77840
|
userId: string(),
|
|
77216
77841
|
username: string(),
|
|
77217
77842
|
integrationId: string(),
|
|
77843
|
+
/** The instance the link was made for; `null` = the default instance. */
|
|
77844
|
+
instanceId: string().nullable().optional(),
|
|
77218
77845
|
scopes: array(TokenScopeSchema),
|
|
77219
77846
|
createdAt: number$1(),
|
|
77220
77847
|
lastUsedAt: number$1(),
|
|
@@ -77314,6 +77941,9 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(_void(), ob
|
|
|
77314
77941
|
access: "view"
|
|
77315
77942
|
}), method(object({
|
|
77316
77943
|
integrationId: string(),
|
|
77944
|
+
/** The integration instance the link is for. Omit for the default
|
|
77945
|
+
* instance — never pass the addon id to mean it. */
|
|
77946
|
+
instanceId: string().optional(),
|
|
77317
77947
|
userId: string(),
|
|
77318
77948
|
username: string(),
|
|
77319
77949
|
scopes: array(TokenScopeSchema),
|
|
@@ -77352,7 +77982,13 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(_void(), ob
|
|
|
77352
77982
|
}), method(object({ token: string() }), object({
|
|
77353
77983
|
userId: string(),
|
|
77354
77984
|
username: string(),
|
|
77355
|
-
scopes: array(TokenScopeSchema)
|
|
77985
|
+
scopes: array(TokenScopeSchema),
|
|
77986
|
+
/** The instance the link was made for, read from the SESSION.
|
|
77987
|
+
* Absent = the default instance. `oauthLinkServesInstance` is the
|
|
77988
|
+
* helper a per-instance route calls to compare it with the instance
|
|
77989
|
+
* of its path; no route declares `perInstance` yet (the Alexa
|
|
77990
|
+
* per-instance route, T3, is the first consumer). */
|
|
77991
|
+
instanceId: string().optional()
|
|
77356
77992
|
}).nullable(), { access: "view" }), method(object({ userId: string() }), array(ExternalIdentitySchema), { auth: "admin" }), method(ExternalIdentityKeySchema, object({
|
|
77357
77993
|
userId: string(),
|
|
77358
77994
|
issuer: string()
|
|
@@ -78952,7 +79588,9 @@ var AccessoryKind = {
|
|
|
78952
79588
|
};
|
|
78953
79589
|
AccessoryKind.Siren, AccessoryKind.Floodlight, AccessoryKind.Spotlight, AccessoryKind.PirSensor, AccessoryKind.Chime, AccessoryKind.Autotrack, AccessoryKind.Nightvision, AccessoryKind.PrivacyMask;
|
|
78954
79590
|
DeviceType.HeatPump;
|
|
78955
|
-
DeviceType.
|
|
79591
|
+
DeviceType.Climate;
|
|
79592
|
+
DeviceRole.ClimateThermostat, DeviceRole.ClimateAc, DeviceRole.ClimateRadiator, DeviceRole.ClimateFloor, DeviceRole.ClimateHeater, DeviceRole.ClimateHeatPumpCircuit;
|
|
79593
|
+
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;
|
|
78956
79594
|
new Set(Object.values(DeviceType));
|
|
78957
79595
|
/** Parses the raw slice with the cap's own schema; `undefined` when it does not parse. */
|
|
78958
79596
|
function contribution(cap, schema, build) {
|
|
@@ -80958,7 +81596,7 @@ var HEAT_PUMP_FAMILY_CONTRIBUTIONS = { "heat-pump-status": contribution("heat-pu
|
|
|
80958
81596
|
...Object.values(CLIMATE_FAMILY_CONTRIBUTIONS),
|
|
80959
81597
|
...Object.values(HEAT_PUMP_FAMILY_CONTRIBUTIONS)
|
|
80960
81598
|
];
|
|
80961
|
-
DeviceType.Camera, DeviceType.Hub, DeviceType.Light, DeviceType.Siren, DeviceType.Switch, DeviceType.Sensor, DeviceType.
|
|
81599
|
+
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;
|
|
80962
81600
|
/**
|
|
80963
81601
|
* Who looks like what (D1023). One look per {@link DeviceType}, refined by a
|
|
80964
81602
|
* {@link DeviceRole} where the role changes how the device reads (a leak
|
|
@@ -81602,9 +82240,9 @@ lookOf({
|
|
|
81602
82240
|
idle: INFO,
|
|
81603
82241
|
standby: MUTED
|
|
81604
82242
|
});
|
|
81605
|
-
DeviceType.Climate
|
|
81606
|
-
DeviceType.Camera, DeviceType.Hub, DeviceType.Light, DeviceType.Siren, DeviceType.Switch, DeviceType.Sensor, DeviceType.
|
|
81607
|
-
DeviceRole.Siren, DeviceRole.Floodlight, DeviceRole.Spotlight, DeviceRole.PirSensor, DeviceRole.Chime, DeviceRole.Autotrack, DeviceRole.Nightvision, DeviceRole.PrivacyMask, DeviceRole.Doorbell, DeviceRole.CoverBlind, DeviceRole.CoverShutter, DeviceRole.CoverAwning, DeviceRole.CoverCurtain, DeviceRole.CoverGarage, DeviceRole.CoverGate, DeviceRole.CoverDoor, DeviceRole.CoverWindow, DeviceRole.BinaryHelper, DeviceRole.Outlet, DeviceRole.MotionSensor, DeviceRole.ContactSensor, DeviceRole.LeakSensor, DeviceRole.SmokeSensor, DeviceRole.COSensor, DeviceRole.GasSensor, DeviceRole.TamperSensor, DeviceRole.VibrationSensor, DeviceRole.ConnectivitySensor, DeviceRole.SoundSensor, DeviceRole.BinarySensor, DeviceRole.TemperatureSensor, DeviceRole.HumiditySensor, DeviceRole.AmbientLightSensor, DeviceRole.PressureSensor, DeviceRole.WindSensor, DeviceRole.RainSensor, DeviceRole.UvSensor, DeviceRole.SolarRadiationSensor, DeviceRole.SoilMoistureSensor, DeviceRole.PowerSensor, DeviceRole.EnergySensor, DeviceRole.VoltageSensor, DeviceRole.CurrentSensor, DeviceRole.AirQualitySensor, DeviceRole.BatterySensor, DeviceRole.NumericSensor, DeviceRole.EnumSensor, DeviceRole.DateTimeSensor, DeviceRole.GenericSensor, DeviceRole.NumericControl, DeviceRole.SelectControl, DeviceRole.TextControl, DeviceRole.DateTimeControl, DeviceRole.MobilePushNotifier, DeviceRole.MessagingNotifier, DeviceRole.EmailNotifier, DeviceRole.GenericNotifier, DeviceRole.IrTransmitter;
|
|
82243
|
+
DeviceType.Climate;
|
|
82244
|
+
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;
|
|
82245
|
+
DeviceRole.Siren, DeviceRole.Floodlight, DeviceRole.Spotlight, DeviceRole.PirSensor, DeviceRole.Chime, DeviceRole.Autotrack, DeviceRole.Nightvision, DeviceRole.PrivacyMask, DeviceRole.Doorbell, DeviceRole.CoverBlind, DeviceRole.CoverShutter, DeviceRole.CoverAwning, DeviceRole.CoverCurtain, DeviceRole.CoverGarage, DeviceRole.CoverGate, DeviceRole.CoverDoor, DeviceRole.CoverWindow, DeviceRole.BinaryHelper, DeviceRole.Outlet, DeviceRole.SwitchHeater, DeviceRole.SwitchFan, DeviceRole.ClimateAc, DeviceRole.ClimateThermostat, DeviceRole.ClimateFloor, DeviceRole.ClimateRadiator, DeviceRole.ClimateHeater, DeviceRole.ClimateHeatPumpCircuit, DeviceRole.MotionSensor, DeviceRole.ContactSensor, DeviceRole.LeakSensor, DeviceRole.SmokeSensor, DeviceRole.COSensor, DeviceRole.GasSensor, DeviceRole.TamperSensor, DeviceRole.VibrationSensor, DeviceRole.ConnectivitySensor, DeviceRole.SoundSensor, DeviceRole.BinarySensor, DeviceRole.TemperatureSensor, DeviceRole.HumiditySensor, DeviceRole.AmbientLightSensor, DeviceRole.PressureSensor, DeviceRole.WindSensor, DeviceRole.RainSensor, DeviceRole.UvSensor, DeviceRole.SolarRadiationSensor, DeviceRole.SoilMoistureSensor, DeviceRole.PowerSensor, DeviceRole.EnergySensor, DeviceRole.VoltageSensor, DeviceRole.CurrentSensor, DeviceRole.AirQualitySensor, DeviceRole.BatterySensor, DeviceRole.NumericSensor, DeviceRole.EnumSensor, DeviceRole.DateTimeSensor, DeviceRole.GenericSensor, DeviceRole.NumericControl, DeviceRole.SelectControl, DeviceRole.TextControl, DeviceRole.DateTimeControl, DeviceRole.MobilePushNotifier, DeviceRole.MessagingNotifier, DeviceRole.EmailNotifier, DeviceRole.GenericNotifier, DeviceRole.IrTransmitter;
|
|
81608
82246
|
Object.freeze({
|
|
81609
82247
|
"accessories.getStatus": {
|
|
81610
82248
|
capName: "accessories",
|
|
@@ -83454,41 +84092,6 @@ Object.freeze({
|
|
|
83454
84092
|
access: "create",
|
|
83455
84093
|
role: "admin"
|
|
83456
84094
|
},
|
|
83457
|
-
"deviceDiscovery.adoptDevice": {
|
|
83458
|
-
capName: "device-discovery",
|
|
83459
|
-
capScope: "device",
|
|
83460
|
-
addonId: null,
|
|
83461
|
-
access: "create",
|
|
83462
|
-
role: "admin"
|
|
83463
|
-
},
|
|
83464
|
-
"deviceDiscovery.getStatus": {
|
|
83465
|
-
capName: "device-discovery",
|
|
83466
|
-
capScope: "device",
|
|
83467
|
-
addonId: null,
|
|
83468
|
-
access: "view",
|
|
83469
|
-
role: "viewer"
|
|
83470
|
-
},
|
|
83471
|
-
"deviceDiscovery.listDiscovered": {
|
|
83472
|
-
capName: "device-discovery",
|
|
83473
|
-
capScope: "device",
|
|
83474
|
-
addonId: null,
|
|
83475
|
-
access: "view",
|
|
83476
|
-
role: "viewer"
|
|
83477
|
-
},
|
|
83478
|
-
"deviceDiscovery.refreshDiscovery": {
|
|
83479
|
-
capName: "device-discovery",
|
|
83480
|
-
capScope: "device",
|
|
83481
|
-
addonId: null,
|
|
83482
|
-
access: "create",
|
|
83483
|
-
role: "admin"
|
|
83484
|
-
},
|
|
83485
|
-
"deviceDiscovery.releaseDevice": {
|
|
83486
|
-
capName: "device-discovery",
|
|
83487
|
-
capScope: "device",
|
|
83488
|
-
addonId: null,
|
|
83489
|
-
access: "create",
|
|
83490
|
-
role: "admin"
|
|
83491
|
-
},
|
|
83492
84095
|
"deviceExport.applyDeviceSettingsPatch": {
|
|
83493
84096
|
capName: "device-export",
|
|
83494
84097
|
capScope: "system",
|
|
@@ -85036,6 +85639,13 @@ Object.freeze({
|
|
|
85036
85639
|
access: "create",
|
|
85037
85640
|
role: "viewer"
|
|
85038
85641
|
},
|
|
85642
|
+
"fanControl.setOscillationAxis": {
|
|
85643
|
+
capName: "fan-control",
|
|
85644
|
+
capScope: "device",
|
|
85645
|
+
addonId: null,
|
|
85646
|
+
access: "create",
|
|
85647
|
+
role: "viewer"
|
|
85648
|
+
},
|
|
85039
85649
|
"fanControl.setPercentage": {
|
|
85040
85650
|
capName: "fan-control",
|
|
85041
85651
|
capScope: "device",
|
|
@@ -92057,7 +92667,7 @@ function projectAction(cap, action) {
|
|
|
92057
92667
|
};
|
|
92058
92668
|
}
|
|
92059
92669
|
Object.entries(CAP_VOCABULARY_BY_NAME).flatMap(([cap, entry]) => entry.scope === "device" ? (entry.actions ?? []).map((a) => projectAction(cap, a)) : []);
|
|
92060
|
-
DeviceType.Camera, DeviceType.Hub, DeviceType.Light, DeviceType.Siren, DeviceType.Switch, DeviceType.Sensor, DeviceType.
|
|
92670
|
+
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;
|
|
92061
92671
|
DeviceFeature.BatteryOperated;
|
|
92062
92672
|
function bound(cap, methods = [], authority = "reported") {
|
|
92063
92673
|
return {
|
|
@@ -92571,35 +93181,6 @@ Object.freeze({
|
|
|
92571
93181
|
form: "single",
|
|
92572
93182
|
optional: false
|
|
92573
93183
|
}],
|
|
92574
|
-
"deviceDiscovery.adoptDevice": [{
|
|
92575
|
-
name: "deviceId",
|
|
92576
|
-
form: "single",
|
|
92577
|
-
optional: false
|
|
92578
|
-
}],
|
|
92579
|
-
"deviceDiscovery.getStatus": [{
|
|
92580
|
-
name: "deviceId",
|
|
92581
|
-
form: "single",
|
|
92582
|
-
optional: false
|
|
92583
|
-
}],
|
|
92584
|
-
"deviceDiscovery.listDiscovered": [{
|
|
92585
|
-
name: "deviceId",
|
|
92586
|
-
form: "single",
|
|
92587
|
-
optional: false
|
|
92588
|
-
}],
|
|
92589
|
-
"deviceDiscovery.refreshDiscovery": [{
|
|
92590
|
-
name: "deviceId",
|
|
92591
|
-
form: "single",
|
|
92592
|
-
optional: false
|
|
92593
|
-
}],
|
|
92594
|
-
"deviceDiscovery.releaseDevice": [{
|
|
92595
|
-
name: "childDeviceId",
|
|
92596
|
-
form: "single",
|
|
92597
|
-
optional: false
|
|
92598
|
-
}, {
|
|
92599
|
-
name: "deviceId",
|
|
92600
|
-
form: "single",
|
|
92601
|
-
optional: false
|
|
92602
|
-
}],
|
|
92603
93184
|
"deviceExport.applyDeviceSettingsPatch": [{
|
|
92604
93185
|
name: "deviceId",
|
|
92605
93186
|
form: "single",
|
|
@@ -93163,6 +93744,11 @@ Object.freeze({
|
|
|
93163
93744
|
form: "single",
|
|
93164
93745
|
optional: false
|
|
93165
93746
|
}],
|
|
93747
|
+
"fanControl.setOscillationAxis": [{
|
|
93748
|
+
name: "deviceId",
|
|
93749
|
+
form: "single",
|
|
93750
|
+
optional: false
|
|
93751
|
+
}],
|
|
93166
93752
|
"fanControl.setPercentage": [{
|
|
93167
93753
|
name: "deviceId",
|
|
93168
93754
|
form: "single",
|
|
@@ -98076,9 +98662,14 @@ function thermostatCapability(slice, modes, features) {
|
|
|
98076
98662
|
}
|
|
98077
98663
|
};
|
|
98078
98664
|
}
|
|
98079
|
-
/**
|
|
98080
|
-
|
|
98081
|
-
|
|
98665
|
+
/**
|
|
98666
|
+
* D1033 — one `climate` type, and the role says which thing it is: an air
|
|
98667
|
+
* conditioner is an AIR_CONDITIONER; a thermostat, a radiator, a floor loop, a
|
|
98668
|
+
* heat-pump circuit, a climate heater and a climate with no role yet are all a
|
|
98669
|
+
* THERMOSTAT.
|
|
98670
|
+
*/
|
|
98671
|
+
function climateCategoryFor(role) {
|
|
98672
|
+
return role === DeviceRole.ClimateAc ? "AIR_CONDITIONER" : "THERMOSTAT";
|
|
98082
98673
|
}
|
|
98083
98674
|
function describeClimate(device) {
|
|
98084
98675
|
const slice = readClimateSlice(device.slices["climate-control"]);
|
|
@@ -98112,7 +98703,7 @@ function describeClimate(device) {
|
|
|
98112
98703
|
}] : [],
|
|
98113
98704
|
...extras
|
|
98114
98705
|
],
|
|
98115
|
-
category: climateCategoryFor(device.
|
|
98706
|
+
category: climateCategoryFor(device.role)
|
|
98116
98707
|
};
|
|
98117
98708
|
}
|
|
98118
98709
|
/** Amazon's `thermostatMode` for the state, or null while in a mode it lacks. */
|
|
@@ -99754,13 +100345,13 @@ async function applyCustom(c, deps, name) {
|
|
|
99754
100345
|
tags: { deviceId: c.deviceId },
|
|
99755
100346
|
meta: {
|
|
99756
100347
|
preset: preset.name,
|
|
99757
|
-
|
|
100348
|
+
fields: result.fields.length
|
|
99758
100349
|
}
|
|
99759
100350
|
});
|
|
99760
100351
|
return successResponse$1(c, []);
|
|
99761
100352
|
}
|
|
99762
|
-
const bad = result.
|
|
99763
|
-
const detail = bad === void 0 ? result.status :
|
|
100353
|
+
const bad = result.fields.find((f) => f.outcome === "failed" || f.outcome === "refused");
|
|
100354
|
+
const detail = bad === void 0 ? result.status : `${bad.field}: ${bad.message ?? bad.outcome}`;
|
|
99764
100355
|
deps.logger.warn("alexa fan-controller: custom preset did not fully apply", {
|
|
99765
100356
|
tags: { deviceId: c.deviceId },
|
|
99766
100357
|
meta: {
|
|
@@ -102727,18 +103318,17 @@ async function handleSetObjectDetectionClasses(header, endpoint, payloadRaw, ctx
|
|
|
102727
103318
|
}] }
|
|
102728
103319
|
};
|
|
102729
103320
|
}
|
|
102730
|
-
/** Device types this export may publish as a generic endpoint. `
|
|
102731
|
-
*
|
|
102732
|
-
*
|
|
103321
|
+
/** Device types this export may publish as a generic endpoint. A `climate`
|
|
103322
|
+
* device carries the `climate-control` cap (D874); its role picks THERMOSTAT
|
|
103323
|
+
* or AIR_CONDITIONER (D1033). A plug-in heater is a `switch` (role
|
|
103324
|
+
* `switch-heater`). */
|
|
102733
103325
|
var GENERIC_DEVICE_TYPES = [
|
|
102734
103326
|
"light",
|
|
102735
103327
|
"switch",
|
|
102736
|
-
"heater",
|
|
102737
103328
|
"siren",
|
|
102738
103329
|
"sensor",
|
|
102739
103330
|
"lock",
|
|
102740
103331
|
"presence",
|
|
102741
|
-
"thermostat",
|
|
102742
103332
|
"climate",
|
|
102743
103333
|
"cover",
|
|
102744
103334
|
"fan",
|
|
@@ -104414,6 +105004,21 @@ async function rotateBrokerCredential(fetchImpl, brokerUrl, credential) {
|
|
|
104414
105004
|
async function revokeBrokerCredential(fetchImpl, brokerUrl, credential) {
|
|
104415
105005
|
await call(fetchImpl, brokerUrl, "/broker/revoke", { bearer: credential }, unknown());
|
|
104416
105006
|
}
|
|
105007
|
+
function judgeTokenInstance(token, skill) {
|
|
105008
|
+
if (token.instanceId !== void 0) return oauthLinkServesInstance({ instanceId: token.instanceId }, skill.id, "export-alexa") ? { kind: "serves" } : {
|
|
105009
|
+
kind: "refused",
|
|
105010
|
+
reason: "token-instance-mismatch"
|
|
105011
|
+
};
|
|
105012
|
+
if (skill.id === "export-alexa") return { kind: "serves" };
|
|
105013
|
+
return skill.hasLinkedUser(token.userId) ? { kind: "serves" } : {
|
|
105014
|
+
kind: "refused",
|
|
105015
|
+
reason: "token-instance-unstated"
|
|
105016
|
+
};
|
|
105017
|
+
}
|
|
105018
|
+
/** The operator-facing sentence for a refusal, sent back to the Lambda and logged. */
|
|
105019
|
+
function describeTokenInstanceRefusal(reason) {
|
|
105020
|
+
return reason === "token-instance-mismatch" ? "the account was linked to another skill instance of this hub" : "the account link names no skill instance and this skill has not linked the account; update the skill Lambda and link again";
|
|
105021
|
+
}
|
|
104417
105022
|
//#endregion
|
|
104418
105023
|
//#region src/handlers/lwa-tokens-callback.ts
|
|
104419
105024
|
/**
|
|
@@ -104438,13 +105043,33 @@ async function revokeBrokerCredential(fetchImpl, brokerUrl, credential) {
|
|
|
104438
105043
|
var OauthVerifiedResultSchema$1 = object({
|
|
104439
105044
|
userId: string(),
|
|
104440
105045
|
username: string(),
|
|
104441
|
-
scopes: array(TokenScopeSchema)
|
|
105046
|
+
scopes: array(TokenScopeSchema),
|
|
105047
|
+
/** The instance the link was made for; absent = the default instance (D1047). */
|
|
105048
|
+
instanceId: string().optional()
|
|
104442
105049
|
}).nullable();
|
|
104443
105050
|
var LwaTokensCallbackBodySchema = object({
|
|
104444
105051
|
lwaAccessToken: string().min(1),
|
|
104445
105052
|
lwaRefreshToken: string().min(1),
|
|
104446
105053
|
expiresAt: number$1().int().nonnegative()
|
|
104447
105054
|
});
|
|
105055
|
+
/**
|
|
105056
|
+
* Refuse (403, logged with the reason) a caller whose token was linked to another instance.
|
|
105057
|
+
* True when the reply was sent; the caller must return.
|
|
105058
|
+
*/
|
|
105059
|
+
function refusedForInstance(caller, reply, deps, label) {
|
|
105060
|
+
const verdict = deps.judgeInstance(caller);
|
|
105061
|
+
if (verdict.kind === "serves") return false;
|
|
105062
|
+
deps.logger.warn(`${label}: refused — ${verdict.reason}`, { meta: {
|
|
105063
|
+
instanceId: deps.instanceId,
|
|
105064
|
+
tokenInstanceId: caller.instanceId ?? null,
|
|
105065
|
+
userId: caller.userId
|
|
105066
|
+
} });
|
|
105067
|
+
reply.code(403).send({
|
|
105068
|
+
error: verdict.reason,
|
|
105069
|
+
message: describeTokenInstanceRefusal(verdict.reason)
|
|
105070
|
+
});
|
|
105071
|
+
return true;
|
|
105072
|
+
}
|
|
104448
105073
|
async function handleLwaTokensCallback(request, reply, deps) {
|
|
104449
105074
|
const parsed = LwaTokensCallbackBodySchema.safeParse(request.body);
|
|
104450
105075
|
if (!parsed.success) {
|
|
@@ -104464,6 +105089,7 @@ async function handleLwaTokensCallback(request, reply, deps) {
|
|
|
104464
105089
|
});
|
|
104465
105090
|
return;
|
|
104466
105091
|
}
|
|
105092
|
+
if (refusedForInstance(caller, reply, deps, "alexa lwa-tokens-callback")) return;
|
|
104467
105093
|
const { userId, username } = caller;
|
|
104468
105094
|
await deps.upsertToken({
|
|
104469
105095
|
userId,
|
|
@@ -104490,10 +105116,14 @@ async function resolveCaller(request, deps) {
|
|
|
104490
105116
|
if (!bearer) return null;
|
|
104491
105117
|
const rawVerified = await deps.ctx.api.userManagement.oauthVerifyAccessToken.query({ token: bearer });
|
|
104492
105118
|
const verifiedParse = OauthVerifiedResultSchema$1.safeParse(rawVerified);
|
|
104493
|
-
if (verifiedParse.success && verifiedParse.data)
|
|
104494
|
-
userId
|
|
104495
|
-
|
|
104496
|
-
|
|
105119
|
+
if (verifiedParse.success && verifiedParse.data) {
|
|
105120
|
+
const { userId, username, instanceId } = verifiedParse.data;
|
|
105121
|
+
return {
|
|
105122
|
+
userId,
|
|
105123
|
+
username,
|
|
105124
|
+
...instanceId !== void 0 ? { instanceId } : {}
|
|
105125
|
+
};
|
|
105126
|
+
}
|
|
104497
105127
|
deps.logger.debug("alexa lwa-tokens-callback: bearer present but did not verify");
|
|
104498
105128
|
return null;
|
|
104499
105129
|
}
|
|
@@ -104566,6 +105196,7 @@ async function handleBrokerLinkCallback(request, reply, deps) {
|
|
|
104566
105196
|
});
|
|
104567
105197
|
return;
|
|
104568
105198
|
}
|
|
105199
|
+
if (refusedForInstance(caller, reply, deps, "alexa broker-link")) return;
|
|
104569
105200
|
await deps.upsertToken({
|
|
104570
105201
|
userId: caller.userId,
|
|
104571
105202
|
accessToken: body.lwaAccessToken,
|
|
@@ -104846,12 +105477,16 @@ async function handleSnapshotFetch(req, reply, deps) {
|
|
|
104846
105477
|
* we register via the `addon-routes` capability.
|
|
104847
105478
|
*
|
|
104848
105479
|
* Public URLs (assuming the hub is reachable as `https://<hub>`):
|
|
104849
|
-
* POST /addon/export-alexa/
|
|
104850
|
-
* POST /addon/export-alexa/oauth/broker-link
|
|
104851
|
-
* POST /addon/export-alexa/oauth/lwa-tokens
|
|
105480
|
+
* POST /addon/export-alexa[/instances/:instanceId]/directive
|
|
105481
|
+
* POST /addon/export-alexa[/instances/:instanceId]/oauth/broker-link (Lambda → hub, D753)
|
|
105482
|
+
* POST /addon/export-alexa[/instances/:instanceId]/oauth/lwa-tokens (Lambda → hub, pre-D753)
|
|
105483
|
+
*
|
|
105484
|
+
* The three are `perInstance` routes (D1046): the hub reads the instance segment. Without one
|
|
105485
|
+
* the skill is found by its ingress token, then falls back to the default skill
|
|
105486
|
+
* (`instance-routing.ts`). The same three with a trailing `/:instanceId` are the addresses a
|
|
105487
|
+
* Lambda built with `HUB_INSTANCE_ID` before D1046 still calls (planning#422); they stay.
|
|
104852
105488
|
*
|
|
104853
|
-
*
|
|
104854
|
-
* to the first skill (`instance-routing.ts`).
|
|
105489
|
+
* A token linked to another instance is refused (`token-instance.ts`, D1047).
|
|
104855
105490
|
*
|
|
104856
105491
|
* OAuth account-linking is handled by the core `/oauth2/*` server
|
|
104857
105492
|
* (integration=export-alexa). This addon registers an `oauth-integration`
|
|
@@ -104860,23 +105495,26 @@ async function handleSnapshotFetch(req, reply, deps) {
|
|
|
104860
105495
|
var OauthVerifiedResultSchema = object({
|
|
104861
105496
|
userId: string(),
|
|
104862
105497
|
username: string(),
|
|
104863
|
-
scopes: array(TokenScopeSchema)
|
|
105498
|
+
scopes: array(TokenScopeSchema),
|
|
105499
|
+
/** The instance the link was made for; absent = the default instance (D1047). */
|
|
105500
|
+
instanceId: string().optional()
|
|
104864
105501
|
}).nullable();
|
|
104865
105502
|
/** Header the D753 Lambda sends its broker origin on. */
|
|
104866
105503
|
var BROKER_HEADER = "x-camstack-broker";
|
|
104867
105504
|
function buildRoutes(deps) {
|
|
104868
105505
|
const forSkill = (description, path, handler) => [{
|
|
104869
105506
|
method: "POST",
|
|
104870
|
-
path
|
|
105507
|
+
path,
|
|
104871
105508
|
access: "public",
|
|
104872
|
-
|
|
104873
|
-
|
|
105509
|
+
perInstance: true,
|
|
105510
|
+
description: `${description} (the skill named by the instance segment; without one, the skill that presents its ingress token, else the default skill)`,
|
|
105511
|
+
handler: (req, reply) => routeToSkill(req, reply, deps, explicitInstance(req.instanceId), handler)
|
|
104874
105512
|
}, {
|
|
104875
105513
|
method: "POST",
|
|
104876
|
-
path
|
|
105514
|
+
path: `${path}/:instanceId`,
|
|
104877
105515
|
access: "public",
|
|
104878
|
-
description: `${description} (
|
|
104879
|
-
handler: (req, reply) => routeToSkill(req, reply, deps,
|
|
105516
|
+
description: `${description} (one skill, named after the path: the address older Lambdas call)`,
|
|
105517
|
+
handler: (req, reply) => routeToSkill(req, reply, deps, req.params["instanceId"], handler)
|
|
104880
105518
|
}];
|
|
104881
105519
|
return [
|
|
104882
105520
|
...forSkill("Alexa Smart Home directive ingress (forwarded by the user-owned Lambda)", "/directive", (req, reply, skill) => handleDirective(req, reply, deps, skill)),
|
|
@@ -104897,6 +105535,14 @@ function buildRoutes(deps) {
|
|
|
104897
105535
|
}
|
|
104898
105536
|
];
|
|
104899
105537
|
}
|
|
105538
|
+
/**
|
|
105539
|
+
* The instance a per-instance request names for the resolver. The default instance (no segment,
|
|
105540
|
+
* or the addon id) names none: its address is shared with a Lambda that finds its skill by the
|
|
105541
|
+
* ingress header (planning#422), so the resolver keeps that lookup for it.
|
|
105542
|
+
*/
|
|
105543
|
+
function explicitInstance(instanceId) {
|
|
105544
|
+
return instanceId === void 0 || instanceId === "export-alexa" ? void 0 : instanceId;
|
|
105545
|
+
}
|
|
104900
105546
|
/** Resolve the request's skill, or answer that there is none. */
|
|
104901
105547
|
async function routeToSkill(request, reply, deps, pathInstanceId, handler) {
|
|
104902
105548
|
const skill = deps.resolveSkill({
|
|
@@ -105009,6 +105655,19 @@ async function handleDirective(request, reply, deps, skill) {
|
|
|
105009
105655
|
reply.code(200).send(preParseErrorEnvelope("INVALID_AUTHORIZATION_CREDENTIAL", verdict.kind === "stale" ? "token was issued for another hub address; re-link the Alexa skill" : `hub has no public endpoint (${verdict.reason.code}); set it on the Network page`));
|
|
105010
105656
|
return;
|
|
105011
105657
|
}
|
|
105658
|
+
const instanceVerdict = judgeTokenInstance(verified, skill);
|
|
105659
|
+
if (instanceVerdict.kind === "refused") {
|
|
105660
|
+
deps.logger.warn(`alexa directive: refused — ${instanceVerdict.reason}`, {
|
|
105661
|
+
...arrival.deviceId !== void 0 ? { tags: { deviceId: arrival.deviceId } } : {},
|
|
105662
|
+
meta: {
|
|
105663
|
+
instanceId: skill.id,
|
|
105664
|
+
tokenInstanceId: verified.instanceId ?? null,
|
|
105665
|
+
userId: verified.userId
|
|
105666
|
+
}
|
|
105667
|
+
});
|
|
105668
|
+
reply.code(200).send(preParseErrorEnvelope("INVALID_AUTHORIZATION_CREDENTIAL", describeTokenInstanceRefusal(instanceVerdict.reason)));
|
|
105669
|
+
return;
|
|
105670
|
+
}
|
|
105012
105671
|
try {
|
|
105013
105672
|
assertDeviceScope(verified.scopes);
|
|
105014
105673
|
} catch {
|
|
@@ -105776,25 +106435,6 @@ var ADDON_MIGRATIONS = [
|
|
|
105776
106435
|
//#endregion
|
|
105777
106436
|
//#region src/oauth-integration.ts
|
|
105778
106437
|
/**
|
|
105779
|
-
* The `export-alexa` OAuth client — the descriptor behind
|
|
105780
|
-
* `/api/oauth2/authorize?integration=export-alexa`.
|
|
105781
|
-
*
|
|
105782
|
-
* Shaped deliberately like
|
|
105783
|
-
* `packages/addon-provider-homeassistant/src/ha-export/oauth-integration.ts`:
|
|
105784
|
-
* one named `OauthIntegrationDescriptor` per integration, in its own module,
|
|
105785
|
-
* registered from the addon's `onInitialize` through `oauthIntegrationCapability`
|
|
105786
|
-
* ([D101](../../../docs/decisions/adr-0101.md)). The two integrations differ
|
|
105787
|
-
* only in the FIELDS below, never in how they are declared — which is the whole
|
|
105788
|
-
* claim being made: a third one is configuration, not framework work.
|
|
105789
|
-
*
|
|
105790
|
-
* Typed rather than inlined, and that is not cosmetic. As an untyped object
|
|
105791
|
-
* literal this needed three `as const` assertions to satisfy the schema and was
|
|
105792
|
-
* checked for the first time at `/authorize`, i.e. in front of an operator
|
|
105793
|
-
* mid-link. The annotation moves that to compile time.
|
|
105794
|
-
*
|
|
105795
|
-
* @see docs/decisions/adr-0092.md — why `client_secret` is never checked here.
|
|
105796
|
-
*/
|
|
105797
|
-
/**
|
|
105798
106438
|
* Where Alexa lands after consent — Amazon's three regional account-linking
|
|
105799
106439
|
* origins, fixed and public. Contrast Home Assistant, whose callback is on the
|
|
105800
106440
|
* operator's own LAN and needs `allowedPrivateHostPaths`; that difference is
|
|
@@ -105830,7 +106470,7 @@ var ALEXA_REDIRECT_PREFIXES = [
|
|
|
105830
106470
|
* no `requiresPkce` here. That is a property of the two clients, expressed
|
|
105831
106471
|
* through the same descriptor field.
|
|
105832
106472
|
*/
|
|
105833
|
-
function buildAlexaOauthIntegration(publicOrigin) {
|
|
106473
|
+
function buildAlexaOauthIntegration(publicOrigin, instances = []) {
|
|
105834
106474
|
return {
|
|
105835
106475
|
integrationId: "export-alexa",
|
|
105836
106476
|
displayName: "Alexa Smart Home",
|
|
@@ -105867,7 +106507,8 @@ function buildAlexaOauthIntegration(publicOrigin) {
|
|
|
105867
106507
|
* "Unlink Amazon account" button does; see `unlinkAlexaAccounts`.
|
|
105868
106508
|
*/
|
|
105869
106509
|
refreshTokenTtlSec: "never",
|
|
105870
|
-
...publicOrigin ? { hubUrl: publicOrigin } : {}
|
|
106510
|
+
...publicOrigin ? { hubUrl: publicOrigin } : {},
|
|
106511
|
+
...instances.length > 0 ? { instances: [...instances] } : {}
|
|
105871
106512
|
};
|
|
105872
106513
|
}
|
|
105873
106514
|
//#endregion
|
|
@@ -109610,15 +110251,22 @@ var SkillRuntime = class {
|
|
|
109610
110251
|
}
|
|
109611
110252
|
/** The routes' view of this skill: what a directive or a Lambda callback acts on. */
|
|
109612
110253
|
routed() {
|
|
110254
|
+
const hasLinkedUser = (userId) => this.view.linkedAccounts.some((a) => a.userId === userId);
|
|
109613
110255
|
return {
|
|
109614
110256
|
id: this.instanceId,
|
|
109615
110257
|
getSettings: () => this.effectiveSettings(),
|
|
109616
110258
|
directiveDeps: this.directiveDeps(),
|
|
110259
|
+
hasLinkedUser,
|
|
109617
110260
|
lwaTokensCallbackDeps: {
|
|
109618
110261
|
ctx: this.ctx,
|
|
109619
110262
|
logger: this.ctx.logger,
|
|
109620
110263
|
upsertToken: (input) => this.upsertToken(input),
|
|
109621
|
-
recordLinkedAccount: (input) => this.recordLinkedAccount(input)
|
|
110264
|
+
recordLinkedAccount: (input) => this.recordLinkedAccount(input),
|
|
110265
|
+
instanceId: this.instanceId,
|
|
110266
|
+
judgeInstance: (caller) => judgeTokenInstance(caller, {
|
|
110267
|
+
id: this.instanceId,
|
|
110268
|
+
hasLinkedUser
|
|
110269
|
+
})
|
|
109622
110270
|
},
|
|
109623
110271
|
onBrokerAdvertised: (raw) => this.rememberAdvertisedBroker(raw)
|
|
109624
110272
|
};
|
|
@@ -110741,7 +111389,6 @@ var SUPPORTED_KINDS = [
|
|
|
110741
111389
|
DeviceType.Sensor,
|
|
110742
111390
|
DeviceType.Lock,
|
|
110743
111391
|
DeviceType.Presence,
|
|
110744
|
-
DeviceType.Thermostat,
|
|
110745
111392
|
DeviceType.Climate,
|
|
110746
111393
|
DeviceType.Cover,
|
|
110747
111394
|
DeviceType.Generic
|
|
@@ -110991,7 +111638,7 @@ var ExportAlexaAddon = class extends BaseAddon {
|
|
|
110991
111638
|
const oauthIntegrationProvider = { getDescriptor: async () => {
|
|
110992
111639
|
const endpoint = await this.publicEndpoint();
|
|
110993
111640
|
if (!endpoint.ok) this.ctx.logger.warn(`export-alexa: linking without a routing claim — ${endpoint.reason.code}: ${endpoint.reason.message}`);
|
|
110994
|
-
return buildAlexaOauthIntegration(endpoint.ok ? endpoint.origin : void 0);
|
|
111641
|
+
return buildAlexaOauthIntegration(endpoint.ok ? endpoint.origin : void 0, this.linkableInstances());
|
|
110995
111642
|
} };
|
|
110996
111643
|
const reaper = setInterval(() => {
|
|
110997
111644
|
this.reapDeadEgressHandles();
|
|
@@ -111039,6 +111686,13 @@ var ExportAlexaAddon = class extends BaseAddon {
|
|
|
111039
111686
|
async onConfigChanged() {
|
|
111040
111687
|
for (const runtime of this.runtimes.values()) await runtime.applyShapeSwitches();
|
|
111041
111688
|
}
|
|
111689
|
+
/** The running skills an account may be linked to with `instance=` (all but the default). */
|
|
111690
|
+
linkableInstances() {
|
|
111691
|
+
return [...this.runtimes.values()].filter((r) => !r.isDefault).map((r) => ({
|
|
111692
|
+
id: r.instanceId,
|
|
111693
|
+
displayName: r.skillName
|
|
111694
|
+
}));
|
|
111695
|
+
}
|
|
111042
111696
|
/** Build and start the runtime of one skill. */
|
|
111043
111697
|
async startRuntime(instanceId) {
|
|
111044
111698
|
const runtime = new SkillRuntime(instanceId, this.host());
|