@camstack/types 1.2.548 → 1.2.549

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.
Files changed (70) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/addon.js +5 -5
  3. package/dist/addon.mjs +5 -5
  4. package/dist/capabilities/accessories.cap.d.ts +1 -1
  5. package/dist/capabilities/battery.cap.d.ts +2 -2
  6. package/dist/capabilities/capability-definition.d.ts +47 -1
  7. package/dist/capabilities/climate-control.cap.d.ts +8 -1
  8. package/dist/capabilities/core-blocks.cap.d.ts +2 -0
  9. package/dist/capabilities/customize-catalog.d.ts +3 -1
  10. package/dist/capabilities/customize-spec.d.ts +26 -2
  11. package/dist/capabilities/device-manager.cap.d.ts +6 -0
  12. package/dist/capabilities/fan-control.cap.d.ts +248 -0
  13. package/dist/capabilities/fan-presets.cap.d.ts +172 -536
  14. package/dist/capabilities/group-active.cap.d.ts +1 -1
  15. package/dist/capabilities/group-commands.cap.d.ts +1 -1
  16. package/dist/capabilities/group-status.cap.d.ts +1 -1
  17. package/dist/capabilities/heating-valve.cap.d.ts +1 -1
  18. package/dist/capabilities/hero-layout.cap.d.ts +2 -0
  19. package/dist/capabilities/humidifier.cap.d.ts +5 -0
  20. package/dist/capabilities/humidity-sensor.cap.d.ts +1 -1
  21. package/dist/capabilities/index.d.ts +4 -4
  22. package/dist/capabilities/media-player.cap.d.ts +7 -0
  23. package/dist/capabilities/pet-fountain.cap.d.ts +5 -0
  24. package/dist/capabilities/power-meter.cap.d.ts +5 -5
  25. package/dist/capabilities/power-source.cap.d.ts +5 -0
  26. package/dist/capabilities/running-state.cap.d.ts +2 -2
  27. package/dist/capabilities/switch.cap.d.ts +1 -1
  28. package/dist/capabilities/temperature-sensor.cap.d.ts +1 -1
  29. package/dist/capabilities/timed-run.cap.d.ts +19 -5
  30. package/dist/capabilities/water-heater.cap.d.ts +7 -0
  31. package/dist/client.js +7 -11
  32. package/dist/client.mjs +7 -11
  33. package/dist/{composed-stable-id-DrGLxjVF.js → composed-stable-id-CDNLq7Y8.js} +27 -10
  34. package/dist/{composed-stable-id-DFNyOFzz.mjs → composed-stable-id-CPp3votu.mjs} +27 -10
  35. package/dist/composition/composition-report.d.ts +6 -0
  36. package/dist/composition/evaluate-field.d.ts +7 -0
  37. package/dist/composition/field-kinds.d.ts +12 -1
  38. package/dist/composition/helpers/index.d.ts +1 -1
  39. package/dist/composition/helpers/source-pick.d.ts +0 -5
  40. package/dist/composition/power-source-link.d.ts +15 -0
  41. package/dist/composition/state-fields.d.ts +2 -0
  42. package/dist/composition/validate-composition.d.ts +15 -1
  43. package/dist/device/base-device-provider.d.ts +13 -0
  44. package/dist/device/device-control-resolution.d.ts +1 -33
  45. package/dist/device/device-kind.d.ts +36 -0
  46. package/dist/device/device-management.d.ts +3 -0
  47. package/dist/device/device-type.d.ts +27 -10
  48. package/dist/device/hero/hero-fragment.d.ts +2 -0
  49. package/dist/device/hero/hero-layout.d.ts +1 -3
  50. package/dist/device/hero/hero-look.d.ts +18 -12
  51. package/dist/device/hero/hero-scene.d.ts +9 -3
  52. package/dist/device/index.d.ts +2 -1
  53. package/dist/device/power-switch.d.ts +82 -0
  54. package/dist/device/schema-fields.d.ts +10 -1
  55. package/dist/generated/addon-api.d.ts +7 -0
  56. package/dist/generated/cap-input-defaults.d.ts +1 -1
  57. package/dist/generated/collection-array-methods.d.ts +1 -1
  58. package/dist/generated/customize-catalog.d.ts +257 -8
  59. package/dist/generated/method-access-map.d.ts +1 -1
  60. package/dist/generated/method-device-selectors.d.ts +1 -1
  61. package/dist/{implemented-methods-M5aguGon.mjs → implemented-methods-5YMDeE3f.mjs} +1 -1
  62. package/dist/{implemented-methods-8AU92riC.js → implemented-methods-Cj65uy2F.js} +1 -1
  63. package/dist/index.d.ts +7 -4
  64. package/dist/index.js +1275 -409
  65. package/dist/index.mjs +1244 -403
  66. package/dist/node.js +2 -2
  67. package/dist/node.mjs +2 -2
  68. package/dist/{sleep-D_NpiLFP.mjs → sleep-Bn346wCJ.mjs} +46 -1
  69. package/dist/{sleep-vzHEmsrO.js → sleep-LFKpQ2_f.js} +46 -1
  70. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_sleep = require("./sleep-vzHEmsrO.js");
2
+ const require_sleep = require("./sleep-LFKpQ2_f.js");
3
3
  const require_event_category = require("./event-category-BC4RRerT.js");
4
- const require_composed_stable_id = require("./composed-stable-id-DrGLxjVF.js");
5
- const require_implemented_methods = require("./implemented-methods-8AU92riC.js");
4
+ const require_composed_stable_id = require("./composed-stable-id-CDNLq7Y8.js");
5
+ const require_implemented_methods = require("./implemented-methods-Cj65uy2F.js");
6
6
  const require_node_color = require("./node-color.js");
7
7
  const require_convert = require("./convert-BmtM6K-5.js");
8
8
  const require_enums = require("./enums.js");
