@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
|
@@ -837,7 +837,7 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
|
837
837
|
return EventCategory;
|
|
838
838
|
}({});
|
|
839
839
|
//#endregion
|
|
840
|
-
//#region ../types/dist/composed-stable-id-
|
|
840
|
+
//#region ../types/dist/composed-stable-id-CPp3votu.mjs
|
|
841
841
|
/**
|
|
842
842
|
import { errMsg } from '@camstack/types'
|
|
843
843
|
* Extract a human-readable message from an unknown error value.
|
|
@@ -850,17 +850,18 @@ function errMsg$1(err) {
|
|
|
850
850
|
}
|
|
851
851
|
var DeviceType = /* @__PURE__ */ function(DeviceType) {
|
|
852
852
|
DeviceType["Camera"] = "camera";
|
|
853
|
+
/** Legacy stored value, read only by the hub-to-integration migrations; no live device carries it. */
|
|
853
854
|
DeviceType["Hub"] = "hub";
|
|
854
855
|
DeviceType["Light"] = "light";
|
|
855
856
|
DeviceType["Siren"] = "siren";
|
|
856
857
|
DeviceType["Switch"] = "switch";
|
|
857
858
|
DeviceType["Sensor"] = "sensor";
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
* `climate-control`
|
|
861
|
-
*
|
|
862
|
-
*
|
|
863
|
-
*
|
|
859
|
+
/** Every climate device: an air conditioner, a room thermostat, a radiator
|
|
860
|
+
* valve, a floor-heating zone, a heat-pump circuit. They share one set of
|
|
861
|
+
* controls (`climate-control`), so they are one type; WHICH kind of climate
|
|
862
|
+
* device it is is its {@link DeviceRole} (`climate-*`), which the UI and the
|
|
863
|
+
* exports branch on. The retired `thermostat` type is read as this one
|
|
864
|
+
* (`canonicalStoredDeviceType`). */
|
|
864
865
|
DeviceType["Climate"] = "climate";
|
|
865
866
|
DeviceType["Button"] = "button";
|
|
866
867
|
/** Generic stateless event emitter — carries a device's EXACT declared
|
|
@@ -951,10 +952,6 @@ var DeviceType = /* @__PURE__ */ function(DeviceType) {
|
|
|
951
952
|
/** Washing machine. A plug-built one is running while its power stays
|
|
952
953
|
* above a threshold. No program cap — that surface is the dishwasher's. */
|
|
953
954
|
DeviceType["Washer"] = "washer";
|
|
954
|
-
/** A dumb plug-in stove or heater: a switch (and, with a meter, a power
|
|
955
|
-
* reading) that only runs while the plug is on. Built from a smart plug;
|
|
956
|
-
* the `timed-run` cap switches it off again after a chosen time. */
|
|
957
|
-
DeviceType["Heater"] = "heater";
|
|
958
955
|
/** Tumble dryer. Same plug-built running surface as {@link Washer}. */
|
|
959
956
|
DeviceType["Dryer"] = "dryer";
|
|
960
957
|
/** The physical bridge box of a vendor ecosystem (Velux KLF-200, and later
|
|
@@ -1174,6 +1171,27 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
|
|
|
1174
1171
|
/** A smart plug: a `switch` whose source says it is an outlet (HA
|
|
1175
1172
|
* `device_class: outlet`). The Alexa export shows it as a SMARTPLUG. */
|
|
1176
1173
|
DeviceRole["Outlet"] = "outlet";
|
|
1174
|
+
/** A dumb plug-in stove or heater behind a switch: it runs only while the
|
|
1175
|
+
* switch is on. Offered `timed-run`, which switches it off again after a
|
|
1176
|
+
* chosen time. */
|
|
1177
|
+
DeviceRole["SwitchHeater"] = "switch-heater";
|
|
1178
|
+
/** A plain fan behind a switch (a smart plug powering it): drawn as a fan,
|
|
1179
|
+
* with the switch's on/off only. Speed or oscillation appear only when the
|
|
1180
|
+
* device also has a fan cap (D1033). */
|
|
1181
|
+
DeviceRole["SwitchFan"] = "switch-fan";
|
|
1182
|
+
/** Air conditioner / split unit: cooling, fan speed, louvres. */
|
|
1183
|
+
DeviceRole["ClimateAc"] = "climate-ac";
|
|
1184
|
+
/** Room thermostat: a setpoint and a room temperature. The default. */
|
|
1185
|
+
DeviceRole["ClimateThermostat"] = "climate-thermostat";
|
|
1186
|
+
/** Floor-heating zone actuator. */
|
|
1187
|
+
DeviceRole["ClimateFloor"] = "climate-floor";
|
|
1188
|
+
/** Radiator valve (thermostatic radiator head). */
|
|
1189
|
+
DeviceRole["ClimateRadiator"] = "climate-radiator";
|
|
1190
|
+
/** A heater with its own thermostat (stove, convector). */
|
|
1191
|
+
DeviceRole["ClimateHeater"] = "climate-heater";
|
|
1192
|
+
/** One heating/cooling circuit of a heat pump: a water loop with comfort /
|
|
1193
|
+
* eco setpoints and a heat/cool mode, no room sensor. */
|
|
1194
|
+
DeviceRole["ClimateHeatPumpCircuit"] = "climate-heat-pump-circuit";
|
|
1177
1195
|
/** Generic motion / occupancy / moving event source. Distinct from
|
|
1178
1196
|
* the camera accessory PirSensor role: that one is a camera child;
|
|
1179
1197
|
* this is a standalone HA / 3rd-party motion sensor. */
|
|
@@ -6061,7 +6079,7 @@ var ZodIssueCode = {
|
|
|
6061
6079
|
var ZodFirstPartyTypeKind;
|
|
6062
6080
|
ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
|
|
6063
6081
|
//#endregion
|
|
6064
|
-
//#region ../types/dist/sleep-
|
|
6082
|
+
//#region ../types/dist/sleep-D0roI_CZ.mjs
|
|
6065
6083
|
/**
|
|
6066
6084
|
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
6067
6085
|
* window to float samples (D455).
|
|
@@ -11750,6 +11768,50 @@ var ACTUATOR_CAP_VOCABULARY = {
|
|
|
11750
11768
|
value: false
|
|
11751
11769
|
},
|
|
11752
11770
|
args: { oscillating: false }
|
|
11771
|
+
},
|
|
11772
|
+
{
|
|
11773
|
+
id: "fan.horizontalOscillateOn",
|
|
11774
|
+
method: "setOscillationAxis",
|
|
11775
|
+
label: t("Horizontal oscillation on", "Oscillazione orizzontale attiva"),
|
|
11776
|
+
phrase: t("Start the horizontal oscillation of {device}", "Attiva l’oscillazione orizzontale di {device}"),
|
|
11777
|
+
icon: "move-horizontal",
|
|
11778
|
+
args: {
|
|
11779
|
+
axis: "horizontal",
|
|
11780
|
+
oscillating: true
|
|
11781
|
+
}
|
|
11782
|
+
},
|
|
11783
|
+
{
|
|
11784
|
+
id: "fan.horizontalOscillateOff",
|
|
11785
|
+
method: "setOscillationAxis",
|
|
11786
|
+
label: t("Horizontal oscillation off", "Oscillazione orizzontale spenta"),
|
|
11787
|
+
phrase: t("Stop the horizontal oscillation of {device}", "Ferma l’oscillazione orizzontale di {device}"),
|
|
11788
|
+
icon: "move-horizontal",
|
|
11789
|
+
args: {
|
|
11790
|
+
axis: "horizontal",
|
|
11791
|
+
oscillating: false
|
|
11792
|
+
}
|
|
11793
|
+
},
|
|
11794
|
+
{
|
|
11795
|
+
id: "fan.verticalOscillateOn",
|
|
11796
|
+
method: "setOscillationAxis",
|
|
11797
|
+
label: t("Vertical oscillation on", "Oscillazione verticale attiva"),
|
|
11798
|
+
phrase: t("Start the vertical oscillation of {device}", "Attiva l’oscillazione verticale di {device}"),
|
|
11799
|
+
icon: "move-vertical",
|
|
11800
|
+
args: {
|
|
11801
|
+
axis: "vertical",
|
|
11802
|
+
oscillating: true
|
|
11803
|
+
}
|
|
11804
|
+
},
|
|
11805
|
+
{
|
|
11806
|
+
id: "fan.verticalOscillateOff",
|
|
11807
|
+
method: "setOscillationAxis",
|
|
11808
|
+
label: t("Vertical oscillation off", "Oscillazione verticale spenta"),
|
|
11809
|
+
phrase: t("Stop the vertical oscillation of {device}", "Ferma l’oscillazione verticale di {device}"),
|
|
11810
|
+
icon: "move-vertical",
|
|
11811
|
+
args: {
|
|
11812
|
+
axis: "vertical",
|
|
11813
|
+
oscillating: false
|
|
11814
|
+
}
|
|
11753
11815
|
}
|
|
11754
11816
|
],
|
|
11755
11817
|
state: [{
|
|
@@ -13839,10 +13901,6 @@ var CAMERA_CAP_VOCABULARY = {
|
|
|
13839
13901
|
scope: "device",
|
|
13840
13902
|
noun: t("Admin link", "Link di amministrazione")
|
|
13841
13903
|
},
|
|
13842
|
-
"device-discovery": {
|
|
13843
|
-
scope: "device",
|
|
13844
|
-
noun: t("Discovery", "Rilevamento dispositivi")
|
|
13845
|
-
},
|
|
13846
13904
|
"device-extension": {
|
|
13847
13905
|
scope: "device",
|
|
13848
13906
|
noun: t("Device extension", "Estensione del dispositivo")
|
|
@@ -15322,7 +15380,6 @@ var CAP_NAMES = Object.freeze([
|
|
|
15322
15380
|
"device-admin-link",
|
|
15323
15381
|
"device-adoption",
|
|
15324
15382
|
"device-credentials",
|
|
15325
|
-
"device-discovery",
|
|
15326
15383
|
"device-export",
|
|
15327
15384
|
"device-extension",
|
|
15328
15385
|
"device-history",
|
|
@@ -15944,13 +16001,6 @@ Object.freeze({
|
|
|
15944
16001
|
"valueType": "string"
|
|
15945
16002
|
}
|
|
15946
16003
|
],
|
|
15947
|
-
"device-discovery": [{
|
|
15948
|
-
"path": "lastDiscoveryAt",
|
|
15949
|
-
"valueType": "number"
|
|
15950
|
-
}, {
|
|
15951
|
-
"path": "lastError",
|
|
15952
|
-
"valueType": "string"
|
|
15953
|
-
}],
|
|
15954
16004
|
"device-export": [
|
|
15955
16005
|
{
|
|
15956
16006
|
"path": "linkState",
|
|
@@ -16139,6 +16189,10 @@ Object.freeze({
|
|
|
16139
16189
|
"path": "lastEvent.eventType",
|
|
16140
16190
|
"valueType": "string"
|
|
16141
16191
|
},
|
|
16192
|
+
{
|
|
16193
|
+
"path": "lastEvent.sourceId",
|
|
16194
|
+
"valueType": "string"
|
|
16195
|
+
},
|
|
16142
16196
|
{
|
|
16143
16197
|
"path": "lastEvent.timestamp",
|
|
16144
16198
|
"valueType": "number"
|
|
@@ -17402,7 +17456,7 @@ Object.freeze({
|
|
|
17402
17456
|
}
|
|
17403
17457
|
});
|
|
17404
17458
|
//#endregion
|
|
17405
|
-
//#region ../types/dist/implemented-methods-
|
|
17459
|
+
//#region ../types/dist/implemented-methods-5YMDeE3f.mjs
|
|
17406
17460
|
/**
|
|
17407
17461
|
* The ffmpeg build every CamStack node downloads, per platform and arch.
|
|
17408
17462
|
*
|
|
@@ -19159,6 +19213,7 @@ function buildAddonRouteProvider(id, routes) {
|
|
|
19159
19213
|
query: input.query,
|
|
19160
19214
|
body: input.body,
|
|
19161
19215
|
headers: input.headers,
|
|
19216
|
+
...match.route.perInstance === true && input.instanceId !== void 0 ? { instanceId: input.instanceId } : {},
|
|
19162
19217
|
...input.user ? { user: input.user } : {},
|
|
19163
19218
|
...input.scopedToken !== void 0 ? { scopedToken: input.scopedToken } : {}
|
|
19164
19219
|
};
|
|
@@ -19226,6 +19281,18 @@ function buildCapturingReply(envelope) {
|
|
|
19226
19281
|
};
|
|
19227
19282
|
return wrapper;
|
|
19228
19283
|
}
|
|
19284
|
+
/** The instance a link was made for, with the default one spelled as the addon id. */
|
|
19285
|
+
function oauthLinkInstanceId(link, addonId) {
|
|
19286
|
+
return link.instanceId ?? addonId;
|
|
19287
|
+
}
|
|
19288
|
+
/**
|
|
19289
|
+
* True when a verified link may be used on a request addressed to
|
|
19290
|
+
* `requestInstanceId` (`AddonHttpRequest.instanceId`, absent on a route that
|
|
19291
|
+
* is not per-instance, which is the default instance).
|
|
19292
|
+
*/
|
|
19293
|
+
function oauthLinkServesInstance(link, requestInstanceId, addonId) {
|
|
19294
|
+
return oauthLinkInstanceId(link, addonId) === (requestInstanceId ?? addonId);
|
|
19295
|
+
}
|
|
19229
19296
|
/**
|
|
19230
19297
|
* notification-output — canonical, capability-gated notification delivery.
|
|
19231
19298
|
*
|
|
@@ -44014,6 +44081,41 @@ function macroOnly(macro) {
|
|
|
44014
44081
|
};
|
|
44015
44082
|
}
|
|
44016
44083
|
}
|
|
44084
|
+
var EventVocabularyKindSchema = _enum([
|
|
44085
|
+
"press",
|
|
44086
|
+
"long-press",
|
|
44087
|
+
"long-press-start",
|
|
44088
|
+
"release",
|
|
44089
|
+
"repeat",
|
|
44090
|
+
"double-press",
|
|
44091
|
+
"other"
|
|
44092
|
+
]);
|
|
44093
|
+
/** The part of the device an event comes from: a button, a channel. */
|
|
44094
|
+
var EventVocabularySourceSchema = object({
|
|
44095
|
+
id: string().min(1),
|
|
44096
|
+
label: string().min(1)
|
|
44097
|
+
});
|
|
44098
|
+
/** One scalar field of an event's `data`, by dotted path. */
|
|
44099
|
+
var EventVocabularyFieldSchema = object({
|
|
44100
|
+
path: string().min(1),
|
|
44101
|
+
kind: _enum([
|
|
44102
|
+
"string",
|
|
44103
|
+
"number",
|
|
44104
|
+
"boolean",
|
|
44105
|
+
"enum"
|
|
44106
|
+
]),
|
|
44107
|
+
enumValues: array(string()).optional(),
|
|
44108
|
+
label: string().min(1).optional()
|
|
44109
|
+
});
|
|
44110
|
+
var EventVocabularyEntrySchema = object({
|
|
44111
|
+
/** The native token, verbatim. */
|
|
44112
|
+
id: string().min(1),
|
|
44113
|
+
source: EventVocabularySourceSchema.optional(),
|
|
44114
|
+
label: string().min(1),
|
|
44115
|
+
description: string().optional(),
|
|
44116
|
+
kind: EventVocabularyKindSchema.optional(),
|
|
44117
|
+
payload: array(EventVocabularyFieldSchema).optional()
|
|
44118
|
+
});
|
|
44017
44119
|
Math.PI / 180;
|
|
44018
44120
|
/**
|
|
44019
44121
|
* WHEN something happens, as data (D983) — the one time vocabulary of the
|
|
@@ -44135,6 +44237,13 @@ var AutomationConditionOperatorSchema = _enum([
|
|
|
44135
44237
|
"in"
|
|
44136
44238
|
]);
|
|
44137
44239
|
/**
|
|
44240
|
+
* The stable name of an event leaf. A path (`when.0.1`) moves when a row is
|
|
44241
|
+
* reordered; the id does not, so a `triggered-by` leaf keeps pointing at the
|
|
44242
|
+
* same row. Optional: a leaf nothing refers to needs none.
|
|
44243
|
+
*/
|
|
44244
|
+
var EVENT_LEAF_ID_RE = /^[A-Za-z0-9_-]{1,40}$/;
|
|
44245
|
+
var eventLeafId = { id: string().regex(EVENT_LEAF_ID_RE).optional() };
|
|
44246
|
+
/**
|
|
44138
44247
|
* D8 compliance, and it is the reason a "becomes" leaf is not merely an event
|
|
44139
44248
|
* subscription: it evaluates against the **state mirror**, which is reconciled,
|
|
44140
44249
|
* and an event only WAKES the evaluation. A dropped event therefore DELAYS a
|
|
@@ -44142,6 +44251,7 @@ var AutomationConditionOperatorSchema = _enum([
|
|
|
44142
44251
|
*/
|
|
44143
44252
|
var DeviceBecomesLeafSchema = object({
|
|
44144
44253
|
kind: literal("device-becomes"),
|
|
44254
|
+
...eventLeafId,
|
|
44145
44255
|
deviceId: number$1().int().nonnegative(),
|
|
44146
44256
|
cap: string().min(1),
|
|
44147
44257
|
fieldPath: string().min(1),
|
|
@@ -44194,6 +44304,7 @@ var DeviceBecomesLeafSchema = object({
|
|
|
44194
44304
|
});
|
|
44195
44305
|
var DeviceEventLeafSchema = object({
|
|
44196
44306
|
kind: literal("device-event"),
|
|
44307
|
+
...eventLeafId,
|
|
44197
44308
|
/** An `EventCategory` value. */
|
|
44198
44309
|
category: string().min(1),
|
|
44199
44310
|
deviceId: number$1().int().nonnegative().optional()
|
|
@@ -44206,18 +44317,51 @@ var DeviceEventLeafSchema = object({
|
|
|
44206
44317
|
*/
|
|
44207
44318
|
var ScheduleLeafSchema = object({
|
|
44208
44319
|
kind: literal("schedule"),
|
|
44320
|
+
...eventLeafId,
|
|
44209
44321
|
at: TimeSpecSchema.optional(),
|
|
44210
44322
|
days: array(WeekdayKeySchema).min(1).max(7).optional(),
|
|
44211
44323
|
/** @deprecated legacy cron — new schedules use `at`. */
|
|
44212
44324
|
cron: string().min(1).max(120).optional()
|
|
44213
44325
|
}).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" });
|
|
44214
|
-
|
|
44326
|
+
/**
|
|
44327
|
+
* One payload predicate of a `device-fired` row: the value at `path` inside
|
|
44328
|
+
* the fire's `data` (dotted) equals `equals`. Compared strictly, no coercion.
|
|
44329
|
+
*/
|
|
44330
|
+
var DeviceFiredMatchSchema = object({
|
|
44331
|
+
path: string().min(1).max(120),
|
|
44332
|
+
equals: union([
|
|
44333
|
+
string(),
|
|
44334
|
+
number$1(),
|
|
44335
|
+
boolean()
|
|
44336
|
+
])
|
|
44337
|
+
});
|
|
44338
|
+
/**
|
|
44339
|
+
* "fires": one device of the `event-emitter` capability reported an event
|
|
44340
|
+
* (D1045). Every list is an OR, the lists together an AND; an absent list does
|
|
44341
|
+
* not narrow. `eventIds` are the device's own tokens, `sourceIds` the parts of
|
|
44342
|
+
* the device (a button), `kinds` the shared press kinds of its vocabulary.
|
|
44343
|
+
*/
|
|
44344
|
+
var DeviceFiredLeafSchema = object({
|
|
44345
|
+
kind: literal("device-fired"),
|
|
44346
|
+
...eventLeafId,
|
|
44347
|
+
deviceId: number$1().int().nonnegative(),
|
|
44348
|
+
eventIds: array(string().min(1)).min(1).max(64).optional(),
|
|
44349
|
+
sourceIds: array(string().min(1)).min(1).max(64).optional(),
|
|
44350
|
+
kinds: array(EventVocabularyKindSchema).min(1).optional(),
|
|
44351
|
+
match: array(DeviceFiredMatchSchema).min(1).max(8).optional()
|
|
44352
|
+
});
|
|
44353
|
+
var ManualLeafSchema = object({
|
|
44354
|
+
kind: literal("manual"),
|
|
44355
|
+
...eventLeafId
|
|
44356
|
+
});
|
|
44215
44357
|
var IntervalLeafSchema = object({
|
|
44216
44358
|
kind: literal("interval"),
|
|
44359
|
+
...eventLeafId,
|
|
44217
44360
|
minutes: number$1().int().min(1).max(1440)
|
|
44218
44361
|
});
|
|
44219
44362
|
var DetectionLeafSchema = object({
|
|
44220
44363
|
kind: literal("detection"),
|
|
44364
|
+
...eventLeafId,
|
|
44221
44365
|
/** One macro class each, optionally narrowed by a label; a track of any listed subject fires. */
|
|
44222
44366
|
subjects: array(DetectionSubjectSchema).min(1),
|
|
44223
44367
|
deviceIds: array(number$1().int().nonnegative()).min(1),
|
|
@@ -44228,6 +44372,7 @@ var DetectionLeafSchema = object({
|
|
|
44228
44372
|
});
|
|
44229
44373
|
var StationaryLeafSchema = object({
|
|
44230
44374
|
kind: literal("stationary"),
|
|
44375
|
+
...eventLeafId,
|
|
44231
44376
|
deviceIds: array(number$1().int().nonnegative()).min(1),
|
|
44232
44377
|
subjects: array(StationarySubjectSchema).min(1).optional(),
|
|
44233
44378
|
zones: array(string().min(1)).min(1).optional(),
|
|
@@ -44273,6 +44418,41 @@ var StationaryPresentLeafSchema = object({
|
|
|
44273
44418
|
minCount: number$1().int().positive().optional()
|
|
44274
44419
|
});
|
|
44275
44420
|
/**
|
|
44421
|
+
* True while the site-local clock is inside a daily window and/or on one of
|
|
44422
|
+
* the named days. `days` names the local day a window STARTS on, so
|
|
44423
|
+
* 22:00-06:00 on weekdays is still inside at 01:00 Saturday. A one-date spec
|
|
44424
|
+
* (`kind: 'date'`) is refused: only a clock time or a sun event makes a window
|
|
44425
|
+
* that repeats every day.
|
|
44426
|
+
*/
|
|
44427
|
+
var TimeIsLeafSchema = object({
|
|
44428
|
+
kind: literal("time-is"),
|
|
44429
|
+
between: object({
|
|
44430
|
+
from: TimeSpecSchema,
|
|
44431
|
+
to: TimeSpecSchema
|
|
44432
|
+
}).optional(),
|
|
44433
|
+
days: array(WeekdayKeySchema).min(1).max(7).optional()
|
|
44434
|
+
}).superRefine((leaf, ctx) => {
|
|
44435
|
+
if (leaf.between === void 0 && leaf.days === void 0) ctx.addIssue({
|
|
44436
|
+
code: "custom",
|
|
44437
|
+
message: "a time-is leaf needs a between window, days, or both"
|
|
44438
|
+
});
|
|
44439
|
+
for (const end of ["from", "to"]) if (leaf.between?.[end].kind === "date") ctx.addIssue({
|
|
44440
|
+
code: "custom",
|
|
44441
|
+
message: "a one-date time cannot bound a daily window: use a clock time or a sun event",
|
|
44442
|
+
path: ["between", end]
|
|
44443
|
+
});
|
|
44444
|
+
});
|
|
44445
|
+
/**
|
|
44446
|
+
* True for the run that one of the named event leaves started. It reads the
|
|
44447
|
+
* run, not a device: in the tree it is judged against the leaf that fired, in
|
|
44448
|
+
* a step guard against the trigger the run carries. A run no event leaf
|
|
44449
|
+
* started (a state-only tree becoming true) is false.
|
|
44450
|
+
*/
|
|
44451
|
+
var TriggeredByLeafSchema = object({
|
|
44452
|
+
kind: literal("triggered-by"),
|
|
44453
|
+
leafIds: array(string().regex(EVENT_LEAF_ID_RE)).min(1).max(20)
|
|
44454
|
+
});
|
|
44455
|
+
/**
|
|
44276
44456
|
* The escape hatch: the bounded expression engine over named device bindings.
|
|
44277
44457
|
* Declared as a plain object so a discriminated union can read `kind`; the
|
|
44278
44458
|
* author-time validation is the SAME function `ExpressionSourceSchema` runs.
|
|
@@ -44311,6 +44491,7 @@ var AutomationWhenSchema = lazy(() => discriminatedUnion("kind", [
|
|
|
44311
44491
|
}),
|
|
44312
44492
|
DeviceBecomesLeafSchema,
|
|
44313
44493
|
DeviceEventLeafSchema,
|
|
44494
|
+
DeviceFiredLeafSchema,
|
|
44314
44495
|
ScheduleLeafSchema,
|
|
44315
44496
|
ManualLeafSchema,
|
|
44316
44497
|
IntervalLeafSchema,
|
|
@@ -44318,11 +44499,14 @@ var AutomationWhenSchema = lazy(() => discriminatedUnion("kind", [
|
|
|
44318
44499
|
StationaryLeafSchema,
|
|
44319
44500
|
DeviceIsLeafSchema,
|
|
44320
44501
|
StationaryPresentLeafSchema,
|
|
44321
|
-
ExpressionLeafSchema
|
|
44502
|
+
ExpressionLeafSchema,
|
|
44503
|
+
TimeIsLeafSchema,
|
|
44504
|
+
TriggeredByLeafSchema
|
|
44322
44505
|
]));
|
|
44323
44506
|
var EVENT_KINDS = new Set([
|
|
44324
44507
|
"device-becomes",
|
|
44325
44508
|
"device-event",
|
|
44509
|
+
"device-fired",
|
|
44326
44510
|
"schedule",
|
|
44327
44511
|
"manual",
|
|
44328
44512
|
"interval",
|
|
@@ -44372,6 +44556,28 @@ function hasEventLeaves(node) {
|
|
|
44372
44556
|
});
|
|
44373
44557
|
return found;
|
|
44374
44558
|
}
|
|
44559
|
+
/** The event leaves of the tree that carry an id, in tree order. */
|
|
44560
|
+
function identifiedEventLeaves(when) {
|
|
44561
|
+
const found = [];
|
|
44562
|
+
forEachLeaf(when, (leaf, path) => {
|
|
44563
|
+
if (isEventLeaf(leaf) && leaf.id !== void 0) found.push({
|
|
44564
|
+
id: leaf.id,
|
|
44565
|
+
path,
|
|
44566
|
+
leaf
|
|
44567
|
+
});
|
|
44568
|
+
});
|
|
44569
|
+
return found;
|
|
44570
|
+
}
|
|
44571
|
+
/** Does the tree hold a `triggered-by` leaf? */
|
|
44572
|
+
function hasTriggeredByLeaves(when) {
|
|
44573
|
+
let found = false;
|
|
44574
|
+
forEachLeaf(when, (leaf) => {
|
|
44575
|
+
if (leaf.kind === "triggered-by") found = true;
|
|
44576
|
+
});
|
|
44577
|
+
return found;
|
|
44578
|
+
}
|
|
44579
|
+
/** Why a `triggered-by` leaf is refused outside an automation: there is no trigger row to name. */
|
|
44580
|
+
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";
|
|
44375
44581
|
function hasEmptyContainer(node) {
|
|
44376
44582
|
if (isLeaf(node)) return false;
|
|
44377
44583
|
if (node.kind === "not") return hasEmptyContainer(node.child);
|
|
@@ -44381,6 +44587,7 @@ function hasEmptyContainer(node) {
|
|
|
44381
44587
|
var LEAF_WORDS = {
|
|
44382
44588
|
"device-becomes": "a device value that becomes",
|
|
44383
44589
|
"device-event": "a device event",
|
|
44590
|
+
"device-fired": "a device firing an event",
|
|
44384
44591
|
schedule: "a schedule",
|
|
44385
44592
|
manual: "a manual run",
|
|
44386
44593
|
interval: "an interval",
|
|
@@ -44430,6 +44637,11 @@ function validateWhenTree(when) {
|
|
|
44430
44637
|
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`;
|
|
44431
44638
|
const leaves = countWhenLeaves(when);
|
|
44432
44639
|
if (leaves > 32) return `the rules use ${leaves} rows — the limit is 32`;
|
|
44640
|
+
const seen = /* @__PURE__ */ new Set();
|
|
44641
|
+
for (const entry of identifiedEventLeaves(when)) {
|
|
44642
|
+
if (seen.has(entry.id)) return `two trigger rows share the id "${entry.id}" — an id names one row`;
|
|
44643
|
+
seen.add(entry.id);
|
|
44644
|
+
}
|
|
44433
44645
|
const need = eventNeed(when, "when", false);
|
|
44434
44646
|
if ("error" in need) return need.error;
|
|
44435
44647
|
const [first, second] = need.paths;
|
|
@@ -44641,9 +44853,12 @@ function convertLegacyWhen(half) {
|
|
|
44641
44853
|
* every caller — automations, Actions, and the notification centre, which runs
|
|
44642
44854
|
* only Actions (planning#473).
|
|
44643
44855
|
*/
|
|
44856
|
+
/** The longest one `wait` step lasts. It is cut by a restart of the run and does not survive a hub restart. */
|
|
44857
|
+
var WAIT_MAX_SECONDS = 3600;
|
|
44858
|
+
var WAIT_TOO_LONG = `a wait is at most one hour (${WAIT_MAX_SECONDS} s)`;
|
|
44644
44859
|
var AutomationWaitStepSchema = object({
|
|
44645
44860
|
kind: literal("wait"),
|
|
44646
|
-
seconds: number$1().min(0).max(
|
|
44861
|
+
seconds: number$1().min(0).max(WAIT_MAX_SECONDS, WAIT_TOO_LONG)
|
|
44647
44862
|
});
|
|
44648
44863
|
/** The legacy `deviceId` of a cap step: still READ, never written (D983). */
|
|
44649
44864
|
var LegacyStepDeviceSchema = union([
|
|
@@ -44713,28 +44928,227 @@ var elseNeedsIf = {
|
|
|
44713
44928
|
path: ["else"]
|
|
44714
44929
|
};
|
|
44715
44930
|
var GuardedWaitStepSchema = AutomationWaitStepSchema.extend(stepGuardShape).refine((step) => step.else === void 0 || step.if !== void 0, elseNeedsIf);
|
|
44716
|
-
|
|
44931
|
+
/**
|
|
44932
|
+
* A step of a STANDALONE list (an action, a scheduler point, a preset): the
|
|
44933
|
+
* same two step kinds an automation runs, minus a guard that reads the
|
|
44934
|
+
* automation's trigger, which such a list does not have.
|
|
44935
|
+
*/
|
|
44936
|
+
var ActionStepSchema = discriminatedUnion("kind", [GuardedWaitStepSchema, AutomationCapStepBaseSchema.extend(stepGuardShape).refine((step) => step.target !== void 0 || step.deviceId !== void 0, {
|
|
44937
|
+
message: "a cap step needs a target",
|
|
44938
|
+
path: ["target"]
|
|
44939
|
+
}).refine((step) => step.target?.kind !== "domain" || step.actionId !== void 0, {
|
|
44940
|
+
message: "a domain target needs the vocabulary action it applies to (actionId)",
|
|
44941
|
+
path: ["actionId"]
|
|
44942
|
+
}).refine((step) => step.else === void 0 || step.if !== void 0, elseNeedsIf)]).superRefine((step, ctx) => {
|
|
44943
|
+
if (step.if !== void 0 && hasTriggeredByLeaves(step.if)) ctx.addIssue({
|
|
44944
|
+
code: "custom",
|
|
44945
|
+
message: TRIGGERED_BY_NEEDS_AUTOMATION,
|
|
44946
|
+
path: ["if"]
|
|
44947
|
+
});
|
|
44948
|
+
});
|
|
44949
|
+
/**
|
|
44950
|
+
* Flow control of an AUTOMATION's list (#500). A standalone list (an action, a
|
|
44951
|
+
* scheduler point, a preset) stays `wait` and `cap`: it has no run of its own
|
|
44952
|
+
* to end and no variable bag to write.
|
|
44953
|
+
*/
|
|
44954
|
+
var continueOnErrorShape = {
|
|
44955
|
+
/** A failure of this step is traced `failed-continued` and the next step runs. */
|
|
44956
|
+
continueOnError: literal(true).optional() };
|
|
44957
|
+
/** An automation's cap step: the shared guarded cap step, plus `continueOnError`. */
|
|
44958
|
+
var AutomationGuardedCapStepSchema = AutomationCapStepBaseSchema.extend({
|
|
44959
|
+
...stepGuardShape,
|
|
44960
|
+
...continueOnErrorShape
|
|
44961
|
+
}).refine((step) => step.target !== void 0 || step.deviceId !== void 0, {
|
|
44717
44962
|
message: "a cap step needs a target",
|
|
44718
44963
|
path: ["target"]
|
|
44719
44964
|
}).refine((step) => step.target?.kind !== "domain" || step.actionId !== void 0, {
|
|
44720
44965
|
message: "a domain target needs the vocabulary action it applies to (actionId)",
|
|
44721
44966
|
path: ["actionId"]
|
|
44722
44967
|
}).refine((step) => step.else === void 0 || step.if !== void 0, elseNeedsIf);
|
|
44723
|
-
|
|
44968
|
+
/** End the run here, on purpose. `reason` may carry `{{vars.x}}` slots. */
|
|
44969
|
+
var AutomationStopStepSchema = object({
|
|
44970
|
+
kind: literal("stop"),
|
|
44971
|
+
reason: string().min(1, "a stop needs a reason: it is what the run trace shows").max(200),
|
|
44972
|
+
/** `ok`: the run ends as a success. `failed`: it ends as a failure, with the reason. */
|
|
44973
|
+
outcome: _enum(["ok", "failed"]),
|
|
44974
|
+
/** Stop only when this reads true; false or unknown does not stop. */
|
|
44975
|
+
if: AutomationWhenSchema.optional()
|
|
44976
|
+
});
|
|
44977
|
+
var SET_VAR_NAME_RE = /^[A-Za-z_][A-Za-z0-9_]{0,39}$/;
|
|
44978
|
+
/** Names the run itself writes and reads (`leaf` is what `triggered-by` judges): a step may not overwrite them. */
|
|
44979
|
+
var RESERVED_RUN_VARS = [
|
|
44980
|
+
"kind",
|
|
44981
|
+
"leaf",
|
|
44982
|
+
"at"
|
|
44983
|
+
];
|
|
44984
|
+
/**
|
|
44985
|
+
* Write variables into the run's bag, for the steps after it. SUBSTITUTION
|
|
44986
|
+
* only, never evaluation: a text value may carry `{{vars.x}}` slots.
|
|
44987
|
+
*/
|
|
44988
|
+
var AutomationSetStepSchema = object({
|
|
44989
|
+
kind: literal("set"),
|
|
44990
|
+
vars: record(string(), union([
|
|
44991
|
+
string().max(500),
|
|
44992
|
+
number$1(),
|
|
44993
|
+
boolean()
|
|
44994
|
+
])).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` }),
|
|
44995
|
+
/** Set only when this reads true; false or unknown leaves the bag as it is. */
|
|
44996
|
+
if: AutomationWhenSchema.optional()
|
|
44997
|
+
});
|
|
44998
|
+
var AutomationRunActionStepSchema = object({
|
|
44999
|
+
kind: literal("action"),
|
|
45000
|
+
/** An entry of the `actions` surface (`internal:<uuid>` or `<addonId>:<localId>`). */
|
|
45001
|
+
actionId: string().min(1),
|
|
45002
|
+
/** Values for the action's declared variables; the others take their default. */
|
|
45003
|
+
variables: record(string(), union([
|
|
45004
|
+
string(),
|
|
45005
|
+
number$1(),
|
|
45006
|
+
boolean()
|
|
45007
|
+
])).optional(),
|
|
45008
|
+
...continueOnErrorShape
|
|
45009
|
+
});
|
|
45010
|
+
/**
|
|
45011
|
+
* A step INSIDE a branch of a `choose`: a flow step with no condition of its
|
|
45012
|
+
* own (the branch is the condition) and no block inside it. Strict, so an `if`
|
|
45013
|
+
* written on such a step is refused rather than dropped.
|
|
45014
|
+
*/
|
|
45015
|
+
/** The longest a `wait-until` may wait: six hours. */
|
|
45016
|
+
var WAIT_UNTIL_TIMEOUT_MAX_S = 21600;
|
|
45017
|
+
/**
|
|
45018
|
+
* Pause the run until a condition is true (#500). The timeout is mandatory: a
|
|
45019
|
+
* run never waits without an end. `onTimeout` says what a wait that ran out
|
|
45020
|
+
* does: `continue` goes on to the next step, `stop` ends the run as a failure.
|
|
45021
|
+
* A condition that cannot be read is not "true": the wait goes on (D49).
|
|
45022
|
+
*/
|
|
45023
|
+
var AutomationWaitUntilStepSchema = object({
|
|
45024
|
+
kind: literal("wait-until"),
|
|
45025
|
+
when: AutomationWhenSchema,
|
|
45026
|
+
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)`),
|
|
45027
|
+
onTimeout: _enum(["continue", "stop"])
|
|
45028
|
+
}).strict();
|
|
45029
|
+
/** The step kinds that hold steps of their own, or pause on a condition: they nest two levels at most. */
|
|
45030
|
+
var BLOCK_STEP_KINDS = [
|
|
45031
|
+
"choose",
|
|
45032
|
+
"repeat",
|
|
45033
|
+
"parallel",
|
|
45034
|
+
"wait-until"
|
|
45035
|
+
];
|
|
45036
|
+
var NEST_TOO_DEEP = `steps nest two levels at most: a step inside a nested choose or repeat can be a plain step only`;
|
|
45037
|
+
function kindOf(input) {
|
|
45038
|
+
return typeof input === "object" && input !== null ? Reflect.get(input, "kind") : void 0;
|
|
45039
|
+
}
|
|
45040
|
+
/** Where the nesting ends, a block step is refused in words rather than as an unknown kind. */
|
|
45041
|
+
function nestTooDeep(issue) {
|
|
45042
|
+
const kind = kindOf(issue.input);
|
|
45043
|
+
return typeof kind === "string" && BLOCK_STEP_KINDS.includes(kind) ? NEST_TOO_DEEP : void 0;
|
|
45044
|
+
}
|
|
45045
|
+
var plainStepSchemas = [
|
|
45046
|
+
AutomationWaitStepSchema.strict(),
|
|
45047
|
+
AutomationCapStepBaseSchema.extend(continueOnErrorShape).strict().refine((step) => step.target !== void 0 || step.deviceId !== void 0, {
|
|
45048
|
+
message: "a cap step needs a target",
|
|
45049
|
+
path: ["target"]
|
|
45050
|
+
}).refine((step) => step.target?.kind !== "domain" || step.actionId !== void 0, {
|
|
45051
|
+
message: "a domain target needs the vocabulary action it applies to (actionId)",
|
|
45052
|
+
path: ["actionId"]
|
|
45053
|
+
}),
|
|
45054
|
+
AutomationStopStepSchema.omit({ if: true }).strict(),
|
|
45055
|
+
AutomationSetStepSchema.omit({ if: true }).strict(),
|
|
45056
|
+
AutomationRunActionStepSchema.strict()
|
|
45057
|
+
];
|
|
45058
|
+
/**
|
|
45059
|
+
* A plain step: a flow step with no condition of its own and no step inside
|
|
45060
|
+
* it. The second (last) level of nesting holds these only.
|
|
45061
|
+
*/
|
|
45062
|
+
var AutomationBranchStepSchema = discriminatedUnion("kind", plainStepSchemas, { error: nestTooDeep });
|
|
45063
|
+
/** A step that can run beside others: it writes no variable and does not end the run. */
|
|
45064
|
+
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");
|
|
45065
|
+
/**
|
|
45066
|
+
* Several steps at once (#500): all are started together and all are awaited.
|
|
45067
|
+
* A failure fails the run once the others finished, as in a sequence; a member
|
|
45068
|
+
* marked "continue if this fails" does not.
|
|
45069
|
+
*/
|
|
45070
|
+
var AutomationParallelStepSchema = object({
|
|
45071
|
+
kind: literal("parallel"),
|
|
45072
|
+
steps: array(AutomationParallelMemberSchema).min(2, "a parallel needs at least two steps").max(5, `a parallel takes at most 5 steps`)
|
|
45073
|
+
}).strict();
|
|
45074
|
+
var REPEAT_NEEDS_MAX = "a repeat on a condition needs a maximum number of iterations";
|
|
45075
|
+
/** A loop on a condition: the bound is mandatory, so a run never loops without an end. */
|
|
45076
|
+
var repeatConditionShape = {
|
|
45077
|
+
when: AutomationWhenSchema,
|
|
45078
|
+
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`),
|
|
45079
|
+
/** A pause between two iterations, never after the last. */
|
|
45080
|
+
waitS: number$1().int().min(1).max(WAIT_MAX_SECONDS, WAIT_TOO_LONG).optional()
|
|
45081
|
+
};
|
|
45082
|
+
/** What decides how many times a `repeat` runs. */
|
|
45083
|
+
var AutomationRepeatLoopSchema = discriminatedUnion("by", [
|
|
45084
|
+
object({
|
|
45085
|
+
by: literal("count"),
|
|
45086
|
+
count: number$1().int().min(1).max(20, `a repeat runs at most 20 times`)
|
|
45087
|
+
}).strict(),
|
|
45088
|
+
object({
|
|
45089
|
+
by: literal("while"),
|
|
45090
|
+
...repeatConditionShape
|
|
45091
|
+
}).strict(),
|
|
45092
|
+
object({
|
|
45093
|
+
by: literal("until"),
|
|
45094
|
+
...repeatConditionShape
|
|
45095
|
+
}).strict(),
|
|
45096
|
+
object({
|
|
45097
|
+
by: literal("forEach"),
|
|
45098
|
+
target: object({
|
|
45099
|
+
kind: literal("devices"),
|
|
45100
|
+
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`)
|
|
45101
|
+
}).strict()
|
|
45102
|
+
}).strict()
|
|
45103
|
+
]);
|
|
45104
|
+
/**
|
|
45105
|
+
* The same steps several times (#500). Every form is bounded at save, so a
|
|
45106
|
+
* run cannot loop without an end. A failure or a `stop` in the steps ends the
|
|
45107
|
+
* loop and the run, as in a sequence.
|
|
45108
|
+
*/
|
|
45109
|
+
function repeatSchemaOf(step) {
|
|
45110
|
+
return object({
|
|
45111
|
+
kind: literal("repeat"),
|
|
45112
|
+
loop: AutomationRepeatLoopSchema,
|
|
45113
|
+
steps: array(step).min(1, "a repeat needs at least one step").max(10, `a repeat takes at most 10 steps`)
|
|
45114
|
+
}).strict();
|
|
45115
|
+
}
|
|
45116
|
+
/**
|
|
45117
|
+
* One step, several ways (#500): the branches are read in order and the FIRST
|
|
45118
|
+
* whose condition is true runs; `else` runs when every branch is false. A
|
|
45119
|
+
* branch that cannot be read ends the choice: nothing runs, not the branches
|
|
45120
|
+
* after it and not the else (D49). The #472 `if` / `else` of a wait or cap
|
|
45121
|
+
* step is the one-branch case and stays as it is stored.
|
|
45122
|
+
*/
|
|
45123
|
+
function chooseSchemaOf(step) {
|
|
45124
|
+
const steps = array(step).max(10);
|
|
45125
|
+
return object({
|
|
45126
|
+
kind: literal("choose"),
|
|
45127
|
+
branches: array(object({
|
|
45128
|
+
if: AutomationWhenSchema,
|
|
45129
|
+
steps: steps.min(1, "a branch needs at least one step")
|
|
45130
|
+
})).min(1, "a choose needs at least one branch").max(6, `a choose takes at most 6 branches`),
|
|
45131
|
+
else: steps.optional()
|
|
45132
|
+
});
|
|
45133
|
+
}
|
|
45134
|
+
var AutomationBodyStepSchema = discriminatedUnion("kind", [
|
|
45135
|
+
...plainStepSchemas,
|
|
45136
|
+
AutomationWaitUntilStepSchema,
|
|
45137
|
+
AutomationParallelStepSchema,
|
|
45138
|
+
chooseSchemaOf(AutomationBranchStepSchema),
|
|
45139
|
+
repeatSchemaOf(AutomationBranchStepSchema)
|
|
45140
|
+
]);
|
|
45141
|
+
var AutomationRepeatStepSchema = repeatSchemaOf(AutomationBodyStepSchema);
|
|
44724
45142
|
var AutomationActionSchema = discriminatedUnion("kind", [
|
|
44725
45143
|
GuardedWaitStepSchema,
|
|
44726
|
-
|
|
44727
|
-
|
|
44728
|
-
|
|
44729
|
-
|
|
44730
|
-
|
|
44731
|
-
|
|
44732
|
-
|
|
44733
|
-
|
|
44734
|
-
number$1(),
|
|
44735
|
-
boolean()
|
|
44736
|
-
])).optional()
|
|
44737
|
-
}),
|
|
45144
|
+
AutomationGuardedCapStepSchema,
|
|
45145
|
+
AutomationStopStepSchema,
|
|
45146
|
+
AutomationSetStepSchema,
|
|
45147
|
+
chooseSchemaOf(AutomationBodyStepSchema),
|
|
45148
|
+
AutomationWaitUntilStepSchema,
|
|
45149
|
+
AutomationParallelStepSchema,
|
|
45150
|
+
AutomationRepeatStepSchema,
|
|
45151
|
+
AutomationRunActionStepSchema,
|
|
44738
45152
|
object({
|
|
44739
45153
|
kind: literal("code"),
|
|
44740
45154
|
/** Compiled into the automation's OWN block by esbuild — not a third
|
|
@@ -44797,11 +45211,6 @@ function convertLegacyRecipe(legacy) {
|
|
|
44797
45211
|
...rest
|
|
44798
45212
|
};
|
|
44799
45213
|
}
|
|
44800
|
-
/**
|
|
44801
|
-
* Where recipes are PARSED (the core-blocks cap, the MCP tool, the literal a
|
|
44802
|
-
* saved block carries): the new shape as it is, or the old shape converted to
|
|
44803
|
-
* it. The output type is always the new one.
|
|
44804
|
-
*/
|
|
44805
45214
|
var AutomationRecipeSchema = union([CurrentAutomationRecipeSchema, LegacyAutomationRecipeSchema.transform(convertLegacyRecipe)]);
|
|
44806
45215
|
var DETECTION_DESCRIPTIONS = {
|
|
44807
45216
|
deviceId: "the camera that saw it",
|
|
@@ -44817,6 +45226,21 @@ var STATIONARY_DESCRIPTIONS = {
|
|
|
44817
45226
|
phase: "appeared or departed",
|
|
44818
45227
|
entryId: "the stopped object"
|
|
44819
45228
|
};
|
|
45229
|
+
var BECOMES_DESCRIPTIONS = {
|
|
45230
|
+
deviceId: "the device that changed",
|
|
45231
|
+
from: "the value before the change, empty when it is not known",
|
|
45232
|
+
to: "the value it changed to"
|
|
45233
|
+
};
|
|
45234
|
+
/**
|
|
45235
|
+
* A fire's payload is offered too, as `data.<path>` (`{{vars.data.channel}}`):
|
|
45236
|
+
* those names depend on the device, so they are not in this list.
|
|
45237
|
+
*/
|
|
45238
|
+
var FIRED_DESCRIPTIONS = {
|
|
45239
|
+
deviceId: "the device that fired",
|
|
45240
|
+
eventType: "the event, as the device names it",
|
|
45241
|
+
sourceId: "the part of the device that fired (a button), empty when it names none",
|
|
45242
|
+
eventKind: "the kind of press (press, long-press …), empty when the device declares none"
|
|
45243
|
+
};
|
|
44820
45244
|
function describe$1(descriptions) {
|
|
44821
45245
|
return Object.entries(descriptions).map(([name, description]) => ({
|
|
44822
45246
|
name,
|
|
@@ -44825,8 +45249,50 @@ function describe$1(descriptions) {
|
|
|
44825
45249
|
}
|
|
44826
45250
|
describe$1(DETECTION_DESCRIPTIONS);
|
|
44827
45251
|
describe$1(STATIONARY_DESCRIPTIONS);
|
|
45252
|
+
describe$1(FIRED_DESCRIPTIONS).map((v) => v.name === "deviceId" ? {
|
|
45253
|
+
...v,
|
|
45254
|
+
hintKey: "firedDeviceId"
|
|
45255
|
+
} : v);
|
|
45256
|
+
describe$1(BECOMES_DESCRIPTIONS).map((v) => v.name === "deviceId" ? {
|
|
45257
|
+
...v,
|
|
45258
|
+
hintKey: "becomesDeviceId"
|
|
45259
|
+
} : v);
|
|
44828
45260
|
new Set(Object.values(COCO_TO_MACRO.mapping));
|
|
44829
45261
|
/**
|
|
45262
|
+
* Generic stateless event emitter. Installed on a `DeviceType.EventEmitter`
|
|
45263
|
+
* device. Carries the device's EXACT declared event vocabulary verbatim
|
|
45264
|
+
* (NO normalization). Two shapes:
|
|
45265
|
+
* - structured source (HA `event.*` entity) → `vocabulary` is the fixed
|
|
45266
|
+
* declared set (e.g. press_short, press_long, …).
|
|
45267
|
+
* - generic/legacy source (HA bus events, e.g. zha_event) → `vocabulary`
|
|
45268
|
+
* is [] (open) and `lastEvent.data` carries the complex payload.
|
|
45269
|
+
* `vocabulary` (D1044) names each event for a person and types it for a
|
|
45270
|
+
* rule; `eventTypes` is its list of native tokens, kept for older readers.
|
|
45271
|
+
* A fire names the part of the device it came from in `sourceId` when the
|
|
45272
|
+
* vocabulary declares sources (a remote's buttons).
|
|
45273
|
+
* `seq` is monotonic so two identical events still produce distinct slice writes.
|
|
45274
|
+
*/
|
|
45275
|
+
var EventFireSchema = object({
|
|
45276
|
+
deviceId: number$1(),
|
|
45277
|
+
eventType: string(),
|
|
45278
|
+
sourceId: string().optional(),
|
|
45279
|
+
data: record(string(), unknown()).nullable(),
|
|
45280
|
+
timestamp: number$1().meta(readingMeta("none")),
|
|
45281
|
+
seq: number$1().meta(readingMeta("count"))
|
|
45282
|
+
});
|
|
45283
|
+
var EventEmitterStatusSchema = object({
|
|
45284
|
+
eventTypes: array(string()),
|
|
45285
|
+
/**
|
|
45286
|
+
* Required of a provider by the type. A status written before the field
|
|
45287
|
+
* existed still parses, as an empty vocabulary: read it through
|
|
45288
|
+
* `readEventVocabulary`, which then answers with the plain tokens.
|
|
45289
|
+
*/
|
|
45290
|
+
vocabulary: array(EventVocabularyEntrySchema).default([]),
|
|
45291
|
+
lastEvent: EventFireSchema.nullable(),
|
|
45292
|
+
eventCountSinceStart: number$1().meta(readingMeta("count"))
|
|
45293
|
+
});
|
|
45294
|
+
DeviceType.EventEmitter;
|
|
45295
|
+
/**
|
|
44830
45296
|
* Schedulers (D983) — an entity that performs actions over the day.
|
|
44831
45297
|
*
|
|
44832
45298
|
* A scheduler has profiles; a profile has weekdays and a timeline of POINTS.
|
|
@@ -44849,6 +45315,13 @@ var SchedulerStateTreeSchema = AutomationWhenSchema.superRefine((when, ctx) => {
|
|
|
44849
45315
|
});
|
|
44850
45316
|
return;
|
|
44851
45317
|
}
|
|
45318
|
+
if (hasTriggeredByLeaves(when)) {
|
|
45319
|
+
ctx.addIssue({
|
|
45320
|
+
code: "custom",
|
|
45321
|
+
message: TRIGGERED_BY_NEEDS_AUTOMATION
|
|
45322
|
+
});
|
|
45323
|
+
return;
|
|
45324
|
+
}
|
|
44852
45325
|
const problem = validateWhenTree(when);
|
|
44853
45326
|
if (problem !== null) ctx.addIssue({
|
|
44854
45327
|
code: "custom",
|
|
@@ -44870,12 +45343,16 @@ var HoldOverrideSchema = discriminatedUnion("mode", [object({ mode: literal("res
|
|
|
44870
45343
|
})]);
|
|
44871
45344
|
/** A missed edge up to this late still runs. */
|
|
44872
45345
|
var DEFAULT_MAX_LATE_MS = 10 * 6e4;
|
|
45346
|
+
var SchedulerStepSchema = ActionStepSchema.refine((step) => step.kind !== "wait" || step.seconds <= 300, {
|
|
45347
|
+
message: `a scheduler point waits at most five minutes (300 s); put a longer wait in an action`,
|
|
45348
|
+
path: ["seconds"]
|
|
45349
|
+
});
|
|
44873
45350
|
var SchedulerPointSchema = object({
|
|
44874
45351
|
id: string().min(1).max(64),
|
|
44875
45352
|
at: SchedulerTimeSpecSchema,
|
|
44876
45353
|
mode: SchedulerPointModeSchema,
|
|
44877
45354
|
/** The actions of an `edge` or `hold`; a `release` has none. */
|
|
44878
|
-
steps: array(
|
|
45355
|
+
steps: array(SchedulerStepSchema).max(20).default([]),
|
|
44879
45356
|
/** Checked when the point runs (an edge) or is applied (a hold). */
|
|
44880
45357
|
conditions: SchedulerStateTreeSchema.optional(),
|
|
44881
45358
|
/** Hold only; absent means `respect`. */
|
|
@@ -45069,8 +45546,11 @@ var AutomationConditionTraceNodeSchema = object({
|
|
|
45069
45546
|
"device-is",
|
|
45070
45547
|
"expression",
|
|
45071
45548
|
"stationary-present",
|
|
45549
|
+
"time-is",
|
|
45550
|
+
"triggered-by",
|
|
45072
45551
|
"device-becomes",
|
|
45073
45552
|
"device-event",
|
|
45553
|
+
"device-fired",
|
|
45074
45554
|
"schedule",
|
|
45075
45555
|
"interval",
|
|
45076
45556
|
"manual",
|
|
@@ -45141,18 +45621,46 @@ var StepTraceBaseSchema = object({
|
|
|
45141
45621
|
]).optional(),
|
|
45142
45622
|
/** Why the condition read what it read, in the evaluator's own words. */
|
|
45143
45623
|
conditionReason: string().optional(),
|
|
45144
|
-
/** `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. */
|
|
45624
|
+
/** `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). */
|
|
45145
45625
|
outcome: _enum([
|
|
45146
45626
|
"ok",
|
|
45147
45627
|
"error",
|
|
45148
45628
|
"not-run",
|
|
45149
45629
|
"empty",
|
|
45150
|
-
"skipped"
|
|
45630
|
+
"skipped",
|
|
45631
|
+
"failed-continued",
|
|
45632
|
+
"timed-out"
|
|
45151
45633
|
]),
|
|
45152
45634
|
message: string().optional()
|
|
45153
45635
|
});
|
|
45636
|
+
/** What a block step adds to its row: which list ran, what each branch read, how many rounds. */
|
|
45637
|
+
var blockTraceShape = {
|
|
45638
|
+
/** A `choose` step (#500): the list that ran, `branches.<n>` or `else`. Absent when none did. */
|
|
45639
|
+
branch: string().optional(),
|
|
45640
|
+
/** A `choose` step: what each branch read, in order, up to the one that decided. */
|
|
45641
|
+
branchChecks: array(object({
|
|
45642
|
+
condition: _enum([
|
|
45643
|
+
"true",
|
|
45644
|
+
"false",
|
|
45645
|
+
"unknown"
|
|
45646
|
+
]),
|
|
45647
|
+
conditionReason: string().optional()
|
|
45648
|
+
})).optional(),
|
|
45649
|
+
/** A `repeat` step (#500): how many times its steps ran. */
|
|
45650
|
+
iterations: number$1().int().optional()
|
|
45651
|
+
};
|
|
45652
|
+
/** A step one level down: it may be a block step itself, whose own steps are plain rows (the nesting ends there). */
|
|
45653
|
+
var NestedStepTraceSchema = StepTraceBaseSchema.extend({
|
|
45654
|
+
...blockTraceShape,
|
|
45655
|
+
steps: array(StepTraceBaseSchema).optional()
|
|
45656
|
+
});
|
|
45154
45657
|
/** A step trace; the `else` steps that ran are one level of the same shape (the nesting is bounded at one). */
|
|
45155
|
-
var AutomationStepTraceSchema = StepTraceBaseSchema.extend({
|
|
45658
|
+
var AutomationStepTraceSchema = StepTraceBaseSchema.extend({
|
|
45659
|
+
else: array(StepTraceBaseSchema).optional(),
|
|
45660
|
+
...blockTraceShape,
|
|
45661
|
+
/** A `choose` step: the steps of the list that ran. A `parallel`: its members. A `repeat`: the LAST iteration. */
|
|
45662
|
+
steps: array(NestedStepTraceSchema).optional()
|
|
45663
|
+
});
|
|
45156
45664
|
var AutomationRunTraceSchema = object({
|
|
45157
45665
|
runId: string().min(1),
|
|
45158
45666
|
startedAt: number$1(),
|
|
@@ -45485,7 +45993,7 @@ object({
|
|
|
45485
45993
|
* is irrelevant; the array is treated as a set by consumers. */
|
|
45486
45994
|
hiddenChildIds: array(number$1()).readonly()
|
|
45487
45995
|
});
|
|
45488
|
-
DeviceType.Camera, DeviceType.
|
|
45996
|
+
DeviceType.Camera, DeviceType.Switch, DeviceType.Light, DeviceType.Sensor, DeviceType.Climate, DeviceType.Cover, DeviceType.Lock, DeviceType.Fan, DeviceType.MediaPlayer, DeviceType.AlarmPanel, DeviceType.Generic, method(object({
|
|
45489
45997
|
deviceId: number$1().int().nonnegative(),
|
|
45490
45998
|
childDeviceId: number$1().int().nonnegative(),
|
|
45491
45999
|
hidden: boolean()
|
|
@@ -45642,7 +46150,9 @@ var AddonHttpRouteSchema = object({
|
|
|
45642
46150
|
]).optional(),
|
|
45643
46151
|
description: string().optional(),
|
|
45644
46152
|
/** The hub limits this route per client address before the handler runs. */
|
|
45645
|
-
rateLimit: _enum(["auth"]).optional()
|
|
46153
|
+
rateLimit: _enum(["auth"]).optional(),
|
|
46154
|
+
/** Served once per integration instance; the handler reads `instanceId`. */
|
|
46155
|
+
perInstance: boolean().optional()
|
|
45646
46156
|
});
|
|
45647
46157
|
/**
|
|
45648
46158
|
* Cross-process route invocation envelope. The hub captures the
|
|
@@ -45659,6 +46169,8 @@ var InvokeRequestSchema = object({
|
|
|
45659
46169
|
query: record(string(), string()),
|
|
45660
46170
|
body: unknown(),
|
|
45661
46171
|
headers: record(string(), string()),
|
|
46172
|
+
/** The instance the hub resolved for a `perInstance` route. */
|
|
46173
|
+
instanceId: string().optional(),
|
|
45662
46174
|
user: object({
|
|
45663
46175
|
id: string(),
|
|
45664
46176
|
username: string(),
|
|
@@ -47596,7 +48108,7 @@ var BatteryStatusSchema = object({
|
|
|
47596
48108
|
*/
|
|
47597
48109
|
binary: boolean().optional().meta({ label: "Binary indicator" })
|
|
47598
48110
|
});
|
|
47599
|
-
DeviceType.Camera, DeviceType.Sensor, DeviceType.Button, DeviceType.Switch, DeviceType.PetFeeder, DeviceType.Container, DeviceType.
|
|
48111
|
+
DeviceType.Camera, DeviceType.Sensor, DeviceType.Button, DeviceType.Switch, DeviceType.PetFeeder, DeviceType.Container, DeviceType.Climate, DeviceType.EventEmitter;
|
|
47600
48112
|
method(object({
|
|
47601
48113
|
deviceId: number$1(),
|
|
47602
48114
|
/** Bound on the wait. Sensible range 3000–10000ms. */
|
|
@@ -49019,7 +49531,7 @@ var ClimateControlStatusSchema = object({
|
|
|
49019
49531
|
/** Ms epoch when the slice was last updated (push or command). */
|
|
49020
49532
|
lastFetchedAt: number$1()
|
|
49021
49533
|
});
|
|
49022
|
-
DeviceType.
|
|
49534
|
+
DeviceType.Climate, method(object({
|
|
49023
49535
|
deviceId: number$1().int().nonnegative(),
|
|
49024
49536
|
mode: HvacModeSchema
|
|
49025
49537
|
}), _void(), {
|
|
@@ -49310,6 +49822,7 @@ var CompositionProblemSchema = object({
|
|
|
49310
49822
|
"nested-field",
|
|
49311
49823
|
"missing-field",
|
|
49312
49824
|
"kind-mismatch",
|
|
49825
|
+
"source-kind-mismatch",
|
|
49313
49826
|
"may-be-null",
|
|
49314
49827
|
"source-missing",
|
|
49315
49828
|
"source-unreadable",
|
|
@@ -49331,7 +49844,8 @@ var CompositionProblemSchema = object({
|
|
|
49331
49844
|
"command-method-unknown",
|
|
49332
49845
|
"command-source-unknown",
|
|
49333
49846
|
"command-input-unknown",
|
|
49334
|
-
"command-input-missing"
|
|
49847
|
+
"command-input-missing",
|
|
49848
|
+
"power-source-is-actuator"
|
|
49335
49849
|
]),
|
|
49336
49850
|
path: string(),
|
|
49337
49851
|
message: string()
|
|
@@ -50154,7 +50668,7 @@ DeviceType.MediaPlayer, optionalMethod(deviceOnly, _void(), {
|
|
|
50154
50668
|
kind: "mutation",
|
|
50155
50669
|
auth: "protected"
|
|
50156
50670
|
});
|
|
50157
|
-
DeviceType.Camera, DeviceType.Sensor, DeviceType.Button, DeviceType.Switch, DeviceType.PetFeeder, DeviceType.Container, DeviceType.
|
|
50671
|
+
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;
|
|
50158
50672
|
var NUMBER = {
|
|
50159
50673
|
kind: "fixed",
|
|
50160
50674
|
result: ["number"]
|
|
@@ -50237,7 +50751,7 @@ function numeric(input) {
|
|
|
50237
50751
|
}, ...alsoFrom === void 0 ? [] : [alsoFrom.accept]]
|
|
50238
50752
|
};
|
|
50239
50753
|
}
|
|
50240
|
-
var CLIMATE_DEVICES = [DeviceType.
|
|
50754
|
+
var CLIMATE_DEVICES = [DeviceType.Climate];
|
|
50241
50755
|
function binary(input) {
|
|
50242
50756
|
return {
|
|
50243
50757
|
...input,
|
|
@@ -50559,8 +51073,8 @@ var GROUP_TEMPLATES = [
|
|
|
50559
51073
|
actuator({
|
|
50560
51074
|
id: "climate",
|
|
50561
51075
|
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.",
|
|
50562
|
-
deviceType: DeviceType.
|
|
50563
|
-
memberDeviceTypes: [DeviceType.
|
|
51076
|
+
deviceType: DeviceType.Climate,
|
|
51077
|
+
memberDeviceTypes: [DeviceType.Climate],
|
|
50564
51078
|
outputCap: "group-active",
|
|
50565
51079
|
outputField: "active",
|
|
50566
51080
|
member: {
|
|
@@ -50603,6 +51117,50 @@ function actuator(input) {
|
|
|
50603
51117
|
new Map(GROUP_TEMPLATES.map((template) => [template.id, template]));
|
|
50604
51118
|
DeviceFeature.LightColorRgb, DeviceFeature.LightColorHsv, DeviceFeature.LightColorMired;
|
|
50605
51119
|
DeviceType.Camera;
|
|
51120
|
+
var PowerSourceRefusalReasonSchema = _enum([
|
|
51121
|
+
"no-power-source",
|
|
51122
|
+
"switch-missing",
|
|
51123
|
+
"switch-offline",
|
|
51124
|
+
"switch-unknown",
|
|
51125
|
+
"restart-in-progress",
|
|
51126
|
+
"switch-call-failed",
|
|
51127
|
+
"switch-is-actuator"
|
|
51128
|
+
]);
|
|
51129
|
+
var PowerSourceActionResultSchema = discriminatedUnion("accepted", [object({ accepted: literal(true) }), object({
|
|
51130
|
+
accepted: literal(false),
|
|
51131
|
+
reason: PowerSourceRefusalReasonSchema,
|
|
51132
|
+
/** One line for the operator, naming the switch. */
|
|
51133
|
+
message: string()
|
|
51134
|
+
})]);
|
|
51135
|
+
var PowerSourceInfoSchema = object({
|
|
51136
|
+
/** False when the device has no power source linked; the rest is then empty. */
|
|
51137
|
+
linked: boolean(),
|
|
51138
|
+
switchDeviceId: number$1().nullable(),
|
|
51139
|
+
switchName: string().nullable(),
|
|
51140
|
+
/** The switch's on/off state, or null when it is unknown. Never false for unknown (D393). */
|
|
51141
|
+
switchOn: boolean().nullable(),
|
|
51142
|
+
switchOnline: boolean().nullable(),
|
|
51143
|
+
restartInProgress: boolean(),
|
|
51144
|
+
offSeconds: number$1().int()
|
|
51145
|
+
});
|
|
51146
|
+
object({
|
|
51147
|
+
/** Null while the switch has not reported: unknown is never `false` (D393). */
|
|
51148
|
+
switchOn: boolean().nullable(),
|
|
51149
|
+
offSeconds: number$1().int(),
|
|
51150
|
+
lastFetchedAt: number$1()
|
|
51151
|
+
});
|
|
51152
|
+
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;
|
|
51153
|
+
var deviceInput$2 = object({ deviceId: number$1().int().nonnegative() });
|
|
51154
|
+
systemMethod(deviceInput$2, PowerSourceInfoSchema, { auth: "protected" }), systemMethod(deviceInput$2, PowerSourceActionResultSchema, {
|
|
51155
|
+
kind: "mutation",
|
|
51156
|
+
auth: "protected"
|
|
51157
|
+
}), systemMethod(deviceInput$2, PowerSourceActionResultSchema, {
|
|
51158
|
+
kind: "mutation",
|
|
51159
|
+
auth: "protected"
|
|
51160
|
+
}), systemMethod(deviceInput$2, PowerSourceActionResultSchema, {
|
|
51161
|
+
kind: "mutation",
|
|
51162
|
+
auth: "protected"
|
|
51163
|
+
});
|
|
50606
51164
|
`${COMPOSED_DEVICE_STABLE_ID_PREFIX}`;
|
|
50607
51165
|
/**
|
|
50608
51166
|
* What a composition may BUILD on a device type (G2, D676): the caps a new
|
|
@@ -51547,27 +52105,35 @@ var DeviceAdminLinkSchema = object({
|
|
|
51547
52105
|
});
|
|
51548
52106
|
method(object({ deviceId: number$1().int().nonnegative() }), DeviceAdminLinkSchema.nullable(), { auth: "admin" });
|
|
51549
52107
|
/**
|
|
51550
|
-
* device-
|
|
51551
|
-
*
|
|
51552
|
-
*
|
|
51553
|
-
*
|
|
51554
|
-
*
|
|
51555
|
-
*
|
|
51556
|
-
*
|
|
51557
|
-
*
|
|
51558
|
-
*
|
|
51559
|
-
*
|
|
51560
|
-
*
|
|
51561
|
-
*
|
|
51562
|
-
*
|
|
51563
|
-
*
|
|
51564
|
-
*
|
|
51565
|
-
*
|
|
51566
|
-
*
|
|
51567
|
-
|
|
51568
|
-
|
|
51569
|
-
*
|
|
51570
|
-
*
|
|
52108
|
+
* `device-adoption` — generic discovery + adoption surface,
|
|
52109
|
+
* system-scoped collection (one provider per integration addon), routed
|
|
52110
|
+
* by explicit `{ addonId }` on direct `deviceAdoption.*` calls — the same
|
|
52111
|
+
* pin model as `connection-test`. The admin UI keeps using
|
|
52112
|
+
* `deviceManager.adoption*` (which already threads `addonId`). The de-HA-ified
|
|
52113
|
+
* successor to `ha-discovery`:
|
|
52114
|
+
* keyed by `integrationId` (the addon resolves integrationId → broker
|
|
52115
|
+
* internally) rather than a connection-specific `brokerId`, and it
|
|
52116
|
+
* OWNS the shared `DiscoveredChildDevice` candidate type
|
|
52117
|
+
* (declared below) so a single shared adoption modal renders any integration's
|
|
52118
|
+
* candidate tree.
|
|
52119
|
+
*
|
|
52120
|
+
* UI flow (Integrations page → integration detail):
|
|
52121
|
+
* 1. `listCandidates({integrationId, page, pageSize, filter})` →
|
|
52122
|
+
* paginated candidate list, each row collapsed.
|
|
52123
|
+
* 2. User expands a row → `getCandidate({integrationId,
|
|
52124
|
+
* childNativeId})` returns the single candidate (with its nested
|
|
52125
|
+
* `children`) for the accordion render.
|
|
52126
|
+
* 3. User clicks "Adopt" on one or more candidates →
|
|
52127
|
+
* `adopt({integrationId, childNativeIds, perCandidate?})`
|
|
52128
|
+
* materialises one parent CamStack device per candidate plus its
|
|
52129
|
+
* accessory children. `perCandidate[childNativeId]` carries an
|
|
52130
|
+
* optional display-name override + a `hiddenChildIds` pre-hide set
|
|
52131
|
+
* (the parent's `accessories.hiddenChildIds` gates UI visibility).
|
|
52132
|
+
* 4. User clicks "Release" → `release({integrationId, camDeviceId})`
|
|
52133
|
+
* removes the parent + every child from the kernel registry.
|
|
52134
|
+
*/
|
|
52135
|
+
/**
|
|
52136
|
+
* Status enum for a discovered device. Generic enough for
|
|
51571
52137
|
* battery cams, awake cams, and unreachable cams alike.
|
|
51572
52138
|
*/
|
|
51573
52139
|
var DiscoveredChildStatusSchema = _enum([
|
|
@@ -51584,12 +52150,12 @@ var DiscoveredChildDeviceSchema = lazy(() => object({
|
|
|
51584
52150
|
/** DeviceType the child should be created with on adopt. */
|
|
51585
52151
|
type: _enum(DeviceType),
|
|
51586
52152
|
status: DiscoveredChildStatusSchema,
|
|
51587
|
-
/** Free-form integration-specific metadata surfaced in the
|
|
52153
|
+
/** Free-form integration-specific metadata surfaced in the adoption modal. */
|
|
51588
52154
|
metadata: object({
|
|
51589
52155
|
model: string().optional(),
|
|
51590
52156
|
serialNumber: string().optional(),
|
|
51591
52157
|
uid: string().optional(),
|
|
51592
|
-
/** Reolink: 0-based channel index inside the parent NVR
|
|
52158
|
+
/** Reolink: 0-based channel index inside the parent NVR. */
|
|
51593
52159
|
rtspChannel: number$1().int().nonnegative().optional(),
|
|
51594
52160
|
isBattery: boolean().optional(),
|
|
51595
52161
|
isDoorbell: boolean().optional(),
|
|
@@ -51605,86 +52171,24 @@ var DiscoveredChildDeviceSchema = lazy(() => object({
|
|
|
51605
52171
|
}).default({}),
|
|
51606
52172
|
/**
|
|
51607
52173
|
* `true` when the framework already created a child device for this
|
|
51608
|
-
* `childNativeId` under the current parent. The
|
|
52174
|
+
* `childNativeId` under the current parent. The adoption modal uses it to
|
|
51609
52175
|
* gate the Add/Remove button and surface the existing `deviceId`.
|
|
51610
52176
|
*/
|
|
51611
52177
|
alreadyAdopted: boolean(),
|
|
51612
52178
|
/** When `alreadyAdopted=true`, the framework-assigned child device id. */
|
|
51613
52179
|
adoptedDeviceId: number$1().int().nonnegative().nullable(),
|
|
51614
|
-
/** Capability names the candidate advertises — integrations populate,
|
|
52180
|
+
/** Capability names the candidate advertises — integrations populate, flat enumerations omit. */
|
|
51615
52181
|
capabilities: array(string()).readonly().optional(),
|
|
51616
|
-
/** Feature flags the candidate advertises — integrations populate,
|
|
52182
|
+
/** Feature flags the candidate advertises — integrations populate, flat enumerations omit. */
|
|
51617
52183
|
features: array(string()).readonly().optional(),
|
|
51618
52184
|
/** Upstream-system identity + rendering hints for the candidate. */
|
|
51619
52185
|
sourceInfo: SourceInfoSchema.optional(),
|
|
51620
|
-
/** Nested entity-children for accordion preview — integrations populate,
|
|
52186
|
+
/** Nested entity-children for accordion preview — integrations populate, flat enumerations omit. */
|
|
51621
52187
|
children: array(DiscoveredChildDeviceSchema).readonly().optional(),
|
|
51622
52188
|
/** `childNativeId` of the gateway candidate in the same list this device sits behind. */
|
|
51623
52189
|
parentStableId: string().optional()
|
|
51624
52190
|
}));
|
|
51625
52191
|
/**
|
|
51626
|
-
* Status block — populated by the integration after each
|
|
51627
|
-
* `refreshDiscovery` (or push-driven update). The runtime-state slice
|
|
51628
|
-
* is what the panel reads via the per-device proxy; `getStatus`
|
|
51629
|
-
* returns the same payload via the codegen'd auto-injection.
|
|
51630
|
-
*/
|
|
51631
|
-
var DeviceDiscoveryStatusSchema = object({
|
|
51632
|
-
discovered: array(DiscoveredChildDeviceSchema),
|
|
51633
|
-
/** Wall-clock ms of the last successful enumeration. */
|
|
51634
|
-
lastDiscoveryAt: number$1().int().nonnegative().nullable(),
|
|
51635
|
-
/** Last error surfaced from the source (rendered as a banner). */
|
|
51636
|
-
lastError: string().nullable()
|
|
51637
|
-
});
|
|
51638
|
-
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(), {
|
|
51639
|
-
kind: "mutation",
|
|
51640
|
-
auth: "admin"
|
|
51641
|
-
}), method(object({
|
|
51642
|
-
deviceId: number$1().int().nonnegative(),
|
|
51643
|
-
childNativeId: string(),
|
|
51644
|
-
/** Optional override for the child's display name. */
|
|
51645
|
-
name: string().optional()
|
|
51646
|
-
}), object({
|
|
51647
|
-
deviceId: number$1().int().nonnegative(),
|
|
51648
|
-
stableId: string()
|
|
51649
|
-
}), {
|
|
51650
|
-
kind: "mutation",
|
|
51651
|
-
auth: "admin"
|
|
51652
|
-
}), method(object({
|
|
51653
|
-
deviceId: number$1().int().nonnegative(),
|
|
51654
|
-
childDeviceId: number$1().int().nonnegative()
|
|
51655
|
-
}), _void(), {
|
|
51656
|
-
kind: "mutation",
|
|
51657
|
-
auth: "admin"
|
|
51658
|
-
});
|
|
51659
|
-
/**
|
|
51660
|
-
* `device-adoption` — generic discovery + adoption surface,
|
|
51661
|
-
* system-scoped collection (one provider per integration addon), routed
|
|
51662
|
-
* by explicit `{ addonId }` on direct `deviceAdoption.*` calls — the same
|
|
51663
|
-
* pin model as `connection-test`. The admin UI keeps using
|
|
51664
|
-
* `deviceManager.adoption*` (which already threads `addonId`). The de-HA-ified
|
|
51665
|
-
* successor to `ha-discovery`:
|
|
51666
|
-
* keyed by `integrationId` (the addon resolves integrationId → broker
|
|
51667
|
-
* internally) rather than a connection-specific `brokerId`, and it
|
|
51668
|
-
* REUSES the shared `DiscoveredChildDevice` candidate type from
|
|
51669
|
-
* `device-discovery.cap.ts` so a single shared adoption panel renders
|
|
51670
|
-
* any integration's candidate tree.
|
|
51671
|
-
*
|
|
51672
|
-
* UI flow (Integrations page → integration detail):
|
|
51673
|
-
* 1. `listCandidates({integrationId, page, pageSize, filter})` →
|
|
51674
|
-
* paginated candidate list, each row collapsed.
|
|
51675
|
-
* 2. User expands a row → `getCandidate({integrationId,
|
|
51676
|
-
* childNativeId})` returns the single candidate (with its nested
|
|
51677
|
-
* `children`) for the accordion render.
|
|
51678
|
-
* 3. User clicks "Adopt" on one or more candidates →
|
|
51679
|
-
* `adopt({integrationId, childNativeIds, perCandidate?})`
|
|
51680
|
-
* materialises one parent CamStack device per candidate plus its
|
|
51681
|
-
* accessory children. `perCandidate[childNativeId]` carries an
|
|
51682
|
-
* optional display-name override + a `hiddenChildIds` pre-hide set
|
|
51683
|
-
* (the parent's `accessories.hiddenChildIds` gates UI visibility).
|
|
51684
|
-
* 4. User clicks "Release" → `release({integrationId, camDeviceId})`
|
|
51685
|
-
* removes the parent + every child from the kernel registry.
|
|
51686
|
-
*/
|
|
51687
|
-
/**
|
|
51688
52192
|
* Provider-declared discovery *granularity* filter (the keystone of the
|
|
51689
52193
|
* single-entity-import design). A provider advertises which discovery
|
|
51690
52194
|
* granularities it supports via `listCandidateFilters`; the operator picks
|
|
@@ -53051,8 +53555,14 @@ method(object({
|
|
|
53051
53555
|
"string",
|
|
53052
53556
|
"number",
|
|
53053
53557
|
"boolean",
|
|
53054
|
-
"enum"
|
|
53558
|
+
"enum",
|
|
53559
|
+
"union"
|
|
53055
53560
|
]),
|
|
53561
|
+
unionMembers: array(_enum([
|
|
53562
|
+
"string",
|
|
53563
|
+
"number",
|
|
53564
|
+
"boolean"
|
|
53565
|
+
])).optional(),
|
|
53056
53566
|
enumValues: array(string()).optional(),
|
|
53057
53567
|
item: boolean().optional(),
|
|
53058
53568
|
quantity: ReadingQuantitySchema.optional()
|
|
@@ -54918,29 +55428,6 @@ var EnumSensorStatusSchema = object({
|
|
|
54918
55428
|
lastFetchedAt: number$1()
|
|
54919
55429
|
});
|
|
54920
55430
|
DeviceType.Sensor;
|
|
54921
|
-
/**
|
|
54922
|
-
* Generic stateless event emitter. Installed on a `DeviceType.EventEmitter`
|
|
54923
|
-
* device. Carries the device's EXACT declared event vocabulary verbatim
|
|
54924
|
-
* (NO normalization). Two shapes:
|
|
54925
|
-
* - structured source (HA `event.*` entity) → `eventTypes` is the fixed
|
|
54926
|
-
* declared vocabulary (e.g. ['press_short','press_long',...]).
|
|
54927
|
-
* - generic/legacy source (HA bus events, e.g. zha_event) → `eventTypes`
|
|
54928
|
-
* is [] (open) and `lastEvent.data` carries the complex payload.
|
|
54929
|
-
* `seq` is monotonic so two identical events still produce distinct slice writes.
|
|
54930
|
-
*/
|
|
54931
|
-
var EventFireSchema = object({
|
|
54932
|
-
deviceId: number$1(),
|
|
54933
|
-
eventType: string(),
|
|
54934
|
-
data: record(string(), unknown()).nullable(),
|
|
54935
|
-
timestamp: number$1().meta(readingMeta("none")),
|
|
54936
|
-
seq: number$1().meta(readingMeta("count"))
|
|
54937
|
-
});
|
|
54938
|
-
var EventEmitterStatusSchema = object({
|
|
54939
|
-
eventTypes: array(string()),
|
|
54940
|
-
lastEvent: EventFireSchema.nullable(),
|
|
54941
|
-
eventCountSinceStart: number$1().meta(readingMeta("count"))
|
|
54942
|
-
});
|
|
54943
|
-
DeviceType.EventEmitter;
|
|
54944
55431
|
var IdentitySchema = object({
|
|
54945
55432
|
id: string(),
|
|
54946
55433
|
name: string(),
|
|
@@ -55430,8 +55917,85 @@ method(_void(), array(FailureContributionSchema).readonly());
|
|
|
55430
55917
|
* - `FanPreset` — preset selector
|
|
55431
55918
|
* - `FanDirection` — direction toggle (ceiling fans)
|
|
55432
55919
|
* - `FanOscillating` — oscillation toggle
|
|
55920
|
+
*
|
|
55921
|
+
* Per-axis oscillation (`oscillationAxes`, `setOscillationAxis`, D1034): an air
|
|
55922
|
+
* circulator sweeps horizontally and vertically, each axis with its own
|
|
55923
|
+
* switch, fixed angle, sweep bounds and limits. A provider may report them
|
|
55924
|
+
* natively; otherwise the OPERATOR links sibling devices to each field in
|
|
55925
|
+
* Customize (a `replace` over the fields listed in `overridable` — nothing is
|
|
55926
|
+
* linked or inferred by itself), and a write to a linked field is forwarded to
|
|
55927
|
+
* its source. `oscillating` stays the single summary flag: when axes exist it
|
|
55928
|
+
* means "any axis oscillates" (`anyAxisOscillating`).
|
|
55433
55929
|
*/
|
|
55434
55930
|
var FanDirectionSchema = _enum(["forward", "reverse"]);
|
|
55931
|
+
var FAN_OSCILLATION_AXES = ["horizontal", "vertical"];
|
|
55932
|
+
var FanOscillationAxisNameSchema = _enum(FAN_OSCILLATION_AXES);
|
|
55933
|
+
var FanOscillationAxisFieldSchema = _enum([
|
|
55934
|
+
"oscillating",
|
|
55935
|
+
"angle",
|
|
55936
|
+
"sweepFrom",
|
|
55937
|
+
"sweepTo"
|
|
55938
|
+
]);
|
|
55939
|
+
/** The limits of one axis, read from the source that serves its angle. */
|
|
55940
|
+
var FAN_OSCILLATION_AXIS_LIMITS = [
|
|
55941
|
+
"min",
|
|
55942
|
+
"max",
|
|
55943
|
+
"step"
|
|
55944
|
+
];
|
|
55945
|
+
/**
|
|
55946
|
+
* One oscillation axis. Every reading the device has not reported is `null`,
|
|
55947
|
+
* never `0` (D393): `0°` is a real position. Each leaf defaults to `null`, so
|
|
55948
|
+
* a slice that names only the leaves it knows (a Customize link of one field)
|
|
55949
|
+
* is still a whole axis.
|
|
55950
|
+
*/
|
|
55951
|
+
var FanOscillationAxisSchema = object({
|
|
55952
|
+
/** Whether the axis sweeps. */
|
|
55953
|
+
oscillating: boolean().nullable().default(null),
|
|
55954
|
+
/** The fixed position (degrees) the axis holds when it does not sweep. */
|
|
55955
|
+
angle: number$1().nullable().default(null),
|
|
55956
|
+
/** The sweep bounds (degrees): left → right, bottom → top. */
|
|
55957
|
+
sweepFrom: number$1().nullable().default(null),
|
|
55958
|
+
sweepTo: number$1().nullable().default(null),
|
|
55959
|
+
/** The angles the axis accepts. Null when the device states none. */
|
|
55960
|
+
min: number$1().nullable().default(null),
|
|
55961
|
+
max: number$1().nullable().default(null),
|
|
55962
|
+
step: number$1().nullable().default(null)
|
|
55963
|
+
});
|
|
55964
|
+
/** Both axes; an axis the device does not have is `null`. */
|
|
55965
|
+
var FanOscillationAxesSchema = object({
|
|
55966
|
+
horizontal: FanOscillationAxisSchema.nullable().default(null),
|
|
55967
|
+
vertical: FanOscillationAxisSchema.nullable().default(null)
|
|
55968
|
+
});
|
|
55969
|
+
var FanOscillationAxisRefusalSchema = _enum([
|
|
55970
|
+
"nothing-to-set",
|
|
55971
|
+
"axis-not-linked",
|
|
55972
|
+
"out-of-range",
|
|
55973
|
+
"source-gone",
|
|
55974
|
+
"source-unknown",
|
|
55975
|
+
"source-call-failed"
|
|
55976
|
+
]);
|
|
55977
|
+
var FanOscillationAxisResultSchema = discriminatedUnion("status", [object({ status: literal("applied") }), object({
|
|
55978
|
+
status: literal("refused"),
|
|
55979
|
+
reason: FanOscillationAxisRefusalSchema,
|
|
55980
|
+
/** The field at fault, when one is. */
|
|
55981
|
+
field: FanOscillationAxisFieldSchema.optional(),
|
|
55982
|
+
/** One line for the operator, naming the axis, the field and the source. */
|
|
55983
|
+
detail: string(),
|
|
55984
|
+
/** Fields that DID land before the refusal (writes run in order, stop at the first failure). */
|
|
55985
|
+
applied: array(FanOscillationAxisFieldSchema)
|
|
55986
|
+
})]);
|
|
55987
|
+
var SetOscillationAxisInputSchema = object({
|
|
55988
|
+
deviceId: number$1().int().nonnegative(),
|
|
55989
|
+
axis: FanOscillationAxisNameSchema,
|
|
55990
|
+
oscillating: boolean().optional(),
|
|
55991
|
+
angle: number$1().optional(),
|
|
55992
|
+
sweepFrom: number$1().optional(),
|
|
55993
|
+
sweepTo: number$1().optional()
|
|
55994
|
+
});
|
|
55995
|
+
/** The state path of one axis field: `oscillationAxes.<axis>.<field>`. */
|
|
55996
|
+
function fanAxisPath(axis, field) {
|
|
55997
|
+
return `oscillationAxes.${axis}.${field}`;
|
|
55998
|
+
}
|
|
55435
55999
|
var FanControlStatusSchema = object({
|
|
55436
56000
|
/** Active speed as 0..100 inclusive. Null when the device has no
|
|
55437
56001
|
* speed surface (single-speed fan). */
|
|
@@ -55450,9 +56014,91 @@ var FanControlStatusSchema = object({
|
|
|
55450
56014
|
/** Oscillation toggle. Null when the device has no oscillation
|
|
55451
56015
|
* surface. */
|
|
55452
56016
|
oscillating: boolean().nullable(),
|
|
56017
|
+
/**
|
|
56018
|
+
* Per-axis oscillation (air circulators). Absent when the device has no
|
|
56019
|
+
* per-axis surface and nothing is linked in Customize.
|
|
56020
|
+
*/
|
|
56021
|
+
oscillationAxes: FanOscillationAxesSchema.optional(),
|
|
55453
56022
|
/** Ms epoch when the slice was last updated. */
|
|
55454
56023
|
lastChangedAt: number$1()
|
|
55455
56024
|
});
|
|
56025
|
+
var FAN_CUSTOMIZE_DEVICE_TYPES = [DeviceType.Fan];
|
|
56026
|
+
/** The Customize section the axis targets are listed under. */
|
|
56027
|
+
var AXES_SECTION = "oscillation-axes";
|
|
56028
|
+
function axisOscillatingTarget(axis) {
|
|
56029
|
+
return {
|
|
56030
|
+
id: `${axis}-oscillating`,
|
|
56031
|
+
cardinality: "scalar",
|
|
56032
|
+
vocabulary: {
|
|
56033
|
+
cap: "fan-control",
|
|
56034
|
+
stateField: "oscillating"
|
|
56035
|
+
},
|
|
56036
|
+
deviceTypes: FAN_CUSTOMIZE_DEVICE_TYPES,
|
|
56037
|
+
apply: "replace",
|
|
56038
|
+
section: AXES_SECTION,
|
|
56039
|
+
path: fanAxisPath(axis, "oscillating"),
|
|
56040
|
+
sources: [{
|
|
56041
|
+
kind: "switch",
|
|
56042
|
+
transforms: [{ kind: "identity" }]
|
|
56043
|
+
}],
|
|
56044
|
+
sourceReport: { status: "assignment-status" }
|
|
56045
|
+
};
|
|
56046
|
+
}
|
|
56047
|
+
/**
|
|
56048
|
+
* A numeric axis field. The `angle` link also carries the axis limits, read
|
|
56049
|
+
* from the SAME linked control's own range (`min`/`max`/`step`), so the limits
|
|
56050
|
+
* are the source's, never guessed.
|
|
56051
|
+
*/
|
|
56052
|
+
function axisNumericTarget(axis, field) {
|
|
56053
|
+
const base = {
|
|
56054
|
+
id: `${axis}-${field}`,
|
|
56055
|
+
cardinality: "scalar",
|
|
56056
|
+
vocabulary: { cap: "fan-control" },
|
|
56057
|
+
deviceTypes: FAN_CUSTOMIZE_DEVICE_TYPES,
|
|
56058
|
+
apply: "replace",
|
|
56059
|
+
section: AXES_SECTION,
|
|
56060
|
+
path: fanAxisPath(axis, field),
|
|
56061
|
+
sources: [{
|
|
56062
|
+
kind: "numeric",
|
|
56063
|
+
transforms: [{ kind: "identity" }]
|
|
56064
|
+
}],
|
|
56065
|
+
sourceReport: { status: "assignment-status" }
|
|
56066
|
+
};
|
|
56067
|
+
if (field !== "angle") return base;
|
|
56068
|
+
return {
|
|
56069
|
+
...base,
|
|
56070
|
+
companions: FAN_OSCILLATION_AXIS_LIMITS.map((limit) => ({
|
|
56071
|
+
kind: "source-field",
|
|
56072
|
+
path: fanAxisPath(axis, limit),
|
|
56073
|
+
field: limit
|
|
56074
|
+
}))
|
|
56075
|
+
};
|
|
56076
|
+
}
|
|
56077
|
+
var AXIS_TARGETS = FAN_OSCILLATION_AXES.flatMap((axis) => [
|
|
56078
|
+
axisOscillatingTarget(axis),
|
|
56079
|
+
axisNumericTarget(axis, "angle"),
|
|
56080
|
+
axisNumericTarget(axis, "sweepFrom"),
|
|
56081
|
+
axisNumericTarget(axis, "sweepTo")
|
|
56082
|
+
]);
|
|
56083
|
+
/** A select (an enum control) the operator links to the fan's `preset`. */
|
|
56084
|
+
var PRESET_TARGET = {
|
|
56085
|
+
id: "preset",
|
|
56086
|
+
cardinality: "scalar",
|
|
56087
|
+
vocabulary: { cap: "fan-control" },
|
|
56088
|
+
deviceTypes: FAN_CUSTOMIZE_DEVICE_TYPES,
|
|
56089
|
+
apply: "replace",
|
|
56090
|
+
path: "preset",
|
|
56091
|
+
sources: [{
|
|
56092
|
+
kind: "field",
|
|
56093
|
+
valueKinds: ["string"],
|
|
56094
|
+
transforms: [{ kind: "identity" }]
|
|
56095
|
+
}],
|
|
56096
|
+
sourceReport: { status: "assignment-status" }
|
|
56097
|
+
};
|
|
56098
|
+
[...AXIS_TARGETS, PRESET_TARGET].map((target) => ({
|
|
56099
|
+
path: target.path,
|
|
56100
|
+
by: target.id
|
|
56101
|
+
}));
|
|
55456
56102
|
DeviceType.Fan, optionalMethod(object({
|
|
55457
56103
|
deviceId: number$1().int().nonnegative(),
|
|
55458
56104
|
speed: number$1().min(0).max(100)
|
|
@@ -55477,17 +56123,37 @@ DeviceType.Fan, optionalMethod(object({
|
|
|
55477
56123
|
}), _void(), {
|
|
55478
56124
|
kind: "mutation",
|
|
55479
56125
|
auth: "protected"
|
|
56126
|
+
}), optionalMethod(SetOscillationAxisInputSchema, FanOscillationAxisResultSchema, {
|
|
56127
|
+
kind: "mutation",
|
|
56128
|
+
auth: "protected"
|
|
56129
|
+
});
|
|
56130
|
+
/** One axis as a preset wants it; an absent field is left as it is. */
|
|
56131
|
+
var FanPresetAxisSchema = object({
|
|
56132
|
+
oscillating: boolean().optional(),
|
|
56133
|
+
angle: number$1().optional(),
|
|
56134
|
+
sweepFrom: number$1().optional(),
|
|
56135
|
+
sweepTo: number$1().optional()
|
|
56136
|
+
});
|
|
56137
|
+
/** The fan-control state a preset sets; an absent field is left as it is. */
|
|
56138
|
+
var FanPresetStateSchema = object({
|
|
56139
|
+
speed: number$1().min(0).max(100).optional(),
|
|
56140
|
+
/** The fan's own preset mode (or the linked select's option). */
|
|
56141
|
+
preset: string().min(1).optional(),
|
|
56142
|
+
direction: FanDirectionSchema.optional(),
|
|
56143
|
+
oscillationAxes: object({
|
|
56144
|
+
horizontal: FanPresetAxisSchema.optional(),
|
|
56145
|
+
vertical: FanPresetAxisSchema.optional()
|
|
56146
|
+
}).optional()
|
|
55480
56147
|
});
|
|
55481
56148
|
var FanPresetSchema = object({
|
|
55482
56149
|
/** Stable key; never reused after a delete within one device's list. */
|
|
55483
56150
|
id: string().min(1).max(64),
|
|
55484
56151
|
/** What the operator and a voice assistant call it. */
|
|
55485
56152
|
name: string().trim().min(1).max(40),
|
|
55486
|
-
|
|
56153
|
+
state: FanPresetStateSchema
|
|
55487
56154
|
});
|
|
55488
56155
|
var FanPresetsRefusalSchema = _enum([
|
|
55489
|
-
"
|
|
55490
|
-
"bad-target",
|
|
56156
|
+
"empty-state",
|
|
55491
56157
|
"duplicate-name",
|
|
55492
56158
|
"duplicate-id",
|
|
55493
56159
|
"too-many",
|
|
@@ -55499,72 +56165,55 @@ var FanPresetsSetResultSchema = discriminatedUnion("status", [object({
|
|
|
55499
56165
|
}), object({
|
|
55500
56166
|
status: literal("refused"),
|
|
55501
56167
|
reason: FanPresetsRefusalSchema,
|
|
55502
|
-
/** Names the preset
|
|
56168
|
+
/** Names the preset at fault. */
|
|
55503
56169
|
detail: string()
|
|
55504
56170
|
})]);
|
|
55505
|
-
var
|
|
55506
|
-
|
|
56171
|
+
var FanPresetFieldResultSchema = object({
|
|
56172
|
+
/** The state path: `speed`, `preset`, `direction`, `oscillationAxes.horizontal.angle`. */
|
|
56173
|
+
field: string(),
|
|
55507
56174
|
outcome: _enum([
|
|
55508
56175
|
"applied",
|
|
55509
56176
|
"failed",
|
|
55510
56177
|
"not-run",
|
|
55511
56178
|
"refused"
|
|
55512
56179
|
]),
|
|
55513
|
-
deviceId: number$1().int().nonnegative().optional(),
|
|
55514
|
-
cap: string().optional(),
|
|
55515
|
-
method: string().optional(),
|
|
55516
56180
|
/** The cause, for every outcome but `applied`. */
|
|
55517
56181
|
message: string().optional()
|
|
55518
56182
|
});
|
|
55519
56183
|
var FanPresetApplyResultSchema = object({
|
|
55520
|
-
/** `applied`: every
|
|
56184
|
+
/** `applied`: every field landed. `partial`: some did, one did not. `refused`: nothing ran. */
|
|
55521
56185
|
status: _enum([
|
|
55522
56186
|
"applied",
|
|
55523
56187
|
"partial",
|
|
55524
56188
|
"refused"
|
|
55525
56189
|
]),
|
|
55526
|
-
|
|
56190
|
+
fields: array(FanPresetFieldResultSchema)
|
|
55527
56191
|
});
|
|
55528
56192
|
var FanCaptureFieldSchema = _enum([
|
|
55529
56193
|
"speed",
|
|
55530
|
-
"oscillating",
|
|
55531
56194
|
"direction",
|
|
55532
|
-
"preset"
|
|
56195
|
+
"preset",
|
|
56196
|
+
"oscillationAxes"
|
|
55533
56197
|
]);
|
|
55534
|
-
var FanCaptureOmissionSchema = object({
|
|
55535
|
-
/** A fan field (`speed`) or `step <n>` for a sibling step. */
|
|
55536
|
-
what: string(),
|
|
55537
|
-
/** Why no value was taken: unknown reading (never stored as 0, D393), or a step that cannot be read. */
|
|
55538
|
-
reason: string()
|
|
55539
|
-
});
|
|
55540
|
-
var FanCaptureItemSchema = object({
|
|
55541
|
-
group: _enum([
|
|
55542
|
-
"fan",
|
|
55543
|
-
"oscillation",
|
|
55544
|
-
"angles"
|
|
55545
|
-
]),
|
|
55546
|
-
/** What the step sets, in the operator's words (a device name, a fan field). */
|
|
55547
|
-
label: string()
|
|
55548
|
-
});
|
|
55549
56198
|
var FanPresetCaptureResultSchema = object({
|
|
55550
|
-
/** The
|
|
55551
|
-
|
|
55552
|
-
|
|
55553
|
-
|
|
55554
|
-
|
|
56199
|
+
/** The fan's CURRENT fan-control state, as a preset; NOT saved. */
|
|
56200
|
+
state: FanPresetStateSchema,
|
|
56201
|
+
omitted: array(object({
|
|
56202
|
+
/** A state path (`speed`, `oscillationAxes.vertical.angle`). */
|
|
56203
|
+
what: string(),
|
|
56204
|
+
/** Why no value was taken: an unknown reading is never stored as 0 (D393). */
|
|
56205
|
+
reason: string()
|
|
56206
|
+
}))
|
|
55555
56207
|
});
|
|
55556
|
-
var deviceInput$
|
|
56208
|
+
var deviceInput$1 = object({ deviceId: number$1().int().nonnegative() });
|
|
55557
56209
|
DeviceType.Fan;
|
|
55558
|
-
method(deviceInput$
|
|
56210
|
+
method(deviceInput$1, array(FanPresetSchema), { auth: "protected" }), method(deviceInput$1.extend({ presets: array(FanPresetSchema).max(12) }), FanPresetsSetResultSchema, {
|
|
55559
56211
|
kind: "mutation",
|
|
55560
56212
|
auth: "admin"
|
|
55561
|
-
}), method(deviceInput$
|
|
56213
|
+
}), method(deviceInput$1.extend({ presetId: string().min(1) }), FanPresetApplyResultSchema, {
|
|
55562
56214
|
kind: "mutation",
|
|
55563
56215
|
auth: "protected"
|
|
55564
|
-
}), method(deviceInput$
|
|
55565
|
-
fields: array(FanCaptureFieldSchema).optional(),
|
|
55566
|
-
steps: array(ActionStepSchema).max(20).default([])
|
|
55567
|
-
}), FanPresetCaptureResultSchema, { auth: "protected" });
|
|
56216
|
+
}), method(deviceInput$1.extend({ fields: array(FanCaptureFieldSchema).optional() }), FanPresetCaptureResultSchema, { auth: "protected" });
|
|
55568
56217
|
/**
|
|
55569
56218
|
* Per-device feature/identity probe slice. Holds the runtime-resolved
|
|
55570
56219
|
* truth about what a device CAN do — which the kernel uses to:
|
|
@@ -55688,7 +56337,7 @@ var GroupActiveSchema = object({
|
|
|
55688
56337
|
/** Ms epoch when the slice was last updated. */
|
|
55689
56338
|
lastChangedAt: number$1()
|
|
55690
56339
|
});
|
|
55691
|
-
DeviceType.Cover, DeviceType.Valve, DeviceType.Lock, DeviceType.MediaPlayer, DeviceType.Climate
|
|
56340
|
+
DeviceType.Cover, DeviceType.Valve, DeviceType.Lock, DeviceType.MediaPlayer, DeviceType.Climate;
|
|
55692
56341
|
var GroupCommandsSchema = object({
|
|
55693
56342
|
/** One row per member that has been commanded. A later command replaces that member's row. */
|
|
55694
56343
|
results: array(object({
|
|
@@ -55700,7 +56349,7 @@ results: array(object({
|
|
|
55700
56349
|
/** Ms epoch of the attempt. */
|
|
55701
56350
|
at: number$1()
|
|
55702
56351
|
})) });
|
|
55703
|
-
DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Cover, DeviceType.Valve, DeviceType.Lock, DeviceType.MediaPlayer, DeviceType.
|
|
56352
|
+
DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Cover, DeviceType.Valve, DeviceType.Lock, DeviceType.MediaPlayer, DeviceType.Climate;
|
|
55704
56353
|
/**
|
|
55705
56354
|
* How many members of a helper group answered (D944). Counts are integers,
|
|
55706
56355
|
* not measurements: zero included is a real count, never a stand-in reading.
|
|
@@ -55724,7 +56373,7 @@ var GroupStatusSchema = object({
|
|
|
55724
56373
|
label: "Members"
|
|
55725
56374
|
}))
|
|
55726
56375
|
});
|
|
55727
|
-
DeviceType.Sensor, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Cover, DeviceType.Valve, DeviceType.Lock, DeviceType.MediaPlayer, DeviceType.
|
|
56376
|
+
DeviceType.Sensor, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Cover, DeviceType.Valve, DeviceType.Lock, DeviceType.MediaPlayer, DeviceType.Climate;
|
|
55728
56377
|
/**
|
|
55729
56378
|
* Heat pump settable surface (D1026): one typed method per parameter, never a
|
|
55730
56379
|
* generic `set(key, value)`. The values a mode takes and the limits of a number
|
|
@@ -55932,7 +56581,7 @@ var HeatingValveStatusSchema = object({
|
|
|
55932
56581
|
/** Ms epoch when the slice was last updated (push or poll). */
|
|
55933
56582
|
lastFetchedAt: number$1()
|
|
55934
56583
|
});
|
|
55935
|
-
DeviceType.
|
|
56584
|
+
DeviceType.Climate;
|
|
55936
56585
|
/**
|
|
55937
56586
|
* timed-run - run a device for a chosen time, then stop it (D993).
|
|
55938
56587
|
*
|
|
@@ -55948,13 +56597,13 @@ DeviceType.Thermostat;
|
|
|
55948
56597
|
* retried in a loop - D49); a future one is re-armed.
|
|
55949
56598
|
*
|
|
55950
56599
|
* What a device may be run for, and for how long at most, is per device type
|
|
55951
|
-
* ({@link
|
|
56600
|
+
* and role ({@link timedRunLimitOf}): the maximum is a safety bound, not a preference,
|
|
55952
56601
|
* so a request above it is REFUSED with a typed reason, never clamped.
|
|
55953
56602
|
*/
|
|
55954
56603
|
var TimedRunUnitSchema = _enum(["s", "min"]);
|
|
55955
56604
|
_enum(["switch", "pet-fountain"]);
|
|
55956
|
-
DeviceType.
|
|
55957
|
-
DeviceType.
|
|
56605
|
+
DeviceType.Switch, DeviceType.PetFountain;
|
|
56606
|
+
DeviceType.Switch, DeviceRole.SwitchHeater;
|
|
55958
56607
|
/** One duration, as the one-tap run asks for it. */
|
|
55959
56608
|
var TimedRunQuickRunSchema = object({
|
|
55960
56609
|
duration: number$1().positive().finite(),
|
|
@@ -56126,8 +56775,8 @@ var HeroSceneSchema = object({
|
|
|
56126
56775
|
/** 0..1: volume, cover position, cycle progress. */
|
|
56127
56776
|
level: number$1().min(0).max(1).nullable()
|
|
56128
56777
|
});
|
|
56129
|
-
DeviceType.Camera, DeviceType.Hub, DeviceType.Light, DeviceType.Siren, DeviceType.Switch, DeviceType.Sensor, DeviceType.
|
|
56130
|
-
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;
|
|
56778
|
+
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;
|
|
56779
|
+
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;
|
|
56131
56780
|
/** A string in both languages, as the cap vocabulary writes it (D920): no `t()` in the model. */
|
|
56132
56781
|
var HeroTextSchema = object({
|
|
56133
56782
|
en: string(),
|
|
@@ -56512,8 +57161,8 @@ var HeroRowModelSchema = object({
|
|
|
56512
57161
|
extras: array(HeroControlSchema).max(2).optional(),
|
|
56513
57162
|
trailing: HeroFactSchema.nullable()
|
|
56514
57163
|
});
|
|
56515
|
-
DeviceType.Climate
|
|
56516
|
-
DeviceType.Climate, DeviceType.
|
|
57164
|
+
DeviceType.Climate;
|
|
57165
|
+
DeviceType.Climate, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.MediaPlayer;
|
|
56517
57166
|
/**
|
|
56518
57167
|
* hero-layout — what a device's hero says (D1023). Read-only: the FIXED
|
|
56519
57168
|
* layouts live in `@camstack/types` and nothing here stores or edits one.
|
|
@@ -56545,7 +57194,10 @@ method(heroInput, HeroModelSchema.nullable(), {
|
|
|
56545
57194
|
}), method(rowModelsInput, array(HeroRowModelSchema.nullable()), {
|
|
56546
57195
|
auth: "protected",
|
|
56547
57196
|
role: "viewer"
|
|
56548
|
-
}), method(object({
|
|
57197
|
+
}), method(object({
|
|
57198
|
+
deviceType: string(),
|
|
57199
|
+
role: string().nullable().optional()
|
|
57200
|
+
}), HeroLayoutRowsSchema, {
|
|
56549
57201
|
auth: "protected",
|
|
56550
57202
|
role: "viewer"
|
|
56551
57203
|
});
|
|
@@ -56622,7 +57274,7 @@ var HumiditySensorStatusSchema = object({
|
|
|
56622
57274
|
/** Ms epoch when the slice was last updated. */
|
|
56623
57275
|
lastFetchedAt: number$1()
|
|
56624
57276
|
});
|
|
56625
|
-
DeviceType.Sensor, DeviceType.
|
|
57277
|
+
DeviceType.Sensor, DeviceType.Climate;
|
|
56626
57278
|
/**
|
|
56627
57279
|
* Image display cap. Models a single still image exposed by an integration —
|
|
56628
57280
|
* a snapshot, a chart, a generated picture, or a robot's cleaning-map render.
|
|
@@ -68966,7 +69618,18 @@ var OauthIntegrationDescriptorSchema = object({
|
|
|
68966
69618
|
* The value is baked into the authorization code at `/authorize` and travels
|
|
68967
69619
|
* on the tokens, so editing this field changes FUTURE links only.
|
|
68968
69620
|
*/
|
|
68969
|
-
refreshTokenTtlSec: union([number$1().int().positive(), literal("never")]).optional()
|
|
69621
|
+
refreshTokenTtlSec: union([number$1().int().positive(), literal("never")]).optional(),
|
|
69622
|
+
/**
|
|
69623
|
+
* The integration instances an account can be linked to (planning#415),
|
|
69624
|
+
* beside the default one. `/api/oauth2/authorize?instance=<id>` is accepted
|
|
69625
|
+
* only for an id listed here; with no `instance=` the link is made to the
|
|
69626
|
+
* default instance, which is never listed and always accepted — it is the
|
|
69627
|
+
* address third parties already hold. Omit for a single-instance integration.
|
|
69628
|
+
*/
|
|
69629
|
+
instances: array(object({
|
|
69630
|
+
id: string(),
|
|
69631
|
+
displayName: string()
|
|
69632
|
+
})).optional()
|
|
68970
69633
|
});
|
|
68971
69634
|
var oauthIntegrationCapability = {
|
|
68972
69635
|
name: "oauth-integration",
|
|
@@ -70916,7 +71579,6 @@ object({
|
|
|
70916
71579
|
DeviceType.Light,
|
|
70917
71580
|
DeviceType.Fan,
|
|
70918
71581
|
DeviceType.Climate,
|
|
70919
|
-
DeviceType.Thermostat,
|
|
70920
71582
|
DeviceType.Humidifier,
|
|
70921
71583
|
DeviceType.WaterHeater,
|
|
70922
71584
|
DeviceType.MediaPlayer,
|
|
@@ -70925,52 +71587,8 @@ object({
|
|
|
70925
71587
|
DeviceType.Dishwasher,
|
|
70926
71588
|
DeviceType.Vacuum,
|
|
70927
71589
|
DeviceType.LawnMower,
|
|
70928
|
-
DeviceType.PetFeeder
|
|
70929
|
-
DeviceType.Heater
|
|
71590
|
+
DeviceType.PetFeeder
|
|
70930
71591
|
].filter((type) => type !== DeviceType.Sensor);
|
|
70931
|
-
var PowerSourceRefusalReasonSchema = _enum([
|
|
70932
|
-
"no-power-source",
|
|
70933
|
-
"switch-missing",
|
|
70934
|
-
"switch-offline",
|
|
70935
|
-
"switch-unknown",
|
|
70936
|
-
"restart-in-progress",
|
|
70937
|
-
"switch-call-failed"
|
|
70938
|
-
]);
|
|
70939
|
-
var PowerSourceActionResultSchema = discriminatedUnion("accepted", [object({ accepted: literal(true) }), object({
|
|
70940
|
-
accepted: literal(false),
|
|
70941
|
-
reason: PowerSourceRefusalReasonSchema,
|
|
70942
|
-
/** One line for the operator, naming the switch. */
|
|
70943
|
-
message: string()
|
|
70944
|
-
})]);
|
|
70945
|
-
var PowerSourceInfoSchema = object({
|
|
70946
|
-
/** False when the device has no power source linked; the rest is then empty. */
|
|
70947
|
-
linked: boolean(),
|
|
70948
|
-
switchDeviceId: number$1().nullable(),
|
|
70949
|
-
switchName: string().nullable(),
|
|
70950
|
-
/** The switch's on/off state, or null when it is unknown. Never false for unknown (D393). */
|
|
70951
|
-
switchOn: boolean().nullable(),
|
|
70952
|
-
switchOnline: boolean().nullable(),
|
|
70953
|
-
restartInProgress: boolean(),
|
|
70954
|
-
offSeconds: number$1().int()
|
|
70955
|
-
});
|
|
70956
|
-
object({
|
|
70957
|
-
/** Null while the switch has not reported: unknown is never `false` (D393). */
|
|
70958
|
-
switchOn: boolean().nullable(),
|
|
70959
|
-
offSeconds: number$1().int(),
|
|
70960
|
-
lastFetchedAt: number$1()
|
|
70961
|
-
});
|
|
70962
|
-
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;
|
|
70963
|
-
var deviceInput$1 = object({ deviceId: number$1().int().nonnegative() });
|
|
70964
|
-
systemMethod(deviceInput$1, PowerSourceInfoSchema, { auth: "protected" }), systemMethod(deviceInput$1, PowerSourceActionResultSchema, {
|
|
70965
|
-
kind: "mutation",
|
|
70966
|
-
auth: "protected"
|
|
70967
|
-
}), systemMethod(deviceInput$1, PowerSourceActionResultSchema, {
|
|
70968
|
-
kind: "mutation",
|
|
70969
|
-
auth: "protected"
|
|
70970
|
-
}), systemMethod(deviceInput$1, PowerSourceActionResultSchema, {
|
|
70971
|
-
kind: "mutation",
|
|
70972
|
-
auth: "protected"
|
|
70973
|
-
});
|
|
70974
71592
|
/**
|
|
70975
71593
|
* Presence cap. Models HA `person.*` and `device_tracker.*` entities
|
|
70976
71594
|
* on `DeviceType.Presence`. Read-only — no setters: presence is
|
|
@@ -74098,7 +74716,7 @@ object({
|
|
|
74098
74716
|
phase: string().nullable()
|
|
74099
74717
|
});
|
|
74100
74718
|
Object.values(DeviceType);
|
|
74101
|
-
DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.MediaPlayer, DeviceType.WaterHeater, DeviceType.Humidifier, DeviceType.Fan, DeviceType.Climate, DeviceType.
|
|
74719
|
+
DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.MediaPlayer, DeviceType.WaterHeater, DeviceType.Humidifier, DeviceType.Fan, DeviceType.Climate, DeviceType.PetFeeder;
|
|
74102
74720
|
/**
|
|
74103
74721
|
* scene-monitor — device-scoped reference-region state cap. An operator marks
|
|
74104
74722
|
* a rect ROI on a camera frame and names one or more states; the engine
|
|
@@ -75156,6 +75774,13 @@ var SsoBridgeClaimsSchema = object({
|
|
|
75156
75774
|
/** OAuth authorization-code binding — set only on `oauth-code` tokens. */
|
|
75157
75775
|
redirectUri: string().optional(),
|
|
75158
75776
|
integrationId: string().optional(),
|
|
75777
|
+
/**
|
|
75778
|
+
* The integration INSTANCE an OAuth link was made for (planning#415). Set on
|
|
75779
|
+
* `oauth-code`, `oauth-access` and `oauth-refresh` tokens of a link made
|
|
75780
|
+
* with `instance=`; absent on a link to the default instance. A cloud relay
|
|
75781
|
+
* reads it off the access token to route; the hub answers from the session.
|
|
75782
|
+
*/
|
|
75783
|
+
instanceId: string().optional(),
|
|
75159
75784
|
/** JWT ID — unique per issued code; consumed-set enforces single-use. */
|
|
75160
75785
|
jti: string().optional(),
|
|
75161
75786
|
/** PKCE S256 challenge — set only on `oauth-code` tokens issued to a public
|
|
@@ -75799,7 +76424,7 @@ var SwitchStatusSchema = object({
|
|
|
75799
76424
|
/** Ms epoch of the last state change. Useful for UI "X minutes ago". */
|
|
75800
76425
|
lastChangedAt: number$1()
|
|
75801
76426
|
});
|
|
75802
|
-
DeviceType.Switch, DeviceType.Siren, DeviceType.Light, DeviceType.Fan,
|
|
76427
|
+
DeviceType.Switch, DeviceType.Siren, DeviceType.Light, DeviceType.Fan, method(object({
|
|
75803
76428
|
deviceId: number$1(),
|
|
75804
76429
|
on: boolean()
|
|
75805
76430
|
}), _void(), {
|
|
@@ -76424,7 +77049,7 @@ var TemperatureSensorStatusSchema = object({
|
|
|
76424
77049
|
/** Ms epoch when the slice was last updated (push or poll). */
|
|
76425
77050
|
lastFetchedAt: number$1()
|
|
76426
77051
|
});
|
|
76427
|
-
DeviceType.Sensor, DeviceType.
|
|
77052
|
+
DeviceType.Sensor, DeviceType.Climate;
|
|
76428
77053
|
var TemplateKindSchema = _enum(["remote"]);
|
|
76429
77054
|
/**
|
|
76430
77055
|
* template — the generic store of reusable, named operator data (D963). A
|
|
@@ -77244,6 +77869,8 @@ var OauthSessionSummarySchema = object({
|
|
|
77244
77869
|
userId: string(),
|
|
77245
77870
|
username: string(),
|
|
77246
77871
|
integrationId: string(),
|
|
77872
|
+
/** The instance the link was made for; `null` = the default instance. */
|
|
77873
|
+
instanceId: string().nullable().optional(),
|
|
77247
77874
|
scopes: array(TokenScopeSchema),
|
|
77248
77875
|
createdAt: number$1(),
|
|
77249
77876
|
lastUsedAt: number$1(),
|
|
@@ -77343,6 +77970,9 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(_void(), ob
|
|
|
77343
77970
|
access: "view"
|
|
77344
77971
|
}), method(object({
|
|
77345
77972
|
integrationId: string(),
|
|
77973
|
+
/** The integration instance the link is for. Omit for the default
|
|
77974
|
+
* instance — never pass the addon id to mean it. */
|
|
77975
|
+
instanceId: string().optional(),
|
|
77346
77976
|
userId: string(),
|
|
77347
77977
|
username: string(),
|
|
77348
77978
|
scopes: array(TokenScopeSchema),
|
|
@@ -77381,7 +78011,13 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(_void(), ob
|
|
|
77381
78011
|
}), method(object({ token: string() }), object({
|
|
77382
78012
|
userId: string(),
|
|
77383
78013
|
username: string(),
|
|
77384
|
-
scopes: array(TokenScopeSchema)
|
|
78014
|
+
scopes: array(TokenScopeSchema),
|
|
78015
|
+
/** The instance the link was made for, read from the SESSION.
|
|
78016
|
+
* Absent = the default instance. `oauthLinkServesInstance` is the
|
|
78017
|
+
* helper a per-instance route calls to compare it with the instance
|
|
78018
|
+
* of its path; no route declares `perInstance` yet (the Alexa
|
|
78019
|
+
* per-instance route, T3, is the first consumer). */
|
|
78020
|
+
instanceId: string().optional()
|
|
77385
78021
|
}).nullable(), { access: "view" }), method(object({ userId: string() }), array(ExternalIdentitySchema), { auth: "admin" }), method(ExternalIdentityKeySchema, object({
|
|
77386
78022
|
userId: string(),
|
|
77387
78023
|
issuer: string()
|
|
@@ -78981,7 +79617,9 @@ var AccessoryKind = {
|
|
|
78981
79617
|
};
|
|
78982
79618
|
AccessoryKind.Siren, AccessoryKind.Floodlight, AccessoryKind.Spotlight, AccessoryKind.PirSensor, AccessoryKind.Chime, AccessoryKind.Autotrack, AccessoryKind.Nightvision, AccessoryKind.PrivacyMask;
|
|
78983
79619
|
DeviceType.HeatPump;
|
|
78984
|
-
DeviceType.
|
|
79620
|
+
DeviceType.Climate;
|
|
79621
|
+
DeviceRole.ClimateThermostat, DeviceRole.ClimateAc, DeviceRole.ClimateRadiator, DeviceRole.ClimateFloor, DeviceRole.ClimateHeater, DeviceRole.ClimateHeatPumpCircuit;
|
|
79622
|
+
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;
|
|
78985
79623
|
new Set(Object.values(DeviceType));
|
|
78986
79624
|
/** Parses the raw slice with the cap's own schema; `undefined` when it does not parse. */
|
|
78987
79625
|
function contribution(cap, schema, build) {
|
|
@@ -80987,7 +81625,7 @@ var HEAT_PUMP_FAMILY_CONTRIBUTIONS = { "heat-pump-status": contribution("heat-pu
|
|
|
80987
81625
|
...Object.values(CLIMATE_FAMILY_CONTRIBUTIONS),
|
|
80988
81626
|
...Object.values(HEAT_PUMP_FAMILY_CONTRIBUTIONS)
|
|
80989
81627
|
];
|
|
80990
|
-
DeviceType.Camera, DeviceType.Hub, DeviceType.Light, DeviceType.Siren, DeviceType.Switch, DeviceType.Sensor, DeviceType.
|
|
81628
|
+
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;
|
|
80991
81629
|
/**
|
|
80992
81630
|
* Who looks like what (D1023). One look per {@link DeviceType}, refined by a
|
|
80993
81631
|
* {@link DeviceRole} where the role changes how the device reads (a leak
|
|
@@ -81631,9 +82269,9 @@ lookOf({
|
|
|
81631
82269
|
idle: INFO,
|
|
81632
82270
|
standby: MUTED
|
|
81633
82271
|
});
|
|
81634
|
-
DeviceType.Climate
|
|
81635
|
-
DeviceType.Camera, DeviceType.Hub, DeviceType.Light, DeviceType.Siren, DeviceType.Switch, DeviceType.Sensor, DeviceType.
|
|
81636
|
-
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;
|
|
82272
|
+
DeviceType.Climate;
|
|
82273
|
+
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;
|
|
82274
|
+
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;
|
|
81637
82275
|
Object.freeze({
|
|
81638
82276
|
"accessories.getStatus": {
|
|
81639
82277
|
capName: "accessories",
|
|
@@ -83483,41 +84121,6 @@ Object.freeze({
|
|
|
83483
84121
|
access: "create",
|
|
83484
84122
|
role: "admin"
|
|
83485
84123
|
},
|
|
83486
|
-
"deviceDiscovery.adoptDevice": {
|
|
83487
|
-
capName: "device-discovery",
|
|
83488
|
-
capScope: "device",
|
|
83489
|
-
addonId: null,
|
|
83490
|
-
access: "create",
|
|
83491
|
-
role: "admin"
|
|
83492
|
-
},
|
|
83493
|
-
"deviceDiscovery.getStatus": {
|
|
83494
|
-
capName: "device-discovery",
|
|
83495
|
-
capScope: "device",
|
|
83496
|
-
addonId: null,
|
|
83497
|
-
access: "view",
|
|
83498
|
-
role: "viewer"
|
|
83499
|
-
},
|
|
83500
|
-
"deviceDiscovery.listDiscovered": {
|
|
83501
|
-
capName: "device-discovery",
|
|
83502
|
-
capScope: "device",
|
|
83503
|
-
addonId: null,
|
|
83504
|
-
access: "view",
|
|
83505
|
-
role: "viewer"
|
|
83506
|
-
},
|
|
83507
|
-
"deviceDiscovery.refreshDiscovery": {
|
|
83508
|
-
capName: "device-discovery",
|
|
83509
|
-
capScope: "device",
|
|
83510
|
-
addonId: null,
|
|
83511
|
-
access: "create",
|
|
83512
|
-
role: "admin"
|
|
83513
|
-
},
|
|
83514
|
-
"deviceDiscovery.releaseDevice": {
|
|
83515
|
-
capName: "device-discovery",
|
|
83516
|
-
capScope: "device",
|
|
83517
|
-
addonId: null,
|
|
83518
|
-
access: "create",
|
|
83519
|
-
role: "admin"
|
|
83520
|
-
},
|
|
83521
84124
|
"deviceExport.applyDeviceSettingsPatch": {
|
|
83522
84125
|
capName: "device-export",
|
|
83523
84126
|
capScope: "system",
|
|
@@ -85065,6 +85668,13 @@ Object.freeze({
|
|
|
85065
85668
|
access: "create",
|
|
85066
85669
|
role: "viewer"
|
|
85067
85670
|
},
|
|
85671
|
+
"fanControl.setOscillationAxis": {
|
|
85672
|
+
capName: "fan-control",
|
|
85673
|
+
capScope: "device",
|
|
85674
|
+
addonId: null,
|
|
85675
|
+
access: "create",
|
|
85676
|
+
role: "viewer"
|
|
85677
|
+
},
|
|
85068
85678
|
"fanControl.setPercentage": {
|
|
85069
85679
|
capName: "fan-control",
|
|
85070
85680
|
capScope: "device",
|
|
@@ -92086,7 +92696,7 @@ function projectAction(cap, action) {
|
|
|
92086
92696
|
};
|
|
92087
92697
|
}
|
|
92088
92698
|
Object.entries(CAP_VOCABULARY_BY_NAME).flatMap(([cap, entry]) => entry.scope === "device" ? (entry.actions ?? []).map((a) => projectAction(cap, a)) : []);
|
|
92089
|
-
DeviceType.Camera, DeviceType.Hub, DeviceType.Light, DeviceType.Siren, DeviceType.Switch, DeviceType.Sensor, DeviceType.
|
|
92699
|
+
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;
|
|
92090
92700
|
DeviceFeature.BatteryOperated;
|
|
92091
92701
|
function bound(cap, methods = [], authority = "reported") {
|
|
92092
92702
|
return {
|
|
@@ -92600,35 +93210,6 @@ Object.freeze({
|
|
|
92600
93210
|
form: "single",
|
|
92601
93211
|
optional: false
|
|
92602
93212
|
}],
|
|
92603
|
-
"deviceDiscovery.adoptDevice": [{
|
|
92604
|
-
name: "deviceId",
|
|
92605
|
-
form: "single",
|
|
92606
|
-
optional: false
|
|
92607
|
-
}],
|
|
92608
|
-
"deviceDiscovery.getStatus": [{
|
|
92609
|
-
name: "deviceId",
|
|
92610
|
-
form: "single",
|
|
92611
|
-
optional: false
|
|
92612
|
-
}],
|
|
92613
|
-
"deviceDiscovery.listDiscovered": [{
|
|
92614
|
-
name: "deviceId",
|
|
92615
|
-
form: "single",
|
|
92616
|
-
optional: false
|
|
92617
|
-
}],
|
|
92618
|
-
"deviceDiscovery.refreshDiscovery": [{
|
|
92619
|
-
name: "deviceId",
|
|
92620
|
-
form: "single",
|
|
92621
|
-
optional: false
|
|
92622
|
-
}],
|
|
92623
|
-
"deviceDiscovery.releaseDevice": [{
|
|
92624
|
-
name: "childDeviceId",
|
|
92625
|
-
form: "single",
|
|
92626
|
-
optional: false
|
|
92627
|
-
}, {
|
|
92628
|
-
name: "deviceId",
|
|
92629
|
-
form: "single",
|
|
92630
|
-
optional: false
|
|
92631
|
-
}],
|
|
92632
93213
|
"deviceExport.applyDeviceSettingsPatch": [{
|
|
92633
93214
|
name: "deviceId",
|
|
92634
93215
|
form: "single",
|
|
@@ -93192,6 +93773,11 @@ Object.freeze({
|
|
|
93192
93773
|
form: "single",
|
|
93193
93774
|
optional: false
|
|
93194
93775
|
}],
|
|
93776
|
+
"fanControl.setOscillationAxis": [{
|
|
93777
|
+
name: "deviceId",
|
|
93778
|
+
form: "single",
|
|
93779
|
+
optional: false
|
|
93780
|
+
}],
|
|
93195
93781
|
"fanControl.setPercentage": [{
|
|
93196
93782
|
name: "deviceId",
|
|
93197
93783
|
form: "single",
|
|
@@ -98105,9 +98691,14 @@ function thermostatCapability(slice, modes, features) {
|
|
|
98105
98691
|
}
|
|
98106
98692
|
};
|
|
98107
98693
|
}
|
|
98108
|
-
/**
|
|
98109
|
-
|
|
98110
|
-
|
|
98694
|
+
/**
|
|
98695
|
+
* D1033 — one `climate` type, and the role says which thing it is: an air
|
|
98696
|
+
* conditioner is an AIR_CONDITIONER; a thermostat, a radiator, a floor loop, a
|
|
98697
|
+
* heat-pump circuit, a climate heater and a climate with no role yet are all a
|
|
98698
|
+
* THERMOSTAT.
|
|
98699
|
+
*/
|
|
98700
|
+
function climateCategoryFor(role) {
|
|
98701
|
+
return role === DeviceRole.ClimateAc ? "AIR_CONDITIONER" : "THERMOSTAT";
|
|
98111
98702
|
}
|
|
98112
98703
|
function describeClimate(device) {
|
|
98113
98704
|
const slice = readClimateSlice(device.slices["climate-control"]);
|
|
@@ -98141,7 +98732,7 @@ function describeClimate(device) {
|
|
|
98141
98732
|
}] : [],
|
|
98142
98733
|
...extras
|
|
98143
98734
|
],
|
|
98144
|
-
category: climateCategoryFor(device.
|
|
98735
|
+
category: climateCategoryFor(device.role)
|
|
98145
98736
|
};
|
|
98146
98737
|
}
|
|
98147
98738
|
/** Amazon's `thermostatMode` for the state, or null while in a mode it lacks. */
|
|
@@ -99783,13 +100374,13 @@ async function applyCustom(c, deps, name) {
|
|
|
99783
100374
|
tags: { deviceId: c.deviceId },
|
|
99784
100375
|
meta: {
|
|
99785
100376
|
preset: preset.name,
|
|
99786
|
-
|
|
100377
|
+
fields: result.fields.length
|
|
99787
100378
|
}
|
|
99788
100379
|
});
|
|
99789
100380
|
return successResponse$1(c, []);
|
|
99790
100381
|
}
|
|
99791
|
-
const bad = result.
|
|
99792
|
-
const detail = bad === void 0 ? result.status :
|
|
100382
|
+
const bad = result.fields.find((f) => f.outcome === "failed" || f.outcome === "refused");
|
|
100383
|
+
const detail = bad === void 0 ? result.status : `${bad.field}: ${bad.message ?? bad.outcome}`;
|
|
99793
100384
|
deps.logger.warn("alexa fan-controller: custom preset did not fully apply", {
|
|
99794
100385
|
tags: { deviceId: c.deviceId },
|
|
99795
100386
|
meta: {
|
|
@@ -102756,18 +103347,17 @@ async function handleSetObjectDetectionClasses(header, endpoint, payloadRaw, ctx
|
|
|
102756
103347
|
}] }
|
|
102757
103348
|
};
|
|
102758
103349
|
}
|
|
102759
|
-
/** Device types this export may publish as a generic endpoint. `
|
|
102760
|
-
*
|
|
102761
|
-
*
|
|
103350
|
+
/** Device types this export may publish as a generic endpoint. A `climate`
|
|
103351
|
+
* device carries the `climate-control` cap (D874); its role picks THERMOSTAT
|
|
103352
|
+
* or AIR_CONDITIONER (D1033). A plug-in heater is a `switch` (role
|
|
103353
|
+
* `switch-heater`). */
|
|
102762
103354
|
var GENERIC_DEVICE_TYPES = [
|
|
102763
103355
|
"light",
|
|
102764
103356
|
"switch",
|
|
102765
|
-
"heater",
|
|
102766
103357
|
"siren",
|
|
102767
103358
|
"sensor",
|
|
102768
103359
|
"lock",
|
|
102769
103360
|
"presence",
|
|
102770
|
-
"thermostat",
|
|
102771
103361
|
"climate",
|
|
102772
103362
|
"cover",
|
|
102773
103363
|
"fan",
|
|
@@ -104443,6 +105033,21 @@ async function rotateBrokerCredential(fetchImpl, brokerUrl, credential) {
|
|
|
104443
105033
|
async function revokeBrokerCredential(fetchImpl, brokerUrl, credential) {
|
|
104444
105034
|
await call(fetchImpl, brokerUrl, "/broker/revoke", { bearer: credential }, unknown());
|
|
104445
105035
|
}
|
|
105036
|
+
function judgeTokenInstance(token, skill) {
|
|
105037
|
+
if (token.instanceId !== void 0) return oauthLinkServesInstance({ instanceId: token.instanceId }, skill.id, "export-alexa") ? { kind: "serves" } : {
|
|
105038
|
+
kind: "refused",
|
|
105039
|
+
reason: "token-instance-mismatch"
|
|
105040
|
+
};
|
|
105041
|
+
if (skill.id === "export-alexa") return { kind: "serves" };
|
|
105042
|
+
return skill.hasLinkedUser(token.userId) ? { kind: "serves" } : {
|
|
105043
|
+
kind: "refused",
|
|
105044
|
+
reason: "token-instance-unstated"
|
|
105045
|
+
};
|
|
105046
|
+
}
|
|
105047
|
+
/** The operator-facing sentence for a refusal, sent back to the Lambda and logged. */
|
|
105048
|
+
function describeTokenInstanceRefusal(reason) {
|
|
105049
|
+
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";
|
|
105050
|
+
}
|
|
104446
105051
|
//#endregion
|
|
104447
105052
|
//#region src/handlers/lwa-tokens-callback.ts
|
|
104448
105053
|
/**
|
|
@@ -104467,13 +105072,33 @@ async function revokeBrokerCredential(fetchImpl, brokerUrl, credential) {
|
|
|
104467
105072
|
var OauthVerifiedResultSchema$1 = object({
|
|
104468
105073
|
userId: string(),
|
|
104469
105074
|
username: string(),
|
|
104470
|
-
scopes: array(TokenScopeSchema)
|
|
105075
|
+
scopes: array(TokenScopeSchema),
|
|
105076
|
+
/** The instance the link was made for; absent = the default instance (D1047). */
|
|
105077
|
+
instanceId: string().optional()
|
|
104471
105078
|
}).nullable();
|
|
104472
105079
|
var LwaTokensCallbackBodySchema = object({
|
|
104473
105080
|
lwaAccessToken: string().min(1),
|
|
104474
105081
|
lwaRefreshToken: string().min(1),
|
|
104475
105082
|
expiresAt: number$1().int().nonnegative()
|
|
104476
105083
|
});
|
|
105084
|
+
/**
|
|
105085
|
+
* Refuse (403, logged with the reason) a caller whose token was linked to another instance.
|
|
105086
|
+
* True when the reply was sent; the caller must return.
|
|
105087
|
+
*/
|
|
105088
|
+
function refusedForInstance(caller, reply, deps, label) {
|
|
105089
|
+
const verdict = deps.judgeInstance(caller);
|
|
105090
|
+
if (verdict.kind === "serves") return false;
|
|
105091
|
+
deps.logger.warn(`${label}: refused — ${verdict.reason}`, { meta: {
|
|
105092
|
+
instanceId: deps.instanceId,
|
|
105093
|
+
tokenInstanceId: caller.instanceId ?? null,
|
|
105094
|
+
userId: caller.userId
|
|
105095
|
+
} });
|
|
105096
|
+
reply.code(403).send({
|
|
105097
|
+
error: verdict.reason,
|
|
105098
|
+
message: describeTokenInstanceRefusal(verdict.reason)
|
|
105099
|
+
});
|
|
105100
|
+
return true;
|
|
105101
|
+
}
|
|
104477
105102
|
async function handleLwaTokensCallback(request, reply, deps) {
|
|
104478
105103
|
const parsed = LwaTokensCallbackBodySchema.safeParse(request.body);
|
|
104479
105104
|
if (!parsed.success) {
|
|
@@ -104493,6 +105118,7 @@ async function handleLwaTokensCallback(request, reply, deps) {
|
|
|
104493
105118
|
});
|
|
104494
105119
|
return;
|
|
104495
105120
|
}
|
|
105121
|
+
if (refusedForInstance(caller, reply, deps, "alexa lwa-tokens-callback")) return;
|
|
104496
105122
|
const { userId, username } = caller;
|
|
104497
105123
|
await deps.upsertToken({
|
|
104498
105124
|
userId,
|
|
@@ -104519,10 +105145,14 @@ async function resolveCaller(request, deps) {
|
|
|
104519
105145
|
if (!bearer) return null;
|
|
104520
105146
|
const rawVerified = await deps.ctx.api.userManagement.oauthVerifyAccessToken.query({ token: bearer });
|
|
104521
105147
|
const verifiedParse = OauthVerifiedResultSchema$1.safeParse(rawVerified);
|
|
104522
|
-
if (verifiedParse.success && verifiedParse.data)
|
|
104523
|
-
userId
|
|
104524
|
-
|
|
104525
|
-
|
|
105148
|
+
if (verifiedParse.success && verifiedParse.data) {
|
|
105149
|
+
const { userId, username, instanceId } = verifiedParse.data;
|
|
105150
|
+
return {
|
|
105151
|
+
userId,
|
|
105152
|
+
username,
|
|
105153
|
+
...instanceId !== void 0 ? { instanceId } : {}
|
|
105154
|
+
};
|
|
105155
|
+
}
|
|
104526
105156
|
deps.logger.debug("alexa lwa-tokens-callback: bearer present but did not verify");
|
|
104527
105157
|
return null;
|
|
104528
105158
|
}
|
|
@@ -104595,6 +105225,7 @@ async function handleBrokerLinkCallback(request, reply, deps) {
|
|
|
104595
105225
|
});
|
|
104596
105226
|
return;
|
|
104597
105227
|
}
|
|
105228
|
+
if (refusedForInstance(caller, reply, deps, "alexa broker-link")) return;
|
|
104598
105229
|
await deps.upsertToken({
|
|
104599
105230
|
userId: caller.userId,
|
|
104600
105231
|
accessToken: body.lwaAccessToken,
|
|
@@ -104875,12 +105506,16 @@ async function handleSnapshotFetch(req, reply, deps) {
|
|
|
104875
105506
|
* we register via the `addon-routes` capability.
|
|
104876
105507
|
*
|
|
104877
105508
|
* Public URLs (assuming the hub is reachable as `https://<hub>`):
|
|
104878
|
-
* POST /addon/export-alexa/
|
|
104879
|
-
* POST /addon/export-alexa/oauth/broker-link
|
|
104880
|
-
* POST /addon/export-alexa/oauth/lwa-tokens
|
|
105509
|
+
* POST /addon/export-alexa[/instances/:instanceId]/directive
|
|
105510
|
+
* POST /addon/export-alexa[/instances/:instanceId]/oauth/broker-link (Lambda → hub, D753)
|
|
105511
|
+
* POST /addon/export-alexa[/instances/:instanceId]/oauth/lwa-tokens (Lambda → hub, pre-D753)
|
|
105512
|
+
*
|
|
105513
|
+
* The three are `perInstance` routes (D1046): the hub reads the instance segment. Without one
|
|
105514
|
+
* the skill is found by its ingress token, then falls back to the default skill
|
|
105515
|
+
* (`instance-routing.ts`). The same three with a trailing `/:instanceId` are the addresses a
|
|
105516
|
+
* Lambda built with `HUB_INSTANCE_ID` before D1046 still calls (planning#422); they stay.
|
|
104881
105517
|
*
|
|
104882
|
-
*
|
|
104883
|
-
* to the first skill (`instance-routing.ts`).
|
|
105518
|
+
* A token linked to another instance is refused (`token-instance.ts`, D1047).
|
|
104884
105519
|
*
|
|
104885
105520
|
* OAuth account-linking is handled by the core `/oauth2/*` server
|
|
104886
105521
|
* (integration=export-alexa). This addon registers an `oauth-integration`
|
|
@@ -104889,23 +105524,26 @@ async function handleSnapshotFetch(req, reply, deps) {
|
|
|
104889
105524
|
var OauthVerifiedResultSchema = object({
|
|
104890
105525
|
userId: string(),
|
|
104891
105526
|
username: string(),
|
|
104892
|
-
scopes: array(TokenScopeSchema)
|
|
105527
|
+
scopes: array(TokenScopeSchema),
|
|
105528
|
+
/** The instance the link was made for; absent = the default instance (D1047). */
|
|
105529
|
+
instanceId: string().optional()
|
|
104893
105530
|
}).nullable();
|
|
104894
105531
|
/** Header the D753 Lambda sends its broker origin on. */
|
|
104895
105532
|
var BROKER_HEADER = "x-camstack-broker";
|
|
104896
105533
|
function buildRoutes(deps) {
|
|
104897
105534
|
const forSkill = (description, path, handler) => [{
|
|
104898
105535
|
method: "POST",
|
|
104899
|
-
path
|
|
105536
|
+
path,
|
|
104900
105537
|
access: "public",
|
|
104901
|
-
|
|
104902
|
-
|
|
105538
|
+
perInstance: true,
|
|
105539
|
+
description: `${description} (the skill named by the instance segment; without one, the skill that presents its ingress token, else the default skill)`,
|
|
105540
|
+
handler: (req, reply) => routeToSkill(req, reply, deps, explicitInstance(req.instanceId), handler)
|
|
104903
105541
|
}, {
|
|
104904
105542
|
method: "POST",
|
|
104905
|
-
path
|
|
105543
|
+
path: `${path}/:instanceId`,
|
|
104906
105544
|
access: "public",
|
|
104907
|
-
description: `${description} (
|
|
104908
|
-
handler: (req, reply) => routeToSkill(req, reply, deps,
|
|
105545
|
+
description: `${description} (one skill, named after the path: the address older Lambdas call)`,
|
|
105546
|
+
handler: (req, reply) => routeToSkill(req, reply, deps, req.params["instanceId"], handler)
|
|
104909
105547
|
}];
|
|
104910
105548
|
return [
|
|
104911
105549
|
...forSkill("Alexa Smart Home directive ingress (forwarded by the user-owned Lambda)", "/directive", (req, reply, skill) => handleDirective(req, reply, deps, skill)),
|
|
@@ -104926,6 +105564,14 @@ function buildRoutes(deps) {
|
|
|
104926
105564
|
}
|
|
104927
105565
|
];
|
|
104928
105566
|
}
|
|
105567
|
+
/**
|
|
105568
|
+
* The instance a per-instance request names for the resolver. The default instance (no segment,
|
|
105569
|
+
* or the addon id) names none: its address is shared with a Lambda that finds its skill by the
|
|
105570
|
+
* ingress header (planning#422), so the resolver keeps that lookup for it.
|
|
105571
|
+
*/
|
|
105572
|
+
function explicitInstance(instanceId) {
|
|
105573
|
+
return instanceId === void 0 || instanceId === "export-alexa" ? void 0 : instanceId;
|
|
105574
|
+
}
|
|
104929
105575
|
/** Resolve the request's skill, or answer that there is none. */
|
|
104930
105576
|
async function routeToSkill(request, reply, deps, pathInstanceId, handler) {
|
|
104931
105577
|
const skill = deps.resolveSkill({
|
|
@@ -105038,6 +105684,19 @@ async function handleDirective(request, reply, deps, skill) {
|
|
|
105038
105684
|
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`));
|
|
105039
105685
|
return;
|
|
105040
105686
|
}
|
|
105687
|
+
const instanceVerdict = judgeTokenInstance(verified, skill);
|
|
105688
|
+
if (instanceVerdict.kind === "refused") {
|
|
105689
|
+
deps.logger.warn(`alexa directive: refused — ${instanceVerdict.reason}`, {
|
|
105690
|
+
...arrival.deviceId !== void 0 ? { tags: { deviceId: arrival.deviceId } } : {},
|
|
105691
|
+
meta: {
|
|
105692
|
+
instanceId: skill.id,
|
|
105693
|
+
tokenInstanceId: verified.instanceId ?? null,
|
|
105694
|
+
userId: verified.userId
|
|
105695
|
+
}
|
|
105696
|
+
});
|
|
105697
|
+
reply.code(200).send(preParseErrorEnvelope("INVALID_AUTHORIZATION_CREDENTIAL", describeTokenInstanceRefusal(instanceVerdict.reason)));
|
|
105698
|
+
return;
|
|
105699
|
+
}
|
|
105041
105700
|
try {
|
|
105042
105701
|
assertDeviceScope(verified.scopes);
|
|
105043
105702
|
} catch {
|
|
@@ -105805,25 +106464,6 @@ var ADDON_MIGRATIONS = [
|
|
|
105805
106464
|
//#endregion
|
|
105806
106465
|
//#region src/oauth-integration.ts
|
|
105807
106466
|
/**
|
|
105808
|
-
* The `export-alexa` OAuth client — the descriptor behind
|
|
105809
|
-
* `/api/oauth2/authorize?integration=export-alexa`.
|
|
105810
|
-
*
|
|
105811
|
-
* Shaped deliberately like
|
|
105812
|
-
* `packages/addon-provider-homeassistant/src/ha-export/oauth-integration.ts`:
|
|
105813
|
-
* one named `OauthIntegrationDescriptor` per integration, in its own module,
|
|
105814
|
-
* registered from the addon's `onInitialize` through `oauthIntegrationCapability`
|
|
105815
|
-
* ([D101](../../../docs/decisions/adr-0101.md)). The two integrations differ
|
|
105816
|
-
* only in the FIELDS below, never in how they are declared — which is the whole
|
|
105817
|
-
* claim being made: a third one is configuration, not framework work.
|
|
105818
|
-
*
|
|
105819
|
-
* Typed rather than inlined, and that is not cosmetic. As an untyped object
|
|
105820
|
-
* literal this needed three `as const` assertions to satisfy the schema and was
|
|
105821
|
-
* checked for the first time at `/authorize`, i.e. in front of an operator
|
|
105822
|
-
* mid-link. The annotation moves that to compile time.
|
|
105823
|
-
*
|
|
105824
|
-
* @see docs/decisions/adr-0092.md — why `client_secret` is never checked here.
|
|
105825
|
-
*/
|
|
105826
|
-
/**
|
|
105827
106467
|
* Where Alexa lands after consent — Amazon's three regional account-linking
|
|
105828
106468
|
* origins, fixed and public. Contrast Home Assistant, whose callback is on the
|
|
105829
106469
|
* operator's own LAN and needs `allowedPrivateHostPaths`; that difference is
|
|
@@ -105859,7 +106499,7 @@ var ALEXA_REDIRECT_PREFIXES = [
|
|
|
105859
106499
|
* no `requiresPkce` here. That is a property of the two clients, expressed
|
|
105860
106500
|
* through the same descriptor field.
|
|
105861
106501
|
*/
|
|
105862
|
-
function buildAlexaOauthIntegration(publicOrigin) {
|
|
106502
|
+
function buildAlexaOauthIntegration(publicOrigin, instances = []) {
|
|
105863
106503
|
return {
|
|
105864
106504
|
integrationId: "export-alexa",
|
|
105865
106505
|
displayName: "Alexa Smart Home",
|
|
@@ -105896,7 +106536,8 @@ function buildAlexaOauthIntegration(publicOrigin) {
|
|
|
105896
106536
|
* "Unlink Amazon account" button does; see `unlinkAlexaAccounts`.
|
|
105897
106537
|
*/
|
|
105898
106538
|
refreshTokenTtlSec: "never",
|
|
105899
|
-
...publicOrigin ? { hubUrl: publicOrigin } : {}
|
|
106539
|
+
...publicOrigin ? { hubUrl: publicOrigin } : {},
|
|
106540
|
+
...instances.length > 0 ? { instances: [...instances] } : {}
|
|
105900
106541
|
};
|
|
105901
106542
|
}
|
|
105902
106543
|
//#endregion
|
|
@@ -109639,15 +110280,22 @@ var SkillRuntime = class {
|
|
|
109639
110280
|
}
|
|
109640
110281
|
/** The routes' view of this skill: what a directive or a Lambda callback acts on. */
|
|
109641
110282
|
routed() {
|
|
110283
|
+
const hasLinkedUser = (userId) => this.view.linkedAccounts.some((a) => a.userId === userId);
|
|
109642
110284
|
return {
|
|
109643
110285
|
id: this.instanceId,
|
|
109644
110286
|
getSettings: () => this.effectiveSettings(),
|
|
109645
110287
|
directiveDeps: this.directiveDeps(),
|
|
110288
|
+
hasLinkedUser,
|
|
109646
110289
|
lwaTokensCallbackDeps: {
|
|
109647
110290
|
ctx: this.ctx,
|
|
109648
110291
|
logger: this.ctx.logger,
|
|
109649
110292
|
upsertToken: (input) => this.upsertToken(input),
|
|
109650
|
-
recordLinkedAccount: (input) => this.recordLinkedAccount(input)
|
|
110293
|
+
recordLinkedAccount: (input) => this.recordLinkedAccount(input),
|
|
110294
|
+
instanceId: this.instanceId,
|
|
110295
|
+
judgeInstance: (caller) => judgeTokenInstance(caller, {
|
|
110296
|
+
id: this.instanceId,
|
|
110297
|
+
hasLinkedUser
|
|
110298
|
+
})
|
|
109651
110299
|
},
|
|
109652
110300
|
onBrokerAdvertised: (raw) => this.rememberAdvertisedBroker(raw)
|
|
109653
110301
|
};
|
|
@@ -110770,7 +111418,6 @@ var SUPPORTED_KINDS = [
|
|
|
110770
111418
|
DeviceType.Sensor,
|
|
110771
111419
|
DeviceType.Lock,
|
|
110772
111420
|
DeviceType.Presence,
|
|
110773
|
-
DeviceType.Thermostat,
|
|
110774
111421
|
DeviceType.Climate,
|
|
110775
111422
|
DeviceType.Cover,
|
|
110776
111423
|
DeviceType.Generic
|
|
@@ -111020,7 +111667,7 @@ var ExportAlexaAddon = class extends BaseAddon {
|
|
|
111020
111667
|
const oauthIntegrationProvider = { getDescriptor: async () => {
|
|
111021
111668
|
const endpoint = await this.publicEndpoint();
|
|
111022
111669
|
if (!endpoint.ok) this.ctx.logger.warn(`export-alexa: linking without a routing claim — ${endpoint.reason.code}: ${endpoint.reason.message}`);
|
|
111023
|
-
return buildAlexaOauthIntegration(endpoint.ok ? endpoint.origin : void 0);
|
|
111670
|
+
return buildAlexaOauthIntegration(endpoint.ok ? endpoint.origin : void 0, this.linkableInstances());
|
|
111024
111671
|
} };
|
|
111025
111672
|
const reaper = setInterval(() => {
|
|
111026
111673
|
this.reapDeadEgressHandles();
|
|
@@ -111068,6 +111715,13 @@ var ExportAlexaAddon = class extends BaseAddon {
|
|
|
111068
111715
|
async onConfigChanged() {
|
|
111069
111716
|
for (const runtime of this.runtimes.values()) await runtime.applyShapeSwitches();
|
|
111070
111717
|
}
|
|
111718
|
+
/** The running skills an account may be linked to with `instance=` (all but the default). */
|
|
111719
|
+
linkableInstances() {
|
|
111720
|
+
return [...this.runtimes.values()].filter((r) => !r.isDefault).map((r) => ({
|
|
111721
|
+
id: r.instanceId,
|
|
111722
|
+
displayName: r.skillName
|
|
111723
|
+
}));
|
|
111724
|
+
}
|
|
111071
111725
|
/** Build and start the runtime of one skill. */
|
|
111072
111726
|
async startRuntime(instanceId) {
|
|
111073
111727
|
const runtime = new SkillRuntime(instanceId, this.host());
|