@camstack/addon-provider-homematic 1.2.188 → 1.2.190

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/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-jnvhwGoH.mjs
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
- DeviceType["Thermostat"] = "thermostat";
834
- /** Air-conditioner / heat-pump climate device (HVAC) — shares the
835
- * `climate-control` cap surface with `Thermostat` but renders a
836
- * dedicated AC-appropriate control UI (mode chips, fan speed,
837
- * independent vertical/horizontal swing). Sources: native Gree, and
838
- * reusable by other AC integrations. */
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-Dz1P6--1.mjs
6057
+ //#region ../types/dist/sleep-Bn346wCJ.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")
@@ -15017,6 +15075,7 @@ var SYSTEM_CAP_VOCABULARY = {
15017
15075
  backup: system("system backups — run and restored from the Backups page"),
15018
15076
  broker: system("message-broker connections — configured, not actuated"),
15019
15077
  "calendar-source": system(INTERNAL),
15078
+ "cluster-update": system(CLUSTER),
15020
15079
  calendars: system("calendars feed schedules and conditions, not device actions"),
15021
15080
  composer: system("device composition — an authoring tool, not an action"),
15022
15081
  "core-blocks": system(INTERNAL),
@@ -15323,6 +15382,7 @@ var CAP_NAMES = Object.freeze([
15323
15382
  "camera-streams",
15324
15383
  "carbon-monoxide",
15325
15384
  "climate-control",
15385
+ "cluster-update",
15326
15386
  "color",
15327
15387
  "composer",
15328
15388
  "connectivity",
@@ -15340,7 +15400,6 @@ var CAP_NAMES = Object.freeze([
15340
15400
  "device-admin-link",
15341
15401
  "device-adoption",
15342
15402
  "device-credentials",
15343
- "device-discovery",
15344
15403
  "device-export",
15345
15404
  "device-extension",
15346
15405
  "device-history",
@@ -15962,13 +16021,6 @@ Object.freeze({
15962
16021
  "valueType": "string"
15963
16022
  }
15964
16023
  ],
15965
- "device-discovery": [{
15966
- "path": "lastDiscoveryAt",
15967
- "valueType": "number"
15968
- }, {
15969
- "path": "lastError",
15970
- "valueType": "string"
15971
- }],
15972
16024
  "device-export": [
15973
16025
  {
15974
16026
  "path": "linkState",
@@ -17420,7 +17472,7 @@ Object.freeze({
17420
17472
  }
17421
17473
  });
17422
17474
  //#endregion
17423
- //#region ../types/dist/implemented-methods-OitwyO1Y.mjs
17475
+ //#region ../types/dist/implemented-methods-5YMDeE3f.mjs
17424
17476
  /**
17425
17477
  * The ffmpeg build every CamStack node downloads, per platform and arch.
17426
17478
  *
@@ -44079,6 +44131,62 @@ var WeekdayKeySchema = _enum([
44079
44131
  "sat",
44080
44132
  "sun"
44081
44133
  ]);
44134
+ /**
44135
+ * Hold semantics — "for N seconds" on a leaf of the `when` tree (#498).
44136
+ *
44137
+ * ONE primitive, `for: { ms, mode, tolerance? }`, shared by `device-becomes`,
44138
+ * `device-is` and `expression`:
44139
+ *
44140
+ * - `held`: the condition stays true for `ms`;
44141
+ * - `stable`: the value does not move by more than `tolerance` (absolute, in
44142
+ * the field's base unit) for `ms` while the condition holds.
44143
+ *
44144
+ * {@link HoldCore} is the pure state machine (an input observation → a reading).
44145
+ * {@link HoldTracker} keys cores by a leaf path for the STATE leaves the tree
44146
+ * evaluator judges. {@link BecomesWatch} wraps a core with a timer for the
44147
+ * `device-becomes` EVENT leaf: the deadline is armed when the hold starts and
44148
+ * cancelled when it breaks, and the leaf fires ONCE per episode.
44149
+ *
44150
+ * Hold state is memory only. A hold that is already running when the watcher
44151
+ * first looks (a restart) is INHERITED: nobody knows when it began, so it never
44152
+ * fires for that episode and a state leaf reads it as unknown until the window
44153
+ * has elapsed from the moment the watcher started (D49: not-known is not false).
44154
+ */
44155
+ var HOLD_MAX_MS = 864e5;
44156
+ var HoldModeSchema = _enum(["held", "stable"]);
44157
+ var HoldSpecSchema = object({
44158
+ /** How long the condition (or the value) must hold. */
44159
+ ms: number$1().int().min(1).max(HOLD_MAX_MS),
44160
+ mode: HoldModeSchema,
44161
+ /** `stable` only: the largest move of the value that still counts as unchanged (absolute, base unit). */
44162
+ tolerance: number$1().min(0).optional()
44163
+ });
44164
+ /** What a trace says about a hold. */
44165
+ var HoldTraceSchema = object({
44166
+ phase: _enum([
44167
+ "pending",
44168
+ "cancelled",
44169
+ "fired",
44170
+ "reseeded"
44171
+ ]),
44172
+ ms: number$1().int(),
44173
+ mode: HoldModeSchema,
44174
+ /** When the hold started (ms epoch). */
44175
+ since: number$1().optional(),
44176
+ /** When it completes (ms epoch), for a pending hold. */
44177
+ deadline: number$1().optional()
44178
+ });
44179
+ /** The operators a `device-becomes` leaf may carry: a threshold or a range. */
44180
+ var BecomesOperatorSchema = _enum([
44181
+ "eq",
44182
+ "ne",
44183
+ "gt",
44184
+ "gte",
44185
+ "lt",
44186
+ "lte",
44187
+ "between",
44188
+ "outside"
44189
+ ]);
44082
44190
  /** How a state leaf compares a device field to a value. Derived from the
44083
44191
  * field's `kind` in `deviceManager.getWireableFields`, never hand-maintained. */
44084
44192
  var AutomationConditionOperatorSchema = _enum([
@@ -44092,6 +44200,13 @@ var AutomationConditionOperatorSchema = _enum([
44092
44200
  "in"
44093
44201
  ]);
44094
44202
  /**
44203
+ * The stable name of an event leaf. A path (`when.0.1`) moves when a row is
44204
+ * reordered; the id does not, so a `triggered-by` leaf keeps pointing at the
44205
+ * same row. Optional: a leaf nothing refers to needs none.
44206
+ */
44207
+ var EVENT_LEAF_ID_RE = /^[A-Za-z0-9_-]{1,40}$/;
44208
+ var eventLeafId = { id: string().regex(EVENT_LEAF_ID_RE).optional() };
44209
+ /**
44095
44210
  * D8 compliance, and it is the reason a "becomes" leaf is not merely an event
44096
44211
  * subscription: it evaluates against the **state mirror**, which is reconciled,
44097
44212
  * and an event only WAKES the evaluation. A dropped event therefore DELAYS a
@@ -44099,24 +44214,60 @@ var AutomationConditionOperatorSchema = _enum([
44099
44214
  */
44100
44215
  var DeviceBecomesLeafSchema = object({
44101
44216
  kind: literal("device-becomes"),
44217
+ ...eventLeafId,
44102
44218
  deviceId: number$1().int().nonnegative(),
44103
44219
  cap: string().min(1),
44104
44220
  fieldPath: string().min(1),
44105
- /** Fire when the field takes this value. Omit to fire on any change. */
44221
+ /** Fire when the field takes this value. Omit (with no `operator`) to fire on any change. */
44106
44222
  becomes: union([
44107
44223
  string(),
44108
44224
  number$1(),
44109
44225
  boolean()
44110
44226
  ]).optional(),
44111
- /** Only on a CHANGE of value, not on every re-report. */
44227
+ /**
44228
+ * A threshold or a range instead of an equality: "crosses above 3000", "enters
44229
+ * 18..24". The leaf fires on the TRANSITION into the predicate, never on a re-report.
44230
+ * `value` is in the field's base unit; `between` / `outside` take `[low, high]`.
44231
+ */
44232
+ operator: BecomesOperatorSchema.optional(),
44233
+ value: union([
44234
+ number$1(),
44235
+ string(),
44236
+ boolean(),
44237
+ array(number$1()).length(2)
44238
+ ]).optional(),
44239
+ /**
44240
+ * Hold: the transition (or, with no predicate, the new value) must stay for
44241
+ * `for.ms` before the leaf fires, ONCE per episode. See `hold.ts`.
44242
+ */
44243
+ for: HoldSpecSchema.optional(),
44244
+ /** @deprecated every leaf fires on a transition now; read as always on. */
44112
44245
  edge: boolean().optional(),
44113
- /** The new value must hold this long before it counts. */
44114
- forMs: number$1().int().min(0).max(864e5).optional(),
44246
+ /** @deprecated legacy `held` window — read through `holdOf` as `for: { ms, mode: 'held' }`. */
44247
+ forMs: number$1().int().min(0).max(HOLD_MAX_MS).optional(),
44115
44248
  /** Collapse a burst into one occurrence. */
44116
44249
  debounceMs: number$1().int().min(0).max(6e5).optional()
44250
+ }).superRefine((leaf, ctx) => {
44251
+ if (leaf.becomes !== void 0 && leaf.operator !== void 0) ctx.addIssue({
44252
+ code: "custom",
44253
+ message: "a leaf names `becomes` or `operator`, not both",
44254
+ path: ["operator"]
44255
+ });
44256
+ if (leaf.operator !== void 0 && leaf.value === void 0) ctx.addIssue({
44257
+ code: "custom",
44258
+ message: "an operator needs the value to compare to",
44259
+ path: ["value"]
44260
+ });
44261
+ const range = leaf.operator === "between" || leaf.operator === "outside";
44262
+ if (leaf.operator !== void 0 && range !== Array.isArray(leaf.value)) ctx.addIssue({
44263
+ code: "custom",
44264
+ message: range ? "a range takes [low, high]" : "only a range takes [low, high]",
44265
+ path: ["value"]
44266
+ });
44117
44267
  });
44118
44268
  var DeviceEventLeafSchema = object({
44119
44269
  kind: literal("device-event"),
44270
+ ...eventLeafId,
44120
44271
  /** An `EventCategory` value. */
44121
44272
  category: string().min(1),
44122
44273
  deviceId: number$1().int().nonnegative().optional()
@@ -44129,18 +44280,24 @@ var DeviceEventLeafSchema = object({
44129
44280
  */
44130
44281
  var ScheduleLeafSchema = object({
44131
44282
  kind: literal("schedule"),
44283
+ ...eventLeafId,
44132
44284
  at: TimeSpecSchema.optional(),
44133
44285
  days: array(WeekdayKeySchema).min(1).max(7).optional(),
44134
44286
  /** @deprecated legacy cron — new schedules use `at`. */
44135
44287
  cron: string().min(1).max(120).optional()
44136
44288
  }).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" });
44137
- var ManualLeafSchema = object({ kind: literal("manual") });
44289
+ var ManualLeafSchema = object({
44290
+ kind: literal("manual"),
44291
+ ...eventLeafId
44292
+ });
44138
44293
  var IntervalLeafSchema = object({
44139
44294
  kind: literal("interval"),
44295
+ ...eventLeafId,
44140
44296
  minutes: number$1().int().min(1).max(1440)
44141
44297
  });
44142
44298
  var DetectionLeafSchema = object({
44143
44299
  kind: literal("detection"),
44300
+ ...eventLeafId,
44144
44301
  /** One macro class each, optionally narrowed by a label; a track of any listed subject fires. */
44145
44302
  subjects: array(DetectionSubjectSchema).min(1),
44146
44303
  deviceIds: array(number$1().int().nonnegative()).min(1),
@@ -44151,6 +44308,7 @@ var DetectionLeafSchema = object({
44151
44308
  });
44152
44309
  var StationaryLeafSchema = object({
44153
44310
  kind: literal("stationary"),
44311
+ ...eventLeafId,
44154
44312
  deviceIds: array(number$1().int().nonnegative()).min(1),
44155
44313
  subjects: array(StationarySubjectSchema).min(1).optional(),
44156
44314
  zones: array(string().min(1)).min(1).optional(),
@@ -44178,7 +44336,9 @@ var DeviceIsLeafSchema = object({
44178
44336
  QuantityValueSchema
44179
44337
  ]),
44180
44338
  /** The unit the person picked for `value` (display only; `value` is in the base unit). */
44181
- unit: string().min(1).optional()
44339
+ unit: string().min(1).optional(),
44340
+ /** The comparison must hold (`held`) or the value stay put (`stable`) this long. */
44341
+ for: HoldSpecSchema.optional()
44182
44342
  });
44183
44343
  /**
44184
44344
  * True when the camera currently has a PARKED object matching `subjects` in at
@@ -44194,6 +44354,41 @@ var StationaryPresentLeafSchema = object({
44194
44354
  minCount: number$1().int().positive().optional()
44195
44355
  });
44196
44356
  /**
44357
+ * True while the site-local clock is inside a daily window and/or on one of
44358
+ * the named days. `days` names the local day a window STARTS on, so
44359
+ * 22:00-06:00 on weekdays is still inside at 01:00 Saturday. A one-date spec
44360
+ * (`kind: 'date'`) is refused: only a clock time or a sun event makes a window
44361
+ * that repeats every day.
44362
+ */
44363
+ var TimeIsLeafSchema = object({
44364
+ kind: literal("time-is"),
44365
+ between: object({
44366
+ from: TimeSpecSchema,
44367
+ to: TimeSpecSchema
44368
+ }).optional(),
44369
+ days: array(WeekdayKeySchema).min(1).max(7).optional()
44370
+ }).superRefine((leaf, ctx) => {
44371
+ if (leaf.between === void 0 && leaf.days === void 0) ctx.addIssue({
44372
+ code: "custom",
44373
+ message: "a time-is leaf needs a between window, days, or both"
44374
+ });
44375
+ for (const end of ["from", "to"]) if (leaf.between?.[end].kind === "date") ctx.addIssue({
44376
+ code: "custom",
44377
+ message: "a one-date time cannot bound a daily window: use a clock time or a sun event",
44378
+ path: ["between", end]
44379
+ });
44380
+ });
44381
+ /**
44382
+ * True for the run that one of the named event leaves started. It reads the
44383
+ * run, not a device: in the tree it is judged against the leaf that fired, in
44384
+ * a step guard against the trigger the run carries. A run no event leaf
44385
+ * started (a state-only tree becoming true) is false.
44386
+ */
44387
+ var TriggeredByLeafSchema = object({
44388
+ kind: literal("triggered-by"),
44389
+ leafIds: array(string().regex(EVENT_LEAF_ID_RE)).min(1).max(20)
44390
+ });
44391
+ /**
44197
44392
  * The escape hatch: the bounded expression engine over named device bindings.
44198
44393
  * Declared as a plain object so a discriminated union can read `kind`; the
44199
44394
  * author-time validation is the SAME function `ExpressionSourceSchema` runs.
@@ -44201,7 +44396,9 @@ var StationaryPresentLeafSchema = object({
44201
44396
  var ExpressionLeafSchema = object({
44202
44397
  kind: literal("expression"),
44203
44398
  expr: string().min(1).max(MAX_EXPRESSION_SOURCE_LENGTH),
44204
- bindings: record(string().regex(EXPRESSION_IDENTIFIER_RE), ExpressionBindingSourceSchema)
44399
+ bindings: record(string().regex(EXPRESSION_IDENTIFIER_RE), ExpressionBindingSourceSchema),
44400
+ /** The expression must stay true this long. An expression has no single value, so only `held`. */
44401
+ for: HoldSpecSchema.optional()
44205
44402
  }).superRefine((src, ctx) => {
44206
44403
  const err = validateExpressionSource(src);
44207
44404
  if (err !== null) ctx.addIssue({
@@ -44209,6 +44406,11 @@ var ExpressionLeafSchema = object({
44209
44406
  message: err,
44210
44407
  path: ["expr"]
44211
44408
  });
44409
+ if (src.for?.mode === "stable") ctx.addIssue({
44410
+ code: "custom",
44411
+ message: "an expression is held, not stable: it has no single value to keep still",
44412
+ path: ["for", "mode"]
44413
+ });
44212
44414
  });
44213
44415
  var AutomationWhenSchema = lazy(() => discriminatedUnion("kind", [
44214
44416
  object({
@@ -44232,7 +44434,9 @@ var AutomationWhenSchema = lazy(() => discriminatedUnion("kind", [
44232
44434
  StationaryLeafSchema,
44233
44435
  DeviceIsLeafSchema,
44234
44436
  StationaryPresentLeafSchema,
44235
- ExpressionLeafSchema
44437
+ ExpressionLeafSchema,
44438
+ TimeIsLeafSchema,
44439
+ TriggeredByLeafSchema
44236
44440
  ]));
44237
44441
  var EVENT_KINDS = new Set([
44238
44442
  "device-becomes",
@@ -44286,6 +44490,28 @@ function hasEventLeaves(node) {
44286
44490
  });
44287
44491
  return found;
44288
44492
  }
44493
+ /** The event leaves of the tree that carry an id, in tree order. */
44494
+ function identifiedEventLeaves(when) {
44495
+ const found = [];
44496
+ forEachLeaf(when, (leaf, path) => {
44497
+ if (isEventLeaf(leaf) && leaf.id !== void 0) found.push({
44498
+ id: leaf.id,
44499
+ path,
44500
+ leaf
44501
+ });
44502
+ });
44503
+ return found;
44504
+ }
44505
+ /** Does the tree hold a `triggered-by` leaf? */
44506
+ function hasTriggeredByLeaves(when) {
44507
+ let found = false;
44508
+ forEachLeaf(when, (leaf) => {
44509
+ if (leaf.kind === "triggered-by") found = true;
44510
+ });
44511
+ return found;
44512
+ }
44513
+ /** Why a `triggered-by` leaf is refused outside an automation: there is no trigger row to name. */
44514
+ 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";
44289
44515
  function hasEmptyContainer(node) {
44290
44516
  if (isLeaf(node)) return false;
44291
44517
  if (node.kind === "not") return hasEmptyContainer(node.child);
@@ -44344,6 +44570,11 @@ function validateWhenTree(when) {
44344
44570
  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`;
44345
44571
  const leaves = countWhenLeaves(when);
44346
44572
  if (leaves > 32) return `the rules use ${leaves} rows — the limit is 32`;
44573
+ const seen = /* @__PURE__ */ new Set();
44574
+ for (const entry of identifiedEventLeaves(when)) {
44575
+ if (seen.has(entry.id)) return `two trigger rows share the id "${entry.id}" — an id names one row`;
44576
+ seen.add(entry.id);
44577
+ }
44347
44578
  const need = eventNeed(when, "when", false);
44348
44579
  if ("error" in need) return need.error;
44349
44580
  const [first, second] = need.paths;
@@ -44634,7 +44865,18 @@ var GuardedCapStepSchema = AutomationCapStepBaseSchema.extend(stepGuardShape).re
44634
44865
  message: "a domain target needs the vocabulary action it applies to (actionId)",
44635
44866
  path: ["actionId"]
44636
44867
  }).refine((step) => step.else === void 0 || step.if !== void 0, elseNeedsIf);
44637
- var ActionStepSchema = discriminatedUnion("kind", [GuardedWaitStepSchema, GuardedCapStepSchema]);
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, GuardedCapStepSchema]).superRefine((step, ctx) => {
44874
+ if (step.if !== void 0 && hasTriggeredByLeaves(step.if)) ctx.addIssue({
44875
+ code: "custom",
44876
+ message: TRIGGERED_BY_NEEDS_AUTOMATION,
44877
+ path: ["if"]
44878
+ });
44879
+ });
44638
44880
  var AutomationActionSchema = discriminatedUnion("kind", [
44639
44881
  GuardedWaitStepSchema,
44640
44882
  GuardedCapStepSchema,
@@ -44731,6 +44973,11 @@ var STATIONARY_DESCRIPTIONS = {
44731
44973
  phase: "appeared or departed",
44732
44974
  entryId: "the stopped object"
44733
44975
  };
44976
+ var BECOMES_DESCRIPTIONS = {
44977
+ deviceId: "the device that changed",
44978
+ from: "the value before the change, empty when it is not known",
44979
+ to: "the value it changed to"
44980
+ };
44734
44981
  function describe$1(descriptions) {
44735
44982
  return Object.entries(descriptions).map(([name, description]) => ({
44736
44983
  name,
@@ -44739,6 +44986,10 @@ function describe$1(descriptions) {
44739
44986
  }
44740
44987
  describe$1(DETECTION_DESCRIPTIONS);
44741
44988
  describe$1(STATIONARY_DESCRIPTIONS);
44989
+ describe$1(BECOMES_DESCRIPTIONS).map((v) => v.name === "deviceId" ? {
44990
+ ...v,
44991
+ hintKey: "becomesDeviceId"
44992
+ } : v);
44742
44993
  new Set(Object.values(COCO_TO_MACRO.mapping));
44743
44994
  /**
44744
44995
  * Schedulers (D983) — an entity that performs actions over the day.
@@ -44763,6 +45014,13 @@ var SchedulerStateTreeSchema = AutomationWhenSchema.superRefine((when, ctx) => {
44763
45014
  });
44764
45015
  return;
44765
45016
  }
45017
+ if (hasTriggeredByLeaves(when)) {
45018
+ ctx.addIssue({
45019
+ code: "custom",
45020
+ message: TRIGGERED_BY_NEEDS_AUTOMATION
45021
+ });
45022
+ return;
45023
+ }
44766
45024
  const problem = validateWhenTree(when);
44767
45025
  if (problem !== null) ctx.addIssue({
44768
45026
  code: "custom",
@@ -44968,7 +45226,9 @@ var AutomationTriggerTraceSchema = object({
44968
45226
  /** Why an event was rejected ("class person not in [dog]") or what fired. */
44969
45227
  reason: string(),
44970
45228
  /** deviceId, className, trackId, score … — only what the trigger exposes. */
44971
- vars: record(string(), TraceValueSchema)
45229
+ vars: record(string(), TraceValueSchema),
45230
+ /** A hold (`for`) this occurrence went through: pending, cancelled, fired or re-seeded. */
45231
+ hold: HoldTraceSchema.optional()
44972
45232
  });
44973
45233
  var AutomationConditionTraceNodeSchema = object({
44974
45234
  /** `when` for the root, `when.<i>` for its i-th child, … (`conditions…` on an old trace). */
@@ -44981,6 +45241,8 @@ var AutomationConditionTraceNodeSchema = object({
44981
45241
  "device-is",
44982
45242
  "expression",
44983
45243
  "stationary-present",
45244
+ "time-is",
45245
+ "triggered-by",
44984
45246
  "device-becomes",
44985
45247
  "device-event",
44986
45248
  "schedule",
@@ -45314,7 +45576,7 @@ object({
45314
45576
  * is irrelevant; the array is treated as a set by consumers. */
45315
45577
  hiddenChildIds: array(number$1()).readonly()
45316
45578
  });
45317
- DeviceType.Camera, DeviceType.Hub, DeviceType.Switch, DeviceType.Light, DeviceType.Sensor, DeviceType.Thermostat, DeviceType.Cover, DeviceType.Lock, DeviceType.Fan, DeviceType.MediaPlayer, DeviceType.AlarmPanel, DeviceType.Generic, method(object({
45579
+ DeviceType.Camera, DeviceType.Switch, DeviceType.Light, DeviceType.Sensor, DeviceType.Climate, DeviceType.Cover, DeviceType.Lock, DeviceType.Fan, DeviceType.MediaPlayer, DeviceType.AlarmPanel, DeviceType.Generic, method(object({
45318
45580
  deviceId: number$1().int().nonnegative(),
45319
45581
  childDeviceId: number$1().int().nonnegative(),
45320
45582
  hidden: boolean()
@@ -47612,7 +47874,7 @@ var BATTERY_DEVICE_TYPES = [
47612
47874
  DeviceType.Switch,
47613
47875
  DeviceType.PetFeeder,
47614
47876
  DeviceType.Container,
47615
- DeviceType.Thermostat,
47877
+ DeviceType.Climate,
47616
47878
  DeviceType.EventEmitter
47617
47879
  ];
47618
47880
  /** Generic Customize target for the percentage reading (D936). */
@@ -49375,7 +49637,14 @@ var climateControlCapability = {
49375
49637
  scope: "device",
49376
49638
  deviceNative: true,
49377
49639
  mode: "singleton",
49378
- deviceTypes: [DeviceType.Thermostat, DeviceType.Climate],
49640
+ deviceTypes: [DeviceType.Climate],
49641
+ power: {
49642
+ kind: "mode",
49643
+ field: "mode",
49644
+ offValue: "off",
49645
+ set: "setMode",
49646
+ lastField: "lastActiveMode"
49647
+ },
49379
49648
  methods: {
49380
49649
  setMode: method(object({
49381
49650
  deviceId: number$1().int().nonnegative(),
@@ -49485,6 +49754,140 @@ var climateControlCapability = {
49485
49754
  } }
49486
49755
  };
49487
49756
  /**
49757
+ * cluster-update — the ONE flow that brings the whole cluster to a release
49758
+ * (planning#493). Hub-provided (`server-provided`), hub-only: the hub runs
49759
+ * the sequence itself, so the admin UI, the MCP and the CLI all start the same
49760
+ * job and read the same report instead of each driving their own loop.
49761
+ *
49762
+ * 1. backup (`backup.trigger`) — skipped only when the caller says so
49763
+ * 2. the hub's server closure (`applyServerUpdate`); the hub restarts and the
49764
+ * job RESUMES on the new boot, verified against the hub's running version
49765
+ * 3. every online agent behind the target, one at a time, verified: runs the
49766
+ * target, settled, online, and its capabilities registered (D848) — an
49767
+ * agent that comes back capless is a FAILED step, never a done one
49768
+ * 4. every stale addon on the hub (`addons.updatePackage`); agents follow by
49769
+ * reconciliation, which is verified, never pushed
49770
+ *
49771
+ * The job stops on the first failed step with a typed reason (D877). Its state
49772
+ * is durable on the hub and read by RPC (`getClusterUpdateJob`) — events are
49773
+ * telemetry and never carry it (D8, D11).
49774
+ */
49775
+ /** The steps, in the order they run. */
49776
+ var ClusterUpdateStepKindSchema = _enum([
49777
+ "backup",
49778
+ "hub-server",
49779
+ "agent-server",
49780
+ "addons"
49781
+ ]);
49782
+ /**
49783
+ * - `pending` — not reached yet.
49784
+ * - `running` — in progress (for `hub-server`: possibly across the restart).
49785
+ * - `ok` — done AND verified.
49786
+ * - `failed` — did not land; `reason` + `detail` say why. Stops the job.
49787
+ * - `skipped` — not run: nothing to do, opted out, the node is offline, or a
49788
+ * step before it failed. `detail` says which.
49789
+ */
49790
+ var ClusterUpdateStepStatusSchema = _enum([
49791
+ "pending",
49792
+ "running",
49793
+ "ok",
49794
+ "failed",
49795
+ "skipped"
49796
+ ]);
49797
+ /**
49798
+ * Why a step (and with it the job) failed. Stable, greppable; `detail` carries
49799
+ * the prose.
49800
+ */
49801
+ var ClusterUpdateFailureReasonSchema = _enum([
49802
+ "backup-unavailable",
49803
+ "backup-failed",
49804
+ "server-refused",
49805
+ "server-not-on-target",
49806
+ "node-capless",
49807
+ "status-unreadable",
49808
+ "addon-update-failed",
49809
+ "addons-not-converged",
49810
+ "interrupted"
49811
+ ]);
49812
+ var ClusterUpdateStepSchema = object({
49813
+ kind: ClusterUpdateStepKindSchema,
49814
+ /** The node the step acts on; absent for `backup` and `addons`. */
49815
+ nodeId: string().optional(),
49816
+ status: ClusterUpdateStepStatusSchema,
49817
+ /** One line for the operator: what happened, or why not. */
49818
+ detail: string(),
49819
+ reason: ClusterUpdateFailureReasonSchema.optional(),
49820
+ /** `hub-server` / `agent-server`: the version the node ran before. */
49821
+ fromVersion: string().nullable().optional(),
49822
+ /** `addons`: the packages this step updates, `name from -> to`. */
49823
+ packages: array(string()).readonly().optional(),
49824
+ startedAt: number$1().optional(),
49825
+ finishedAt: number$1().optional()
49826
+ });
49827
+ var ClusterUpdateJobStateSchema = _enum([
49828
+ "running",
49829
+ "succeeded",
49830
+ "failed"
49831
+ ]);
49832
+ var ClusterUpdateJobSchema = object({
49833
+ id: string(),
49834
+ state: ClusterUpdateJobStateSchema,
49835
+ /** The server version every node is brought to. */
49836
+ targetVersion: string(),
49837
+ /** Who started it (the user name, or `system`). */
49838
+ requestedBy: string(),
49839
+ startedAt: number$1(),
49840
+ finishedAt: number$1().optional(),
49841
+ /** Every step, in run order; later steps stay `pending` while it runs. */
49842
+ steps: array(ClusterUpdateStepSchema).readonly(),
49843
+ /** On `failed`: the step that stopped it (`nodeId` or the step kind). */
49844
+ stoppedAt: string().optional(),
49845
+ reason: ClusterUpdateFailureReasonSchema.optional(),
49846
+ /** Agents offline when the plan was read: never touched. */
49847
+ skippedOffline: array(string()).readonly()
49848
+ });
49849
+ var ClusterUpdateOptionsSchema = object({
49850
+ /** Explicit server target; omitted = the hub's latest registry check. */
49851
+ version: string().optional(),
49852
+ /** Update the addons too (default true). */
49853
+ addons: boolean().optional(),
49854
+ /**
49855
+ * Back up before touching anything (default true). `false` is an explicit
49856
+ * operator opt-out; a missing backup provider is otherwise a failure.
49857
+ */
49858
+ backup: boolean().optional()
49859
+ });
49860
+ /** Why a plan cannot start. */
49861
+ var ClusterUpdateBlockerSchema = _enum([
49862
+ "no-target",
49863
+ "node-busy",
49864
+ "job-running",
49865
+ "nothing-to-do",
49866
+ "status-unreadable"
49867
+ ]);
49868
+ var ClusterUpdatePlanSchema = object({
49869
+ /** `null` when no target could be resolved (`blocker: 'no-target'`). */
49870
+ targetVersion: string().nullable(),
49871
+ /** The steps the job WOULD run, all `pending` (or `skipped` with a reason). */
49872
+ steps: array(ClusterUpdateStepSchema).readonly(),
49873
+ skippedOffline: array(string()).readonly(),
49874
+ /** `null` = the plan can start. */
49875
+ blocker: ClusterUpdateBlockerSchema.nullable(),
49876
+ /** Prose for `blocker`. */
49877
+ blockerDetail: string().nullable()
49878
+ });
49879
+ var StartClusterUpdateResultSchema = object({
49880
+ accepted: boolean(),
49881
+ /** The job to follow with `getClusterUpdateJob`; `null` when refused. */
49882
+ jobId: string().nullable(),
49883
+ blocker: ClusterUpdateBlockerSchema.nullable(),
49884
+ message: string()
49885
+ });
49886
+ method(ClusterUpdateOptionsSchema, ClusterUpdatePlanSchema, { auth: "admin" }), method(ClusterUpdateOptionsSchema, StartClusterUpdateResultSchema, {
49887
+ kind: "mutation",
49888
+ auth: "admin"
49889
+ }), method(object({ jobId: string().optional() }), ClusterUpdateJobSchema.nullable(), { auth: "admin" });
49890
+ /**
49488
49891
  * Color-light cap. Coexists with `switch` (on/off) and `brightness`
49489
49892
  * (level) on the same device — `switch` toggles the bulb, `brightness`
49490
49893
  * sets the dim level, this cap sets the chromaticity.
@@ -49626,6 +50029,7 @@ var CompositionProblemSchema = object({
49626
50029
  "nested-field",
49627
50030
  "missing-field",
49628
50031
  "kind-mismatch",
50032
+ "source-kind-mismatch",
49629
50033
  "may-be-null",
49630
50034
  "source-missing",
49631
50035
  "source-unreadable",
@@ -49647,7 +50051,8 @@ var CompositionProblemSchema = object({
49647
50051
  "command-method-unknown",
49648
50052
  "command-source-unknown",
49649
50053
  "command-input-unknown",
49650
- "command-input-missing"
50054
+ "command-input-missing",
50055
+ "power-source-is-actuator"
49651
50056
  ]),
49652
50057
  path: string(),
49653
50058
  message: string()
@@ -50685,6 +51090,13 @@ var mediaPlayerCapability = {
50685
51090
  deviceNative: true,
50686
51091
  mode: "singleton",
50687
51092
  deviceTypes: [DeviceType.MediaPlayer],
51093
+ power: {
51094
+ kind: "methods",
51095
+ field: "state",
51096
+ offValues: ["off", "standby"],
51097
+ on: "turnOn",
51098
+ off: "turnOff"
51099
+ },
50688
51100
  methods: {
50689
51101
  turnOn: optionalMethod(deviceOnly, _void(), {
50690
51102
  kind: "mutation",
@@ -50815,7 +51227,7 @@ var mediaPlayerCapability = {
50815
51227
  isMuted: { kind: "boolean" }
50816
51228
  } }
50817
51229
  };
50818
- DeviceType.Camera, DeviceType.Sensor, DeviceType.Button, DeviceType.Switch, DeviceType.PetFeeder, DeviceType.Container, DeviceType.Thermostat, DeviceType.EventEmitter, DeviceType.Camera, DeviceType.Hub, DeviceType.Light, DeviceType.Siren, DeviceType.Switch, DeviceType.Sensor, DeviceType.Thermostat, 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.Heater, DeviceType.Dryer, DeviceType.Gateway, DeviceType.HeatPump, DeviceType.Camera, DeviceType.Fan, DeviceType.Lock, DeviceType.Camera, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Heater, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Heater, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Heater, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Heater, DeviceType.Gateway, DeviceType.Hub, DeviceType.Camera, DeviceType.Sensor, DeviceType.MediaPlayer, DeviceType.Vacuum, DeviceType.Generic, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.PetFountain, DeviceType.Fan, DeviceType.Humidifier, DeviceType.Climate, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.MediaPlayer, DeviceType.WaterHeater, DeviceType.Humidifier, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.PetFeeder, DeviceType.Heater, DeviceType.MediaPlayer;
51230
+ 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;
50819
51231
  var NUMBER = {
50820
51232
  kind: "fixed",
50821
51233
  result: ["number"]
@@ -50898,7 +51310,7 @@ function numeric(input) {
50898
51310
  }, ...alsoFrom === void 0 ? [] : [alsoFrom.accept]]
50899
51311
  };
50900
51312
  }
50901
- var CLIMATE_DEVICES = [DeviceType.Thermostat, DeviceType.Climate];
51313
+ var CLIMATE_DEVICES = [DeviceType.Climate];
50902
51314
  function binary(input) {
50903
51315
  return {
50904
51316
  ...input,
@@ -51220,8 +51632,8 @@ var GROUP_TEMPLATES = [
51220
51632
  actuator({
51221
51633
  id: "climate",
51222
51634
  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.",
51223
- deviceType: DeviceType.Thermostat,
51224
- memberDeviceTypes: [DeviceType.Thermostat, DeviceType.Climate],
51635
+ deviceType: DeviceType.Climate,
51636
+ memberDeviceTypes: [DeviceType.Climate],
51225
51637
  outputCap: "group-active",
51226
51638
  outputField: "active",
51227
51639
  member: {
@@ -51264,6 +51676,118 @@ function actuator(input) {
51264
51676
  new Map(GROUP_TEMPLATES.map((template) => [template.id, template]));
51265
51677
  DeviceFeature.LightColorRgb, DeviceFeature.LightColorHsv, DeviceFeature.LightColorMired;
51266
51678
  DeviceType.Camera;
51679
+ var PowerSourceRefusalReasonSchema = _enum([
51680
+ "no-power-source",
51681
+ "switch-missing",
51682
+ "switch-offline",
51683
+ "switch-unknown",
51684
+ "restart-in-progress",
51685
+ "switch-call-failed",
51686
+ "switch-is-actuator"
51687
+ ]);
51688
+ var PowerSourceActionResultSchema = discriminatedUnion("accepted", [object({ accepted: literal(true) }), object({
51689
+ accepted: literal(false),
51690
+ reason: PowerSourceRefusalReasonSchema,
51691
+ /** One line for the operator, naming the switch. */
51692
+ message: string()
51693
+ })]);
51694
+ var PowerSourceInfoSchema = object({
51695
+ /** False when the device has no power source linked; the rest is then empty. */
51696
+ linked: boolean(),
51697
+ switchDeviceId: number$1().nullable(),
51698
+ switchName: string().nullable(),
51699
+ /** The switch's on/off state, or null when it is unknown. Never false for unknown (D393). */
51700
+ switchOn: boolean().nullable(),
51701
+ switchOnline: boolean().nullable(),
51702
+ restartInProgress: boolean(),
51703
+ offSeconds: number$1().int()
51704
+ });
51705
+ /** The composed slice: the switch state the link mirrors, plus the stored off time. */
51706
+ var PowerSourceStateSchema = object({
51707
+ /** Null while the switch has not reported: unknown is never `false` (D393). */
51708
+ switchOn: boolean().nullable(),
51709
+ offSeconds: number$1().int(),
51710
+ lastFetchedAt: number$1()
51711
+ });
51712
+ var POWER_SOURCE_DEVICE_TYPES = [
51713
+ DeviceType.Gateway,
51714
+ DeviceType.Camera,
51715
+ DeviceType.Sensor,
51716
+ DeviceType.MediaPlayer,
51717
+ DeviceType.Vacuum,
51718
+ DeviceType.Generic,
51719
+ DeviceType.Washer,
51720
+ DeviceType.Dryer,
51721
+ DeviceType.Dishwasher,
51722
+ DeviceType.PetFountain,
51723
+ DeviceType.Fan,
51724
+ DeviceType.Humidifier,
51725
+ DeviceType.Climate,
51726
+ DeviceType.WaterHeater
51727
+ ];
51728
+ var powerSourceCustomize = {
51729
+ version: 1,
51730
+ targets: [{
51731
+ id: "switch",
51732
+ cardinality: "scalar",
51733
+ vocabulary: {
51734
+ cap: "power-source",
51735
+ stateField: "switchOn"
51736
+ },
51737
+ deviceTypes: POWER_SOURCE_DEVICE_TYPES,
51738
+ apply: "add",
51739
+ path: "switchOn",
51740
+ sources: [{
51741
+ kind: "switch",
51742
+ transforms: [{ kind: "identity" }]
51743
+ }],
51744
+ companions: [{
51745
+ kind: "constant",
51746
+ path: "offSeconds",
51747
+ value: 10,
51748
+ when: "add",
51749
+ formerValues: [0]
51750
+ }, {
51751
+ kind: "clock",
51752
+ path: "lastFetchedAt",
51753
+ when: "always"
51754
+ }],
51755
+ sourceReport: { status: "assignment-status" }
51756
+ }]
51757
+ };
51758
+ var deviceInput$2 = object({ deviceId: number$1().int().nonnegative() });
51759
+ var powerSourceCapability = {
51760
+ name: "power-source",
51761
+ scope: "device",
51762
+ mode: "singleton",
51763
+ deviceTypes: POWER_SOURCE_DEVICE_TYPES,
51764
+ methods: {
51765
+ getStatus: systemMethod(deviceInput$2, PowerSourceInfoSchema, { auth: "protected" }),
51766
+ powerOn: systemMethod(deviceInput$2, PowerSourceActionResultSchema, {
51767
+ kind: "mutation",
51768
+ auth: "protected"
51769
+ }),
51770
+ powerOff: systemMethod(deviceInput$2, PowerSourceActionResultSchema, {
51771
+ kind: "mutation",
51772
+ auth: "protected"
51773
+ }),
51774
+ forceRestart: systemMethod(deviceInput$2, PowerSourceActionResultSchema, {
51775
+ kind: "mutation",
51776
+ auth: "protected"
51777
+ })
51778
+ },
51779
+ runtimeState: PowerSourceStateSchema,
51780
+ customize: powerSourceCustomize,
51781
+ /**
51782
+ * Runtime-state durability: **session** — mirrored from the linked switch on
51783
+ * its next report; a restored value would outlive the reading it names.
51784
+ *
51785
+ * See `RuntimeStateDurability`. Enforced by
51786
+ * `scripts/check-runtime-state-durability.ts`.
51787
+ */
51788
+ durability: "session",
51789
+ history: "none"
51790
+ };
51267
51791
  `${COMPOSED_DEVICE_STABLE_ID_PREFIX}`;
51268
51792
  /**
51269
51793
  * What a composition may BUILD on a device type (G2, D676): the caps a new
@@ -52308,27 +52832,35 @@ var deviceAdminLinkCapability = {
52308
52832
  getAdminLink: method(object({ deviceId: number$1().int().nonnegative() }), DeviceAdminLinkSchema.nullable(), { auth: "admin" }) }
52309
52833
  };
52310
52834
  /**
52311
- * device-discovery — device-scoped capability for parents that host /
52312
- * enumerate child devices (Reolink Hub / NVR, ONVIF gateway, future
52313
- * integrations). The parent advertises a list of discoverable children,
52314
- * and the operator promotes a subset to real devices via `adoptDevice`.
52315
- * Child lifecycle (kernel device create/remove, parent reference) is
52316
- * owned by the framework so a single shared `<DiscoveryPanel />` can
52317
- * drive any integration.
52318
- *
52319
- * Boundaries:
52320
- * - The cap exposes ENUMERATION + ADOPT/RELEASE only. The protocol
52321
- * used to discover children (CGI poll, mDNS, push from hub, ...)
52322
- * is the integration's business; results land in `runtimeState`
52323
- * so the panel can render without a fresh round-trip.
52324
- * - `childNativeId` is integration-defined and must be stable across
52325
- * reboots so re-discovery doesn't duplicate adopted children.
52326
- * - `adoptDevice` returns the new `deviceId` so the UI can navigate
52327
- * directly to the freshly-created child's settings page.
52328
- */
52329
- /**
52330
- * Status enum for a discovered device. Mirrors the Reolink simpleEvent
52331
- * lifecycle (`online` / `sleeping` / `offline`) — generic enough for
52835
+ * `device-adoption` — generic discovery + adoption surface,
52836
+ * system-scoped collection (one provider per integration addon), routed
52837
+ * by explicit `{ addonId }` on direct `deviceAdoption.*` calls — the same
52838
+ * pin model as `connection-test`. The admin UI keeps using
52839
+ * `deviceManager.adoption*` (which already threads `addonId`). The de-HA-ified
52840
+ * successor to `ha-discovery`:
52841
+ * keyed by `integrationId` (the addon resolves integrationId → broker
52842
+ * internally) rather than a connection-specific `brokerId`, and it
52843
+ * OWNS the shared `DiscoveredChildDevice` candidate type
52844
+ * (declared below) so a single shared adoption modal renders any integration's
52845
+ * candidate tree.
52846
+ *
52847
+ * UI flow (Integrations page → integration detail):
52848
+ * 1. `listCandidates({integrationId, page, pageSize, filter})` →
52849
+ * paginated candidate list, each row collapsed.
52850
+ * 2. User expands a row → `getCandidate({integrationId,
52851
+ * childNativeId})` returns the single candidate (with its nested
52852
+ * `children`) for the accordion render.
52853
+ * 3. User clicks "Adopt" on one or more candidates →
52854
+ * `adopt({integrationId, childNativeIds, perCandidate?})`
52855
+ * materialises one parent CamStack device per candidate plus its
52856
+ * accessory children. `perCandidate[childNativeId]` carries an
52857
+ * optional display-name override + a `hiddenChildIds` pre-hide set
52858
+ * (the parent's `accessories.hiddenChildIds` gates UI visibility).
52859
+ * 4. User clicks "Release" → `release({integrationId, camDeviceId})`
52860
+ * removes the parent + every child from the kernel registry.
52861
+ */
52862
+ /**
52863
+ * Status enum for a discovered device. Generic enough for
52332
52864
  * battery cams, awake cams, and unreachable cams alike.
52333
52865
  */
52334
52866
  var DiscoveredChildStatusSchema = _enum([
@@ -52345,12 +52877,12 @@ var DiscoveredChildDeviceSchema = lazy(() => object({
52345
52877
  /** DeviceType the child should be created with on adopt. */
52346
52878
  type: _enum(DeviceType),
52347
52879
  status: DiscoveredChildStatusSchema,
52348
- /** Free-form integration-specific metadata surfaced in the panel. */
52880
+ /** Free-form integration-specific metadata surfaced in the adoption modal. */
52349
52881
  metadata: object({
52350
52882
  model: string().optional(),
52351
52883
  serialNumber: string().optional(),
52352
52884
  uid: string().optional(),
52353
- /** Reolink: 0-based channel index inside the parent NVR/Hub. */
52885
+ /** Reolink: 0-based channel index inside the parent NVR. */
52354
52886
  rtspChannel: number$1().int().nonnegative().optional(),
52355
52887
  isBattery: boolean().optional(),
52356
52888
  isDoorbell: boolean().optional(),
@@ -52366,137 +52898,24 @@ var DiscoveredChildDeviceSchema = lazy(() => object({
52366
52898
  }).default({}),
52367
52899
  /**
52368
52900
  * `true` when the framework already created a child device for this
52369
- * `childNativeId` under the current parent. The panel uses it to
52901
+ * `childNativeId` under the current parent. The adoption modal uses it to
52370
52902
  * gate the Add/Remove button and surface the existing `deviceId`.
52371
52903
  */
52372
52904
  alreadyAdopted: boolean(),
52373
52905
  /** When `alreadyAdopted=true`, the framework-assigned child device id. */
52374
52906
  adoptedDeviceId: number$1().int().nonnegative().nullable(),
52375
- /** Capability names the candidate advertises — integrations populate, Hubs omit. */
52907
+ /** Capability names the candidate advertises — integrations populate, flat enumerations omit. */
52376
52908
  capabilities: array(string()).readonly().optional(),
52377
- /** Feature flags the candidate advertises — integrations populate, Hubs omit. */
52909
+ /** Feature flags the candidate advertises — integrations populate, flat enumerations omit. */
52378
52910
  features: array(string()).readonly().optional(),
52379
52911
  /** Upstream-system identity + rendering hints for the candidate. */
52380
52912
  sourceInfo: SourceInfoSchema.optional(),
52381
- /** Nested entity-children for accordion preview — integrations populate, Hubs omit. */
52913
+ /** Nested entity-children for accordion preview — integrations populate, flat enumerations omit. */
52382
52914
  children: array(DiscoveredChildDeviceSchema).readonly().optional(),
52383
52915
  /** `childNativeId` of the gateway candidate in the same list this device sits behind. */
52384
52916
  parentStableId: string().optional()
52385
52917
  }));
52386
52918
  /**
52387
- * Status block — populated by the integration after each
52388
- * `refreshDiscovery` (or push-driven update). The runtime-state slice
52389
- * is what the panel reads via the per-device proxy; `getStatus`
52390
- * returns the same payload via the codegen'd auto-injection.
52391
- */
52392
- var DeviceDiscoveryStatusSchema = object({
52393
- discovered: array(DiscoveredChildDeviceSchema),
52394
- /** Wall-clock ms of the last successful enumeration. */
52395
- lastDiscoveryAt: number$1().int().nonnegative().nullable(),
52396
- /** Last error surfaced from the source (rendered as a banner). */
52397
- lastError: string().nullable()
52398
- });
52399
- var deviceDiscoveryCapability = {
52400
- name: "device-discovery",
52401
- scope: "device",
52402
- deviceNative: true,
52403
- mode: "singleton",
52404
- deviceTypes: [DeviceType.Hub],
52405
- status: {
52406
- schema: DeviceDiscoveryStatusSchema,
52407
- kind: "poll"
52408
- },
52409
- runtimeState: DeviceDiscoveryStatusSchema.extend({ lastFetchedAt: number$1().int().nonnegative() }),
52410
- /**
52411
- * Runtime-state durability: **session** — 5.7 KB of scan output on the largest device, fully re-derivable by re-scanning.
52412
- *
52413
- * See `RuntimeStateDurability`. Enforced by
52414
- * `scripts/check-runtime-state-durability.ts`.
52415
- */
52416
- durability: "session",
52417
- /**
52418
- * History (D850): none — inventory.
52419
- */
52420
- history: "none",
52421
- methods: {
52422
- /**
52423
- * Snapshot of the current `discovered` list. Returns the
52424
- * runtime-state cache — call `refreshDiscovery` first if a
52425
- * fresh round-trip to the source is required.
52426
- */
52427
- listDiscovered: method(object({ deviceId: number$1().int().nonnegative() }), array(DiscoveredChildDeviceSchema).readonly()),
52428
- /**
52429
- * Force the integration to re-enumerate and update the
52430
- * runtime-state slice. Returns the freshly-enumerated list (also
52431
- * available via `listDiscovered` post-call).
52432
- */
52433
- refreshDiscovery: method(object({ deviceId: number$1().int().nonnegative() }), array(DiscoveredChildDeviceSchema).readonly(), {
52434
- kind: "mutation",
52435
- auth: "admin"
52436
- }),
52437
- /**
52438
- * Promote a discovered entry to a real child device. The framework
52439
- * creates the child via `kernel.devices.create()` with
52440
- * `parentDeviceId = parent.id` and seeds the child's config from
52441
- * `childInitialConfig` (driver-defined; usually carries channel +
52442
- * uid + parent reference). Returns the kernel-assigned numeric id.
52443
- */
52444
- adoptDevice: method(object({
52445
- deviceId: number$1().int().nonnegative(),
52446
- childNativeId: string(),
52447
- /** Optional override for the child's display name. */
52448
- name: string().optional()
52449
- }), object({
52450
- deviceId: number$1().int().nonnegative(),
52451
- stableId: string()
52452
- }), {
52453
- kind: "mutation",
52454
- auth: "admin"
52455
- }),
52456
- /**
52457
- * Inverse of `adoptDevice`: removes the child device from the
52458
- * kernel registry. The discovered entry remains in the
52459
- * enumeration (status updates resume) so the operator can re-adopt
52460
- * it later without a fresh refresh.
52461
- */
52462
- releaseDevice: method(object({
52463
- deviceId: number$1().int().nonnegative(),
52464
- childDeviceId: number$1().int().nonnegative()
52465
- }), _void(), {
52466
- kind: "mutation",
52467
- auth: "admin"
52468
- })
52469
- }
52470
- };
52471
- /**
52472
- * `device-adoption` — generic discovery + adoption surface,
52473
- * system-scoped collection (one provider per integration addon), routed
52474
- * by explicit `{ addonId }` on direct `deviceAdoption.*` calls — the same
52475
- * pin model as `connection-test`. The admin UI keeps using
52476
- * `deviceManager.adoption*` (which already threads `addonId`). The de-HA-ified
52477
- * successor to `ha-discovery`:
52478
- * keyed by `integrationId` (the addon resolves integrationId → broker
52479
- * internally) rather than a connection-specific `brokerId`, and it
52480
- * REUSES the shared `DiscoveredChildDevice` candidate type from
52481
- * `device-discovery.cap.ts` so a single shared adoption panel renders
52482
- * any integration's candidate tree.
52483
- *
52484
- * UI flow (Integrations page → integration detail):
52485
- * 1. `listCandidates({integrationId, page, pageSize, filter})` →
52486
- * paginated candidate list, each row collapsed.
52487
- * 2. User expands a row → `getCandidate({integrationId,
52488
- * childNativeId})` returns the single candidate (with its nested
52489
- * `children`) for the accordion render.
52490
- * 3. User clicks "Adopt" on one or more candidates →
52491
- * `adopt({integrationId, childNativeIds, perCandidate?})`
52492
- * materialises one parent CamStack device per candidate plus its
52493
- * accessory children. `perCandidate[childNativeId]` carries an
52494
- * optional display-name override + a `hiddenChildIds` pre-hide set
52495
- * (the parent's `accessories.hiddenChildIds` gates UI visibility).
52496
- * 4. User clicks "Release" → `release({integrationId, camDeviceId})`
52497
- * removes the parent + every child from the kernel registry.
52498
- */
52499
- /**
52500
52919
  * Provider-declared discovery *granularity* filter (the keystone of the
52501
52920
  * single-entity-import design). A provider advertises which discovery
52502
52921
  * granularities it supports via `listCandidateFilters`; the operator picks
@@ -52957,6 +53376,90 @@ var SiteZoneSchema = object({
52957
53376
  * the ones that most want grouping. */
52958
53377
  locationKeys: array(string())
52959
53378
  });
53379
+ var DeviceSearchRequiresSchema = object({
53380
+ /** Capability names the field wants a value of. */
53381
+ caps: array(string()).readonly(),
53382
+ /** `any` (default): a device with one of them is compatible. `all`: it must hold every one. */
53383
+ mode: _enum(["any", "all"]).optional()
53384
+ });
53385
+ var DeviceSearchFiltersSchema = object({
53386
+ locations: array(string()).readonly().optional(),
53387
+ integrationIds: array(string()).readonly().optional(),
53388
+ types: array(string()).readonly().optional()
53389
+ });
53390
+ var DeviceSearchInputSchema = object({
53391
+ /** Matches name, location, type, integration (id and label) and id. Case-insensitive. */
53392
+ text: string().optional(),
53393
+ requires: DeviceSearchRequiresSchema.optional(),
53394
+ filters: DeviceSearchFiltersSchema.optional(),
53395
+ /** List the devices that do not provide the required cap too (greyed, not pickable). */
53396
+ includeIncompatible: boolean().optional(),
53397
+ /** The device the field belongs to: its location drives `suggested`. */
53398
+ contextDeviceId: number$1().optional(),
53399
+ /**
53400
+ * Resolve exactly these devices, regardless of every filter, so a picked
53401
+ * value can be rendered. When given, `items` is these devices in the order
53402
+ * asked (no paging, `nextCursor` null) and the ones that do not exist are
53403
+ * listed in `missingIds`.
53404
+ */
53405
+ ids: array(number$1()).readonly().optional(),
53406
+ cursor: string().nullable().optional(),
53407
+ limit: number$1().int().min(1).max(200).optional()
53408
+ });
53409
+ var DeviceValueOptionSchema = object({
53410
+ cap: string(),
53411
+ /** Status-schema field path inside the cap (same paths as `getWireableFields`). */
53412
+ path: string(),
53413
+ label: string(),
53414
+ /** The current value as text; `null` when it is unknown or the read FAILED — never `0`. */
53415
+ reading: string().nullable(),
53416
+ unit: string().nullable().optional(),
53417
+ /** The field's measured quantity, when the cap declares one, so a client can format the reading. */
53418
+ quantity: ReadingQuantitySchema.optional()
53419
+ });
53420
+ var DeviceSearchItemSchema = object({
53421
+ id: number$1(),
53422
+ name: string(),
53423
+ type: _enum(DeviceType),
53424
+ location: string().nullable(),
53425
+ integrationId: string().nullable(),
53426
+ integrationLabel: string().nullable(),
53427
+ online: boolean().nullable(),
53428
+ disabled: boolean(),
53429
+ compatible: boolean(),
53430
+ /** Only the required caps' fields; empty when nothing was required or the device is incompatible. */
53431
+ values: array(DeviceValueOptionSchema).readonly()
53432
+ });
53433
+ var DeviceSearchFacetValueSchema = object({
53434
+ value: string(),
53435
+ count: number$1()
53436
+ });
53437
+ var DeviceSearchFacetIntegrationSchema = object({
53438
+ id: string(),
53439
+ label: string(),
53440
+ count: number$1()
53441
+ });
53442
+ var DeviceSearchFacetsSchema = object({
53443
+ locations: array(DeviceSearchFacetValueSchema).readonly(),
53444
+ integrations: array(DeviceSearchFacetIntegrationSchema).readonly(),
53445
+ types: array(DeviceSearchFacetValueSchema).readonly()
53446
+ });
53447
+ var DeviceSearchResultSchema = object({
53448
+ items: array(DeviceSearchItemSchema).readonly(),
53449
+ nextCursor: string().nullable(),
53450
+ /** Devices listed by this query across all pages (filters + text applied; incompatible counted only when `includeIncompatible`). */
53451
+ total: number$1(),
53452
+ /** Compatible devices after filters + text. */
53453
+ compatibleTotal: number$1(),
53454
+ /** Every device the caller's fleet holds, before anything is applied. */
53455
+ fleetTotal: number$1(),
53456
+ /** Incompatible devices after filters + text — the K of "show the K that don't". */
53457
+ hiddenIncompatible: number$1(),
53458
+ facets: DeviceSearchFacetsSchema,
53459
+ /** Same location as `contextDeviceId`; first page only. */
53460
+ suggested: array(DeviceSearchItemSchema).readonly(),
53461
+ missingIds: array(number$1()).readonly()
53462
+ });
52960
53463
  var ProviderStatusSchema = object({
52961
53464
  connected: boolean(),
52962
53465
  deviceCount: number$1(),
@@ -53442,6 +53945,9 @@ var DeviceInfoSchema = object({
53442
53945
  * named accordion sections (with optional intra-section order). See
53443
53946
  * `DeviceMeta.childLayout`. Absent ⇒ no layout declared. */
53444
53947
  childLayout: array(ChildLayoutEntrySchema).readonly().optional(),
53948
+ /** The children a container stands for, most preferred first, by accessory
53949
+ * `childKey`. Provider-declared. See `DeviceMeta.primaryChildPreference`. */
53950
+ primaryChildPreference: array(string()).readonly().optional(),
53445
53951
  /** Operator-authored per-device display override. See `DeviceMeta.display`. */
53446
53952
  display: DeviceDisplayOverrideSchema.optional()
53447
53953
  });
@@ -53590,6 +54096,9 @@ var DeviceMetaSchema = object({
53590
54096
  * accordion sections (with optional intra-section order). See
53591
54097
  * `DeviceMeta.childLayout`. Absent ⇒ no layout declared. */
53592
54098
  childLayout: array(ChildLayoutEntrySchema).readonly().optional(),
54099
+ /** The children a container stands for, most preferred first, by accessory
54100
+ * `childKey`. Provider-declared. See `DeviceMeta.primaryChildPreference`. */
54101
+ primaryChildPreference: array(string()).readonly().optional(),
53593
54102
  /** Semantic role string (`DeviceRole`) — propagated from the spawn pre-seed.
53594
54103
  * Optional: only present for accessory children that carry a known role. */
53595
54104
  role: string().nullable().optional(),
@@ -53805,6 +54314,12 @@ method(object({
53805
54314
  }), _void(), {
53806
54315
  kind: "mutation",
53807
54316
  auth: "admin"
54317
+ }), method(object({
54318
+ deviceId: number$1(),
54319
+ primaryChildPreference: array(string()).readonly()
54320
+ }), _void(), {
54321
+ kind: "mutation",
54322
+ auth: "admin"
53808
54323
  }), method(object({
53809
54324
  deviceId: number$1(),
53810
54325
  display: DeviceDisplayOverrideSchema.nullable()
@@ -53828,8 +54343,14 @@ method(object({
53828
54343
  "string",
53829
54344
  "number",
53830
54345
  "boolean",
53831
- "enum"
54346
+ "enum",
54347
+ "union"
53832
54348
  ]),
54349
+ unionMembers: array(_enum([
54350
+ "string",
54351
+ "number",
54352
+ "boolean"
54353
+ ])).optional(),
53833
54354
  enumValues: array(string()).optional(),
53834
54355
  item: boolean().optional(),
53835
54356
  quantity: ReadingQuantitySchema.optional()
@@ -53942,7 +54463,7 @@ method(object({
53942
54463
  * it answers today and the caller filters as it already does.
53943
54464
  */
53944
54465
  deviceIds: array(number$1()).optional()
53945
- }), array(DeviceInfoSchema), { role: "viewer" }), method(object({ deviceId: number$1() }), DeviceInfoSchema.nullable()), method(object({ parentDeviceId: number$1() }), array(DeviceInfoSchema), { role: "viewer" }), method(object({ parentDeviceIds: array(number$1()).max(256) }), record(string(), array(DeviceInfoSchema))), method(object({ deviceId: number$1() }), object({
54466
+ }), array(DeviceInfoSchema), { role: "viewer" }), method(DeviceSearchInputSchema, DeviceSearchResultSchema, { role: "viewer" }), method(object({ deviceId: number$1() }), DeviceInfoSchema.nullable()), method(object({ parentDeviceId: number$1() }), array(DeviceInfoSchema), { role: "viewer" }), method(object({ parentDeviceIds: array(number$1()).max(256) }), record(string(), array(DeviceInfoSchema))), method(object({ deviceId: number$1() }), object({
53946
54467
  mode: LinkedDevicesModeSchema,
53947
54468
  devices: array(LinkedDeviceSchema)
53948
54469
  }), { role: "viewer" }), method(object({ deviceIds: array(number$1()) }), array(LinkedDevicesForDeviceSchema), { role: "viewer" }), method(object({ deviceId: number$1() }), array(StreamSourceEntrySchema$1)), method(object({ deviceId: number$1() }), array(ConfigEntrySchema)), method(object({ deviceId: number$1() }), ConfigUISchemaOutput), method(object({
@@ -56457,8 +56978,85 @@ method(_void(), array(FailureContributionSchema).readonly());
56457
56978
  * - `FanPreset` — preset selector
56458
56979
  * - `FanDirection` — direction toggle (ceiling fans)
56459
56980
  * - `FanOscillating` — oscillation toggle
56981
+ *
56982
+ * Per-axis oscillation (`oscillationAxes`, `setOscillationAxis`, D1034): an air
56983
+ * circulator sweeps horizontally and vertically, each axis with its own
56984
+ * switch, fixed angle, sweep bounds and limits. A provider may report them
56985
+ * natively; otherwise the OPERATOR links sibling devices to each field in
56986
+ * Customize (a `replace` over the fields listed in `overridable` — nothing is
56987
+ * linked or inferred by itself), and a write to a linked field is forwarded to
56988
+ * its source. `oscillating` stays the single summary flag: when axes exist it
56989
+ * means "any axis oscillates" (`anyAxisOscillating`).
56460
56990
  */
56461
56991
  var FanDirectionSchema = _enum(["forward", "reverse"]);
56992
+ var FAN_OSCILLATION_AXES = ["horizontal", "vertical"];
56993
+ var FanOscillationAxisNameSchema = _enum(FAN_OSCILLATION_AXES);
56994
+ var FanOscillationAxisFieldSchema = _enum([
56995
+ "oscillating",
56996
+ "angle",
56997
+ "sweepFrom",
56998
+ "sweepTo"
56999
+ ]);
57000
+ /** The limits of one axis, read from the source that serves its angle. */
57001
+ var FAN_OSCILLATION_AXIS_LIMITS = [
57002
+ "min",
57003
+ "max",
57004
+ "step"
57005
+ ];
57006
+ /**
57007
+ * One oscillation axis. Every reading the device has not reported is `null`,
57008
+ * never `0` (D393): `0°` is a real position. Each leaf defaults to `null`, so
57009
+ * a slice that names only the leaves it knows (a Customize link of one field)
57010
+ * is still a whole axis.
57011
+ */
57012
+ var FanOscillationAxisSchema = object({
57013
+ /** Whether the axis sweeps. */
57014
+ oscillating: boolean().nullable().default(null),
57015
+ /** The fixed position (degrees) the axis holds when it does not sweep. */
57016
+ angle: number$1().nullable().default(null),
57017
+ /** The sweep bounds (degrees): left → right, bottom → top. */
57018
+ sweepFrom: number$1().nullable().default(null),
57019
+ sweepTo: number$1().nullable().default(null),
57020
+ /** The angles the axis accepts. Null when the device states none. */
57021
+ min: number$1().nullable().default(null),
57022
+ max: number$1().nullable().default(null),
57023
+ step: number$1().nullable().default(null)
57024
+ });
57025
+ /** Both axes; an axis the device does not have is `null`. */
57026
+ var FanOscillationAxesSchema = object({
57027
+ horizontal: FanOscillationAxisSchema.nullable().default(null),
57028
+ vertical: FanOscillationAxisSchema.nullable().default(null)
57029
+ });
57030
+ var FanOscillationAxisRefusalSchema = _enum([
57031
+ "nothing-to-set",
57032
+ "axis-not-linked",
57033
+ "out-of-range",
57034
+ "source-gone",
57035
+ "source-unknown",
57036
+ "source-call-failed"
57037
+ ]);
57038
+ var FanOscillationAxisResultSchema = discriminatedUnion("status", [object({ status: literal("applied") }), object({
57039
+ status: literal("refused"),
57040
+ reason: FanOscillationAxisRefusalSchema,
57041
+ /** The field at fault, when one is. */
57042
+ field: FanOscillationAxisFieldSchema.optional(),
57043
+ /** One line for the operator, naming the axis, the field and the source. */
57044
+ detail: string(),
57045
+ /** Fields that DID land before the refusal (writes run in order, stop at the first failure). */
57046
+ applied: array(FanOscillationAxisFieldSchema)
57047
+ })]);
57048
+ var SetOscillationAxisInputSchema = object({
57049
+ deviceId: number$1().int().nonnegative(),
57050
+ axis: FanOscillationAxisNameSchema,
57051
+ oscillating: boolean().optional(),
57052
+ angle: number$1().optional(),
57053
+ sweepFrom: number$1().optional(),
57054
+ sweepTo: number$1().optional()
57055
+ });
57056
+ /** The state path of one axis field: `oscillationAxes.<axis>.<field>`. */
57057
+ function fanAxisPath(axis, field) {
57058
+ return `oscillationAxes.${axis}.${field}`;
57059
+ }
56462
57060
  var FanControlStatusSchema = object({
56463
57061
  /** Active speed as 0..100 inclusive. Null when the device has no
56464
57062
  * speed surface (single-speed fan). */
@@ -56477,9 +57075,102 @@ var FanControlStatusSchema = object({
56477
57075
  /** Oscillation toggle. Null when the device has no oscillation
56478
57076
  * surface. */
56479
57077
  oscillating: boolean().nullable(),
57078
+ /**
57079
+ * Per-axis oscillation (air circulators). Absent when the device has no
57080
+ * per-axis surface and nothing is linked in Customize.
57081
+ */
57082
+ oscillationAxes: FanOscillationAxesSchema.optional(),
56480
57083
  /** Ms epoch when the slice was last updated. */
56481
57084
  lastChangedAt: number$1()
56482
57085
  });
57086
+ var FAN_CUSTOMIZE_DEVICE_TYPES = [DeviceType.Fan];
57087
+ /** The Customize section the axis targets are listed under. */
57088
+ var AXES_SECTION = "oscillation-axes";
57089
+ function axisOscillatingTarget(axis) {
57090
+ return {
57091
+ id: `${axis}-oscillating`,
57092
+ cardinality: "scalar",
57093
+ vocabulary: {
57094
+ cap: "fan-control",
57095
+ stateField: "oscillating"
57096
+ },
57097
+ deviceTypes: FAN_CUSTOMIZE_DEVICE_TYPES,
57098
+ apply: "replace",
57099
+ section: AXES_SECTION,
57100
+ path: fanAxisPath(axis, "oscillating"),
57101
+ sources: [{
57102
+ kind: "switch",
57103
+ transforms: [{ kind: "identity" }]
57104
+ }],
57105
+ sourceReport: { status: "assignment-status" }
57106
+ };
57107
+ }
57108
+ /**
57109
+ * A numeric axis field. The `angle` link also carries the axis limits, read
57110
+ * from the SAME linked control's own range (`min`/`max`/`step`), so the limits
57111
+ * are the source's, never guessed.
57112
+ */
57113
+ function axisNumericTarget(axis, field) {
57114
+ const base = {
57115
+ id: `${axis}-${field}`,
57116
+ cardinality: "scalar",
57117
+ vocabulary: { cap: "fan-control" },
57118
+ deviceTypes: FAN_CUSTOMIZE_DEVICE_TYPES,
57119
+ apply: "replace",
57120
+ section: AXES_SECTION,
57121
+ path: fanAxisPath(axis, field),
57122
+ sources: [{
57123
+ kind: "numeric",
57124
+ transforms: [{ kind: "identity" }]
57125
+ }],
57126
+ sourceReport: { status: "assignment-status" }
57127
+ };
57128
+ if (field !== "angle") return base;
57129
+ return {
57130
+ ...base,
57131
+ companions: FAN_OSCILLATION_AXIS_LIMITS.map((limit) => ({
57132
+ kind: "source-field",
57133
+ path: fanAxisPath(axis, limit),
57134
+ field: limit
57135
+ }))
57136
+ };
57137
+ }
57138
+ var AXIS_TARGETS = FAN_OSCILLATION_AXES.flatMap((axis) => [
57139
+ axisOscillatingTarget(axis),
57140
+ axisNumericTarget(axis, "angle"),
57141
+ axisNumericTarget(axis, "sweepFrom"),
57142
+ axisNumericTarget(axis, "sweepTo")
57143
+ ]);
57144
+ /** A select (an enum control) the operator links to the fan's `preset`. */
57145
+ var PRESET_TARGET = {
57146
+ id: "preset",
57147
+ cardinality: "scalar",
57148
+ vocabulary: { cap: "fan-control" },
57149
+ deviceTypes: FAN_CUSTOMIZE_DEVICE_TYPES,
57150
+ apply: "replace",
57151
+ path: "preset",
57152
+ sources: [{
57153
+ kind: "field",
57154
+ valueKinds: ["string"],
57155
+ transforms: [{ kind: "identity" }]
57156
+ }],
57157
+ sourceReport: { status: "assignment-status" }
57158
+ };
57159
+ var FAN_CONTROL_TARGETS = [...AXIS_TARGETS, PRESET_TARGET];
57160
+ /**
57161
+ * Customize (D1034): the fan already serves `fan-control` natively, so every
57162
+ * target is a `replace` over a field listed in `overridable` — the axis leaves
57163
+ * and `preset`, nothing else. Nothing is pre-linked: the operator picks each
57164
+ * source (D356).
57165
+ */
57166
+ var fanControlCustomize = {
57167
+ version: 1,
57168
+ overridable: FAN_CONTROL_TARGETS.map((target) => ({
57169
+ path: target.path,
57170
+ by: target.id
57171
+ })),
57172
+ targets: FAN_CONTROL_TARGETS
57173
+ };
56483
57174
  var fanControlCapability = {
56484
57175
  name: "fan-control",
56485
57176
  scope: "device",
@@ -56514,6 +57205,18 @@ var fanControlCapability = {
56514
57205
  }), _void(), {
56515
57206
  kind: "mutation",
56516
57207
  auth: "protected"
57208
+ }),
57209
+ /**
57210
+ * Sets one oscillation axis: its switch, fixed angle and/or sweep bounds.
57211
+ * Fields left out are untouched. A field linked in Customize is forwarded
57212
+ * to its linked source (D1034); otherwise the native provider serves it;
57213
+ * neither → `axis-not-linked`. Ranges are checked against the axis limits
57214
+ * before anything is written; writes run in order and stop at the first
57215
+ * failure, which the result names.
57216
+ */
57217
+ setOscillationAxis: optionalMethod(SetOscillationAxisInputSchema, FanOscillationAxisResultSchema, {
57218
+ kind: "mutation",
57219
+ auth: "protected"
56517
57220
  })
56518
57221
  },
56519
57222
  status: {
@@ -56525,6 +57228,7 @@ var fanControlCapability = {
56525
57228
  * sliders read `speed` for live updates.
56526
57229
  */
56527
57230
  runtimeState: FanControlStatusSchema,
57231
+ customize: fanControlCustomize,
56528
57232
  /**
56529
57233
  * Runtime-state durability: **session** — as `brightness`.
56530
57234
  *
@@ -56544,16 +57248,33 @@ var fanControlCapability = {
56544
57248
  oscillating: { kind: "boolean" }
56545
57249
  } }
56546
57250
  };
57251
+ /** One axis as a preset wants it; an absent field is left as it is. */
57252
+ var FanPresetAxisSchema = object({
57253
+ oscillating: boolean().optional(),
57254
+ angle: number$1().optional(),
57255
+ sweepFrom: number$1().optional(),
57256
+ sweepTo: number$1().optional()
57257
+ });
57258
+ /** The fan-control state a preset sets; an absent field is left as it is. */
57259
+ var FanPresetStateSchema = object({
57260
+ speed: number$1().min(0).max(100).optional(),
57261
+ /** The fan's own preset mode (or the linked select's option). */
57262
+ preset: string().min(1).optional(),
57263
+ direction: FanDirectionSchema.optional(),
57264
+ oscillationAxes: object({
57265
+ horizontal: FanPresetAxisSchema.optional(),
57266
+ vertical: FanPresetAxisSchema.optional()
57267
+ }).optional()
57268
+ });
56547
57269
  var FanPresetSchema = object({
56548
57270
  /** Stable key; never reused after a delete within one device's list. */
56549
57271
  id: string().min(1).max(64),
56550
57272
  /** What the operator and a voice assistant call it. */
56551
57273
  name: string().trim().min(1).max(40),
56552
- steps: array(ActionStepSchema).min(1).max(20)
57274
+ state: FanPresetStateSchema
56553
57275
  });
56554
57276
  var FanPresetsRefusalSchema = _enum([
56555
- "not-sibling",
56556
- "bad-target",
57277
+ "empty-state",
56557
57278
  "duplicate-name",
56558
57279
  "duplicate-id",
56559
57280
  "too-many",
@@ -56565,72 +57286,55 @@ var FanPresetsSetResultSchema = discriminatedUnion("status", [object({
56565
57286
  }), object({
56566
57287
  status: literal("refused"),
56567
57288
  reason: FanPresetsRefusalSchema,
56568
- /** Names the preset and step at fault. */
57289
+ /** Names the preset at fault. */
56569
57290
  detail: string()
56570
57291
  })]);
56571
- var FanPresetStepResultSchema = object({
56572
- index: number$1().int().nonnegative(),
57292
+ var FanPresetFieldResultSchema = object({
57293
+ /** The state path: `speed`, `preset`, `direction`, `oscillationAxes.horizontal.angle`. */
57294
+ field: string(),
56573
57295
  outcome: _enum([
56574
57296
  "applied",
56575
57297
  "failed",
56576
57298
  "not-run",
56577
57299
  "refused"
56578
57300
  ]),
56579
- deviceId: number$1().int().nonnegative().optional(),
56580
- cap: string().optional(),
56581
- method: string().optional(),
56582
57301
  /** The cause, for every outcome but `applied`. */
56583
57302
  message: string().optional()
56584
57303
  });
56585
57304
  var FanPresetApplyResultSchema = object({
56586
- /** `applied`: every step ran. `partial`: some ran, one failed. `refused`: nothing ran. */
57305
+ /** `applied`: every field landed. `partial`: some did, one did not. `refused`: nothing ran. */
56587
57306
  status: _enum([
56588
57307
  "applied",
56589
57308
  "partial",
56590
57309
  "refused"
56591
57310
  ]),
56592
- steps: array(FanPresetStepResultSchema)
57311
+ fields: array(FanPresetFieldResultSchema)
56593
57312
  });
56594
57313
  var FanCaptureFieldSchema = _enum([
56595
57314
  "speed",
56596
- "oscillating",
56597
57315
  "direction",
56598
- "preset"
57316
+ "preset",
57317
+ "oscillationAxes"
56599
57318
  ]);
56600
- var FanCaptureOmissionSchema = object({
56601
- /** A fan field (`speed`) or `step <n>` for a sibling step. */
56602
- what: string(),
56603
- /** Why no value was taken: unknown reading (never stored as 0, D393), or a step that cannot be read. */
56604
- reason: string()
56605
- });
56606
- var FanCaptureItemSchema = object({
56607
- group: _enum([
56608
- "fan",
56609
- "oscillation",
56610
- "angles"
56611
- ]),
56612
- /** What the step sets, in the operator's words (a device name, a fan field). */
56613
- label: string()
56614
- });
56615
57319
  var FanPresetCaptureResultSchema = object({
56616
- /** The steps filled from the device's current values; NOT saved. */
56617
- steps: array(ActionStepSchema),
56618
- /** One entry per step, same order: its review group and label. */
56619
- items: array(FanCaptureItemSchema),
56620
- omitted: array(FanCaptureOmissionSchema)
57320
+ /** The fan's CURRENT fan-control state, as a preset; NOT saved. */
57321
+ state: FanPresetStateSchema,
57322
+ omitted: array(object({
57323
+ /** A state path (`speed`, `oscillationAxes.vertical.angle`). */
57324
+ what: string(),
57325
+ /** Why no value was taken: an unknown reading is never stored as 0 (D393). */
57326
+ reason: string()
57327
+ }))
56621
57328
  });
56622
- var deviceInput$2 = object({ deviceId: number$1().int().nonnegative() });
57329
+ var deviceInput$1 = object({ deviceId: number$1().int().nonnegative() });
56623
57330
  DeviceType.Fan;
56624
- method(deviceInput$2, array(FanPresetSchema), { auth: "protected" }), method(deviceInput$2.extend({ presets: array(FanPresetSchema).max(12) }), FanPresetsSetResultSchema, {
57331
+ method(deviceInput$1, array(FanPresetSchema), { auth: "protected" }), method(deviceInput$1.extend({ presets: array(FanPresetSchema).max(12) }), FanPresetsSetResultSchema, {
56625
57332
  kind: "mutation",
56626
57333
  auth: "admin"
56627
- }), method(deviceInput$2.extend({ presetId: string().min(1) }), FanPresetApplyResultSchema, {
57334
+ }), method(deviceInput$1.extend({ presetId: string().min(1) }), FanPresetApplyResultSchema, {
56628
57335
  kind: "mutation",
56629
57336
  auth: "protected"
56630
- }), method(deviceInput$2.extend({
56631
- fields: array(FanCaptureFieldSchema).optional(),
56632
- steps: array(ActionStepSchema).max(20).default([])
56633
- }), FanPresetCaptureResultSchema, { auth: "protected" });
57337
+ }), method(deviceInput$1.extend({ fields: array(FanCaptureFieldSchema).optional() }), FanPresetCaptureResultSchema, { auth: "protected" });
56634
57338
  /**
56635
57339
  * Per-device feature/identity probe slice. Holds the runtime-resolved
56636
57340
  * truth about what a device CAN do — which the kernel uses to:
@@ -56842,8 +57546,7 @@ var groupActiveCapability = {
56842
57546
  DeviceType.Valve,
56843
57547
  DeviceType.Lock,
56844
57548
  DeviceType.MediaPlayer,
56845
- DeviceType.Climate,
56846
- DeviceType.Thermostat
57549
+ DeviceType.Climate
56847
57550
  ],
56848
57551
  methods: {},
56849
57552
  status: {
@@ -56885,7 +57588,6 @@ var groupCommandsCapability = {
56885
57588
  DeviceType.Valve,
56886
57589
  DeviceType.Lock,
56887
57590
  DeviceType.MediaPlayer,
56888
- DeviceType.Thermostat,
56889
57591
  DeviceType.Climate
56890
57592
  ],
56891
57593
  methods: {},
@@ -56941,7 +57643,6 @@ var groupStatusCapability = {
56941
57643
  DeviceType.Valve,
56942
57644
  DeviceType.Lock,
56943
57645
  DeviceType.MediaPlayer,
56944
- DeviceType.Thermostat,
56945
57646
  DeviceType.Climate
56946
57647
  ],
56947
57648
  methods: {},
@@ -57270,7 +57971,7 @@ var heatingValveCapability = {
57270
57971
  scope: "device",
57271
57972
  deviceNative: true,
57272
57973
  mode: "singleton",
57273
- deviceTypes: [DeviceType.Thermostat],
57974
+ deviceTypes: [DeviceType.Climate],
57274
57975
  methods: {},
57275
57976
  status: {
57276
57977
  schema: HeatingValveStatusSchema,
@@ -57300,13 +58001,18 @@ var heatingValveCapability = {
57300
58001
  * retried in a loop - D49); a future one is re-armed.
57301
58002
  *
57302
58003
  * What a device may be run for, and for how long at most, is per device type
57303
- * ({@link TIMED_RUN_LIMITS}): the maximum is a safety bound, not a preference,
58004
+ * and role ({@link timedRunLimitOf}): the maximum is a safety bound, not a preference,
57304
58005
  * so a request above it is REFUSED with a typed reason, never clamped.
57305
58006
  */
57306
58007
  var TimedRunUnitSchema = _enum(["s", "min"]);
57307
58008
  _enum(["switch", "pet-fountain"]);
57308
- DeviceType.Heater, DeviceType.PetFountain;
57309
- var TIMED_RUN_DEVICE_TYPES = [DeviceType.Heater, DeviceType.PetFountain];
58009
+ /**
58010
+ * The device types `timed-run` may be offered on. A `switch` is narrowed by
58011
+ * role ({@link TIMED_RUN_DEVICE_ROLES}): only a plug-in heater runs on a timer.
58012
+ */
58013
+ var TIMED_RUN_DEVICE_TYPES = [DeviceType.Switch, DeviceType.PetFountain];
58014
+ /** The roles that make a device of these types timed-run-able (D1033). */
58015
+ var TIMED_RUN_DEVICE_ROLES = { [DeviceType.Switch]: [DeviceRole.SwitchHeater] };
57310
58016
  /** One duration, as the one-tap run asks for it. */
57311
58017
  var TimedRunQuickRunSchema = object({
57312
58018
  duration: number$1().positive().finite(),
@@ -57356,6 +58062,7 @@ var timedRunCapability = {
57356
58062
  kind: "wrapper",
57357
58063
  defaultActive: true,
57358
58064
  deviceTypes: TIMED_RUN_DEVICE_TYPES,
58065
+ deviceRoles: TIMED_RUN_DEVICE_ROLES,
57359
58066
  deviceConfig: { ui: {
57360
58067
  kind: "derived-form",
57361
58068
  builderId: "timed-run",
@@ -57516,8 +58223,8 @@ var HeroSceneSchema = object({
57516
58223
  /** 0..1: volume, cover position, cycle progress. */
57517
58224
  level: number$1().min(0).max(1).nullable()
57518
58225
  });
57519
- DeviceType.Camera, DeviceType.Hub, DeviceType.Light, DeviceType.Siren, DeviceType.Switch, DeviceType.Sensor, DeviceType.Thermostat, 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.Heater, DeviceType.Dryer, DeviceType.Gateway;
57520
- 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;
58226
+ 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;
58227
+ 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;
57521
58228
  /** A string in both languages, as the cap vocabulary writes it (D920): no `t()` in the model. */
57522
58229
  var HeroTextSchema = object({
57523
58230
  en: string(),
@@ -57583,13 +58290,11 @@ var HeroConfirmSchema = _enum([
57583
58290
  "press"
57584
58291
  ]);
57585
58292
  var HeroActionSchema = object({
57586
- /** Unique within the model; the `gated` list and the specs name it. */
57587
58293
  id: string(),
57588
58294
  label: HeroTextSchema,
57589
58295
  icon: IconKeySchema,
57590
58296
  call: HeroCallSchema,
57591
58297
  emphasis: _enum(["primary", "normal"]),
57592
- /** Ask before running it. */
57593
58298
  confirm: HeroConfirmSchema.nullable()
57594
58299
  });
57595
58300
  var HeroControlSchema = discriminatedUnion("kind", [
@@ -57640,6 +58345,8 @@ var HeroPillSchema = object({
57640
58345
  });
57641
58346
  var HeroRowSchema = object({
57642
58347
  id: HeroRowIdSchema,
58348
+ /** `scene`: the row's action and slider controls are drawn on the scene. Absent: an ordinary row. */
58349
+ placement: _enum(["row", "scene"]).optional(),
57643
58350
  /** The row's own name when the kind's label would not tell rows of one kind apart (a circuit's label). */
57644
58351
  label: HeroTextSchema.optional(),
57645
58352
  /** A group header drawn above the row when it differs from the previous row's ("System"). */
@@ -57670,9 +58377,16 @@ var HeroBadgeSchema = object({
57670
58377
  value: number$1().nullable(),
57671
58378
  label: HeroTextSchema
57672
58379
  });
57673
- var HeroRemoteSlotSchema = object({
57674
- /** Saved commands; `null` = not known yet (the button still shows). */
57675
- commands: number$1().int().nullable() });
58380
+ var HeroRemoteSlotSchema = object({
58381
+ /** Saved commands; `null` = not known yet (the button still shows). */
58382
+ commands: number$1().int().nullable(),
58383
+ /**
58384
+ * The control a list row draws as the "open the remote" icon. Recognised by its id
58385
+ * ({@link REMOTE_OPEN_ACTION_ID}); it changes no state, so a client opens the remote
58386
+ * instead of running `call`. Absent on a model from an older server.
58387
+ */
58388
+ open: HeroActionSchema.optional()
58389
+ });
57676
58390
  var HeroConsumablesSlotSchema = object({
57677
58391
  items: array(object({
57678
58392
  key: string(),
@@ -57840,6 +58554,8 @@ var HeroModelSchema = object({
57840
58554
  * the FIRST row that has any (a later row's control is never promoted). When
57841
58555
  * the model lists that part in `gated`, the row has no inline control: the
57842
58556
  * projection never falls through to another control the caller could use.
58557
+ * - a climate or thermostat row's primary is its `climate.mode` control (no power
58558
+ * toggle: "off" is a mode); when the model gates it the rule above applies as before;
57843
58559
  * - a timed run, when the model carries the slot, sits beside that primary:
57844
58560
  * Run while idle, Stop while armed. Gating the slot hides the control.
57845
58561
  * - the status line is the head (what plays, else the state) plus at most
@@ -57847,6 +58563,13 @@ var HeroModelSchema = object({
57847
58563
  * time left on an armed timed run;
57848
58564
  * - the trailing fact is the first of power, battery, consumables.
57849
58565
  *
58566
+ * - `extras` are the further inline controls of the types that carry more than one
58567
+ * ({@link ROW_EXTRAS_BY_TYPE}): climate setpoint, a robot's return to base,
58568
+ * a player's volume and remote. Each is a control the model already has, named by id,
58569
+ * in that order and at most {@link ROW_EXTRAS_MAX}; one the model lacks, or lists in
58570
+ * `gated`, is absent, and the one `primary` already is never repeats. Empty = the
58571
+ * row of an older server: `primary` alone.
58572
+ *
57850
58573
  * `projectDeviceRow` is pure and computes nothing: it selects from a
57851
58574
  * {@link HeroModel}. A row that needed a value the hero lacks would mean the
57852
58575
  * model is missing it, so the fix goes in the model.
@@ -57878,8 +58601,16 @@ var HeroRowModelSchema = object({
57878
58601
  * while armed. `null` when there is no slot, or the caller may not act.
57879
58602
  */
57880
58603
  timedRun: HeroRowTimedRunSchema.nullable(),
58604
+ /**
58605
+ * The further inline controls after `primary`, in order (see the header). The remote
58606
+ * is an `action` with id `remote.open`: the client opens the remote, it does not run
58607
+ * the call. Absent or empty = `primary` alone.
58608
+ */
58609
+ extras: array(HeroControlSchema).max(2).optional(),
57881
58610
  trailing: HeroFactSchema.nullable()
57882
58611
  });
58612
+ DeviceType.Climate;
58613
+ DeviceType.Climate, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.MediaPlayer;
57883
58614
  /**
57884
58615
  * hero-layout — what a device's hero says (D1023). Read-only: the FIXED
57885
58616
  * layouts live in `@camstack/types` and nothing here stores or edits one.
@@ -57911,7 +58642,10 @@ method(heroInput, HeroModelSchema.nullable(), {
57911
58642
  }), method(rowModelsInput, array(HeroRowModelSchema.nullable()), {
57912
58643
  auth: "protected",
57913
58644
  role: "viewer"
57914
- }), method(object({ deviceType: string() }), HeroLayoutRowsSchema, {
58645
+ }), method(object({
58646
+ deviceType: string(),
58647
+ role: string().nullable().optional()
58648
+ }), HeroLayoutRowsSchema, {
57915
58649
  auth: "protected",
57916
58650
  role: "viewer"
57917
58651
  });
@@ -57958,6 +58692,11 @@ var humidifierCapability = {
57958
58692
  deviceNative: true,
57959
58693
  mode: "singleton",
57960
58694
  deviceTypes: [DeviceType.Humidifier],
58695
+ power: {
58696
+ kind: "field",
58697
+ field: "on",
58698
+ set: "setOn"
58699
+ },
57961
58700
  methods: {
57962
58701
  setOn: method(object({
57963
58702
  deviceId: number$1().int().nonnegative(),
@@ -58031,7 +58770,7 @@ var humiditySensorCapability = {
58031
58770
  scope: "device",
58032
58771
  deviceNative: true,
58033
58772
  mode: "singleton",
58034
- deviceTypes: [DeviceType.Sensor, DeviceType.Thermostat],
58773
+ deviceTypes: [DeviceType.Sensor, DeviceType.Climate],
58035
58774
  methods: {},
58036
58775
  status: {
58037
58776
  schema: HumiditySensorStatusSchema,
@@ -69429,13 +70168,23 @@ var NcRuleTargetSchema = object({
69429
70168
  */
69430
70169
  params: record(string(), unknown()).optional()
69431
70170
  });
70171
+ /** Which picture kind one target receives (#487). */
70172
+ var NcTargetAttachmentSchema = _enum([
70173
+ "none",
70174
+ "image",
70175
+ "clip",
70176
+ "gif"
70177
+ ]);
69432
70178
  var NcTargetOverrideSchema = object({
69433
70179
  template: object({
69434
70180
  title: string().max(500).optional(),
69435
70181
  body: string().max(2e3).optional()
69436
70182
  }).optional(),
69437
70183
  schedule: NcScheduleSchema.optional(),
69438
- priority: number$1().int().min(1).max(5).optional()
70184
+ priority: number$1().int().min(1).max(5).optional(),
70185
+ attachment: NcTargetAttachmentSchema.optional(),
70186
+ /** `false` = no buttons for this target; `true` is the same as absent. */
70187
+ actions: boolean().optional()
69439
70188
  });
69440
70189
  /** Per-target settings keyed by target id (#487). */
69441
70190
  var NcTargetOverridesSchema = record(string(), NcTargetOverrideSchema);
@@ -71626,9 +72375,13 @@ var petFeederCapability = {
71626
72375
  */
71627
72376
  durability: "session",
71628
72377
  /**
71629
- * History (D850): recorded series.
72378
+ * History (D850): recorded series. `feeding` / `eating` are the meals the
72379
+ * device hero's "Meals" button names — change-only booleans, so a dispense
72380
+ * or a pet at the bowl is one span on the history.
71630
72381
  */
71631
72382
  history: { fields: {
72383
+ feeding: { kind: "boolean" },
72384
+ eating: { kind: "boolean" },
71632
72385
  foodLevel: { kind: "gauge" },
71633
72386
  bowlFood: { kind: "gauge" },
71634
72387
  food1: { kind: "gauge" },
@@ -71689,6 +72442,11 @@ var petFountainCapability = {
71689
72442
  deviceNative: true,
71690
72443
  mode: "singleton",
71691
72444
  deviceTypes: [DeviceType.PetFountain],
72445
+ power: {
72446
+ kind: "field",
72447
+ field: "pumpRunning",
72448
+ set: "setPump"
72449
+ },
71692
72450
  methods: {
71693
72451
  /** Start or stop the pump. */
71694
72452
  setPump: method(object({
@@ -73264,7 +74022,6 @@ var POWER_METER_DEVICE_TYPES = [
73264
74022
  DeviceType.Light,
73265
74023
  DeviceType.Fan,
73266
74024
  DeviceType.Climate,
73267
- DeviceType.Thermostat,
73268
74025
  DeviceType.Humidifier,
73269
74026
  DeviceType.WaterHeater,
73270
74027
  DeviceType.MediaPlayer,
@@ -73273,8 +74030,7 @@ var POWER_METER_DEVICE_TYPES = [
73273
74030
  DeviceType.Dishwasher,
73274
74031
  DeviceType.Vacuum,
73275
74032
  DeviceType.LawnMower,
73276
- DeviceType.PetFeeder,
73277
- DeviceType.Heater
74033
+ DeviceType.PetFeeder
73278
74034
  ];
73279
74035
  /** Everything but a bare `Sensor`: a sensor that takes its reading from another sensor adds nothing. */
73280
74036
  var POWER_METER_CUSTOMIZE_DEVICE_TYPES = POWER_METER_DEVICE_TYPES.filter((type) => type !== DeviceType.Sensor);
@@ -73387,118 +74143,6 @@ var powerMeterCapability = {
73387
74143
  volatileStateFields: ["lastFetchedAt"],
73388
74144
  customize: powerMeterCustomize
73389
74145
  };
73390
- var PowerSourceRefusalReasonSchema = _enum([
73391
- "no-power-source",
73392
- "switch-missing",
73393
- "switch-offline",
73394
- "switch-unknown",
73395
- "restart-in-progress",
73396
- "switch-call-failed"
73397
- ]);
73398
- var PowerSourceActionResultSchema = discriminatedUnion("accepted", [object({ accepted: literal(true) }), object({
73399
- accepted: literal(false),
73400
- reason: PowerSourceRefusalReasonSchema,
73401
- /** One line for the operator, naming the switch. */
73402
- message: string()
73403
- })]);
73404
- var PowerSourceInfoSchema = object({
73405
- /** False when the device has no power source linked; the rest is then empty. */
73406
- linked: boolean(),
73407
- switchDeviceId: number$1().nullable(),
73408
- switchName: string().nullable(),
73409
- /** The switch's on/off state, or null when it is unknown. Never false for unknown (D393). */
73410
- switchOn: boolean().nullable(),
73411
- switchOnline: boolean().nullable(),
73412
- restartInProgress: boolean(),
73413
- offSeconds: number$1().int()
73414
- });
73415
- /** The composed slice: the switch state the link mirrors, plus the stored off time. */
73416
- var PowerSourceStateSchema = object({
73417
- /** Null while the switch has not reported: unknown is never `false` (D393). */
73418
- switchOn: boolean().nullable(),
73419
- offSeconds: number$1().int(),
73420
- lastFetchedAt: number$1()
73421
- });
73422
- var POWER_SOURCE_DEVICE_TYPES = [
73423
- DeviceType.Gateway,
73424
- DeviceType.Hub,
73425
- DeviceType.Camera,
73426
- DeviceType.Sensor,
73427
- DeviceType.MediaPlayer,
73428
- DeviceType.Vacuum,
73429
- DeviceType.Generic,
73430
- DeviceType.Washer,
73431
- DeviceType.Dryer,
73432
- DeviceType.Dishwasher,
73433
- DeviceType.PetFountain,
73434
- DeviceType.Fan,
73435
- DeviceType.Humidifier,
73436
- DeviceType.Climate,
73437
- DeviceType.WaterHeater
73438
- ];
73439
- var powerSourceCustomize = {
73440
- version: 1,
73441
- targets: [{
73442
- id: "switch",
73443
- cardinality: "scalar",
73444
- vocabulary: {
73445
- cap: "power-source",
73446
- stateField: "switchOn"
73447
- },
73448
- deviceTypes: POWER_SOURCE_DEVICE_TYPES,
73449
- apply: "add",
73450
- path: "switchOn",
73451
- sources: [{
73452
- kind: "switch",
73453
- transforms: [{ kind: "identity" }]
73454
- }],
73455
- companions: [{
73456
- kind: "constant",
73457
- path: "offSeconds",
73458
- value: 10,
73459
- when: "add",
73460
- formerValues: [0]
73461
- }, {
73462
- kind: "clock",
73463
- path: "lastFetchedAt",
73464
- when: "always"
73465
- }],
73466
- sourceReport: { status: "assignment-status" }
73467
- }]
73468
- };
73469
- var deviceInput$1 = object({ deviceId: number$1().int().nonnegative() });
73470
- var powerSourceCapability = {
73471
- name: "power-source",
73472
- scope: "device",
73473
- mode: "singleton",
73474
- deviceTypes: POWER_SOURCE_DEVICE_TYPES,
73475
- methods: {
73476
- getStatus: systemMethod(deviceInput$1, PowerSourceInfoSchema, { auth: "admin" }),
73477
- powerOn: systemMethod(deviceInput$1, PowerSourceActionResultSchema, {
73478
- kind: "mutation",
73479
- auth: "admin"
73480
- }),
73481
- powerOff: systemMethod(deviceInput$1, PowerSourceActionResultSchema, {
73482
- kind: "mutation",
73483
- auth: "admin"
73484
- }),
73485
- forceRestart: systemMethod(deviceInput$1, PowerSourceActionResultSchema, {
73486
- kind: "mutation",
73487
- auth: "admin"
73488
- })
73489
- },
73490
- runtimeState: PowerSourceStateSchema,
73491
- customize: powerSourceCustomize,
73492
- /**
73493
- * Runtime-state durability: **session** — mirrored from the linked switch on
73494
- * its next report; a restored value would outlive the reading it names.
73495
- *
73496
- * See `RuntimeStateDurability`. Enforced by
73497
- * `scripts/check-runtime-state-durability.ts`.
73498
- */
73499
- durability: "session",
73500
- history: "none"
73501
- };
73502
74146
  /**
73503
74147
  * Presence cap. Models HA `person.*` and `device_tracker.*` entities
73504
74148
  * on `DeviceType.Presence`. Read-only — no setters: presence is
@@ -76965,9 +77609,7 @@ var RUNNING_CUSTOMIZE_DEVICE_TYPES = [
76965
77609
  DeviceType.Humidifier,
76966
77610
  DeviceType.Fan,
76967
77611
  DeviceType.Climate,
76968
- DeviceType.Thermostat,
76969
- DeviceType.PetFeeder,
76970
- DeviceType.Heater
77612
+ DeviceType.PetFeeder
76971
77613
  ];
76972
77614
  var runningStateCapability = {
76973
77615
  name: "running-state",
@@ -79055,8 +79697,7 @@ var switchCapability = {
79055
79697
  DeviceType.Switch,
79056
79698
  DeviceType.Siren,
79057
79699
  DeviceType.Light,
79058
- DeviceType.Fan,
79059
- DeviceType.Heater
79700
+ DeviceType.Fan
79060
79701
  ],
79061
79702
  methods: { setState: method(object({
79062
79703
  deviceId: number$1(),
@@ -79750,7 +80391,7 @@ var temperatureSensorCapability = {
79750
80391
  scope: "device",
79751
80392
  deviceNative: true,
79752
80393
  mode: "singleton",
79753
- deviceTypes: [DeviceType.Sensor, DeviceType.Thermostat],
80394
+ deviceTypes: [DeviceType.Sensor, DeviceType.Climate],
79754
80395
  methods: {},
79755
80396
  status: {
79756
80397
  schema: TemperatureSensorStatusSchema,
@@ -81397,6 +82038,13 @@ var waterHeaterCapability = {
81397
82038
  deviceNative: true,
81398
82039
  mode: "singleton",
81399
82040
  deviceTypes: [DeviceType.WaterHeater],
82041
+ power: {
82042
+ kind: "mode",
82043
+ field: "operationMode",
82044
+ offValue: "off",
82045
+ set: "setOperationMode",
82046
+ lastField: "lastActiveMode"
82047
+ },
81400
82048
  methods: {
81401
82049
  setTargetTemp: method(object({
81402
82050
  deviceId: number$1().int().nonnegative(),
@@ -83055,7 +83703,6 @@ var DEVICE_LOCAL_STATE_CAPS = {
83055
83703
  control: controlCapability,
83056
83704
  cover: coverCapability,
83057
83705
  dayNight: dayNightCapability,
83058
- deviceDiscovery: deviceDiscoveryCapability,
83059
83706
  deviceStatus: deviceStatusCapability,
83060
83707
  dishwasher: dishwasherCapability,
83061
83708
  doNotDisturb: doNotDisturbCapability,
@@ -84150,15 +84797,16 @@ var BaseDeviceProvider = class extends BaseAddon {
84150
84797
  });
84151
84798
  const meta = await this.ctx.api.deviceManager.loadMeta.query({ deviceId: id });
84152
84799
  if (meta === null) throw new Error(`${this.providerName}: no persisted meta for "${stableId}" (id ${id}) — cannot reload`);
84153
- const deviceType = Object.values(DeviceType).find((t) => t === meta.type);
84154
- const Class = deviceType !== void 0 ? this.deviceClasses[deviceType] : void 0;
84800
+ const Class = this.deviceClassForRow({
84801
+ type: meta.type,
84802
+ stableId
84803
+ });
84155
84804
  if (!Class) throw new Error(`${this.providerName}: no device class for type "${meta.type}" — "${stableId}" is an accessory child; reload its parent instead`);
84156
84805
  await devices.create(stableId, Class, {}, meta.parentDeviceId ?? null);
84157
84806
  const rows = await this.ctx.api.deviceManager.listPersistedByAddon.query({ addonId: this.addonId });
84158
84807
  for (const row of rows) {
84159
84808
  if (row.parentDeviceId !== id) continue;
84160
- const childType = Object.values(DeviceType).find((t) => t === row.type);
84161
- const ChildClass = childType !== void 0 ? this.deviceClasses[childType] : void 0;
84809
+ const ChildClass = this.deviceClassForRow(row);
84162
84810
  if (!ChildClass) continue;
84163
84811
  try {
84164
84812
  await devices.create(row.stableId, ChildClass, {}, id);
@@ -84185,6 +84833,16 @@ var BaseDeviceProvider = class extends BaseAddon {
84185
84833
  return { deviceId: id };
84186
84834
  }
84187
84835
  /**
84836
+ * The class a PERSISTED row is rebuilt with. Default: by type, from
84837
+ * `deviceClasses`. A provider whose distinct devices share one type (D1033:
84838
+ * a radiator valve and a room climate are both `climate`) overrides this
84839
+ * and tells them apart by the row's stable id or config.
84840
+ */
84841
+ deviceClassForRow(row) {
84842
+ const type = Object.values(DeviceType).find((t) => t === row.type);
84843
+ return type !== void 0 ? this.deviceClasses[type] : void 0;
84844
+ }
84845
+ /**
84188
84846
  * Restore devices from persisted state. Two-pass:
84189
84847
  *
84190
84848
  * 1. **Top-level pass** — invokes `kernel.devices.create()` for every
@@ -84245,7 +84903,7 @@ var BaseDeviceProvider = class extends BaseAddon {
84245
84903
  restored.add(saved.id);
84246
84904
  return;
84247
84905
  }
84248
- const Class = this.deviceClasses[saved.type];
84906
+ const Class = this.deviceClassForRow(saved);
84249
84907
  if (!Class) throw new Error(`no device class registered for type "${saved.type}"`);
84250
84908
  if (saved.parentDeviceId !== null && !restored.has(saved.parentDeviceId)) throw new Error(`parent device ${saved.parentDeviceId} not restored`);
84251
84909
  await this.healSavedConfig(saved, savedDevices);
@@ -84262,7 +84920,7 @@ var BaseDeviceProvider = class extends BaseAddon {
84262
84920
  };
84263
84921
  const topLevel = savedDevices.filter((saved) => saved.parentDeviceId === null);
84264
84922
  const restoreOne = async (saved) => {
84265
- if (!this.deviceClasses[saved.type]) {
84923
+ if (!this.deviceClassForRow(saved)) {
84266
84924
  this.ctx.logger.warn("No device class registered for restored type — skipping", {
84267
84925
  tags: {
84268
84926
  deviceId: saved.id,
@@ -84301,7 +84959,7 @@ var BaseDeviceProvider = class extends BaseAddon {
84301
84959
  const failedTopLevelIds = new Set(failures.map((failure) => failure.saved.id));
84302
84960
  const childRows = savedDevices.filter((s) => s.parentDeviceId !== null);
84303
84961
  for (const saved of childRows) {
84304
- if (!this.deviceClasses[saved.type]) continue;
84962
+ if (!this.deviceClassForRow(saved)) continue;
84305
84963
  if (saved.parentDeviceId === null) continue;
84306
84964
  if (restored.has(saved.parentDeviceId)) {
84307
84965
  try {
@@ -84355,7 +85013,9 @@ var BaseDeviceProvider = class extends BaseAddon {
84355
85013
  }
84356
85014
  };
84357
85015
  DeviceType.HeatPump;
84358
- 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.Thermostat, 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.Heater, DeviceType.Dishwasher, DeviceType.Washer, DeviceType.Dryer, DeviceType.Gateway;
85016
+ DeviceType.Climate;
85017
+ DeviceRole.ClimateThermostat, DeviceRole.ClimateAc, DeviceRole.ClimateRadiator, DeviceRole.ClimateFloor, DeviceRole.ClimateHeater, DeviceRole.ClimateHeatPumpCircuit;
85018
+ 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;
84359
85019
  new Set(Object.values(DeviceType));
84360
85020
  /** Parses the raw slice with the cap's own schema; `undefined` when it does not parse. */
84361
85021
  function contribution(cap, schema, build) {
@@ -86361,7 +87021,7 @@ var HEAT_PUMP_FAMILY_CONTRIBUTIONS = { "heat-pump-status": contribution("heat-pu
86361
87021
  ...Object.values(CLIMATE_FAMILY_CONTRIBUTIONS),
86362
87022
  ...Object.values(HEAT_PUMP_FAMILY_CONTRIBUTIONS)
86363
87023
  ];
86364
- DeviceType.Camera, DeviceType.Hub, DeviceType.Light, DeviceType.Siren, DeviceType.Switch, DeviceType.Sensor, DeviceType.Thermostat, 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.Heater, DeviceType.Dryer, DeviceType.Gateway;
87024
+ 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;
86365
87025
  /**
86366
87026
  * Who looks like what (D1023). One look per {@link DeviceType}, refined by a
86367
87027
  * {@link DeviceRole} where the role changes how the device reads (a leak
@@ -87005,9 +87665,9 @@ lookOf({
87005
87665
  idle: INFO,
87006
87666
  standby: MUTED
87007
87667
  });
87008
- DeviceType.Climate, DeviceType.Thermostat;
87009
- DeviceType.Camera, DeviceType.Hub, DeviceType.Light, DeviceType.Siren, DeviceType.Switch, DeviceType.Sensor, DeviceType.Thermostat, 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.Heater, DeviceType.Dryer, DeviceType.Gateway;
87010
- 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;
87668
+ DeviceType.Climate;
87669
+ 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;
87670
+ 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;
87011
87671
  Object.freeze({
87012
87672
  "accessories.getStatus": {
87013
87673
  capName: "accessories",
@@ -88234,6 +88894,27 @@ Object.freeze({
88234
88894
  access: "create",
88235
88895
  role: "viewer"
88236
88896
  },
88897
+ "clusterUpdate.getClusterUpdateJob": {
88898
+ capName: "cluster-update",
88899
+ capScope: "system",
88900
+ addonId: null,
88901
+ access: "view",
88902
+ role: "admin"
88903
+ },
88904
+ "clusterUpdate.previewClusterUpdate": {
88905
+ capName: "cluster-update",
88906
+ capScope: "system",
88907
+ addonId: null,
88908
+ access: "view",
88909
+ role: "admin"
88910
+ },
88911
+ "clusterUpdate.startClusterUpdate": {
88912
+ capName: "cluster-update",
88913
+ capScope: "system",
88914
+ addonId: null,
88915
+ access: "create",
88916
+ role: "admin"
88917
+ },
88237
88918
  "color.getStatus": {
88238
88919
  capName: "color",
88239
88920
  capScope: "device",
@@ -88836,41 +89517,6 @@ Object.freeze({
88836
89517
  access: "create",
88837
89518
  role: "admin"
88838
89519
  },
88839
- "deviceDiscovery.adoptDevice": {
88840
- capName: "device-discovery",
88841
- capScope: "device",
88842
- addonId: null,
88843
- access: "create",
88844
- role: "admin"
88845
- },
88846
- "deviceDiscovery.getStatus": {
88847
- capName: "device-discovery",
88848
- capScope: "device",
88849
- addonId: null,
88850
- access: "view",
88851
- role: "viewer"
88852
- },
88853
- "deviceDiscovery.listDiscovered": {
88854
- capName: "device-discovery",
88855
- capScope: "device",
88856
- addonId: null,
88857
- access: "view",
88858
- role: "viewer"
88859
- },
88860
- "deviceDiscovery.refreshDiscovery": {
88861
- capName: "device-discovery",
88862
- capScope: "device",
88863
- addonId: null,
88864
- access: "create",
88865
- role: "admin"
88866
- },
88867
- "deviceDiscovery.releaseDevice": {
88868
- capName: "device-discovery",
88869
- capScope: "device",
88870
- addonId: null,
88871
- access: "create",
88872
- role: "admin"
88873
- },
88874
89520
  "deviceExport.applyDeviceSettingsPatch": {
88875
89521
  capName: "device-export",
88876
89522
  capScope: "system",
@@ -89606,6 +90252,13 @@ Object.freeze({
89606
90252
  access: "create",
89607
90253
  role: "admin"
89608
90254
  },
90255
+ "deviceManager.search": {
90256
+ capName: "device-manager",
90257
+ capScope: "system",
90258
+ addonId: null,
90259
+ access: "view",
90260
+ role: "viewer"
90261
+ },
89609
90262
  "deviceManager.setAlias": {
89610
90263
  capName: "device-manager",
89611
90264
  capScope: "system",
@@ -89697,6 +90350,13 @@ Object.freeze({
89697
90350
  access: "create",
89698
90351
  role: "admin"
89699
90352
  },
90353
+ "deviceManager.setPrimaryChildPreference": {
90354
+ capName: "device-manager",
90355
+ capScope: "system",
90356
+ addonId: null,
90357
+ access: "create",
90358
+ role: "admin"
90359
+ },
89700
90360
  "deviceManager.setRole": {
89701
90361
  capName: "device-manager",
89702
90362
  capScope: "system",
@@ -90404,6 +91064,13 @@ Object.freeze({
90404
91064
  access: "create",
90405
91065
  role: "viewer"
90406
91066
  },
91067
+ "fanControl.setOscillationAxis": {
91068
+ capName: "fan-control",
91069
+ capScope: "device",
91070
+ addonId: null,
91071
+ access: "create",
91072
+ role: "viewer"
91073
+ },
90407
91074
  "fanControl.setPercentage": {
90408
91075
  capName: "fan-control",
90409
91076
  capScope: "device",
@@ -94336,28 +95003,28 @@ Object.freeze({
94336
95003
  capScope: "device",
94337
95004
  addonId: null,
94338
95005
  access: "create",
94339
- role: "admin"
95006
+ role: "viewer"
94340
95007
  },
94341
95008
  "powerSource.getStatus": {
94342
95009
  capName: "power-source",
94343
95010
  capScope: "device",
94344
95011
  addonId: null,
94345
95012
  access: "view",
94346
- role: "admin"
95013
+ role: "viewer"
94347
95014
  },
94348
95015
  "powerSource.powerOff": {
94349
95016
  capName: "power-source",
94350
95017
  capScope: "device",
94351
95018
  addonId: null,
94352
95019
  access: "create",
94353
- role: "admin"
95020
+ role: "viewer"
94354
95021
  },
94355
95022
  "powerSource.powerOn": {
94356
95023
  capName: "power-source",
94357
95024
  capScope: "device",
94358
95025
  addonId: null,
94359
95026
  access: "create",
94360
- role: "admin"
95027
+ role: "viewer"
94361
95028
  },
94362
95029
  "presence.getStatus": {
94363
95030
  capName: "presence",
@@ -97425,7 +98092,7 @@ function projectAction(cap, action) {
97425
98092
  };
97426
98093
  }
97427
98094
  Object.entries(CAP_VOCABULARY_BY_NAME).flatMap(([cap, entry]) => entry.scope === "device" ? (entry.actions ?? []).map((a) => projectAction(cap, a)) : []);
97428
- DeviceType.Camera, DeviceType.Hub, DeviceType.Light, DeviceType.Siren, DeviceType.Switch, DeviceType.Sensor, DeviceType.Thermostat, 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.Heater, DeviceType.Dishwasher, DeviceType.Washer, DeviceType.Dryer, DeviceType.Gateway;
98095
+ 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;
97429
98096
  DeviceFeature.BatteryOperated;
97430
98097
  function bound(cap, methods = [], authority = "reported") {
97431
98098
  return {
@@ -97914,35 +98581,6 @@ Object.freeze({
97914
98581
  form: "single",
97915
98582
  optional: false
97916
98583
  }],
97917
- "deviceDiscovery.adoptDevice": [{
97918
- name: "deviceId",
97919
- form: "single",
97920
- optional: false
97921
- }],
97922
- "deviceDiscovery.getStatus": [{
97923
- name: "deviceId",
97924
- form: "single",
97925
- optional: false
97926
- }],
97927
- "deviceDiscovery.listDiscovered": [{
97928
- name: "deviceId",
97929
- form: "single",
97930
- optional: false
97931
- }],
97932
- "deviceDiscovery.refreshDiscovery": [{
97933
- name: "deviceId",
97934
- form: "single",
97935
- optional: false
97936
- }],
97937
- "deviceDiscovery.releaseDevice": [{
97938
- name: "childDeviceId",
97939
- form: "single",
97940
- optional: false
97941
- }, {
97942
- name: "deviceId",
97943
- form: "single",
97944
- optional: false
97945
- }],
97946
98584
  "deviceExport.applyDeviceSettingsPatch": [{
97947
98585
  name: "deviceId",
97948
98586
  form: "single",
@@ -98221,6 +98859,11 @@ Object.freeze({
98221
98859
  form: "single",
98222
98860
  optional: false
98223
98861
  }],
98862
+ "deviceManager.setPrimaryChildPreference": [{
98863
+ name: "deviceId",
98864
+ form: "single",
98865
+ optional: false
98866
+ }],
98224
98867
  "deviceManager.setRole": [{
98225
98868
  name: "deviceId",
98226
98869
  form: "single",
@@ -98501,6 +99144,11 @@ Object.freeze({
98501
99144
  form: "single",
98502
99145
  optional: false
98503
99146
  }],
99147
+ "fanControl.setOscillationAxis": [{
99148
+ name: "deviceId",
99149
+ form: "single",
99150
+ optional: false
99151
+ }],
98504
99152
  "fanControl.setPercentage": [{
98505
99153
  name: "deviceId",
98506
99154
  form: "single",
@@ -101689,7 +102337,9 @@ var TimelapseRuleInputSchema = object({
101689
102337
  /** Classes the notification counts — see {@link ReportClassesField}. */
101690
102338
  reportClasses: ReportClassesField.optional(),
101691
102339
  /** Canonical notification priority ordinal (1..5); per-target overridable. */
101692
- priority: PriorityField.default(3)
102340
+ priority: PriorityField.default(3),
102341
+ /** Per-target settings keyed by target id (D1032) — absent = every target follows the rule. */
102342
+ targetOverrides: NcTargetOverridesSchema.optional()
101693
102343
  });
101694
102344
  object({
101695
102345
  name: NameField.optional(),
@@ -101705,7 +102355,9 @@ object({
101705
102355
  previewText: PreviewTextField.optional(),
101706
102356
  previewMode: PreviewModeField.optional(),
101707
102357
  reportClasses: ReportClassesField.optional(),
101708
- priority: PriorityField.optional()
102358
+ priority: PriorityField.optional(),
102359
+ /** Per-target settings keyed by target id (D1032) — absent = every target follows the rule. */
102360
+ targetOverrides: NcTargetOverridesSchema.optional()
101709
102361
  });
101710
102362
  TimelapseRuleInputSchema.extend({
101711
102363
  id: string(),
@@ -126885,7 +127537,7 @@ function mapHmChannel(channelType) {
126885
127537
  capabilities: ["cover"]
126886
127538
  };
126887
127539
  case "HEATING_CLIMATECONTROL_TRANSCEIVER": return {
126888
- deviceType: DeviceType.Thermostat,
127540
+ deviceType: DeviceType.Climate,
126889
127541
  role: null,
126890
127542
  capabilities: [
126891
127543
  "climate-control",
@@ -126924,12 +127576,12 @@ function mapHmChannel(channelType) {
126924
127576
  * from the union of its channel mappings. Actuators win over sensors so
126925
127577
  * a switch + energy-meter device (HmIP-BSM) reports as a Switch, not a
126926
127578
  * Sensor, and a thermostat with a humidity sensor reports as a
126927
- * Thermostat. A remote/wall-switch is primarily an EventEmitter: it is
127579
+ * Climate device (D1033). A remote/wall-switch is primarily an EventEmitter: it is
126928
127580
  * ranked above Sensor so its battery / maintenance sensor channels don't
126929
127581
  * win the parent type. Returns `DeviceType.Generic` when no channel maps.
126930
127582
  */
126931
127583
  var PARENT_TYPE_PRIORITY = [
126932
- DeviceType.Thermostat,
127584
+ DeviceType.Climate,
126933
127585
  DeviceType.Lock,
126934
127586
  DeviceType.Cover,
126935
127587
  DeviceType.Light,
@@ -127113,7 +127765,7 @@ function actuatorInfo(kind) {
127113
127765
  case "climate": return {
127114
127766
  kind: "climate",
127115
127767
  capName: "climate-control",
127116
- type: DeviceType.Thermostat
127768
+ type: DeviceType.Climate
127117
127769
  };
127118
127770
  default: return null;
127119
127771
  }
@@ -127123,13 +127775,28 @@ function actuatorInfo(kind) {
127123
127775
  * tilt), a plain `cover` entity is the roller shutter (HmIP-BROLL). Exporters
127124
127776
  * read it; every other actuator has no role.
127125
127777
  */
127126
- function actuatorRole(kind) {
127778
+ function actuatorRole(kind, model) {
127127
127779
  if (kind === "blind") return DeviceRole.CoverBlind;
127128
127780
  if (kind === "cover") return DeviceRole.CoverShutter;
127781
+ if (kind === "climate") return climateRoleOfModel(model);
127129
127782
  return null;
127130
127783
  }
127784
+ /** Radiator valves: HmIP-eTRV-* and the classic HM-CC-RT-DN. */
127785
+ var RADIATOR_MODEL = /eTRV|HM-CC-RT-DN/i;
127786
+ /** Floor-heating actuators: HmIP-FAL* / HmIP-FALMOT-*. */
127787
+ var FLOOR_MODEL = /FAL/i;
127788
+ /**
127789
+ * D1033 — which climate device a Homematic model is. A radiator valve and a
127790
+ * floor-heating actuator are told apart by model; a wall thermostat, a
127791
+ * heating group and an unknown model are thermostats.
127792
+ */
127793
+ function climateRoleOfModel(model) {
127794
+ if (model !== void 0 && RADIATOR_MODEL.test(model)) return DeviceRole.ClimateRadiator;
127795
+ if (model !== void 0 && FLOOR_MODEL.test(model)) return DeviceRole.ClimateFloor;
127796
+ return DeviceRole.ClimateThermostat;
127797
+ }
127131
127798
  /** Actuator specs from the library's typed custom entities (correct channel). */
127132
- function deriveActuatorSpecs(customEntities) {
127799
+ function deriveActuatorSpecs(customEntities, model) {
127133
127800
  const out = [];
127134
127801
  for (const entity of customEntities) {
127135
127802
  const info = actuatorInfo(entity.kind);
@@ -127137,7 +127804,7 @@ function deriveActuatorSpecs(customEntities) {
127137
127804
  out.push({
127138
127805
  key: `act-${entity.channel}`,
127139
127806
  deviceType: info.type,
127140
- role: actuatorRole(entity.kind),
127807
+ role: actuatorRole(entity.kind, model),
127141
127808
  capabilities: [info.capName],
127142
127809
  name: `${entity.kind} ${entity.channel}`,
127143
127810
  config: {
@@ -127237,7 +127904,7 @@ function deriveUpdateSpec(device) {
127237
127904
  */
127238
127905
  function deriveHmEntitySpecs(device, customEntities) {
127239
127906
  return [
127240
- ...deriveActuatorSpecs(customEntities),
127907
+ ...deriveActuatorSpecs(customEntities, device.type),
127241
127908
  ...deriveSensorAndEventSpecs(device),
127242
127909
  ...deriveDiagnosticSpecs(device, device.address),
127243
127910
  ...deriveUpdateSpec(device)