@@ -31187,16 +31187,39 @@ function metaQuantity(schema) {
31187
31187
  function quantityOfField(schema) {
31188
31188
  return metaQuantity(schema) ?? metaQuantity(unwrapSchema(schema));
31189
31189
  }
31190
+ function scalarKind(schema) {
31191
+ const s = unwrapSchema(schema);
31192
+ if (s instanceof zod.z.ZodNumber) return "number";
31193
+ if (s instanceof zod.z.ZodString) return "string";
31194
+ if (s instanceof zod.z.ZodBoolean) return "boolean";
31195
+ return null;
31196
+ }
31197
+ /** A union is a leaf only when EVERY member is a scalar; one object or array member keeps it out. */
31198
+ function unionMembersOf(s) {
31199
+ const members = [];
31200
+ for (const option of s.options) {
31201
+ if (!(option instanceof zod.z.ZodType)) return null;
31202
+ const kind = scalarKind(option);
31203
+ if (kind === null) return null;
31204
+ if (!members.includes(kind)) members.push(kind);
31205
+ }
31206
+ return members.length > 0 ? members : null;
31207
+ }
31190
31208
  function leafKind(schema) {
31191
31209
  const s = unwrapSchema(schema);
31192
31210
  if (s instanceof zod.z.ZodEnum) return {
31193
31211
  kind: "enum",
31194
31212
  enumValues: s.options
31195
31213
  };
31196
- if (s instanceof zod.z.ZodNumber) return { kind: "number" };
31197
- if (s instanceof zod.z.ZodString) return { kind: "string" };
31198
- if (s instanceof zod.z.ZodBoolean) return { kind: "boolean" };
31199
- return null;
31214
+ if (s instanceof zod.z.ZodUnion) {
31215
+ const members = unionMembersOf(s);
31216
+ return members === null ? null : {
31217
+ kind: "union",
31218
+ unionMembers: members
31219
+ };
31220
+ }
31221
+ const scalar = scalarKind(s);
31222
+ return scalar === null ? null : { kind: scalar };
31200
31223
  }
31201
31224
  /** Walk a cap status schema into flat wireable leaf fields (dotted paths).
31202
31225
  * Recurses into nested ZodObject (unwrapping nullable/optional/default first),
@@ -31221,6 +31244,7 @@ function enumerateSchemaFields(schema, prefix = "") {
31221
31244
  path,
31222
31245
  kind: leaf.kind,
31223
31246
  ...leaf.enumValues ? { enumValues: leaf.enumValues } : {},
31247
+ ...leaf.unionMembers ? { unionMembers: leaf.unionMembers } : {},
31224
31248
  ...quantity !== void 0 ? { quantity } : {}
31225
31249
  });
31226
31250
  }
@@ -37932,7 +37956,7 @@ var accessoriesCapability = {
37932
37956
  require_composed_stable_id.DeviceType.Switch,
37933
37957
  require_composed_stable_id.DeviceType.Light,
37934
37958
  require_composed_stable_id.DeviceType.Sensor,
37935
- require_composed_stable_id.DeviceType.Thermostat,
37959
+ require_composed_stable_id.DeviceType.Climate,
37936
37960
  require_composed_stable_id.DeviceType.Cover,
37937
37961
  require_composed_stable_id.DeviceType.Lock,
37938
37962
  require_composed_stable_id.DeviceType.Fan,
@@ -41061,7 +41085,7 @@ var BATTERY_DEVICE_TYPES = [
41061
41085
  require_composed_stable_id.DeviceType.Switch,
41062
41086
  require_composed_stable_id.DeviceType.PetFeeder,
41063
41087
  require_composed_stable_id.DeviceType.Container,
41064
- require_composed_stable_id.DeviceType.Thermostat,
41088
+ require_composed_stable_id.DeviceType.Climate,
41065
41089
  require_composed_stable_id.DeviceType.EventEmitter
41066
41090
  ];
41067
41091
  /** Generic Customize target for the percentage reading (D936). */
@@ -43332,7 +43356,14 @@ var climateControlCapability = {
43332
43356
  scope: "device",
43333
43357
  deviceNative: true,
43334
43358
  mode: "singleton",
43335
- deviceTypes: [require_composed_stable_id.DeviceType.Thermostat, require_composed_stable_id.DeviceType.Climate],
43359
+ deviceTypes: [require_composed_stable_id.DeviceType.Climate],
43360
+ power: {
43361
+ kind: "mode",
43362
+ field: "mode",
43363
+ offValue: "off",
43364
+ set: "setMode",
43365
+ lastField: "lastActiveMode"
43366
+ },
43336
43367
  methods: {
43337
43368
  setMode: require_sleep.method(zod.z.object({
43338
43369
  deviceId: zod.z.number().int().nonnegative(),
@@ -43752,7 +43783,8 @@ function describeStateField(schema, path) {
43752
43783
  kind: leaf.kind,
43753
43784
  nullable: field.safeParse(null).success,
43754
43785
  required: !field.safeParse(void 0).success,
43755
- ...leaf.enumValues === void 0 ? {} : { enumValues: leaf.enumValues }
43786
+ ...leaf.enumValues === void 0 ? {} : { enumValues: leaf.enumValues },
43787
+ ...leaf.unionMembers === void 0 ? {} : { unionMembers: leaf.unionMembers }
43756
43788
  };
43757
43789
  }
43758
43790
  function describeTopLevelStateFields(schema) {
@@ -43875,6 +43907,7 @@ var CompositionProblemCodeSchema = zod.z.enum([
43875
43907
  "nested-field",
43876
43908
  "missing-field",
43877
43909
  "kind-mismatch",
43910
+ "source-kind-mismatch",
43878
43911
  "may-be-null",
43879
43912
  "source-missing",
43880
43913
  "source-unreadable",
@@ -43896,7 +43929,8 @@ var CompositionProblemCodeSchema = zod.z.enum([
43896
43929
  "command-method-unknown",
43897
43930
  "command-source-unknown",
43898
43931
  "command-input-unknown",
43899
- "command-input-missing"
43932
+ "command-input-missing",
43933
+ "power-source-is-actuator"
43900
43934
  ]);
43901
43935
  /** One refusal, named (D391). `path` points into the composition, e.g. `features[0].fields.temperature`. */
43902
43936
  var CompositionProblemSchema = zod.z.object({
@@ -45071,6 +45105,13 @@ var mediaPlayerCapability = {
45071
45105
  deviceNative: true,
45072
45106
  mode: "singleton",
45073
45107
  deviceTypes: [require_composed_stable_id.DeviceType.MediaPlayer],
45108
+ power: {
45109
+ kind: "methods",
45110
+ field: "state",
45111
+ offValues: ["off", "standby"],
45112
+ on: "turnOn",
45113
+ off: "turnOff"
45114
+ },
45074
45115
  methods: {
45075
45116
  turnOn: require_sleep.optionalMethod(deviceOnly, zod.z.void(), {
45076
45117
  kind: "mutation",
@@ -45205,7 +45246,7 @@ var mediaPlayerCapability = {
45205
45246
  //#region src/generated/customize-catalog.ts
45206
45247
  /**
45207
45248
  * Customize catalog, projected from every `*.cap.ts` `customize` block.
45208
- * 10 caps. Field keys are `runtimeState` paths. No Zod.
45249
+ * 11 caps. Field keys are `runtimeState` paths. No Zod.
45209
45250
  */
45210
45251
  var CAP_CUSTOMIZE_CATALOG = {
45211
45252
  "battery": {
@@ -45220,7 +45261,7 @@ var CAP_CUSTOMIZE_CATALOG = {
45220
45261
  require_composed_stable_id.DeviceType.Switch,
45221
45262
  require_composed_stable_id.DeviceType.PetFeeder,
45222
45263
  require_composed_stable_id.DeviceType.Container,
45223
- require_composed_stable_id.DeviceType.Thermostat,
45264
+ require_composed_stable_id.DeviceType.Climate,
45224
45265
  require_composed_stable_id.DeviceType.EventEmitter
45225
45266
  ],
45226
45267
  apply: "add",
@@ -45276,7 +45317,6 @@ var CAP_CUSTOMIZE_CATALOG = {
45276
45317
  require_composed_stable_id.DeviceType.Siren,
45277
45318
  require_composed_stable_id.DeviceType.Switch,
45278
45319
  require_composed_stable_id.DeviceType.Sensor,
45279
- require_composed_stable_id.DeviceType.Thermostat,
45280
45320
  require_composed_stable_id.DeviceType.Climate,
45281
45321
  require_composed_stable_id.DeviceType.Button,
45282
45322
  require_composed_stable_id.DeviceType.EventEmitter,
@@ -45304,7 +45344,6 @@ var CAP_CUSTOMIZE_CATALOG = {
45304
45344
  require_composed_stable_id.DeviceType.PetFountain,
45305
45345
  require_composed_stable_id.DeviceType.Dishwasher,
45306
45346
  require_composed_stable_id.DeviceType.Washer,
45307
- require_composed_stable_id.DeviceType.Heater,
45308
45347
  require_composed_stable_id.DeviceType.Dryer,
45309
45348
  require_composed_stable_id.DeviceType.Gateway,
45310
45349
  require_composed_stable_id.DeviceType.HeatPump
@@ -45438,6 +45477,247 @@ var CAP_CUSTOMIZE_CATALOG = {
45438
45477
  debounceMs: 2e3
45439
45478
  }]
45440
45479
  },
45480
+ "fan-control": {
45481
+ version: 1,
45482
+ targets: [
45483
+ {
45484
+ id: "horizontal-oscillating",
45485
+ cardinality: "scalar",
45486
+ deviceTypes: [require_composed_stable_id.DeviceType.Fan],
45487
+ apply: "replace",
45488
+ vocabularyCap: "fan-control",
45489
+ vocabularyStateField: "oscillating",
45490
+ sources: [{
45491
+ kind: "switch",
45492
+ transformKinds: ["identity"],
45493
+ transforms: [{ kind: "identity" }]
45494
+ }],
45495
+ sourceReport: { status: "assignment-status" },
45496
+ advancedExpression: false,
45497
+ section: "oscillation-axes",
45498
+ path: "oscillationAxes.horizontal.oscillating",
45499
+ valueKind: "boolean",
45500
+ nullable: true
45501
+ },
45502
+ {
45503
+ id: "horizontal-angle",
45504
+ cardinality: "scalar",
45505
+ deviceTypes: [require_composed_stable_id.DeviceType.Fan],
45506
+ apply: "replace",
45507
+ vocabularyCap: "fan-control",
45508
+ sources: [{
45509
+ kind: "numeric",
45510
+ transformKinds: ["identity"],
45511
+ transforms: [{ kind: "identity" }]
45512
+ }],
45513
+ sourceReport: { status: "assignment-status" },
45514
+ advancedExpression: false,
45515
+ section: "oscillation-axes",
45516
+ path: "oscillationAxes.horizontal.angle",
45517
+ valueKind: "number",
45518
+ nullable: true,
45519
+ companions: [
45520
+ {
45521
+ kind: "source-field",
45522
+ path: "oscillationAxes.horizontal.min",
45523
+ field: "min"
45524
+ },
45525
+ {
45526
+ kind: "source-field",
45527
+ path: "oscillationAxes.horizontal.max",
45528
+ field: "max"
45529
+ },
45530
+ {
45531
+ kind: "source-field",
45532
+ path: "oscillationAxes.horizontal.step",
45533
+ field: "step"
45534
+ }
45535
+ ]
45536
+ },
45537
+ {
45538
+ id: "horizontal-sweepFrom",
45539
+ cardinality: "scalar",
45540
+ deviceTypes: [require_composed_stable_id.DeviceType.Fan],
45541
+ apply: "replace",
45542
+ vocabularyCap: "fan-control",
45543
+ sources: [{
45544
+ kind: "numeric",
45545
+ transformKinds: ["identity"],
45546
+ transforms: [{ kind: "identity" }]
45547
+ }],
45548
+ sourceReport: { status: "assignment-status" },
45549
+ advancedExpression: false,
45550
+ section: "oscillation-axes",
45551
+ path: "oscillationAxes.horizontal.sweepFrom",
45552
+ valueKind: "number",
45553
+ nullable: true
45554
+ },
45555
+ {
45556
+ id: "horizontal-sweepTo",
45557
+ cardinality: "scalar",
45558
+ deviceTypes: [require_composed_stable_id.DeviceType.Fan],
45559
+ apply: "replace",
45560
+ vocabularyCap: "fan-control",
45561
+ sources: [{
45562
+ kind: "numeric",
45563
+ transformKinds: ["identity"],
45564
+ transforms: [{ kind: "identity" }]
45565
+ }],
45566
+ sourceReport: { status: "assignment-status" },
45567
+ advancedExpression: false,
45568
+ section: "oscillation-axes",
45569
+ path: "oscillationAxes.horizontal.sweepTo",
45570
+ valueKind: "number",
45571
+ nullable: true
45572
+ },
45573
+ {
45574
+ id: "vertical-oscillating",
45575
+ cardinality: "scalar",
45576
+ deviceTypes: [require_composed_stable_id.DeviceType.Fan],
45577
+ apply: "replace",
45578
+ vocabularyCap: "fan-control",
45579
+ vocabularyStateField: "oscillating",
45580
+ sources: [{
45581
+ kind: "switch",
45582
+ transformKinds: ["identity"],
45583
+ transforms: [{ kind: "identity" }]
45584
+ }],
45585
+ sourceReport: { status: "assignment-status" },
45586
+ advancedExpression: false,
45587
+ section: "oscillation-axes",
45588
+ path: "oscillationAxes.vertical.oscillating",
45589
+ valueKind: "boolean",
45590
+ nullable: true
45591
+ },
45592
+ {
45593
+ id: "vertical-angle",
45594
+ cardinality: "scalar",
45595
+ deviceTypes: [require_composed_stable_id.DeviceType.Fan],
45596
+ apply: "replace",
45597
+ vocabularyCap: "fan-control",
45598
+ sources: [{
45599
+ kind: "numeric",
45600
+ transformKinds: ["identity"],
45601
+ transforms: [{ kind: "identity" }]
45602
+ }],
45603
+ sourceReport: { status: "assignment-status" },
45604
+ advancedExpression: false,
45605
+ section: "oscillation-axes",
45606
+ path: "oscillationAxes.vertical.angle",
45607
+ valueKind: "number",
45608
+ nullable: true,
45609
+ companions: [
45610
+ {
45611
+ kind: "source-field",
45612
+ path: "oscillationAxes.vertical.min",
45613
+ field: "min"
45614
+ },
45615
+ {
45616
+ kind: "source-field",
45617
+ path: "oscillationAxes.vertical.max",
45618
+ field: "max"
45619
+ },
45620
+ {
45621
+ kind: "source-field",
45622
+ path: "oscillationAxes.vertical.step",
45623
+ field: "step"
45624
+ }
45625
+ ]
45626
+ },
45627
+ {
45628
+ id: "vertical-sweepFrom",
45629
+ cardinality: "scalar",
45630
+ deviceTypes: [require_composed_stable_id.DeviceType.Fan],
45631
+ apply: "replace",
45632
+ vocabularyCap: "fan-control",
45633
+ sources: [{
45634
+ kind: "numeric",
45635
+ transformKinds: ["identity"],
45636
+ transforms: [{ kind: "identity" }]
45637
+ }],
45638
+ sourceReport: { status: "assignment-status" },
45639
+ advancedExpression: false,
45640
+ section: "oscillation-axes",
45641
+ path: "oscillationAxes.vertical.sweepFrom",
45642
+ valueKind: "number",
45643
+ nullable: true
45644
+ },
45645
+ {
45646
+ id: "vertical-sweepTo",
45647
+ cardinality: "scalar",
45648
+ deviceTypes: [require_composed_stable_id.DeviceType.Fan],
45649
+ apply: "replace",
45650
+ vocabularyCap: "fan-control",
45651
+ sources: [{
45652
+ kind: "numeric",
45653
+ transformKinds: ["identity"],
45654
+ transforms: [{ kind: "identity" }]
45655
+ }],
45656
+ sourceReport: { status: "assignment-status" },
45657
+ advancedExpression: false,
45658
+ section: "oscillation-axes",
45659
+ path: "oscillationAxes.vertical.sweepTo",
45660
+ valueKind: "number",
45661
+ nullable: true
45662
+ },
45663
+ {
45664
+ id: "preset",
45665
+ cardinality: "scalar",
45666
+ deviceTypes: [require_composed_stable_id.DeviceType.Fan],
45667
+ apply: "replace",
45668
+ vocabularyCap: "fan-control",
45669
+ sources: [{
45670
+ kind: "field",
45671
+ valueKinds: ["string"],
45672
+ transformKinds: ["identity"],
45673
+ transforms: [{ kind: "identity" }]
45674
+ }],
45675
+ sourceReport: { status: "assignment-status" },
45676
+ advancedExpression: false,
45677
+ path: "preset",
45678
+ valueKind: "string",
45679
+ nullable: false
45680
+ }
45681
+ ],
45682
+ overridable: [
45683
+ {
45684
+ path: "oscillationAxes.horizontal.oscillating",
45685
+ by: "horizontal-oscillating"
45686
+ },
45687
+ {
45688
+ path: "oscillationAxes.horizontal.angle",
45689
+ by: "horizontal-angle"
45690
+ },
45691
+ {
45692
+ path: "oscillationAxes.horizontal.sweepFrom",
45693
+ by: "horizontal-sweepFrom"
45694
+ },
45695
+ {
45696
+ path: "oscillationAxes.horizontal.sweepTo",
45697
+ by: "horizontal-sweepTo"
45698
+ },
45699
+ {
45700
+ path: "oscillationAxes.vertical.oscillating",
45701
+ by: "vertical-oscillating"
45702
+ },
45703
+ {
45704
+ path: "oscillationAxes.vertical.angle",
45705
+ by: "vertical-angle"
45706
+ },
45707
+ {
45708
+ path: "oscillationAxes.vertical.sweepFrom",
45709
+ by: "vertical-sweepFrom"
45710
+ },
45711
+ {
45712
+ path: "oscillationAxes.vertical.sweepTo",
45713
+ by: "vertical-sweepTo"
45714
+ },
45715
+ {
45716
+ path: "preset",
45717
+ by: "preset"
45718
+ }
45719
+ ]
45720
+ },
45441
45721
  "fan-presets": {
45442
45722
  version: 1,
45443
45723
  targets: [{
@@ -45538,7 +45818,6 @@ var CAP_CUSTOMIZE_CATALOG = {
45538
45818
  require_composed_stable_id.DeviceType.Light,
45539
45819
  require_composed_stable_id.DeviceType.Fan,
45540
45820
  require_composed_stable_id.DeviceType.Climate,
45541
- require_composed_stable_id.DeviceType.Thermostat,
45542
45821
  require_composed_stable_id.DeviceType.Humidifier,
45543
45822
  require_composed_stable_id.DeviceType.WaterHeater,
45544
45823
  require_composed_stable_id.DeviceType.MediaPlayer,
@@ -45547,8 +45826,7 @@ var CAP_CUSTOMIZE_CATALOG = {
45547
45826
  require_composed_stable_id.DeviceType.Dishwasher,
45548
45827
  require_composed_stable_id.DeviceType.Vacuum,
45549
45828
  require_composed_stable_id.DeviceType.LawnMower,
45550
- require_composed_stable_id.DeviceType.PetFeeder,
45551
- require_composed_stable_id.DeviceType.Heater
45829
+ require_composed_stable_id.DeviceType.PetFeeder
45552
45830
  ],
45553
45831
  apply: "add",
45554
45832
  vocabularyCap: "power-meter",
@@ -45578,7 +45856,6 @@ var CAP_CUSTOMIZE_CATALOG = {
45578
45856
  require_composed_stable_id.DeviceType.Light,
45579
45857
  require_composed_stable_id.DeviceType.Fan,
45580
45858
  require_composed_stable_id.DeviceType.Climate,
45581
- require_composed_stable_id.DeviceType.Thermostat,
45582
45859
  require_composed_stable_id.DeviceType.Humidifier,
45583
45860
  require_composed_stable_id.DeviceType.WaterHeater,
45584
45861
  require_composed_stable_id.DeviceType.MediaPlayer,
@@ -45587,8 +45864,7 @@ var CAP_CUSTOMIZE_CATALOG = {
45587
45864
  require_composed_stable_id.DeviceType.Dishwasher,
45588
45865
  require_composed_stable_id.DeviceType.Vacuum,
45589
45866
  require_composed_stable_id.DeviceType.LawnMower,
45590
- require_composed_stable_id.DeviceType.PetFeeder,
45591
- require_composed_stable_id.DeviceType.Heater
45867
+ require_composed_stable_id.DeviceType.PetFeeder
45592
45868
  ],
45593
45869
  apply: "add",
45594
45870
  vocabularyCap: "power-meter",
@@ -45618,7 +45894,6 @@ var CAP_CUSTOMIZE_CATALOG = {
45618
45894
  require_composed_stable_id.DeviceType.Light,
45619
45895
  require_composed_stable_id.DeviceType.Fan,
45620
45896
  require_composed_stable_id.DeviceType.Climate,
45621
- require_composed_stable_id.DeviceType.Thermostat,
45622
45897
  require_composed_stable_id.DeviceType.Humidifier,
45623
45898
  require_composed_stable_id.DeviceType.WaterHeater,
45624
45899
  require_composed_stable_id.DeviceType.MediaPlayer,
@@ -45627,8 +45902,7 @@ var CAP_CUSTOMIZE_CATALOG = {
45627
45902
  require_composed_stable_id.DeviceType.Dishwasher,
45628
45903
  require_composed_stable_id.DeviceType.Vacuum,
45629
45904
  require_composed_stable_id.DeviceType.LawnMower,
45630
- require_composed_stable_id.DeviceType.PetFeeder,
45631
- require_composed_stable_id.DeviceType.Heater
45905
+ require_composed_stable_id.DeviceType.PetFeeder
45632
45906
  ],
45633
45907
  apply: "add",
45634
45908
  vocabularyCap: "power-meter",
@@ -45658,7 +45932,6 @@ var CAP_CUSTOMIZE_CATALOG = {
45658
45932
  require_composed_stable_id.DeviceType.Light,
45659
45933
  require_composed_stable_id.DeviceType.Fan,
45660
45934
  require_composed_stable_id.DeviceType.Climate,
45661
- require_composed_stable_id.DeviceType.Thermostat,
45662
45935
  require_composed_stable_id.DeviceType.Humidifier,
45663
45936
  require_composed_stable_id.DeviceType.WaterHeater,
45664
45937
  require_composed_stable_id.DeviceType.MediaPlayer,
@@ -45667,8 +45940,7 @@ var CAP_CUSTOMIZE_CATALOG = {
45667
45940
  require_composed_stable_id.DeviceType.Dishwasher,
45668
45941
  require_composed_stable_id.DeviceType.Vacuum,
45669
45942
  require_composed_stable_id.DeviceType.LawnMower,
45670
- require_composed_stable_id.DeviceType.PetFeeder,
45671
- require_composed_stable_id.DeviceType.Heater
45943
+ require_composed_stable_id.DeviceType.PetFeeder
45672
45944
  ],
45673
45945
  apply: "add",
45674
45946
  vocabularyCap: "power-meter",
@@ -45770,9 +46042,7 @@ var CAP_CUSTOMIZE_CATALOG = {
45770
46042
  require_composed_stable_id.DeviceType.Humidifier,
45771
46043
  require_composed_stable_id.DeviceType.Fan,
45772
46044
  require_composed_stable_id.DeviceType.Climate,
45773
- require_composed_stable_id.DeviceType.Thermostat,
45774
- require_composed_stable_id.DeviceType.PetFeeder,
45775
- require_composed_stable_id.DeviceType.Heater
46045
+ require_composed_stable_id.DeviceType.PetFeeder
45776
46046
  ],
45777
46047
  apply: "add",
45778
46048
  vocabularyCap: "running-state",
@@ -46091,12 +46361,37 @@ function readKinds(read, lookupCap) {
46091
46361
  code: "source-field-unknown",
46092
46362
  message: `\`${read.cap}\` has no field \`${read.fieldPath}\``
46093
46363
  };
46094
- const base = field.kind === "enum" ? "string" : field.kind;
46364
+ const bases = field.kind === "union" ? field.unionMembers ?? [] : [field.kind === "enum" ? "string" : field.kind];
46095
46365
  return {
46096
46366
  ok: true,
46097
- kinds: new Set(field.nullable ? [base, "null"] : [base])
46367
+ kinds: new Set(field.nullable ? [...bases, "null"] : bases)
46098
46368
  };
46099
46369
  }
46370
+ /** A union field is read as a source (D1034), never written: no single kind to check a source against. */
46371
+ function unionTargetProblem(cap, path, at) {
46372
+ return problem("kind-mismatch", at, `\`${cap}.${path}\` is a union — it is read as a source, never written`);
46373
+ }
46374
+ /** The one value kind a target field accepts. */
46375
+ function acceptedKind(target) {
46376
+ if (target.kind === "union") return null;
46377
+ return target.kind === "enum" ? "string" : target.kind;
46378
+ }
46379
+ /**
46380
+ * A direct read of a UNION source field (D1034) is judged by the member that
46381
+ * fits the target: when one does, the read produces that kind only (a reading
46382
+ * of another kind is UNAVAILABLE at read time, never a coerced value); when
46383
+ * none does, the kinds stay as they are and `compatibility` names the mismatch.
46384
+ */
46385
+ function narrowUnionRead(source, target, kinds, lookupCap) {
46386
+ if (source.kind !== "from") return kinds;
46387
+ const def = lookupCap(source.cap);
46388
+ const schema = def?.runtimeState ?? def?.status?.schema;
46389
+ if (schema === void 0) return kinds;
46390
+ const field = describeStateField(schema, source.fieldPath);
46391
+ const accepted = acceptedKind(target);
46392
+ if (field?.kind !== "union" || accepted === null || !kinds.has(accepted)) return kinds;
46393
+ return new Set(kinds.has("null") ? [accepted, "null"] : [accepted]);
46394
+ }
46100
46395
  function sourceKinds(source, lookupCap) {
46101
46396
  if (source.kind === "from") return readKinds(source, lookupCap);
46102
46397
  if (source.kind === "code") return {
@@ -46133,7 +46428,8 @@ function sourceKinds(source, lookupCap) {
46133
46428
  };
46134
46429
  }
46135
46430
  function compatibility(cap, target, kinds, at) {
46136
- const allowed = target.kind === "enum" ? "string" : target.kind;
46431
+ const allowed = acceptedKind(target);
46432
+ if (allowed === null) return [unionTargetProblem(cap, target.path, at)];
46137
46433
  const offending = [...kinds].filter((k) => k !== "null" && k !== allowed);
46138
46434
  const problems = [];
46139
46435
  if (offending.length > 0) problems.push(problem("kind-mismatch", at, `\`${cap}.${target.path}\` is a ${target.kind}; this source can produce ${offending.join(" or ")}`));
@@ -46244,6 +46540,7 @@ function planItemField(ctx, leaf) {
46244
46540
  if (ctx.reserved.has(path)) return refused(problem("item-field-reserved", at, `\`${capName}.${itemArray.path}[].${path}\` is set by the composer itself — it takes no source`));
46245
46541
  const tf = describeStateField(itemArray.itemSchema, path);
46246
46542
  if (tf === null) return refused(problem("unknown-field", at, `a \`${capName}\` item has no field \`${path}\``));
46543
+ if (tf.kind === "union") return refused(unionTargetProblem(capName, path, at));
46247
46544
  const kinds = sourceKinds(source, lookupCap);
46248
46545
  if (!kinds.ok) return refused(problem(kinds.code, at, kinds.message));
46249
46546
  const role = roleOf(source);
@@ -46269,7 +46566,7 @@ function planItemField(ctx, leaf) {
46269
46566
  };
46270
46567
  const enumProblem = enumLiteralProblem(capName, tf, source, at);
46271
46568
  return {
46272
- problems: [...compatibility(capName, tf, kinds.kinds, at), ...enumProblem === null ? [] : [enumProblem]],
46569
+ problems: [...compatibility(capName, tf, narrowUnionRead(source, tf, kinds.kinds, lookupCap), at), ...enumProblem === null ? [] : [enumProblem]],
46273
46570
  fields: [plan],
46274
46571
  features: [],
46275
46572
  events: []
@@ -46501,7 +46798,7 @@ function numeric(input) {
46501
46798
  }, ...alsoFrom === void 0 ? [] : [alsoFrom.accept]]
46502
46799
  };
46503
46800
  }
46504
- var CLIMATE_DEVICES = [require_composed_stable_id.DeviceType.Thermostat, require_composed_stable_id.DeviceType.Climate];
46801
+ var CLIMATE_DEVICES = [require_composed_stable_id.DeviceType.Climate];
46505
46802
  function binary(input) {
46506
46803
  return {
46507
46804
  ...input,
@@ -46823,8 +47120,8 @@ var GROUP_TEMPLATES = [
46823
47120
  actuator({
46824
47121
  id: "climate",
46825
47122
  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.",
46826
- deviceType: require_composed_stable_id.DeviceType.Thermostat,
46827
- memberDeviceTypes: [require_composed_stable_id.DeviceType.Thermostat, require_composed_stable_id.DeviceType.Climate],
47123
+ deviceType: require_composed_stable_id.DeviceType.Climate,
47124
+ memberDeviceTypes: [require_composed_stable_id.DeviceType.Climate],
46828
47125
  outputCap: "group-active",
46829
47126
  outputField: "active",
46830
47127
  member: {
@@ -48288,6 +48585,233 @@ function findCandidateCycles(candidate, stored) {
48288
48585
  });
48289
48586
  }
48290
48587
  //#endregion
48588
+ //#region src/capabilities/power-source.cap.ts
48589
+ /**
48590
+ * power-source — a device that hangs is powered by a smart switch, and the
48591
+ * operator picks that switch in the device's Customize. The device then offers
48592
+ * power on, power off and a forced restart (switch off, wait, switch on).
48593
+ *
48594
+ * Manual by default: nothing here restarts a device by itself. The one
48595
+ * exception (D997) is a device's OWN provider calling `forceRestart` for its own
48596
+ * device as a bounded self-recovery (unreachable for a long stretch, linked,
48597
+ * one attempt per cooldown, never with a live session); Velux is the first. It
48598
+ * is not the native `reboot` cap and never replaces or wraps it: `reboot` talks
48599
+ * to the device, this cuts the power of the device that no longer answers.
48600
+ *
48601
+ * The link is a Customize extension (`add`): one scalar target whose source is
48602
+ * the switch. The stored composition is the ONE copy of the link and of
48603
+ * `offSeconds` (`powerSourceLinkOfComposition`, D676); the composed slice only
48604
+ * mirrors the switch state for the UI. The methods are served by the
48605
+ * `core-blocks` system provider, so they are `systemMethod`s and carry a
48606
+ * top-level `deviceId`.
48607
+ *
48608
+ * Every action answers a typed result and never throws for an expected
48609
+ * refusal, so a caller tells "the switch is offline" from "a restart is
48610
+ * already running" without parsing text.
48611
+ */
48612
+ /** Bounds of the off time of a forced restart, in seconds. */
48613
+ var POWER_SOURCE_OFF_SECONDS_MIN = 3;
48614
+ var POWER_SOURCE_OFF_SECONDS_MAX = 120;
48615
+ var POWER_SOURCE_OFF_SECONDS_DEFAULT = 10;
48616
+ var PowerSourceRefusalReasonSchema = zod.z.enum([
48617
+ "no-power-source",
48618
+ "switch-missing",
48619
+ "switch-offline",
48620
+ "switch-unknown",
48621
+ "restart-in-progress",
48622
+ "switch-call-failed",
48623
+ "switch-is-actuator"
48624
+ ]);
48625
+ var PowerSourceActionResultSchema = zod.z.discriminatedUnion("accepted", [zod.z.object({ accepted: zod.z.literal(true) }), zod.z.object({
48626
+ accepted: zod.z.literal(false),
48627
+ reason: PowerSourceRefusalReasonSchema,
48628
+ /** One line for the operator, naming the switch. */
48629
+ message: zod.z.string()
48630
+ })]);
48631
+ var PowerSourceInfoSchema = zod.z.object({
48632
+ /** False when the device has no power source linked; the rest is then empty. */
48633
+ linked: zod.z.boolean(),
48634
+ switchDeviceId: zod.z.number().nullable(),
48635
+ switchName: zod.z.string().nullable(),
48636
+ /** The switch's on/off state, or null when it is unknown. Never false for unknown (D393). */
48637
+ switchOn: zod.z.boolean().nullable(),
48638
+ switchOnline: zod.z.boolean().nullable(),
48639
+ restartInProgress: zod.z.boolean(),
48640
+ offSeconds: zod.z.number().int()
48641
+ });
48642
+ /** The composed slice: the switch state the link mirrors, plus the stored off time. */
48643
+ var PowerSourceStateSchema = zod.z.object({
48644
+ /** Null while the switch has not reported: unknown is never `false` (D393). */
48645
+ switchOn: zod.z.boolean().nullable(),
48646
+ offSeconds: zod.z.number().int(),
48647
+ lastFetchedAt: zod.z.number()
48648
+ });
48649
+ var POWER_SOURCE_DEVICE_TYPES = [
48650
+ require_composed_stable_id.DeviceType.Gateway,
48651
+ require_composed_stable_id.DeviceType.Camera,
48652
+ require_composed_stable_id.DeviceType.Sensor,
48653
+ require_composed_stable_id.DeviceType.MediaPlayer,
48654
+ require_composed_stable_id.DeviceType.Vacuum,
48655
+ require_composed_stable_id.DeviceType.Generic,
48656
+ require_composed_stable_id.DeviceType.Washer,
48657
+ require_composed_stable_id.DeviceType.Dryer,
48658
+ require_composed_stable_id.DeviceType.Dishwasher,
48659
+ require_composed_stable_id.DeviceType.PetFountain,
48660
+ require_composed_stable_id.DeviceType.Fan,
48661
+ require_composed_stable_id.DeviceType.Humidifier,
48662
+ require_composed_stable_id.DeviceType.Climate,
48663
+ require_composed_stable_id.DeviceType.WaterHeater
48664
+ ];
48665
+ var powerSourceCustomize = {
48666
+ version: 1,
48667
+ targets: [{
48668
+ id: "switch",
48669
+ cardinality: "scalar",
48670
+ vocabulary: {
48671
+ cap: "power-source",
48672
+ stateField: "switchOn"
48673
+ },
48674
+ deviceTypes: POWER_SOURCE_DEVICE_TYPES,
48675
+ apply: "add",
48676
+ path: "switchOn",
48677
+ sources: [{
48678
+ kind: "switch",
48679
+ transforms: [{ kind: "identity" }]
48680
+ }],
48681
+ companions: [{
48682
+ kind: "constant",
48683
+ path: "offSeconds",
48684
+ value: 10,
48685
+ when: "add",
48686
+ formerValues: [0]
48687
+ }, {
48688
+ kind: "clock",
48689
+ path: "lastFetchedAt",
48690
+ when: "always"
48691
+ }],
48692
+ sourceReport: { status: "assignment-status" }
48693
+ }]
48694
+ };
48695
+ var deviceInput$2 = zod.z.object({ deviceId: zod.z.number().int().nonnegative() });
48696
+ var powerSourceCapability = {
48697
+ name: "power-source",
48698
+ scope: "device",
48699
+ mode: "singleton",
48700
+ deviceTypes: POWER_SOURCE_DEVICE_TYPES,
48701
+ methods: {
48702
+ getStatus: require_sleep.systemMethod(deviceInput$2, PowerSourceInfoSchema, { auth: "protected" }),
48703
+ powerOn: require_sleep.systemMethod(deviceInput$2, PowerSourceActionResultSchema, {
48704
+ kind: "mutation",
48705
+ auth: "protected"
48706
+ }),
48707
+ powerOff: require_sleep.systemMethod(deviceInput$2, PowerSourceActionResultSchema, {
48708
+ kind: "mutation",
48709
+ auth: "protected"
48710
+ }),
48711
+ forceRestart: require_sleep.systemMethod(deviceInput$2, PowerSourceActionResultSchema, {
48712
+ kind: "mutation",
48713
+ auth: "protected"
48714
+ })
48715
+ },
48716
+ runtimeState: PowerSourceStateSchema,
48717
+ customize: powerSourceCustomize,
48718
+ /**
48719
+ * Runtime-state durability: **session** — mirrored from the linked switch on
48720
+ * its next report; a restored value would outlive the reading it names.
48721
+ *
48722
+ * See `RuntimeStateDurability`. Enforced by
48723
+ * `scripts/check-runtime-state-durability.ts`.
48724
+ */
48725
+ durability: "session",
48726
+ history: "none"
48727
+ };
48728
+ //#endregion
48729
+ //#region src/composition/power-source-link.ts
48730
+ /**
48731
+ * Which smart switch powers a device (the `power-source` Customize extension):
48732
+ * the source its stored `power-source.switchOn` field reads, and the off time of
48733
+ * a forced restart stored beside it. Read from the STORED composition, never kept
48734
+ * as a second copy (D676). Shared by the hub (which acts on the switch) and the
48735
+ * admin UI (which shows it).
48736
+ */
48737
+ /**
48738
+ * The stored off time, or the default when none is stored. A stored number out
48739
+ * of range is CLAMPED to the bounds (a hand-written value never refuses the
48740
+ * link, it just cannot cut power for an absurd time); a non-integer is rounded.
48741
+ */
48742
+ function normalizeOffSeconds(value) {
48743
+ if (typeof value !== "number" || !Number.isFinite(value)) return 10;
48744
+ return Math.min(120, Math.max(3, Math.round(value)));
48745
+ }
48746
+ /** The constant a stored `offSeconds` field carries, or undefined when it is not a literal number. */
48747
+ function storedOffSeconds(composition) {
48748
+ const feature = composition.features.find((f) => f.cap === "power-source");
48749
+ if (feature === void 0 || feature.kind !== "fields") return void 0;
48750
+ const field = feature.fields["offSeconds"];
48751
+ if (field === void 0 || field.kind !== "expression") return void 0;
48752
+ const n = Number(field.expr);
48753
+ return field.expr.trim() === "" || !Number.isFinite(n) ? void 0 : n;
48754
+ }
48755
+ /**
48756
+ * The link a composition stores. An `existing` target names its own device; a
48757
+ * `new` target (a composed device) is the composer's own device, so the caller
48758
+ * passes the block id and a new-target composition without one has no link.
48759
+ */
48760
+ function powerSourceLinkOfComposition(composition, blockId) {
48761
+ if (composition === null) return null;
48762
+ let device;
48763
+ if (composition.target.kind === "existing") device = composition.target.device;
48764
+ else if (blockId !== void 0) device = require_implemented_methods.composedDeviceRef(blockId);
48765
+ else return null;
48766
+ const feature = composition.features.find((f) => f.cap === "power-source");
48767
+ if (feature === void 0 || feature.kind !== "fields" || feature.enabled === false) return null;
48768
+ const field = feature.fields["switchOn"];
48769
+ if (field === void 0) return null;
48770
+ const read = require_implemented_methods.fieldReads(field).find((r) => r.cap === "switch");
48771
+ if (read === void 0) return null;
48772
+ return {
48773
+ device,
48774
+ switch: read.source,
48775
+ offSeconds: normalizeOffSeconds(storedOffSeconds(composition))
48776
+ };
48777
+ }
48778
+ var ACTUATOR_CAP = "switch";
48779
+ /**
48780
+ * The devices that ACT for this composition: the device itself when it is an
48781
+ * existing one, and every source its own `switch` feature reads or forwards a
48782
+ * command to (a heater's plug, every member of a switch group).
48783
+ */
48784
+ function actuatorKeys(composition) {
48785
+ const keys = /* @__PURE__ */ new Set();
48786
+ if (composition.target.kind === "existing") keys.add(require_implemented_methods.compositionSourceKey(composition.target.device));
48787
+ composition.features.forEach((feature, index) => {
48788
+ if (feature.kind !== "fields" || feature.cap !== ACTUATOR_CAP) return;
48789
+ if (!require_implemented_methods.compositionFeatureEnabled(feature)) return;
48790
+ for (const source of require_implemented_methods.featureSources(feature)) for (const read of require_implemented_methods.fieldReads(source)) keys.add(require_implemented_methods.compositionSourceKey(read.source));
48791
+ for (const forward of featureForwards(feature, index)) keys.add(require_implemented_methods.compositionSourceKey(forward.command.source));
48792
+ });
48793
+ return keys;
48794
+ }
48795
+ /**
48796
+ * The supply plug is never one of the device's own actuators (#462): cutting
48797
+ * power through the switch that IS the device's on/off leaves nothing to
48798
+ * restart, and makes "power off" and "turn off" the same press. Refused at save
48799
+ * time (`power-source-is-actuator`) and again by the power-source provider for a
48800
+ * link stored before this check existed (`switch-is-actuator`).
48801
+ */
48802
+ function powerSourceActuatorConflicts(composition) {
48803
+ const index = composition.features.findIndex((f) => f.cap === "power-source");
48804
+ const feature = composition.features[index];
48805
+ if (feature === void 0 || feature.kind !== "fields" || feature.enabled === false) return [];
48806
+ const field = feature.fields["switchOn"];
48807
+ if (field === void 0) return [];
48808
+ const actuators = actuatorKeys(composition);
48809
+ return require_implemented_methods.fieldReads(field).filter((read) => read.cap === ACTUATOR_CAP && actuators.has(require_implemented_methods.compositionSourceKey(read.source))).map((read) => ({
48810
+ path: `features[${index}].fields.switchOn`,
48811
+ switch: read.source
48812
+ }));
48813
+ }
48814
+ //#endregion
48291
48815
  //#region src/composition/validate-composition.ts
48292
48816
  function buildCapabilityLookup(defs) {
48293
48817
  const byName = new Map(defs.map((d) => [d.name, d]));
@@ -48349,12 +48873,25 @@ function builtCapProblems({ def, state, fields: targetFields }, feature, at, dev
48349
48873
  }
48350
48874
  return problems;
48351
48875
  }
48352
- function planTopLevelField({ def, fields }, field, mode, lookupCap) {
48876
+ /**
48877
+ * A dotted leaf is planned only on a `replace` (D1034): the feature already
48878
+ * passed `overridesOnlyDeclared`, so the leaf is one the cap lists in its
48879
+ * `overridable`, and the hub sets it into the native object. Anywhere else a
48880
+ * nested field is still refused.
48881
+ */
48882
+ function stateFieldOf({ fields, state }, path, mode) {
48883
+ if (!path.includes(".")) return fields.get(path);
48884
+ if (mode !== "replace") return "nested";
48885
+ return describeStateField(state, path) ?? void 0;
48886
+ }
48887
+ function planTopLevelField(cap, field, mode, lookupCap) {
48888
+ const { def } = cap;
48353
48889
  const { featureIndex, path, source } = field;
48354
48890
  const fieldAt = `features[${featureIndex}].fields.${path}`;
48355
- if (path.includes(".")) return refused(problem("nested-field", fieldAt, `\`${path}\` is nested — nested fields arrive in a later slice`));
48356
- const tf = fields.get(path);
48891
+ const tf = stateFieldOf(cap, path, mode);
48892
+ if (tf === "nested") return refused(problem("nested-field", fieldAt, `\`${path}\` is nested — a nested field is planned only on a declared replace (D1034)`));
48357
48893
  if (tf === void 0) return refused(problem("unknown-field", fieldAt, `\`${def.name}\` has no field \`${path}\``));
48894
+ if (tf.kind === "union") return refused(unionTargetProblem(def.name, path, fieldAt));
48358
48895
  const kinds = sourceKinds(source, lookupCap);
48359
48896
  if (!kinds.ok) return refused(problem(kinds.code, fieldAt, kinds.message));
48360
48897
  const role = roleOf(source);
@@ -48375,7 +48912,7 @@ function planTopLevelField({ def, fields }, field, mode, lookupCap) {
48375
48912
  };
48376
48913
  const enumProblem = enumLiteralProblem(def.name, tf, source, fieldAt);
48377
48914
  return {
48378
- problems: [...compatibility(def.name, tf, kinds.kinds, fieldAt), ...enumProblem === null ? [] : [enumProblem]],
48915
+ problems: [...compatibility(def.name, tf, narrowUnionRead(source, tf, kinds.kinds, lookupCap), fieldAt), ...enumProblem === null ? [] : [enumProblem]],
48379
48916
  fields: [plan],
48380
48917
  features: [],
48381
48918
  events: []
@@ -48478,7 +49015,7 @@ var customizeCatalog = CAP_CUSTOMIZE_CATALOG;
48478
49015
  function overridesOnlyDeclared(feature) {
48479
49016
  const entry = customizeCatalog[feature.cap];
48480
49017
  const allowed = new Set((entry?.overridable ?? []).flatMap((o) => {
48481
- const companions = ((entry?.targets.find((t) => t.id === o.by && t.path === o.path))?.companions ?? []).filter((c) => c.kind === "transition-time" || c.when === "always");
49018
+ const companions = ((entry?.targets.find((t) => t.id === o.by && t.path === o.path))?.companions ?? []).filter((c) => c.kind === "transition-time" || c.kind === "source-field" || c.when === "always");
48482
49019
  return [o.path, ...companions.map((c) => c.path)];
48483
49020
  }));
48484
49021
  const paths = Object.keys(feature.fields);
@@ -48549,6 +49086,20 @@ function compositionSourceRefs(composition) {
48549
49086
  return [...new Map([...refs, ...forwardSourceRefs(composition)].map((r) => [require_implemented_methods.compositionSourceKey(r), r])).values()];
48550
49087
  }
48551
49088
  /**
49089
+ * Every DIRECT read (`from`) of a union source field (D1034): the reads whose
49090
+ * source's live kind a save looks up, so a numeric control is never linked to
49091
+ * a string field. A read inside an expression is judged by the expression.
49092
+ */
49093
+ function compositionUnionReads(composition, lookupCap) {
49094
+ return composition.features.flatMap((f) => require_implemented_methods.compositionFeatureEnabled(f) && f.kind === "fields" ? require_implemented_methods.featureSources(f).flatMap((source) => {
49095
+ if (source.kind !== "from") return [];
49096
+ const def = lookupCap(source.cap);
49097
+ const schema = def?.runtimeState ?? def?.status?.schema;
49098
+ if (schema === void 0) return [];
49099
+ return describeStateField(schema, source.fieldPath)?.kind === "union" ? [source] : [];
49100
+ }) : []);
49101
+ }
49102
+ /**
48552
49103
  * The candidate's device: the existing target itself, else `self`, else a
48553
49104
  * placeholder that cannot collide with a stored target. An existing target is
48554
49105
  * known even on create, so a second customization of it is refused on create too.
@@ -48582,6 +49133,18 @@ function selfReadProblems(read, at, fields, self) {
48582
49133
  if (isNativeCap(self.native, read.cap)) return [];
48583
49134
  return [problem("source-capability-missing", at, `the target device (device ${self.native.deviceId}) has no native \`${read.cap}\``)];
48584
49135
  }
49136
+ /**
49137
+ * A direct read of a union field is judged by the source's LIVE kind when the
49138
+ * save knew it (D1034): a numeric control feeds only a number field, a select
49139
+ * only a string or enum one.
49140
+ */
49141
+ function liveKindProblems(field, read, desc, at) {
49142
+ if (field.source.kind !== "from") return [];
49143
+ const live = desc.liveKinds?.get(`${read.cap}.${read.fieldPath}`);
49144
+ const accepted = field.kind === "enum" ? "string" : field.kind;
49145
+ if (live === void 0 || live === accepted) return [];
49146
+ return [problem("source-kind-mismatch", at, `\`${read.cap}.${read.fieldPath}\` of device ${desc.deviceId} reads a ${live} now; \`${field.cap}.${field.path}\` takes a ${accepted}`)];
49147
+ }
48585
49148
  function sourceProblems(fields, ctx, self) {
48586
49149
  const selfKey = require_implemented_methods.compositionSourceKey(self.ref);
48587
49150
  return fields.flatMap((field) => field.reads.flatMap((read) => {
@@ -48592,7 +49155,7 @@ function sourceProblems(fields, ctx, self) {
48592
49155
  if (desc === void 0 || desc.kind === "unreadable") return [problem("source-unreadable", at, `could not read source \`${key}\` (${desc === void 0 ? "it was not read" : desc.error}) — the save is refused rather than stored unchecked`)];
48593
49156
  if (desc.kind === "absent") return [problem("source-missing", at, `source \`${key}\` does not exist`)];
48594
49157
  if (!desc.caps.has(read.cap)) return [problem("source-capability-missing", at, `source \`${key}\` (device ${desc.deviceId}) has no \`${read.cap}\``)];
48595
- return [];
49158
+ return liveKindProblems(field, read, desc, at);
48596
49159
  }));
48597
49160
  }
48598
49161
  /**
@@ -48684,7 +49247,8 @@ function validateComposition(composition, ctx) {
48684
49247
  ...sourceProblems(plan.fields, ctx, self),
48685
49248
  ...forwardSourceProblems(composition, ctx.sources),
48686
49249
  ...cycles,
48687
- ...helperSaveProblems(composition, facts)
49250
+ ...helperSaveProblems(composition, facts),
49251
+ ...powerSourceActuatorConflicts(composition).map((c) => problem("power-source-is-actuator", c.path, `the power source \`${c.switch.stableId}\` is one of this device's own switches — pick the plug that feeds it`))
48688
49252
  ];
48689
49253
  return {
48690
49254
  ok: problems.length === 0,
@@ -48746,13 +49310,13 @@ function describeComposableCaps(defs, deviceType) {
48746
49310
  const itemArray = def.status?.itemArray;
48747
49311
  return {
48748
49312
  cap: def.name,
48749
- fields: fields.map((f) => ({
49313
+ fields: fields.flatMap((f) => f.kind === "union" ? [] : [{
48750
49314
  path: f.path,
48751
49315
  kind: f.kind,
48752
49316
  nullable: f.nullable,
48753
49317
  required: f.required,
48754
49318
  ...f.enumValues === void 0 ? {} : { enumValues: [...f.enumValues] }
48755
- })),
49319
+ }]),
48756
49320
  ...itemArray === void 0 ? {} : { itemArray: {
48757
49321
  path: itemArray.path,
48758
49322
  keyField: itemArray.keyField
@@ -52351,8 +52915,14 @@ var deviceManagerCapability = {
52351
52915
  "string",
52352
52916
  "number",
52353
52917
  "boolean",
52354
- "enum"
52918
+ "enum",
52919
+ "union"
52355
52920
  ]),
52921
+ unionMembers: zod.z.array(zod.z.enum([
52922
+ "string",
52923
+ "number",
52924
+ "boolean"
52925
+ ])).optional(),
52356
52926
  enumValues: zod.z.array(zod.z.string()).optional(),
52357
52927
  item: zod.z.boolean().optional(),
52358
52928
  quantity: require_sleep.ReadingQuantitySchema.optional()
@@ -56379,8 +56949,88 @@ list: require_sleep.method(zod.z.void(), zod.z.array(FailureContributionSchema).
56379
56949
  * - `FanPreset` — preset selector
56380
56950
  * - `FanDirection` — direction toggle (ceiling fans)
56381
56951
  * - `FanOscillating` — oscillation toggle
56952
+ *
56953
+ * Per-axis oscillation (`oscillationAxes`, `setOscillationAxis`, D1034): an air
56954
+ * circulator sweeps horizontally and vertically, each axis with its own
56955
+ * switch, fixed angle, sweep bounds and limits. A provider may report them
56956
+ * natively; otherwise the OPERATOR links sibling devices to each field in
56957
+ * Customize (a `replace` over the fields listed in `overridable` — nothing is
56958
+ * linked or inferred by itself), and a write to a linked field is forwarded to
56959
+ * its source. `oscillating` stays the single summary flag: when axes exist it
56960
+ * means "any axis oscillates" (`anyAxisOscillating`).
56382
56961
  */
56383
56962
  var FanDirectionSchema = zod.z.enum(["forward", "reverse"]);
56963
+ var FAN_OSCILLATION_AXES = ["horizontal", "vertical"];
56964
+ var FanOscillationAxisNameSchema = zod.z.enum(FAN_OSCILLATION_AXES);
56965
+ /** The fields of one axis a caller may set. */
56966
+ var FAN_OSCILLATION_AXIS_SETTABLE = [
56967
+ "oscillating",
56968
+ "angle",
56969
+ "sweepFrom",
56970
+ "sweepTo"
56971
+ ];
56972
+ var FanOscillationAxisFieldSchema = zod.z.enum(FAN_OSCILLATION_AXIS_SETTABLE);
56973
+ /** The limits of one axis, read from the source that serves its angle. */
56974
+ var FAN_OSCILLATION_AXIS_LIMITS = [
56975
+ "min",
56976
+ "max",
56977
+ "step"
56978
+ ];
56979
+ /**
56980
+ * One oscillation axis. Every reading the device has not reported is `null`,
56981
+ * never `0` (D393): `0°` is a real position. Each leaf defaults to `null`, so
56982
+ * a slice that names only the leaves it knows (a Customize link of one field)
56983
+ * is still a whole axis.
56984
+ */
56985
+ var FanOscillationAxisSchema = zod.z.object({
56986
+ /** Whether the axis sweeps. */
56987
+ oscillating: zod.z.boolean().nullable().default(null),
56988
+ /** The fixed position (degrees) the axis holds when it does not sweep. */
56989
+ angle: zod.z.number().nullable().default(null),
56990
+ /** The sweep bounds (degrees): left → right, bottom → top. */
56991
+ sweepFrom: zod.z.number().nullable().default(null),
56992
+ sweepTo: zod.z.number().nullable().default(null),
56993
+ /** The angles the axis accepts. Null when the device states none. */
56994
+ min: zod.z.number().nullable().default(null),
56995
+ max: zod.z.number().nullable().default(null),
56996
+ step: zod.z.number().nullable().default(null)
56997
+ });
56998
+ /** Both axes; an axis the device does not have is `null`. */
56999
+ var FanOscillationAxesSchema = zod.z.object({
57000
+ horizontal: FanOscillationAxisSchema.nullable().default(null),
57001
+ vertical: FanOscillationAxisSchema.nullable().default(null)
57002
+ });
57003
+ var FAN_OSCILLATION_AXIS_REFUSALS = [
57004
+ "nothing-to-set",
57005
+ "axis-not-linked",
57006
+ "out-of-range",
57007
+ "source-gone",
57008
+ "source-unknown",
57009
+ "source-call-failed"
57010
+ ];
57011
+ var FanOscillationAxisRefusalSchema = zod.z.enum(FAN_OSCILLATION_AXIS_REFUSALS);
57012
+ var FanOscillationAxisResultSchema = zod.z.discriminatedUnion("status", [zod.z.object({ status: zod.z.literal("applied") }), zod.z.object({
57013
+ status: zod.z.literal("refused"),
57014
+ reason: FanOscillationAxisRefusalSchema,
57015
+ /** The field at fault, when one is. */
57016
+ field: FanOscillationAxisFieldSchema.optional(),
57017
+ /** One line for the operator, naming the axis, the field and the source. */
57018
+ detail: zod.z.string(),
57019
+ /** Fields that DID land before the refusal (writes run in order, stop at the first failure). */
57020
+ applied: zod.z.array(FanOscillationAxisFieldSchema)
57021
+ })]);
57022
+ var SetOscillationAxisInputSchema = zod.z.object({
57023
+ deviceId: zod.z.number().int().nonnegative(),
57024
+ axis: FanOscillationAxisNameSchema,
57025
+ oscillating: zod.z.boolean().optional(),
57026
+ angle: zod.z.number().optional(),
57027
+ sweepFrom: zod.z.number().optional(),
57028
+ sweepTo: zod.z.number().optional()
57029
+ });
57030
+ /** The state path of one axis field: `oscillationAxes.<axis>.<field>`. */
57031
+ function fanAxisPath(axis, field) {
57032
+ return `oscillationAxes.${axis}.${field}`;
57033
+ }
56384
57034
  var FanControlStatusSchema = zod.z.object({
56385
57035
  /** Active speed as 0..100 inclusive. Null when the device has no
56386
57036
  * speed surface (single-speed fan). */
@@ -56399,9 +57049,116 @@ var FanControlStatusSchema = zod.z.object({
56399
57049
  /** Oscillation toggle. Null when the device has no oscillation
56400
57050
  * surface. */
56401
57051
  oscillating: zod.z.boolean().nullable(),
57052
+ /**
57053
+ * Per-axis oscillation (air circulators). Absent when the device has no
57054
+ * per-axis surface and nothing is linked in Customize.
57055
+ */
57056
+ oscillationAxes: FanOscillationAxesSchema.optional(),
56402
57057
  /** Ms epoch when the slice was last updated. */
56403
57058
  lastChangedAt: zod.z.number()
56404
57059
  });
57060
+ /**
57061
+ * The summary flag: with axes, "any axis oscillates"; without an axis that
57062
+ * reports, the device's own `oscillating`.
57063
+ */
57064
+ function anyAxisOscillating(status) {
57065
+ const axes = status.oscillationAxes;
57066
+ if (axes === void 0) return status.oscillating;
57067
+ const known = FAN_OSCILLATION_AXES.flatMap((axis) => {
57068
+ const value = axes[axis]?.oscillating;
57069
+ return value === null || value === void 0 ? [] : [value];
57070
+ });
57071
+ if (known.length === 0) return status.oscillating;
57072
+ return known.some(Boolean);
57073
+ }
57074
+ var FAN_CUSTOMIZE_DEVICE_TYPES = [require_composed_stable_id.DeviceType.Fan];
57075
+ /** The Customize section the axis targets are listed under. */
57076
+ var AXES_SECTION = "oscillation-axes";
57077
+ function axisOscillatingTarget(axis) {
57078
+ return {
57079
+ id: `${axis}-oscillating`,
57080
+ cardinality: "scalar",
57081
+ vocabulary: {
57082
+ cap: "fan-control",
57083
+ stateField: "oscillating"
57084
+ },
57085
+ deviceTypes: FAN_CUSTOMIZE_DEVICE_TYPES,
57086
+ apply: "replace",
57087
+ section: AXES_SECTION,
57088
+ path: fanAxisPath(axis, "oscillating"),
57089
+ sources: [{
57090
+ kind: "switch",
57091
+ transforms: [{ kind: "identity" }]
57092
+ }],
57093
+ sourceReport: { status: "assignment-status" }
57094
+ };
57095
+ }
57096
+ /**
57097
+ * A numeric axis field. The `angle` link also carries the axis limits, read
57098
+ * from the SAME linked control's own range (`min`/`max`/`step`), so the limits
57099
+ * are the source's, never guessed.
57100
+ */
57101
+ function axisNumericTarget(axis, field) {
57102
+ const base = {
57103
+ id: `${axis}-${field}`,
57104
+ cardinality: "scalar",
57105
+ vocabulary: { cap: "fan-control" },
57106
+ deviceTypes: FAN_CUSTOMIZE_DEVICE_TYPES,
57107
+ apply: "replace",
57108
+ section: AXES_SECTION,
57109
+ path: fanAxisPath(axis, field),
57110
+ sources: [{
57111
+ kind: "numeric",
57112
+ transforms: [{ kind: "identity" }]
57113
+ }],
57114
+ sourceReport: { status: "assignment-status" }
57115
+ };
57116
+ if (field !== "angle") return base;
57117
+ return {
57118
+ ...base,
57119
+ companions: FAN_OSCILLATION_AXIS_LIMITS.map((limit) => ({
57120
+ kind: "source-field",
57121
+ path: fanAxisPath(axis, limit),
57122
+ field: limit
57123
+ }))
57124
+ };
57125
+ }
57126
+ var AXIS_TARGETS = FAN_OSCILLATION_AXES.flatMap((axis) => [
57127
+ axisOscillatingTarget(axis),
57128
+ axisNumericTarget(axis, "angle"),
57129
+ axisNumericTarget(axis, "sweepFrom"),
57130
+ axisNumericTarget(axis, "sweepTo")
57131
+ ]);
57132
+ /** A select (an enum control) the operator links to the fan's `preset`. */
57133
+ var PRESET_TARGET = {
57134
+ id: "preset",
57135
+ cardinality: "scalar",
57136
+ vocabulary: { cap: "fan-control" },
57137
+ deviceTypes: FAN_CUSTOMIZE_DEVICE_TYPES,
57138
+ apply: "replace",
57139
+ path: "preset",
57140
+ sources: [{
57141
+ kind: "field",
57142
+ valueKinds: ["string"],
57143
+ transforms: [{ kind: "identity" }]
57144
+ }],
57145
+ sourceReport: { status: "assignment-status" }
57146
+ };
57147
+ var FAN_CONTROL_TARGETS = [...AXIS_TARGETS, PRESET_TARGET];
57148
+ /**
57149
+ * Customize (D1034): the fan already serves `fan-control` natively, so every
57150
+ * target is a `replace` over a field listed in `overridable` — the axis leaves
57151
+ * and `preset`, nothing else. Nothing is pre-linked: the operator picks each
57152
+ * source (D356).
57153
+ */
57154
+ var fanControlCustomize = {
57155
+ version: 1,
57156
+ overridable: FAN_CONTROL_TARGETS.map((target) => ({
57157
+ path: target.path,
57158
+ by: target.id
57159
+ })),
57160
+ targets: FAN_CONTROL_TARGETS
57161
+ };
56405
57162
  var fanControlCapability = {
56406
57163
  name: "fan-control",
56407
57164
  scope: "device",
@@ -56436,6 +57193,18 @@ var fanControlCapability = {
56436
57193
  }), zod.z.void(), {
56437
57194
  kind: "mutation",
56438
57195
  auth: "protected"
57196
+ }),
57197
+ /**
57198
+ * Sets one oscillation axis: its switch, fixed angle and/or sweep bounds.
57199
+ * Fields left out are untouched. A field linked in Customize is forwarded
57200
+ * to its linked source (D1034); otherwise the native provider serves it;
57201
+ * neither → `axis-not-linked`. Ranges are checked against the axis limits
57202
+ * before anything is written; writes run in order and stop at the first
57203
+ * failure, which the result names.
57204
+ */
57205
+ setOscillationAxis: require_sleep.optionalMethod(SetOscillationAxisInputSchema, FanOscillationAxisResultSchema, {
57206
+ kind: "mutation",
57207
+ auth: "protected"
56439
57208
  })
56440
57209
  },
56441
57210
  status: {
@@ -56447,6 +57216,7 @@ var fanControlCapability = {
56447
57216
  * sliders read `speed` for live updates.
56448
57217
  */
56449
57218
  runtimeState: FanControlStatusSchema,
57219
+ customize: fanControlCustomize,
56450
57220
  /**
56451
57221
  * Runtime-state durability: **session** — as `brightness`.
56452
57222
  *
@@ -56469,12 +57239,15 @@ var fanControlCapability = {
56469
57239
  //#endregion
56470
57240
  //#region src/capabilities/fan-presets.cap.ts
56471
57241
  /**
56472
- * fan-presets — named settings the operator composes for a fan ("Night":
56473
- * speed 25 %, oscillation off, the room's light off). A preset is a short
56474
- * sequence of action steps over the fan itself and the devices that sit in the
56475
- * same container (its siblings); applying it runs the steps in order and
56476
- * reports every one, so a caller tells "applied" from "the speed was set but
56477
- * the light step failed" without parsing text.
57242
+ * fan-presets — named settings the operator keeps for a fan ("Night": speed
57243
+ * 25 %, horizontal sweep off, angle 30°). A preset is a DESIRED fan-control
57244
+ * state (D1034): the fields it names, nothing else. Applying it calls the
57245
+ * fan's own `fan-control` methods — `setPreset`, `setPercentage`,
57246
+ * `setDirection`, `setOscillationAxis` — and an axis the operator linked in
57247
+ * Customize reaches its sibling device through that link, never through a
57248
+ * step the preset stores. Every field is reported (applied / failed / not-run
57249
+ * / refused), so a caller tells "applied" from "the speed was set but the
57250
+ * angle was refused" without parsing text.
56478
57251
  *
56479
57252
  * It is a Customize `config` extension of a fan: the presets are the
56480
57253
  * operator's, stored per device (D865), and the editor is derived from the
@@ -56483,17 +57256,33 @@ var fanControlCapability = {
56483
57256
  * (a scene, a switch, a button) offer it.
56484
57257
  */
56485
57258
  var FAN_PRESETS_MAX = 12;
56486
- var FAN_PRESET_STEPS_MAX = 20;
57259
+ /** One axis as a preset wants it; an absent field is left as it is. */
57260
+ var FanPresetAxisSchema = zod.z.object({
57261
+ oscillating: zod.z.boolean().optional(),
57262
+ angle: zod.z.number().optional(),
57263
+ sweepFrom: zod.z.number().optional(),
57264
+ sweepTo: zod.z.number().optional()
57265
+ });
57266
+ /** The fan-control state a preset sets; an absent field is left as it is. */
57267
+ var FanPresetStateSchema = zod.z.object({
57268
+ speed: zod.z.number().min(0).max(100).optional(),
57269
+ /** The fan's own preset mode (or the linked select's option). */
57270
+ preset: zod.z.string().min(1).optional(),
57271
+ direction: FanDirectionSchema.optional(),
57272
+ oscillationAxes: zod.z.object({
57273
+ horizontal: FanPresetAxisSchema.optional(),
57274
+ vertical: FanPresetAxisSchema.optional()
57275
+ }).optional()
57276
+ });
56487
57277
  var FanPresetSchema = zod.z.object({
56488
57278
  /** Stable key; never reused after a delete within one device's list. */
56489
57279
  id: zod.z.string().min(1).max(64),
56490
57280
  /** What the operator and a voice assistant call it. */
56491
57281
  name: zod.z.string().trim().min(1).max(40),
56492
- steps: zod.z.array(ActionStepSchema).min(1).max(20)
57282
+ state: FanPresetStateSchema
56493
57283
  });
56494
57284
  var FAN_PRESETS_REFUSALS = [
56495
- "not-sibling",
56496
- "bad-target",
57285
+ "empty-state",
56497
57286
  "duplicate-name",
56498
57287
  "duplicate-id",
56499
57288
  "too-many",
@@ -56506,66 +57295,50 @@ var FanPresetsSetResultSchema = zod.z.discriminatedUnion("status", [zod.z.object
56506
57295
  }), zod.z.object({
56507
57296
  status: zod.z.literal("refused"),
56508
57297
  reason: FanPresetsRefusalSchema,
56509
- /** Names the preset and step at fault. */
57298
+ /** Names the preset at fault. */
56510
57299
  detail: zod.z.string()
56511
57300
  })]);
56512
- var FanPresetStepResultSchema = zod.z.object({
56513
- index: zod.z.number().int().nonnegative(),
57301
+ var FanPresetFieldResultSchema = zod.z.object({
57302
+ /** The state path: `speed`, `preset`, `direction`, `oscillationAxes.horizontal.angle`. */
57303
+ field: zod.z.string(),
56514
57304
  outcome: zod.z.enum([
56515
57305
  "applied",
56516
57306
  "failed",
56517
57307
  "not-run",
56518
57308
  "refused"
56519
57309
  ]),
56520
- deviceId: zod.z.number().int().nonnegative().optional(),
56521
- cap: zod.z.string().optional(),
56522
- method: zod.z.string().optional(),
56523
57310
  /** The cause, for every outcome but `applied`. */
56524
57311
  message: zod.z.string().optional()
56525
57312
  });
56526
57313
  var FanPresetApplyResultSchema = zod.z.object({
56527
- /** `applied`: every step ran. `partial`: some ran, one failed. `refused`: nothing ran. */
57314
+ /** `applied`: every field landed. `partial`: some did, one did not. `refused`: nothing ran. */
56528
57315
  status: zod.z.enum([
56529
57316
  "applied",
56530
57317
  "partial",
56531
57318
  "refused"
56532
57319
  ]),
56533
- steps: zod.z.array(FanPresetStepResultSchema)
57320
+ fields: zod.z.array(FanPresetFieldResultSchema)
56534
57321
  });
56535
- /** The fan's own readings a capture may take. */
57322
+ /** The fan-control fields a capture may take. */
56536
57323
  var FAN_CAPTURE_FIELDS = [
56537
57324
  "speed",
56538
- "oscillating",
56539
57325
  "direction",
56540
- "preset"
57326
+ "preset",
57327
+ "oscillationAxes"
56541
57328
  ];
56542
57329
  var FanCaptureFieldSchema = zod.z.enum(FAN_CAPTURE_FIELDS);
56543
57330
  var FanCaptureOmissionSchema = zod.z.object({
56544
- /** A fan field (`speed`) or `step <n>` for a sibling step. */
57331
+ /** A state path (`speed`, `oscillationAxes.vertical.angle`). */
56545
57332
  what: zod.z.string(),
56546
- /** Why no value was taken: unknown reading (never stored as 0, D393), or a step that cannot be read. */
57333
+ /** Why no value was taken: an unknown reading is never stored as 0 (D393). */
56547
57334
  reason: zod.z.string()
56548
57335
  });
56549
- /** Where a proposed step belongs in the review list. */
56550
- var FAN_CAPTURE_GROUPS = [
56551
- "fan",
56552
- "oscillation",
56553
- "angles"
56554
- ];
56555
- var FanCaptureGroupSchema = zod.z.enum(FAN_CAPTURE_GROUPS);
56556
- var FanCaptureItemSchema = zod.z.object({
56557
- group: FanCaptureGroupSchema,
56558
- /** What the step sets, in the operator's words (a device name, a fan field). */
56559
- label: zod.z.string()
56560
- });
56561
57336
  var FanPresetCaptureResultSchema = zod.z.object({
56562
- /** The steps filled from the device's current values; NOT saved. */
56563
- steps: zod.z.array(ActionStepSchema),
56564
- /** One entry per step, same order: its review group and label. */
56565
- items: zod.z.array(FanCaptureItemSchema),
57337
+ /** The fan's CURRENT fan-control state, as a preset; NOT saved. */
57338
+ state: FanPresetStateSchema,
56566
57339
  omitted: zod.z.array(FanCaptureOmissionSchema)
56567
57340
  });
56568
- var deviceInput$2 = zod.z.object({ deviceId: zod.z.number().int().nonnegative() });
57341
+ var deviceInput$1 = zod.z.object({ deviceId: zod.z.number().int().nonnegative() });
56569
57342
  var fanPresetsCustomize = {
56570
57343
  version: 1,
56571
57344
  targets: [{
@@ -56583,28 +57356,22 @@ var fanPresetsCapability = {
56583
57356
  scope: "system",
56584
57357
  mode: "singleton",
56585
57358
  methods: {
56586
- getPresets: require_sleep.method(deviceInput$2, zod.z.array(FanPresetSchema), { auth: "protected" }),
56587
- setPresets: require_sleep.method(deviceInput$2.extend({ presets: zod.z.array(FanPresetSchema).max(12) }), FanPresetsSetResultSchema, {
57359
+ getPresets: require_sleep.method(deviceInput$1, zod.z.array(FanPresetSchema), { auth: "protected" }),
57360
+ setPresets: require_sleep.method(deviceInput$1.extend({ presets: zod.z.array(FanPresetSchema).max(12) }), FanPresetsSetResultSchema, {
56588
57361
  kind: "mutation",
56589
57362
  auth: "admin"
56590
57363
  }),
56591
- applyPreset: require_sleep.method(deviceInput$2.extend({ presetId: zod.z.string().min(1) }), FanPresetApplyResultSchema, {
57364
+ applyPreset: require_sleep.method(deviceInput$1.extend({ presetId: zod.z.string().min(1) }), FanPresetApplyResultSchema, {
56592
57365
  kind: "mutation",
56593
57366
  auth: "protected"
56594
57367
  }),
56595
57368
  /**
56596
- * Fills steps from the CURRENT values: the fan's own fields named in
56597
- * `fields` (all when absent) and the sibling `steps` already composed
56598
- * (a control value, a switch state). With no `steps` it proposes EVERY
56599
- * switch and control in the fan's container, ordered angle bounds,
56600
- * oscillation, fixed angles, fan fields, speed last. A reading that is
56601
- * unknown is left out and named in `omitted`, never captured as 0. Nothing
56602
- * is saved.
57369
+ * The fan's CURRENT fan-control state as a preset: the fields named in
57370
+ * `fields` (all when absent), read from its merged slice — a field linked
57371
+ * in Customize reads its link. A reading that is unknown is left out and
57372
+ * named in `omitted`, never captured as 0. Nothing is saved.
56603
57373
  */
56604
- capturePreset: require_sleep.method(deviceInput$2.extend({
56605
- fields: zod.z.array(FanCaptureFieldSchema).optional(),
56606
- steps: zod.z.array(ActionStepSchema).max(20).default([])
56607
- }), FanPresetCaptureResultSchema, { auth: "protected" })
57374
+ capturePreset: require_sleep.method(deviceInput$1.extend({ fields: zod.z.array(FanCaptureFieldSchema).optional() }), FanPresetCaptureResultSchema, { auth: "protected" })
56608
57375
  },
56609
57376
  customize: fanPresetsCustomize
56610
57377
  };
@@ -56842,8 +57609,7 @@ var groupActiveCapability = {
56842
57609
  require_composed_stable_id.DeviceType.Valve,
56843
57610
  require_composed_stable_id.DeviceType.Lock,
56844
57611
  require_composed_stable_id.DeviceType.MediaPlayer,
56845
- require_composed_stable_id.DeviceType.Climate,
56846
- require_composed_stable_id.DeviceType.Thermostat
57612
+ require_composed_stable_id.DeviceType.Climate
56847
57613
  ],
56848
57614
  methods: {},
56849
57615
  status: {
@@ -56894,7 +57660,6 @@ var groupCommandsCapability = {
56894
57660
  require_composed_stable_id.DeviceType.Valve,
56895
57661
  require_composed_stable_id.DeviceType.Lock,
56896
57662
  require_composed_stable_id.DeviceType.MediaPlayer,
56897
- require_composed_stable_id.DeviceType.Thermostat,
56898
57663
  require_composed_stable_id.DeviceType.Climate
56899
57664
  ],
56900
57665
  methods: {},
@@ -56952,7 +57717,6 @@ var groupStatusCapability = {
56952
57717
  require_composed_stable_id.DeviceType.Valve,
56953
57718
  require_composed_stable_id.DeviceType.Lock,
56954
57719
  require_composed_stable_id.DeviceType.MediaPlayer,
56955
- require_composed_stable_id.DeviceType.Thermostat,
56956
57720
  require_composed_stable_id.DeviceType.Climate
56957
57721
  ],
56958
57722
  methods: {},
@@ -57328,7 +58092,7 @@ var heatingValveCapability = {
57328
58092
  scope: "device",
57329
58093
  deviceNative: true,
57330
58094
  mode: "singleton",
57331
- deviceTypes: [require_composed_stable_id.DeviceType.Thermostat],
58095
+ deviceTypes: [require_composed_stable_id.DeviceType.Climate],
57332
58096
  methods: {},
57333
58097
  status: {
57334
58098
  schema: HeatingValveStatusSchema,
@@ -57360,30 +58124,42 @@ var heatingValveCapability = {
57360
58124
  * retried in a loop - D49); a future one is re-armed.
57361
58125
  *
57362
58126
  * What a device may be run for, and for how long at most, is per device type
57363
- * ({@link TIMED_RUN_LIMITS}): the maximum is a safety bound, not a preference,
58127
+ * and role ({@link timedRunLimitOf}): the maximum is a safety bound, not a preference,
57364
58128
  * so a request above it is REFUSED with a typed reason, never clamped.
57365
58129
  */
57366
58130
  var TimedRunUnitSchema = zod.z.enum(["s", "min"]);
57367
58131
  /** What a timed run switches: the `switch` cap's `setState` or the fountain's `setPump`. */
57368
58132
  var TimedRunActuatorSchema = zod.z.enum(["switch", "pet-fountain"]);
57369
- /** The longest run, per device type. Only these types are offered `timed-run`. */
57370
- var TIMED_RUN_LIMITS = {
57371
- [require_composed_stable_id.DeviceType.Heater]: {
57372
- actuator: "switch",
57373
- maxSeconds: 10800,
57374
- unit: "min",
57375
- quickRunDefault: 30
57376
- },
57377
- [require_composed_stable_id.DeviceType.PetFountain]: {
57378
- actuator: "pet-fountain",
57379
- maxSeconds: 300,
57380
- unit: "s",
57381
- quickRunDefault: 60
57382
- }
58133
+ /** A plug-in heater (switch + `switch-heater`): up to 3 h, in minutes. */
58134
+ var TIMED_RUN_HEATER_LIMIT = {
58135
+ actuator: "switch",
58136
+ maxSeconds: 10800,
58137
+ unit: "min",
58138
+ quickRunDefault: 30
58139
+ };
58140
+ /** A pet fountain's pump: up to 5 min, in seconds. */
58141
+ var TIMED_RUN_PET_FOUNTAIN_LIMIT = {
58142
+ actuator: "pet-fountain",
58143
+ maxSeconds: 300,
58144
+ unit: "s",
58145
+ quickRunDefault: 60
57383
58146
  };
57384
- var TIMED_RUN_DEVICE_TYPES = [require_composed_stable_id.DeviceType.Heater, require_composed_stable_id.DeviceType.PetFountain];
57385
- function timedRunLimitOf(deviceType) {
57386
- return TIMED_RUN_LIMITS[deviceType] ?? null;
58147
+ /**
58148
+ * The device types `timed-run` may be offered on. A `switch` is narrowed by
58149
+ * role ({@link TIMED_RUN_DEVICE_ROLES}): only a plug-in heater runs on a timer.
58150
+ */
58151
+ var TIMED_RUN_DEVICE_TYPES = [require_composed_stable_id.DeviceType.Switch, require_composed_stable_id.DeviceType.PetFountain];
58152
+ /** The roles that make a device of these types timed-run-able (D1033). */
58153
+ var TIMED_RUN_DEVICE_ROLES = { [require_composed_stable_id.DeviceType.Switch]: [require_composed_stable_id.DeviceRole.SwitchHeater] };
58154
+ /**
58155
+ * The longest run of a device, by its type AND role (D1033): a `switch` is a
58156
+ * heater only with role `switch-heater`, a pet fountain always is what it is.
58157
+ * `null` - the device is not offered `timed-run`.
58158
+ */
58159
+ function timedRunLimitOf(deviceType, role) {
58160
+ if (deviceType === require_composed_stable_id.DeviceType.PetFountain) return TIMED_RUN_PET_FOUNTAIN_LIMIT;
58161
+ if (deviceType === require_composed_stable_id.DeviceType.Switch && role === require_composed_stable_id.DeviceRole.SwitchHeater) return TIMED_RUN_HEATER_LIMIT;
58162
+ return null;
57387
58163
  }
57388
58164
  var MS_PER_SECOND = 1e3;
57389
58165
  var MS_PER_MINUTE = 6e4;
@@ -57465,6 +58241,7 @@ var timedRunCapability = {
57465
58241
  kind: "wrapper",
57466
58242
  defaultActive: true,
57467
58243
  deviceTypes: TIMED_RUN_DEVICE_TYPES,
58244
+ deviceRoles: TIMED_RUN_DEVICE_ROLES,
57468
58245
  deviceConfig: { ui: {
57469
58246
  kind: "derived-form",
57470
58247
  builderId: "timed-run",
@@ -57656,8 +58433,7 @@ var HERO_SCENE_BY_TYPE = {
57656
58433
  [require_composed_stable_id.DeviceType.Siren]: "siren",
57657
58434
  [require_composed_stable_id.DeviceType.Switch]: "plug",
57658
58435
  [require_composed_stable_id.DeviceType.Sensor]: "sensor-sparkline",
57659
- [require_composed_stable_id.DeviceType.Thermostat]: "thermostat",
57660
- [require_composed_stable_id.DeviceType.Climate]: "ac",
58436
+ [require_composed_stable_id.DeviceType.Climate]: "thermostat",
57661
58437
  [require_composed_stable_id.DeviceType.Button]: "button",
57662
58438
  [require_composed_stable_id.DeviceType.EventEmitter]: "event-stream",
57663
58439
  [require_composed_stable_id.DeviceType.Update]: "update",
@@ -57685,7 +58461,6 @@ var HERO_SCENE_BY_TYPE = {
57685
58461
  [require_composed_stable_id.DeviceType.PetFountain]: "pet-fountain",
57686
58462
  [require_composed_stable_id.DeviceType.Dishwasher]: "dishwasher",
57687
58463
  [require_composed_stable_id.DeviceType.Washer]: "washer",
57688
- [require_composed_stable_id.DeviceType.Heater]: "heater",
57689
58464
  [require_composed_stable_id.DeviceType.Dryer]: "dryer",
57690
58465
  [require_composed_stable_id.DeviceType.Gateway]: "gateway"
57691
58466
  };
@@ -57710,6 +58485,14 @@ var HERO_SCENE_BY_ROLE = {
57710
58485
  [require_composed_stable_id.DeviceRole.CoverWindow]: "inherit",
57711
58486
  [require_composed_stable_id.DeviceRole.BinaryHelper]: "inherit",
57712
58487
  [require_composed_stable_id.DeviceRole.Outlet]: "plug",
58488
+ [require_composed_stable_id.DeviceRole.SwitchHeater]: "heater",
58489
+ [require_composed_stable_id.DeviceRole.SwitchFan]: "fan",
58490
+ [require_composed_stable_id.DeviceRole.ClimateAc]: "ac",
58491
+ [require_composed_stable_id.DeviceRole.ClimateThermostat]: "inherit",
58492
+ [require_composed_stable_id.DeviceRole.ClimateFloor]: "inherit",
58493
+ [require_composed_stable_id.DeviceRole.ClimateRadiator]: "inherit",
58494
+ [require_composed_stable_id.DeviceRole.ClimateHeater]: "inherit",
58495
+ [require_composed_stable_id.DeviceRole.ClimateHeatPumpCircuit]: "inherit",
57713
58496
  [require_composed_stable_id.DeviceRole.MotionSensor]: "presence",
57714
58497
  [require_composed_stable_id.DeviceRole.ContactSensor]: "contact",
57715
58498
  [require_composed_stable_id.DeviceRole.LeakSensor]: "inherit",
@@ -58273,10 +59056,7 @@ function trailingOf(facts) {
58273
59056
  * A type whose primary is a named control, not its power: a climate row is the mode
58274
59057
  * (which carries "off") and the setpoint, with no power toggle.
58275
59058
  */
58276
- var ROW_PRIMARY_BY_TYPE = {
58277
- [require_composed_stable_id.DeviceType.Climate]: "climate.mode",
58278
- [require_composed_stable_id.DeviceType.Thermostat]: "climate.mode"
58279
- };
59059
+ var ROW_PRIMARY_BY_TYPE = { [require_composed_stable_id.DeviceType.Climate]: "climate.mode" };
58280
59060
  function primaryOf(model) {
58281
59061
  const named = ROW_PRIMARY_BY_TYPE[model.type];
58282
59062
  if (named !== void 0) {
@@ -58309,7 +59089,6 @@ function primaryOf(model) {
58309
59089
  */
58310
59090
  var ROW_EXTRAS_BY_TYPE = {
58311
59091
  [require_composed_stable_id.DeviceType.Climate]: ["climate.target"],
58312
- [require_composed_stable_id.DeviceType.Thermostat]: ["climate.target"],
58313
59092
  [require_composed_stable_id.DeviceType.Vacuum]: ["vacuum.base"],
58314
59093
  [require_composed_stable_id.DeviceType.LawnMower]: ["mower.dock"],
58315
59094
  [require_composed_stable_id.DeviceType.MediaPlayer]: ["volume.level", REMOTE_OPEN_ACTION_ID]
@@ -58432,7 +59211,11 @@ var heroLayoutCapability = {
58432
59211
  auth: "protected",
58433
59212
  role: "viewer"
58434
59213
  }),
58435
- getLayout: require_sleep.method(zod.z.object({ deviceType: zod.z.string() }), HeroLayoutRowsSchema, {
59214
+ /** The fixed rows of a kind: the type, refined by the role (D1033 — a heater is a switch). */
59215
+ getLayout: require_sleep.method(zod.z.object({
59216
+ deviceType: zod.z.string(),
59217
+ role: zod.z.string().nullable().optional()
59218
+ }), HeroLayoutRowsSchema, {
58436
59219
  auth: "protected",
58437
59220
  role: "viewer"
58438
59221
  })
@@ -58483,6 +59266,11 @@ var humidifierCapability = {
58483
59266
  deviceNative: true,
58484
59267
  mode: "singleton",
58485
59268
  deviceTypes: [require_composed_stable_id.DeviceType.Humidifier],
59269
+ power: {
59270
+ kind: "field",
59271
+ field: "on",
59272
+ set: "setOn"
59273
+ },
58486
59274
  methods: {
58487
59275
  setOn: require_sleep.method(zod.z.object({
58488
59276
  deviceId: zod.z.number().int().nonnegative(),
@@ -58558,7 +59346,7 @@ var humiditySensorCapability = {
58558
59346
  scope: "device",
58559
59347
  deviceNative: true,
58560
59348
  mode: "singleton",
58561
- deviceTypes: [require_composed_stable_id.DeviceType.Sensor, require_composed_stable_id.DeviceType.Thermostat],
59349
+ deviceTypes: [require_composed_stable_id.DeviceType.Sensor, require_composed_stable_id.DeviceType.Climate],
58562
59350
  methods: {},
58563
59351
  status: {
58564
59352
  schema: HumiditySensorStatusSchema,
@@ -77128,6 +77916,11 @@ var petFountainCapability = {
77128
77916
  deviceNative: true,
77129
77917
  mode: "singleton",
77130
77918
  deviceTypes: [require_composed_stable_id.DeviceType.PetFountain],
77919
+ power: {
77920
+ kind: "field",
77921
+ field: "pumpRunning",
77922
+ set: "setPump"
77923
+ },
77131
77924
  methods: {
77132
77925
  /** Start or stop the pump. */
77133
77926
  setPump: require_sleep.method(zod.z.object({
@@ -80042,7 +80835,6 @@ var POWER_METER_DEVICE_TYPES = [
80042
80835
  require_composed_stable_id.DeviceType.Light,
80043
80836
  require_composed_stable_id.DeviceType.Fan,
80044
80837
  require_composed_stable_id.DeviceType.Climate,
80045
- require_composed_stable_id.DeviceType.Thermostat,
80046
80838
  require_composed_stable_id.DeviceType.Humidifier,
80047
80839
  require_composed_stable_id.DeviceType.WaterHeater,
80048
80840
  require_composed_stable_id.DeviceType.MediaPlayer,
@@ -80051,8 +80843,7 @@ var POWER_METER_DEVICE_TYPES = [
80051
80843
  require_composed_stable_id.DeviceType.Dishwasher,
80052
80844
  require_composed_stable_id.DeviceType.Vacuum,
80053
80845
  require_composed_stable_id.DeviceType.LawnMower,
80054
- require_composed_stable_id.DeviceType.PetFeeder,
80055
- require_composed_stable_id.DeviceType.Heater
80846
+ require_composed_stable_id.DeviceType.PetFeeder
80056
80847
  ];
80057
80848
  /** Everything but a bare `Sensor`: a sensor that takes its reading from another sensor adds nothing. */
80058
80849
  var POWER_METER_CUSTOMIZE_DEVICE_TYPES = POWER_METER_DEVICE_TYPES.filter((type) => type !== require_composed_stable_id.DeviceType.Sensor);
@@ -80166,146 +80957,6 @@ var powerMeterCapability = {
80166
80957
  customize: powerMeterCustomize
80167
80958
  };
80168
80959
  //#endregion
80169
- //#region src/capabilities/power-source.cap.ts
80170
- /**
80171
- * power-source — a device that hangs is powered by a smart switch, and the
80172
- * operator picks that switch in the device's Customize. The device then offers
80173
- * power on, power off and a forced restart (switch off, wait, switch on).
80174
- *
80175
- * Manual by default: nothing here restarts a device by itself. The one
80176
- * exception (D997) is a device's OWN provider calling `forceRestart` for its own
80177
- * device as a bounded self-recovery (unreachable for a long stretch, linked,
80178
- * one attempt per cooldown, never with a live session); Velux is the first. It
80179
- * is not the native `reboot` cap and never replaces or wraps it: `reboot` talks
80180
- * to the device, this cuts the power of the device that no longer answers.
80181
- *
80182
- * The link is a Customize extension (`add`): one scalar target whose source is
80183
- * the switch. The stored composition is the ONE copy of the link and of
80184
- * `offSeconds` (`powerSourceLinkOfComposition`, D676); the composed slice only
80185
- * mirrors the switch state for the UI. The methods are served by the
80186
- * `core-blocks` system provider, so they are `systemMethod`s and carry a
80187
- * top-level `deviceId`.
80188
- *
80189
- * Every action answers a typed result and never throws for an expected
80190
- * refusal, so a caller tells "the switch is offline" from "a restart is
80191
- * already running" without parsing text.
80192
- */
80193
- /** Bounds of the off time of a forced restart, in seconds. */
80194
- var POWER_SOURCE_OFF_SECONDS_MIN = 3;
80195
- var POWER_SOURCE_OFF_SECONDS_MAX = 120;
80196
- var POWER_SOURCE_OFF_SECONDS_DEFAULT = 10;
80197
- var PowerSourceRefusalReasonSchema = zod.z.enum([
80198
- "no-power-source",
80199
- "switch-missing",
80200
- "switch-offline",
80201
- "switch-unknown",
80202
- "restart-in-progress",
80203
- "switch-call-failed"
80204
- ]);
80205
- var PowerSourceActionResultSchema = zod.z.discriminatedUnion("accepted", [zod.z.object({ accepted: zod.z.literal(true) }), zod.z.object({
80206
- accepted: zod.z.literal(false),
80207
- reason: PowerSourceRefusalReasonSchema,
80208
- /** One line for the operator, naming the switch. */
80209
- message: zod.z.string()
80210
- })]);
80211
- var PowerSourceInfoSchema = zod.z.object({
80212
- /** False when the device has no power source linked; the rest is then empty. */
80213
- linked: zod.z.boolean(),
80214
- switchDeviceId: zod.z.number().nullable(),
80215
- switchName: zod.z.string().nullable(),
80216
- /** The switch's on/off state, or null when it is unknown. Never false for unknown (D393). */
80217
- switchOn: zod.z.boolean().nullable(),
80218
- switchOnline: zod.z.boolean().nullable(),
80219
- restartInProgress: zod.z.boolean(),
80220
- offSeconds: zod.z.number().int()
80221
- });
80222
- /** The composed slice: the switch state the link mirrors, plus the stored off time. */
80223
- var PowerSourceStateSchema = zod.z.object({
80224
- /** Null while the switch has not reported: unknown is never `false` (D393). */
80225
- switchOn: zod.z.boolean().nullable(),
80226
- offSeconds: zod.z.number().int(),
80227
- lastFetchedAt: zod.z.number()
80228
- });
80229
- var POWER_SOURCE_DEVICE_TYPES = [
80230
- require_composed_stable_id.DeviceType.Gateway,
80231
- require_composed_stable_id.DeviceType.Camera,
80232
- require_composed_stable_id.DeviceType.Sensor,
80233
- require_composed_stable_id.DeviceType.MediaPlayer,
80234
- require_composed_stable_id.DeviceType.Vacuum,
80235
- require_composed_stable_id.DeviceType.Generic,
80236
- require_composed_stable_id.DeviceType.Washer,
80237
- require_composed_stable_id.DeviceType.Dryer,
80238
- require_composed_stable_id.DeviceType.Dishwasher,
80239
- require_composed_stable_id.DeviceType.PetFountain,
80240
- require_composed_stable_id.DeviceType.Fan,
80241
- require_composed_stable_id.DeviceType.Humidifier,
80242
- require_composed_stable_id.DeviceType.Climate,
80243
- require_composed_stable_id.DeviceType.WaterHeater
80244
- ];
80245
- var powerSourceCustomize = {
80246
- version: 1,
80247
- targets: [{
80248
- id: "switch",
80249
- cardinality: "scalar",
80250
- vocabulary: {
80251
- cap: "power-source",
80252
- stateField: "switchOn"
80253
- },
80254
- deviceTypes: POWER_SOURCE_DEVICE_TYPES,
80255
- apply: "add",
80256
- path: "switchOn",
80257
- sources: [{
80258
- kind: "switch",
80259
- transforms: [{ kind: "identity" }]
80260
- }],
80261
- companions: [{
80262
- kind: "constant",
80263
- path: "offSeconds",
80264
- value: 10,
80265
- when: "add",
80266
- formerValues: [0]
80267
- }, {
80268
- kind: "clock",
80269
- path: "lastFetchedAt",
80270
- when: "always"
80271
- }],
80272
- sourceReport: { status: "assignment-status" }
80273
- }]
80274
- };
80275
- var deviceInput$1 = zod.z.object({ deviceId: zod.z.number().int().nonnegative() });
80276
- var powerSourceCapability = {
80277
- name: "power-source",
80278
- scope: "device",
80279
- mode: "singleton",
80280
- deviceTypes: POWER_SOURCE_DEVICE_TYPES,
80281
- methods: {
80282
- getStatus: require_sleep.systemMethod(deviceInput$1, PowerSourceInfoSchema, { auth: "protected" }),
80283
- powerOn: require_sleep.systemMethod(deviceInput$1, PowerSourceActionResultSchema, {
80284
- kind: "mutation",
80285
- auth: "protected"
80286
- }),
80287
- powerOff: require_sleep.systemMethod(deviceInput$1, PowerSourceActionResultSchema, {
80288
- kind: "mutation",
80289
- auth: "protected"
80290
- }),
80291
- forceRestart: require_sleep.systemMethod(deviceInput$1, PowerSourceActionResultSchema, {
80292
- kind: "mutation",
80293
- auth: "protected"
80294
- })
80295
- },
80296
- runtimeState: PowerSourceStateSchema,
80297
- customize: powerSourceCustomize,
80298
- /**
80299
- * Runtime-state durability: **session** — mirrored from the linked switch on
80300
- * its next report; a restored value would outlive the reading it names.
80301
- *
80302
- * See `RuntimeStateDurability`. Enforced by
80303
- * `scripts/check-runtime-state-durability.ts`.
80304
- */
80305
- durability: "session",
80306
- history: "none"
80307
- };
80308
- //#endregion
80309
80960
  //#region src/capabilities/presence.cap.ts
80310
80961
  /**
80311
80962
  * Presence cap. Models HA `person.*` and `device_tracker.*` entities
@@ -85273,9 +85924,7 @@ var RUNNING_CUSTOMIZE_DEVICE_TYPES = [
85273
85924
  require_composed_stable_id.DeviceType.Humidifier,
85274
85925
  require_composed_stable_id.DeviceType.Fan,
85275
85926
  require_composed_stable_id.DeviceType.Climate,
85276
- require_composed_stable_id.DeviceType.Thermostat,
85277
- require_composed_stable_id.DeviceType.PetFeeder,
85278
- require_composed_stable_id.DeviceType.Heater
85927
+ require_composed_stable_id.DeviceType.PetFeeder
85279
85928
  ];
85280
85929
  var runningStateCapability = {
85281
85930
  name: "running-state",
@@ -87963,8 +88612,7 @@ var switchCapability = {
87963
88612
  require_composed_stable_id.DeviceType.Switch,
87964
88613
  require_composed_stable_id.DeviceType.Siren,
87965
88614
  require_composed_stable_id.DeviceType.Light,
87966
- require_composed_stable_id.DeviceType.Fan,
87967
- require_composed_stable_id.DeviceType.Heater
88615
+ require_composed_stable_id.DeviceType.Fan
87968
88616
  ],
87969
88617
  methods: { setState: require_sleep.method(zod.z.object({
87970
88618
  deviceId: zod.z.number(),
@@ -88828,7 +89476,7 @@ var temperatureSensorCapability = {
88828
89476
  scope: "device",
88829
89477
  deviceNative: true,
88830
89478
  mode: "singleton",
88831
- deviceTypes: [require_composed_stable_id.DeviceType.Sensor, require_composed_stable_id.DeviceType.Thermostat],
89479
+ deviceTypes: [require_composed_stable_id.DeviceType.Sensor, require_composed_stable_id.DeviceType.Climate],
88832
89480
  methods: {},
88833
89481
  status: {
88834
89482
  schema: TemperatureSensorStatusSchema,
@@ -90860,6 +91508,13 @@ var waterHeaterCapability = {
90860
91508
  deviceNative: true,
90861
91509
  mode: "singleton",
90862
91510
  deviceTypes: [require_composed_stable_id.DeviceType.WaterHeater],
91511
+ power: {
91512
+ kind: "mode",
91513
+ field: "operationMode",
91514
+ offValue: "off",
91515
+ set: "setOperationMode",
91516
+ lastField: "lastActiveMode"
91517
+ },
90863
91518
  methods: {
90864
91519
  setTargetTemp: require_sleep.method(zod.z.object({
90865
91520
  deviceId: zod.z.number().int().nonnegative(),
@@ -97465,11 +98120,6 @@ function evaluateAggregate(input) {
97465
98120
  }
97466
98121
  //#endregion
97467
98122
  //#region src/composition/helpers/source-pick.ts
97468
- /**
97469
- * The request the common source selector (#236) accepts for a helper (D944 §5).
97470
- * The selector's layout is not specified here. Groups ask for one device type
97471
- * and the catalog field; they do not opt into incompatible fields.
97472
- */
97473
98123
  /** What the member step asks the selector for this template. */
97474
98124
  function sourcePickForTemplate(template) {
97475
98125
  const valueKind = template.family === "numeric" ? "number" : template.activeWhen === void 0 ? "boolean" : "state";
@@ -97551,30 +98201,6 @@ function sourcePickForMath(kind) {
97551
98201
  function numericAccept() {
97552
98202
  return historyAccept("statistic").filter((field) => field.valueKind === "number");
97553
98203
  }
97554
- /**
97555
- * The one thing a naked heater needs at creation (D1004 point 5): the plug it
97556
- * switches. On and off forward to that plug; no other facet is attached.
97557
- */
97558
- function sourcePickForHeaterPlug() {
97559
- return {
97560
- fieldChoice: "operator",
97561
- purpose: "member",
97562
- multiple: false,
97563
- max: 1,
97564
- deviceTypes: [require_composed_stable_id.DeviceType.Switch],
97565
- accept: [{
97566
- cap: "switch",
97567
- fieldPath: "on",
97568
- valueKind: "boolean"
97569
- }],
97570
- history: {
97571
- required: false,
97572
- minRetentionMs: null
97573
- },
97574
- mustBindCaps: ["switch"],
97575
- exclude: []
97576
- };
97577
- }
97578
98204
  //#endregion
97579
98205
  //#region src/composition/customize/field-source.ts
97580
98206
  function fromRead(source, cap, fieldPath) {
@@ -97670,7 +98296,7 @@ function compileValue$1(input) {
97670
98296
  const transform = input.draft.transform;
97671
98297
  if (transform.kind === "identity" || transform.kind === "number") return {
97672
98298
  ok: true,
97673
- value: identityValue(read, input.sourceValueKind)
98299
+ value: identityValue(read, input.sourceValueKind, targetValueKind(input))
97674
98300
  };
97675
98301
  if (transform.kind === "invert") {
97676
98302
  if (input.sourceValueKind !== "boolean") return fail$2("source-kind");
@@ -97683,8 +98309,16 @@ function compileValue$1(input) {
97683
98309
  if (transform.kind === "linear") return linearValue$1(transform, read, input.sourceValueKind);
97684
98310
  return fail$2("transform");
97685
98311
  }
97686
- function identityValue(read, valueKind) {
97687
- if (valueKind === "string") return expression("number(x)", { x: read });
98312
+ /** The kind of the field a draft writes, from the catalog. */
98313
+ function targetValueKind(input) {
98314
+ return catalogTarget$4(input.draft.cap, input.draft.targetId)?.valueKind;
98315
+ }
98316
+ /**
98317
+ * A string reading feeds a NUMBER field through `number(x)`; a string field
98318
+ * (a fan `preset` linked to a select, D1034) takes the string as it is.
98319
+ */
98320
+ function identityValue(read, valueKind, targetKind) {
98321
+ if (valueKind === "string" && targetKind !== "string" && targetKind !== "enum") return expression("number(x)", { x: read });
97688
98322
  return read;
97689
98323
  }
97690
98324
  /**
@@ -97766,7 +98400,7 @@ function compileCompanions$1(input, target, value) {
97766
98400
  });
97767
98401
  }
97768
98402
  function companionIncluded$1(companion, apply) {
97769
- if (companion.kind === "transition-time") return true;
98403
+ if (companion.kind === "transition-time" || companion.kind === "source-field") return true;
97770
98404
  return companion.when === "always" || apply === "add";
97771
98405
  }
97772
98406
  function companionField(input, path, companion, value) {
@@ -97782,6 +98416,10 @@ function companionField(input, path, companion, value) {
97782
98416
  ok: true,
97783
98417
  value: literal("now")
97784
98418
  };
98419
+ if (companion.kind === "source-field") return {
98420
+ ok: true,
98421
+ value: fromRead(refOf$1(input.draft), input.draft.source.cap, companion.field)
98422
+ };
97785
98423
  return transitionField(input, path, companion.sourceChangedAt, value);
97786
98424
  }
97787
98425
  function transitionField(input, path, sourceChangedAt, value) {
@@ -97975,7 +98613,12 @@ function describeRead(read) {
97975
98613
  function isConfirmed(reading) {
97976
98614
  return reading.fatal || reading.confirmed === true;
97977
98615
  }
97978
- function fromReading(reading, read) {
98616
+ /** Whether a non-null value is of the kind a field of `kind` holds. */
98617
+ function valueFitsKind(value, kind) {
98618
+ if (value === null) return true;
98619
+ return typeof value === (kind === "enum" ? "string" : kind);
98620
+ }
98621
+ function fromReading(reading, read, targetKind) {
97979
98622
  if (reading.state === "unavailable") return {
97980
98623
  state: "unavailable",
97981
98624
  value: null,
@@ -97983,6 +98626,13 @@ function fromReading(reading, read) {
97983
98626
  fatal: reading.fatal,
97984
98627
  confirmed: isConfirmed(reading)
97985
98628
  };
98629
+ if (targetKind !== void 0 && !valueFitsKind(reading.value, targetKind)) return {
98630
+ state: "unavailable",
98631
+ value: null,
98632
+ reason: `${describeRead(read)}: source-kind-mismatch, it reads a ${typeof reading.value} and the field takes a ${targetKind}`,
98633
+ fatal: false,
98634
+ confirmed: true
98635
+ };
97986
98636
  return {
97987
98637
  state: reading.state,
97988
98638
  value: reading.value,
@@ -98106,7 +98756,7 @@ function aggregateField(source, read) {
98106
98756
  function evaluateCompositionField(input) {
98107
98757
  const { source } = input;
98108
98758
  switch (source.kind) {
98109
- case "from": return fromReading(input.read(source), source);
98759
+ case "from": return fromReading(input.read(source), source, input.targetKind);
98110
98760
  case "expression": return expressionOutcome(source, input.read, input.now, input.stateful);
98111
98761
  case "aggregate": return aggregateField(source, input.read);
98112
98762
  case "series": return {
@@ -98342,56 +98992,6 @@ function lockDoorLinkOfComposition(composition) {
98342
98992
  };
98343
98993
  }
98344
98994
  //#endregion
98345
- //#region src/composition/power-source-link.ts
98346
- /**
98347
- * Which smart switch powers a device (the `power-source` Customize extension):
98348
- * the source its stored `power-source.switchOn` field reads, and the off time of
98349
- * a forced restart stored beside it. Read from the STORED composition, never kept
98350
- * as a second copy (D676). Shared by the hub (which acts on the switch) and the
98351
- * admin UI (which shows it).
98352
- */
98353
- /**
98354
- * The stored off time, or the default when none is stored. A stored number out
98355
- * of range is CLAMPED to the bounds (a hand-written value never refuses the
98356
- * link, it just cannot cut power for an absurd time); a non-integer is rounded.
98357
- */
98358
- function normalizeOffSeconds(value) {
98359
- if (typeof value !== "number" || !Number.isFinite(value)) return 10;
98360
- return Math.min(120, Math.max(3, Math.round(value)));
98361
- }
98362
- /** The constant a stored `offSeconds` field carries, or undefined when it is not a literal number. */
98363
- function storedOffSeconds(composition) {
98364
- const feature = composition.features.find((f) => f.cap === "power-source");
98365
- if (feature === void 0 || feature.kind !== "fields") return void 0;
98366
- const field = feature.fields["offSeconds"];
98367
- if (field === void 0 || field.kind !== "expression") return void 0;
98368
- const n = Number(field.expr);
98369
- return field.expr.trim() === "" || !Number.isFinite(n) ? void 0 : n;
98370
- }
98371
- /**
98372
- * The link a composition stores. An `existing` target names its own device; a
98373
- * `new` target (a composed device) is the composer's own device, so the caller
98374
- * passes the block id and a new-target composition without one has no link.
98375
- */
98376
- function powerSourceLinkOfComposition(composition, blockId) {
98377
- if (composition === null) return null;
98378
- let device;
98379
- if (composition.target.kind === "existing") device = composition.target.device;
98380
- else if (blockId !== void 0) device = require_implemented_methods.composedDeviceRef(blockId);
98381
- else return null;
98382
- const feature = composition.features.find((f) => f.cap === "power-source");
98383
- if (feature === void 0 || feature.kind !== "fields" || feature.enabled === false) return null;
98384
- const field = feature.fields["switchOn"];
98385
- if (field === void 0) return null;
98386
- const read = require_implemented_methods.fieldReads(field).find((r) => r.cap === "switch");
98387
- if (read === void 0) return null;
98388
- return {
98389
- device,
98390
- switch: read.source,
98391
- offSeconds: normalizeOffSeconds(storedOffSeconds(composition))
98392
- };
98393
- }
98394
- //#endregion
98395
98995
  //#region src/composition/presets/numeric-transforms.ts
98396
98996
  /**
98397
98997
  * Self-only invert / unit-convert composition features (D663, D939).
@@ -99219,7 +99819,7 @@ function drafted(field, transform, sourceValueKind, cap, targetId) {
99219
99819
  };
99220
99820
  }
99221
99821
  function inferApply$1(target, fields) {
99222
- const addPaths = (target.companions ?? []).flatMap((companion) => companion.kind !== "transition-time" && companion.when === "add" ? [companion.path] : []);
99822
+ const addPaths = (target.companions ?? []).flatMap((companion) => (companion.kind === "constant" || companion.kind === "clock") && companion.when === "add" ? [companion.path] : []);
99223
99823
  if (addPaths.length === 0) return "replace";
99224
99824
  const present = addPaths.filter((path) => fields[path] !== void 0);
99225
99825
  if (present.length === addPaths.length) return "add";
@@ -99564,7 +100164,7 @@ function compileCompanions(target, apply) {
99564
100164
  });
99565
100165
  }
99566
100166
  function companionIncluded(companion, apply) {
99567
- if (companion.kind === "transition-time") return false;
100167
+ if (companion.kind === "transition-time" || companion.kind === "source-field") return false;
99568
100168
  return companion.when === "always" || apply === "add";
99569
100169
  }
99570
100170
  function refOf(draft) {
@@ -99743,7 +100343,7 @@ function isConstant(source) {
99743
100343
  return source?.kind === "expression" && Object.keys(source.bindings).length === 0;
99744
100344
  }
99745
100345
  function inferApply(target, fields) {
99746
- const addPaths = (target.companions ?? []).flatMap((companion) => companion.kind !== "transition-time" && companion.when === "add" ? [companion.path] : []);
100346
+ const addPaths = (target.companions ?? []).flatMap((companion) => (companion.kind === "constant" || companion.kind === "clock") && companion.when === "add" ? [companion.path] : []);
99747
100347
  if (addPaths.length === 0) return "replace";
99748
100348
  const present = addPaths.filter((path) => fields[path] !== void 0);
99749
100349
  if (present.length === addPaths.length) return "add";
@@ -99752,7 +100352,7 @@ function inferApply(target, fields) {
99752
100352
  }
99753
100353
  function companionsMatch(target, fields, apply) {
99754
100354
  const expected = (target.companions ?? []).flatMap((companion) => {
99755
- if (companion.kind === "transition-time") return [];
100355
+ if (companion.kind === "transition-time" || companion.kind === "source-field") return [];
99756
100356
  if (companion.when === "always" || apply === "add") return [companion.path];
99757
100357
  return [];
99758
100358
  });
@@ -101816,15 +102416,16 @@ var BaseDeviceProvider = class extends require_sleep.BaseAddon {
101816
102416
  });
101817
102417
  const meta = await this.ctx.api.deviceManager.loadMeta.query({ deviceId: id });
101818
102418
  if (meta === null) throw new Error(`${this.providerName}: no persisted meta for "${stableId}" (id ${id}) — cannot reload`);
101819
- const deviceType = Object.values(require_composed_stable_id.DeviceType).find((t) => t === meta.type);
101820
- const Class = deviceType !== void 0 ? this.deviceClasses[deviceType] : void 0;
102419
+ const Class = this.deviceClassForRow({
102420
+ type: meta.type,
102421
+ stableId
102422
+ });
101821
102423
  if (!Class) throw new Error(`${this.providerName}: no device class for type "${meta.type}" — "${stableId}" is an accessory child; reload its parent instead`);
101822
102424
  await devices.create(stableId, Class, {}, meta.parentDeviceId ?? null);
101823
102425
  const rows = await this.ctx.api.deviceManager.listPersistedByAddon.query({ addonId: this.addonId });
101824
102426
  for (const row of rows) {
101825
102427
  if (row.parentDeviceId !== id) continue;
101826
- const childType = Object.values(require_composed_stable_id.DeviceType).find((t) => t === row.type);
101827
- const ChildClass = childType !== void 0 ? this.deviceClasses[childType] : void 0;
102428
+ const ChildClass = this.deviceClassForRow(row);
101828
102429
  if (!ChildClass) continue;
101829
102430
  try {
101830
102431
  await devices.create(row.stableId, ChildClass, {}, id);
@@ -101851,6 +102452,16 @@ var BaseDeviceProvider = class extends require_sleep.BaseAddon {
101851
102452
  return { deviceId: id };
101852
102453
  }
101853
102454
  /**
102455
+ * The class a PERSISTED row is rebuilt with. Default: by type, from
102456
+ * `deviceClasses`. A provider whose distinct devices share one type (D1033:
102457
+ * a radiator valve and a room climate are both `climate`) overrides this
102458
+ * and tells them apart by the row's stable id or config.
102459
+ */
102460
+ deviceClassForRow(row) {
102461
+ const type = Object.values(require_composed_stable_id.DeviceType).find((t) => t === row.type);
102462
+ return type !== void 0 ? this.deviceClasses[type] : void 0;
102463
+ }
102464
+ /**
101854
102465
  * Restore devices from persisted state. Two-pass:
101855
102466
  *
101856
102467
  * 1. **Top-level pass** — invokes `kernel.devices.create()` for every
@@ -101911,7 +102522,7 @@ var BaseDeviceProvider = class extends require_sleep.BaseAddon {
101911
102522
  restored.add(saved.id);
101912
102523
  return;
101913
102524
  }
101914
- const Class = this.deviceClasses[saved.type];
102525
+ const Class = this.deviceClassForRow(saved);
101915
102526
  if (!Class) throw new Error(`no device class registered for type "${saved.type}"`);
101916
102527
  if (saved.parentDeviceId !== null && !restored.has(saved.parentDeviceId)) throw new Error(`parent device ${saved.parentDeviceId} not restored`);
101917
102528
  await this.healSavedConfig(saved, savedDevices);
@@ -101928,7 +102539,7 @@ var BaseDeviceProvider = class extends require_sleep.BaseAddon {
101928
102539
  };
101929
102540
  const topLevel = savedDevices.filter((saved) => saved.parentDeviceId === null);
101930
102541
  const restoreOne = async (saved) => {
101931
- if (!this.deviceClasses[saved.type]) {
102542
+ if (!this.deviceClassForRow(saved)) {
101932
102543
  this.ctx.logger.warn("No device class registered for restored type — skipping", {
101933
102544
  tags: {
101934
102545
  deviceId: saved.id,
@@ -101967,7 +102578,7 @@ var BaseDeviceProvider = class extends require_sleep.BaseAddon {
101967
102578
  const failedTopLevelIds = new Set(failures.map((failure) => failure.saved.id));
101968
102579
  const childRows = savedDevices.filter((s) => s.parentDeviceId !== null);
101969
102580
  for (const saved of childRows) {
101970
- if (!this.deviceClasses[saved.type]) continue;
102581
+ if (!this.deviceClassForRow(saved)) continue;
101971
102582
  if (saved.parentDeviceId === null) continue;
101972
102583
  if (restored.has(saved.parentDeviceId)) {
101973
102584
  try {
@@ -102158,7 +102769,6 @@ function applyPrimaryChildRule(rule, children) {
102158
102769
  var CONTAINER_CHILD_PRIORITY = [
102159
102770
  "media-player",
102160
102771
  "alarm-panel",
102161
- "thermostat",
102162
102772
  "climate",
102163
102773
  "humidifier",
102164
102774
  "water-heater",
@@ -102778,6 +103388,73 @@ function widenDeviceConstructor(ctor) {
102778
103388
  return ctor;
102779
103389
  }
102780
103390
  //#endregion
103391
+ //#region src/device/device-kind.ts
103392
+ /**
103393
+ * A device's KIND is its type plus its role (D1033): the type is the set of
103394
+ * controls it has, the role says which thing it is among the devices that
103395
+ * share those controls. A plug-in heater is a `switch` with role
103396
+ * `switch-heater`; an air conditioner and a radiator valve are both `climate`,
103397
+ * told apart by their `climate-*` role.
103398
+ */
103399
+ /**
103400
+ * Type values a persisted row may still carry after the type was retired, and
103401
+ * the type each one is read as. The row is rewritten by the next registration
103402
+ * of the device (its provider stamps the live type), so this is a read alias,
103403
+ * not a migration.
103404
+ *
103405
+ * `heater` is deliberately absent: the only heaters were composed devices the
103406
+ * operator deletes. Such a row stays an unknown type, which every reader
103407
+ * treats as a generic device.
103408
+ */
103409
+ var RETIRED_DEVICE_TYPES = { thermostat: require_composed_stable_id.DeviceType.Climate };
103410
+ /** The live type a stored `type` value stands for (itself unless retired). */
103411
+ function canonicalStoredDeviceType(stored) {
103412
+ return RETIRED_DEVICE_TYPES[stored] ?? stored;
103413
+ }
103414
+ /** The `climate-*` roles, in the order the role picker lists them. */
103415
+ var CLIMATE_ROLES = [
103416
+ require_composed_stable_id.DeviceRole.ClimateThermostat,
103417
+ require_composed_stable_id.DeviceRole.ClimateAc,
103418
+ require_composed_stable_id.DeviceRole.ClimateRadiator,
103419
+ require_composed_stable_id.DeviceRole.ClimateFloor,
103420
+ require_composed_stable_id.DeviceRole.ClimateHeater,
103421
+ require_composed_stable_id.DeviceRole.ClimateHeatPumpCircuit
103422
+ ];
103423
+ function isClimateRole(role) {
103424
+ return CLIMATE_ROLES.some((candidate) => candidate === role);
103425
+ }
103426
+ /**
103427
+ * Which climate device this is. A climate device with no role, or a role that
103428
+ * is not a climate one, is a room thermostat: that is what most of them are,
103429
+ * and it is the presentation a thermostat had before the types were folded.
103430
+ */
103431
+ function climateRoleOf(role) {
103432
+ return role !== null && role !== void 0 && isClimateRole(role) ? role : require_composed_stable_id.DeviceRole.ClimateThermostat;
103433
+ }
103434
+ /** An air conditioner: exports present it as an AC unit, not a thermostat. */
103435
+ function isAirConditioner(type, role) {
103436
+ return type === require_composed_stable_id.DeviceType.Climate && climateRoleOf(role) === require_composed_stable_id.DeviceRole.ClimateAc;
103437
+ }
103438
+ /**
103439
+ * Is a capability offered on a device of this type and role?
103440
+ *
103441
+ * Fails open where the old type-only gate did: no `deviceTypes` (or an empty
103442
+ * list) applies to every device, and an unknown type never filters (a failed
103443
+ * meta read must not destroy work, D49). A type the cap's `deviceRoles` names
103444
+ * is offered only to the roles listed there; an unknown role is NOT one of
103445
+ * them, so a `switch` whose role could not be read is not a heater.
103446
+ */
103447
+ function capAppliesToDeviceKind(gate, deviceType, role) {
103448
+ if (deviceType === void 0) return true;
103449
+ const types = gate?.deviceTypes;
103450
+ if (!types || types.length === 0) return true;
103451
+ const type = types.find((candidate) => candidate === deviceType);
103452
+ if (type === void 0) return false;
103453
+ const roles = gate?.deviceRoles?.[type];
103454
+ if (roles === void 0) return true;
103455
+ return role !== null && role !== void 0 && roles.some((candidate) => candidate === role);
103456
+ }
103457
+ //#endregion
102781
103458
  //#region src/device/device-control-resolution.ts
102782
103459
  /**
102783
103460
  * Device-control RESOLUTION LOGIC — the single, presentation-free source of
@@ -102830,8 +103507,7 @@ var DEVICE_TYPE_CONTROL_KIND = {
102830
103507
  [require_composed_stable_id.DeviceType.Light]: "light",
102831
103508
  [require_composed_stable_id.DeviceType.Fan]: "fan",
102832
103509
  [require_composed_stable_id.DeviceType.Sensor]: "sensor",
102833
- [require_composed_stable_id.DeviceType.Thermostat]: "thermostat",
102834
- [require_composed_stable_id.DeviceType.Climate]: "climate",
103510
+ [require_composed_stable_id.DeviceType.Climate]: "thermostat",
102835
103511
  [require_composed_stable_id.DeviceType.Button]: "button",
102836
103512
  [require_composed_stable_id.DeviceType.EventEmitter]: "dummy",
102837
103513
  [require_composed_stable_id.DeviceType.Update]: "update",
@@ -102851,7 +103527,6 @@ var DEVICE_TYPE_CONTROL_KIND = {
102851
103527
  [require_composed_stable_id.DeviceType.Image]: "image",
102852
103528
  [require_composed_stable_id.DeviceType.PetFeeder]: "pet-feeder",
102853
103529
  [require_composed_stable_id.DeviceType.PetFountain]: "pet-fountain",
102854
- [require_composed_stable_id.DeviceType.Heater]: "heater",
102855
103530
  [require_composed_stable_id.DeviceType.Dishwasher]: "dishwasher",
102856
103531
  [require_composed_stable_id.DeviceType.Washer]: "appliance",
102857
103532
  [require_composed_stable_id.DeviceType.Dryer]: "appliance",
@@ -102865,8 +103540,11 @@ var DEVICE_TYPE_VALUES = new Set(Object.values(require_composed_stable_id.Device
102865
103540
  * narrows the string to a `DeviceType` before indexing (documented enum-string
102866
103541
  * boundary).
102867
103542
  */
102868
- function resolveDeviceControlKind(type) {
102869
- return DEVICE_TYPE_VALUES.has(type) ? DEVICE_TYPE_CONTROL_KIND[type] : null;
103543
+ function resolveDeviceControlKind(type, role) {
103544
+ if (!DEVICE_TYPE_VALUES.has(type)) return null;
103545
+ if (isAirConditioner(type, role)) return "climate";
103546
+ if (type === require_composed_stable_id.DeviceType.Switch && role === require_composed_stable_id.DeviceRole.SwitchHeater) return "heater";
103547
+ return DEVICE_TYPE_CONTROL_KIND[type];
102870
103548
  }
102871
103549
  /** Kebab feature flag advertised by an accessory that auto-activates when its
102872
103550
  * parent camera detects motion. The cap's kebab name is `motion-trigger` (see
@@ -105188,9 +105866,6 @@ function durationText(seconds) {
105188
105866
  const text = `${Math.floor(m / 60)} h ${String(m % 60).padStart(2, "0")}`;
105189
105867
  return require_sleep.t(text, text);
105190
105868
  }
105191
- function deviceTypeOf(type) {
105192
- return Object.values(require_composed_stable_id.DeviceType).find((t) => t === type);
105193
- }
105194
105869
  var switchContribution = contribution("switch", SwitchStatusSchema, (slice) => {
105195
105870
  const on = slice?.on ?? null;
105196
105871
  return {
@@ -105371,8 +106046,7 @@ function remainingWords(amount, unit) {
105371
106046
  return require_sleep.t(`${amount} ${word}`, `${amount} ${word}`);
105372
106047
  }
105373
106048
  var timedRunContribution = contribution("timed-run", TimedRunStatusSchema, (slice, ctx) => {
105374
- const type = deviceTypeOf(ctx.type);
105375
- const limit = type === void 0 ? null : timedRunLimitOf(type);
106049
+ const limit = timedRunLimitOf(ctx.type, ctx.role);
105376
106050
  if (limit === null) return {};
105377
106051
  const quickRun = slice?.quickRun ?? timedRunQuickRun(limit, null);
105378
106052
  const activeUntil = slice?.activeUntil != null && slice.activeUntil > ctx.now ? slice.activeUntil : null;
@@ -105813,7 +106487,6 @@ var HERO_LAYOUT_BY_TYPE = {
105813
106487
  [require_composed_stable_id.DeviceType.Siren]: HERO_LAYOUT_DEFAULT,
105814
106488
  [require_composed_stable_id.DeviceType.Switch]: SWITCH_LAYOUT,
105815
106489
  [require_composed_stable_id.DeviceType.Sensor]: HERO_LAYOUT_DEFAULT,
105816
- [require_composed_stable_id.DeviceType.Thermostat]: CLIMATE_LAYOUT,
105817
106490
  [require_composed_stable_id.DeviceType.Climate]: CLIMATE_LAYOUT,
105818
106491
  [require_composed_stable_id.DeviceType.Button]: BUTTON_LAYOUT,
105819
106492
  [require_composed_stable_id.DeviceType.EventEmitter]: HERO_LAYOUT_DEFAULT,
@@ -105842,7 +106515,6 @@ var HERO_LAYOUT_BY_TYPE = {
105842
106515
  [require_composed_stable_id.DeviceType.PetFountain]: FOUNTAIN_LAYOUT,
105843
106516
  [require_composed_stable_id.DeviceType.Dishwasher]: DISHWASHER_LAYOUT,
105844
106517
  [require_composed_stable_id.DeviceType.Washer]: APPLIANCE_LAYOUT,
105845
- [require_composed_stable_id.DeviceType.Heater]: HEATER_LAYOUT,
105846
106518
  [require_composed_stable_id.DeviceType.Dryer]: APPLIANCE_LAYOUT,
105847
106519
  [require_composed_stable_id.DeviceType.Gateway]: HERO_LAYOUT_DEFAULT
105848
106520
  };
@@ -105850,7 +106522,8 @@ function isDeviceType$1(type) {
105850
106522
  return Object.values(require_composed_stable_id.DeviceType).includes(type);
105851
106523
  }
105852
106524
  /** The layout of a type; a type this build does not know gets the default. */
105853
- function resolveHeroLayout(type) {
106525
+ function resolveHeroLayout(type, role = null) {
106526
+ if (type === require_composed_stable_id.DeviceType.Switch && role === require_composed_stable_id.DeviceRole.SwitchHeater) return HEATER_LAYOUT;
105854
106527
  return isDeviceType$1(type) ? HERO_LAYOUT_BY_TYPE[type] : HERO_LAYOUT_DEFAULT;
105855
106528
  }
105856
106529
  //#endregion
@@ -106531,7 +107204,7 @@ var HERO_MODE_LOOK = {
106531
107204
  open: null,
106532
107205
  closed: null
106533
107206
  };
106534
- var MODE_LOOK_TYPES = [require_composed_stable_id.DeviceType.Climate, require_composed_stable_id.DeviceType.Thermostat];
107207
+ var MODE_LOOK_TYPES = [require_composed_stable_id.DeviceType.Climate];
106535
107208
  var HERO_LOOK_BY_TYPE = {
106536
107209
  [require_composed_stable_id.DeviceType.Camera]: CAMERA_LOOK,
106537
107210
  [require_composed_stable_id.DeviceType.Hub]: HERO_LOOK_DEFAULT,
@@ -106539,8 +107212,7 @@ var HERO_LOOK_BY_TYPE = {
106539
107212
  [require_composed_stable_id.DeviceType.Siren]: HERO_LOOK_DEFAULT,
106540
107213
  [require_composed_stable_id.DeviceType.Switch]: SWITCH_LOOK,
106541
107214
  [require_composed_stable_id.DeviceType.Sensor]: READING_SENSOR_LOOK,
106542
- [require_composed_stable_id.DeviceType.Thermostat]: THERMOSTAT_LOOK,
106543
- [require_composed_stable_id.DeviceType.Climate]: CLIMATE_LOOK,
107215
+ [require_composed_stable_id.DeviceType.Climate]: THERMOSTAT_LOOK,
106544
107216
  [require_composed_stable_id.DeviceType.Button]: BUTTON_LOOK,
106545
107217
  [require_composed_stable_id.DeviceType.EventEmitter]: EVENT_EMITTER_LOOK,
106546
107218
  [require_composed_stable_id.DeviceType.Update]: UPDATE_LOOK,
@@ -106568,7 +107240,6 @@ var HERO_LOOK_BY_TYPE = {
106568
107240
  [require_composed_stable_id.DeviceType.PetFountain]: FOUNTAIN_LOOK,
106569
107241
  [require_composed_stable_id.DeviceType.Dishwasher]: DISHWASHER_LOOK,
106570
107242
  [require_composed_stable_id.DeviceType.Washer]: WASHER_LOOK,
106571
- [require_composed_stable_id.DeviceType.Heater]: HEATER_LOOK,
106572
107243
  [require_composed_stable_id.DeviceType.Dryer]: DRYER_LOOK,
106573
107244
  [require_composed_stable_id.DeviceType.Gateway]: HERO_LOOK_DEFAULT
106574
107245
  };
@@ -106593,6 +107264,14 @@ var HERO_LOOK_BY_ROLE = {
106593
107264
  [require_composed_stable_id.DeviceRole.CoverWindow]: "inherit",
106594
107265
  [require_composed_stable_id.DeviceRole.BinaryHelper]: "inherit",
106595
107266
  [require_composed_stable_id.DeviceRole.Outlet]: "inherit",
107267
+ [require_composed_stable_id.DeviceRole.SwitchHeater]: HEATER_LOOK,
107268
+ [require_composed_stable_id.DeviceRole.SwitchFan]: FAN_LOOK,
107269
+ [require_composed_stable_id.DeviceRole.ClimateAc]: "inherit",
107270
+ [require_composed_stable_id.DeviceRole.ClimateThermostat]: "inherit",
107271
+ [require_composed_stable_id.DeviceRole.ClimateFloor]: "inherit",
107272
+ [require_composed_stable_id.DeviceRole.ClimateRadiator]: "inherit",
107273
+ [require_composed_stable_id.DeviceRole.ClimateHeater]: "inherit",
107274
+ [require_composed_stable_id.DeviceRole.ClimateHeatPumpCircuit]: "inherit",
106596
107275
  [require_composed_stable_id.DeviceRole.MotionSensor]: MOTION_LOOK,
106597
107276
  [require_composed_stable_id.DeviceRole.ContactSensor]: "inherit",
106598
107277
  [require_composed_stable_id.DeviceRole.LeakSensor]: LEAK_LOOK,
@@ -106650,6 +107329,7 @@ function resolveHeroLook(role, type, state, mode = null) {
106650
107329
  const byMode = HERO_MODE_LOOK[mode];
106651
107330
  if (byMode !== null) return byMode;
106652
107331
  }
107332
+ if (isAirConditioner(type, role)) return CLIMATE_LOOK[state];
106653
107333
  return ((isDeviceType(type) ? HERO_LOOK_BY_TYPE[type] : void 0) ?? HERO_LOOK_DEFAULT)[state];
106654
107334
  }
106655
107335
  /** Every look the model declares, for the exhaustiveness guard and its spec. */
@@ -106832,6 +107512,7 @@ function buildHeroModel(input) {
106832
107512
  const ctx = {
106833
107513
  deviceId: device.id,
106834
107514
  type: device.type,
107515
+ role: device.role,
106835
107516
  features: input.features,
106836
107517
  now: input.now,
106837
107518
  running: runningOf(input),
@@ -106860,7 +107541,7 @@ function buildHeroModel(input) {
106860
107541
  }
106861
107542
  };
106862
107543
  const allRows = fragments.flatMap((f) => f.rows ?? []);
106863
- const rows = resolveHeroLayout(device.type).rows.flatMap((id) => {
107544
+ const rows = resolveHeroLayout(device.type, device.role).rows.flatMap((id) => {
106864
107545
  return allRows.filter((r) => r.id === id).map((r) => HERO_SCENE_ROW_IDS.has(r.id) ? {
106865
107546
  ...r,
106866
107547
  placement: "scene"
@@ -110437,6 +111118,13 @@ var METHOD_ACCESS_MAP = Object.freeze({
110437
111118
  access: "create",
110438
111119
  role: "viewer"
110439
111120
  },
111121
+ "fanControl.setOscillationAxis": {
111122
+ capName: "fan-control",
111123
+ capScope: "device",
111124
+ addonId: null,
111125
+ access: "create",
111126
+ role: "viewer"
111127
+ },
110440
111128
  "fanControl.setPercentage": {
110441
111129
  capName: "fan-control",
110442
111130
  capScope: "device",
@@ -117956,7 +118644,6 @@ var DEVICE_TYPE_DO_CAPS = {
117956
118644
  [require_composed_stable_id.DeviceType.Siren]: ["switch", "motion-trigger"],
117957
118645
  [require_composed_stable_id.DeviceType.Switch]: ["switch", "motion-trigger"],
117958
118646
  [require_composed_stable_id.DeviceType.Sensor]: [],
117959
- [require_composed_stable_id.DeviceType.Thermostat]: ["climate-control"],
117960
118647
  [require_composed_stable_id.DeviceType.Climate]: ["climate-control"],
117961
118648
  [require_composed_stable_id.DeviceType.Button]: ["button"],
117962
118649
  [require_composed_stable_id.DeviceType.EventEmitter]: [],
@@ -117983,7 +118670,6 @@ var DEVICE_TYPE_DO_CAPS = {
117983
118670
  [require_composed_stable_id.DeviceType.Image]: [],
117984
118671
  [require_composed_stable_id.DeviceType.PetFeeder]: ["pet-feeder"],
117985
118672
  [require_composed_stable_id.DeviceType.PetFountain]: ["pet-fountain", "timed-run"],
117986
- [require_composed_stable_id.DeviceType.Heater]: ["switch", "timed-run"],
117987
118673
  [require_composed_stable_id.DeviceType.Dishwasher]: ["dishwasher"],
117988
118674
  [require_composed_stable_id.DeviceType.Washer]: [],
117989
118675
  [require_composed_stable_id.DeviceType.Dryer]: [],
@@ -118008,7 +118694,6 @@ function isDoPickerDeviceType(type) {
118008
118694
  function deviceDoFamily(type) {
118009
118695
  switch (type) {
118010
118696
  case require_composed_stable_id.DeviceType.Climate:
118011
- case require_composed_stable_id.DeviceType.Thermostat:
118012
118697
  case require_composed_stable_id.DeviceType.Humidifier:
118013
118698
  case require_composed_stable_id.DeviceType.WaterHeater:
118014
118699
  case require_composed_stable_id.DeviceType.HeatPump: return "climate-family";
@@ -118931,6 +119616,151 @@ function createRuntimeStateBridge(params) {
118931
119616
  };
118932
119617
  }
118933
119618
  //#endregion
119619
+ //#region src/device/power-switch.ts
119620
+ var PowerSwitchRefusedError = class extends Error {
119621
+ reason;
119622
+ constructor(reason, message) {
119623
+ super(message);
119624
+ this.name = "PowerSwitchRefusedError";
119625
+ this.reason = reason;
119626
+ }
119627
+ };
119628
+ /** `true` / `false` from the owner slice, `null` when the hinted field is
119629
+ * absent or not of the hinted shape. */
119630
+ function powerOnFromSlice(hint, slice) {
119631
+ const value = slice?.[hint.field];
119632
+ switch (hint.kind) {
119633
+ case "field": return typeof value === "boolean" ? value : null;
119634
+ case "methods": return typeof value === "string" ? !hint.offValues.includes(value) : null;
119635
+ case "mode": return typeof value === "string" ? value !== hint.offValue : null;
119636
+ }
119637
+ }
119638
+ function ownerMethod(owner, name, capName) {
119639
+ const fn = Reflect.get(owner, name);
119640
+ if (typeof fn !== "function") throw new PowerSwitchRefusedError("owner-method-missing", `${capName} provider does not serve '${name}', which its power hint names`);
119641
+ return async (input) => fn.call(owner, input);
119642
+ }
119643
+ async function lastNonOffMode(host, capName, hint) {
119644
+ const isMode = (v) => typeof v === "string" && v.length > 0 && v !== hint.offValue;
119645
+ const fromHub = (await host.readHubSlice(capName).catch(() => null))?.[hint.lastField];
119646
+ if (isMode(fromHub)) return fromHub;
119647
+ const local = host.runtimeState.getCapState(capName)?.[hint.lastField];
119648
+ return isMode(local) ? local : null;
119649
+ }
119650
+ async function applyPower(host, capName, hint, owner, on) {
119651
+ const deviceId = host.deviceId;
119652
+ switch (hint.kind) {
119653
+ case "field":
119654
+ await ownerMethod(owner, hint.set, capName)({
119655
+ deviceId,
119656
+ on
119657
+ });
119658
+ return;
119659
+ case "methods":
119660
+ await ownerMethod(owner, on ? hint.on : hint.off, capName)({ deviceId });
119661
+ return;
119662
+ case "mode": {
119663
+ const set = ownerMethod(owner, hint.set, capName);
119664
+ if (!on) {
119665
+ await set({
119666
+ deviceId,
119667
+ mode: hint.offValue
119668
+ });
119669
+ return;
119670
+ }
119671
+ const mode = await lastNonOffMode(host, capName, hint);
119672
+ if (mode === null) throw new PowerSwitchRefusedError("no-last-mode", `device ${deviceId}: ${capName} has no last non-off mode to restore; pick a mode instead`);
119673
+ await set({
119674
+ deviceId,
119675
+ mode
119676
+ });
119677
+ return;
119678
+ }
119679
+ }
119680
+ }
119681
+ function hintedMethods(hint) {
119682
+ return hint.kind === "methods" ? [hint.on, hint.off] : [hint.set];
119683
+ }
119684
+ /** Whether `owner` serves every method its cap's power hint names. A media
119685
+ * player whose `turnOn` / `turnOff` are not served has no power, so no switch. */
119686
+ function powerServedBy(hint, owner) {
119687
+ if (hint === void 0) return false;
119688
+ return hintedMethods(hint).every((name) => typeof Reflect.get(owner, name) === "function");
119689
+ }
119690
+ /** Builds the `switch` provider and starts the slice projection. Exported
119691
+ * for the specs; providers call `registerPowerSwitch`. */
119692
+ function buildPowerSwitch(host, cap, owner) {
119693
+ const hint = cap.power;
119694
+ if (hint === void 0) throw new Error(`capability '${cap.name}' has no power hint: it has no switch to project`);
119695
+ const read = () => powerOnFromSlice(hint, host.runtimeState.getCapState(cap.name));
119696
+ const project = () => {
119697
+ const on = read();
119698
+ const current = host.runtimeState.getCapState(switchCapability.name);
119699
+ if (current !== void 0 && current["on"] === on) return;
119700
+ const next = {
119701
+ on,
119702
+ lastChangedAt: Date.now()
119703
+ };
119704
+ host.runtimeState.setCapState(switchCapability.name, next);
119705
+ };
119706
+ const stop = host.runtimeState.subscribeCap(cap.name, project);
119707
+ if (host.runtimeState.getCapState(cap.name) !== void 0) project();
119708
+ return {
119709
+ provider: {
119710
+ getStatus: async () => {
119711
+ const current = host.runtimeState.getCapState(switchCapability.name);
119712
+ const lastChangedAt = typeof current?.["lastChangedAt"] === "number" ? current["lastChangedAt"] : 0;
119713
+ return {
119714
+ on: read(),
119715
+ lastChangedAt
119716
+ };
119717
+ },
119718
+ setState: async ({ on }) => applyPower(host, cap.name, hint, owner, on)
119719
+ },
119720
+ dispose: stop
119721
+ };
119722
+ }
119723
+ /**
119724
+ * Registers `switch` for a device whose `cap` carries a `power` hint, built
119725
+ * from `owner` (the provider the device registered for `cap`). Call it right
119726
+ * after `registerNativeCap(cap, owner)`.
119727
+ */
119728
+ function registerPowerSwitch(device, cap, owner) {
119729
+ const deviceId = device.ctx.id;
119730
+ if (cap.power !== void 0 && !powerServedBy(cap.power, owner)) {
119731
+ device.ctx.logger.debug("power switch: owner serves no power control, no switch registered", {
119732
+ tags: { deviceId },
119733
+ meta: { capName: cap.name }
119734
+ });
119735
+ return () => {};
119736
+ }
119737
+ const host = {
119738
+ deviceId,
119739
+ runtimeState: device.runtimeState,
119740
+ registerNativeCap: (c, p) => device.ctx.registerNativeCap(c, p),
119741
+ readHubSlice: async (capName) => {
119742
+ try {
119743
+ return await device.ctx.api.deviceState.getCapSlice.query({
119744
+ deviceId,
119745
+ capName
119746
+ });
119747
+ } catch (err) {
119748
+ device.ctx.logger.warn("power switch: hub slice read failed", {
119749
+ tags: { deviceId },
119750
+ meta: {
119751
+ capName,
119752
+ error: err instanceof Error ? err.message : String(err)
119753
+ }
119754
+ });
119755
+ return null;
119756
+ }
119757
+ }
119758
+ };
119759
+ const built = buildPowerSwitch(host, cap, owner);
119760
+ host.registerNativeCap(switchCapability, built.provider);
119761
+ return built.dispose;
119762
+ }
119763
+ //#endregion
118934
119764
  //#region src/device/system-mirror.ts
118935
119765
  var STATE_CHANGED_CATEGORY = "device.state-changed";
118936
119766
  var BINDING_CHANGED_CATEGORY = "capability.binding-changed";
@@ -120804,6 +121634,11 @@ var METHOD_DEVICE_SELECTORS = Object.freeze({
120804
121634
  form: "single",
120805
121635
  optional: false
120806
121636
  }],
121637
+ "fanControl.setOscillationAxis": [{
121638
+ name: "deviceId",
121639
+ form: "single",
121640
+ optional: false
121641
+ }],
120807
121642
  "fanControl.setPercentage": [{
120808
121643
  name: "deviceId",
120809
121644
  form: "single",
@@ -123659,6 +124494,12 @@ var CUSTOMIZE_CARDINALITIES = [
123659
124494
  var CUSTOMIZE_EVENT_SHAPES = ["pulse", "span"];
123660
124495
  /** Who applies a stored event or scalar assignment; the table branches on it. */
123661
124496
  var CUSTOMIZE_APPLY_AUTHORITY_KINDS = ["composition-claim", "camera-sensors"];
124497
+ /**
124498
+ * A named group a cap may file its targets under in the Customize table
124499
+ * (D1034). Admin-ui keys a section title off this list; a target without one
124500
+ * lands in the section its cardinality implies.
124501
+ */
124502
+ var CUSTOMIZE_TARGET_SECTIONS = ["oscillation-axes"];
123662
124503
  //#endregion
123663
124504
  //#region src/composition/customize/scalar-status.ts
123664
124505
  function projectScalarAssignment(input) {
@@ -136946,6 +137787,7 @@ exports.CAP_VOCABULARY_BY_NAME = require_sleep.CAP_VOCABULARY_BY_NAME;
136946
137787
  exports.CATALOG_LANGS = CATALOG_LANGS;
136947
137788
  exports.CIVIL_TWILIGHT_ALTITUDE_DEG = CIVIL_TWILIGHT_ALTITUDE_DEG;
136948
137789
  exports.CLASS_MAP_MACRO_TARGETS = CLASS_MAP_MACRO_TARGETS;
137790
+ exports.CLIMATE_ROLES = CLIMATE_ROLES;
136949
137791
  exports.CLIP_BROKER_PACED_RATES = CLIP_BROKER_PACED_RATES;
136950
137792
  exports.CLIP_LABEL_EVENT_FETCH_LIMIT = CLIP_LABEL_EVENT_FETCH_LIMIT;
136951
137793
  exports.CLIP_PLAYBACK_OPTIONS = CLIP_PLAYBACK_OPTIONS;
@@ -136991,6 +137833,7 @@ exports.CUSTOMIZATION_BLOCK_NAME_PREFIX = require_implemented_methods.CUSTOMIZAT
136991
137833
  exports.CUSTOMIZE_APPLY_AUTHORITY_KINDS = CUSTOMIZE_APPLY_AUTHORITY_KINDS;
136992
137834
  exports.CUSTOMIZE_CARDINALITIES = CUSTOMIZE_CARDINALITIES;
136993
137835
  exports.CUSTOMIZE_EVENT_SHAPES = CUSTOMIZE_EVENT_SHAPES;
137836
+ exports.CUSTOMIZE_TARGET_SECTIONS = CUSTOMIZE_TARGET_SECTIONS;
136994
137837
  exports.CalendarColorSchema = CalendarColorSchema;
136995
137838
  exports.CalendarEntrySchema = CalendarEntrySchema;
136996
137839
  exports.CalendarEventSchema = CalendarEventSchema;
@@ -137550,11 +138393,13 @@ exports.FACE_RESCORE_INTERVAL_KEY = FACE_RESCORE_INTERVAL_KEY;
137550
138393
  exports.FACE_RESCORE_INTERVAL_MIN_RUNNING = FACE_RESCORE_INTERVAL_MIN_RUNNING;
137551
138394
  exports.FACE_RESCORE_SECTION_ID = FACE_RESCORE_SECTION_ID;
137552
138395
  exports.FAN_CAPTURE_FIELDS = FAN_CAPTURE_FIELDS;
137553
- exports.FAN_CAPTURE_GROUPS = FAN_CAPTURE_GROUPS;
138396
+ exports.FAN_OSCILLATION_AXES = FAN_OSCILLATION_AXES;
138397
+ exports.FAN_OSCILLATION_AXIS_LIMITS = FAN_OSCILLATION_AXIS_LIMITS;
138398
+ exports.FAN_OSCILLATION_AXIS_REFUSALS = FAN_OSCILLATION_AXIS_REFUSALS;
138399
+ exports.FAN_OSCILLATION_AXIS_SETTABLE = FAN_OSCILLATION_AXIS_SETTABLE;
137554
138400
  exports.FAN_OUT_CONCURRENCY = FAN_OUT_CONCURRENCY;
137555
138401
  exports.FAN_PRESETS_MAX = FAN_PRESETS_MAX;
137556
138402
  exports.FAN_PRESETS_REFUSALS = FAN_PRESETS_REFUSALS;
137557
- exports.FAN_PRESET_STEPS_MAX = FAN_PRESET_STEPS_MAX;
137558
138403
  exports.FEEDER_EXAMPLE_ADDON_ID = FEEDER_EXAMPLE_ADDON_ID;
137559
138404
  exports.FEEDER_EXAMPLE_HA_DEVICE_ID = FEEDER_EXAMPLE_HA_DEVICE_ID;
137560
138405
  exports.FEW_SHOT_COUNT = FEW_SHOT_COUNT;
@@ -137567,15 +138412,21 @@ exports.FailureContributionSchema = FailureContributionSchema;
137567
138412
  exports.FailureCounters = FailureCounters;
137568
138413
  exports.FailureReasonCountSchema = FailureReasonCountSchema;
137569
138414
  exports.FanCaptureFieldSchema = FanCaptureFieldSchema;
137570
- exports.FanCaptureGroupSchema = FanCaptureGroupSchema;
137571
- exports.FanCaptureItemSchema = FanCaptureItemSchema;
137572
138415
  exports.FanCaptureOmissionSchema = FanCaptureOmissionSchema;
137573
138416
  exports.FanControlStatusSchema = FanControlStatusSchema;
137574
138417
  exports.FanDirectionSchema = FanDirectionSchema;
138418
+ exports.FanOscillationAxesSchema = FanOscillationAxesSchema;
138419
+ exports.FanOscillationAxisFieldSchema = FanOscillationAxisFieldSchema;
138420
+ exports.FanOscillationAxisNameSchema = FanOscillationAxisNameSchema;
138421
+ exports.FanOscillationAxisRefusalSchema = FanOscillationAxisRefusalSchema;
138422
+ exports.FanOscillationAxisResultSchema = FanOscillationAxisResultSchema;
138423
+ exports.FanOscillationAxisSchema = FanOscillationAxisSchema;
137575
138424
  exports.FanPresetApplyResultSchema = FanPresetApplyResultSchema;
138425
+ exports.FanPresetAxisSchema = FanPresetAxisSchema;
137576
138426
  exports.FanPresetCaptureResultSchema = FanPresetCaptureResultSchema;
138427
+ exports.FanPresetFieldResultSchema = FanPresetFieldResultSchema;
137577
138428
  exports.FanPresetSchema = FanPresetSchema;
137578
- exports.FanPresetStepResultSchema = FanPresetStepResultSchema;
138429
+ exports.FanPresetStateSchema = FanPresetStateSchema;
137579
138430
  exports.FanPresetsRefusalSchema = FanPresetsRefusalSchema;
137580
138431
  exports.FanPresetsSetResultSchema = FanPresetsSetResultSchema;
137581
138432
  exports.FeatureManifestSchema = FeatureManifestSchema;
@@ -138417,6 +139268,7 @@ exports.PowerSourceActionResultSchema = PowerSourceActionResultSchema;
138417
139268
  exports.PowerSourceInfoSchema = PowerSourceInfoSchema;
138418
139269
  exports.PowerSourceRefusalReasonSchema = PowerSourceRefusalReasonSchema;
138419
139270
  exports.PowerSourceStateSchema = PowerSourceStateSchema;
139271
+ exports.PowerSwitchRefusedError = PowerSwitchRefusedError;
138420
139272
  exports.PrecisionGopsSchema = PrecisionGopsSchema;
138421
139273
  exports.PreferenceDeviceIdSchema = PreferenceDeviceIdSchema;
138422
139274
  exports.PreferenceNamespaceSchema = PreferenceNamespaceSchema;
@@ -138861,6 +139713,7 @@ exports.SessionPlacementPolicySchema = SessionPlacementPolicySchema;
138861
139713
  exports.SessionTriggerSchema = SessionTriggerSchema;
138862
139714
  exports.SetCameraSensorsInputSchema = SetCameraSensorsInputSchema;
138863
139715
  exports.SetLoggingSettingsInputSchema = SetLoggingSettingsInputSchema;
139716
+ exports.SetOscillationAxisInputSchema = SetOscillationAxisInputSchema;
138864
139717
  exports.SetShareSourceInputSchema = SetShareSourceInputSchema;
138865
139718
  exports.SetSiteLocationInputSchema = SetSiteLocationInputSchema;
138866
139719
  exports.SetTrackPurityInputSchema = SetTrackPurityInputSchema;
@@ -138981,8 +139834,10 @@ exports.TEMPLATE_KINDS = TEMPLATE_KINDS;
138981
139834
  exports.TEMPLATE_PAYLOAD_SCHEMAS = TEMPLATE_PAYLOAD_SCHEMAS;
138982
139835
  exports.TEMPLATE_WRITE_REFUSALS = TEMPLATE_WRITE_REFUSALS;
138983
139836
  exports.THRESHOLD_GRID_W = THRESHOLD_GRID_W;
139837
+ exports.TIMED_RUN_DEVICE_ROLES = TIMED_RUN_DEVICE_ROLES;
138984
139838
  exports.TIMED_RUN_DEVICE_TYPES = TIMED_RUN_DEVICE_TYPES;
138985
- exports.TIMED_RUN_LIMITS = TIMED_RUN_LIMITS;
139839
+ exports.TIMED_RUN_HEATER_LIMIT = TIMED_RUN_HEATER_LIMIT;
139840
+ exports.TIMED_RUN_PET_FOUNTAIN_LIMIT = TIMED_RUN_PET_FOUNTAIN_LIMIT;
138986
139841
  exports.TIMELAPSE_DENSE_FLOOR_SEC = TIMELAPSE_DENSE_FLOOR_SEC;
138987
139842
  exports.TIMEZONES = TIMEZONES;
138988
139843
  exports.TRACK_RELATIONS_DEFAULT_LIMIT = TRACK_RELATIONS_DEFAULT_LIMIT;
@@ -139243,6 +140098,7 @@ exports.allVocabActions = require_sleep.allVocabActions;
139243
140098
  exports.allowedSuppliedEffect = allowedSuppliedEffect;
139244
140099
  exports.ambientLightSensorCapability = ambientLightSensorCapability;
139245
140100
  exports.annotateClipsWithEventLabels = annotateClipsWithEventLabels;
140101
+ exports.anyAxisOscillating = anyAxisOscillating;
139246
140102
  exports.anySubjectMatches = anySubjectMatches;
139247
140103
  exports.appFlowLocation = appFlowLocation;
139248
140104
  exports.appendTrace = appendTrace;
@@ -139320,6 +140176,7 @@ exports.buildModelVariantGroups = buildModelVariantGroups;
139320
140176
  exports.buildNcTaxonomy = buildNcTaxonomy;
139321
140177
  exports.buildNotificationTargetInstances = buildNotificationTargetInstances;
139322
140178
  exports.buildPlusCatalogClassMap = buildPlusCatalogClassMap;
140179
+ exports.buildPowerSwitch = buildPowerSwitch;
139323
140180
  exports.buildRepairPrompt = buildRepairPrompt;
139324
140181
  exports.buildRoleScopes = buildRoleScopes;
139325
140182
  exports.buildSecretRef = require_sleep.buildSecretRef;
@@ -139352,7 +140209,9 @@ exports.canConvertUnit = require_convert.canConvertUnit;
139352
140209
  exports.canonicalEgressPlan = canonicalEgressPlan;
139353
140210
  exports.canonicalIconKey = canonicalIconKey;
139354
140211
  exports.canonicalJson = canonicalJson;
140212
+ exports.canonicalStoredDeviceType = canonicalStoredDeviceType;
139355
140213
  exports.canonicalizeAppCallback = canonicalizeAppCallback;
140214
+ exports.capAppliesToDeviceKind = capAppliesToDeviceKind;
139356
140215
  exports.capUnitResolver = capUnitResolver;
139357
140216
  exports.capabilityScopesOf = capabilityScopesOf;
139358
140217
  exports.capacityForModel = capacityForModel;
@@ -139381,6 +140240,7 @@ exports.clearKnownSecrets = require_sleep.clearKnownSecrets;
139381
140240
  exports.clearModelBoundOverrides = clearModelBoundOverrides;
139382
140241
  exports.clearModelBoundSetting = clearModelBoundSetting;
139383
140242
  exports.climateControlCapability = climateControlCapability;
140243
+ exports.climateRoleOf = climateRoleOf;
139384
140244
  exports.clipEventLabelDepsFromApi = clipEventLabelDepsFromApi;
139385
140245
  exports.clipExportFailure = clipExportFailure;
139386
140246
  exports.clipExportFailureOf = clipExportFailureOf;
@@ -139437,6 +140297,7 @@ exports.compositionSliceKey = require_implemented_methods.compositionSliceKey;
139437
140297
  exports.compositionSourceKey = require_implemented_methods.compositionSourceKey;
139438
140298
  exports.compositionSourceRefs = compositionSourceRefs;
139439
140299
  exports.compositionTargetCaps = compositionTargetCaps;
140300
+ exports.compositionUnionReads = compositionUnionReads;
139440
140301
  exports.computeCapacityShares = computeCapacityShares;
139441
140302
  exports.computeScores = computeScores;
139442
140303
  exports.conditionExclusionReason = conditionExclusionReason;
@@ -139654,6 +140515,7 @@ exports.extractSourceInfoFromMetadata = extractSourceInfoFromMetadata;
139654
140515
  exports.faceGalleryCapability = faceGalleryCapability;
139655
140516
  exports.failureContributionCapability = failureContributionCapability;
139656
140517
  exports.failureRate = failureRate;
140518
+ exports.fanAxisPath = fanAxisPath;
139657
140519
  exports.fanControlCapability = fanControlCapability;
139658
140520
  exports.fanOutTargets = fanOutTargets;
139659
140521
  exports.fanPresetsCapability = fanPresetsCapability;
@@ -139796,6 +140658,7 @@ exports.invocationFromEncodeProfile = require_implemented_methods.invocationFrom
139796
140658
  exports.irSourceProblem = irSourceProblem;
139797
140659
  exports.irTransmitterCapability = irTransmitterCapability;
139798
140660
  exports.isAgentOnlyPlacement = isAgentOnlyPlacement;
140661
+ exports.isAirConditioner = isAirConditioner;
139799
140662
  exports.isAlarmControllableCap = isAlarmControllableCap;
139800
140663
  exports.isAlertEpisodeOpen = isAlertEpisodeOpen;
139801
140664
  exports.isAlertEpisodeSeverity = isAlertEpisodeSeverity;
@@ -140140,6 +141003,9 @@ exports.plusCatalogDefaultClassFloors = plusCatalogDefaultClassFloors;
140140
141003
  exports.plusCatalogLabelFields = plusCatalogLabelFields;
140141
141004
  exports.poolMemoryThreshold = poolMemoryThreshold;
140142
141005
  exports.powerMeterCapability = powerMeterCapability;
141006
+ exports.powerOnFromSlice = powerOnFromSlice;
141007
+ exports.powerServedBy = powerServedBy;
141008
+ exports.powerSourceActuatorConflicts = powerSourceActuatorConflicts;
140143
141009
  exports.powerSourceCapability = powerSourceCapability;
140144
141010
  exports.powerSourceLinkOfComposition = powerSourceLinkOfComposition;
140145
141011
  exports.preconditionOf = preconditionOf;
@@ -140219,6 +141085,7 @@ exports.rectsToCells = rectsToCells;
140219
141085
  exports.reducePoints = reducePoints;
140220
141086
  exports.reducerForActive = reducerForActive;
140221
141087
  exports.registerKnownSecret = require_sleep.registerKnownSecret;
141088
+ exports.registerPowerSwitch = registerPowerSwitch;
140222
141089
  exports.registrySwitchPortsOver = require_sleep.registrySwitchPortsOver;
140223
141090
  exports.registrySwitchToBodyId = require_sleep.registrySwitchToBodyId;
140224
141091
  exports.registrySwitchToBodyMigration = require_sleep.registrySwitchToBodyMigration;
@@ -140421,7 +141288,6 @@ exports.smokeCapability = smokeCapability;
140421
141288
  exports.smtpProviderCapability = smtpProviderCapability;
140422
141289
  exports.smtpSinceKey = smtpSinceKey;
140423
141290
  exports.snapshotCapability = snapshotCapability;
140424
- exports.sourcePickForHeaterPlug = sourcePickForHeaterPlug;
140425
141291
  exports.sourcePickForHistory = sourcePickForHistory;
140426
141292
  exports.sourcePickForMath = sourcePickForMath;
140427
141293
  exports.sourcePickForTemplate = sourcePickForTemplate;