@camstack/addon-provider-homematic 1.2.189 → 1.2.191
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 +17 -0
- package/dist/_stub.js +606 -606
- package/dist/{_virtual_mf-localSharedImportMap___mfe_internal__addon_provider_homematic_page-gabItMV6.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_provider_homematic_page-BxV9YeD6.mjs} +4 -4
- package/dist/_virtual_mf___mfe_internal__addon_provider_homematic_page__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-DsJZKFzR.mjs +26 -0
- package/dist/addon-provider-homematic.css +1 -1
- package/dist/addon.js +1327 -482
- package/dist/addon.mjs +1327 -482
- package/dist/{hostInit-_8HOpx8j.mjs → hostInit-CVYnx4wT.mjs} +3 -3
- package/dist/remoteEntry.js +1 -1
- package/dist/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__addon_provider_homematic_page__remoteEntry_js-CcrJu_nF.mjs → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__addon_provider_homematic_page__remoteEntry_js-DtvMyC4I.mjs} +1 -1
- package/package.json +3 -3
- package/dist/_virtual_mf___mfe_internal__addon_provider_homematic_page__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-BekQrhZR.mjs +0 -26
package/dist/addon.mjs
CHANGED
|
@@ -812,7 +812,7 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
|
812
812
|
return EventCategory;
|
|
813
813
|
}({});
|
|
814
814
|
//#endregion
|
|
815
|
-
//#region ../types/dist/composed-stable-id-
|
|
815
|
+
//#region ../types/dist/composed-stable-id-CPp3votu.mjs
|
|
816
816
|
/**
|
|
817
817
|
import { errMsg } from '@camstack/types'
|
|
818
818
|
* Extract a human-readable message from an unknown error value.
|
|
@@ -825,17 +825,18 @@ function errMsg(err) {
|
|
|
825
825
|
}
|
|
826
826
|
var DeviceType = /* @__PURE__ */ function(DeviceType) {
|
|
827
827
|
DeviceType["Camera"] = "camera";
|
|
828
|
+
/** Legacy stored value, read only by the hub-to-integration migrations; no live device carries it. */
|
|
828
829
|
DeviceType["Hub"] = "hub";
|
|
829
830
|
DeviceType["Light"] = "light";
|
|
830
831
|
DeviceType["Siren"] = "siren";
|
|
831
832
|
DeviceType["Switch"] = "switch";
|
|
832
833
|
DeviceType["Sensor"] = "sensor";
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
* `climate-control`
|
|
836
|
-
*
|
|
837
|
-
*
|
|
838
|
-
*
|
|
834
|
+
/** Every climate device: an air conditioner, a room thermostat, a radiator
|
|
835
|
+
* valve, a floor-heating zone, a heat-pump circuit. They share one set of
|
|
836
|
+
* controls (`climate-control`), so they are one type; WHICH kind of climate
|
|
837
|
+
* device it is is its {@link DeviceRole} (`climate-*`), which the UI and the
|
|
838
|
+
* exports branch on. The retired `thermostat` type is read as this one
|
|
839
|
+
* (`canonicalStoredDeviceType`). */
|
|
839
840
|
DeviceType["Climate"] = "climate";
|
|
840
841
|
DeviceType["Button"] = "button";
|
|
841
842
|
/** Generic stateless event emitter — carries a device's EXACT declared
|
|
@@ -926,10 +927,6 @@ var DeviceType = /* @__PURE__ */ function(DeviceType) {
|
|
|
926
927
|
/** Washing machine. A plug-built one is running while its power stays
|
|
927
928
|
* above a threshold. No program cap — that surface is the dishwasher's. */
|
|
928
929
|
DeviceType["Washer"] = "washer";
|
|
929
|
-
/** A dumb plug-in stove or heater: a switch (and, with a meter, a power
|
|
930
|
-
* reading) that only runs while the plug is on. Built from a smart plug;
|
|
931
|
-
* the `timed-run` cap switches it off again after a chosen time. */
|
|
932
|
-
DeviceType["Heater"] = "heater";
|
|
933
930
|
/** Tumble dryer. Same plug-built running surface as {@link Washer}. */
|
|
934
931
|
DeviceType["Dryer"] = "dryer";
|
|
935
932
|
/** The physical bridge box of a vendor ecosystem (Velux KLF-200, and later
|
|
@@ -1149,6 +1146,27 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
|
|
|
1149
1146
|
/** A smart plug: a `switch` whose source says it is an outlet (HA
|
|
1150
1147
|
* `device_class: outlet`). The Alexa export shows it as a SMARTPLUG. */
|
|
1151
1148
|
DeviceRole["Outlet"] = "outlet";
|
|
1149
|
+
/** A dumb plug-in stove or heater behind a switch: it runs only while the
|
|
1150
|
+
* switch is on. Offered `timed-run`, which switches it off again after a
|
|
1151
|
+
* chosen time. */
|
|
1152
|
+
DeviceRole["SwitchHeater"] = "switch-heater";
|
|
1153
|
+
/** A plain fan behind a switch (a smart plug powering it): drawn as a fan,
|
|
1154
|
+
* with the switch's on/off only. Speed or oscillation appear only when the
|
|
1155
|
+
* device also has a fan cap (D1033). */
|
|
1156
|
+
DeviceRole["SwitchFan"] = "switch-fan";
|
|
1157
|
+
/** Air conditioner / split unit: cooling, fan speed, louvres. */
|
|
1158
|
+
DeviceRole["ClimateAc"] = "climate-ac";
|
|
1159
|
+
/** Room thermostat: a setpoint and a room temperature. The default. */
|
|
1160
|
+
DeviceRole["ClimateThermostat"] = "climate-thermostat";
|
|
1161
|
+
/** Floor-heating zone actuator. */
|
|
1162
|
+
DeviceRole["ClimateFloor"] = "climate-floor";
|
|
1163
|
+
/** Radiator valve (thermostatic radiator head). */
|
|
1164
|
+
DeviceRole["ClimateRadiator"] = "climate-radiator";
|
|
1165
|
+
/** A heater with its own thermostat (stove, convector). */
|
|
1166
|
+
DeviceRole["ClimateHeater"] = "climate-heater";
|
|
1167
|
+
/** One heating/cooling circuit of a heat pump: a water loop with comfort /
|
|
1168
|
+
* eco setpoints and a heat/cool mode, no room sensor. */
|
|
1169
|
+
DeviceRole["ClimateHeatPumpCircuit"] = "climate-heat-pump-circuit";
|
|
1152
1170
|
/** Generic motion / occupancy / moving event source. Distinct from
|
|
1153
1171
|
* the camera accessory PirSensor role: that one is a camera child;
|
|
1154
1172
|
* this is a standalone HA / 3rd-party motion sensor. */
|
|
@@ -6036,7 +6054,7 @@ var ZodIssueCode = {
|
|
|
6036
6054
|
var ZodFirstPartyTypeKind;
|
|
6037
6055
|
ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
|
|
6038
6056
|
//#endregion
|
|
6039
|
-
//#region ../types/dist/sleep-
|
|
6057
|
+
//#region ../types/dist/sleep-D0roI_CZ.mjs
|
|
6040
6058
|
/**
|
|
6041
6059
|
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
6042
6060
|
* window to float samples (D455).
|
|
@@ -11753,6 +11771,50 @@ var ACTUATOR_CAP_VOCABULARY = {
|
|
|
11753
11771
|
value: false
|
|
11754
11772
|
},
|
|
11755
11773
|
args: { oscillating: false }
|
|
11774
|
+
},
|
|
11775
|
+
{
|
|
11776
|
+
id: "fan.horizontalOscillateOn",
|
|
11777
|
+
method: "setOscillationAxis",
|
|
11778
|
+
label: t("Horizontal oscillation on", "Oscillazione orizzontale attiva"),
|
|
11779
|
+
phrase: t("Start the horizontal oscillation of {device}", "Attiva l’oscillazione orizzontale di {device}"),
|
|
11780
|
+
icon: "move-horizontal",
|
|
11781
|
+
args: {
|
|
11782
|
+
axis: "horizontal",
|
|
11783
|
+
oscillating: true
|
|
11784
|
+
}
|
|
11785
|
+
},
|
|
11786
|
+
{
|
|
11787
|
+
id: "fan.horizontalOscillateOff",
|
|
11788
|
+
method: "setOscillationAxis",
|
|
11789
|
+
label: t("Horizontal oscillation off", "Oscillazione orizzontale spenta"),
|
|
11790
|
+
phrase: t("Stop the horizontal oscillation of {device}", "Ferma l’oscillazione orizzontale di {device}"),
|
|
11791
|
+
icon: "move-horizontal",
|
|
11792
|
+
args: {
|
|
11793
|
+
axis: "horizontal",
|
|
11794
|
+
oscillating: false
|
|
11795
|
+
}
|
|
11796
|
+
},
|
|
11797
|
+
{
|
|
11798
|
+
id: "fan.verticalOscillateOn",
|
|
11799
|
+
method: "setOscillationAxis",
|
|
11800
|
+
label: t("Vertical oscillation on", "Oscillazione verticale attiva"),
|
|
11801
|
+
phrase: t("Start the vertical oscillation of {device}", "Attiva l’oscillazione verticale di {device}"),
|
|
11802
|
+
icon: "move-vertical",
|
|
11803
|
+
args: {
|
|
11804
|
+
axis: "vertical",
|
|
11805
|
+
oscillating: true
|
|
11806
|
+
}
|
|
11807
|
+
},
|
|
11808
|
+
{
|
|
11809
|
+
id: "fan.verticalOscillateOff",
|
|
11810
|
+
method: "setOscillationAxis",
|
|
11811
|
+
label: t("Vertical oscillation off", "Oscillazione verticale spenta"),
|
|
11812
|
+
phrase: t("Stop the vertical oscillation of {device}", "Ferma l’oscillazione verticale di {device}"),
|
|
11813
|
+
icon: "move-vertical",
|
|
11814
|
+
args: {
|
|
11815
|
+
axis: "vertical",
|
|
11816
|
+
oscillating: false
|
|
11817
|
+
}
|
|
11756
11818
|
}
|
|
11757
11819
|
],
|
|
11758
11820
|
state: [{
|
|
@@ -13842,10 +13904,6 @@ var CAMERA_CAP_VOCABULARY = {
|
|
|
13842
13904
|
scope: "device",
|
|
13843
13905
|
noun: t("Admin link", "Link di amministrazione")
|
|
13844
13906
|
},
|
|
13845
|
-
"device-discovery": {
|
|
13846
|
-
scope: "device",
|
|
13847
|
-
noun: t("Discovery", "Rilevamento dispositivi")
|
|
13848
|
-
},
|
|
13849
13907
|
"device-extension": {
|
|
13850
13908
|
scope: "device",
|
|
13851
13909
|
noun: t("Device extension", "Estensione del dispositivo")
|
|
@@ -15342,7 +15400,6 @@ var CAP_NAMES = Object.freeze([
|
|
|
15342
15400
|
"device-admin-link",
|
|
15343
15401
|
"device-adoption",
|
|
15344
15402
|
"device-credentials",
|
|
15345
|
-
"device-discovery",
|
|
15346
15403
|
"device-export",
|
|
15347
15404
|
"device-extension",
|
|
15348
15405
|
"device-history",
|
|
@@ -15964,13 +16021,6 @@ Object.freeze({
|
|
|
15964
16021
|
"valueType": "string"
|
|
15965
16022
|
}
|
|
15966
16023
|
],
|
|
15967
|
-
"device-discovery": [{
|
|
15968
|
-
"path": "lastDiscoveryAt",
|
|
15969
|
-
"valueType": "number"
|
|
15970
|
-
}, {
|
|
15971
|
-
"path": "lastError",
|
|
15972
|
-
"valueType": "string"
|
|
15973
|
-
}],
|
|
15974
16024
|
"device-export": [
|
|
15975
16025
|
{
|
|
15976
16026
|
"path": "linkState",
|
|
@@ -16159,6 +16209,10 @@ Object.freeze({
|
|
|
16159
16209
|
"path": "lastEvent.eventType",
|
|
16160
16210
|
"valueType": "string"
|
|
16161
16211
|
},
|
|
16212
|
+
{
|
|
16213
|
+
"path": "lastEvent.sourceId",
|
|
16214
|
+
"valueType": "string"
|
|
16215
|
+
},
|
|
16162
16216
|
{
|
|
16163
16217
|
"path": "lastEvent.timestamp",
|
|
16164
16218
|
"valueType": "number"
|
|
@@ -17422,7 +17476,7 @@ Object.freeze({
|
|
|
17422
17476
|
}
|
|
17423
17477
|
});
|
|
17424
17478
|
//#endregion
|
|
17425
|
-
//#region ../types/dist/implemented-methods-
|
|
17479
|
+
//#region ../types/dist/implemented-methods-5YMDeE3f.mjs
|
|
17426
17480
|
/**
|
|
17427
17481
|
* The ffmpeg build every CamStack node downloads, per platform and arch.
|
|
17428
17482
|
*
|
|
@@ -44150,6 +44204,13 @@ var AutomationConditionOperatorSchema = _enum([
|
|
|
44150
44204
|
"in"
|
|
44151
44205
|
]);
|
|
44152
44206
|
/**
|
|
44207
|
+
* The stable name of an event leaf. A path (`when.0.1`) moves when a row is
|
|
44208
|
+
* reordered; the id does not, so a `triggered-by` leaf keeps pointing at the
|
|
44209
|
+
* same row. Optional: a leaf nothing refers to needs none.
|
|
44210
|
+
*/
|
|
44211
|
+
var EVENT_LEAF_ID_RE = /^[A-Za-z0-9_-]{1,40}$/;
|
|
44212
|
+
var eventLeafId = { id: string().regex(EVENT_LEAF_ID_RE).optional() };
|
|
44213
|
+
/**
|
|
44153
44214
|
* D8 compliance, and it is the reason a "becomes" leaf is not merely an event
|
|
44154
44215
|
* subscription: it evaluates against the **state mirror**, which is reconciled,
|
|
44155
44216
|
* and an event only WAKES the evaluation. A dropped event therefore DELAYS a
|
|
@@ -44157,6 +44218,7 @@ var AutomationConditionOperatorSchema = _enum([
|
|
|
44157
44218
|
*/
|
|
44158
44219
|
var DeviceBecomesLeafSchema = object({
|
|
44159
44220
|
kind: literal("device-becomes"),
|
|
44221
|
+
...eventLeafId,
|
|
44160
44222
|
deviceId: number$1().int().nonnegative(),
|
|
44161
44223
|
cap: string().min(1),
|
|
44162
44224
|
fieldPath: string().min(1),
|
|
@@ -44209,6 +44271,7 @@ var DeviceBecomesLeafSchema = object({
|
|
|
44209
44271
|
});
|
|
44210
44272
|
var DeviceEventLeafSchema = object({
|
|
44211
44273
|
kind: literal("device-event"),
|
|
44274
|
+
...eventLeafId,
|
|
44212
44275
|
/** An `EventCategory` value. */
|
|
44213
44276
|
category: string().min(1),
|
|
44214
44277
|
deviceId: number$1().int().nonnegative().optional()
|
|
@@ -44221,18 +44284,24 @@ var DeviceEventLeafSchema = object({
|
|
|
44221
44284
|
*/
|
|
44222
44285
|
var ScheduleLeafSchema = object({
|
|
44223
44286
|
kind: literal("schedule"),
|
|
44287
|
+
...eventLeafId,
|
|
44224
44288
|
at: TimeSpecSchema.optional(),
|
|
44225
44289
|
days: array(WeekdayKeySchema).min(1).max(7).optional(),
|
|
44226
44290
|
/** @deprecated legacy cron — new schedules use `at`. */
|
|
44227
44291
|
cron: string().min(1).max(120).optional()
|
|
44228
44292
|
}).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" });
|
|
44229
|
-
var ManualLeafSchema = object({
|
|
44293
|
+
var ManualLeafSchema = object({
|
|
44294
|
+
kind: literal("manual"),
|
|
44295
|
+
...eventLeafId
|
|
44296
|
+
});
|
|
44230
44297
|
var IntervalLeafSchema = object({
|
|
44231
44298
|
kind: literal("interval"),
|
|
44299
|
+
...eventLeafId,
|
|
44232
44300
|
minutes: number$1().int().min(1).max(1440)
|
|
44233
44301
|
});
|
|
44234
44302
|
var DetectionLeafSchema = object({
|
|
44235
44303
|
kind: literal("detection"),
|
|
44304
|
+
...eventLeafId,
|
|
44236
44305
|
/** One macro class each, optionally narrowed by a label; a track of any listed subject fires. */
|
|
44237
44306
|
subjects: array(DetectionSubjectSchema).min(1),
|
|
44238
44307
|
deviceIds: array(number$1().int().nonnegative()).min(1),
|
|
@@ -44243,6 +44312,7 @@ var DetectionLeafSchema = object({
|
|
|
44243
44312
|
});
|
|
44244
44313
|
var StationaryLeafSchema = object({
|
|
44245
44314
|
kind: literal("stationary"),
|
|
44315
|
+
...eventLeafId,
|
|
44246
44316
|
deviceIds: array(number$1().int().nonnegative()).min(1),
|
|
44247
44317
|
subjects: array(StationarySubjectSchema).min(1).optional(),
|
|
44248
44318
|
zones: array(string().min(1)).min(1).optional(),
|
|
@@ -44288,6 +44358,41 @@ var StationaryPresentLeafSchema = object({
|
|
|
44288
44358
|
minCount: number$1().int().positive().optional()
|
|
44289
44359
|
});
|
|
44290
44360
|
/**
|
|
44361
|
+
* True while the site-local clock is inside a daily window and/or on one of
|
|
44362
|
+
* the named days. `days` names the local day a window STARTS on, so
|
|
44363
|
+
* 22:00-06:00 on weekdays is still inside at 01:00 Saturday. A one-date spec
|
|
44364
|
+
* (`kind: 'date'`) is refused: only a clock time or a sun event makes a window
|
|
44365
|
+
* that repeats every day.
|
|
44366
|
+
*/
|
|
44367
|
+
var TimeIsLeafSchema = object({
|
|
44368
|
+
kind: literal("time-is"),
|
|
44369
|
+
between: object({
|
|
44370
|
+
from: TimeSpecSchema,
|
|
44371
|
+
to: TimeSpecSchema
|
|
44372
|
+
}).optional(),
|
|
44373
|
+
days: array(WeekdayKeySchema).min(1).max(7).optional()
|
|
44374
|
+
}).superRefine((leaf, ctx) => {
|
|
44375
|
+
if (leaf.between === void 0 && leaf.days === void 0) ctx.addIssue({
|
|
44376
|
+
code: "custom",
|
|
44377
|
+
message: "a time-is leaf needs a between window, days, or both"
|
|
44378
|
+
});
|
|
44379
|
+
for (const end of ["from", "to"]) if (leaf.between?.[end].kind === "date") ctx.addIssue({
|
|
44380
|
+
code: "custom",
|
|
44381
|
+
message: "a one-date time cannot bound a daily window: use a clock time or a sun event",
|
|
44382
|
+
path: ["between", end]
|
|
44383
|
+
});
|
|
44384
|
+
});
|
|
44385
|
+
/**
|
|
44386
|
+
* True for the run that one of the named event leaves started. It reads the
|
|
44387
|
+
* run, not a device: in the tree it is judged against the leaf that fired, in
|
|
44388
|
+
* a step guard against the trigger the run carries. A run no event leaf
|
|
44389
|
+
* started (a state-only tree becoming true) is false.
|
|
44390
|
+
*/
|
|
44391
|
+
var TriggeredByLeafSchema = object({
|
|
44392
|
+
kind: literal("triggered-by"),
|
|
44393
|
+
leafIds: array(string().regex(EVENT_LEAF_ID_RE)).min(1).max(20)
|
|
44394
|
+
});
|
|
44395
|
+
/**
|
|
44291
44396
|
* The escape hatch: the bounded expression engine over named device bindings.
|
|
44292
44397
|
* Declared as a plain object so a discriminated union can read `kind`; the
|
|
44293
44398
|
* author-time validation is the SAME function `ExpressionSourceSchema` runs.
|
|
@@ -44333,7 +44438,9 @@ var AutomationWhenSchema = lazy(() => discriminatedUnion("kind", [
|
|
|
44333
44438
|
StationaryLeafSchema,
|
|
44334
44439
|
DeviceIsLeafSchema,
|
|
44335
44440
|
StationaryPresentLeafSchema,
|
|
44336
|
-
ExpressionLeafSchema
|
|
44441
|
+
ExpressionLeafSchema,
|
|
44442
|
+
TimeIsLeafSchema,
|
|
44443
|
+
TriggeredByLeafSchema
|
|
44337
44444
|
]));
|
|
44338
44445
|
var EVENT_KINDS = new Set([
|
|
44339
44446
|
"device-becomes",
|
|
@@ -44387,6 +44494,28 @@ function hasEventLeaves(node) {
|
|
|
44387
44494
|
});
|
|
44388
44495
|
return found;
|
|
44389
44496
|
}
|
|
44497
|
+
/** The event leaves of the tree that carry an id, in tree order. */
|
|
44498
|
+
function identifiedEventLeaves(when) {
|
|
44499
|
+
const found = [];
|
|
44500
|
+
forEachLeaf(when, (leaf, path) => {
|
|
44501
|
+
if (isEventLeaf(leaf) && leaf.id !== void 0) found.push({
|
|
44502
|
+
id: leaf.id,
|
|
44503
|
+
path,
|
|
44504
|
+
leaf
|
|
44505
|
+
});
|
|
44506
|
+
});
|
|
44507
|
+
return found;
|
|
44508
|
+
}
|
|
44509
|
+
/** Does the tree hold a `triggered-by` leaf? */
|
|
44510
|
+
function hasTriggeredByLeaves(when) {
|
|
44511
|
+
let found = false;
|
|
44512
|
+
forEachLeaf(when, (leaf) => {
|
|
44513
|
+
if (leaf.kind === "triggered-by") found = true;
|
|
44514
|
+
});
|
|
44515
|
+
return found;
|
|
44516
|
+
}
|
|
44517
|
+
/** Why a `triggered-by` leaf is refused outside an automation: there is no trigger row to name. */
|
|
44518
|
+
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";
|
|
44390
44519
|
function hasEmptyContainer(node) {
|
|
44391
44520
|
if (isLeaf(node)) return false;
|
|
44392
44521
|
if (node.kind === "not") return hasEmptyContainer(node.child);
|
|
@@ -44445,6 +44574,11 @@ function validateWhenTree(when) {
|
|
|
44445
44574
|
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`;
|
|
44446
44575
|
const leaves = countWhenLeaves(when);
|
|
44447
44576
|
if (leaves > 32) return `the rules use ${leaves} rows — the limit is 32`;
|
|
44577
|
+
const seen = /* @__PURE__ */ new Set();
|
|
44578
|
+
for (const entry of identifiedEventLeaves(when)) {
|
|
44579
|
+
if (seen.has(entry.id)) return `two trigger rows share the id "${entry.id}" — an id names one row`;
|
|
44580
|
+
seen.add(entry.id);
|
|
44581
|
+
}
|
|
44448
44582
|
const need = eventNeed(when, "when", false);
|
|
44449
44583
|
if ("error" in need) return need.error;
|
|
44450
44584
|
const [first, second] = need.paths;
|
|
@@ -44656,9 +44790,12 @@ function convertLegacyWhen(half) {
|
|
|
44656
44790
|
* every caller — automations, Actions, and the notification centre, which runs
|
|
44657
44791
|
* only Actions (planning#473).
|
|
44658
44792
|
*/
|
|
44793
|
+
/** The longest one `wait` step lasts. It is cut by a restart of the run and does not survive a hub restart. */
|
|
44794
|
+
var WAIT_MAX_SECONDS = 3600;
|
|
44795
|
+
var WAIT_TOO_LONG = `a wait is at most one hour (${WAIT_MAX_SECONDS} s)`;
|
|
44659
44796
|
var AutomationWaitStepSchema = object({
|
|
44660
44797
|
kind: literal("wait"),
|
|
44661
|
-
seconds: number$1().min(0).max(
|
|
44798
|
+
seconds: number$1().min(0).max(WAIT_MAX_SECONDS, WAIT_TOO_LONG)
|
|
44662
44799
|
});
|
|
44663
44800
|
/** The legacy `deviceId` of a cap step: still READ, never written (D983). */
|
|
44664
44801
|
var LegacyStepDeviceSchema = union([
|
|
@@ -44728,28 +44865,227 @@ var elseNeedsIf = {
|
|
|
44728
44865
|
path: ["else"]
|
|
44729
44866
|
};
|
|
44730
44867
|
var GuardedWaitStepSchema = AutomationWaitStepSchema.extend(stepGuardShape).refine((step) => step.else === void 0 || step.if !== void 0, elseNeedsIf);
|
|
44731
|
-
|
|
44868
|
+
/**
|
|
44869
|
+
* A step of a STANDALONE list (an action, a scheduler point, a preset): the
|
|
44870
|
+
* same two step kinds an automation runs, minus a guard that reads the
|
|
44871
|
+
* automation's trigger, which such a list does not have.
|
|
44872
|
+
*/
|
|
44873
|
+
var ActionStepSchema = discriminatedUnion("kind", [GuardedWaitStepSchema, AutomationCapStepBaseSchema.extend(stepGuardShape).refine((step) => step.target !== void 0 || step.deviceId !== void 0, {
|
|
44874
|
+
message: "a cap step needs a target",
|
|
44875
|
+
path: ["target"]
|
|
44876
|
+
}).refine((step) => step.target?.kind !== "domain" || step.actionId !== void 0, {
|
|
44877
|
+
message: "a domain target needs the vocabulary action it applies to (actionId)",
|
|
44878
|
+
path: ["actionId"]
|
|
44879
|
+
}).refine((step) => step.else === void 0 || step.if !== void 0, elseNeedsIf)]).superRefine((step, ctx) => {
|
|
44880
|
+
if (step.if !== void 0 && hasTriggeredByLeaves(step.if)) ctx.addIssue({
|
|
44881
|
+
code: "custom",
|
|
44882
|
+
message: TRIGGERED_BY_NEEDS_AUTOMATION,
|
|
44883
|
+
path: ["if"]
|
|
44884
|
+
});
|
|
44885
|
+
});
|
|
44886
|
+
/**
|
|
44887
|
+
* Flow control of an AUTOMATION's list (#500). A standalone list (an action, a
|
|
44888
|
+
* scheduler point, a preset) stays `wait` and `cap`: it has no run of its own
|
|
44889
|
+
* to end and no variable bag to write.
|
|
44890
|
+
*/
|
|
44891
|
+
var continueOnErrorShape = {
|
|
44892
|
+
/** A failure of this step is traced `failed-continued` and the next step runs. */
|
|
44893
|
+
continueOnError: literal(true).optional() };
|
|
44894
|
+
/** An automation's cap step: the shared guarded cap step, plus `continueOnError`. */
|
|
44895
|
+
var AutomationGuardedCapStepSchema = AutomationCapStepBaseSchema.extend({
|
|
44896
|
+
...stepGuardShape,
|
|
44897
|
+
...continueOnErrorShape
|
|
44898
|
+
}).refine((step) => step.target !== void 0 || step.deviceId !== void 0, {
|
|
44732
44899
|
message: "a cap step needs a target",
|
|
44733
44900
|
path: ["target"]
|
|
44734
44901
|
}).refine((step) => step.target?.kind !== "domain" || step.actionId !== void 0, {
|
|
44735
44902
|
message: "a domain target needs the vocabulary action it applies to (actionId)",
|
|
44736
44903
|
path: ["actionId"]
|
|
44737
44904
|
}).refine((step) => step.else === void 0 || step.if !== void 0, elseNeedsIf);
|
|
44738
|
-
|
|
44905
|
+
/** End the run here, on purpose. `reason` may carry `{{vars.x}}` slots. */
|
|
44906
|
+
var AutomationStopStepSchema = object({
|
|
44907
|
+
kind: literal("stop"),
|
|
44908
|
+
reason: string().min(1, "a stop needs a reason: it is what the run trace shows").max(200),
|
|
44909
|
+
/** `ok`: the run ends as a success. `failed`: it ends as a failure, with the reason. */
|
|
44910
|
+
outcome: _enum(["ok", "failed"]),
|
|
44911
|
+
/** Stop only when this reads true; false or unknown does not stop. */
|
|
44912
|
+
if: AutomationWhenSchema.optional()
|
|
44913
|
+
});
|
|
44914
|
+
var SET_VAR_NAME_RE = /^[A-Za-z_][A-Za-z0-9_]{0,39}$/;
|
|
44915
|
+
/** Names the run itself writes and reads (`leaf` is what `triggered-by` judges): a step may not overwrite them. */
|
|
44916
|
+
var RESERVED_RUN_VARS = [
|
|
44917
|
+
"kind",
|
|
44918
|
+
"leaf",
|
|
44919
|
+
"at"
|
|
44920
|
+
];
|
|
44921
|
+
/**
|
|
44922
|
+
* Write variables into the run's bag, for the steps after it. SUBSTITUTION
|
|
44923
|
+
* only, never evaluation: a text value may carry `{{vars.x}}` slots.
|
|
44924
|
+
*/
|
|
44925
|
+
var AutomationSetStepSchema = object({
|
|
44926
|
+
kind: literal("set"),
|
|
44927
|
+
vars: record(string(), union([
|
|
44928
|
+
string().max(500),
|
|
44929
|
+
number$1(),
|
|
44930
|
+
boolean()
|
|
44931
|
+
])).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` }),
|
|
44932
|
+
/** Set only when this reads true; false or unknown leaves the bag as it is. */
|
|
44933
|
+
if: AutomationWhenSchema.optional()
|
|
44934
|
+
});
|
|
44935
|
+
var AutomationRunActionStepSchema = object({
|
|
44936
|
+
kind: literal("action"),
|
|
44937
|
+
/** An entry of the `actions` surface (`internal:<uuid>` or `<addonId>:<localId>`). */
|
|
44938
|
+
actionId: string().min(1),
|
|
44939
|
+
/** Values for the action's declared variables; the others take their default. */
|
|
44940
|
+
variables: record(string(), union([
|
|
44941
|
+
string(),
|
|
44942
|
+
number$1(),
|
|
44943
|
+
boolean()
|
|
44944
|
+
])).optional(),
|
|
44945
|
+
...continueOnErrorShape
|
|
44946
|
+
});
|
|
44947
|
+
/**
|
|
44948
|
+
* A step INSIDE a branch of a `choose`: a flow step with no condition of its
|
|
44949
|
+
* own (the branch is the condition) and no block inside it. Strict, so an `if`
|
|
44950
|
+
* written on such a step is refused rather than dropped.
|
|
44951
|
+
*/
|
|
44952
|
+
/** The longest a `wait-until` may wait: six hours. */
|
|
44953
|
+
var WAIT_UNTIL_TIMEOUT_MAX_S = 21600;
|
|
44954
|
+
/**
|
|
44955
|
+
* Pause the run until a condition is true (#500). The timeout is mandatory: a
|
|
44956
|
+
* run never waits without an end. `onTimeout` says what a wait that ran out
|
|
44957
|
+
* does: `continue` goes on to the next step, `stop` ends the run as a failure.
|
|
44958
|
+
* A condition that cannot be read is not "true": the wait goes on (D49).
|
|
44959
|
+
*/
|
|
44960
|
+
var AutomationWaitUntilStepSchema = object({
|
|
44961
|
+
kind: literal("wait-until"),
|
|
44962
|
+
when: AutomationWhenSchema,
|
|
44963
|
+
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)`),
|
|
44964
|
+
onTimeout: _enum(["continue", "stop"])
|
|
44965
|
+
}).strict();
|
|
44966
|
+
/** The step kinds that hold steps of their own, or pause on a condition: they nest two levels at most. */
|
|
44967
|
+
var BLOCK_STEP_KINDS = [
|
|
44968
|
+
"choose",
|
|
44969
|
+
"repeat",
|
|
44970
|
+
"parallel",
|
|
44971
|
+
"wait-until"
|
|
44972
|
+
];
|
|
44973
|
+
var NEST_TOO_DEEP = `steps nest two levels at most: a step inside a nested choose or repeat can be a plain step only`;
|
|
44974
|
+
function kindOf(input) {
|
|
44975
|
+
return typeof input === "object" && input !== null ? Reflect.get(input, "kind") : void 0;
|
|
44976
|
+
}
|
|
44977
|
+
/** Where the nesting ends, a block step is refused in words rather than as an unknown kind. */
|
|
44978
|
+
function nestTooDeep(issue) {
|
|
44979
|
+
const kind = kindOf(issue.input);
|
|
44980
|
+
return typeof kind === "string" && BLOCK_STEP_KINDS.includes(kind) ? NEST_TOO_DEEP : void 0;
|
|
44981
|
+
}
|
|
44982
|
+
var plainStepSchemas = [
|
|
44983
|
+
AutomationWaitStepSchema.strict(),
|
|
44984
|
+
AutomationCapStepBaseSchema.extend(continueOnErrorShape).strict().refine((step) => step.target !== void 0 || step.deviceId !== void 0, {
|
|
44985
|
+
message: "a cap step needs a target",
|
|
44986
|
+
path: ["target"]
|
|
44987
|
+
}).refine((step) => step.target?.kind !== "domain" || step.actionId !== void 0, {
|
|
44988
|
+
message: "a domain target needs the vocabulary action it applies to (actionId)",
|
|
44989
|
+
path: ["actionId"]
|
|
44990
|
+
}),
|
|
44991
|
+
AutomationStopStepSchema.omit({ if: true }).strict(),
|
|
44992
|
+
AutomationSetStepSchema.omit({ if: true }).strict(),
|
|
44993
|
+
AutomationRunActionStepSchema.strict()
|
|
44994
|
+
];
|
|
44995
|
+
/**
|
|
44996
|
+
* A plain step: a flow step with no condition of its own and no step inside
|
|
44997
|
+
* it. The second (last) level of nesting holds these only.
|
|
44998
|
+
*/
|
|
44999
|
+
var AutomationBranchStepSchema = discriminatedUnion("kind", plainStepSchemas, { error: nestTooDeep });
|
|
45000
|
+
/** A step that can run beside others: it writes no variable and does not end the run. */
|
|
45001
|
+
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");
|
|
45002
|
+
/**
|
|
45003
|
+
* Several steps at once (#500): all are started together and all are awaited.
|
|
45004
|
+
* A failure fails the run once the others finished, as in a sequence; a member
|
|
45005
|
+
* marked "continue if this fails" does not.
|
|
45006
|
+
*/
|
|
45007
|
+
var AutomationParallelStepSchema = object({
|
|
45008
|
+
kind: literal("parallel"),
|
|
45009
|
+
steps: array(AutomationParallelMemberSchema).min(2, "a parallel needs at least two steps").max(5, `a parallel takes at most 5 steps`)
|
|
45010
|
+
}).strict();
|
|
45011
|
+
var REPEAT_NEEDS_MAX = "a repeat on a condition needs a maximum number of iterations";
|
|
45012
|
+
/** A loop on a condition: the bound is mandatory, so a run never loops without an end. */
|
|
45013
|
+
var repeatConditionShape = {
|
|
45014
|
+
when: AutomationWhenSchema,
|
|
45015
|
+
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`),
|
|
45016
|
+
/** A pause between two iterations, never after the last. */
|
|
45017
|
+
waitS: number$1().int().min(1).max(WAIT_MAX_SECONDS, WAIT_TOO_LONG).optional()
|
|
45018
|
+
};
|
|
45019
|
+
/** What decides how many times a `repeat` runs. */
|
|
45020
|
+
var AutomationRepeatLoopSchema = discriminatedUnion("by", [
|
|
45021
|
+
object({
|
|
45022
|
+
by: literal("count"),
|
|
45023
|
+
count: number$1().int().min(1).max(20, `a repeat runs at most 20 times`)
|
|
45024
|
+
}).strict(),
|
|
45025
|
+
object({
|
|
45026
|
+
by: literal("while"),
|
|
45027
|
+
...repeatConditionShape
|
|
45028
|
+
}).strict(),
|
|
45029
|
+
object({
|
|
45030
|
+
by: literal("until"),
|
|
45031
|
+
...repeatConditionShape
|
|
45032
|
+
}).strict(),
|
|
45033
|
+
object({
|
|
45034
|
+
by: literal("forEach"),
|
|
45035
|
+
target: object({
|
|
45036
|
+
kind: literal("devices"),
|
|
45037
|
+
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`)
|
|
45038
|
+
}).strict()
|
|
45039
|
+
}).strict()
|
|
45040
|
+
]);
|
|
45041
|
+
/**
|
|
45042
|
+
* The same steps several times (#500). Every form is bounded at save, so a
|
|
45043
|
+
* run cannot loop without an end. A failure or a `stop` in the steps ends the
|
|
45044
|
+
* loop and the run, as in a sequence.
|
|
45045
|
+
*/
|
|
45046
|
+
function repeatSchemaOf(step) {
|
|
45047
|
+
return object({
|
|
45048
|
+
kind: literal("repeat"),
|
|
45049
|
+
loop: AutomationRepeatLoopSchema,
|
|
45050
|
+
steps: array(step).min(1, "a repeat needs at least one step").max(10, `a repeat takes at most 10 steps`)
|
|
45051
|
+
}).strict();
|
|
45052
|
+
}
|
|
45053
|
+
/**
|
|
45054
|
+
* One step, several ways (#500): the branches are read in order and the FIRST
|
|
45055
|
+
* whose condition is true runs; `else` runs when every branch is false. A
|
|
45056
|
+
* branch that cannot be read ends the choice: nothing runs, not the branches
|
|
45057
|
+
* after it and not the else (D49). The #472 `if` / `else` of a wait or cap
|
|
45058
|
+
* step is the one-branch case and stays as it is stored.
|
|
45059
|
+
*/
|
|
45060
|
+
function chooseSchemaOf(step) {
|
|
45061
|
+
const steps = array(step).max(10);
|
|
45062
|
+
return object({
|
|
45063
|
+
kind: literal("choose"),
|
|
45064
|
+
branches: array(object({
|
|
45065
|
+
if: AutomationWhenSchema,
|
|
45066
|
+
steps: steps.min(1, "a branch needs at least one step")
|
|
45067
|
+
})).min(1, "a choose needs at least one branch").max(6, `a choose takes at most 6 branches`),
|
|
45068
|
+
else: steps.optional()
|
|
45069
|
+
});
|
|
45070
|
+
}
|
|
45071
|
+
var AutomationBodyStepSchema = discriminatedUnion("kind", [
|
|
45072
|
+
...plainStepSchemas,
|
|
45073
|
+
AutomationWaitUntilStepSchema,
|
|
45074
|
+
AutomationParallelStepSchema,
|
|
45075
|
+
chooseSchemaOf(AutomationBranchStepSchema),
|
|
45076
|
+
repeatSchemaOf(AutomationBranchStepSchema)
|
|
45077
|
+
]);
|
|
45078
|
+
var AutomationRepeatStepSchema = repeatSchemaOf(AutomationBodyStepSchema);
|
|
44739
45079
|
var AutomationActionSchema = discriminatedUnion("kind", [
|
|
44740
45080
|
GuardedWaitStepSchema,
|
|
44741
|
-
|
|
44742
|
-
|
|
44743
|
-
|
|
44744
|
-
|
|
44745
|
-
|
|
44746
|
-
|
|
44747
|
-
|
|
44748
|
-
|
|
44749
|
-
number$1(),
|
|
44750
|
-
boolean()
|
|
44751
|
-
])).optional()
|
|
44752
|
-
}),
|
|
45081
|
+
AutomationGuardedCapStepSchema,
|
|
45082
|
+
AutomationStopStepSchema,
|
|
45083
|
+
AutomationSetStepSchema,
|
|
45084
|
+
chooseSchemaOf(AutomationBodyStepSchema),
|
|
45085
|
+
AutomationWaitUntilStepSchema,
|
|
45086
|
+
AutomationParallelStepSchema,
|
|
45087
|
+
AutomationRepeatStepSchema,
|
|
45088
|
+
AutomationRunActionStepSchema,
|
|
44753
45089
|
object({
|
|
44754
45090
|
kind: literal("code"),
|
|
44755
45091
|
/** Compiled into the automation's OWN block by esbuild — not a third
|
|
@@ -44812,11 +45148,6 @@ function convertLegacyRecipe(legacy) {
|
|
|
44812
45148
|
...rest
|
|
44813
45149
|
};
|
|
44814
45150
|
}
|
|
44815
|
-
/**
|
|
44816
|
-
* Where recipes are PARSED (the core-blocks cap, the MCP tool, the literal a
|
|
44817
|
-
* saved block carries): the new shape as it is, or the old shape converted to
|
|
44818
|
-
* it. The output type is always the new one.
|
|
44819
|
-
*/
|
|
44820
45151
|
var AutomationRecipeSchema = union([CurrentAutomationRecipeSchema, LegacyAutomationRecipeSchema.transform(convertLegacyRecipe)]);
|
|
44821
45152
|
var DETECTION_DESCRIPTIONS = {
|
|
44822
45153
|
deviceId: "the camera that saw it",
|
|
@@ -44832,6 +45163,11 @@ var STATIONARY_DESCRIPTIONS = {
|
|
|
44832
45163
|
phase: "appeared or departed",
|
|
44833
45164
|
entryId: "the stopped object"
|
|
44834
45165
|
};
|
|
45166
|
+
var BECOMES_DESCRIPTIONS = {
|
|
45167
|
+
deviceId: "the device that changed",
|
|
45168
|
+
from: "the value before the change, empty when it is not known",
|
|
45169
|
+
to: "the value it changed to"
|
|
45170
|
+
};
|
|
44835
45171
|
function describe$1(descriptions) {
|
|
44836
45172
|
return Object.entries(descriptions).map(([name, description]) => ({
|
|
44837
45173
|
name,
|
|
@@ -44840,6 +45176,10 @@ function describe$1(descriptions) {
|
|
|
44840
45176
|
}
|
|
44841
45177
|
describe$1(DETECTION_DESCRIPTIONS);
|
|
44842
45178
|
describe$1(STATIONARY_DESCRIPTIONS);
|
|
45179
|
+
describe$1(BECOMES_DESCRIPTIONS).map((v) => v.name === "deviceId" ? {
|
|
45180
|
+
...v,
|
|
45181
|
+
hintKey: "becomesDeviceId"
|
|
45182
|
+
} : v);
|
|
44843
45183
|
new Set(Object.values(COCO_TO_MACRO.mapping));
|
|
44844
45184
|
/**
|
|
44845
45185
|
* Schedulers (D983) — an entity that performs actions over the day.
|
|
@@ -44864,6 +45204,13 @@ var SchedulerStateTreeSchema = AutomationWhenSchema.superRefine((when, ctx) => {
|
|
|
44864
45204
|
});
|
|
44865
45205
|
return;
|
|
44866
45206
|
}
|
|
45207
|
+
if (hasTriggeredByLeaves(when)) {
|
|
45208
|
+
ctx.addIssue({
|
|
45209
|
+
code: "custom",
|
|
45210
|
+
message: TRIGGERED_BY_NEEDS_AUTOMATION
|
|
45211
|
+
});
|
|
45212
|
+
return;
|
|
45213
|
+
}
|
|
44867
45214
|
const problem = validateWhenTree(when);
|
|
44868
45215
|
if (problem !== null) ctx.addIssue({
|
|
44869
45216
|
code: "custom",
|
|
@@ -44885,12 +45232,16 @@ var HoldOverrideSchema = discriminatedUnion("mode", [object({ mode: literal("res
|
|
|
44885
45232
|
})]);
|
|
44886
45233
|
/** A missed edge up to this late still runs. */
|
|
44887
45234
|
var DEFAULT_MAX_LATE_MS = 10 * 6e4;
|
|
45235
|
+
var SchedulerStepSchema = ActionStepSchema.refine((step) => step.kind !== "wait" || step.seconds <= 300, {
|
|
45236
|
+
message: `a scheduler point waits at most five minutes (300 s); put a longer wait in an action`,
|
|
45237
|
+
path: ["seconds"]
|
|
45238
|
+
});
|
|
44888
45239
|
var SchedulerPointSchema = object({
|
|
44889
45240
|
id: string().min(1).max(64),
|
|
44890
45241
|
at: SchedulerTimeSpecSchema,
|
|
44891
45242
|
mode: SchedulerPointModeSchema,
|
|
44892
45243
|
/** The actions of an `edge` or `hold`; a `release` has none. */
|
|
44893
|
-
steps: array(
|
|
45244
|
+
steps: array(SchedulerStepSchema).max(20).default([]),
|
|
44894
45245
|
/** Checked when the point runs (an edge) or is applied (a hold). */
|
|
44895
45246
|
conditions: SchedulerStateTreeSchema.optional(),
|
|
44896
45247
|
/** Hold only; absent means `respect`. */
|
|
@@ -45084,6 +45435,8 @@ var AutomationConditionTraceNodeSchema = object({
|
|
|
45084
45435
|
"device-is",
|
|
45085
45436
|
"expression",
|
|
45086
45437
|
"stationary-present",
|
|
45438
|
+
"time-is",
|
|
45439
|
+
"triggered-by",
|
|
45087
45440
|
"device-becomes",
|
|
45088
45441
|
"device-event",
|
|
45089
45442
|
"schedule",
|
|
@@ -45156,18 +45509,46 @@ var StepTraceBaseSchema = object({
|
|
|
45156
45509
|
]).optional(),
|
|
45157
45510
|
/** Why the condition read what it read, in the evaluator's own words. */
|
|
45158
45511
|
conditionReason: string().optional(),
|
|
45159
|
-
/** `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. */
|
|
45512
|
+
/** `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). */
|
|
45160
45513
|
outcome: _enum([
|
|
45161
45514
|
"ok",
|
|
45162
45515
|
"error",
|
|
45163
45516
|
"not-run",
|
|
45164
45517
|
"empty",
|
|
45165
|
-
"skipped"
|
|
45518
|
+
"skipped",
|
|
45519
|
+
"failed-continued",
|
|
45520
|
+
"timed-out"
|
|
45166
45521
|
]),
|
|
45167
45522
|
message: string().optional()
|
|
45168
45523
|
});
|
|
45524
|
+
/** What a block step adds to its row: which list ran, what each branch read, how many rounds. */
|
|
45525
|
+
var blockTraceShape = {
|
|
45526
|
+
/** A `choose` step (#500): the list that ran, `branches.<n>` or `else`. Absent when none did. */
|
|
45527
|
+
branch: string().optional(),
|
|
45528
|
+
/** A `choose` step: what each branch read, in order, up to the one that decided. */
|
|
45529
|
+
branchChecks: array(object({
|
|
45530
|
+
condition: _enum([
|
|
45531
|
+
"true",
|
|
45532
|
+
"false",
|
|
45533
|
+
"unknown"
|
|
45534
|
+
]),
|
|
45535
|
+
conditionReason: string().optional()
|
|
45536
|
+
})).optional(),
|
|
45537
|
+
/** A `repeat` step (#500): how many times its steps ran. */
|
|
45538
|
+
iterations: number$1().int().optional()
|
|
45539
|
+
};
|
|
45540
|
+
/** A step one level down: it may be a block step itself, whose own steps are plain rows (the nesting ends there). */
|
|
45541
|
+
var NestedStepTraceSchema = StepTraceBaseSchema.extend({
|
|
45542
|
+
...blockTraceShape,
|
|
45543
|
+
steps: array(StepTraceBaseSchema).optional()
|
|
45544
|
+
});
|
|
45169
45545
|
/** A step trace; the `else` steps that ran are one level of the same shape (the nesting is bounded at one). */
|
|
45170
|
-
var AutomationStepTraceSchema = StepTraceBaseSchema.extend({
|
|
45546
|
+
var AutomationStepTraceSchema = StepTraceBaseSchema.extend({
|
|
45547
|
+
else: array(StepTraceBaseSchema).optional(),
|
|
45548
|
+
...blockTraceShape,
|
|
45549
|
+
/** A `choose` step: the steps of the list that ran. A `parallel`: its members. A `repeat`: the LAST iteration. */
|
|
45550
|
+
steps: array(NestedStepTraceSchema).optional()
|
|
45551
|
+
});
|
|
45171
45552
|
var AutomationRunTraceSchema = object({
|
|
45172
45553
|
runId: string().min(1),
|
|
45173
45554
|
startedAt: number$1(),
|
|
@@ -45417,7 +45798,7 @@ object({
|
|
|
45417
45798
|
* is irrelevant; the array is treated as a set by consumers. */
|
|
45418
45799
|
hiddenChildIds: array(number$1()).readonly()
|
|
45419
45800
|
});
|
|
45420
|
-
DeviceType.Camera, DeviceType.
|
|
45801
|
+
DeviceType.Camera, DeviceType.Switch, DeviceType.Light, DeviceType.Sensor, DeviceType.Climate, DeviceType.Cover, DeviceType.Lock, DeviceType.Fan, DeviceType.MediaPlayer, DeviceType.AlarmPanel, DeviceType.Generic, method(object({
|
|
45421
45802
|
deviceId: number$1().int().nonnegative(),
|
|
45422
45803
|
childDeviceId: number$1().int().nonnegative(),
|
|
45423
45804
|
hidden: boolean()
|
|
@@ -45574,7 +45955,9 @@ var AddonHttpRouteSchema = object({
|
|
|
45574
45955
|
]).optional(),
|
|
45575
45956
|
description: string().optional(),
|
|
45576
45957
|
/** The hub limits this route per client address before the handler runs. */
|
|
45577
|
-
rateLimit: _enum(["auth"]).optional()
|
|
45958
|
+
rateLimit: _enum(["auth"]).optional(),
|
|
45959
|
+
/** Served once per integration instance; the handler reads `instanceId`. */
|
|
45960
|
+
perInstance: boolean().optional()
|
|
45578
45961
|
});
|
|
45579
45962
|
/**
|
|
45580
45963
|
* Cross-process route invocation envelope. The hub captures the
|
|
@@ -45591,6 +45974,8 @@ var InvokeRequestSchema = object({
|
|
|
45591
45974
|
query: record(string(), string()),
|
|
45592
45975
|
body: unknown(),
|
|
45593
45976
|
headers: record(string(), string()),
|
|
45977
|
+
/** The instance the hub resolved for a `perInstance` route. */
|
|
45978
|
+
instanceId: string().optional(),
|
|
45594
45979
|
user: object({
|
|
45595
45980
|
id: string(),
|
|
45596
45981
|
username: string(),
|
|
@@ -47715,7 +48100,7 @@ var BATTERY_DEVICE_TYPES = [
|
|
|
47715
48100
|
DeviceType.Switch,
|
|
47716
48101
|
DeviceType.PetFeeder,
|
|
47717
48102
|
DeviceType.Container,
|
|
47718
|
-
DeviceType.
|
|
48103
|
+
DeviceType.Climate,
|
|
47719
48104
|
DeviceType.EventEmitter
|
|
47720
48105
|
];
|
|
47721
48106
|
/** Generic Customize target for the percentage reading (D936). */
|
|
@@ -49478,7 +49863,14 @@ var climateControlCapability = {
|
|
|
49478
49863
|
scope: "device",
|
|
49479
49864
|
deviceNative: true,
|
|
49480
49865
|
mode: "singleton",
|
|
49481
|
-
deviceTypes: [DeviceType.
|
|
49866
|
+
deviceTypes: [DeviceType.Climate],
|
|
49867
|
+
power: {
|
|
49868
|
+
kind: "mode",
|
|
49869
|
+
field: "mode",
|
|
49870
|
+
offValue: "off",
|
|
49871
|
+
set: "setMode",
|
|
49872
|
+
lastField: "lastActiveMode"
|
|
49873
|
+
},
|
|
49482
49874
|
methods: {
|
|
49483
49875
|
setMode: method(object({
|
|
49484
49876
|
deviceId: number$1().int().nonnegative(),
|
|
@@ -49863,6 +50255,7 @@ var CompositionProblemSchema = object({
|
|
|
49863
50255
|
"nested-field",
|
|
49864
50256
|
"missing-field",
|
|
49865
50257
|
"kind-mismatch",
|
|
50258
|
+
"source-kind-mismatch",
|
|
49866
50259
|
"may-be-null",
|
|
49867
50260
|
"source-missing",
|
|
49868
50261
|
"source-unreadable",
|
|
@@ -49884,7 +50277,8 @@ var CompositionProblemSchema = object({
|
|
|
49884
50277
|
"command-method-unknown",
|
|
49885
50278
|
"command-source-unknown",
|
|
49886
50279
|
"command-input-unknown",
|
|
49887
|
-
"command-input-missing"
|
|
50280
|
+
"command-input-missing",
|
|
50281
|
+
"power-source-is-actuator"
|
|
49888
50282
|
]),
|
|
49889
50283
|
path: string(),
|
|
49890
50284
|
message: string()
|
|
@@ -50922,6 +51316,13 @@ var mediaPlayerCapability = {
|
|
|
50922
51316
|
deviceNative: true,
|
|
50923
51317
|
mode: "singleton",
|
|
50924
51318
|
deviceTypes: [DeviceType.MediaPlayer],
|
|
51319
|
+
power: {
|
|
51320
|
+
kind: "methods",
|
|
51321
|
+
field: "state",
|
|
51322
|
+
offValues: ["off", "standby"],
|
|
51323
|
+
on: "turnOn",
|
|
51324
|
+
off: "turnOff"
|
|
51325
|
+
},
|
|
50925
51326
|
methods: {
|
|
50926
51327
|
turnOn: optionalMethod(deviceOnly, _void(), {
|
|
50927
51328
|
kind: "mutation",
|
|
@@ -51052,7 +51453,7 @@ var mediaPlayerCapability = {
|
|
|
51052
51453
|
isMuted: { kind: "boolean" }
|
|
51053
51454
|
} }
|
|
51054
51455
|
};
|
|
51055
|
-
DeviceType.Camera, DeviceType.Sensor, DeviceType.Button, DeviceType.Switch, DeviceType.PetFeeder, DeviceType.Container, DeviceType.
|
|
51456
|
+
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;
|
|
51056
51457
|
var NUMBER = {
|
|
51057
51458
|
kind: "fixed",
|
|
51058
51459
|
result: ["number"]
|
|
@@ -51135,7 +51536,7 @@ function numeric(input) {
|
|
|
51135
51536
|
}, ...alsoFrom === void 0 ? [] : [alsoFrom.accept]]
|
|
51136
51537
|
};
|
|
51137
51538
|
}
|
|
51138
|
-
var CLIMATE_DEVICES = [DeviceType.
|
|
51539
|
+
var CLIMATE_DEVICES = [DeviceType.Climate];
|
|
51139
51540
|
function binary(input) {
|
|
51140
51541
|
return {
|
|
51141
51542
|
...input,
|
|
@@ -51457,8 +51858,8 @@ var GROUP_TEMPLATES = [
|
|
|
51457
51858
|
actuator({
|
|
51458
51859
|
id: "climate",
|
|
51459
51860
|
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.",
|
|
51460
|
-
deviceType: DeviceType.
|
|
51461
|
-
memberDeviceTypes: [DeviceType.
|
|
51861
|
+
deviceType: DeviceType.Climate,
|
|
51862
|
+
memberDeviceTypes: [DeviceType.Climate],
|
|
51462
51863
|
outputCap: "group-active",
|
|
51463
51864
|
outputField: "active",
|
|
51464
51865
|
member: {
|
|
@@ -51501,6 +51902,118 @@ function actuator(input) {
|
|
|
51501
51902
|
new Map(GROUP_TEMPLATES.map((template) => [template.id, template]));
|
|
51502
51903
|
DeviceFeature.LightColorRgb, DeviceFeature.LightColorHsv, DeviceFeature.LightColorMired;
|
|
51503
51904
|
DeviceType.Camera;
|
|
51905
|
+
var PowerSourceRefusalReasonSchema = _enum([
|
|
51906
|
+
"no-power-source",
|
|
51907
|
+
"switch-missing",
|
|
51908
|
+
"switch-offline",
|
|
51909
|
+
"switch-unknown",
|
|
51910
|
+
"restart-in-progress",
|
|
51911
|
+
"switch-call-failed",
|
|
51912
|
+
"switch-is-actuator"
|
|
51913
|
+
]);
|
|
51914
|
+
var PowerSourceActionResultSchema = discriminatedUnion("accepted", [object({ accepted: literal(true) }), object({
|
|
51915
|
+
accepted: literal(false),
|
|
51916
|
+
reason: PowerSourceRefusalReasonSchema,
|
|
51917
|
+
/** One line for the operator, naming the switch. */
|
|
51918
|
+
message: string()
|
|
51919
|
+
})]);
|
|
51920
|
+
var PowerSourceInfoSchema = object({
|
|
51921
|
+
/** False when the device has no power source linked; the rest is then empty. */
|
|
51922
|
+
linked: boolean(),
|
|
51923
|
+
switchDeviceId: number$1().nullable(),
|
|
51924
|
+
switchName: string().nullable(),
|
|
51925
|
+
/** The switch's on/off state, or null when it is unknown. Never false for unknown (D393). */
|
|
51926
|
+
switchOn: boolean().nullable(),
|
|
51927
|
+
switchOnline: boolean().nullable(),
|
|
51928
|
+
restartInProgress: boolean(),
|
|
51929
|
+
offSeconds: number$1().int()
|
|
51930
|
+
});
|
|
51931
|
+
/** The composed slice: the switch state the link mirrors, plus the stored off time. */
|
|
51932
|
+
var PowerSourceStateSchema = object({
|
|
51933
|
+
/** Null while the switch has not reported: unknown is never `false` (D393). */
|
|
51934
|
+
switchOn: boolean().nullable(),
|
|
51935
|
+
offSeconds: number$1().int(),
|
|
51936
|
+
lastFetchedAt: number$1()
|
|
51937
|
+
});
|
|
51938
|
+
var POWER_SOURCE_DEVICE_TYPES = [
|
|
51939
|
+
DeviceType.Gateway,
|
|
51940
|
+
DeviceType.Camera,
|
|
51941
|
+
DeviceType.Sensor,
|
|
51942
|
+
DeviceType.MediaPlayer,
|
|
51943
|
+
DeviceType.Vacuum,
|
|
51944
|
+
DeviceType.Generic,
|
|
51945
|
+
DeviceType.Washer,
|
|
51946
|
+
DeviceType.Dryer,
|
|
51947
|
+
DeviceType.Dishwasher,
|
|
51948
|
+
DeviceType.PetFountain,
|
|
51949
|
+
DeviceType.Fan,
|
|
51950
|
+
DeviceType.Humidifier,
|
|
51951
|
+
DeviceType.Climate,
|
|
51952
|
+
DeviceType.WaterHeater
|
|
51953
|
+
];
|
|
51954
|
+
var powerSourceCustomize = {
|
|
51955
|
+
version: 1,
|
|
51956
|
+
targets: [{
|
|
51957
|
+
id: "switch",
|
|
51958
|
+
cardinality: "scalar",
|
|
51959
|
+
vocabulary: {
|
|
51960
|
+
cap: "power-source",
|
|
51961
|
+
stateField: "switchOn"
|
|
51962
|
+
},
|
|
51963
|
+
deviceTypes: POWER_SOURCE_DEVICE_TYPES,
|
|
51964
|
+
apply: "add",
|
|
51965
|
+
path: "switchOn",
|
|
51966
|
+
sources: [{
|
|
51967
|
+
kind: "switch",
|
|
51968
|
+
transforms: [{ kind: "identity" }]
|
|
51969
|
+
}],
|
|
51970
|
+
companions: [{
|
|
51971
|
+
kind: "constant",
|
|
51972
|
+
path: "offSeconds",
|
|
51973
|
+
value: 10,
|
|
51974
|
+
when: "add",
|
|
51975
|
+
formerValues: [0]
|
|
51976
|
+
}, {
|
|
51977
|
+
kind: "clock",
|
|
51978
|
+
path: "lastFetchedAt",
|
|
51979
|
+
when: "always"
|
|
51980
|
+
}],
|
|
51981
|
+
sourceReport: { status: "assignment-status" }
|
|
51982
|
+
}]
|
|
51983
|
+
};
|
|
51984
|
+
var deviceInput$2 = object({ deviceId: number$1().int().nonnegative() });
|
|
51985
|
+
var powerSourceCapability = {
|
|
51986
|
+
name: "power-source",
|
|
51987
|
+
scope: "device",
|
|
51988
|
+
mode: "singleton",
|
|
51989
|
+
deviceTypes: POWER_SOURCE_DEVICE_TYPES,
|
|
51990
|
+
methods: {
|
|
51991
|
+
getStatus: systemMethod(deviceInput$2, PowerSourceInfoSchema, { auth: "protected" }),
|
|
51992
|
+
powerOn: systemMethod(deviceInput$2, PowerSourceActionResultSchema, {
|
|
51993
|
+
kind: "mutation",
|
|
51994
|
+
auth: "protected"
|
|
51995
|
+
}),
|
|
51996
|
+
powerOff: systemMethod(deviceInput$2, PowerSourceActionResultSchema, {
|
|
51997
|
+
kind: "mutation",
|
|
51998
|
+
auth: "protected"
|
|
51999
|
+
}),
|
|
52000
|
+
forceRestart: systemMethod(deviceInput$2, PowerSourceActionResultSchema, {
|
|
52001
|
+
kind: "mutation",
|
|
52002
|
+
auth: "protected"
|
|
52003
|
+
})
|
|
52004
|
+
},
|
|
52005
|
+
runtimeState: PowerSourceStateSchema,
|
|
52006
|
+
customize: powerSourceCustomize,
|
|
52007
|
+
/**
|
|
52008
|
+
* Runtime-state durability: **session** — mirrored from the linked switch on
|
|
52009
|
+
* its next report; a restored value would outlive the reading it names.
|
|
52010
|
+
*
|
|
52011
|
+
* See `RuntimeStateDurability`. Enforced by
|
|
52012
|
+
* `scripts/check-runtime-state-durability.ts`.
|
|
52013
|
+
*/
|
|
52014
|
+
durability: "session",
|
|
52015
|
+
history: "none"
|
|
52016
|
+
};
|
|
51504
52017
|
`${COMPOSED_DEVICE_STABLE_ID_PREFIX}`;
|
|
51505
52018
|
/**
|
|
51506
52019
|
* What a composition may BUILD on a device type (G2, D676): the caps a new
|
|
@@ -52545,27 +53058,35 @@ var deviceAdminLinkCapability = {
|
|
|
52545
53058
|
getAdminLink: method(object({ deviceId: number$1().int().nonnegative() }), DeviceAdminLinkSchema.nullable(), { auth: "admin" }) }
|
|
52546
53059
|
};
|
|
52547
53060
|
/**
|
|
52548
|
-
* device-
|
|
52549
|
-
*
|
|
52550
|
-
*
|
|
52551
|
-
*
|
|
52552
|
-
*
|
|
52553
|
-
*
|
|
52554
|
-
*
|
|
52555
|
-
*
|
|
52556
|
-
*
|
|
52557
|
-
*
|
|
52558
|
-
*
|
|
52559
|
-
*
|
|
52560
|
-
*
|
|
52561
|
-
*
|
|
52562
|
-
*
|
|
52563
|
-
*
|
|
52564
|
-
*
|
|
52565
|
-
|
|
52566
|
-
|
|
52567
|
-
*
|
|
52568
|
-
*
|
|
53061
|
+
* `device-adoption` — generic discovery + adoption surface,
|
|
53062
|
+
* system-scoped collection (one provider per integration addon), routed
|
|
53063
|
+
* by explicit `{ addonId }` on direct `deviceAdoption.*` calls — the same
|
|
53064
|
+
* pin model as `connection-test`. The admin UI keeps using
|
|
53065
|
+
* `deviceManager.adoption*` (which already threads `addonId`). The de-HA-ified
|
|
53066
|
+
* successor to `ha-discovery`:
|
|
53067
|
+
* keyed by `integrationId` (the addon resolves integrationId → broker
|
|
53068
|
+
* internally) rather than a connection-specific `brokerId`, and it
|
|
53069
|
+
* OWNS the shared `DiscoveredChildDevice` candidate type
|
|
53070
|
+
* (declared below) so a single shared adoption modal renders any integration's
|
|
53071
|
+
* candidate tree.
|
|
53072
|
+
*
|
|
53073
|
+
* UI flow (Integrations page → integration detail):
|
|
53074
|
+
* 1. `listCandidates({integrationId, page, pageSize, filter})` →
|
|
53075
|
+
* paginated candidate list, each row collapsed.
|
|
53076
|
+
* 2. User expands a row → `getCandidate({integrationId,
|
|
53077
|
+
* childNativeId})` returns the single candidate (with its nested
|
|
53078
|
+
* `children`) for the accordion render.
|
|
53079
|
+
* 3. User clicks "Adopt" on one or more candidates →
|
|
53080
|
+
* `adopt({integrationId, childNativeIds, perCandidate?})`
|
|
53081
|
+
* materialises one parent CamStack device per candidate plus its
|
|
53082
|
+
* accessory children. `perCandidate[childNativeId]` carries an
|
|
53083
|
+
* optional display-name override + a `hiddenChildIds` pre-hide set
|
|
53084
|
+
* (the parent's `accessories.hiddenChildIds` gates UI visibility).
|
|
53085
|
+
* 4. User clicks "Release" → `release({integrationId, camDeviceId})`
|
|
53086
|
+
* removes the parent + every child from the kernel registry.
|
|
53087
|
+
*/
|
|
53088
|
+
/**
|
|
53089
|
+
* Status enum for a discovered device. Generic enough for
|
|
52569
53090
|
* battery cams, awake cams, and unreachable cams alike.
|
|
52570
53091
|
*/
|
|
52571
53092
|
var DiscoveredChildStatusSchema = _enum([
|
|
@@ -52582,12 +53103,12 @@ var DiscoveredChildDeviceSchema = lazy(() => object({
|
|
|
52582
53103
|
/** DeviceType the child should be created with on adopt. */
|
|
52583
53104
|
type: _enum(DeviceType),
|
|
52584
53105
|
status: DiscoveredChildStatusSchema,
|
|
52585
|
-
/** Free-form integration-specific metadata surfaced in the
|
|
53106
|
+
/** Free-form integration-specific metadata surfaced in the adoption modal. */
|
|
52586
53107
|
metadata: object({
|
|
52587
53108
|
model: string().optional(),
|
|
52588
53109
|
serialNumber: string().optional(),
|
|
52589
53110
|
uid: string().optional(),
|
|
52590
|
-
/** Reolink: 0-based channel index inside the parent NVR
|
|
53111
|
+
/** Reolink: 0-based channel index inside the parent NVR. */
|
|
52591
53112
|
rtspChannel: number$1().int().nonnegative().optional(),
|
|
52592
53113
|
isBattery: boolean().optional(),
|
|
52593
53114
|
isDoorbell: boolean().optional(),
|
|
@@ -52603,137 +53124,24 @@ var DiscoveredChildDeviceSchema = lazy(() => object({
|
|
|
52603
53124
|
}).default({}),
|
|
52604
53125
|
/**
|
|
52605
53126
|
* `true` when the framework already created a child device for this
|
|
52606
|
-
* `childNativeId` under the current parent. The
|
|
53127
|
+
* `childNativeId` under the current parent. The adoption modal uses it to
|
|
52607
53128
|
* gate the Add/Remove button and surface the existing `deviceId`.
|
|
52608
53129
|
*/
|
|
52609
53130
|
alreadyAdopted: boolean(),
|
|
52610
53131
|
/** When `alreadyAdopted=true`, the framework-assigned child device id. */
|
|
52611
53132
|
adoptedDeviceId: number$1().int().nonnegative().nullable(),
|
|
52612
|
-
/** Capability names the candidate advertises — integrations populate,
|
|
53133
|
+
/** Capability names the candidate advertises — integrations populate, flat enumerations omit. */
|
|
52613
53134
|
capabilities: array(string()).readonly().optional(),
|
|
52614
|
-
/** Feature flags the candidate advertises — integrations populate,
|
|
53135
|
+
/** Feature flags the candidate advertises — integrations populate, flat enumerations omit. */
|
|
52615
53136
|
features: array(string()).readonly().optional(),
|
|
52616
53137
|
/** Upstream-system identity + rendering hints for the candidate. */
|
|
52617
53138
|
sourceInfo: SourceInfoSchema.optional(),
|
|
52618
|
-
/** Nested entity-children for accordion preview — integrations populate,
|
|
53139
|
+
/** Nested entity-children for accordion preview — integrations populate, flat enumerations omit. */
|
|
52619
53140
|
children: array(DiscoveredChildDeviceSchema).readonly().optional(),
|
|
52620
53141
|
/** `childNativeId` of the gateway candidate in the same list this device sits behind. */
|
|
52621
53142
|
parentStableId: string().optional()
|
|
52622
53143
|
}));
|
|
52623
53144
|
/**
|
|
52624
|
-
* Status block — populated by the integration after each
|
|
52625
|
-
* `refreshDiscovery` (or push-driven update). The runtime-state slice
|
|
52626
|
-
* is what the panel reads via the per-device proxy; `getStatus`
|
|
52627
|
-
* returns the same payload via the codegen'd auto-injection.
|
|
52628
|
-
*/
|
|
52629
|
-
var DeviceDiscoveryStatusSchema = object({
|
|
52630
|
-
discovered: array(DiscoveredChildDeviceSchema),
|
|
52631
|
-
/** Wall-clock ms of the last successful enumeration. */
|
|
52632
|
-
lastDiscoveryAt: number$1().int().nonnegative().nullable(),
|
|
52633
|
-
/** Last error surfaced from the source (rendered as a banner). */
|
|
52634
|
-
lastError: string().nullable()
|
|
52635
|
-
});
|
|
52636
|
-
var deviceDiscoveryCapability = {
|
|
52637
|
-
name: "device-discovery",
|
|
52638
|
-
scope: "device",
|
|
52639
|
-
deviceNative: true,
|
|
52640
|
-
mode: "singleton",
|
|
52641
|
-
deviceTypes: [DeviceType.Hub],
|
|
52642
|
-
status: {
|
|
52643
|
-
schema: DeviceDiscoveryStatusSchema,
|
|
52644
|
-
kind: "poll"
|
|
52645
|
-
},
|
|
52646
|
-
runtimeState: DeviceDiscoveryStatusSchema.extend({ lastFetchedAt: number$1().int().nonnegative() }),
|
|
52647
|
-
/**
|
|
52648
|
-
* Runtime-state durability: **session** — 5.7 KB of scan output on the largest device, fully re-derivable by re-scanning.
|
|
52649
|
-
*
|
|
52650
|
-
* See `RuntimeStateDurability`. Enforced by
|
|
52651
|
-
* `scripts/check-runtime-state-durability.ts`.
|
|
52652
|
-
*/
|
|
52653
|
-
durability: "session",
|
|
52654
|
-
/**
|
|
52655
|
-
* History (D850): none — inventory.
|
|
52656
|
-
*/
|
|
52657
|
-
history: "none",
|
|
52658
|
-
methods: {
|
|
52659
|
-
/**
|
|
52660
|
-
* Snapshot of the current `discovered` list. Returns the
|
|
52661
|
-
* runtime-state cache — call `refreshDiscovery` first if a
|
|
52662
|
-
* fresh round-trip to the source is required.
|
|
52663
|
-
*/
|
|
52664
|
-
listDiscovered: method(object({ deviceId: number$1().int().nonnegative() }), array(DiscoveredChildDeviceSchema).readonly()),
|
|
52665
|
-
/**
|
|
52666
|
-
* Force the integration to re-enumerate and update the
|
|
52667
|
-
* runtime-state slice. Returns the freshly-enumerated list (also
|
|
52668
|
-
* available via `listDiscovered` post-call).
|
|
52669
|
-
*/
|
|
52670
|
-
refreshDiscovery: method(object({ deviceId: number$1().int().nonnegative() }), array(DiscoveredChildDeviceSchema).readonly(), {
|
|
52671
|
-
kind: "mutation",
|
|
52672
|
-
auth: "admin"
|
|
52673
|
-
}),
|
|
52674
|
-
/**
|
|
52675
|
-
* Promote a discovered entry to a real child device. The framework
|
|
52676
|
-
* creates the child via `kernel.devices.create()` with
|
|
52677
|
-
* `parentDeviceId = parent.id` and seeds the child's config from
|
|
52678
|
-
* `childInitialConfig` (driver-defined; usually carries channel +
|
|
52679
|
-
* uid + parent reference). Returns the kernel-assigned numeric id.
|
|
52680
|
-
*/
|
|
52681
|
-
adoptDevice: method(object({
|
|
52682
|
-
deviceId: number$1().int().nonnegative(),
|
|
52683
|
-
childNativeId: string(),
|
|
52684
|
-
/** Optional override for the child's display name. */
|
|
52685
|
-
name: string().optional()
|
|
52686
|
-
}), object({
|
|
52687
|
-
deviceId: number$1().int().nonnegative(),
|
|
52688
|
-
stableId: string()
|
|
52689
|
-
}), {
|
|
52690
|
-
kind: "mutation",
|
|
52691
|
-
auth: "admin"
|
|
52692
|
-
}),
|
|
52693
|
-
/**
|
|
52694
|
-
* Inverse of `adoptDevice`: removes the child device from the
|
|
52695
|
-
* kernel registry. The discovered entry remains in the
|
|
52696
|
-
* enumeration (status updates resume) so the operator can re-adopt
|
|
52697
|
-
* it later without a fresh refresh.
|
|
52698
|
-
*/
|
|
52699
|
-
releaseDevice: method(object({
|
|
52700
|
-
deviceId: number$1().int().nonnegative(),
|
|
52701
|
-
childDeviceId: number$1().int().nonnegative()
|
|
52702
|
-
}), _void(), {
|
|
52703
|
-
kind: "mutation",
|
|
52704
|
-
auth: "admin"
|
|
52705
|
-
})
|
|
52706
|
-
}
|
|
52707
|
-
};
|
|
52708
|
-
/**
|
|
52709
|
-
* `device-adoption` — generic discovery + adoption surface,
|
|
52710
|
-
* system-scoped collection (one provider per integration addon), routed
|
|
52711
|
-
* by explicit `{ addonId }` on direct `deviceAdoption.*` calls — the same
|
|
52712
|
-
* pin model as `connection-test`. The admin UI keeps using
|
|
52713
|
-
* `deviceManager.adoption*` (which already threads `addonId`). The de-HA-ified
|
|
52714
|
-
* successor to `ha-discovery`:
|
|
52715
|
-
* keyed by `integrationId` (the addon resolves integrationId → broker
|
|
52716
|
-
* internally) rather than a connection-specific `brokerId`, and it
|
|
52717
|
-
* REUSES the shared `DiscoveredChildDevice` candidate type from
|
|
52718
|
-
* `device-discovery.cap.ts` so a single shared adoption panel renders
|
|
52719
|
-
* any integration's candidate tree.
|
|
52720
|
-
*
|
|
52721
|
-
* UI flow (Integrations page → integration detail):
|
|
52722
|
-
* 1. `listCandidates({integrationId, page, pageSize, filter})` →
|
|
52723
|
-
* paginated candidate list, each row collapsed.
|
|
52724
|
-
* 2. User expands a row → `getCandidate({integrationId,
|
|
52725
|
-
* childNativeId})` returns the single candidate (with its nested
|
|
52726
|
-
* `children`) for the accordion render.
|
|
52727
|
-
* 3. User clicks "Adopt" on one or more candidates →
|
|
52728
|
-
* `adopt({integrationId, childNativeIds, perCandidate?})`
|
|
52729
|
-
* materialises one parent CamStack device per candidate plus its
|
|
52730
|
-
* accessory children. `perCandidate[childNativeId]` carries an
|
|
52731
|
-
* optional display-name override + a `hiddenChildIds` pre-hide set
|
|
52732
|
-
* (the parent's `accessories.hiddenChildIds` gates UI visibility).
|
|
52733
|
-
* 4. User clicks "Release" → `release({integrationId, camDeviceId})`
|
|
52734
|
-
* removes the parent + every child from the kernel registry.
|
|
52735
|
-
*/
|
|
52736
|
-
/**
|
|
52737
53145
|
* Provider-declared discovery *granularity* filter (the keystone of the
|
|
52738
53146
|
* single-entity-import design). A provider advertises which discovery
|
|
52739
53147
|
* granularities it supports via `listCandidateFilters`; the operator picks
|
|
@@ -54161,8 +54569,14 @@ method(object({
|
|
|
54161
54569
|
"string",
|
|
54162
54570
|
"number",
|
|
54163
54571
|
"boolean",
|
|
54164
|
-
"enum"
|
|
54572
|
+
"enum",
|
|
54573
|
+
"union"
|
|
54165
54574
|
]),
|
|
54575
|
+
unionMembers: array(_enum([
|
|
54576
|
+
"string",
|
|
54577
|
+
"number",
|
|
54578
|
+
"boolean"
|
|
54579
|
+
])).optional(),
|
|
54166
54580
|
enumValues: array(string()).optional(),
|
|
54167
54581
|
item: boolean().optional(),
|
|
54168
54582
|
quantity: ReadingQuantitySchema.optional()
|
|
@@ -56254,25 +56668,89 @@ var enumSensorCapability = {
|
|
|
56254
56668
|
* whether persisting is worth a SQLite commit. */
|
|
56255
56669
|
volatileStateFields: ["lastFetchedAt", "timestamp"]
|
|
56256
56670
|
};
|
|
56671
|
+
var EventVocabularyKindSchema = _enum([
|
|
56672
|
+
"press",
|
|
56673
|
+
"long-press",
|
|
56674
|
+
"long-press-start",
|
|
56675
|
+
"release",
|
|
56676
|
+
"repeat",
|
|
56677
|
+
"double-press",
|
|
56678
|
+
"other"
|
|
56679
|
+
]);
|
|
56680
|
+
/** The part of the device an event comes from: a button, a channel. */
|
|
56681
|
+
var EventVocabularySourceSchema = object({
|
|
56682
|
+
id: string().min(1),
|
|
56683
|
+
label: string().min(1)
|
|
56684
|
+
});
|
|
56685
|
+
/** One scalar field of an event's `data`, by dotted path. */
|
|
56686
|
+
var EventVocabularyFieldSchema = object({
|
|
56687
|
+
path: string().min(1),
|
|
56688
|
+
kind: _enum([
|
|
56689
|
+
"string",
|
|
56690
|
+
"number",
|
|
56691
|
+
"boolean",
|
|
56692
|
+
"enum"
|
|
56693
|
+
]),
|
|
56694
|
+
enumValues: array(string()).optional(),
|
|
56695
|
+
label: string().min(1).optional()
|
|
56696
|
+
});
|
|
56697
|
+
var EventVocabularyEntrySchema = object({
|
|
56698
|
+
/** The native token, verbatim. */
|
|
56699
|
+
id: string().min(1),
|
|
56700
|
+
source: EventVocabularySourceSchema.optional(),
|
|
56701
|
+
label: string().min(1),
|
|
56702
|
+
description: string().optional(),
|
|
56703
|
+
kind: EventVocabularyKindSchema.optional(),
|
|
56704
|
+
payload: array(EventVocabularyFieldSchema).optional()
|
|
56705
|
+
});
|
|
56706
|
+
/**
|
|
56707
|
+
* The vocabulary of a source that declares tokens and nothing else: one
|
|
56708
|
+
* entry per token, labelled with the token itself.
|
|
56709
|
+
*/
|
|
56710
|
+
function plainEventVocabulary(eventTypes) {
|
|
56711
|
+
return [...new Set(eventTypes)].filter((eventType) => eventType !== "").map((eventType) => ({
|
|
56712
|
+
id: eventType,
|
|
56713
|
+
label: eventType
|
|
56714
|
+
}));
|
|
56715
|
+
}
|
|
56716
|
+
/** The native tokens of a vocabulary, each once, in declaration order. */
|
|
56717
|
+
function eventTypesOfVocabulary(vocabulary) {
|
|
56718
|
+
return [...new Set(vocabulary.map((entry) => entry.id))];
|
|
56719
|
+
}
|
|
56720
|
+
/** The entry a fire belongs to: same token, same source (or both without one). */
|
|
56721
|
+
function findVocabularyEntry(vocabulary, eventType, sourceId) {
|
|
56722
|
+
return vocabulary.find((entry) => entry.id === eventType && entry.source?.id === sourceId);
|
|
56723
|
+
}
|
|
56257
56724
|
/**
|
|
56258
56725
|
* Generic stateless event emitter. Installed on a `DeviceType.EventEmitter`
|
|
56259
56726
|
* device. Carries the device's EXACT declared event vocabulary verbatim
|
|
56260
56727
|
* (NO normalization). Two shapes:
|
|
56261
|
-
* - structured source (HA `event.*` entity) → `
|
|
56262
|
-
* declared
|
|
56263
|
-
* - generic/legacy source (HA bus events, e.g. zha_event) → `
|
|
56728
|
+
* - structured source (HA `event.*` entity) → `vocabulary` is the fixed
|
|
56729
|
+
* declared set (e.g. press_short, press_long, …).
|
|
56730
|
+
* - generic/legacy source (HA bus events, e.g. zha_event) → `vocabulary`
|
|
56264
56731
|
* is [] (open) and `lastEvent.data` carries the complex payload.
|
|
56732
|
+
* `vocabulary` (D1044) names each event for a person and types it for a
|
|
56733
|
+
* rule; `eventTypes` is its list of native tokens, kept for older readers.
|
|
56734
|
+
* A fire names the part of the device it came from in `sourceId` when the
|
|
56735
|
+
* vocabulary declares sources (a remote's buttons).
|
|
56265
56736
|
* `seq` is monotonic so two identical events still produce distinct slice writes.
|
|
56266
56737
|
*/
|
|
56267
56738
|
var EventFireSchema = object({
|
|
56268
56739
|
deviceId: number$1(),
|
|
56269
56740
|
eventType: string(),
|
|
56741
|
+
sourceId: string().optional(),
|
|
56270
56742
|
data: record(string(), unknown()).nullable(),
|
|
56271
56743
|
timestamp: number$1().meta(readingMeta("none")),
|
|
56272
56744
|
seq: number$1().meta(readingMeta("count"))
|
|
56273
56745
|
});
|
|
56274
56746
|
var EventEmitterStatusSchema = object({
|
|
56275
56747
|
eventTypes: array(string()),
|
|
56748
|
+
/**
|
|
56749
|
+
* Required of a provider by the type. A status written before the field
|
|
56750
|
+
* existed still parses, as an empty vocabulary: read it through
|
|
56751
|
+
* `readEventVocabulary`, which then answers with the plain tokens.
|
|
56752
|
+
*/
|
|
56753
|
+
vocabulary: array(EventVocabularyEntrySchema).default([]),
|
|
56276
56754
|
lastEvent: EventFireSchema.nullable(),
|
|
56277
56755
|
eventCountSinceStart: number$1().meta(readingMeta("count"))
|
|
56278
56756
|
});
|
|
@@ -56790,8 +57268,85 @@ method(_void(), array(FailureContributionSchema).readonly());
|
|
|
56790
57268
|
* - `FanPreset` — preset selector
|
|
56791
57269
|
* - `FanDirection` — direction toggle (ceiling fans)
|
|
56792
57270
|
* - `FanOscillating` — oscillation toggle
|
|
57271
|
+
*
|
|
57272
|
+
* Per-axis oscillation (`oscillationAxes`, `setOscillationAxis`, D1034): an air
|
|
57273
|
+
* circulator sweeps horizontally and vertically, each axis with its own
|
|
57274
|
+
* switch, fixed angle, sweep bounds and limits. A provider may report them
|
|
57275
|
+
* natively; otherwise the OPERATOR links sibling devices to each field in
|
|
57276
|
+
* Customize (a `replace` over the fields listed in `overridable` — nothing is
|
|
57277
|
+
* linked or inferred by itself), and a write to a linked field is forwarded to
|
|
57278
|
+
* its source. `oscillating` stays the single summary flag: when axes exist it
|
|
57279
|
+
* means "any axis oscillates" (`anyAxisOscillating`).
|
|
56793
57280
|
*/
|
|
56794
57281
|
var FanDirectionSchema = _enum(["forward", "reverse"]);
|
|
57282
|
+
var FAN_OSCILLATION_AXES = ["horizontal", "vertical"];
|
|
57283
|
+
var FanOscillationAxisNameSchema = _enum(FAN_OSCILLATION_AXES);
|
|
57284
|
+
var FanOscillationAxisFieldSchema = _enum([
|
|
57285
|
+
"oscillating",
|
|
57286
|
+
"angle",
|
|
57287
|
+
"sweepFrom",
|
|
57288
|
+
"sweepTo"
|
|
57289
|
+
]);
|
|
57290
|
+
/** The limits of one axis, read from the source that serves its angle. */
|
|
57291
|
+
var FAN_OSCILLATION_AXIS_LIMITS = [
|
|
57292
|
+
"min",
|
|
57293
|
+
"max",
|
|
57294
|
+
"step"
|
|
57295
|
+
];
|
|
57296
|
+
/**
|
|
57297
|
+
* One oscillation axis. Every reading the device has not reported is `null`,
|
|
57298
|
+
* never `0` (D393): `0°` is a real position. Each leaf defaults to `null`, so
|
|
57299
|
+
* a slice that names only the leaves it knows (a Customize link of one field)
|
|
57300
|
+
* is still a whole axis.
|
|
57301
|
+
*/
|
|
57302
|
+
var FanOscillationAxisSchema = object({
|
|
57303
|
+
/** Whether the axis sweeps. */
|
|
57304
|
+
oscillating: boolean().nullable().default(null),
|
|
57305
|
+
/** The fixed position (degrees) the axis holds when it does not sweep. */
|
|
57306
|
+
angle: number$1().nullable().default(null),
|
|
57307
|
+
/** The sweep bounds (degrees): left → right, bottom → top. */
|
|
57308
|
+
sweepFrom: number$1().nullable().default(null),
|
|
57309
|
+
sweepTo: number$1().nullable().default(null),
|
|
57310
|
+
/** The angles the axis accepts. Null when the device states none. */
|
|
57311
|
+
min: number$1().nullable().default(null),
|
|
57312
|
+
max: number$1().nullable().default(null),
|
|
57313
|
+
step: number$1().nullable().default(null)
|
|
57314
|
+
});
|
|
57315
|
+
/** Both axes; an axis the device does not have is `null`. */
|
|
57316
|
+
var FanOscillationAxesSchema = object({
|
|
57317
|
+
horizontal: FanOscillationAxisSchema.nullable().default(null),
|
|
57318
|
+
vertical: FanOscillationAxisSchema.nullable().default(null)
|
|
57319
|
+
});
|
|
57320
|
+
var FanOscillationAxisRefusalSchema = _enum([
|
|
57321
|
+
"nothing-to-set",
|
|
57322
|
+
"axis-not-linked",
|
|
57323
|
+
"out-of-range",
|
|
57324
|
+
"source-gone",
|
|
57325
|
+
"source-unknown",
|
|
57326
|
+
"source-call-failed"
|
|
57327
|
+
]);
|
|
57328
|
+
var FanOscillationAxisResultSchema = discriminatedUnion("status", [object({ status: literal("applied") }), object({
|
|
57329
|
+
status: literal("refused"),
|
|
57330
|
+
reason: FanOscillationAxisRefusalSchema,
|
|
57331
|
+
/** The field at fault, when one is. */
|
|
57332
|
+
field: FanOscillationAxisFieldSchema.optional(),
|
|
57333
|
+
/** One line for the operator, naming the axis, the field and the source. */
|
|
57334
|
+
detail: string(),
|
|
57335
|
+
/** Fields that DID land before the refusal (writes run in order, stop at the first failure). */
|
|
57336
|
+
applied: array(FanOscillationAxisFieldSchema)
|
|
57337
|
+
})]);
|
|
57338
|
+
var SetOscillationAxisInputSchema = object({
|
|
57339
|
+
deviceId: number$1().int().nonnegative(),
|
|
57340
|
+
axis: FanOscillationAxisNameSchema,
|
|
57341
|
+
oscillating: boolean().optional(),
|
|
57342
|
+
angle: number$1().optional(),
|
|
57343
|
+
sweepFrom: number$1().optional(),
|
|
57344
|
+
sweepTo: number$1().optional()
|
|
57345
|
+
});
|
|
57346
|
+
/** The state path of one axis field: `oscillationAxes.<axis>.<field>`. */
|
|
57347
|
+
function fanAxisPath(axis, field) {
|
|
57348
|
+
return `oscillationAxes.${axis}.${field}`;
|
|
57349
|
+
}
|
|
56795
57350
|
var FanControlStatusSchema = object({
|
|
56796
57351
|
/** Active speed as 0..100 inclusive. Null when the device has no
|
|
56797
57352
|
* speed surface (single-speed fan). */
|
|
@@ -56810,9 +57365,102 @@ var FanControlStatusSchema = object({
|
|
|
56810
57365
|
/** Oscillation toggle. Null when the device has no oscillation
|
|
56811
57366
|
* surface. */
|
|
56812
57367
|
oscillating: boolean().nullable(),
|
|
57368
|
+
/**
|
|
57369
|
+
* Per-axis oscillation (air circulators). Absent when the device has no
|
|
57370
|
+
* per-axis surface and nothing is linked in Customize.
|
|
57371
|
+
*/
|
|
57372
|
+
oscillationAxes: FanOscillationAxesSchema.optional(),
|
|
56813
57373
|
/** Ms epoch when the slice was last updated. */
|
|
56814
57374
|
lastChangedAt: number$1()
|
|
56815
57375
|
});
|
|
57376
|
+
var FAN_CUSTOMIZE_DEVICE_TYPES = [DeviceType.Fan];
|
|
57377
|
+
/** The Customize section the axis targets are listed under. */
|
|
57378
|
+
var AXES_SECTION = "oscillation-axes";
|
|
57379
|
+
function axisOscillatingTarget(axis) {
|
|
57380
|
+
return {
|
|
57381
|
+
id: `${axis}-oscillating`,
|
|
57382
|
+
cardinality: "scalar",
|
|
57383
|
+
vocabulary: {
|
|
57384
|
+
cap: "fan-control",
|
|
57385
|
+
stateField: "oscillating"
|
|
57386
|
+
},
|
|
57387
|
+
deviceTypes: FAN_CUSTOMIZE_DEVICE_TYPES,
|
|
57388
|
+
apply: "replace",
|
|
57389
|
+
section: AXES_SECTION,
|
|
57390
|
+
path: fanAxisPath(axis, "oscillating"),
|
|
57391
|
+
sources: [{
|
|
57392
|
+
kind: "switch",
|
|
57393
|
+
transforms: [{ kind: "identity" }]
|
|
57394
|
+
}],
|
|
57395
|
+
sourceReport: { status: "assignment-status" }
|
|
57396
|
+
};
|
|
57397
|
+
}
|
|
57398
|
+
/**
|
|
57399
|
+
* A numeric axis field. The `angle` link also carries the axis limits, read
|
|
57400
|
+
* from the SAME linked control's own range (`min`/`max`/`step`), so the limits
|
|
57401
|
+
* are the source's, never guessed.
|
|
57402
|
+
*/
|
|
57403
|
+
function axisNumericTarget(axis, field) {
|
|
57404
|
+
const base = {
|
|
57405
|
+
id: `${axis}-${field}`,
|
|
57406
|
+
cardinality: "scalar",
|
|
57407
|
+
vocabulary: { cap: "fan-control" },
|
|
57408
|
+
deviceTypes: FAN_CUSTOMIZE_DEVICE_TYPES,
|
|
57409
|
+
apply: "replace",
|
|
57410
|
+
section: AXES_SECTION,
|
|
57411
|
+
path: fanAxisPath(axis, field),
|
|
57412
|
+
sources: [{
|
|
57413
|
+
kind: "numeric",
|
|
57414
|
+
transforms: [{ kind: "identity" }]
|
|
57415
|
+
}],
|
|
57416
|
+
sourceReport: { status: "assignment-status" }
|
|
57417
|
+
};
|
|
57418
|
+
if (field !== "angle") return base;
|
|
57419
|
+
return {
|
|
57420
|
+
...base,
|
|
57421
|
+
companions: FAN_OSCILLATION_AXIS_LIMITS.map((limit) => ({
|
|
57422
|
+
kind: "source-field",
|
|
57423
|
+
path: fanAxisPath(axis, limit),
|
|
57424
|
+
field: limit
|
|
57425
|
+
}))
|
|
57426
|
+
};
|
|
57427
|
+
}
|
|
57428
|
+
var AXIS_TARGETS = FAN_OSCILLATION_AXES.flatMap((axis) => [
|
|
57429
|
+
axisOscillatingTarget(axis),
|
|
57430
|
+
axisNumericTarget(axis, "angle"),
|
|
57431
|
+
axisNumericTarget(axis, "sweepFrom"),
|
|
57432
|
+
axisNumericTarget(axis, "sweepTo")
|
|
57433
|
+
]);
|
|
57434
|
+
/** A select (an enum control) the operator links to the fan's `preset`. */
|
|
57435
|
+
var PRESET_TARGET = {
|
|
57436
|
+
id: "preset",
|
|
57437
|
+
cardinality: "scalar",
|
|
57438
|
+
vocabulary: { cap: "fan-control" },
|
|
57439
|
+
deviceTypes: FAN_CUSTOMIZE_DEVICE_TYPES,
|
|
57440
|
+
apply: "replace",
|
|
57441
|
+
path: "preset",
|
|
57442
|
+
sources: [{
|
|
57443
|
+
kind: "field",
|
|
57444
|
+
valueKinds: ["string"],
|
|
57445
|
+
transforms: [{ kind: "identity" }]
|
|
57446
|
+
}],
|
|
57447
|
+
sourceReport: { status: "assignment-status" }
|
|
57448
|
+
};
|
|
57449
|
+
var FAN_CONTROL_TARGETS = [...AXIS_TARGETS, PRESET_TARGET];
|
|
57450
|
+
/**
|
|
57451
|
+
* Customize (D1034): the fan already serves `fan-control` natively, so every
|
|
57452
|
+
* target is a `replace` over a field listed in `overridable` — the axis leaves
|
|
57453
|
+
* and `preset`, nothing else. Nothing is pre-linked: the operator picks each
|
|
57454
|
+
* source (D356).
|
|
57455
|
+
*/
|
|
57456
|
+
var fanControlCustomize = {
|
|
57457
|
+
version: 1,
|
|
57458
|
+
overridable: FAN_CONTROL_TARGETS.map((target) => ({
|
|
57459
|
+
path: target.path,
|
|
57460
|
+
by: target.id
|
|
57461
|
+
})),
|
|
57462
|
+
targets: FAN_CONTROL_TARGETS
|
|
57463
|
+
};
|
|
56816
57464
|
var fanControlCapability = {
|
|
56817
57465
|
name: "fan-control",
|
|
56818
57466
|
scope: "device",
|
|
@@ -56847,6 +57495,18 @@ var fanControlCapability = {
|
|
|
56847
57495
|
}), _void(), {
|
|
56848
57496
|
kind: "mutation",
|
|
56849
57497
|
auth: "protected"
|
|
57498
|
+
}),
|
|
57499
|
+
/**
|
|
57500
|
+
* Sets one oscillation axis: its switch, fixed angle and/or sweep bounds.
|
|
57501
|
+
* Fields left out are untouched. A field linked in Customize is forwarded
|
|
57502
|
+
* to its linked source (D1034); otherwise the native provider serves it;
|
|
57503
|
+
* neither → `axis-not-linked`. Ranges are checked against the axis limits
|
|
57504
|
+
* before anything is written; writes run in order and stop at the first
|
|
57505
|
+
* failure, which the result names.
|
|
57506
|
+
*/
|
|
57507
|
+
setOscillationAxis: optionalMethod(SetOscillationAxisInputSchema, FanOscillationAxisResultSchema, {
|
|
57508
|
+
kind: "mutation",
|
|
57509
|
+
auth: "protected"
|
|
56850
57510
|
})
|
|
56851
57511
|
},
|
|
56852
57512
|
status: {
|
|
@@ -56858,6 +57518,7 @@ var fanControlCapability = {
|
|
|
56858
57518
|
* sliders read `speed` for live updates.
|
|
56859
57519
|
*/
|
|
56860
57520
|
runtimeState: FanControlStatusSchema,
|
|
57521
|
+
customize: fanControlCustomize,
|
|
56861
57522
|
/**
|
|
56862
57523
|
* Runtime-state durability: **session** — as `brightness`.
|
|
56863
57524
|
*
|
|
@@ -56877,16 +57538,33 @@ var fanControlCapability = {
|
|
|
56877
57538
|
oscillating: { kind: "boolean" }
|
|
56878
57539
|
} }
|
|
56879
57540
|
};
|
|
57541
|
+
/** One axis as a preset wants it; an absent field is left as it is. */
|
|
57542
|
+
var FanPresetAxisSchema = object({
|
|
57543
|
+
oscillating: boolean().optional(),
|
|
57544
|
+
angle: number$1().optional(),
|
|
57545
|
+
sweepFrom: number$1().optional(),
|
|
57546
|
+
sweepTo: number$1().optional()
|
|
57547
|
+
});
|
|
57548
|
+
/** The fan-control state a preset sets; an absent field is left as it is. */
|
|
57549
|
+
var FanPresetStateSchema = object({
|
|
57550
|
+
speed: number$1().min(0).max(100).optional(),
|
|
57551
|
+
/** The fan's own preset mode (or the linked select's option). */
|
|
57552
|
+
preset: string().min(1).optional(),
|
|
57553
|
+
direction: FanDirectionSchema.optional(),
|
|
57554
|
+
oscillationAxes: object({
|
|
57555
|
+
horizontal: FanPresetAxisSchema.optional(),
|
|
57556
|
+
vertical: FanPresetAxisSchema.optional()
|
|
57557
|
+
}).optional()
|
|
57558
|
+
});
|
|
56880
57559
|
var FanPresetSchema = object({
|
|
56881
57560
|
/** Stable key; never reused after a delete within one device's list. */
|
|
56882
57561
|
id: string().min(1).max(64),
|
|
56883
57562
|
/** What the operator and a voice assistant call it. */
|
|
56884
57563
|
name: string().trim().min(1).max(40),
|
|
56885
|
-
|
|
57564
|
+
state: FanPresetStateSchema
|
|
56886
57565
|
});
|
|
56887
57566
|
var FanPresetsRefusalSchema = _enum([
|
|
56888
|
-
"
|
|
56889
|
-
"bad-target",
|
|
57567
|
+
"empty-state",
|
|
56890
57568
|
"duplicate-name",
|
|
56891
57569
|
"duplicate-id",
|
|
56892
57570
|
"too-many",
|
|
@@ -56898,72 +57576,55 @@ var FanPresetsSetResultSchema = discriminatedUnion("status", [object({
|
|
|
56898
57576
|
}), object({
|
|
56899
57577
|
status: literal("refused"),
|
|
56900
57578
|
reason: FanPresetsRefusalSchema,
|
|
56901
|
-
/** Names the preset
|
|
57579
|
+
/** Names the preset at fault. */
|
|
56902
57580
|
detail: string()
|
|
56903
57581
|
})]);
|
|
56904
|
-
var
|
|
56905
|
-
|
|
57582
|
+
var FanPresetFieldResultSchema = object({
|
|
57583
|
+
/** The state path: `speed`, `preset`, `direction`, `oscillationAxes.horizontal.angle`. */
|
|
57584
|
+
field: string(),
|
|
56906
57585
|
outcome: _enum([
|
|
56907
57586
|
"applied",
|
|
56908
57587
|
"failed",
|
|
56909
57588
|
"not-run",
|
|
56910
57589
|
"refused"
|
|
56911
57590
|
]),
|
|
56912
|
-
deviceId: number$1().int().nonnegative().optional(),
|
|
56913
|
-
cap: string().optional(),
|
|
56914
|
-
method: string().optional(),
|
|
56915
57591
|
/** The cause, for every outcome but `applied`. */
|
|
56916
57592
|
message: string().optional()
|
|
56917
57593
|
});
|
|
56918
57594
|
var FanPresetApplyResultSchema = object({
|
|
56919
|
-
/** `applied`: every
|
|
57595
|
+
/** `applied`: every field landed. `partial`: some did, one did not. `refused`: nothing ran. */
|
|
56920
57596
|
status: _enum([
|
|
56921
57597
|
"applied",
|
|
56922
57598
|
"partial",
|
|
56923
57599
|
"refused"
|
|
56924
57600
|
]),
|
|
56925
|
-
|
|
57601
|
+
fields: array(FanPresetFieldResultSchema)
|
|
56926
57602
|
});
|
|
56927
57603
|
var FanCaptureFieldSchema = _enum([
|
|
56928
57604
|
"speed",
|
|
56929
|
-
"oscillating",
|
|
56930
57605
|
"direction",
|
|
56931
|
-
"preset"
|
|
57606
|
+
"preset",
|
|
57607
|
+
"oscillationAxes"
|
|
56932
57608
|
]);
|
|
56933
|
-
var FanCaptureOmissionSchema = object({
|
|
56934
|
-
/** A fan field (`speed`) or `step <n>` for a sibling step. */
|
|
56935
|
-
what: string(),
|
|
56936
|
-
/** Why no value was taken: unknown reading (never stored as 0, D393), or a step that cannot be read. */
|
|
56937
|
-
reason: string()
|
|
56938
|
-
});
|
|
56939
|
-
var FanCaptureItemSchema = object({
|
|
56940
|
-
group: _enum([
|
|
56941
|
-
"fan",
|
|
56942
|
-
"oscillation",
|
|
56943
|
-
"angles"
|
|
56944
|
-
]),
|
|
56945
|
-
/** What the step sets, in the operator's words (a device name, a fan field). */
|
|
56946
|
-
label: string()
|
|
56947
|
-
});
|
|
56948
57609
|
var FanPresetCaptureResultSchema = object({
|
|
56949
|
-
/** The
|
|
56950
|
-
|
|
56951
|
-
|
|
56952
|
-
|
|
56953
|
-
|
|
57610
|
+
/** The fan's CURRENT fan-control state, as a preset; NOT saved. */
|
|
57611
|
+
state: FanPresetStateSchema,
|
|
57612
|
+
omitted: array(object({
|
|
57613
|
+
/** A state path (`speed`, `oscillationAxes.vertical.angle`). */
|
|
57614
|
+
what: string(),
|
|
57615
|
+
/** Why no value was taken: an unknown reading is never stored as 0 (D393). */
|
|
57616
|
+
reason: string()
|
|
57617
|
+
}))
|
|
56954
57618
|
});
|
|
56955
|
-
var deviceInput$
|
|
57619
|
+
var deviceInput$1 = object({ deviceId: number$1().int().nonnegative() });
|
|
56956
57620
|
DeviceType.Fan;
|
|
56957
|
-
method(deviceInput$
|
|
57621
|
+
method(deviceInput$1, array(FanPresetSchema), { auth: "protected" }), method(deviceInput$1.extend({ presets: array(FanPresetSchema).max(12) }), FanPresetsSetResultSchema, {
|
|
56958
57622
|
kind: "mutation",
|
|
56959
57623
|
auth: "admin"
|
|
56960
|
-
}), method(deviceInput$
|
|
57624
|
+
}), method(deviceInput$1.extend({ presetId: string().min(1) }), FanPresetApplyResultSchema, {
|
|
56961
57625
|
kind: "mutation",
|
|
56962
57626
|
auth: "protected"
|
|
56963
|
-
}), method(deviceInput$
|
|
56964
|
-
fields: array(FanCaptureFieldSchema).optional(),
|
|
56965
|
-
steps: array(ActionStepSchema).max(20).default([])
|
|
56966
|
-
}), FanPresetCaptureResultSchema, { auth: "protected" });
|
|
57627
|
+
}), method(deviceInput$1.extend({ fields: array(FanCaptureFieldSchema).optional() }), FanPresetCaptureResultSchema, { auth: "protected" });
|
|
56967
57628
|
/**
|
|
56968
57629
|
* Per-device feature/identity probe slice. Holds the runtime-resolved
|
|
56969
57630
|
* truth about what a device CAN do — which the kernel uses to:
|
|
@@ -57175,8 +57836,7 @@ var groupActiveCapability = {
|
|
|
57175
57836
|
DeviceType.Valve,
|
|
57176
57837
|
DeviceType.Lock,
|
|
57177
57838
|
DeviceType.MediaPlayer,
|
|
57178
|
-
DeviceType.Climate
|
|
57179
|
-
DeviceType.Thermostat
|
|
57839
|
+
DeviceType.Climate
|
|
57180
57840
|
],
|
|
57181
57841
|
methods: {},
|
|
57182
57842
|
status: {
|
|
@@ -57218,7 +57878,6 @@ var groupCommandsCapability = {
|
|
|
57218
57878
|
DeviceType.Valve,
|
|
57219
57879
|
DeviceType.Lock,
|
|
57220
57880
|
DeviceType.MediaPlayer,
|
|
57221
|
-
DeviceType.Thermostat,
|
|
57222
57881
|
DeviceType.Climate
|
|
57223
57882
|
],
|
|
57224
57883
|
methods: {},
|
|
@@ -57274,7 +57933,6 @@ var groupStatusCapability = {
|
|
|
57274
57933
|
DeviceType.Valve,
|
|
57275
57934
|
DeviceType.Lock,
|
|
57276
57935
|
DeviceType.MediaPlayer,
|
|
57277
|
-
DeviceType.Thermostat,
|
|
57278
57936
|
DeviceType.Climate
|
|
57279
57937
|
],
|
|
57280
57938
|
methods: {},
|
|
@@ -57603,7 +58261,7 @@ var heatingValveCapability = {
|
|
|
57603
58261
|
scope: "device",
|
|
57604
58262
|
deviceNative: true,
|
|
57605
58263
|
mode: "singleton",
|
|
57606
|
-
deviceTypes: [DeviceType.
|
|
58264
|
+
deviceTypes: [DeviceType.Climate],
|
|
57607
58265
|
methods: {},
|
|
57608
58266
|
status: {
|
|
57609
58267
|
schema: HeatingValveStatusSchema,
|
|
@@ -57633,13 +58291,18 @@ var heatingValveCapability = {
|
|
|
57633
58291
|
* retried in a loop - D49); a future one is re-armed.
|
|
57634
58292
|
*
|
|
57635
58293
|
* What a device may be run for, and for how long at most, is per device type
|
|
57636
|
-
* ({@link
|
|
58294
|
+
* and role ({@link timedRunLimitOf}): the maximum is a safety bound, not a preference,
|
|
57637
58295
|
* so a request above it is REFUSED with a typed reason, never clamped.
|
|
57638
58296
|
*/
|
|
57639
58297
|
var TimedRunUnitSchema = _enum(["s", "min"]);
|
|
57640
58298
|
_enum(["switch", "pet-fountain"]);
|
|
57641
|
-
|
|
57642
|
-
|
|
58299
|
+
/**
|
|
58300
|
+
* The device types `timed-run` may be offered on. A `switch` is narrowed by
|
|
58301
|
+
* role ({@link TIMED_RUN_DEVICE_ROLES}): only a plug-in heater runs on a timer.
|
|
58302
|
+
*/
|
|
58303
|
+
var TIMED_RUN_DEVICE_TYPES = [DeviceType.Switch, DeviceType.PetFountain];
|
|
58304
|
+
/** The roles that make a device of these types timed-run-able (D1033). */
|
|
58305
|
+
var TIMED_RUN_DEVICE_ROLES = { [DeviceType.Switch]: [DeviceRole.SwitchHeater] };
|
|
57643
58306
|
/** One duration, as the one-tap run asks for it. */
|
|
57644
58307
|
var TimedRunQuickRunSchema = object({
|
|
57645
58308
|
duration: number$1().positive().finite(),
|
|
@@ -57689,6 +58352,7 @@ var timedRunCapability = {
|
|
|
57689
58352
|
kind: "wrapper",
|
|
57690
58353
|
defaultActive: true,
|
|
57691
58354
|
deviceTypes: TIMED_RUN_DEVICE_TYPES,
|
|
58355
|
+
deviceRoles: TIMED_RUN_DEVICE_ROLES,
|
|
57692
58356
|
deviceConfig: { ui: {
|
|
57693
58357
|
kind: "derived-form",
|
|
57694
58358
|
builderId: "timed-run",
|
|
@@ -57849,8 +58513,8 @@ var HeroSceneSchema = object({
|
|
|
57849
58513
|
/** 0..1: volume, cover position, cycle progress. */
|
|
57850
58514
|
level: number$1().min(0).max(1).nullable()
|
|
57851
58515
|
});
|
|
57852
|
-
DeviceType.Camera, DeviceType.Hub, DeviceType.Light, DeviceType.Siren, DeviceType.Switch, DeviceType.Sensor, DeviceType.
|
|
57853
|
-
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;
|
|
58516
|
+
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;
|
|
58517
|
+
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;
|
|
57854
58518
|
/** A string in both languages, as the cap vocabulary writes it (D920): no `t()` in the model. */
|
|
57855
58519
|
var HeroTextSchema = object({
|
|
57856
58520
|
en: string(),
|
|
@@ -58235,8 +58899,8 @@ var HeroRowModelSchema = object({
|
|
|
58235
58899
|
extras: array(HeroControlSchema).max(2).optional(),
|
|
58236
58900
|
trailing: HeroFactSchema.nullable()
|
|
58237
58901
|
});
|
|
58238
|
-
DeviceType.Climate
|
|
58239
|
-
DeviceType.Climate, DeviceType.
|
|
58902
|
+
DeviceType.Climate;
|
|
58903
|
+
DeviceType.Climate, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.MediaPlayer;
|
|
58240
58904
|
/**
|
|
58241
58905
|
* hero-layout — what a device's hero says (D1023). Read-only: the FIXED
|
|
58242
58906
|
* layouts live in `@camstack/types` and nothing here stores or edits one.
|
|
@@ -58268,7 +58932,10 @@ method(heroInput, HeroModelSchema.nullable(), {
|
|
|
58268
58932
|
}), method(rowModelsInput, array(HeroRowModelSchema.nullable()), {
|
|
58269
58933
|
auth: "protected",
|
|
58270
58934
|
role: "viewer"
|
|
58271
|
-
}), method(object({
|
|
58935
|
+
}), method(object({
|
|
58936
|
+
deviceType: string(),
|
|
58937
|
+
role: string().nullable().optional()
|
|
58938
|
+
}), HeroLayoutRowsSchema, {
|
|
58272
58939
|
auth: "protected",
|
|
58273
58940
|
role: "viewer"
|
|
58274
58941
|
});
|
|
@@ -58315,6 +58982,11 @@ var humidifierCapability = {
|
|
|
58315
58982
|
deviceNative: true,
|
|
58316
58983
|
mode: "singleton",
|
|
58317
58984
|
deviceTypes: [DeviceType.Humidifier],
|
|
58985
|
+
power: {
|
|
58986
|
+
kind: "field",
|
|
58987
|
+
field: "on",
|
|
58988
|
+
set: "setOn"
|
|
58989
|
+
},
|
|
58318
58990
|
methods: {
|
|
58319
58991
|
setOn: method(object({
|
|
58320
58992
|
deviceId: number$1().int().nonnegative(),
|
|
@@ -58388,7 +59060,7 @@ var humiditySensorCapability = {
|
|
|
58388
59060
|
scope: "device",
|
|
58389
59061
|
deviceNative: true,
|
|
58390
59062
|
mode: "singleton",
|
|
58391
|
-
deviceTypes: [DeviceType.Sensor, DeviceType.
|
|
59063
|
+
deviceTypes: [DeviceType.Sensor, DeviceType.Climate],
|
|
58392
59064
|
methods: {},
|
|
58393
59065
|
status: {
|
|
58394
59066
|
schema: HumiditySensorStatusSchema,
|
|
@@ -71570,7 +72242,18 @@ var OauthIntegrationDescriptorSchema = object({
|
|
|
71570
72242
|
* The value is baked into the authorization code at `/authorize` and travels
|
|
71571
72243
|
* on the tokens, so editing this field changes FUTURE links only.
|
|
71572
72244
|
*/
|
|
71573
|
-
refreshTokenTtlSec: union([number$1().int().positive(), literal("never")]).optional()
|
|
72245
|
+
refreshTokenTtlSec: union([number$1().int().positive(), literal("never")]).optional(),
|
|
72246
|
+
/**
|
|
72247
|
+
* The integration instances an account can be linked to (planning#415),
|
|
72248
|
+
* beside the default one. `/api/oauth2/authorize?instance=<id>` is accepted
|
|
72249
|
+
* only for an id listed here; with no `instance=` the link is made to the
|
|
72250
|
+
* default instance, which is never listed and always accepted — it is the
|
|
72251
|
+
* address third parties already hold. Omit for a single-instance integration.
|
|
72252
|
+
*/
|
|
72253
|
+
instances: array(object({
|
|
72254
|
+
id: string(),
|
|
72255
|
+
displayName: string()
|
|
72256
|
+
})).optional()
|
|
71574
72257
|
});
|
|
71575
72258
|
method(_void(), OauthIntegrationDescriptorSchema, { auth: "admin" });
|
|
71576
72259
|
/**
|
|
@@ -71993,9 +72676,13 @@ var petFeederCapability = {
|
|
|
71993
72676
|
*/
|
|
71994
72677
|
durability: "session",
|
|
71995
72678
|
/**
|
|
71996
|
-
* History (D850): recorded series.
|
|
72679
|
+
* History (D850): recorded series. `feeding` / `eating` are the meals the
|
|
72680
|
+
* device hero's "Meals" button names — change-only booleans, so a dispense
|
|
72681
|
+
* or a pet at the bowl is one span on the history.
|
|
71997
72682
|
*/
|
|
71998
72683
|
history: { fields: {
|
|
72684
|
+
feeding: { kind: "boolean" },
|
|
72685
|
+
eating: { kind: "boolean" },
|
|
71999
72686
|
foodLevel: { kind: "gauge" },
|
|
72000
72687
|
bowlFood: { kind: "gauge" },
|
|
72001
72688
|
food1: { kind: "gauge" },
|
|
@@ -72056,6 +72743,11 @@ var petFountainCapability = {
|
|
|
72056
72743
|
deviceNative: true,
|
|
72057
72744
|
mode: "singleton",
|
|
72058
72745
|
deviceTypes: [DeviceType.PetFountain],
|
|
72746
|
+
power: {
|
|
72747
|
+
kind: "field",
|
|
72748
|
+
field: "pumpRunning",
|
|
72749
|
+
set: "setPump"
|
|
72750
|
+
},
|
|
72059
72751
|
methods: {
|
|
72060
72752
|
/** Start or stop the pump. */
|
|
72061
72753
|
setPump: method(object({
|
|
@@ -73631,7 +74323,6 @@ var POWER_METER_DEVICE_TYPES = [
|
|
|
73631
74323
|
DeviceType.Light,
|
|
73632
74324
|
DeviceType.Fan,
|
|
73633
74325
|
DeviceType.Climate,
|
|
73634
|
-
DeviceType.Thermostat,
|
|
73635
74326
|
DeviceType.Humidifier,
|
|
73636
74327
|
DeviceType.WaterHeater,
|
|
73637
74328
|
DeviceType.MediaPlayer,
|
|
@@ -73640,8 +74331,7 @@ var POWER_METER_DEVICE_TYPES = [
|
|
|
73640
74331
|
DeviceType.Dishwasher,
|
|
73641
74332
|
DeviceType.Vacuum,
|
|
73642
74333
|
DeviceType.LawnMower,
|
|
73643
|
-
DeviceType.PetFeeder
|
|
73644
|
-
DeviceType.Heater
|
|
74334
|
+
DeviceType.PetFeeder
|
|
73645
74335
|
];
|
|
73646
74336
|
/** Everything but a bare `Sensor`: a sensor that takes its reading from another sensor adds nothing. */
|
|
73647
74337
|
var POWER_METER_CUSTOMIZE_DEVICE_TYPES = POWER_METER_DEVICE_TYPES.filter((type) => type !== DeviceType.Sensor);
|
|
@@ -73754,118 +74444,6 @@ var powerMeterCapability = {
|
|
|
73754
74444
|
volatileStateFields: ["lastFetchedAt"],
|
|
73755
74445
|
customize: powerMeterCustomize
|
|
73756
74446
|
};
|
|
73757
|
-
var PowerSourceRefusalReasonSchema = _enum([
|
|
73758
|
-
"no-power-source",
|
|
73759
|
-
"switch-missing",
|
|
73760
|
-
"switch-offline",
|
|
73761
|
-
"switch-unknown",
|
|
73762
|
-
"restart-in-progress",
|
|
73763
|
-
"switch-call-failed"
|
|
73764
|
-
]);
|
|
73765
|
-
var PowerSourceActionResultSchema = discriminatedUnion("accepted", [object({ accepted: literal(true) }), object({
|
|
73766
|
-
accepted: literal(false),
|
|
73767
|
-
reason: PowerSourceRefusalReasonSchema,
|
|
73768
|
-
/** One line for the operator, naming the switch. */
|
|
73769
|
-
message: string()
|
|
73770
|
-
})]);
|
|
73771
|
-
var PowerSourceInfoSchema = object({
|
|
73772
|
-
/** False when the device has no power source linked; the rest is then empty. */
|
|
73773
|
-
linked: boolean(),
|
|
73774
|
-
switchDeviceId: number$1().nullable(),
|
|
73775
|
-
switchName: string().nullable(),
|
|
73776
|
-
/** The switch's on/off state, or null when it is unknown. Never false for unknown (D393). */
|
|
73777
|
-
switchOn: boolean().nullable(),
|
|
73778
|
-
switchOnline: boolean().nullable(),
|
|
73779
|
-
restartInProgress: boolean(),
|
|
73780
|
-
offSeconds: number$1().int()
|
|
73781
|
-
});
|
|
73782
|
-
/** The composed slice: the switch state the link mirrors, plus the stored off time. */
|
|
73783
|
-
var PowerSourceStateSchema = object({
|
|
73784
|
-
/** Null while the switch has not reported: unknown is never `false` (D393). */
|
|
73785
|
-
switchOn: boolean().nullable(),
|
|
73786
|
-
offSeconds: number$1().int(),
|
|
73787
|
-
lastFetchedAt: number$1()
|
|
73788
|
-
});
|
|
73789
|
-
var POWER_SOURCE_DEVICE_TYPES = [
|
|
73790
|
-
DeviceType.Gateway,
|
|
73791
|
-
DeviceType.Hub,
|
|
73792
|
-
DeviceType.Camera,
|
|
73793
|
-
DeviceType.Sensor,
|
|
73794
|
-
DeviceType.MediaPlayer,
|
|
73795
|
-
DeviceType.Vacuum,
|
|
73796
|
-
DeviceType.Generic,
|
|
73797
|
-
DeviceType.Washer,
|
|
73798
|
-
DeviceType.Dryer,
|
|
73799
|
-
DeviceType.Dishwasher,
|
|
73800
|
-
DeviceType.PetFountain,
|
|
73801
|
-
DeviceType.Fan,
|
|
73802
|
-
DeviceType.Humidifier,
|
|
73803
|
-
DeviceType.Climate,
|
|
73804
|
-
DeviceType.WaterHeater
|
|
73805
|
-
];
|
|
73806
|
-
var powerSourceCustomize = {
|
|
73807
|
-
version: 1,
|
|
73808
|
-
targets: [{
|
|
73809
|
-
id: "switch",
|
|
73810
|
-
cardinality: "scalar",
|
|
73811
|
-
vocabulary: {
|
|
73812
|
-
cap: "power-source",
|
|
73813
|
-
stateField: "switchOn"
|
|
73814
|
-
},
|
|
73815
|
-
deviceTypes: POWER_SOURCE_DEVICE_TYPES,
|
|
73816
|
-
apply: "add",
|
|
73817
|
-
path: "switchOn",
|
|
73818
|
-
sources: [{
|
|
73819
|
-
kind: "switch",
|
|
73820
|
-
transforms: [{ kind: "identity" }]
|
|
73821
|
-
}],
|
|
73822
|
-
companions: [{
|
|
73823
|
-
kind: "constant",
|
|
73824
|
-
path: "offSeconds",
|
|
73825
|
-
value: 10,
|
|
73826
|
-
when: "add",
|
|
73827
|
-
formerValues: [0]
|
|
73828
|
-
}, {
|
|
73829
|
-
kind: "clock",
|
|
73830
|
-
path: "lastFetchedAt",
|
|
73831
|
-
when: "always"
|
|
73832
|
-
}],
|
|
73833
|
-
sourceReport: { status: "assignment-status" }
|
|
73834
|
-
}]
|
|
73835
|
-
};
|
|
73836
|
-
var deviceInput$1 = object({ deviceId: number$1().int().nonnegative() });
|
|
73837
|
-
var powerSourceCapability = {
|
|
73838
|
-
name: "power-source",
|
|
73839
|
-
scope: "device",
|
|
73840
|
-
mode: "singleton",
|
|
73841
|
-
deviceTypes: POWER_SOURCE_DEVICE_TYPES,
|
|
73842
|
-
methods: {
|
|
73843
|
-
getStatus: systemMethod(deviceInput$1, PowerSourceInfoSchema, { auth: "protected" }),
|
|
73844
|
-
powerOn: systemMethod(deviceInput$1, PowerSourceActionResultSchema, {
|
|
73845
|
-
kind: "mutation",
|
|
73846
|
-
auth: "protected"
|
|
73847
|
-
}),
|
|
73848
|
-
powerOff: systemMethod(deviceInput$1, PowerSourceActionResultSchema, {
|
|
73849
|
-
kind: "mutation",
|
|
73850
|
-
auth: "protected"
|
|
73851
|
-
}),
|
|
73852
|
-
forceRestart: systemMethod(deviceInput$1, PowerSourceActionResultSchema, {
|
|
73853
|
-
kind: "mutation",
|
|
73854
|
-
auth: "protected"
|
|
73855
|
-
})
|
|
73856
|
-
},
|
|
73857
|
-
runtimeState: PowerSourceStateSchema,
|
|
73858
|
-
customize: powerSourceCustomize,
|
|
73859
|
-
/**
|
|
73860
|
-
* Runtime-state durability: **session** — mirrored from the linked switch on
|
|
73861
|
-
* its next report; a restored value would outlive the reading it names.
|
|
73862
|
-
*
|
|
73863
|
-
* See `RuntimeStateDurability`. Enforced by
|
|
73864
|
-
* `scripts/check-runtime-state-durability.ts`.
|
|
73865
|
-
*/
|
|
73866
|
-
durability: "session",
|
|
73867
|
-
history: "none"
|
|
73868
|
-
};
|
|
73869
74447
|
/**
|
|
73870
74448
|
* Presence cap. Models HA `person.*` and `device_tracker.*` entities
|
|
73871
74449
|
* on `DeviceType.Presence`. Read-only — no setters: presence is
|
|
@@ -77332,9 +77910,7 @@ var RUNNING_CUSTOMIZE_DEVICE_TYPES = [
|
|
|
77332
77910
|
DeviceType.Humidifier,
|
|
77333
77911
|
DeviceType.Fan,
|
|
77334
77912
|
DeviceType.Climate,
|
|
77335
|
-
DeviceType.
|
|
77336
|
-
DeviceType.PetFeeder,
|
|
77337
|
-
DeviceType.Heater
|
|
77913
|
+
DeviceType.PetFeeder
|
|
77338
77914
|
];
|
|
77339
77915
|
var runningStateCapability = {
|
|
77340
77916
|
name: "running-state",
|
|
@@ -78606,6 +79182,13 @@ var SsoBridgeClaimsSchema = object({
|
|
|
78606
79182
|
/** OAuth authorization-code binding — set only on `oauth-code` tokens. */
|
|
78607
79183
|
redirectUri: string().optional(),
|
|
78608
79184
|
integrationId: string().optional(),
|
|
79185
|
+
/**
|
|
79186
|
+
* The integration INSTANCE an OAuth link was made for (planning#415). Set on
|
|
79187
|
+
* `oauth-code`, `oauth-access` and `oauth-refresh` tokens of a link made
|
|
79188
|
+
* with `instance=`; absent on a link to the default instance. A cloud relay
|
|
79189
|
+
* reads it off the access token to route; the hub answers from the session.
|
|
79190
|
+
*/
|
|
79191
|
+
instanceId: string().optional(),
|
|
78609
79192
|
/** JWT ID — unique per issued code; consumed-set enforces single-use. */
|
|
78610
79193
|
jti: string().optional(),
|
|
78611
79194
|
/** PKCE S256 challenge — set only on `oauth-code` tokens issued to a public
|
|
@@ -79422,8 +80005,7 @@ var switchCapability = {
|
|
|
79422
80005
|
DeviceType.Switch,
|
|
79423
80006
|
DeviceType.Siren,
|
|
79424
80007
|
DeviceType.Light,
|
|
79425
|
-
DeviceType.Fan
|
|
79426
|
-
DeviceType.Heater
|
|
80008
|
+
DeviceType.Fan
|
|
79427
80009
|
],
|
|
79428
80010
|
methods: { setState: method(object({
|
|
79429
80011
|
deviceId: number$1(),
|
|
@@ -80117,7 +80699,7 @@ var temperatureSensorCapability = {
|
|
|
80117
80699
|
scope: "device",
|
|
80118
80700
|
deviceNative: true,
|
|
80119
80701
|
mode: "singleton",
|
|
80120
|
-
deviceTypes: [DeviceType.Sensor, DeviceType.
|
|
80702
|
+
deviceTypes: [DeviceType.Sensor, DeviceType.Climate],
|
|
80121
80703
|
methods: {},
|
|
80122
80704
|
status: {
|
|
80123
80705
|
schema: TemperatureSensorStatusSchema,
|
|
@@ -80985,6 +81567,8 @@ var OauthSessionSummarySchema = object({
|
|
|
80985
81567
|
userId: string(),
|
|
80986
81568
|
username: string(),
|
|
80987
81569
|
integrationId: string(),
|
|
81570
|
+
/** The instance the link was made for; `null` = the default instance. */
|
|
81571
|
+
instanceId: string().nullable().optional(),
|
|
80988
81572
|
scopes: array(TokenScopeSchema),
|
|
80989
81573
|
createdAt: number$1(),
|
|
80990
81574
|
lastUsedAt: number$1(),
|
|
@@ -81084,6 +81668,9 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(_void(), ob
|
|
|
81084
81668
|
access: "view"
|
|
81085
81669
|
}), method(object({
|
|
81086
81670
|
integrationId: string(),
|
|
81671
|
+
/** The integration instance the link is for. Omit for the default
|
|
81672
|
+
* instance — never pass the addon id to mean it. */
|
|
81673
|
+
instanceId: string().optional(),
|
|
81087
81674
|
userId: string(),
|
|
81088
81675
|
username: string(),
|
|
81089
81676
|
scopes: array(TokenScopeSchema),
|
|
@@ -81122,7 +81709,13 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(_void(), ob
|
|
|
81122
81709
|
}), method(object({ token: string() }), object({
|
|
81123
81710
|
userId: string(),
|
|
81124
81711
|
username: string(),
|
|
81125
|
-
scopes: array(TokenScopeSchema)
|
|
81712
|
+
scopes: array(TokenScopeSchema),
|
|
81713
|
+
/** The instance the link was made for, read from the SESSION.
|
|
81714
|
+
* Absent = the default instance. `oauthLinkServesInstance` is the
|
|
81715
|
+
* helper a per-instance route calls to compare it with the instance
|
|
81716
|
+
* of its path; no route declares `perInstance` yet (the Alexa
|
|
81717
|
+
* per-instance route, T3, is the first consumer). */
|
|
81718
|
+
instanceId: string().optional()
|
|
81126
81719
|
}).nullable(), { access: "view" }), method(object({ userId: string() }), array(ExternalIdentitySchema), { auth: "admin" }), method(ExternalIdentityKeySchema, object({
|
|
81127
81720
|
userId: string(),
|
|
81128
81721
|
issuer: string()
|
|
@@ -81764,6 +82357,13 @@ var waterHeaterCapability = {
|
|
|
81764
82357
|
deviceNative: true,
|
|
81765
82358
|
mode: "singleton",
|
|
81766
82359
|
deviceTypes: [DeviceType.WaterHeater],
|
|
82360
|
+
power: {
|
|
82361
|
+
kind: "mode",
|
|
82362
|
+
field: "operationMode",
|
|
82363
|
+
offValue: "off",
|
|
82364
|
+
set: "setOperationMode",
|
|
82365
|
+
lastField: "lastActiveMode"
|
|
82366
|
+
},
|
|
81767
82367
|
methods: {
|
|
81768
82368
|
setTargetTemp: method(object({
|
|
81769
82369
|
deviceId: number$1().int().nonnegative(),
|
|
@@ -83422,7 +84022,6 @@ var DEVICE_LOCAL_STATE_CAPS = {
|
|
|
83422
84022
|
control: controlCapability,
|
|
83423
84023
|
cover: coverCapability,
|
|
83424
84024
|
dayNight: dayNightCapability,
|
|
83425
|
-
deviceDiscovery: deviceDiscoveryCapability,
|
|
83426
84025
|
deviceStatus: deviceStatusCapability,
|
|
83427
84026
|
dishwasher: dishwasherCapability,
|
|
83428
84027
|
doNotDisturb: doNotDisturbCapability,
|
|
@@ -84517,15 +85116,16 @@ var BaseDeviceProvider = class extends BaseAddon {
|
|
|
84517
85116
|
});
|
|
84518
85117
|
const meta = await this.ctx.api.deviceManager.loadMeta.query({ deviceId: id });
|
|
84519
85118
|
if (meta === null) throw new Error(`${this.providerName}: no persisted meta for "${stableId}" (id ${id}) — cannot reload`);
|
|
84520
|
-
const
|
|
84521
|
-
|
|
85119
|
+
const Class = this.deviceClassForRow({
|
|
85120
|
+
type: meta.type,
|
|
85121
|
+
stableId
|
|
85122
|
+
});
|
|
84522
85123
|
if (!Class) throw new Error(`${this.providerName}: no device class for type "${meta.type}" — "${stableId}" is an accessory child; reload its parent instead`);
|
|
84523
85124
|
await devices.create(stableId, Class, {}, meta.parentDeviceId ?? null);
|
|
84524
85125
|
const rows = await this.ctx.api.deviceManager.listPersistedByAddon.query({ addonId: this.addonId });
|
|
84525
85126
|
for (const row of rows) {
|
|
84526
85127
|
if (row.parentDeviceId !== id) continue;
|
|
84527
|
-
const
|
|
84528
|
-
const ChildClass = childType !== void 0 ? this.deviceClasses[childType] : void 0;
|
|
85128
|
+
const ChildClass = this.deviceClassForRow(row);
|
|
84529
85129
|
if (!ChildClass) continue;
|
|
84530
85130
|
try {
|
|
84531
85131
|
await devices.create(row.stableId, ChildClass, {}, id);
|
|
@@ -84552,6 +85152,16 @@ var BaseDeviceProvider = class extends BaseAddon {
|
|
|
84552
85152
|
return { deviceId: id };
|
|
84553
85153
|
}
|
|
84554
85154
|
/**
|
|
85155
|
+
* The class a PERSISTED row is rebuilt with. Default: by type, from
|
|
85156
|
+
* `deviceClasses`. A provider whose distinct devices share one type (D1033:
|
|
85157
|
+
* a radiator valve and a room climate are both `climate`) overrides this
|
|
85158
|
+
* and tells them apart by the row's stable id or config.
|
|
85159
|
+
*/
|
|
85160
|
+
deviceClassForRow(row) {
|
|
85161
|
+
const type = Object.values(DeviceType).find((t) => t === row.type);
|
|
85162
|
+
return type !== void 0 ? this.deviceClasses[type] : void 0;
|
|
85163
|
+
}
|
|
85164
|
+
/**
|
|
84555
85165
|
* Restore devices from persisted state. Two-pass:
|
|
84556
85166
|
*
|
|
84557
85167
|
* 1. **Top-level pass** — invokes `kernel.devices.create()` for every
|
|
@@ -84612,7 +85222,7 @@ var BaseDeviceProvider = class extends BaseAddon {
|
|
|
84612
85222
|
restored.add(saved.id);
|
|
84613
85223
|
return;
|
|
84614
85224
|
}
|
|
84615
|
-
const Class = this.
|
|
85225
|
+
const Class = this.deviceClassForRow(saved);
|
|
84616
85226
|
if (!Class) throw new Error(`no device class registered for type "${saved.type}"`);
|
|
84617
85227
|
if (saved.parentDeviceId !== null && !restored.has(saved.parentDeviceId)) throw new Error(`parent device ${saved.parentDeviceId} not restored`);
|
|
84618
85228
|
await this.healSavedConfig(saved, savedDevices);
|
|
@@ -84629,7 +85239,7 @@ var BaseDeviceProvider = class extends BaseAddon {
|
|
|
84629
85239
|
};
|
|
84630
85240
|
const topLevel = savedDevices.filter((saved) => saved.parentDeviceId === null);
|
|
84631
85241
|
const restoreOne = async (saved) => {
|
|
84632
|
-
if (!this.
|
|
85242
|
+
if (!this.deviceClassForRow(saved)) {
|
|
84633
85243
|
this.ctx.logger.warn("No device class registered for restored type — skipping", {
|
|
84634
85244
|
tags: {
|
|
84635
85245
|
deviceId: saved.id,
|
|
@@ -84668,7 +85278,7 @@ var BaseDeviceProvider = class extends BaseAddon {
|
|
|
84668
85278
|
const failedTopLevelIds = new Set(failures.map((failure) => failure.saved.id));
|
|
84669
85279
|
const childRows = savedDevices.filter((s) => s.parentDeviceId !== null);
|
|
84670
85280
|
for (const saved of childRows) {
|
|
84671
|
-
if (!this.
|
|
85281
|
+
if (!this.deviceClassForRow(saved)) continue;
|
|
84672
85282
|
if (saved.parentDeviceId === null) continue;
|
|
84673
85283
|
if (restored.has(saved.parentDeviceId)) {
|
|
84674
85284
|
try {
|
|
@@ -84722,7 +85332,9 @@ var BaseDeviceProvider = class extends BaseAddon {
|
|
|
84722
85332
|
}
|
|
84723
85333
|
};
|
|
84724
85334
|
DeviceType.HeatPump;
|
|
84725
|
-
DeviceType.
|
|
85335
|
+
DeviceType.Climate;
|
|
85336
|
+
DeviceRole.ClimateThermostat, DeviceRole.ClimateAc, DeviceRole.ClimateRadiator, DeviceRole.ClimateFloor, DeviceRole.ClimateHeater, DeviceRole.ClimateHeatPumpCircuit;
|
|
85337
|
+
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;
|
|
84726
85338
|
new Set(Object.values(DeviceType));
|
|
84727
85339
|
/** Parses the raw slice with the cap's own schema; `undefined` when it does not parse. */
|
|
84728
85340
|
function contribution(cap, schema, build) {
|
|
@@ -86728,7 +87340,7 @@ var HEAT_PUMP_FAMILY_CONTRIBUTIONS = { "heat-pump-status": contribution("heat-pu
|
|
|
86728
87340
|
...Object.values(CLIMATE_FAMILY_CONTRIBUTIONS),
|
|
86729
87341
|
...Object.values(HEAT_PUMP_FAMILY_CONTRIBUTIONS)
|
|
86730
87342
|
];
|
|
86731
|
-
DeviceType.Camera, DeviceType.Hub, DeviceType.Light, DeviceType.Siren, DeviceType.Switch, DeviceType.Sensor, DeviceType.
|
|
87343
|
+
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;
|
|
86732
87344
|
/**
|
|
86733
87345
|
* Who looks like what (D1023). One look per {@link DeviceType}, refined by a
|
|
86734
87346
|
* {@link DeviceRole} where the role changes how the device reads (a leak
|
|
@@ -87372,9 +87984,9 @@ lookOf({
|
|
|
87372
87984
|
idle: INFO,
|
|
87373
87985
|
standby: MUTED
|
|
87374
87986
|
});
|
|
87375
|
-
DeviceType.Climate
|
|
87376
|
-
DeviceType.Camera, DeviceType.Hub, DeviceType.Light, DeviceType.Siren, DeviceType.Switch, DeviceType.Sensor, DeviceType.
|
|
87377
|
-
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;
|
|
87987
|
+
DeviceType.Climate;
|
|
87988
|
+
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;
|
|
87989
|
+
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;
|
|
87378
87990
|
Object.freeze({
|
|
87379
87991
|
"accessories.getStatus": {
|
|
87380
87992
|
capName: "accessories",
|
|
@@ -89224,41 +89836,6 @@ Object.freeze({
|
|
|
89224
89836
|
access: "create",
|
|
89225
89837
|
role: "admin"
|
|
89226
89838
|
},
|
|
89227
|
-
"deviceDiscovery.adoptDevice": {
|
|
89228
|
-
capName: "device-discovery",
|
|
89229
|
-
capScope: "device",
|
|
89230
|
-
addonId: null,
|
|
89231
|
-
access: "create",
|
|
89232
|
-
role: "admin"
|
|
89233
|
-
},
|
|
89234
|
-
"deviceDiscovery.getStatus": {
|
|
89235
|
-
capName: "device-discovery",
|
|
89236
|
-
capScope: "device",
|
|
89237
|
-
addonId: null,
|
|
89238
|
-
access: "view",
|
|
89239
|
-
role: "viewer"
|
|
89240
|
-
},
|
|
89241
|
-
"deviceDiscovery.listDiscovered": {
|
|
89242
|
-
capName: "device-discovery",
|
|
89243
|
-
capScope: "device",
|
|
89244
|
-
addonId: null,
|
|
89245
|
-
access: "view",
|
|
89246
|
-
role: "viewer"
|
|
89247
|
-
},
|
|
89248
|
-
"deviceDiscovery.refreshDiscovery": {
|
|
89249
|
-
capName: "device-discovery",
|
|
89250
|
-
capScope: "device",
|
|
89251
|
-
addonId: null,
|
|
89252
|
-
access: "create",
|
|
89253
|
-
role: "admin"
|
|
89254
|
-
},
|
|
89255
|
-
"deviceDiscovery.releaseDevice": {
|
|
89256
|
-
capName: "device-discovery",
|
|
89257
|
-
capScope: "device",
|
|
89258
|
-
addonId: null,
|
|
89259
|
-
access: "create",
|
|
89260
|
-
role: "admin"
|
|
89261
|
-
},
|
|
89262
89839
|
"deviceExport.applyDeviceSettingsPatch": {
|
|
89263
89840
|
capName: "device-export",
|
|
89264
89841
|
capScope: "system",
|
|
@@ -90806,6 +91383,13 @@ Object.freeze({
|
|
|
90806
91383
|
access: "create",
|
|
90807
91384
|
role: "viewer"
|
|
90808
91385
|
},
|
|
91386
|
+
"fanControl.setOscillationAxis": {
|
|
91387
|
+
capName: "fan-control",
|
|
91388
|
+
capScope: "device",
|
|
91389
|
+
addonId: null,
|
|
91390
|
+
access: "create",
|
|
91391
|
+
role: "viewer"
|
|
91392
|
+
},
|
|
90809
91393
|
"fanControl.setPercentage": {
|
|
90810
91394
|
capName: "fan-control",
|
|
90811
91395
|
capScope: "device",
|
|
@@ -97827,7 +98411,7 @@ function projectAction(cap, action) {
|
|
|
97827
98411
|
};
|
|
97828
98412
|
}
|
|
97829
98413
|
Object.entries(CAP_VOCABULARY_BY_NAME).flatMap(([cap, entry]) => entry.scope === "device" ? (entry.actions ?? []).map((a) => projectAction(cap, a)) : []);
|
|
97830
|
-
DeviceType.Camera, DeviceType.Hub, DeviceType.Light, DeviceType.Siren, DeviceType.Switch, DeviceType.Sensor, DeviceType.
|
|
98414
|
+
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;
|
|
97831
98415
|
DeviceFeature.BatteryOperated;
|
|
97832
98416
|
function bound(cap, methods = [], authority = "reported") {
|
|
97833
98417
|
return {
|
|
@@ -97886,6 +98470,149 @@ function offered(received) {
|
|
|
97886
98470
|
};
|
|
97887
98471
|
}
|
|
97888
98472
|
offered(HA_AS), withheld(HOMEKIT_REASON), withheld(ALEXA_REASON), withheld(GOOGLE_REASON), withheld(MATTER_REASON);
|
|
98473
|
+
var PowerSwitchRefusedError = class extends Error {
|
|
98474
|
+
reason;
|
|
98475
|
+
constructor(reason, message) {
|
|
98476
|
+
super(message);
|
|
98477
|
+
this.name = "PowerSwitchRefusedError";
|
|
98478
|
+
this.reason = reason;
|
|
98479
|
+
}
|
|
98480
|
+
};
|
|
98481
|
+
/** `true` / `false` from the owner slice, `null` when the hinted field is
|
|
98482
|
+
* absent or not of the hinted shape. */
|
|
98483
|
+
function powerOnFromSlice(hint, slice) {
|
|
98484
|
+
const value = slice?.[hint.field];
|
|
98485
|
+
switch (hint.kind) {
|
|
98486
|
+
case "field": return typeof value === "boolean" ? value : null;
|
|
98487
|
+
case "methods": return typeof value === "string" ? !hint.offValues.includes(value) : null;
|
|
98488
|
+
case "mode": return typeof value === "string" ? value !== hint.offValue : null;
|
|
98489
|
+
}
|
|
98490
|
+
}
|
|
98491
|
+
function ownerMethod(owner, name, capName) {
|
|
98492
|
+
const fn = Reflect.get(owner, name);
|
|
98493
|
+
if (typeof fn !== "function") throw new PowerSwitchRefusedError("owner-method-missing", `${capName} provider does not serve '${name}', which its power hint names`);
|
|
98494
|
+
return async (input) => fn.call(owner, input);
|
|
98495
|
+
}
|
|
98496
|
+
async function lastNonOffMode(host, capName, hint) {
|
|
98497
|
+
const isMode = (v) => typeof v === "string" && v.length > 0 && v !== hint.offValue;
|
|
98498
|
+
const fromHub = (await host.readHubSlice(capName).catch(() => null))?.[hint.lastField];
|
|
98499
|
+
if (isMode(fromHub)) return fromHub;
|
|
98500
|
+
const local = host.runtimeState.getCapState(capName)?.[hint.lastField];
|
|
98501
|
+
return isMode(local) ? local : null;
|
|
98502
|
+
}
|
|
98503
|
+
async function applyPower(host, capName, hint, owner, on) {
|
|
98504
|
+
const deviceId = host.deviceId;
|
|
98505
|
+
switch (hint.kind) {
|
|
98506
|
+
case "field":
|
|
98507
|
+
await ownerMethod(owner, hint.set, capName)({
|
|
98508
|
+
deviceId,
|
|
98509
|
+
on
|
|
98510
|
+
});
|
|
98511
|
+
return;
|
|
98512
|
+
case "methods":
|
|
98513
|
+
await ownerMethod(owner, on ? hint.on : hint.off, capName)({ deviceId });
|
|
98514
|
+
return;
|
|
98515
|
+
case "mode": {
|
|
98516
|
+
const set = ownerMethod(owner, hint.set, capName);
|
|
98517
|
+
if (!on) {
|
|
98518
|
+
await set({
|
|
98519
|
+
deviceId,
|
|
98520
|
+
mode: hint.offValue
|
|
98521
|
+
});
|
|
98522
|
+
return;
|
|
98523
|
+
}
|
|
98524
|
+
const mode = await lastNonOffMode(host, capName, hint);
|
|
98525
|
+
if (mode === null) throw new PowerSwitchRefusedError("no-last-mode", `device ${deviceId}: ${capName} has no last non-off mode to restore; pick a mode instead`);
|
|
98526
|
+
await set({
|
|
98527
|
+
deviceId,
|
|
98528
|
+
mode
|
|
98529
|
+
});
|
|
98530
|
+
return;
|
|
98531
|
+
}
|
|
98532
|
+
}
|
|
98533
|
+
}
|
|
98534
|
+
function hintedMethods(hint) {
|
|
98535
|
+
return hint.kind === "methods" ? [hint.on, hint.off] : [hint.set];
|
|
98536
|
+
}
|
|
98537
|
+
/** Whether `owner` serves every method its cap's power hint names. A media
|
|
98538
|
+
* player whose `turnOn` / `turnOff` are not served has no power, so no switch. */
|
|
98539
|
+
function powerServedBy(hint, owner) {
|
|
98540
|
+
if (hint === void 0) return false;
|
|
98541
|
+
return hintedMethods(hint).every((name) => typeof Reflect.get(owner, name) === "function");
|
|
98542
|
+
}
|
|
98543
|
+
/** Builds the `switch` provider and starts the slice projection. Exported
|
|
98544
|
+
* for the specs; providers call `registerPowerSwitch`. */
|
|
98545
|
+
function buildPowerSwitch(host, cap, owner) {
|
|
98546
|
+
const hint = cap.power;
|
|
98547
|
+
if (hint === void 0) throw new Error(`capability '${cap.name}' has no power hint: it has no switch to project`);
|
|
98548
|
+
const read = () => powerOnFromSlice(hint, host.runtimeState.getCapState(cap.name));
|
|
98549
|
+
const project = () => {
|
|
98550
|
+
const on = read();
|
|
98551
|
+
const current = host.runtimeState.getCapState(switchCapability.name);
|
|
98552
|
+
if (current !== void 0 && current["on"] === on) return;
|
|
98553
|
+
const next = {
|
|
98554
|
+
on,
|
|
98555
|
+
lastChangedAt: Date.now()
|
|
98556
|
+
};
|
|
98557
|
+
host.runtimeState.setCapState(switchCapability.name, next);
|
|
98558
|
+
};
|
|
98559
|
+
const stop = host.runtimeState.subscribeCap(cap.name, project);
|
|
98560
|
+
if (host.runtimeState.getCapState(cap.name) !== void 0) project();
|
|
98561
|
+
return {
|
|
98562
|
+
provider: {
|
|
98563
|
+
getStatus: async () => {
|
|
98564
|
+
const current = host.runtimeState.getCapState(switchCapability.name);
|
|
98565
|
+
const lastChangedAt = typeof current?.["lastChangedAt"] === "number" ? current["lastChangedAt"] : 0;
|
|
98566
|
+
return {
|
|
98567
|
+
on: read(),
|
|
98568
|
+
lastChangedAt
|
|
98569
|
+
};
|
|
98570
|
+
},
|
|
98571
|
+
setState: async ({ on }) => applyPower(host, cap.name, hint, owner, on)
|
|
98572
|
+
},
|
|
98573
|
+
dispose: stop
|
|
98574
|
+
};
|
|
98575
|
+
}
|
|
98576
|
+
/**
|
|
98577
|
+
* Registers `switch` for a device whose `cap` carries a `power` hint, built
|
|
98578
|
+
* from `owner` (the provider the device registered for `cap`). Call it right
|
|
98579
|
+
* after `registerNativeCap(cap, owner)`.
|
|
98580
|
+
*/
|
|
98581
|
+
function registerPowerSwitch(device, cap, owner) {
|
|
98582
|
+
const deviceId = device.ctx.id;
|
|
98583
|
+
if (cap.power !== void 0 && !powerServedBy(cap.power, owner)) {
|
|
98584
|
+
device.ctx.logger.debug("power switch: owner serves no power control, no switch registered", {
|
|
98585
|
+
tags: { deviceId },
|
|
98586
|
+
meta: { capName: cap.name }
|
|
98587
|
+
});
|
|
98588
|
+
return () => {};
|
|
98589
|
+
}
|
|
98590
|
+
const host = {
|
|
98591
|
+
deviceId,
|
|
98592
|
+
runtimeState: device.runtimeState,
|
|
98593
|
+
registerNativeCap: (c, p) => device.ctx.registerNativeCap(c, p),
|
|
98594
|
+
readHubSlice: async (capName) => {
|
|
98595
|
+
try {
|
|
98596
|
+
return await device.ctx.api.deviceState.getCapSlice.query({
|
|
98597
|
+
deviceId,
|
|
98598
|
+
capName
|
|
98599
|
+
});
|
|
98600
|
+
} catch (err) {
|
|
98601
|
+
device.ctx.logger.warn("power switch: hub slice read failed", {
|
|
98602
|
+
tags: { deviceId },
|
|
98603
|
+
meta: {
|
|
98604
|
+
capName,
|
|
98605
|
+
error: err instanceof Error ? err.message : String(err)
|
|
98606
|
+
}
|
|
98607
|
+
});
|
|
98608
|
+
return null;
|
|
98609
|
+
}
|
|
98610
|
+
}
|
|
98611
|
+
};
|
|
98612
|
+
const built = buildPowerSwitch(host, cap, owner);
|
|
98613
|
+
host.registerNativeCap(switchCapability, built.provider);
|
|
98614
|
+
return built.dispose;
|
|
98615
|
+
}
|
|
97889
98616
|
Object.freeze({
|
|
97890
98617
|
"accessories.getStatus": [{
|
|
97891
98618
|
name: "deviceId",
|
|
@@ -98316,35 +99043,6 @@ Object.freeze({
|
|
|
98316
99043
|
form: "single",
|
|
98317
99044
|
optional: false
|
|
98318
99045
|
}],
|
|
98319
|
-
"deviceDiscovery.adoptDevice": [{
|
|
98320
|
-
name: "deviceId",
|
|
98321
|
-
form: "single",
|
|
98322
|
-
optional: false
|
|
98323
|
-
}],
|
|
98324
|
-
"deviceDiscovery.getStatus": [{
|
|
98325
|
-
name: "deviceId",
|
|
98326
|
-
form: "single",
|
|
98327
|
-
optional: false
|
|
98328
|
-
}],
|
|
98329
|
-
"deviceDiscovery.listDiscovered": [{
|
|
98330
|
-
name: "deviceId",
|
|
98331
|
-
form: "single",
|
|
98332
|
-
optional: false
|
|
98333
|
-
}],
|
|
98334
|
-
"deviceDiscovery.refreshDiscovery": [{
|
|
98335
|
-
name: "deviceId",
|
|
98336
|
-
form: "single",
|
|
98337
|
-
optional: false
|
|
98338
|
-
}],
|
|
98339
|
-
"deviceDiscovery.releaseDevice": [{
|
|
98340
|
-
name: "childDeviceId",
|
|
98341
|
-
form: "single",
|
|
98342
|
-
optional: false
|
|
98343
|
-
}, {
|
|
98344
|
-
name: "deviceId",
|
|
98345
|
-
form: "single",
|
|
98346
|
-
optional: false
|
|
98347
|
-
}],
|
|
98348
99046
|
"deviceExport.applyDeviceSettingsPatch": [{
|
|
98349
99047
|
name: "deviceId",
|
|
98350
99048
|
form: "single",
|
|
@@ -98908,6 +99606,11 @@ Object.freeze({
|
|
|
98908
99606
|
form: "single",
|
|
98909
99607
|
optional: false
|
|
98910
99608
|
}],
|
|
99609
|
+
"fanControl.setOscillationAxis": [{
|
|
99610
|
+
name: "deviceId",
|
|
99611
|
+
form: "single",
|
|
99612
|
+
optional: false
|
|
99613
|
+
}],
|
|
98911
99614
|
"fanControl.setPercentage": [{
|
|
98912
99615
|
name: "deviceId",
|
|
98913
99616
|
form: "single",
|
|
@@ -127296,7 +127999,7 @@ function mapHmChannel(channelType) {
|
|
|
127296
127999
|
capabilities: ["cover"]
|
|
127297
128000
|
};
|
|
127298
128001
|
case "HEATING_CLIMATECONTROL_TRANSCEIVER": return {
|
|
127299
|
-
deviceType: DeviceType.
|
|
128002
|
+
deviceType: DeviceType.Climate,
|
|
127300
128003
|
role: null,
|
|
127301
128004
|
capabilities: [
|
|
127302
128005
|
"climate-control",
|
|
@@ -127335,12 +128038,12 @@ function mapHmChannel(channelType) {
|
|
|
127335
128038
|
* from the union of its channel mappings. Actuators win over sensors so
|
|
127336
128039
|
* a switch + energy-meter device (HmIP-BSM) reports as a Switch, not a
|
|
127337
128040
|
* Sensor, and a thermostat with a humidity sensor reports as a
|
|
127338
|
-
*
|
|
128041
|
+
* Climate device (D1033). A remote/wall-switch is primarily an EventEmitter: it is
|
|
127339
128042
|
* ranked above Sensor so its battery / maintenance sensor channels don't
|
|
127340
128043
|
* win the parent type. Returns `DeviceType.Generic` when no channel maps.
|
|
127341
128044
|
*/
|
|
127342
128045
|
var PARENT_TYPE_PRIORITY = [
|
|
127343
|
-
DeviceType.
|
|
128046
|
+
DeviceType.Climate,
|
|
127344
128047
|
DeviceType.Lock,
|
|
127345
128048
|
DeviceType.Cover,
|
|
127346
128049
|
DeviceType.Light,
|
|
@@ -127452,9 +128155,10 @@ var HM_KEY_PRESS_DATAPOINTS = [
|
|
|
127452
128155
|
/** Set form for O(1) fire-detection membership tests. */
|
|
127453
128156
|
var HM_KEY_PRESS_SET = new Set(HM_KEY_PRESS_DATAPOINTS);
|
|
127454
128157
|
/** Cold-start event-emitter slice; vocabulary supplied per-device. */
|
|
127455
|
-
function coldEventEmitter(
|
|
128158
|
+
function coldEventEmitter(vocabulary) {
|
|
127456
128159
|
return {
|
|
127457
|
-
eventTypes:
|
|
128160
|
+
eventTypes: eventTypesOfVocabulary(vocabulary),
|
|
128161
|
+
vocabulary: [...vocabulary],
|
|
127458
128162
|
lastEvent: null,
|
|
127459
128163
|
eventCountSinceStart: 0
|
|
127460
128164
|
};
|
|
@@ -127524,7 +128228,7 @@ function actuatorInfo(kind) {
|
|
|
127524
128228
|
case "climate": return {
|
|
127525
128229
|
kind: "climate",
|
|
127526
128230
|
capName: "climate-control",
|
|
127527
|
-
type: DeviceType.
|
|
128231
|
+
type: DeviceType.Climate
|
|
127528
128232
|
};
|
|
127529
128233
|
default: return null;
|
|
127530
128234
|
}
|
|
@@ -127534,13 +128238,28 @@ function actuatorInfo(kind) {
|
|
|
127534
128238
|
* tilt), a plain `cover` entity is the roller shutter (HmIP-BROLL). Exporters
|
|
127535
128239
|
* read it; every other actuator has no role.
|
|
127536
128240
|
*/
|
|
127537
|
-
function actuatorRole(kind) {
|
|
128241
|
+
function actuatorRole(kind, model) {
|
|
127538
128242
|
if (kind === "blind") return DeviceRole.CoverBlind;
|
|
127539
128243
|
if (kind === "cover") return DeviceRole.CoverShutter;
|
|
128244
|
+
if (kind === "climate") return climateRoleOfModel(model);
|
|
127540
128245
|
return null;
|
|
127541
128246
|
}
|
|
128247
|
+
/** Radiator valves: HmIP-eTRV-* and the classic HM-CC-RT-DN. */
|
|
128248
|
+
var RADIATOR_MODEL = /eTRV|HM-CC-RT-DN/i;
|
|
128249
|
+
/** Floor-heating actuators: HmIP-FAL* / HmIP-FALMOT-*. */
|
|
128250
|
+
var FLOOR_MODEL = /FAL/i;
|
|
128251
|
+
/**
|
|
128252
|
+
* D1033 — which climate device a Homematic model is. A radiator valve and a
|
|
128253
|
+
* floor-heating actuator are told apart by model; a wall thermostat, a
|
|
128254
|
+
* heating group and an unknown model are thermostats.
|
|
128255
|
+
*/
|
|
128256
|
+
function climateRoleOfModel(model) {
|
|
128257
|
+
if (model !== void 0 && RADIATOR_MODEL.test(model)) return DeviceRole.ClimateRadiator;
|
|
128258
|
+
if (model !== void 0 && FLOOR_MODEL.test(model)) return DeviceRole.ClimateFloor;
|
|
128259
|
+
return DeviceRole.ClimateThermostat;
|
|
128260
|
+
}
|
|
127542
128261
|
/** Actuator specs from the library's typed custom entities (correct channel). */
|
|
127543
|
-
function deriveActuatorSpecs(customEntities) {
|
|
128262
|
+
function deriveActuatorSpecs(customEntities, model) {
|
|
127544
128263
|
const out = [];
|
|
127545
128264
|
for (const entity of customEntities) {
|
|
127546
128265
|
const info = actuatorInfo(entity.kind);
|
|
@@ -127548,7 +128267,7 @@ function deriveActuatorSpecs(customEntities) {
|
|
|
127548
128267
|
out.push({
|
|
127549
128268
|
key: `act-${entity.channel}`,
|
|
127550
128269
|
deviceType: info.type,
|
|
127551
|
-
role: actuatorRole(entity.kind),
|
|
128270
|
+
role: actuatorRole(entity.kind, model),
|
|
127552
128271
|
capabilities: [info.capName],
|
|
127553
128272
|
name: `${entity.kind} ${entity.channel}`,
|
|
127554
128273
|
config: {
|
|
@@ -127648,7 +128367,7 @@ function deriveUpdateSpec(device) {
|
|
|
127648
128367
|
*/
|
|
127649
128368
|
function deriveHmEntitySpecs(device, customEntities) {
|
|
127650
128369
|
return [
|
|
127651
|
-
...deriveActuatorSpecs(customEntities),
|
|
128370
|
+
...deriveActuatorSpecs(customEntities, device.type),
|
|
127652
128371
|
...deriveSensorAndEventSpecs(device),
|
|
127653
128372
|
...deriveDiagnosticSpecs(device, device.address),
|
|
127654
128373
|
...deriveUpdateSpec(device)
|
|
@@ -128283,7 +129002,7 @@ var HmActuatorDevice = class extends HmChildDevice {
|
|
|
128283
129002
|
}
|
|
128284
129003
|
registerClimateCap() {
|
|
128285
129004
|
const channel = this.actuatorChannel;
|
|
128286
|
-
|
|
129005
|
+
const provider = {
|
|
128287
129006
|
getStatus: async () => this.runtimeState.getCapState("climate-control") ?? COLD_CLIMATE,
|
|
128288
129007
|
setMode: async ({ mode }) => {
|
|
128289
129008
|
await this.requireFacade().climateSetMode(this.address, channel, toHmClimateMode(mode));
|
|
@@ -128299,7 +129018,9 @@ var HmActuatorDevice = class extends HmChildDevice {
|
|
|
128299
129018
|
setTargetHumidity: async () => this.unsupported("climate humidity control"),
|
|
128300
129019
|
setSwingVertical: async () => this.unsupported("climate vertical swing"),
|
|
128301
129020
|
setSwingHorizontal: async () => this.unsupported("climate horizontal swing")
|
|
128302
|
-
}
|
|
129021
|
+
};
|
|
129022
|
+
this.ctx.registerNativeCap(climateControlCapability, provider);
|
|
129023
|
+
registerPowerSwitch(this, climateControlCapability, provider);
|
|
128303
129024
|
this.runtimeState.setCapState("climate-control", COLD_CLIMATE);
|
|
128304
129025
|
this.registeredCap = "climate-control";
|
|
128305
129026
|
}
|
|
@@ -128517,6 +129238,64 @@ var HmSensorDevice = class extends HmChildDevice {
|
|
|
128517
129238
|
}
|
|
128518
129239
|
};
|
|
128519
129240
|
//#endregion
|
|
129241
|
+
//#region src/devices/hm-key-vocabulary.ts
|
|
129242
|
+
var PRESS_MEANING = {
|
|
129243
|
+
PRESS_SHORT: {
|
|
129244
|
+
label: "Short press",
|
|
129245
|
+
kind: "press"
|
|
129246
|
+
},
|
|
129247
|
+
PRESS_LONG: {
|
|
129248
|
+
label: "Long press",
|
|
129249
|
+
kind: "long-press"
|
|
129250
|
+
},
|
|
129251
|
+
PRESS_LONG_START: {
|
|
129252
|
+
label: "Long press started",
|
|
129253
|
+
kind: "long-press-start"
|
|
129254
|
+
},
|
|
129255
|
+
PRESS_LONG_RELEASE: {
|
|
129256
|
+
label: "Long press released",
|
|
129257
|
+
kind: "release"
|
|
129258
|
+
},
|
|
129259
|
+
PRESS_CONT: {
|
|
129260
|
+
label: "Long press held",
|
|
129261
|
+
kind: "repeat"
|
|
129262
|
+
}
|
|
129263
|
+
};
|
|
129264
|
+
/** The channels of a device that are buttons, in channel order. */
|
|
129265
|
+
function hmKeyChannels(device) {
|
|
129266
|
+
return mapHmDeviceChannels(device).filter(({ mapping }) => mapping.capabilities.includes("event-emitter")).map(({ channel }) => channel);
|
|
129267
|
+
}
|
|
129268
|
+
/** The presses one key channel has; the standard set when it lists none. */
|
|
129269
|
+
function pressesOf(channel) {
|
|
129270
|
+
const listed = new Set((channel.dataPoints ?? []).map((dataPoint) => dataPoint.parameter).filter((parameter) => HM_KEY_PRESS_SET.has(parameter)));
|
|
129271
|
+
if (listed.size === 0) return HM_KEY_PRESS_DATAPOINTS;
|
|
129272
|
+
return HM_KEY_PRESS_DATAPOINTS.filter((parameter) => listed.has(parameter));
|
|
129273
|
+
}
|
|
129274
|
+
function entryOf(parameter, source) {
|
|
129275
|
+
const meaning = PRESS_MEANING[parameter];
|
|
129276
|
+
if (meaning === void 0) return {
|
|
129277
|
+
id: parameter,
|
|
129278
|
+
source,
|
|
129279
|
+
label: parameter
|
|
129280
|
+
};
|
|
129281
|
+
return {
|
|
129282
|
+
id: parameter,
|
|
129283
|
+
source,
|
|
129284
|
+
label: meaning.label,
|
|
129285
|
+
kind: meaning.kind
|
|
129286
|
+
};
|
|
129287
|
+
}
|
|
129288
|
+
function hmKeyVocabulary(device) {
|
|
129289
|
+
return hmKeyChannels(device).flatMap((channel, position) => {
|
|
129290
|
+
const index = channelIndexFromAddress(channel.address) ?? String(channel.index);
|
|
129291
|
+
const source = {
|
|
129292
|
+
id: index,
|
|
129293
|
+
label: `Button ${position + 1} (channel ${index})`
|
|
129294
|
+
};
|
|
129295
|
+
return pressesOf(channel).map((parameter) => entryOf(parameter, source));
|
|
129296
|
+
});
|
|
129297
|
+
}
|
|
129298
|
+
//#endregion
|
|
128520
129299
|
//#region src/devices/hm-event-emitter-device.ts
|
|
128521
129300
|
/**
|
|
128522
129301
|
* Event-emitter child config: the persisted native press vocabulary for the
|
|
@@ -128527,31 +129306,93 @@ var hmEventEmitterSchema = hmChildSchema.extend({ eventTypes: array(string()).op
|
|
|
128527
129306
|
/**
|
|
128528
129307
|
* ONE Homematic event-emitter accessory child collapsing all of a device's key
|
|
128529
129308
|
* channels (HmIP-WRC* wall switches / HmIP-RC* remotes / KEY channels). The
|
|
128530
|
-
* event vocabulary is
|
|
128531
|
-
* datapoints (
|
|
128532
|
-
* `EventCategory.EventEmitted` with the button index (`:N` channel suffix)
|
|
128533
|
-
* `
|
|
129309
|
+
* event vocabulary is one source per key channel with that channel's native
|
|
129310
|
+
* `PRESS_*` datapoints, verbatim (`hm-key-vocabulary.ts`). Presses fire
|
|
129311
|
+
* `EventCategory.EventEmitted` with the button index (`:N` channel suffix)
|
|
129312
|
+
* as `sourceId`.
|
|
128534
129313
|
*/
|
|
128535
129314
|
var HmEventEmitterDevice = class extends HmChildDevice {
|
|
128536
|
-
|
|
129315
|
+
/** The tokens persisted at adoption: the vocabulary of last resort. */
|
|
129316
|
+
persistedEventTypes;
|
|
129317
|
+
/** The vocabulary read from the CCU's channel list, once it answered. */
|
|
129318
|
+
#declared = null;
|
|
129319
|
+
/** Fires already reported as outside the vocabulary, as `source:token`. */
|
|
129320
|
+
#undeclaredLogged = /* @__PURE__ */ new Set();
|
|
128537
129321
|
#eventSeq = 0;
|
|
128538
129322
|
#eventCount = 0;
|
|
129323
|
+
/** Unsubscribe for the integration's state-change fan-out. */
|
|
129324
|
+
#snapshotUnsub = null;
|
|
128539
129325
|
constructor(ctx) {
|
|
128540
129326
|
super(ctx, hmEventEmitterSchema);
|
|
128541
129327
|
const persisted = this.config.values.eventTypes;
|
|
128542
|
-
this.
|
|
129328
|
+
this.persistedEventTypes = persisted && persisted.length > 0 ? persisted : HM_KEY_PRESS_DATAPOINTS;
|
|
128543
129329
|
this.registerEventEmitterCap();
|
|
128544
129330
|
this.attachValueChangedListener((event) => this.decodeKeyPress(event));
|
|
129331
|
+
if (this.integrationId !== void 0) this.#snapshotUnsub = homematicFacades.onSnapshot(this.integrationId, () => this.refreshDeclaredVocabulary());
|
|
129332
|
+
}
|
|
129333
|
+
/**
|
|
129334
|
+
* Rewrite the slice with the buttons once the CCU's channel list carries
|
|
129335
|
+
* them. A no-op while it does not, and after the buttons were declared.
|
|
129336
|
+
*/
|
|
129337
|
+
refreshDeclaredVocabulary() {
|
|
129338
|
+
if (this.#declared !== null) return;
|
|
129339
|
+
const vocabulary = this.vocabulary();
|
|
129340
|
+
if (this.#declared === null) return;
|
|
129341
|
+
const current = this.runtimeState.getCapState("event-emitter");
|
|
129342
|
+
this.runtimeState.setCapState("event-emitter", {
|
|
129343
|
+
eventTypes: eventTypesOfVocabulary(vocabulary),
|
|
129344
|
+
vocabulary: [...vocabulary],
|
|
129345
|
+
lastEvent: current?.lastEvent ?? null,
|
|
129346
|
+
eventCountSinceStart: current?.eventCountSinceStart ?? 0
|
|
129347
|
+
});
|
|
129348
|
+
}
|
|
129349
|
+
async removeDevice() {
|
|
129350
|
+
this.#snapshotUnsub?.();
|
|
129351
|
+
this.#snapshotUnsub = null;
|
|
129352
|
+
await super.removeDevice();
|
|
128545
129353
|
}
|
|
128546
129354
|
registerEventEmitterCap() {
|
|
128547
|
-
this.ctx.registerNativeCap(eventEmitterCapability, { getStatus: async () => this.runtimeState.getCapState("event-emitter") ?? coldEventEmitter(this.
|
|
128548
|
-
this.runtimeState.setCapState("event-emitter", coldEventEmitter(this.
|
|
129355
|
+
this.ctx.registerNativeCap(eventEmitterCapability, { getStatus: async () => this.runtimeState.getCapState("event-emitter") ?? coldEventEmitter(this.vocabulary()) });
|
|
129356
|
+
this.runtimeState.setCapState("event-emitter", coldEventEmitter(this.vocabulary()));
|
|
129357
|
+
}
|
|
129358
|
+
/**
|
|
129359
|
+
* The buttons and their presses, read LIVE from the CCU's channel list.
|
|
129360
|
+
*
|
|
129361
|
+
* Not from the child's config: that is written once, at adoption, so a
|
|
129362
|
+
* remote adopted before the vocabulary existed would never get its
|
|
129363
|
+
* buttons. While the CCU has not answered, the persisted tokens stand in,
|
|
129364
|
+
* with no button; the next write after it answers carries the buttons.
|
|
129365
|
+
*/
|
|
129366
|
+
vocabulary() {
|
|
129367
|
+
if (this.#declared !== null) return this.#declared;
|
|
129368
|
+
const device = this.resolveHmDevice();
|
|
129369
|
+
const live = device === null ? [] : hmKeyVocabulary(device);
|
|
129370
|
+
if (live.length === 0) return plainEventVocabulary(this.persistedEventTypes);
|
|
129371
|
+
this.#declared = live;
|
|
129372
|
+
return live;
|
|
129373
|
+
}
|
|
129374
|
+
/** A press the vocabulary does not declare is delivered, and said once. */
|
|
129375
|
+
noteUndeclared(vocabulary, eventType, sourceId) {
|
|
129376
|
+
if (this.#declared === null) return;
|
|
129377
|
+
if (findVocabularyEntry(vocabulary, eventType, sourceId ?? void 0) !== void 0) return;
|
|
129378
|
+
const key = `${sourceId ?? ""}:${eventType}`;
|
|
129379
|
+
if (this.#undeclaredLogged.has(key)) return;
|
|
129380
|
+
this.#undeclaredLogged.add(key);
|
|
129381
|
+
this.ctx.logger.warn("Homematic press is not in the declared event vocabulary", {
|
|
129382
|
+
tags: { deviceId: this.ctx.id },
|
|
129383
|
+
meta: {
|
|
129384
|
+
address: this.address,
|
|
129385
|
+
eventType,
|
|
129386
|
+
sourceId
|
|
129387
|
+
}
|
|
129388
|
+
});
|
|
128549
129389
|
}
|
|
128550
129390
|
/**
|
|
128551
129391
|
* Translate a key-channel `PRESS_*` datapoint into an `EventFire`: emit
|
|
128552
129392
|
* `EventCategory.EventEmitted` on the bus and write the `event-emitter`
|
|
128553
129393
|
* slice. The `eventType` is the native datapoint name VERBATIM; the button
|
|
128554
|
-
* index (`:N` suffix of the channel address)
|
|
129394
|
+
* index (`:N` suffix of the channel address) is the fire's `sourceId`, and
|
|
129395
|
+
* stays in `data.channel` for readers older than the vocabulary.
|
|
128555
129396
|
* Non-key datapoints and value resets are ignored.
|
|
128556
129397
|
*/
|
|
128557
129398
|
decodeKeyPress(event) {
|
|
@@ -128563,6 +129404,7 @@ var HmEventEmitterDevice = class extends HmChildDevice {
|
|
|
128563
129404
|
const fire = {
|
|
128564
129405
|
deviceId: this.id,
|
|
128565
129406
|
eventType: parameter,
|
|
129407
|
+
...channelIndex !== null ? { sourceId: channelIndex } : {},
|
|
128566
129408
|
data: channelIndex !== null ? { channel: channelIndex } : {},
|
|
128567
129409
|
timestamp: now,
|
|
128568
129410
|
seq: ++this.#eventSeq
|
|
@@ -128573,8 +129415,11 @@ var HmEventEmitterDevice = class extends HmChildDevice {
|
|
|
128573
129415
|
deviceId: this.id,
|
|
128574
129416
|
addonId: this.ctx.deviceMeta.addonId
|
|
128575
129417
|
}, fire));
|
|
129418
|
+
const vocabulary = this.vocabulary();
|
|
129419
|
+
this.noteUndeclared(vocabulary, parameter, channelIndex);
|
|
128576
129420
|
const slice = {
|
|
128577
|
-
eventTypes:
|
|
129421
|
+
eventTypes: eventTypesOfVocabulary(vocabulary),
|
|
129422
|
+
vocabulary: [...vocabulary],
|
|
128578
129423
|
lastEvent: fire,
|
|
128579
129424
|
eventCountSinceStart: ++this.#eventCount
|
|
128580
129425
|
};
|