@camstack/addon-provider-hikvision 1.2.174 → 1.2.176

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/addon.js CHANGED
@@ -34,7 +34,7 @@ let node_os = require("node:os");
34
34
  let node_net = require("node:net");
35
35
  let node_http = require("node:http");
36
36
  let node_https = require("node:https");
37
- //#region ../types/dist/event-category-DHXxB8t9.mjs
37
+ //#region ../types/dist/event-category-CT-hz5Rb.mjs
38
38
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
39
39
  EventCategory["SystemBoot"] = "system.boot";
40
40
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -360,6 +360,14 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
360
360
  /** The recovery edge of {@link PipelineMotionNoisy}: the motion fell back, or a detection arrived. */
361
361
  EventCategory["PipelineMotionCalm"] = "pipeline.motion-calm";
362
362
  /**
363
+ * A camera's package LLM confirm has failed closed three times in a row
364
+ * (D931, 2026-10-26). One edge per camera until
365
+ * {@link PipelinePackageLlmAnswered}.
366
+ */
367
+ EventCategory["PipelinePackageLlmSilent"] = "pipeline.package-llm-silent";
368
+ /** The recovery edge of {@link PipelinePackageLlmSilent}: a confirm returned yes or no. */
369
+ EventCategory["PipelinePackageLlmAnswered"] = "pipeline.package-llm-answered";
370
+ /**
363
371
  * Per-camera pipeline config was mutated by the orchestrator
364
372
  * (a settings change via `setAgentInferenceDevices` /
365
373
  * `setCameraStepToggle` / `setCameraStepSettings`). Orchestrator
@@ -5469,7 +5477,7 @@ var ZodIssueCode = {
5469
5477
  var ZodFirstPartyTypeKind;
5470
5478
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5471
5479
  //#endregion
5472
- //#region ../types/dist/sleep-BErAxhul.mjs
5480
+ //#region ../types/dist/sleep-bykKrTgu.mjs
5473
5481
  /**
5474
5482
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5475
5483
  * window to float samples (D455).
@@ -8023,6 +8031,99 @@ var RecordKindDeclarationSchema = object({
8023
8031
  }).strict();
8024
8032
  /** The kind names: lower-case, dash separated, short enough for an index name. */
8025
8033
  var RecordKindNameSchema = string().regex(/^[a-z][a-z0-9-]{0,47}$/);
8034
+ var READING_QUANTITIES = [
8035
+ "temperature",
8036
+ "pressure",
8037
+ "speed",
8038
+ "precipitation",
8039
+ "precipitation-rate",
8040
+ "length",
8041
+ "area",
8042
+ "illuminance",
8043
+ "irradiance",
8044
+ "power",
8045
+ "energy",
8046
+ "voltage",
8047
+ "current",
8048
+ "apparent-power",
8049
+ "humidity",
8050
+ "percentage",
8051
+ "concentration-volume",
8052
+ "concentration-mass",
8053
+ "concentration-ppb",
8054
+ "volume",
8055
+ "duration",
8056
+ "duration-ms",
8057
+ "information",
8058
+ "sound-level",
8059
+ "signal-level",
8060
+ "colour-temperature",
8061
+ "angle",
8062
+ "bitrate",
8063
+ "rate",
8064
+ "mass",
8065
+ "index",
8066
+ "ratio",
8067
+ "count",
8068
+ "none",
8069
+ "device"
8070
+ ];
8071
+ var ReadingQuantitySchema = _enum(READING_QUANTITIES);
8072
+ new Set(READING_QUANTITIES);
8073
+ /**
8074
+ * Stored unit symbol for a quantity. `none` means the number is dimensionless
8075
+ * (or an index / ratio / count). `device` means the cap has no single unit.
8076
+ */
8077
+ var QUANTITY_BASE = {
8078
+ temperature: "°C",
8079
+ pressure: "hPa",
8080
+ speed: "m/s",
8081
+ precipitation: "mm",
8082
+ "precipitation-rate": "mm/h",
8083
+ length: "m",
8084
+ area: "m²",
8085
+ illuminance: "lx",
8086
+ irradiance: "W/m²",
8087
+ power: "W",
8088
+ energy: "kWh",
8089
+ voltage: "V",
8090
+ current: "A",
8091
+ "apparent-power": "VA",
8092
+ humidity: "%",
8093
+ percentage: "%",
8094
+ "concentration-volume": "ppm",
8095
+ "concentration-mass": "µg/m³",
8096
+ "concentration-ppb": "ppb",
8097
+ volume: "L",
8098
+ duration: "s",
8099
+ "duration-ms": "ms",
8100
+ information: "B",
8101
+ "sound-level": "dBFS",
8102
+ "signal-level": "dBm",
8103
+ "colour-temperature": "mired",
8104
+ angle: "°",
8105
+ bitrate: "kbps",
8106
+ rate: "fps",
8107
+ mass: "kg",
8108
+ index: "none",
8109
+ ratio: "none",
8110
+ count: "none",
8111
+ none: "none",
8112
+ device: "device"
8113
+ };
8114
+ /** The stored unit, or `undefined` when the quantity has no unit symbol. */
8115
+ function baseUnitOf(quantity) {
8116
+ const symbol = QUANTITY_BASE[quantity];
8117
+ if (symbol === "none" || symbol === "device") return void 0;
8118
+ return symbol;
8119
+ }
8120
+ function readingMeta(quantity, extras) {
8121
+ return {
8122
+ quantity,
8123
+ ...extras?.precision !== void 0 ? { precision: extras.precision } : {},
8124
+ ...extras?.label !== void 0 ? { label: extras.label } : {}
8125
+ };
8126
+ }
8026
8127
  /** Shared Zod schemas used across streaming capabilities. */
8027
8128
  var CamProfileSchema = _enum([
8028
8129
  "high",
@@ -8050,8 +8151,8 @@ var CamStreamKindSchema = _enum([
8050
8151
  "derived"
8051
8152
  ]);
8052
8153
  var CamStreamResolutionSchema = object({
8053
- width: number().int().positive(),
8054
- height: number().int().positive()
8154
+ width: number().int().positive().meta(readingMeta("none")),
8155
+ height: number().int().positive().meta(readingMeta("none"))
8055
8156
  });
8056
8157
  var CameraStreamSchema = object({
8057
8158
  /** Stable, provider-assigned id unique within the (deviceId) scope. */
@@ -8581,6 +8682,8 @@ var CAP_NAMES = Object.freeze([
8581
8682
  "filesystem-browse",
8582
8683
  "flood",
8583
8684
  "gas",
8685
+ "group-commands",
8686
+ "group-status",
8584
8687
  "heating-valve",
8585
8688
  "humidifier",
8586
8689
  "humidity-sensor",
@@ -8710,14 +8813,6 @@ Object.freeze({
8710
8813
  {
8711
8814
  "path": "aqi",
8712
8815
  "valueType": "number"
8713
- },
8714
- {
8715
- "path": "unit",
8716
- "valueType": "string"
8717
- },
8718
- {
8719
- "path": "precision",
8720
- "valueType": "number"
8721
8816
  }
8722
8817
  ],
8723
8818
  "alarm-panel": [
@@ -8753,20 +8848,10 @@ Object.freeze({
8753
8848
  "valueType": "boolean"
8754
8849
  }
8755
8850
  ],
8756
- "ambient-light-sensor": [
8757
- {
8758
- "path": "lux",
8759
- "valueType": "number"
8760
- },
8761
- {
8762
- "path": "unit",
8763
- "valueType": "string"
8764
- },
8765
- {
8766
- "path": "precision",
8767
- "valueType": "number"
8768
- }
8769
- ],
8851
+ "ambient-light-sensor": [{
8852
+ "path": "lux",
8853
+ "valueType": "number"
8854
+ }],
8770
8855
  "audio-metrics": [
8771
8856
  {
8772
8857
  "path": "ts",
@@ -8846,6 +8931,10 @@ Object.freeze({
8846
8931
  "path": "lastUpdated",
8847
8932
  "valueType": "number"
8848
8933
  },
8934
+ {
8935
+ "path": "volts",
8936
+ "valueType": "number"
8937
+ },
8849
8938
  {
8850
8939
  "path": "lastContactAt",
8851
8940
  "valueType": "number"
@@ -9088,10 +9177,6 @@ Object.freeze({
9088
9177
  "datetime"
9089
9178
  ]
9090
9179
  },
9091
- {
9092
- "path": "unit",
9093
- "valueType": "string"
9094
- },
9095
9180
  {
9096
9181
  "path": "min",
9097
9182
  "valueType": "number"
@@ -9103,19 +9188,6 @@ Object.freeze({
9103
9188
  {
9104
9189
  "path": "step",
9105
9190
  "valueType": "number"
9106
- },
9107
- {
9108
- "path": "precision",
9109
- "valueType": "number"
9110
- },
9111
- {
9112
- "path": "format",
9113
- "valueType": "enum",
9114
- "enumValues": [
9115
- "date",
9116
- "time",
9117
- "datetime"
9118
- ]
9119
9191
  }
9120
9192
  ],
9121
9193
  "cover": [
@@ -9356,13 +9428,8 @@ Object.freeze({
9356
9428
  "path": "value",
9357
9429
  "valueType": "string"
9358
9430
  }, {
9359
- "path": "format",
9360
- "valueType": "enum",
9361
- "enumValues": [
9362
- "date",
9363
- "time",
9364
- "datetime"
9365
- ]
9431
+ "path": "timestamp",
9432
+ "valueType": "boolean"
9366
9433
  }],
9367
9434
  "event-emitter": [
9368
9435
  {
@@ -9435,6 +9502,20 @@ Object.freeze({
9435
9502
  "path": "detected",
9436
9503
  "valueType": "boolean"
9437
9504
  }],
9505
+ "group-status": [
9506
+ {
9507
+ "path": "included",
9508
+ "valueType": "number"
9509
+ },
9510
+ {
9511
+ "path": "excluded",
9512
+ "valueType": "number"
9513
+ },
9514
+ {
9515
+ "path": "total",
9516
+ "valueType": "number"
9517
+ }
9518
+ ],
9438
9519
  "heating-valve": [{
9439
9520
  "path": "position",
9440
9521
  "valueType": "number"
@@ -9469,20 +9550,10 @@ Object.freeze({
9469
9550
  "valueType": "number"
9470
9551
  }
9471
9552
  ],
9472
- "humidity-sensor": [
9473
- {
9474
- "path": "percent",
9475
- "valueType": "number"
9476
- },
9477
- {
9478
- "path": "unit",
9479
- "valueType": "string"
9480
- },
9481
- {
9482
- "path": "precision",
9483
- "valueType": "number"
9484
- }
9485
- ],
9553
+ "humidity-sensor": [{
9554
+ "path": "percent",
9555
+ "valueType": "number"
9556
+ }],
9486
9557
  "image": [{
9487
9558
  "path": "url",
9488
9559
  "valueType": "string"
@@ -9821,20 +9892,10 @@ Object.freeze({
9821
9892
  "valueType": "boolean"
9822
9893
  }
9823
9894
  ],
9824
- "numeric-sensor": [
9825
- {
9826
- "path": "value",
9827
- "valueType": "number"
9828
- },
9829
- {
9830
- "path": "unit",
9831
- "valueType": "string"
9832
- },
9833
- {
9834
- "path": "precision",
9835
- "valueType": "number"
9836
- }
9837
- ],
9895
+ "numeric-sensor": [{
9896
+ "path": "value",
9897
+ "valueType": "number"
9898
+ }],
9838
9899
  "pet-feeder": [
9839
9900
  {
9840
9901
  "path": "foodLevel",
@@ -9926,14 +9987,6 @@ Object.freeze({
9926
9987
  {
9927
9988
  "path": "powerFactor",
9928
9989
  "valueType": "number"
9929
- },
9930
- {
9931
- "path": "unit",
9932
- "valueType": "string"
9933
- },
9934
- {
9935
- "path": "precision",
9936
- "valueType": "number"
9937
9990
  }
9938
9991
  ],
9939
9992
  "presence": [
@@ -9962,20 +10015,10 @@ Object.freeze({
9962
10015
  "valueType": "number"
9963
10016
  }
9964
10017
  ],
9965
- "pressure-sensor": [
9966
- {
9967
- "path": "hpa",
9968
- "valueType": "number"
9969
- },
9970
- {
9971
- "path": "unit",
9972
- "valueType": "string"
9973
- },
9974
- {
9975
- "path": "precision",
9976
- "valueType": "number"
9977
- }
9978
- ],
10018
+ "pressure-sensor": [{
10019
+ "path": "hpa",
10020
+ "valueType": "number"
10021
+ }],
9979
10022
  "privacy-mask": [{
9980
10023
  "path": "enabled",
9981
10024
  "valueType": "boolean"
@@ -10286,20 +10329,10 @@ Object.freeze({
10286
10329
  "path": "tampered",
10287
10330
  "valueType": "boolean"
10288
10331
  }],
10289
- "temperature-sensor": [
10290
- {
10291
- "path": "celsius",
10292
- "valueType": "number"
10293
- },
10294
- {
10295
- "path": "unit",
10296
- "valueType": "string"
10297
- },
10298
- {
10299
- "path": "precision",
10300
- "valueType": "number"
10301
- }
10302
- ],
10332
+ "temperature-sensor": [{
10333
+ "path": "celsius",
10334
+ "valueType": "number"
10335
+ }],
10303
10336
  "update": [
10304
10337
  {
10305
10338
  "path": "currentVersion",
@@ -10410,10 +10443,6 @@ Object.freeze({
10410
10443
  "path": "temperature",
10411
10444
  "valueType": "number"
10412
10445
  },
10413
- {
10414
- "path": "temperatureUnit",
10415
- "valueType": "string"
10416
- },
10417
10446
  {
10418
10447
  "path": "humidity",
10419
10448
  "valueType": "number"
@@ -10422,18 +10451,10 @@ Object.freeze({
10422
10451
  "path": "pressure",
10423
10452
  "valueType": "number"
10424
10453
  },
10425
- {
10426
- "path": "pressureUnit",
10427
- "valueType": "string"
10428
- },
10429
10454
  {
10430
10455
  "path": "windSpeed",
10431
10456
  "valueType": "number"
10432
10457
  },
10433
- {
10434
- "path": "windSpeedUnit",
10435
- "valueType": "string"
10436
- },
10437
10458
  {
10438
10459
  "path": "windBearing",
10439
10460
  "valueType": "number"
@@ -10840,7 +10861,7 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
10840
10861
  return DeviceRole;
10841
10862
  }({});
10842
10863
  //#endregion
10843
- //#region ../types/dist/composition-kEl9mevu.mjs
10864
+ //#region ../types/dist/composition-OhpuespA.mjs
10844
10865
  /**
10845
10866
  * The ffmpeg build every CamStack node downloads, per platform and arch.
10846
10867
  *
@@ -11595,15 +11616,74 @@ function validateExpressionSource(src) {
11595
11616
  }
11596
11617
  return null;
11597
11618
  }
11598
- /** A composed device's stableId is this prefix plus the block id. */
11599
- var COMPOSED_DEVICE_STABLE_ID_PREFIX = "composed-";
11600
- /** Longest snippet a `code` source may carry (slice 4). */
11601
- var MAX_COMPOSITION_CODE_LENGTH = 2e4;
11619
+ /**
11620
+ * A composition source identity: `(addonId, stableId)`, never a numeric device
11621
+ * id. Split out so helper schemas can name it without a cycle through
11622
+ * `composition.ts` (D659).
11623
+ */
11602
11624
  var CompositionSourceRefSchema = object({
11603
11625
  /** The owning addon; `stableId` is unique only within it. */
11604
11626
  addonId: string().min(1),
11605
11627
  stableId: string().min(1)
11606
11628
  });
11629
+ var GROUP_TEMPLATE_IDS = [
11630
+ "temperature",
11631
+ "humidity",
11632
+ "pressure",
11633
+ "illuminance",
11634
+ "power",
11635
+ "energy",
11636
+ "battery",
11637
+ "numeric",
11638
+ "motion",
11639
+ "contact",
11640
+ "leak",
11641
+ "smoke",
11642
+ "occupancy",
11643
+ "binary",
11644
+ "switch",
11645
+ "light"
11646
+ ];
11647
+ var NUMERIC_AGGREGATES = [
11648
+ "mean",
11649
+ "median",
11650
+ "min",
11651
+ "max",
11652
+ "sum"
11653
+ ];
11654
+ var BINARY_AGGREGATES = ["any", "all"];
11655
+ /** How an actuator group decides it is on. Unknown members never count as off. */
11656
+ var ACTIVE_CRITERIA = ["at-least-one", "all"];
11657
+ var AGGREGATE_REDUCERS = [
11658
+ "mean",
11659
+ "median",
11660
+ "min",
11661
+ "max",
11662
+ "sum",
11663
+ "any",
11664
+ "all"
11665
+ ];
11666
+ var GroupTemplateIdSchema = _enum(GROUP_TEMPLATE_IDS);
11667
+ var AggregateReducerSchema = _enum(AGGREGATE_REDUCERS);
11668
+ var ActiveCriterionSchema = _enum(ACTIVE_CRITERIA);
11669
+ /** One member. The field is stored so occupancy can name motion or binary. */
11670
+ var HelperMemberSchema = object({
11671
+ source: CompositionSourceRefSchema,
11672
+ cap: string().min(1),
11673
+ fieldPath: string().min(1)
11674
+ });
11675
+ var HelperSpecSchema = discriminatedUnion("kind", [object({
11676
+ kind: literal("group"),
11677
+ templateId: GroupTemplateIdSchema,
11678
+ aggregate: AggregateReducerSchema,
11679
+ members: array(HelperMemberSchema).min(1).max(64),
11680
+ /** Actuator groups only. Readings leave this unset. */
11681
+ active: ActiveCriterionSchema.optional()
11682
+ })]);
11683
+ /** A composed device's stableId is this prefix plus the block id. */
11684
+ var COMPOSED_DEVICE_STABLE_ID_PREFIX = "composed-";
11685
+ /** Longest snippet a `code` source may carry (slice 4). */
11686
+ var MAX_COMPOSITION_CODE_LENGTH = 2e4;
11607
11687
  /** One field of one capability of one source device. */
11608
11688
  var CompositionFieldReadSchema = object({
11609
11689
  source: CompositionSourceRefSchema,
@@ -11647,7 +11727,33 @@ var CompositionCodeSourceSchema = object({
11647
11727
  var CompositionFieldSourceSchema = discriminatedUnion("kind", [
11648
11728
  CompositionFromSourceSchema,
11649
11729
  CompositionExpressionSourceSchema,
11650
- CompositionCodeSourceSchema
11730
+ CompositionCodeSourceSchema,
11731
+ object({
11732
+ kind: literal("aggregate"),
11733
+ reducer: _enum([
11734
+ "mean",
11735
+ "median",
11736
+ "min",
11737
+ "max",
11738
+ "sum",
11739
+ "any",
11740
+ "all"
11741
+ ]),
11742
+ reads: array(CompositionFieldReadSchema).min(1).max(64),
11743
+ /** `value` is the reading; the others are the member counts. */
11744
+ publish: _enum([
11745
+ "value",
11746
+ "included",
11747
+ "excluded",
11748
+ "total"
11749
+ ]),
11750
+ /** What a `value` publish does when nobody is included. Counts ignore this. */
11751
+ empty: _enum([
11752
+ "null",
11753
+ "omit",
11754
+ "offline"
11755
+ ])
11756
+ })
11651
11757
  ]);
11652
11758
  var CompositionCommandTargetSchema = discriminatedUnion("kind", [object({
11653
11759
  kind: literal("forward"),
@@ -11693,7 +11799,13 @@ var CompositionSchema = object({
11693
11799
  kind: literal("existing"),
11694
11800
  device: CompositionSourceRefSchema
11695
11801
  })]),
11696
- features: array(CompositionFeatureSchema).min(1).max(16)
11802
+ features: array(CompositionFeatureSchema).min(1).max(16),
11803
+ /**
11804
+ * Present when the block is a helper template. Absent on a free
11805
+ * composition (the room example, device 4603). The editor reads this,
11806
+ * never the compiled features.
11807
+ */
11808
+ helper: HelperSpecSchema.optional()
11697
11809
  }).superRefine((composition, ctx) => {
11698
11810
  const seen = /* @__PURE__ */ new Set();
11699
11811
  composition.features.forEach((feature, index) => {
@@ -18220,7 +18332,11 @@ var CompositionProblemSchema = object({
18220
18332
  "item-field-reserved",
18221
18333
  "target-missing",
18222
18334
  "target-unreadable",
18223
- "not-replaceable"
18335
+ "not-replaceable",
18336
+ "native-capability-replace",
18337
+ "mixed-quantity",
18338
+ "helper-mismatch",
18339
+ "member-constraint"
18224
18340
  ]),
18225
18341
  path: string(),
18226
18342
  message: string()
@@ -18241,7 +18357,8 @@ var CompositionUnavailableModeSchema = _enum([
18241
18357
  "null",
18242
18358
  "offline",
18243
18359
  "unknown",
18244
- "release"
18360
+ "release",
18361
+ "omit"
18245
18362
  ]);
18246
18363
  /**
18247
18364
  * `derived` reads a source · `clock` reads only `now`, recomputed when a sibling
@@ -18278,9 +18395,11 @@ var CompositionFieldPlanSchema = object({
18278
18395
  reads: array(CompositionFieldReadSchema)
18279
18396
  });
18280
18397
  /**
18281
- * What a feature does to its target (D663): `new` builds a capability on a new
18282
- * device; on an existing device it `add`s a capability the device lacks, or
18283
- * `replace`s named fields of one it has natively.
18398
+ * What a feature does to its target (D663, D944): `new` builds a capability on a
18399
+ * new device; on an existing device it `add`s a capability the device lacks.
18400
+ * Replacing a capability the device already serves is refused
18401
+ * (`native-capability-replace`), not planned. `replace` remains on the claim
18402
+ * wire for a claim the hub already holds.
18284
18403
  */
18285
18404
  var CompositionFeatureModeSchema = _enum([
18286
18405
  "new",
@@ -18453,6 +18572,275 @@ Object.freeze({
18453
18572
  result: ["number", "null"]
18454
18573
  }
18455
18574
  });
18575
+ /**
18576
+ * One catalog row per base reading a group helper can build (D944 §3).
18577
+ * Data, not a form default written into the block.
18578
+ */
18579
+ var NOW = {
18580
+ fieldPath: "lastFetchedAt",
18581
+ expr: "now"
18582
+ };
18583
+ var CHANGED = {
18584
+ fieldPath: "lastChangedAt",
18585
+ expr: "now"
18586
+ };
18587
+ function numeric(input) {
18588
+ return {
18589
+ ...input,
18590
+ family: "numeric",
18591
+ deviceType: DeviceType.Sensor,
18592
+ memberDeviceType: DeviceType.Sensor,
18593
+ commandCaps: [],
18594
+ baseUnit: baseUnitOf(input.quantity),
18595
+ aggregates: NUMERIC_AGGREGATES,
18596
+ accept: [{
18597
+ cap: input.outputCap,
18598
+ fieldPath: input.outputField
18599
+ }]
18600
+ };
18601
+ }
18602
+ function binary(input) {
18603
+ return {
18604
+ ...input,
18605
+ family: "binary",
18606
+ deviceType: DeviceType.Sensor,
18607
+ memberDeviceType: DeviceType.Sensor,
18608
+ commandCaps: [],
18609
+ quantity: "none",
18610
+ baseUnit: void 0,
18611
+ aggregates: BINARY_AGGREGATES,
18612
+ empty: "offline"
18613
+ };
18614
+ }
18615
+ var GROUP_TEMPLATES = [
18616
+ numeric({
18617
+ id: "temperature",
18618
+ summary: "Mean, median, min, max or sum of temperatures. Offline and unknown members are left out, never read as 0 °C.",
18619
+ role: DeviceRole.TemperatureSensor,
18620
+ outputCap: "temperature-sensor",
18621
+ outputField: "celsius",
18622
+ quantity: "temperature",
18623
+ defaultAggregate: "mean",
18624
+ empty: "null",
18625
+ companions: [NOW]
18626
+ }),
18627
+ numeric({
18628
+ id: "humidity",
18629
+ summary: "Humidity in percent. Offline and unknown members are left out, never read as 0 %.",
18630
+ role: DeviceRole.HumiditySensor,
18631
+ outputCap: "humidity-sensor",
18632
+ outputField: "percent",
18633
+ quantity: "humidity",
18634
+ defaultAggregate: "mean",
18635
+ empty: "null",
18636
+ companions: [NOW]
18637
+ }),
18638
+ numeric({
18639
+ id: "pressure",
18640
+ summary: "Pressure in hectopascals. Offline and unknown members are left out, never read as 0 hPa.",
18641
+ role: DeviceRole.PressureSensor,
18642
+ outputCap: "pressure-sensor",
18643
+ outputField: "hpa",
18644
+ quantity: "pressure",
18645
+ defaultAggregate: "mean",
18646
+ empty: "null",
18647
+ companions: [NOW]
18648
+ }),
18649
+ numeric({
18650
+ id: "illuminance",
18651
+ summary: "Illuminance in lux. Offline and unknown members are left out, never read as 0 lx.",
18652
+ role: DeviceRole.AmbientLightSensor,
18653
+ outputCap: "ambient-light-sensor",
18654
+ outputField: "lux",
18655
+ quantity: "illuminance",
18656
+ defaultAggregate: "mean",
18657
+ empty: "null",
18658
+ companions: [NOW]
18659
+ }),
18660
+ numeric({
18661
+ id: "power",
18662
+ summary: "Power in watts, summed by default. Nobody reporting omits the key rather than writing 0 W.",
18663
+ role: DeviceRole.PowerSensor,
18664
+ outputCap: "power-meter",
18665
+ outputField: "watts",
18666
+ quantity: "power",
18667
+ defaultAggregate: "sum",
18668
+ empty: "omit",
18669
+ companions: [NOW]
18670
+ }),
18671
+ numeric({
18672
+ id: "energy",
18673
+ summary: "Energy in kilowatt-hours, summed by default. Nobody reporting omits the key rather than writing 0 kWh.",
18674
+ role: DeviceRole.EnergySensor,
18675
+ outputCap: "power-meter",
18676
+ outputField: "kwhTotal",
18677
+ quantity: "energy",
18678
+ defaultAggregate: "sum",
18679
+ empty: "omit",
18680
+ companions: [NOW]
18681
+ }),
18682
+ numeric({
18683
+ id: "battery",
18684
+ summary: "Battery charge in percent. Offline and unknown members are left out, never read as 0 %.",
18685
+ role: DeviceRole.BatterySensor,
18686
+ outputCap: "battery",
18687
+ outputField: "percentage",
18688
+ quantity: "percentage",
18689
+ defaultAggregate: "mean",
18690
+ empty: "null",
18691
+ companions: [
18692
+ {
18693
+ fieldPath: "charging",
18694
+ expr: "\"unknown\""
18695
+ },
18696
+ {
18697
+ fieldPath: "sleeping",
18698
+ expr: "false"
18699
+ },
18700
+ {
18701
+ fieldPath: "lastUpdated",
18702
+ expr: "now"
18703
+ }
18704
+ ]
18705
+ }),
18706
+ numeric({
18707
+ id: "numeric",
18708
+ summary: "A numeric reading in the members’ shared quantity. Mixed quantities are refused. Nobody reporting publishes null, not 0.",
18709
+ role: DeviceRole.NumericSensor,
18710
+ outputCap: "numeric-sensor",
18711
+ outputField: "value",
18712
+ quantity: "device",
18713
+ defaultAggregate: "mean",
18714
+ empty: "null",
18715
+ companions: [NOW]
18716
+ }),
18717
+ binary({
18718
+ id: "motion",
18719
+ summary: "Any or all motion. Offline and unknown members are left out, never read as off. Nobody reporting takes the device offline.",
18720
+ role: DeviceRole.MotionSensor,
18721
+ outputCap: "motion",
18722
+ outputField: "detected",
18723
+ defaultAggregate: "any",
18724
+ accept: [{
18725
+ cap: "motion",
18726
+ fieldPath: "detected"
18727
+ }],
18728
+ companions: [{
18729
+ fieldPath: "lastDetectedAt",
18730
+ expr: "null"
18731
+ }, {
18732
+ fieldPath: "autoClearAfterMs",
18733
+ expr: "null"
18734
+ }]
18735
+ }),
18736
+ binary({
18737
+ id: "contact",
18738
+ summary: "Any or all open contacts. Offline and unknown members are left out, never read as closed.",
18739
+ role: DeviceRole.ContactSensor,
18740
+ outputCap: "contact",
18741
+ outputField: "entryOpen",
18742
+ defaultAggregate: "any",
18743
+ accept: [{
18744
+ cap: "contact",
18745
+ fieldPath: "entryOpen"
18746
+ }],
18747
+ companions: [CHANGED]
18748
+ }),
18749
+ binary({
18750
+ id: "leak",
18751
+ summary: "Any or all leak detections. Offline and unknown members are left out, never read as dry.",
18752
+ role: DeviceRole.LeakSensor,
18753
+ outputCap: "flood",
18754
+ outputField: "flooded",
18755
+ defaultAggregate: "any",
18756
+ accept: [{
18757
+ cap: "flood",
18758
+ fieldPath: "flooded"
18759
+ }],
18760
+ companions: [CHANGED]
18761
+ }),
18762
+ binary({
18763
+ id: "smoke",
18764
+ summary: "Any or all smoke detections. Offline and unknown members are left out, never read as clear.",
18765
+ role: DeviceRole.SmokeSensor,
18766
+ outputCap: "smoke",
18767
+ outputField: "detected",
18768
+ defaultAggregate: "any",
18769
+ accept: [{
18770
+ cap: "smoke",
18771
+ fieldPath: "detected"
18772
+ }],
18773
+ companions: [CHANGED]
18774
+ }),
18775
+ binary({
18776
+ id: "occupancy",
18777
+ summary: "Any or all of motion or binary sensors, published as a binary. Presence zones are not aggregated. Nobody reporting is offline, not off.",
18778
+ role: DeviceRole.BinarySensor,
18779
+ outputCap: "binary",
18780
+ outputField: "on",
18781
+ defaultAggregate: "any",
18782
+ accept: [{
18783
+ cap: "motion",
18784
+ fieldPath: "detected"
18785
+ }, {
18786
+ cap: "binary",
18787
+ fieldPath: "on"
18788
+ }],
18789
+ companions: [CHANGED]
18790
+ }),
18791
+ binary({
18792
+ id: "binary",
18793
+ summary: "Any or all generic binary sensors. Offline and unknown members are left out, never read as off.",
18794
+ role: DeviceRole.BinarySensor,
18795
+ outputCap: "binary",
18796
+ outputField: "on",
18797
+ defaultAggregate: "any",
18798
+ accept: [{
18799
+ cap: "binary",
18800
+ fieldPath: "on"
18801
+ }],
18802
+ companions: [CHANGED]
18803
+ }),
18804
+ actuator({
18805
+ id: "switch",
18806
+ summary: "On when at least one switch is on, or when all of them are. Offline and unknown members are left out of that decision, never read as off, and still receive the command.",
18807
+ deviceType: DeviceType.Switch,
18808
+ outputCap: "switch",
18809
+ commandCaps: ["switch"]
18810
+ }),
18811
+ actuator({
18812
+ id: "light",
18813
+ summary: "On when at least one light is on, or when all of them are. Brightness and colour are offered only when every member has them. A command is not sent to a member that lacks it.",
18814
+ deviceType: DeviceType.Light,
18815
+ outputCap: "switch",
18816
+ commandCaps: [
18817
+ "switch",
18818
+ "brightness",
18819
+ "color"
18820
+ ]
18821
+ })
18822
+ ];
18823
+ function actuator(input) {
18824
+ return {
18825
+ ...input,
18826
+ family: "actuator",
18827
+ role: void 0,
18828
+ memberDeviceType: input.deviceType,
18829
+ outputField: "on",
18830
+ quantity: "none",
18831
+ baseUnit: void 0,
18832
+ aggregates: BINARY_AGGREGATES,
18833
+ defaultAggregate: "any",
18834
+ empty: "offline",
18835
+ accept: [{
18836
+ cap: "switch",
18837
+ fieldPath: "on"
18838
+ }],
18839
+ companions: [CHANGED]
18840
+ };
18841
+ }
18842
+ new Map(GROUP_TEMPLATES.map((template) => [template.id, template]));
18843
+ DeviceFeature.LightColorRgb, DeviceFeature.LightColorHsv, DeviceFeature.LightColorMired;
18456
18844
  `${COMPOSED_DEVICE_STABLE_ID_PREFIX}`;
18457
18845
  /**
18458
18846
  * What a composition may BUILD on a device type (G2, D676): the caps a new
@@ -20279,12 +20667,12 @@ function buildDeviceAdminUrl(parts) {
20279
20667
  * providers detect renames by matching `uniqueId` and patch `id`
20280
20668
  * in-place so dispatch keeps working.
20281
20669
  *
20282
- * **Rendering metadata is NOT stored here.** Display fields (`unit`,
20283
- * `precision`) live in the cap STATUS SLICE so they flow live with every
20284
- * state push and are the single source of truth. The `device_class` tag is
20285
- * an HA-specific input that is consumed at the discovery boundary
20286
- * (`ha-domain-mapping`) to derive the CamStack `DeviceRole`; it is never
20287
- * stored after that point.
20670
+ * **Display unit and precision are NOT stored here.** They are a read-time
20671
+ * preference (D944). A polymorphic reading stores its `quantity` here once,
20672
+ * at adopt, and a date/time value stores `dateTimeShape` the same way —
20673
+ * neither is repeated on each sample. The `device_class` tag is an
20674
+ * HA-specific input consumed at the discovery boundary (`ha-domain-mapping`)
20675
+ * to derive the CamStack `DeviceRole`; it is never stored after that point.
20288
20676
  *
20289
20677
  * The `raw` escape hatch carries provider-specific attributes that don't
20290
20678
  * fit the structured slots (HA `attributes` whitelist, Reolink `deviceCache`
@@ -20298,6 +20686,14 @@ var SourceInfoSchema = object({
20298
20686
  /** Immutable upstream identifier when available (HA `unique_id`, … ).
20299
20687
  * Used to detect rename when `id` changes. */
20300
20688
  uniqueId: string().optional(),
20689
+ /** Quantity of a polymorphic reading, written once at adopt (D944). */
20690
+ quantity: ReadingQuantitySchema.optional(),
20691
+ /** Date / time / datetime shape of a string reading, written once at adopt. */
20692
+ dateTimeShape: _enum([
20693
+ "date",
20694
+ "time",
20695
+ "datetime"
20696
+ ]).optional(),
20301
20697
  /** Provider-specific extras that don't fit the structured slots.
20302
20698
  * Whitelist what goes here per provider — do NOT dump entire HA
20303
20699
  * attribute blobs (would explode the meta JSON column). */
@@ -41402,7 +41798,8 @@ method(object({
41402
41798
  "enum"
41403
41799
  ]),
41404
41800
  enumValues: array(string()).optional(),
41405
- item: boolean().optional()
41801
+ item: boolean().optional(),
41802
+ quantity: ReadingQuantitySchema.optional()
41406
41803
  })).readonly(),
41407
41804
  itemArray: object({
41408
41805
  path: string(),
@@ -45265,8 +45662,8 @@ var MaskPolygonShapeSchema = object({
45265
45662
  /** Boolean cell grid — row-major, length === gridWidth*gridHeight. */
45266
45663
  var MaskGridShapeSchema = object({
45267
45664
  kind: literal("grid"),
45268
- gridWidth: number(),
45269
- gridHeight: number(),
45665
+ gridWidth: number().meta(readingMeta("none")),
45666
+ gridHeight: number().meta(readingMeta("none")),
45270
45667
  cells: array(boolean())
45271
45668
  });
45272
45669
  discriminatedUnion("kind", [
@@ -45378,6 +45775,8 @@ var NcSystemEventKindSchema = _enum([
45378
45775
  "detection-blind",
45379
45776
  "motion-noisy",
45380
45777
  "motion-calm",
45778
+ "package-llm-silent",
45779
+ "package-llm-answered",
45381
45780
  "recording-stalled",
45382
45781
  "recording-healthy",
45383
45782
  "recording-degraded",
@@ -56991,6 +57390,28 @@ var PackageVersionInfoSchema = object({
56991
57390
  deprecated: string().optional(),
56992
57391
  distTags: array(string()).readonly()
56993
57392
  });
57393
+ /**
57394
+ * One published document. `ok` is markdown from the registry. `missing` means
57395
+ * the registry answered and the file was not there. `error` is a registry or
57396
+ * tarball failure — never an empty string standing in for either.
57397
+ */
57398
+ var PackageDocBodySchema = discriminatedUnion("status", [
57399
+ object({
57400
+ status: literal("ok"),
57401
+ markdown: string()
57402
+ }),
57403
+ object({ status: literal("missing") }),
57404
+ object({
57405
+ status: literal("error"),
57406
+ message: string()
57407
+ })
57408
+ ]);
57409
+ var PackageDocsSchema = object({
57410
+ name: string(),
57411
+ version: string(),
57412
+ readme: PackageDocBodySchema,
57413
+ changelog: PackageDocBodySchema
57414
+ });
56994
57415
  var SearchResultSchema = object({
56995
57416
  name: string(),
56996
57417
  version: string(),
@@ -57209,7 +57630,10 @@ method(object({ nodeId: string().optional() }).optional(), array(AddonListItemSc
57209
57630
  }), object({ success: literal(true) }), {
57210
57631
  kind: "mutation",
57211
57632
  auth: "admin"
57212
- }), method(object({ name: string() }), array(PackageVersionInfoSchema).readonly()), method(object({ addonId: string() }), RestartAddonResultSchema, {
57633
+ }), method(object({ name: string() }), array(PackageVersionInfoSchema).readonly()), method(object({
57634
+ name: string().min(1),
57635
+ version: string().min(1).optional()
57636
+ }), PackageDocsSchema, { auth: "admin" }), method(object({ addonId: string() }), RestartAddonResultSchema, {
57213
57637
  kind: "mutation",
57214
57638
  auth: "admin"
57215
57639
  }), method(object({ packageName: string() }), object({ success: literal(true) }), {
@@ -57268,27 +57692,17 @@ method(object({ nodeId: string().optional() }).optional(), array(AddonListItemSc
57268
57692
  */
57269
57693
  var AirQualitySensorStatusSchema = object({
57270
57694
  /** Carbon dioxide concentration in ppm. */
57271
- co2Ppm: number().min(0).optional(),
57695
+ co2Ppm: number().min(0).optional().meta(readingMeta("concentration-volume")),
57272
57696
  /** Total volatile organic compounds in ppb. */
57273
- vocPpb: number().min(0).optional(),
57697
+ vocPpb: number().min(0).optional().meta(readingMeta("concentration-ppb")),
57274
57698
  /** Particulate matter ≤ 2.5 μm in µg/m³. */
57275
- pm25: number().min(0).optional(),
57699
+ pm25: number().min(0).optional().meta(readingMeta("concentration-mass")),
57276
57700
  /** Particulate matter ≤ 10 μm in µg/m³. */
57277
- pm10: number().min(0).optional(),
57701
+ pm10: number().min(0).optional().meta(readingMeta("concentration-mass")),
57278
57702
  /** Composite AQI value (typically 0..500). */
57279
- aqi: number().optional(),
57703
+ aqi: number().optional().meta(readingMeta("index")),
57280
57704
  /** Ms epoch when the slice was last updated. */
57281
- lastFetchedAt: number(),
57282
- /** Live display unit of the single metric this slice carries (e.g. HA
57283
- * `attributes.unit_of_measurement` → 'ppm' / 'ppb' / 'µg/m³'). Each
57284
- * upstream `sensor.*` entity surfaces ONE device_class, so one unit
57285
- * per slice is unambiguous. */
57286
- unit: string().optional(),
57287
- /** Suggested decimal places for numeric display.
57288
- * Populated live from the upstream source when provided (e.g. HA
57289
- * `attributes.suggested_display_precision`). Falls back to
57290
- * auto-formatting when absent. */
57291
- precision: number().int().min(0).max(10).optional()
57705
+ lastFetchedAt: number()
57292
57706
  });
57293
57707
  var airQualitySensorCapability = {
57294
57708
  name: "air-quality-sensor",
@@ -57325,12 +57739,12 @@ var airQualitySensorCapability = {
57325
57739
  },
57326
57740
  pm25: {
57327
57741
  kind: "gauge",
57328
- unit: "ug/m3",
57742
+ unit: "µg/m³",
57329
57743
  deadband: 1
57330
57744
  },
57331
57745
  pm10: {
57332
57746
  kind: "gauge",
57333
- unit: "ug/m3",
57747
+ unit: "µg/m³",
57334
57748
  deadband: 1
57335
57749
  },
57336
57750
  aqi: {
@@ -57348,22 +57762,13 @@ var airQualitySensorCapability = {
57348
57762
  * entries with `device_class: illuminance`.
57349
57763
  */
57350
57764
  var AmbientLightSensorStatusSchema = object({
57351
- /** Current illuminance in lux (lx). */
57352
- lux: number().min(0).meta({
57353
- unit: "lx",
57765
+ /** Current illuminance in lux (lx). `null` when the sample was refused (D393). */
57766
+ lux: number().min(0).nullable().meta(readingMeta("illuminance", {
57767
+ precision: 0,
57354
57768
  label: "Illuminance"
57355
- }),
57769
+ })),
57356
57770
  /** Ms epoch when the slice was last updated. */
57357
- lastFetchedAt: number(),
57358
- /** Live display unit from the upstream source (e.g. HA
57359
- * `attributes.unit_of_measurement`). The UI prefers this over the
57360
- * role's canonical unit. Absent → fall back to the canonical unit. */
57361
- unit: string().optional(),
57362
- /** Suggested decimal places for numeric display.
57363
- * Populated live from the upstream source when provided (e.g. HA
57364
- * `attributes.suggested_display_precision`). Falls back to
57365
- * auto-formatting when absent. */
57366
- precision: number().int().min(0).max(10).optional()
57771
+ lastFetchedAt: number()
57367
57772
  });
57368
57773
  var ambientLightSensorCapability = {
57369
57774
  name: "ambient-light-sensor",
@@ -57395,12 +57800,7 @@ var ambientLightSensorCapability = {
57395
57800
  } } },
57396
57801
  /** Clock fields: written, but excluded from the compare that decides
57397
57802
  * whether persisting is worth a SQLite commit. */
57398
- volatileStateFields: ["lastFetchedAt"],
57399
- customize: {
57400
- version: 1,
57401
- advanced: "derive",
57402
- targets: []
57403
- }
57803
+ volatileStateFields: ["lastFetchedAt"]
57404
57804
  };
57405
57805
  /**
57406
57806
  * Per-class audio metrics aggregated over a sliding window.
@@ -57627,10 +58027,7 @@ var BatteryStatusSchema = object({
57627
58027
  * Consumers must SKIP a null rather than coerce it — `battery-band` already
57628
58028
  * declines to band a non-finite reading, which is the correct shape.
57629
58029
  */
57630
- percentage: number().min(0).max(100).nullable().meta({
57631
- unit: "%",
57632
- label: "Charge"
57633
- }),
58030
+ percentage: number().min(0).max(100).nullable().meta(readingMeta("percentage", { label: "Charge" })),
57634
58031
  /**
57635
58032
  * Charging source. `'dc'` covers wall/USB adapters; `'solar'` is
57636
58033
  * Reolink-specific for the Solar Panel 2 accessory (will become
@@ -57657,7 +58054,14 @@ var BatteryStatusSchema = object({
57657
58054
  */
57658
58055
  sleeping: boolean().meta({ label: "Sleeping" }),
57659
58056
  /** Ms epoch of the last observation. Lets consumers reason about freshness. */
57660
- lastUpdated: number(),
58057
+ lastUpdated: number().meta(readingMeta("none")),
58058
+ /**
58059
+ * Battery voltage in volts, for a cell the firmware reports as voltage
58060
+ * rather than a percentage (Ecowitt capacitor packs). Absent on cameras
58061
+ * that only report charge. A second reading on this cap, not a second
58062
+ * `numeric-sensor` on the same device.
58063
+ */
58064
+ volts: number().nullable().optional().meta(readingMeta("voltage", { label: "Voltage" })),
57661
58065
  /**
57662
58066
  * Ms epoch of the last time the device PROVED it was reachable — a
57663
58067
  * completed firmware round-trip, an observed wake, or an inbound push
@@ -57709,7 +58113,6 @@ var BATTERY_DEVICE_TYPES = [
57709
58113
  /** Generic Customize target for the percentage reading (D936). */
57710
58114
  var batteryCustomize = {
57711
58115
  version: 1,
57712
- advanced: "derive",
57713
58116
  targets: [{
57714
58117
  id: "percentage",
57715
58118
  cardinality: "scalar",
@@ -57718,7 +58121,7 @@ var batteryCustomize = {
57718
58121
  stateField: "percentage"
57719
58122
  },
57720
58123
  deviceTypes: BATTERY_DEVICE_TYPES,
57721
- apply: "add-or-replace",
58124
+ apply: "add",
57722
58125
  path: "percentage",
57723
58126
  sources: [{
57724
58127
  kind: "field",
@@ -57839,10 +58242,16 @@ onStatusChanged: { data: object({
57839
58242
  /**
57840
58243
  * History (D850): recorded series. The generic capture replaces the `battery` series of `pipeline-analytics:stats-5m`.
57841
58244
  */
57842
- history: { fields: { percentage: {
57843
- kind: "gauge",
57844
- unit: "%"
57845
- } } },
58245
+ history: { fields: {
58246
+ percentage: {
58247
+ kind: "gauge",
58248
+ unit: "%"
58249
+ },
58250
+ volts: {
58251
+ kind: "gauge",
58252
+ unit: "V"
58253
+ }
58254
+ } },
57846
58255
  customize: batteryCustomize,
57847
58256
  /** Clock fields: written, but excluded from the compare that decides
57848
58257
  * whether persisting is worth a SQLite commit. */
@@ -57889,12 +58298,7 @@ var binaryCapability = {
57889
58298
  history: { fields: { on: { kind: "boolean" } } },
57890
58299
  /** Clock fields: written, but excluded from the compare that decides
57891
58300
  * whether persisting is worth a SQLite commit. */
57892
- volatileStateFields: ["lastChangedAt"],
57893
- customize: {
57894
- version: 1,
57895
- advanced: "derive",
57896
- targets: []
57897
- }
58301
+ volatileStateFields: ["lastChangedAt"]
57898
58302
  };
57899
58303
  /**
57900
58304
  * Dimmable-light brightness control. Co-exists with `switch` on the
@@ -57910,7 +58314,7 @@ var binaryCapability = {
57910
58314
  */
57911
58315
  var BrightnessStatusSchema = object({
57912
58316
  /** Current level as 0..100 inclusive. Firmware-reported. */
57913
- percentage: number().min(0).max(100),
58317
+ percentage: number().min(0).max(100).meta(readingMeta("percentage")),
57914
58318
  /** Ms epoch of the last operator-driven change. Useful for UI freshness. */
57915
58319
  lastChangedAt: number()
57916
58320
  });
@@ -58364,21 +58768,21 @@ var ClimateControlStatusSchema = object({
58364
58768
  /** Single setpoint in Celsius. Used by single-target modes
58365
58769
  * (heat / cool / dry). Null when the device is in a range mode
58366
58770
  * (`heat_cool`) or has no setpoint at all (`fan_only`/`off`). */
58367
- target: number().nullable(),
58771
+ target: number().nullable().meta(readingMeta("temperature")),
58368
58772
  /** Upper bound of the dual setpoint in Celsius. Populated only
58369
58773
  * in `heat_cool` mode. */
58370
- targetHigh: number().nullable(),
58774
+ targetHigh: number().nullable().meta(readingMeta("temperature")),
58371
58775
  /** Lower bound of the dual setpoint in Celsius. Populated only
58372
58776
  * in `heat_cool` mode. */
58373
- targetLow: number().nullable(),
58777
+ targetLow: number().nullable().meta(readingMeta("temperature")),
58374
58778
  /** Target relative humidity (0..100). Null when the device has no
58375
58779
  * humidity control. */
58376
- targetHumidity: number().min(0).max(100).nullable(),
58780
+ targetHumidity: number().min(0).max(100).nullable().meta(readingMeta("humidity")),
58377
58781
  /** Current measured temperature in Celsius. Read-only — pushed by
58378
58782
  * the device's internal sensor. */
58379
- currentTemp: number().nullable(),
58783
+ currentTemp: number().nullable().meta(readingMeta("temperature")),
58380
58784
  /** Current measured relative humidity (0..100). Read-only. */
58381
- currentHumidity: number().min(0).max(100).nullable(),
58785
+ currentHumidity: number().min(0).max(100).nullable().meta(readingMeta("humidity")),
58382
58786
  /** Vertical louver swing on/off. Null when the device has no vertical
58383
58787
  * swing surface (gate with `DeviceFeature.ClimateSwingVertical`). */
58384
58788
  swingVertical: boolean().nullable(),
@@ -58386,11 +58790,11 @@ var ClimateControlStatusSchema = object({
58386
58790
  * horizontal swing surface (gate with `DeviceFeature.ClimateSwingHorizontal`). */
58387
58791
  swingHorizontal: boolean().nullable(),
58388
58792
  /** Lowest setpoint the device accepts, Celsius. Absent / null = not reported. */
58389
- minTemp: number().nullable().optional(),
58793
+ minTemp: number().nullable().optional().meta(readingMeta("temperature")),
58390
58794
  /** Highest setpoint the device accepts, Celsius. Absent / null = not reported. */
58391
- maxTemp: number().nullable().optional(),
58795
+ maxTemp: number().nullable().optional().meta(readingMeta("temperature")),
58392
58796
  /** Setpoint granularity, Celsius (0.5, 1). Absent / null = not reported. */
58393
- tempStep: number().positive().nullable().optional(),
58797
+ tempStep: number().positive().nullable().optional().meta(readingMeta("temperature")),
58394
58798
  /** Ms epoch when the slice was last updated (push or command). */
58395
58799
  lastFetchedAt: number()
58396
58800
  });
@@ -58532,17 +58936,17 @@ var climateControlCapability = {
58532
58936
  * modes to expose in the picker without a slice fetch.
58533
58937
  */
58534
58938
  var RgbTripletSchema = object({
58535
- r: number().int().min(0).max(255),
58536
- g: number().int().min(0).max(255),
58537
- b: number().int().min(0).max(255)
58939
+ r: number().int().min(0).max(255).meta(readingMeta("none")),
58940
+ g: number().int().min(0).max(255).meta(readingMeta("none")),
58941
+ b: number().int().min(0).max(255).meta(readingMeta("none"))
58538
58942
  });
58539
58943
  var HsvTripletSchema = object({
58540
58944
  /** Hue in degrees, 0..360. */
58541
- h: number().min(0).max(360),
58945
+ h: number().min(0).max(360).meta(readingMeta("none")),
58542
58946
  /** Saturation as 0..100 inclusive. */
58543
- s: number().min(0).max(100),
58947
+ s: number().min(0).max(100).meta(readingMeta("none")),
58544
58948
  /** Value/brightness as 0..100 inclusive. */
58545
- v: number().min(0).max(100)
58949
+ v: number().min(0).max(100).meta(readingMeta("none"))
58546
58950
  });
58547
58951
  var ColorInputSchema = discriminatedUnion("mode", [
58548
58952
  object({
@@ -58571,7 +58975,7 @@ var ColorStatusSchema = object({
58571
58975
  /** Populated when `mode === 'hsv'`. */
58572
58976
  hsv: HsvTripletSchema.optional(),
58573
58977
  /** Populated when `mode === 'mired'`. */
58574
- mireds: number().int().optional(),
58978
+ mireds: number().int().optional().meta(readingMeta("colour-temperature")),
58575
58979
  /** Ms epoch of the last operator-driven change. */
58576
58980
  lastChangedAt: number()
58577
58981
  });
@@ -58766,18 +59170,12 @@ _enum([
58766
59170
  "empty",
58767
59171
  "full"
58768
59172
  ]);
58769
- /** Units a remaining-life counter is reported in. Closed: the panel renders
58770
- * each. */
58771
- var ConsumableRemainingUnitSchema = _enum([
58772
- "days",
58773
- "hours",
58774
- "cycles"
58775
- ]);
58776
- /** Remaining life as a COUNT, not a percentage (the PetKit desiccant reports
58777
- * days). `value` null = unknown (D393). */
59173
+ /** Whether `remaining.value` is a duration in seconds or a dimensionless count. */
59174
+ var ConsumableRemainingKindSchema = _enum(["duration", "count"]);
59175
+ /** Remaining life. `value` null = unknown (D393). Duration is seconds. */
58778
59176
  var ConsumableRemainingSchema = object({
58779
- value: number().min(0).nullable(),
58780
- unit: ConsumableRemainingUnitSchema
59177
+ value: number().min(0).nullable().meta(readingMeta("device")),
59178
+ kind: ConsumableRemainingKindSchema
58781
59179
  });
58782
59180
  /** A single consumable item. Either a continuous `level` (remaining
58783
59181
  * life %, or fill % for a `supply` / `waste` item) or a discrete `status`
@@ -58790,7 +59188,7 @@ var ConsumableItemSchema = object({
58790
59188
  /** Display name. */
58791
59189
  label: string().min(1),
58792
59190
  /** Remaining life % (`wear`) or fill % (`supply`, `waste`) when known (0..100). */
58793
- level: number().min(0).max(100).nullable(),
59191
+ level: number().min(0).max(100).nullable().meta(readingMeta("percentage")),
58794
59192
  /** The provider's discrete verdict when known (binary mode). */
58795
59193
  status: ConsumableStatusSchema.nullable(),
58796
59194
  /** What the item is — decides whether low or full is bad. Absent = `wear`. */
@@ -58872,8 +59270,8 @@ var consumablesCustomize = {
58872
59270
  transforms: [{ kind: "identity" }]
58873
59271
  }],
58874
59272
  literals: [{
58875
- path: "remaining.unit",
58876
- values: [...ConsumableRemainingUnitSchema.options]
59273
+ path: "remaining.kind",
59274
+ values: [...ConsumableRemainingKindSchema.options]
58877
59275
  }]
58878
59276
  },
58879
59277
  {
@@ -59002,7 +59400,6 @@ reset: method(object({
59002
59400
  },
59003
59401
  "remaining.value": {
59004
59402
  kind: "gauge",
59005
- unitFrom: "remaining.unit",
59006
59403
  deadband: 1,
59007
59404
  displayName: "Remaining"
59008
59405
  }
@@ -59072,10 +59469,9 @@ var contactCapability = {
59072
59469
  * (empty array for the other kinds). It lives in the slice because
59073
59470
  * HA `select.*` entities may update their options at runtime.
59074
59471
  *
59075
- * The `unit`/`min`/`max`/`step` fields are meaningful for
59076
- * `kind === 'numeric'` and are absent (undefined) for all other
59077
- * kinds. They are populated live from HA attributes on each state
59078
- * push — consistent with `options` and the sensor-unit approach.
59472
+ * Numeric `min` / `max` / `step` live in the slice and share the device
59473
+ * quantity (`SourceInfo.quantity`, D944). Display precision is a read-time
59474
+ * preference. A datetime control's shape is `SourceInfo.dateTimeShape`.
59079
59475
  */
59080
59476
  var ControlStatusSchema = object({
59081
59477
  kind: _enum([
@@ -59087,39 +59483,17 @@ var ControlStatusSchema = object({
59087
59483
  /** Current value. Numeric kind → number; select/text/datetime → string.
59088
59484
  * Datetime values are ISO 8601 strings (full timestamp, date-only,
59089
59485
  * or time-only — HA accepts all three forms). */
59090
- value: union([number(), string()]),
59486
+ value: union([number().meta(readingMeta("device")), string()]),
59091
59487
  /** Acceptable values when `kind === 'select'`. Empty for other kinds. */
59092
59488
  options: array(string()),
59093
59489
  /** Ms epoch when the slice was last updated. */
59094
59490
  lastChangedAt: number(),
59095
- /** Display unit-of-measurement (e.g. '°C', '%', 'lx').
59096
- * Populated live from HA `attributes.unit_of_measurement` on each push.
59097
- * Meaningful for `kind === 'numeric'`; absent for other kinds. */
59098
- unit: string().optional(),
59099
- /** Minimum allowed value. Populated live from HA `attributes.min`.
59100
- * Meaningful for `kind === 'numeric'`; absent for other kinds. */
59101
- min: number().optional(),
59102
- /** Maximum allowed value. Populated live from HA `attributes.max`.
59103
- * Meaningful for `kind === 'numeric'`; absent for other kinds. */
59104
- max: number().optional(),
59105
- /** Step increment. Populated live from HA `attributes.step`.
59106
- * Meaningful for `kind === 'numeric'`; absent for other kinds. */
59107
- step: number().optional(),
59108
- /** Suggested decimal places for numeric display. Populated live from HA
59109
- * `attributes.suggested_display_precision`, or derived from `step` when the
59110
- * HA attribute is absent. Meaningful for `kind === 'numeric'`; absent for
59111
- * other kinds. Falls back to auto-formatting when absent. */
59112
- precision: number().int().min(0).max(10).optional(),
59113
- /** Date-picker granularity for `kind === 'datetime'`. 'date' → date-only,
59114
- * 'time' → time-only, 'datetime' → full timestamp. Absent for other kinds
59115
- * (UI defaults to 'datetime'). Derived live from the device's HA domain
59116
- * (date.* / time.* / datetime.*) or, for input_datetime, from the entity's
59117
- * `has_date`/`has_time` attributes on each push. */
59118
- format: _enum([
59119
- "date",
59120
- "time",
59121
- "datetime"
59122
- ]).optional()
59491
+ /** Minimum allowed value, in the device quantity's base unit. */
59492
+ min: number().optional().meta(readingMeta("device")),
59493
+ /** Maximum allowed value, in the device quantity's base unit. */
59494
+ max: number().optional().meta(readingMeta("device")),
59495
+ /** Step increment, in the device quantity's base unit. */
59496
+ step: number().optional().meta(readingMeta("device"))
59123
59497
  });
59124
59498
  var ControlSetValueInputSchema = discriminatedUnion("kind", [
59125
59499
  object({
@@ -59185,9 +59559,9 @@ var CoverStatusSchema = object({
59185
59559
  ]),
59186
59560
  /** 0 = fully closed, 100 = fully open. Null when the device has
59187
59561
  * no intermediate position surface. */
59188
- position: number().min(0).max(100).nullable(),
59562
+ position: number().min(0).max(100).nullable().meta(readingMeta("percentage")),
59189
59563
  /** 0 = closed slats, 100 = open slats. Null when no tilt support. */
59190
- tiltPosition: number().min(0).max(100).nullable(),
59564
+ tiltPosition: number().min(0).max(100).nullable().meta(readingMeta("percentage")),
59191
59565
  /** Ms epoch when the slice was last updated. */
59192
59566
  lastChangedAt: number()
59193
59567
  });
@@ -59290,9 +59664,9 @@ var NormalizedRangeSchema$1 = object({
59290
59664
  var DayNightStatusSchema = object({
59291
59665
  mode: DayNightModeSchema,
59292
59666
  /** IR-cut trigger sensitivity, NORMALIZED 0–100 (higher = switches to night sooner). */
59293
- sensitivity: number().optional(),
59667
+ sensitivity: number().optional().meta(readingMeta("none")),
59294
59668
  /** Delay before the IR-cut filter flips, in seconds. */
59295
- switchDelaySec: number().optional(),
59669
+ switchDelaySec: number().optional().meta(readingMeta("duration")),
59296
59670
  lastFetchedAt: number()
59297
59671
  });
59298
59672
  /**
@@ -59510,11 +59884,11 @@ var DishwasherStatusSchema = object({
59510
59884
  /** Feature keys of the programs the appliance currently offers — drives the UI selector. */
59511
59885
  availablePrograms: array(string()),
59512
59886
  /** Seconds remaining on the active cycle, or null when not running / not known. */
59513
- remainingSeconds: number().int().nonnegative().nullable(),
59887
+ remainingSeconds: number().int().nonnegative().nullable().meta(readingMeta("duration")),
59514
59888
  /** Seconds the delayed start is set to (time until the cycle starts), or null. */
59515
- delayedStartSeconds: number().int().nonnegative().nullable(),
59889
+ delayedStartSeconds: number().int().nonnegative().nullable().meta(readingMeta("duration")),
59516
59890
  /** Cycle completion 0..100, or null when not applicable. */
59517
- progressPercent: number().min(0).max(100).nullable(),
59891
+ progressPercent: number().min(0).max(100).nullable().meta(readingMeta("percentage")),
59518
59892
  /** True when the door is reported open; null when the door state is not known. */
59519
59893
  doorOpen: boolean().nullable(),
59520
59894
  /** True when the door is latched (locked) during a cycle; null when not reported. */
@@ -59538,7 +59912,7 @@ var DishwasherStatusSchema = object({
59538
59912
  /** True while the machine-care (descaling / cleaning-program) reminder is raised; false when clear; null when not reported. */
59539
59913
  machineCareDue: boolean().nullable(),
59540
59914
  /** Program runs left before the machine-care reminder is due; null when the appliance does not say. */
59541
- machineCareRemainingRuns: number().int().nonnegative().nullable(),
59915
+ machineCareRemainingRuns: number().int().nonnegative().nullable().meta(readingMeta("count")),
59542
59916
  /** Option states: null when the appliance does not expose the option or has not said. */
59543
59917
  halfLoad: boolean().nullable(),
59544
59918
  hygienePlus: boolean().nullable(),
@@ -59553,7 +59927,7 @@ var DishwasherStatusSchema = object({
59553
59927
  /** Feature keys of the events currently raised (salt low, rinse aid low, program finished, …). */
59554
59928
  activeEvents: array(string()),
59555
59929
  /** Numeric error code when the appliance reports one; null otherwise. */
59556
- errorCode: number().nullable(),
59930
+ errorCode: number().nullable().meta(readingMeta("none")),
59557
59931
  /** Name of the raised alert-level event while the appliance is in error; null otherwise. */
59558
59932
  errorLabel: string().nullable(),
59559
59933
  /** Ms epoch of the last value received from the appliance; 0 = never. */
@@ -59765,6 +60139,7 @@ var doorbellCustomize = {
59765
60139
  applyAuthority: { kind: "composition-claim" },
59766
60140
  eventName: "onPressed",
59767
60141
  edges: ["rising"],
60142
+ defaultEdge: "rising",
59768
60143
  timestampPath: "lastPressedAt",
59769
60144
  counterPath: "pressCountSinceStart",
59770
60145
  highWater: "composer-advance",
@@ -59783,7 +60158,7 @@ var DoorbellStatusSchema = object({
59783
60158
  /** Ms epoch of the last press. null = never observed since this provider started. */
59784
60159
  lastPressedAt: number().nullable(),
59785
60160
  /** Counter since provider start. Resets on reboot. Useful for metrics/debug. */
59786
- pressCountSinceStart: number()
60161
+ pressCountSinceStart: number().meta(readingMeta("count"))
59787
60162
  });
59788
60163
  var DoorbellPressEventSchema = object({
59789
60164
  deviceId: number(),
@@ -59848,17 +60223,7 @@ onPressed: {
59848
60223
  history: "none",
59849
60224
  customize: doorbellCustomize
59850
60225
  };
59851
- /**
59852
- * Enum-state sensor — a string value picked from a finite option set.
59853
- * Drives HA `sensor` entries with `state_class: enum` (HVAC action
59854
- * states, weather conditions, contact-source channels, mode strings).
59855
- * The option set is stable across observations; it is persisted in the
59856
- * device config blob (via the control slice at adoption) and is NOT
59857
- * stored in `sourceInfo`.
59858
- */
59859
- /** Locale-render shape for an ISO `value` carried by a `DateTimeSensor`-role
59860
- * enum sensor: `date` (date-only), `time` (time-only), `datetime` (both). */
59861
- var EnumSensorDateTimeFormatSchema = _enum([
60226
+ _enum([
59862
60227
  "date",
59863
60228
  "time",
59864
60229
  "datetime"
@@ -59866,12 +60231,11 @@ var EnumSensorDateTimeFormatSchema = _enum([
59866
60231
  var EnumSensorStatusSchema = object({
59867
60232
  value: string(),
59868
60233
  /**
59869
- * Set for `DateTimeSensor`-role sensors so the UI renders the ISO `value`
59870
- * as a locale date/time/datetime; absent for plain enum sensors. HA
59871
- * `device_class=timestamp` → `'datetime'`, `device_class=date` → `'date'`,
59872
- * a time-only sensor → `'time'`.
60234
+ * Set when `value` is a timestamp rather than an enum state, so history
60235
+ * does not learn ISO strings as states. The display shape (date / time /
60236
+ * datetime) lives on `SourceInfo.dateTimeShape`, written once at adopt.
59873
60237
  */
59874
- format: EnumSensorDateTimeFormatSchema.optional(),
60238
+ timestamp: boolean().optional(),
59875
60239
  /** Ms epoch when the slice was last updated. */
59876
60240
  lastFetchedAt: number()
59877
60241
  });
@@ -59898,11 +60262,11 @@ var enumSensorCapability = {
59898
60262
  * History (D850): the value as an `enum` series (an appliance's program or
59899
60263
  * operation state, an HVAC action). The option set is per device, so the
59900
60264
  * value list is LEARNED as values are first seen (bounded). A sensor with a
59901
- * `format` carries a timestamp, not a state, and is not recorded.
60265
+ * `timestamp` carries a clock, not a state, and is not recorded.
59902
60266
  */
59903
60267
  history: { fields: { value: {
59904
60268
  kind: "enum",
59905
- skipWhenSet: "format"
60269
+ skipWhenSet: "timestamp"
59906
60270
  } } },
59907
60271
  /** Clock fields: written, but excluded from the compare that decides
59908
60272
  * whether persisting is worth a SQLite commit. */
@@ -59922,13 +60286,13 @@ var EventFireSchema = object({
59922
60286
  deviceId: number(),
59923
60287
  eventType: string(),
59924
60288
  data: record(string(), unknown()).nullable(),
59925
- timestamp: number(),
59926
- seq: number()
60289
+ timestamp: number().meta(readingMeta("none")),
60290
+ seq: number().meta(readingMeta("count"))
59927
60291
  });
59928
60292
  var EventEmitterStatusSchema = object({
59929
60293
  eventTypes: array(string()),
59930
60294
  lastEvent: EventFireSchema.nullable(),
59931
- eventCountSinceStart: number()
60295
+ eventCountSinceStart: number().meta(readingMeta("count"))
59932
60296
  });
59933
60297
  var eventEmitterCapability = {
59934
60298
  name: "event-emitter",
@@ -60341,10 +60705,10 @@ var FanDirectionSchema = _enum(["forward", "reverse"]);
60341
60705
  var FanControlStatusSchema = object({
60342
60706
  /** Active speed as 0..100 inclusive. Null when the device has no
60343
60707
  * speed surface (single-speed fan). */
60344
- percentage: number().min(0).max(100).nullable(),
60708
+ percentage: number().min(0).max(100).nullable().meta(readingMeta("percentage")),
60345
60709
  /** Speed granularity the device accepts (HA `percentage_step`, e.g. 25 for
60346
60710
  * a 4-speed fan). Absent when unknown — the UI then falls back to step 1. */
60347
- percentageStep: number().positive().optional(),
60711
+ percentageStep: number().positive().optional().meta(readingMeta("percentage")),
60348
60712
  /** Active preset mode (`auto` / `quiet` / `turbo` / vendor-specific)
60349
60713
  * — empty string when no preset is active or supported. */
60350
60714
  preset: string(),
@@ -60465,7 +60829,7 @@ var FeatureProbeStatusSchema = object({
60465
60829
  /** Camera/firmware model string. `null` when the firmware doesn't expose it. */
60466
60830
  model: string().nullable(),
60467
60831
  /** Channel count for NVR/Hub devices; `1` for standalone cameras; `null` pre-probe. */
60468
- channelCount: number().nullable(),
60832
+ channelCount: number().nullable().meta(readingMeta("count")),
60469
60833
  /**
60470
60834
  * Ms epoch of the last SUCCESSFUL probe. `0` before the first probe
60471
60835
  * completes — drivers' `getAccessoryChildren()` should treat zero as
@@ -60588,9 +60952,91 @@ var gasCapability = {
60588
60952
  * whether persisting is worth a SQLite commit. */
60589
60953
  volatileStateFields: ["lastChangedAt"]
60590
60954
  };
60955
+ var GroupCommandsSchema = object({
60956
+ /** One row per member that has been commanded. A later command replaces that member's row. */
60957
+ results: array(object({
60958
+ deviceId: number().int().nonnegative(),
60959
+ cap: string().min(1),
60960
+ method: string().min(1),
60961
+ ok: boolean(),
60962
+ error: string().optional(),
60963
+ /** Ms epoch of the attempt. */
60964
+ at: number()
60965
+ })) });
60966
+ var groupCommandsCapability = {
60967
+ name: "group-commands",
60968
+ scope: "device",
60969
+ deviceNative: true,
60970
+ mode: "singleton",
60971
+ deviceTypes: [DeviceType.Switch, DeviceType.Light],
60972
+ methods: {},
60973
+ status: {
60974
+ schema: GroupCommandsSchema,
60975
+ kind: "push"
60976
+ },
60977
+ runtimeState: GroupCommandsSchema,
60978
+ /**
60979
+ * Runtime-state durability: **session** — the last attempt. A restored
60980
+ * failure would outlive the command that caused it.
60981
+ *
60982
+ * See `RuntimeStateDurability`. Enforced by
60983
+ * `scripts/check-runtime-state-durability.ts`.
60984
+ */
60985
+ durability: "session",
60986
+ history: "none"
60987
+ };
60988
+ /**
60989
+ * How many members of a helper group answered (D944). Counts are integers,
60990
+ * not measurements: zero included is a real count, never a stand-in reading.
60991
+ * The reading itself stays on the output capability. History is none — the
60992
+ * series that later statistics read is the output cap's own history block.
60993
+ */
60994
+ var GroupStatusSchema = object({
60995
+ /** Members whose current value entered the aggregate. */
60996
+ included: number().int().nonnegative().meta(readingMeta("count", {
60997
+ precision: 0,
60998
+ label: "Reporting"
60999
+ })),
61000
+ /** Members left out: offline, unknown, or not a finite reading (D393). */
61001
+ excluded: number().int().nonnegative().meta(readingMeta("count", {
61002
+ precision: 0,
61003
+ label: "Excluded"
61004
+ })),
61005
+ /** `included` + `excluded`. */
61006
+ total: number().int().nonnegative().meta(readingMeta("count", {
61007
+ precision: 0,
61008
+ label: "Members"
61009
+ }))
61010
+ });
61011
+ var groupStatusCapability = {
61012
+ name: "group-status",
61013
+ scope: "device",
61014
+ deviceNative: true,
61015
+ mode: "singleton",
61016
+ deviceTypes: [
61017
+ DeviceType.Sensor,
61018
+ DeviceType.Switch,
61019
+ DeviceType.Light
61020
+ ],
61021
+ methods: {},
61022
+ status: {
61023
+ schema: GroupStatusSchema,
61024
+ kind: "push"
61025
+ },
61026
+ runtimeState: GroupStatusSchema,
61027
+ /**
61028
+ * Runtime-state durability: **session** — recomputed from members on the
61029
+ * next source event; a restored count would outlive the readings it named.
61030
+ *
61031
+ * See `RuntimeStateDurability`. Enforced by
61032
+ * `scripts/check-runtime-state-durability.ts`.
61033
+ */
61034
+ durability: "session",
61035
+ history: "none"
61036
+ };
60591
61037
  var HeatingValveStatusSchema = object({
60592
61038
  /** Radiator valve opening 0 (closed) .. 100 (open). Null = not yet known. */
60593
- position: number().min(0).max(100).nullable(),
61039
+ position: number().min(0).max(100).nullable().meta(readingMeta("percentage")),
60594
61040
  /** Ms epoch when the slice was last updated (push or poll). */
60595
61041
  lastFetchedAt: number()
60596
61042
  });
@@ -60633,9 +61079,9 @@ var HumidifierStatusSchema = object({
60633
61079
  /** Whether the humidifier is currently on. */
60634
61080
  on: boolean(),
60635
61081
  /** Current measured relative humidity (0..100). Null when not reported. */
60636
- currentHumidity: number().min(0).max(100).nullable(),
61082
+ currentHumidity: number().min(0).max(100).nullable().meta(readingMeta("humidity")),
60637
61083
  /** Target relative humidity (0..100). Null when no setpoint surface. */
60638
- targetHumidity: number().min(0).max(100).nullable(),
61084
+ targetHumidity: number().min(0).max(100).nullable().meta(readingMeta("humidity")),
60639
61085
  /** Active mode (`auto` / `normal` / `baby` / vendor). Null when the
60640
61086
  * device has no mode surface. */
60641
61087
  mode: string().nullable(),
@@ -60645,9 +61091,9 @@ var HumidifierStatusSchema = object({
60645
61091
  * `idle` / `off`). Null when the device doesn't report it. */
60646
61092
  action: string().nullable(),
60647
61093
  /** HA `min_humidity` attribute. Null → UI uses 0. */
60648
- minHumidity: number().nullable(),
61094
+ minHumidity: number().nullable().meta(readingMeta("humidity")),
60649
61095
  /** HA `max_humidity` attribute. Null → UI uses 100. */
60650
- maxHumidity: number().nullable(),
61096
+ maxHumidity: number().nullable().meta(readingMeta("humidity")),
60651
61097
  /** Ms epoch when the slice was last updated. */
60652
61098
  lastChangedAt: number()
60653
61099
  });
@@ -60717,22 +61163,13 @@ var humidifierCapability = {
60717
61163
  * `sourceInfo`.
60718
61164
  */
60719
61165
  var HumiditySensorStatusSchema = object({
60720
- /** Current relative humidity, 0..100. */
60721
- percent: number().min(0).max(100).meta({
60722
- unit: "%",
61166
+ /** Current relative humidity, 0..100. `null` when the sample was refused (D393). */
61167
+ percent: number().min(0).max(100).nullable().meta(readingMeta("humidity", {
61168
+ precision: 0,
60723
61169
  label: "Humidity"
60724
- }),
61170
+ })),
60725
61171
  /** Ms epoch when the slice was last updated. */
60726
- lastFetchedAt: number(),
60727
- /** Live display unit from the upstream source (e.g. HA
60728
- * `attributes.unit_of_measurement`). The UI prefers this over the
60729
- * role's canonical unit. Absent → fall back to the canonical unit. */
60730
- unit: string().optional(),
60731
- /** Suggested decimal places for numeric display.
60732
- * Populated live from the upstream source when provided (e.g. HA
60733
- * `attributes.suggested_display_precision`). Falls back to
60734
- * auto-formatting when absent. */
60735
- precision: number().int().min(0).max(10).optional()
61172
+ lastFetchedAt: number()
60736
61173
  });
60737
61174
  var humiditySensorCapability = {
60738
61175
  name: "humidity-sensor",
@@ -60763,12 +61200,7 @@ var humiditySensorCapability = {
60763
61200
  } } },
60764
61201
  /** Clock fields: written, but excluded from the compare that decides
60765
61202
  * whether persisting is worth a SQLite commit. */
60766
- volatileStateFields: ["lastFetchedAt"],
60767
- customize: {
60768
- version: 1,
60769
- advanced: "derive",
60770
- targets: []
60771
- }
61203
+ volatileStateFields: ["lastFetchedAt"]
60772
61204
  };
60773
61205
  /**
60774
61206
  * Image display cap. Models a single still image exposed by an integration —
@@ -60789,7 +61221,7 @@ var ImageStatusSchema = object({
60789
61221
  * entity exposes no `entity_picture` (yet). */
60790
61222
  url: string().nullable(),
60791
61223
  /** Ms epoch of the upstream last-updated timestamp. Null at cold-start. */
60792
- lastUpdated: number().nullable()
61224
+ lastUpdated: number().nullable().meta(readingMeta("none"))
60793
61225
  });
60794
61226
  var imageCapability = {
60795
61227
  name: "image",
@@ -60877,19 +61309,19 @@ var NormalizedRangeSchema = object({
60877
61309
  */
60878
61310
  var ImageSettingsStatusSchema = object({
60879
61311
  /** Normalized 0–100. */
60880
- brightness: number().optional(),
61312
+ brightness: number().optional().meta(readingMeta("none")),
60881
61313
  /** Normalized 0–100. */
60882
- contrast: number().optional(),
61314
+ contrast: number().optional().meta(readingMeta("none")),
60883
61315
  /** Normalized 0–100. */
60884
- saturation: number().optional(),
61316
+ saturation: number().optional().meta(readingMeta("none")),
60885
61317
  /** Normalized 0–100. */
60886
- sharpness: number().optional(),
61318
+ sharpness: number().optional().meta(readingMeta("none")),
60887
61319
  mirror: boolean().optional(),
60888
61320
  flip: boolean().optional(),
60889
61321
  rotate: ImageRotateSchema.optional(),
60890
61322
  whiteBalance: WhiteBalanceModeSchema.optional(),
60891
61323
  /** Manual white-balance warmth, NORMALIZED 0–100. Meaningful only when `whiteBalance === 'manual'`. */
60892
- warmth: number().optional(),
61324
+ warmth: number().optional().meta(readingMeta("none")),
60893
61325
  exposureMode: ExposureModeSchema.optional(),
60894
61326
  backlightMode: BacklightModeSchema.optional(),
60895
61327
  lastFetchedAt: number()
@@ -61168,10 +61600,10 @@ var IntercomAbilitySchema = object({
61168
61600
  /** Codecs accepted by firmware, in preference order. Driver-authored strings. */
61169
61601
  codecs: array(string()),
61170
61602
  /** Sample rate (Hz) the firmware expects. Reolink typical: 16000. */
61171
- sampleRate: number(),
61603
+ sampleRate: number().meta(readingMeta("none")),
61172
61604
  duplex: _enum(["half", "full"]),
61173
61605
  /** Max in-flight audio backlog before drop (ms). Server uses this to bound latency. */
61174
- maxBacklogMs: number()
61606
+ maxBacklogMs: number().meta(readingMeta("duration-ms"))
61175
61607
  });
61176
61608
  var IntercomStatusSchema = object({
61177
61609
  /** True while a talk session is open. */
@@ -61398,13 +61830,13 @@ var LawnMowerControlStatusSchema = object({
61398
61830
  activity: LawnMowerActivitySchema,
61399
61831
  /** 0..100 battery percentage. Null when the device has no battery
61400
61832
  * reading. */
61401
- batteryLevel: number().min(0).max(100).nullable(),
61833
+ batteryLevel: number().min(0).max(100).nullable().meta(readingMeta("percentage")),
61402
61834
  /** 0..100 mowing-completion percentage of the current task, or null when no
61403
61835
  * task is active / progress is unavailable. */
61404
- progressPercent: number().min(0).max(100).nullable(),
61836
+ progressPercent: number().min(0).max(100).nullable().meta(readingMeta("percentage")),
61405
61837
  /** Current device/event code (dynamic — mostly status, sometimes an error),
61406
61838
  * or null when unknown. */
61407
- currentCode: number().nullable(),
61839
+ currentCode: number().nullable().meta(readingMeta("none")),
61408
61840
  /** Human label for {@link currentCode}, or null when undecodable. */
61409
61841
  currentCodeLabel: string().nullable(),
61410
61842
  /** Severity of {@link currentCode}. `error` (and often `warning`) warrants UI
@@ -61937,7 +62369,7 @@ var MediaPlayerStatusSchema = object({
61937
62369
  state: MediaPlayerStateSchema,
61938
62370
  /** Volume as 0..100 inclusive. Null when the device has no volume
61939
62371
  * surface. Pair with `DeviceFeature.MediaPlayerVolume`. */
61940
- volumeLevel: number().min(0).max(100).nullable(),
62372
+ volumeLevel: number().min(0).max(100).nullable().meta(readingMeta("percentage")),
61941
62373
  /** Mute toggle distinct from volume=0. Null when no mute surface.
61942
62374
  * Pair with `DeviceFeature.MediaPlayerMute`. */
61943
62375
  isMuted: boolean().nullable(),
@@ -61950,10 +62382,10 @@ var MediaPlayerStatusSchema = object({
61950
62382
  currentMedia: MediaInfoSchema.nullable(),
61951
62383
  /** Current playback position in ms. Null when not seekable or
61952
62384
  * nothing is playing. Pair with `DeviceFeature.MediaPlayerSeek`. */
61953
- positionMs: number().int().nonnegative().nullable(),
62385
+ positionMs: number().int().nonnegative().nullable().meta(readingMeta("duration-ms")),
61954
62386
  /** Total duration of the current media in ms. Null when unknown
61955
62387
  * (live stream) or nothing is playing. */
61956
- durationMs: number().int().nonnegative().nullable(),
62388
+ durationMs: number().int().nonnegative().nullable().meta(readingMeta("duration-ms")),
61957
62389
  /** Shuffle toggle. Null when no shuffle surface.
61958
62390
  * Pair with `DeviceFeature.MediaPlayerShuffle`. */
61959
62391
  shuffle: boolean().nullable(),
@@ -62262,7 +62694,7 @@ var motionCustomize = {
62262
62694
  eventName: "onMotionChanged"
62263
62695
  },
62264
62696
  deviceTypes: [DeviceType.Camera],
62265
- apply: "replace",
62697
+ apply: "add",
62266
62698
  applyAuthority: {
62267
62699
  kind: "camera-sensors",
62268
62700
  timeoutField: "motionCooldownMs"
@@ -62334,7 +62766,7 @@ var MotionStatusSchema = object({
62334
62766
  * it, every provider seeded it at boot, and every session left it
62335
62767
  * `detected: true` after its detach.
62336
62768
  */
62337
- autoClearAfterMs: number().nullable()
62769
+ autoClearAfterMs: number().nullable().meta(readingMeta("duration-ms"))
62338
62770
  });
62339
62771
  /**
62340
62772
  * Payload of `motion.onMotionChanged` event + the corresponding bus
@@ -62371,12 +62803,18 @@ var motionCapability = {
62371
62803
  methods: {
62372
62804
  /**
62373
62805
  * Pull the current motion state synchronously. Convenience shortcut
62374
- * for consumers that don't need the full status object; equivalent
62375
- * to `getStatus()?.detected ?? false`. Will likely be folded into
62376
- * `getStatus` once the auto-injected status surface lands in every
62377
- * consumer.
62806
+ * for consumers that don't need the full status object. A composed
62807
+ * group answers from its slice (D944): unknown throws, it is not off.
62378
62808
  */
62379
62809
  isDetected: method(object({ deviceId: number() }), boolean()) },
62810
+ /**
62811
+ * A composed motion group serves `isDetected` from `detected` (D944).
62812
+ * Without this the cap stays uncomposable (`has-commands`).
62813
+ */
62814
+ composedMethods: { isDetected: {
62815
+ kind: "slice",
62816
+ field: "detected"
62817
+ } },
62380
62818
  events: {
62381
62819
  /**
62382
62820
  * Fires every time the runner transitions a camera between
@@ -62516,7 +62954,7 @@ var MotionZoneRegionSchema = object({
62516
62954
  * the grid region(s). */
62517
62955
  var MotionZoneStatusSchema = object({
62518
62956
  enabled: boolean(),
62519
- sensitivity: number(),
62957
+ sensitivity: number().meta(readingMeta("none")),
62520
62958
  /** Grid region(s). Today exactly one `grid` shape. */
62521
62959
  regions: array(MotionZoneRegionSchema),
62522
62960
  lastFetchedAt: number()
@@ -62886,7 +63324,7 @@ var NavigationStatusSchema = object({
62886
63324
  following: boolean(),
62887
63325
  flash: boolean(),
62888
63326
  lightMode: NavigationLightModeSchema,
62889
- lightLevel: number().min(40).max(100),
63327
+ lightLevel: number().min(40).max(100).meta(readingMeta("none")),
62890
63328
  /** Ms epoch when the slice was last updated. */
62891
63329
  lastChangedAt: number()
62892
63330
  });
@@ -63020,13 +63458,13 @@ var NetworkLinkStatusSchema = object({
63020
63458
  * one whose reading has not landed must not be drawn at 0 %. Consumers
63021
63459
  * SKIP a null rather than coerce it.
63022
63460
  */
63023
- signalPercent: number().min(0).max(100).nullable(),
63461
+ signalPercent: number().min(0).max(100).nullable().meta(readingMeta("percentage")),
63024
63462
  /** Raw received signal strength in dBm, when the firmware reports one. */
63025
- rssiDbm: number().optional(),
63463
+ rssiDbm: number().optional().meta(readingMeta("signal-level")),
63026
63464
  /** Network name of a wireless link, when the firmware reports it. */
63027
63465
  ssid: string().optional(),
63028
63466
  /** Ms epoch of the last observation. Lets consumers reason about freshness. */
63029
- lastUpdated: number()
63467
+ lastUpdated: number().meta(readingMeta("none"))
63030
63468
  });
63031
63469
  var networkLinkCapability = {
63032
63470
  name: "network-link",
@@ -63411,7 +63849,7 @@ var NotifierStatusSchema = object({
63411
63849
  lastError: string().nullable(),
63412
63850
  /** Number of deliveries currently buffered server-side (rate-limited
63413
63851
  * notifiers may queue). 0 when the provider sends synchronously. */
63414
- queueDepth: number().int().nonnegative(),
63852
+ queueDepth: number().int().nonnegative().meta(readingMeta("count")),
63415
63853
  /** Per-feature capability matrix — authoritative source for the
63416
63854
  * compose-form field gating. */
63417
63855
  supports: NotifierSupportsSchema
@@ -63503,11 +63941,9 @@ onSent: { data: object({
63503
63941
  * cap fits (HA `sensor` whose `device_class` we don't have a typed cap
63504
63942
  * for: water flow, distance, weight, frequency, signal strength, …).
63505
63943
  *
63506
- * The `unit` and `precision` fields carry the live display metadata that
63507
- * the upstream source provides with each state push (HA
63508
- * `attributes.unit_of_measurement` / `attributes.suggested_display_precision`).
63509
- * The UI reads them directly from the slice — they are the single source
63510
- * of truth for generic numeric rendering and do NOT live on `sourceInfo`.
63944
+ * The quantity is not on this slice. It is chosen when the device is
63945
+ * adopted and stored once on `SourceInfo.quantity` (D944). `value` is in
63946
+ * that quantity's base unit. `null` is a refused sample (D393).
63511
63947
  *
63512
63948
  * Prefer the typed alternatives (`temperature-sensor`, `humidity-sensor`,
63513
63949
  * `ambient-light-sensor`, `pressure-sensor`, `power-meter`,
@@ -63516,15 +63952,8 @@ onSent: { data: object({
63516
63952
  * numeric values land here.
63517
63953
  */
63518
63954
  var NumericSensorStatusSchema = object({
63519
- value: number(),
63520
- /** Display unit-of-measurement (e.g. 'dBm', 's', 'rpm', 'steps').
63521
- * Populated live from the upstream source on each state push.
63522
- * Absent for unitless sensors. */
63523
- unit: string().optional(),
63524
- /** Suggested decimal places for numeric display.
63525
- * Populated live from the upstream source when provided.
63526
- * Falls back to auto-formatting when absent. */
63527
- precision: number().int().min(0).max(10).optional(),
63955
+ /** Reading in the device quantity's base unit. `null` when refused (D393). */
63956
+ value: number().nullable().meta(readingMeta("device")),
63528
63957
  /** Ms epoch when the slice was last updated. */
63529
63958
  lastFetchedAt: number()
63530
63959
  });
@@ -63548,11 +63977,11 @@ var numericSensorCapability = {
63548
63977
  */
63549
63978
  durability: "restored",
63550
63979
  /**
63551
- * History (D850): recorded series. The unit is per device, read from the sibling `unit` field.
63980
+ * History (D850): recorded series. The unit is the device quantity's base,
63981
+ * resolved when the series is read — the cap has no single unit.
63552
63982
  */
63553
63983
  history: { fields: { value: {
63554
63984
  kind: "gauge",
63555
- unitFrom: "unit",
63556
63985
  minIntervalMs: 3e4
63557
63986
  } } },
63558
63987
  /** Clock fields: written, but excluded from the compare that decides
@@ -63890,23 +64319,26 @@ var PetFeederStatusSchema = object({
63890
64319
  /** Food currently in the bowl (grams). Null when the device has not
63891
64320
  * reported a reading yet. On dual-hopper models this is the combined
63892
64321
  * bowl reading; per-hopper levels live in `food1`/`food2`. */
63893
- foodLevel: number().nullable(),
64322
+ foodLevel: number().nullable().meta(readingMeta("none")),
63894
64323
  /** Hopper-1 food level (grams) on dual-hopper feeders; null on
63895
64324
  * single-hopper models. */
63896
- food1: number().nullable(),
64325
+ food1: number().nullable().meta(readingMeta("none")),
63897
64326
  /** Hopper-2 food level (grams) on dual-hopper feeders; null on
63898
64327
  * single-hopper models. */
63899
- food2: number().nullable(),
64328
+ food2: number().nullable().meta(readingMeta("none")),
63900
64329
  /** Derived low-food flag — mirrors the HA `food_level` binary_sensor
63901
64330
  * (`device_class: problem`, on = low). True when the bowl is empty /
63902
64331
  * below the feeder's low threshold. */
63903
64332
  lowFood: boolean(),
63904
64333
  /** Battery charge 0..100 (%). Null on mains-powered models or when the
63905
64334
  * device has no battery reading. */
63906
- batteryPower: number().min(0).max(100).nullable(),
63907
- /** Days of desiccant life remaining. Null when the model has no
63908
- * desiccant sensor. */
63909
- desiccantLeftDays: number().nullable(),
64335
+ batteryPower: number().min(0).max(100).nullable().meta(readingMeta("percentage")),
64336
+ /**
64337
+ * Desiccant life remaining, stored in seconds (duration base, D944).
64338
+ * Providers convert from the days the feeder reports. Null when the
64339
+ * model has no desiccant sensor.
64340
+ */
64341
+ desiccantLeftDays: number().nullable().meta(readingMeta("duration")),
63910
64342
  /** True while a feed is in progress. */
63911
64343
  feeding: boolean(),
63912
64344
  /** Decoded connectivity / power status (HA petkit device-status enum).
@@ -63917,7 +64349,7 @@ var PetFeederStatusSchema = object({
63917
64349
  * with `errorCode` for consumers that want the raw integer. */
63918
64350
  error: string().nullable(),
63919
64351
  /** Raw device error code (0 / null = no error). */
63920
- errorCode: number().nullable(),
64352
+ errorCode: number().nullable().meta(readingMeta("none")),
63921
64353
  /** True for D4S/D4SH dual-hopper hardware — gates the per-hopper UI. */
63922
64354
  isDualHopper: boolean(),
63923
64355
  /** Child-lock (manual-lock) setting — buttons on the unit are disabled. */
@@ -63927,7 +64359,7 @@ var PetFeederStatusSchema = object({
63927
64359
  /** Play a chime when dispensing. */
63928
64360
  feedSound: boolean(),
63929
64361
  /** Speaker / prompt volume level (device-scaled integer). */
63930
- volume: number(),
64362
+ volume: number().meta(readingMeta("none")),
63931
64363
  /** Ms epoch when the slice was last refreshed from the cloud. */
63932
64364
  lastFetchedAt: number()
63933
64365
  });
@@ -64046,7 +64478,7 @@ var petFeederCapability = {
64046
64478
  },
64047
64479
  desiccantLeftDays: {
64048
64480
  kind: "gauge",
64049
- unit: "days"
64481
+ unit: "s"
64050
64482
  }
64051
64483
  } }
64052
64484
  };
@@ -64447,36 +64879,19 @@ method(_void(), PlatformCapabilitiesSchema), method(_void(), HardwareInfoSchema)
64447
64879
  */
64448
64880
  var PowerMeterStatusSchema = object({
64449
64881
  /** Instantaneous power draw in watts. */
64450
- watts: number().optional().meta({
64451
- unit: "W",
64452
- label: "Power"
64453
- }),
64882
+ watts: number().optional().meta(readingMeta("power", { label: "Power" })),
64454
64883
  /** Cumulative energy in kilowatt-hours since the meter was reset. */
64455
- kwhTotal: number().optional().meta({
64456
- unit: "kWh",
64457
- label: "Energy"
64458
- }),
64884
+ kwhTotal: number().optional().meta(readingMeta("energy", { label: "Energy" })),
64459
64885
  /** Voltage in volts. */
64460
- volts: number().optional(),
64886
+ volts: number().optional().meta(readingMeta("voltage")),
64461
64887
  /** Current in amperes. */
64462
- amps: number().optional(),
64463
- /** Apparent power in volt-amperes (W × power-factor reciprocal). */
64464
- va: number().optional(),
64888
+ amps: number().optional().meta(readingMeta("current")),
64889
+ /** Apparent power in volt-amperes. */
64890
+ va: number().optional().meta(readingMeta("apparent-power")),
64465
64891
  /** Power factor (0..1) if reported. */
64466
- powerFactor: number().min(0).max(1).optional(),
64892
+ powerFactor: number().min(0).max(1).optional().meta(readingMeta("ratio")),
64467
64893
  /** Ms epoch when the slice was last updated. */
64468
- lastFetchedAt: number(),
64469
- /** Live display unit of the single metric this slice carries (e.g. HA
64470
- * `attributes.unit_of_measurement` → 'V' / 'A' / 'W' / 'kW' / 'kWh').
64471
- * Each upstream `sensor.*` entity surfaces ONE device_class, so one
64472
- * unit per slice is unambiguous. The UI prefers this over the role's
64473
- * canonical unit so a 'kW' / 'Wh' feed renders verbatim. */
64474
- unit: string().optional(),
64475
- /** Suggested decimal places for numeric display.
64476
- * Populated live from the upstream source when provided (e.g. HA
64477
- * `attributes.suggested_display_precision`). Falls back to
64478
- * auto-formatting when absent. */
64479
- precision: number().int().min(0).max(10).optional()
64894
+ lastFetchedAt: number()
64480
64895
  });
64481
64896
  var powerMeterCapability = {
64482
64897
  name: "power-meter",
@@ -64540,12 +64955,7 @@ var powerMeterCapability = {
64540
64955
  } },
64541
64956
  /** Clock fields: written, but excluded from the compare that decides
64542
64957
  * whether persisting is worth a SQLite commit. */
64543
- volatileStateFields: ["lastFetchedAt"],
64544
- customize: {
64545
- version: 1,
64546
- advanced: "derive",
64547
- targets: []
64548
- }
64958
+ volatileStateFields: ["lastFetchedAt"]
64549
64959
  };
64550
64960
  /**
64551
64961
  * Presence cap. Models HA `person.*` and `device_tracker.*` entities
@@ -64565,11 +64975,11 @@ var powerMeterCapability = {
64565
64975
  */
64566
64976
  var GpsLocationSchema = object({
64567
64977
  /** Latitude in decimal degrees, -90..90. */
64568
- latitude: number().min(-90).max(90),
64978
+ latitude: number().min(-90).max(90).meta(readingMeta("angle")),
64569
64979
  /** Longitude in decimal degrees, -180..180. */
64570
- longitude: number().min(-180).max(180),
64980
+ longitude: number().min(-180).max(180).meta(readingMeta("angle")),
64571
64981
  /** Reported accuracy in meters (lower = better). */
64572
- accuracyMeters: number().nonnegative()
64982
+ accuracyMeters: number().nonnegative().meta(readingMeta("length"))
64573
64983
  });
64574
64984
  var PresenceStatusSchema = object({
64575
64985
  /** `home` / `not_home` / any user-defined zone name. */
@@ -64581,7 +64991,7 @@ var PresenceStatusSchema = object({
64581
64991
  gps: GpsLocationSchema.nullable(),
64582
64992
  /** Optional battery level of the tracking device (0..100). Null
64583
64993
  * when not reported. */
64584
- batteryPercent: number().min(0).max(100).nullable(),
64994
+ batteryPercent: number().min(0).max(100).nullable().meta(readingMeta("percentage")),
64585
64995
  /** Ms epoch when the slice was last updated. */
64586
64996
  lastChangedAt: number()
64587
64997
  });
@@ -64631,19 +65041,10 @@ var presenceCapability = {
64631
65041
  * `sourceInfo`.
64632
65042
  */
64633
65043
  var PressureSensorStatusSchema = object({
64634
- /** Current pressure in hPa. */
64635
- hpa: number(),
65044
+ /** Current pressure in hPa. `null` when the sample was refused (D393). */
65045
+ hpa: number().nullable().meta(readingMeta("pressure", { precision: 0 })),
64636
65046
  /** Ms epoch when the slice was last updated. */
64637
- lastFetchedAt: number(),
64638
- /** Live display unit from the upstream source (e.g. HA
64639
- * `attributes.unit_of_measurement`). The UI prefers this over the
64640
- * role's canonical unit. Absent → fall back to the canonical unit. */
64641
- unit: string().optional(),
64642
- /** Suggested decimal places for numeric display.
64643
- * Populated live from the upstream source when provided (e.g. HA
64644
- * `attributes.suggested_display_precision`). Falls back to
64645
- * auto-formatting when absent. */
64646
- precision: number().int().min(0).max(10).optional()
65047
+ lastFetchedAt: number()
64647
65048
  });
64648
65049
  var pressureSensorCapability = {
64649
65050
  name: "pressure-sensor",
@@ -65169,8 +65570,8 @@ var ptzCapability = {
65169
65570
  };
65170
65571
  var PtzAutotrackSettingsSchema = object({
65171
65572
  targetType: string().describe("Vendor target string (people/vehicle/pet); empty = camera default"),
65172
- stopDelaySeconds: number().int().min(0).max(300),
65173
- disappearDelaySeconds: number().int().min(0).max(300)
65573
+ stopDelaySeconds: number().int().min(0).max(300).meta(readingMeta("duration")),
65574
+ disappearDelaySeconds: number().int().min(0).max(300).meta(readingMeta("duration"))
65174
65575
  });
65175
65576
  /**
65176
65577
  * One option the camera advertises as a valid `targetType`. Drivers
@@ -65324,7 +65725,7 @@ var RunningStateStatusSchema = object({
65324
65725
  /** null = unknown — never coerced to false (D393). */
65325
65726
  running: boolean().nullable(),
65326
65727
  /** Epoch ms the current boolean began; null while `running` is null. */
65327
- since: number().nullable(),
65728
+ since: number().nullable().meta(readingMeta("none")),
65328
65729
  source: RunningStateSourceSchema.meta({ label: "Source" }),
65329
65730
  phase: string().nullable(),
65330
65731
  /** null until a reading has been published (D393). */
@@ -65339,7 +65740,6 @@ var RUNNING_DEVICE_TYPES = Object.values(DeviceType);
65339
65740
  /** Generic Customize target for the running boolean (D936). */
65340
65741
  var runningCustomize = {
65341
65742
  version: 1,
65342
- advanced: "derive",
65343
65743
  targets: [{
65344
65744
  id: "running",
65345
65745
  cardinality: "scalar",
@@ -65359,7 +65759,7 @@ var runningCustomize = {
65359
65759
  DeviceType.Thermostat,
65360
65760
  DeviceType.PetFeeder
65361
65761
  ],
65362
- apply: "add-or-replace",
65762
+ apply: "add",
65363
65763
  path: "running",
65364
65764
  sources: [
65365
65765
  {
@@ -65375,6 +65775,7 @@ var runningCustomize = {
65375
65775
  requiredUnit: "W",
65376
65776
  transforms: [{
65377
65777
  kind: "threshold",
65778
+ comparisons: ["gte", "lte"],
65378
65779
  comparison: "gte",
65379
65780
  defaultThreshold: 5,
65380
65781
  defaultStartDwellMs: RUNNING_POWER_START_DELAY_MS,
@@ -66651,9 +67052,9 @@ var RecordTriggerSchema = _enum([
66651
67052
  */
66652
67053
  var RecordWindowSchema = object({
66653
67054
  trigger: RecordTriggerSchema,
66654
- day: number().int().min(0).max(6),
66655
- startMinute: number().int().min(0).max(1439),
66656
- endMinute: number().int().min(1).max(1440)
67055
+ day: number().int().min(0).max(6).meta(readingMeta("none")),
67056
+ startMinute: number().int().min(0).max(1439).meta(readingMeta("none")),
67057
+ endMinute: number().int().min(1).max(1440).meta(readingMeta("none"))
66657
67058
  });
66658
67059
  /** Status of one physical volume, as the camera itself describes it. */
66659
67060
  var OnboardStorageVolumeSchema = object({
@@ -66729,10 +67130,10 @@ var RecordingOnboardStatusSchema = object({
66729
67130
  /** Master "record to the card at all" switch. */
66730
67131
  enabled: boolean().nullable(),
66731
67132
  overwriteWhenFull: boolean().nullable(),
66732
- preRecordSec: number().nullable(),
66733
- postRecordSec: number().nullable(),
67133
+ preRecordSec: number().nullable().meta(readingMeta("duration")),
67134
+ postRecordSec: number().nullable().meta(readingMeta("duration")),
66734
67135
  /** Length of one recorded file, in minutes. */
66735
- segmentMinutes: number().nullable(),
67136
+ segmentMinutes: number().nullable().meta(readingMeta("none")),
66736
67137
  /** The primary track's weekly windows, flattened. */
66737
67138
  windows: array(RecordWindowSchema),
66738
67139
  /**
@@ -66748,7 +67149,7 @@ var RecordingOnboardStatusSchema = object({
66748
67149
  * provider reporting a non-zero count also reports the schedule as not
66749
67150
  * writable.
66750
67151
  */
66751
- unreadableWindows: number(),
67152
+ unreadableWindows: number().meta(readingMeta("count")),
66752
67153
  /**
66753
67154
  * The camera is scheduled to record and has NO usable storage.
66754
67155
  *
@@ -67769,7 +68170,7 @@ var CamStreamDescriptorSchema = object({
67769
68170
  url: string().optional(),
67770
68171
  codec: string().optional(),
67771
68172
  resolution: CamStreamResolutionSchema.optional(),
67772
- fps: number().positive().optional(),
68173
+ fps: number().positive().optional().meta(readingMeta("rate")),
67773
68174
  label: string().optional(),
67774
68175
  /** Device-level features (e.g. `battery-operated`) — drives broker policy. */
67775
68176
  deviceFeatures: array(string()).optional(),
@@ -67856,18 +68257,18 @@ var StreamProfileSchema = _enum([
67856
68257
  ]);
67857
68258
  /** The current encoding config of one stream profile. */
67858
68259
  var StreamProfileConfigSchema = object({
67859
- width: number(),
67860
- height: number(),
68260
+ width: number().meta(readingMeta("none")),
68261
+ height: number().meta(readingMeta("none")),
67861
68262
  codec: _enum(["h264", "h265"]),
67862
- framerate: number(),
67863
- bitrate: number(),
68263
+ framerate: number().meta(readingMeta("rate")),
68264
+ bitrate: number().meta(readingMeta("bitrate")),
67864
68265
  bitrateMode: _enum(["vbr", "cbr"]).optional(),
67865
68266
  encoderProfile: _enum([
67866
68267
  "high",
67867
68268
  "main",
67868
68269
  "baseline"
67869
68270
  ]).optional(),
67870
- gop: number().optional(),
68271
+ gop: number().optional().meta(readingMeta("none")),
67871
68272
  /**
67872
68273
  * Whether THIS profile currently carries an audio track. READ-ONLY here.
67873
68274
  *
@@ -68286,12 +68687,7 @@ var switchCapability = {
68286
68687
  label: "On",
68287
68688
  kind: "boolean"
68288
68689
  }
68289
- }] },
68290
- customize: {
68291
- version: 1,
68292
- advanced: "derive",
68293
- targets: []
68294
- }
68690
+ }] }
68295
68691
  };
68296
68692
  /** C0 controls, DEL and the C1 range: none of them belongs in a name. */
68297
68693
  function hasControlCharacter(value) {
@@ -68874,35 +69270,21 @@ var tamperCapability = {
68874
69270
  * entries with `device_class: temperature` and any future native
68875
69271
  * thermometer.
68876
69272
  *
68877
- * Unit normalisation: providers convert to Celsius before storing.
68878
- * The slice value is always Celsius so cross-cap aggregators
68879
- * (climate-control's `currentTemp`, energy analytics) can compose
68880
- * without per-source unit fixups. The canonical display unit (`°C`) is
68881
- * a descriptor constant in the UI (ROLE_DESCRIPTOR), not stored in
68882
- * `sourceInfo`.
69273
+ * The number is Celsius (D944). Providers convert on ingest. A failed
69274
+ * conversion is `null`, never a guess. Display unit is a read-time preference.
68883
69275
  *
68884
69276
  * Status `lastFetchedAt` lets staleness-aware consumers detect a
68885
69277
  * frozen feed (provider hung) distinct from a "temperature hasn't
68886
69278
  * changed" steady state.
68887
69279
  */
68888
69280
  var TemperatureSensorStatusSchema = object({
68889
- /** Current temperature in Celsius. */
68890
- celsius: number().meta({
68891
- unit: "°C",
69281
+ /** Current temperature in Celsius. `null` when the sample was refused (D393). */
69282
+ celsius: number().nullable().meta(readingMeta("temperature", {
69283
+ precision: 1,
68892
69284
  label: "Temperature"
68893
- }),
69285
+ })),
68894
69286
  /** Ms epoch when the slice was last updated (push or poll). */
68895
- lastFetchedAt: number(),
68896
- /** Live display unit from the upstream source (e.g. HA
68897
- * `attributes.unit_of_measurement`). The UI prefers this over the
68898
- * role's canonical unit, so a Fahrenheit feed renders '°F' not '°C'.
68899
- * Absent → the UI falls back to the role's canonical unit. */
68900
- unit: string().optional(),
68901
- /** Suggested decimal places for numeric display.
68902
- * Populated live from the upstream source when provided (e.g. HA
68903
- * `attributes.suggested_display_precision`). Falls back to
68904
- * auto-formatting when absent. */
68905
- precision: number().int().min(0).max(10).optional()
69287
+ lastFetchedAt: number()
68906
69288
  });
68907
69289
  var temperatureSensorCapability = {
68908
69290
  name: "temperature-sensor",
@@ -68933,12 +69315,7 @@ var temperatureSensorCapability = {
68933
69315
  } } },
68934
69316
  /** Clock fields: written, but excluded from the compare that decides
68935
69317
  * whether persisting is worth a SQLite commit. */
68936
- volatileStateFields: ["lastFetchedAt"],
68937
- customize: {
68938
- version: 1,
68939
- advanced: "derive",
68940
- targets: []
68941
- }
69318
+ volatileStateFields: ["lastFetchedAt"]
68942
69319
  };
68943
69320
  /**
68944
69321
  * toast — system-scoped singleton capability that streams toast
@@ -69221,16 +69598,16 @@ var VacuumControlStatusSchema = object({
69221
69598
  ]),
69222
69599
  /** 0..100 battery percentage. Null when the device has no battery
69223
69600
  * reading. */
69224
- batteryLevel: number().min(0).max(100).nullable(),
69601
+ batteryLevel: number().min(0).max(100).nullable().meta(readingMeta("percentage")),
69225
69602
  /** Current fan-speed token (provider-verbatim). Null when unknown or
69226
69603
  * the vacuum has no speed control. */
69227
69604
  fanSpeed: string().nullable(),
69228
69605
  /** Speed tokens the hardware accepts — drives the UI selector. */
69229
69606
  availableFanSpeeds: array(string()),
69230
69607
  /** 0..100 cleaning-completion percentage of the current task, or null. */
69231
- progressPercent: number().min(0).max(100).nullable(),
69608
+ progressPercent: number().min(0).max(100).nullable().meta(readingMeta("percentage")),
69232
69609
  /** Current error code (0 / null = no error). */
69233
- errorCode: number().nullable(),
69610
+ errorCode: number().nullable().meta(readingMeta("none")),
69234
69611
  /** Human label for {@link errorCode}, or null when none / undecodable. */
69235
69612
  errorLabel: string().nullable(),
69236
69613
  /** Ms epoch when the slice was last updated. */
@@ -69308,7 +69685,7 @@ var ValveStatusSchema = object({
69308
69685
  ]),
69309
69686
  /** 0 = fully closed, 100 = fully open. Null when the device has no
69310
69687
  * intermediate position surface. */
69311
- position: number().min(0).max(100).nullable(),
69688
+ position: number().min(0).max(100).nullable().meta(readingMeta("percentage")),
69312
69689
  /** Ms epoch when the slice was last updated. */
69313
69690
  lastChangedAt: number()
69314
69691
  });
@@ -69416,9 +69793,9 @@ var vibrationCapability = {
69416
69793
  */
69417
69794
  var WaterHeaterStatusSchema = object({
69418
69795
  /** Current measured temperature. Null when not reported. */
69419
- currentTemp: number().nullable(),
69796
+ currentTemp: number().nullable().meta(readingMeta("temperature")),
69420
69797
  /** Target temperature setpoint. Null when no setpoint surface. */
69421
- targetTemp: number().nullable(),
69798
+ targetTemp: number().nullable().meta(readingMeta("temperature")),
69422
69799
  /** Active operation mode = HA `state` (`eco` / `electric` / `gas` /
69423
69800
  * `heat_pump` / `high_demand` / `performance` / `off`). Null when the
69424
69801
  * device reports an unknown state. */
@@ -69429,9 +69806,9 @@ var WaterHeaterStatusSchema = object({
69429
69806
  * has no away surface. */
69430
69807
  away: boolean().nullable(),
69431
69808
  /** HA `min_temp` attribute. Null when not reported. */
69432
- minTemp: number().nullable(),
69809
+ minTemp: number().nullable().meta(readingMeta("temperature")),
69433
69810
  /** HA `max_temp` attribute. Null when not reported. */
69434
- maxTemp: number().nullable(),
69811
+ maxTemp: number().nullable().meta(readingMeta("temperature")),
69435
69812
  /** Ms epoch when the slice was last updated. */
69436
69813
  lastChangedAt: number()
69437
69814
  });
@@ -69516,25 +69893,18 @@ var waterHeaterCapability = {
69516
69893
  * Forecast deferred — current conditions only for v1.
69517
69894
  */
69518
69895
  var WeatherStatusSchema = object({
69519
- /** Verbatim HA condition state (`sunny`, `cloudy`, `rainy`, …). Null
69520
- * when no condition has been reported yet. */
69896
+ /** Verbatim condition state (`sunny`, `cloudy`, `rainy`, …). Null when none yet. */
69521
69897
  condition: string().nullable(),
69522
- /** Current temperature in the reported unit. Null when not provided. */
69523
- temperature: number().nullable(),
69524
- /** Temperature unit string (e.g. `°C` / `°F`). Null when not provided. */
69525
- temperatureUnit: string().nullable(),
69898
+ /** Current temperature in Celsius. Null when not provided or refused. */
69899
+ temperature: number().nullable().meta(readingMeta("temperature", { precision: 1 })),
69526
69900
  /** Relative humidity (0..100). Null when not provided. */
69527
- humidity: number().min(0).max(100).nullable(),
69528
- /** Barometric pressure in the reported unit. Null when not provided. */
69529
- pressure: number().nullable(),
69530
- /** Pressure unit string (e.g. `hPa` / `inHg`). Null when not provided. */
69531
- pressureUnit: string().nullable(),
69532
- /** Wind speed in the reported unit. Null when not provided. */
69533
- windSpeed: number().nullable(),
69534
- /** Wind-speed unit string (e.g. `km/h` / `mph`). Null when not provided. */
69535
- windSpeedUnit: string().nullable(),
69901
+ humidity: number().min(0).max(100).nullable().meta(readingMeta("humidity")),
69902
+ /** Barometric pressure in hPa. Null when not provided or refused. */
69903
+ pressure: number().nullable().meta(readingMeta("pressure")),
69904
+ /** Wind speed in metres per second. Null when not provided or refused. */
69905
+ windSpeed: number().nullable().meta(readingMeta("speed")),
69536
69906
  /** Wind bearing in degrees (0..360, meteorological). Null when not provided. */
69537
- windBearing: number().nullable(),
69907
+ windBearing: number().nullable().meta(readingMeta("angle")),
69538
69908
  /** Ms epoch when the slice was last updated. */
69539
69909
  lastFetchedAt: number()
69540
69910
  });
@@ -69562,12 +69932,12 @@ var weatherCapability = {
69562
69932
  */
69563
69933
  durability: "session",
69564
69934
  /**
69565
- * History (D850): recorded series. Units follow the sibling `*Unit` fields.
69935
+ * History (D850): recorded series. Numbers are the quantity base (D944).
69566
69936
  */
69567
69937
  history: { fields: {
69568
69938
  temperature: {
69569
69939
  kind: "gauge",
69570
- unitFrom: "temperatureUnit",
69940
+ unit: "°C",
69571
69941
  deadband: .2
69572
69942
  },
69573
69943
  humidity: {
@@ -69577,12 +69947,12 @@ var weatherCapability = {
69577
69947
  },
69578
69948
  pressure: {
69579
69949
  kind: "gauge",
69580
- unitFrom: "pressureUnit",
69950
+ unit: "hPa",
69581
69951
  deadband: .5
69582
69952
  },
69583
69953
  windSpeed: {
69584
69954
  kind: "gauge",
69585
- unitFrom: "windSpeedUnit",
69955
+ unit: "m/s",
69586
69956
  deadband: .5
69587
69957
  }
69588
69958
  } }
@@ -70961,6 +71331,8 @@ var DEVICE_LOCAL_STATE_CAPS = {
70961
71331
  featureProbe: featureProbeCapability,
70962
71332
  flood: floodCapability,
70963
71333
  gas: gasCapability,
71334
+ groupCommands: groupCommandsCapability,
71335
+ groupStatus: groupStatusCapability,
70964
71336
  heatingValve: heatingValveCapability,
70965
71337
  humidifier: humidifierCapability,
70966
71338
  humiditySensor: humiditySensorCapability,
@@ -72341,6 +72713,13 @@ Object.freeze({
72341
72713
  access: "view",
72342
72714
  role: "admin"
72343
72715
  },
72716
+ "addons.getPackageDocs": {
72717
+ capName: "addons",
72718
+ capScope: "system",
72719
+ addonId: null,
72720
+ access: "view",
72721
+ role: "admin"
72722
+ },
72344
72723
  "addons.getVersions": {
72345
72724
  capName: "addons",
72346
72725
  capScope: "system",
@@ -75449,6 +75828,20 @@ Object.freeze({
75449
75828
  access: "view",
75450
75829
  role: "viewer"
75451
75830
  },
75831
+ "groupCommands.getStatus": {
75832
+ capName: "group-commands",
75833
+ capScope: "device",
75834
+ addonId: null,
75835
+ access: "view",
75836
+ role: "viewer"
75837
+ },
75838
+ "groupStatus.getStatus": {
75839
+ capName: "group-status",
75840
+ capScope: "device",
75841
+ addonId: null,
75842
+ access: "view",
75843
+ role: "viewer"
75844
+ },
75452
75845
  "heatingValve.getStatus": {
75453
75846
  capName: "heating-valve",
75454
75847
  capScope: "device",
@@ -85271,6 +85664,37 @@ var SENSOR_CAP_VOCABULARY = {
85271
85664
  icon: "flame"
85272
85665
  }]
85273
85666
  },
85667
+ "group-commands": {
85668
+ scope: "device",
85669
+ noun: t("Group command", "Comando di gruppo")
85670
+ },
85671
+ "group-status": {
85672
+ scope: "device",
85673
+ noun: t("Group", "Gruppo"),
85674
+ state: [
85675
+ {
85676
+ kind: "numeric",
85677
+ field: "included",
85678
+ quantity: t("the members reporting", "i membri che rispondono"),
85679
+ label: t("Reporting", "Rispondono"),
85680
+ icon: "users"
85681
+ },
85682
+ {
85683
+ kind: "numeric",
85684
+ field: "excluded",
85685
+ quantity: t("the members left out", "i membri esclusi"),
85686
+ label: t("Excluded", "Esclusi"),
85687
+ icon: "users"
85688
+ },
85689
+ {
85690
+ kind: "numeric",
85691
+ field: "total",
85692
+ quantity: t("the member count", "il numero di membri"),
85693
+ label: t("Members", "Membri"),
85694
+ icon: "sigma"
85695
+ }
85696
+ ]
85697
+ },
85274
85698
  "humidity-sensor": {
85275
85699
  scope: "device",
85276
85700
  noun: t("Humidity", "Umidità"),
@@ -85304,7 +85728,6 @@ var SENSOR_CAP_VOCABULARY = {
85304
85728
  field: "value",
85305
85729
  quantity: t("the reading", "il valore"),
85306
85730
  label: t("Reading", "Valore"),
85307
- unitField: "unit",
85308
85731
  icon: "gauge"
85309
85732
  }]
85310
85733
  },
@@ -85440,7 +85863,7 @@ var SENSOR_CAP_VOCABULARY = {
85440
85863
  field: "temperature",
85441
85864
  quantity: t("the outdoor temperature", "la temperatura esterna"),
85442
85865
  label: t("Temperature", "Temperatura"),
85443
- unitField: "temperatureUnit",
85866
+ unit: "°C",
85444
85867
  icon: "thermometer"
85445
85868
  },
85446
85869
  {
@@ -85456,7 +85879,7 @@ var SENSOR_CAP_VOCABULARY = {
85456
85879
  field: "windSpeed",
85457
85880
  quantity: t("the wind speed", "la velocità del vento"),
85458
85881
  label: t("Wind", "Vento"),
85459
- unitField: "windSpeedUnit",
85882
+ unit: "m/s",
85460
85883
  icon: "wind"
85461
85884
  },
85462
85885
  {
@@ -85464,7 +85887,7 @@ var SENSOR_CAP_VOCABULARY = {
85464
85887
  field: "pressure",
85465
85888
  quantity: t("the air pressure", "la pressione atmosferica"),
85466
85889
  label: t("Pressure", "Pressione"),
85467
- unitField: "pressureUnit",
85890
+ unit: "hPa",
85468
85891
  icon: "gauge"
85469
85892
  }
85470
85893
  ]
@@ -86955,6 +87378,16 @@ Object.freeze({
86955
87378
  form: "single",
86956
87379
  optional: false
86957
87380
  }],
87381
+ "groupCommands.getStatus": [{
87382
+ name: "deviceId",
87383
+ form: "single",
87384
+ optional: false
87385
+ }],
87386
+ "groupStatus.getStatus": [{
87387
+ name: "deviceId",
87388
+ form: "single",
87389
+ optional: false
87390
+ }],
86958
87391
  "heatingValve.getStatus": [{
86959
87392
  name: "deviceId",
86960
87393
  form: "single",
@@ -88819,6 +89252,11 @@ var PulseOverrideDraftSchema = object({
88819
89252
  targetId: string().min(1),
88820
89253
  enabled: boolean(),
88821
89254
  debounceMs: number().nonnegative(),
89255
+ edges: array(_enum([
89256
+ "rising",
89257
+ "button",
89258
+ "native-event"
89259
+ ])).min(1).optional(),
88822
89260
  sources: array(OverrideSourceSchema).min(1)
88823
89261
  });
88824
89262
  var SpanSourceDraftSchema = OverrideSourceSchema.extend({ mode: _enum([
@@ -88934,6 +89372,8 @@ new Map(Object.entries({
88934
89372
  "detection-blind": "device-events",
88935
89373
  "motion-noisy": "device-events",
88936
89374
  "motion-calm": "device-events",
89375
+ "package-llm-silent": "device-events",
89376
+ "package-llm-answered": "device-events",
88937
89377
  "recording-stalled": "device-events",
88938
89378
  "recording-healthy": "device-events",
88939
89379
  "recording-degraded": "device-events",
@@ -89017,6 +89457,12 @@ var NC_SYSTEM_EVENT_KIND_GROUP_SPECS = [
89017
89457
  label: "Motion without a subject",
89018
89458
  kinds: ["motion-noisy", "motion-calm"]
89019
89459
  },
89460
+ {
89461
+ id: "package-llm",
89462
+ family: "device-events",
89463
+ label: "Package confirm",
89464
+ kinds: ["package-llm-silent", "package-llm-answered"]
89465
+ },
89020
89466
  {
89021
89467
  id: "recording",
89022
89468
  family: "device-events",
@@ -89198,6 +89644,8 @@ var DEVICE_EVENTS = [
89198
89644
  "detection-blind",
89199
89645
  "motion-noisy",
89200
89646
  "motion-calm",
89647
+ "package-llm-silent",
89648
+ "package-llm-answered",
89201
89649
  "recording-stalled",
89202
89650
  "recording-healthy",
89203
89651
  "recording-degraded",
@@ -89466,6 +89914,15 @@ new Map([
89466
89914
  snapshotLabel: "Cameras with constant motion now",
89467
89915
  snapshotSection: null
89468
89916
  },
89917
+ {
89918
+ id: "package-llm-confirm",
89919
+ family: "device-events",
89920
+ label: "Package confirm (not answering / answering again)",
89921
+ bad: ["package-llm-silent"],
89922
+ recovery: ["package-llm-answered"],
89923
+ snapshotLabel: "Cameras whose package confirm is not answering",
89924
+ snapshotSection: null
89925
+ },
89469
89926
  {
89470
89927
  id: "recording-health",
89471
89928
  family: "device-events",