@camstack/types 1.2.568 → 1.2.570

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/CHANGELOG.md +12 -1
  2. package/dist/addon.js +2 -2
  3. package/dist/addon.mjs +2 -2
  4. package/dist/capabilities/error.cap.d.ts +135 -0
  5. package/dist/capabilities/index.d.ts +5 -1
  6. package/dist/capabilities/weather-station.cap.d.ts +255 -0
  7. package/dist/client.js +10 -0
  8. package/dist/client.mjs +10 -0
  9. package/dist/{composed-stable-id-BzXh1Swk.js → composed-stable-id-C3NfRTj8.js} +3 -0
  10. package/dist/{composed-stable-id-COP6zOXx.mjs → composed-stable-id-RvQIEpqg.mjs} +3 -0
  11. package/dist/device/base-device.d.ts +15 -0
  12. package/dist/device/device-error-episode.d.ts +24 -0
  13. package/dist/device/device-icon.d.ts +1 -0
  14. package/dist/device/device-type.d.ts +3 -0
  15. package/dist/device/hero/hero-layout.d.ts +1 -0
  16. package/dist/device/hero/hero-look.d.ts +6 -0
  17. package/dist/device/hero/hero-scene.d.ts +1 -0
  18. package/dist/generated/addon-api.d.ts +28 -0
  19. package/dist/generated/addon-cap-facts.d.ts +1 -1
  20. package/dist/generated/cap-status-types.d.ts +5 -1
  21. package/dist/generated/cap-vocabulary.d.ts +1 -1
  22. package/dist/generated/capability-router-map.d.ts +8 -2
  23. package/dist/generated/customize-catalog.d.ts +1 -1
  24. package/dist/generated/device-local-state.d.ts +6 -0
  25. package/dist/generated/device-proxy.d.ts +6 -0
  26. package/dist/generated/device-scoped-caps.d.ts +1 -1
  27. package/dist/generated/history-catalog.d.ts +1 -1
  28. package/dist/generated/method-access-map.d.ts +1 -1
  29. package/dist/generated/method-device-selectors.d.ts +1 -1
  30. package/dist/generated/runtime-state-durability.d.ts +1 -1
  31. package/dist/{implemented-methods-0xxMOekw.mjs → implemented-methods-C5FMXLGP.mjs} +1 -1
  32. package/dist/{implemented-methods-D4F6RWkO.js → implemented-methods-C7ScGvEz.js} +1 -1
  33. package/dist/index.d.ts +1 -0
  34. package/dist/index.js +356 -15
  35. package/dist/index.mjs +347 -16
  36. package/dist/node.js +2 -2
  37. package/dist/node.mjs +2 -2
  38. package/dist/{sleep-DEd_klYQ.mjs → sleep-BnR9qGOv.mjs} +287 -3
  39. package/dist/{sleep-BTb3-IPb.js → sleep-Cr2-wtyQ.js} +287 -3
  40. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_sleep = require("./sleep-BTb3-IPb.js");
2
+ const require_sleep = require("./sleep-Cr2-wtyQ.js");
3
3
  const require_event_category = require("./event-category-d9kiqCqC.js");
4
- const require_composed_stable_id = require("./composed-stable-id-BzXh1Swk.js");
5
- const require_implemented_methods = require("./implemented-methods-D4F6RWkO.js");
4
+ const require_composed_stable_id = require("./composed-stable-id-C3NfRTj8.js");
5
+ const require_implemented_methods = require("./implemented-methods-C7ScGvEz.js");
6
6
  const require_node_color = require("./node-color.js");
7
7
  const require_convert = require("./convert-BI8iTXn6.js");
8
8
  const require_enums = require("./enums.js");
@@ -48930,6 +48930,7 @@ var CAP_CUSTOMIZE_CATALOG = {
48930
48930
  require_composed_stable_id.DeviceType.Control,
48931
48931
  require_composed_stable_id.DeviceType.Presence,
48932
48932
  require_composed_stable_id.DeviceType.Weather,
48933
+ require_composed_stable_id.DeviceType.WeatherStation,
48933
48934
  require_composed_stable_id.DeviceType.Vacuum,
48934
48935
  require_composed_stable_id.DeviceType.LawnMower,
48935
48936
  require_composed_stable_id.DeviceType.Container,
@@ -50383,7 +50384,7 @@ var CHANGED = {
50383
50384
  fieldPath: "lastChangedAt",
50384
50385
  expr: "now"
50385
50386
  };
50386
- function numeric(input) {
50387
+ function numeric$1(input) {
50387
50388
  const { alsoFrom, ...base } = input;
50388
50389
  return {
50389
50390
  ...base,
@@ -50418,7 +50419,7 @@ function binary(input) {
50418
50419
  };
50419
50420
  }
50420
50421
  var GROUP_TEMPLATES = [
50421
- numeric({
50422
+ numeric$1({
50422
50423
  id: "temperature",
50423
50424
  summary: "Mean, median, min, max or sum of temperatures. Offline and unknown members are left out, never read as 0 °C.",
50424
50425
  role: require_composed_stable_id.DeviceRole.TemperatureSensor,
@@ -50436,7 +50437,7 @@ var GROUP_TEMPLATES = [
50436
50437
  }
50437
50438
  }
50438
50439
  }),
50439
- numeric({
50440
+ numeric$1({
50440
50441
  id: "humidity",
50441
50442
  summary: "Humidity in percent. Offline and unknown members are left out, never read as 0 %.",
50442
50443
  role: require_composed_stable_id.DeviceRole.HumiditySensor,
@@ -50454,7 +50455,7 @@ var GROUP_TEMPLATES = [
50454
50455
  }
50455
50456
  }
50456
50457
  }),
50457
- numeric({
50458
+ numeric$1({
50458
50459
  id: "pressure",
50459
50460
  summary: "Pressure in hectopascals. Offline and unknown members are left out, never read as 0 hPa.",
50460
50461
  role: require_composed_stable_id.DeviceRole.PressureSensor,
@@ -50465,7 +50466,7 @@ var GROUP_TEMPLATES = [
50465
50466
  empty: "null",
50466
50467
  companions: [NOW$3]
50467
50468
  }),
50468
- numeric({
50469
+ numeric$1({
50469
50470
  id: "illuminance",
50470
50471
  summary: "Illuminance in lux. Offline and unknown members are left out, never read as 0 lx.",
50471
50472
  role: require_composed_stable_id.DeviceRole.AmbientLightSensor,
@@ -50476,7 +50477,7 @@ var GROUP_TEMPLATES = [
50476
50477
  empty: "null",
50477
50478
  companions: [NOW$3]
50478
50479
  }),
50479
- numeric({
50480
+ numeric$1({
50480
50481
  id: "power",
50481
50482
  summary: "Power in watts, summed by default. Nobody reporting omits the key rather than writing 0 W.",
50482
50483
  role: require_composed_stable_id.DeviceRole.PowerSensor,
@@ -50487,7 +50488,7 @@ var GROUP_TEMPLATES = [
50487
50488
  empty: "omit",
50488
50489
  companions: [NOW$3]
50489
50490
  }),
50490
- numeric({
50491
+ numeric$1({
50491
50492
  id: "energy",
50492
50493
  summary: "Energy in kilowatt-hours, summed by default. Nobody reporting omits the key rather than writing 0 kWh.",
50493
50494
  role: require_composed_stable_id.DeviceRole.EnergySensor,
@@ -50498,7 +50499,7 @@ var GROUP_TEMPLATES = [
50498
50499
  empty: "omit",
50499
50500
  companions: [NOW$3]
50500
50501
  }),
50501
- numeric({
50502
+ numeric$1({
50502
50503
  id: "battery",
50503
50504
  summary: "Battery charge in percent. Offline and unknown members are left out, never read as 0 %.",
50504
50505
  role: require_composed_stable_id.DeviceRole.BatterySensor,
@@ -50522,7 +50523,7 @@ var GROUP_TEMPLATES = [
50522
50523
  }
50523
50524
  ]
50524
50525
  }),
50525
- numeric({
50526
+ numeric$1({
50526
50527
  id: "numeric",
50527
50528
  summary: "A numeric reading in the members’ shared quantity. Mixed quantities are refused. Nobody reporting publishes null, not 0.",
50528
50529
  role: require_composed_stable_id.DeviceRole.NumericSensor,
@@ -50772,7 +50773,7 @@ function groupTemplate(id) {
50772
50773
  //#region src/generated/history-catalog.ts
50773
50774
  /**
50774
50775
  * Cap history catalog, projected from every `*.cap.ts` `history` block.
50775
- * 45 caps with series (104 series), 37 caps answered `'none'`.
50776
+ * 45 caps with series (104 series), 39 caps answered `'none'`.
50776
50777
  * Field keys are `runtimeState` paths (`a.b` into fixed objects only).
50777
50778
  */
50778
50779
  var HISTORY_CATALOG = {
@@ -51344,6 +51345,7 @@ var HISTORY_NONE_CAPS = [
51344
51345
  "control",
51345
51346
  "day-night",
51346
51347
  "doorbell",
51348
+ "error",
51347
51349
  "event-emitter",
51348
51350
  "feature-probe",
51349
51351
  "group-active",
@@ -51371,6 +51373,7 @@ var HISTORY_NONE_CAPS = [
51371
51373
  "stream-signals",
51372
51374
  "timed-run",
51373
51375
  "update",
51376
+ "weather-station",
51374
51377
  "zone-analytics",
51375
51378
  "zone-rules",
51376
51379
  "zones"
@@ -60736,6 +60739,87 @@ var enumSensorCapability = {
60736
60739
  }
60737
60740
  };
60738
60741
  //#endregion
60742
+ //#region src/capabilities/error.cap.ts
60743
+ /** How loudly a fault wants the operator. Both tiers raise the attention event. */
60744
+ var DeviceErrorSeveritySchema = zod.z.enum(["warning", "error"]);
60745
+ /** One fault of a device that can raise several at once. */
60746
+ var DeviceFaultSchema = zod.z.object({
60747
+ /** The device's own code, as the vendor names it. */
60748
+ code: zod.z.string(),
60749
+ /** Already translated by the provider (it owns the vendor vocabulary). */
60750
+ label: zod.z.string(),
60751
+ severity: DeviceErrorSeveritySchema
60752
+ });
60753
+ /**
60754
+ * The fault a device reports right now. One slice per device.
60755
+ *
60756
+ * `active` is tri-state: `null` is "the provider has not read it yet" and is
60757
+ * never drawn as "no fault" nor as a fault (D315, D393). The provider filters
60758
+ * what is not a fault (a completion or reminder code) BEFORE it writes `true`.
60759
+ *
60760
+ * The cap's name is the key a template reads (`{{ alias.error.label }}`, D1021).
60761
+ */
60762
+ var ErrorStatusSchema = zod.z.object({
60763
+ active: zod.z.boolean().nullable(),
60764
+ /** The code of the principal fault; `null` when none (or unknown). */
60765
+ code: zod.z.string().nullable(),
60766
+ /** The principal fault's words, provider-translated; `null` when none. */
60767
+ label: zod.z.string().nullable(),
60768
+ severity: DeviceErrorSeveritySchema,
60769
+ /** Ms epoch the current fault started; `null` when none or not known. */
60770
+ since: zod.z.number().nullable(),
60771
+ /** Every fault, for a device that raises several. The principal is the first. */
60772
+ faults: zod.z.array(DeviceFaultSchema).optional(),
60773
+ /** Ms epoch of the last read the provider made of the fault. */
60774
+ lastFetchedAt: zod.z.number()
60775
+ });
60776
+ /** The slice before the provider has read anything: unknown, not "fine". */
60777
+ var ERROR_STATUS_COLD = {
60778
+ active: null,
60779
+ code: null,
60780
+ label: null,
60781
+ severity: "error",
60782
+ since: null,
60783
+ lastFetchedAt: 0
60784
+ };
60785
+ var errorCapability = {
60786
+ name: "error",
60787
+ scope: "device",
60788
+ deviceNative: true,
60789
+ mode: "singleton",
60790
+ methods: {},
60791
+ status: {
60792
+ schema: ErrorStatusSchema,
60793
+ kind: "push",
60794
+ empty: ERROR_STATUS_COLD
60795
+ },
60796
+ runtimeState: ErrorStatusSchema,
60797
+ /**
60798
+ * Runtime-state durability: **restored** — the previous observation is what
60799
+ * lets the first reading after a restart be a COMPARISON: a fault that was
60800
+ * already open must not announce itself a second time.
60801
+ *
60802
+ * See `RuntimeStateDurability`. Enforced by
60803
+ * `scripts/check-runtime-state-durability.ts`.
60804
+ */
60805
+ durability: "restored",
60806
+ volatileStateFields: ["lastFetchedAt"],
60807
+ /** The fault itself is carried by the attention alerts; no series is recorded. */
60808
+ history: "none",
60809
+ vocabulary: {
60810
+ noun: require_sleep.t("Fault", "Guasto"),
60811
+ order: 5265,
60812
+ state: [{
60813
+ kind: "boolean",
60814
+ field: "active",
60815
+ label: require_sleep.t("Fault", "Guasto"),
60816
+ whenTrue: require_sleep.t("When {device} reports a fault", "Quando {device} segnala un guasto"),
60817
+ whenFalse: require_sleep.t("When the fault of {device} clears", "Quando il guasto di {device} si risolve"),
60818
+ icon: "triangle-alert"
60819
+ }]
60820
+ }
60821
+ };
60822
+ //#endregion
60739
60823
  //#region src/capabilities/face-gallery.cap.ts
60740
60824
  var IdentitySchema = zod.z.object({
60741
60825
  id: zod.z.string(),
@@ -63594,6 +63678,7 @@ var HERO_SCENE_BY_TYPE = {
63594
63678
  [require_composed_stable_id.DeviceType.Control]: "control-dial",
63595
63679
  [require_composed_stable_id.DeviceType.Presence]: "presence",
63596
63680
  [require_composed_stable_id.DeviceType.Weather]: "weather",
63681
+ [require_composed_stable_id.DeviceType.WeatherStation]: "weather",
63597
63682
  [require_composed_stable_id.DeviceType.Vacuum]: "vacuum",
63598
63683
  [require_composed_stable_id.DeviceType.LawnMower]: "lawn-mower",
63599
63684
  [require_composed_stable_id.DeviceType.Container]: "generic",
@@ -100142,6 +100227,71 @@ var weatherCapability = {
100142
100227
  ]
100143
100228
  }
100144
100229
  };
100230
+ var WeatherStationStatusSchema = zod.z.object({
100231
+ temperature: zod.z.number().nullable().meta(require_sleep.readingMeta("temperature", { precision: 1 })),
100232
+ humidity: zod.z.number().min(0).max(100).nullable().meta(require_sleep.readingMeta("humidity")),
100233
+ pressure: zod.z.number().nullable().meta(require_sleep.readingMeta("pressure")),
100234
+ windSpeed: zod.z.number().nullable().meta(require_sleep.readingMeta("speed")),
100235
+ windGust: zod.z.number().nullable().meta(require_sleep.readingMeta("speed")),
100236
+ windBearing: zod.z.number().nullable().meta(require_sleep.readingMeta("angle")),
100237
+ rainRate: zod.z.number().nullable().meta(require_sleep.readingMeta("precipitation-rate", { precision: 1 })),
100238
+ rainDaily: zod.z.number().nullable().meta(require_sleep.readingMeta("precipitation", { precision: 1 })),
100239
+ rainEvent: zod.z.number().nullable().meta(require_sleep.readingMeta("precipitation", { precision: 1 })),
100240
+ uv: zod.z.number().nullable().meta(require_sleep.readingMeta("index", { precision: 1 })),
100241
+ solarRadiation: zod.z.number().nullable().meta(require_sleep.readingMeta("irradiance")),
100242
+ dewPoint: zod.z.number().nullable().meta(require_sleep.readingMeta("temperature", { precision: 1 }))
100243
+ }).extend({
100244
+ /** Ms epoch of the poll that produced this slice. 0 before the first one. */
100245
+ lastFetchedAt: zod.z.number() });
100246
+ var numeric = (field, quantity, label, unit, icon) => ({
100247
+ kind: "numeric",
100248
+ field,
100249
+ quantity,
100250
+ label,
100251
+ unit,
100252
+ icon
100253
+ });
100254
+ var weatherStationCapability = {
100255
+ name: "weather-station",
100256
+ scope: "device",
100257
+ deviceNative: true,
100258
+ mode: "singleton",
100259
+ deviceTypes: [require_composed_stable_id.DeviceType.WeatherStation],
100260
+ methods: {},
100261
+ status: {
100262
+ schema: WeatherStationStatusSchema,
100263
+ kind: "push"
100264
+ },
100265
+ runtimeState: WeatherStationStatusSchema,
100266
+ /**
100267
+ * The sensor children already record each reading. The station slice is the
100268
+ * live aggregate a template reads; it does not keep a second series.
100269
+ */
100270
+ history: "none",
100271
+ /**
100272
+ * Runtime-state durability: **session** — a station reading is stale the
100273
+ * moment the hub is down; the provider re-reads on the next poll.
100274
+ */
100275
+ durability: "session",
100276
+ vocabulary: {
100277
+ noun: require_sleep.t("Weather station", "Stazione meteo"),
100278
+ order: 5235,
100279
+ state: [
100280
+ numeric("temperature", require_sleep.t("the outdoor temperature", "la temperatura esterna"), require_sleep.t("Temperature", "Temperatura"), "°C", "thermometer"),
100281
+ numeric("humidity", require_sleep.t("the outdoor humidity", "l’umidità esterna"), require_sleep.t("Humidity", "Umidità"), "%", "droplets"),
100282
+ numeric("pressure", require_sleep.t("the air pressure", "la pressione atmosferica"), require_sleep.t("Pressure", "Pressione"), "hPa", "gauge"),
100283
+ numeric("windSpeed", require_sleep.t("the wind speed", "la velocità del vento"), require_sleep.t("Wind", "Vento"), "m/s", "wind"),
100284
+ numeric("windGust", require_sleep.t("the wind gust", "la raffica di vento"), require_sleep.t("Gust", "Raffica"), "m/s", "wind"),
100285
+ numeric("windBearing", require_sleep.t("the wind bearing", "la direzione del vento"), require_sleep.t("Wind bearing", "Direzione del vento"), "°", "wind"),
100286
+ numeric("rainRate", require_sleep.t("the rain rate", "l’intensità della pioggia"), require_sleep.t("Rain rate", "Intensità pioggia"), "mm/h", "droplets"),
100287
+ numeric("rainDaily", require_sleep.t("the rain today", "la pioggia di oggi"), require_sleep.t("Rain today", "Pioggia oggi"), "mm", "droplets"),
100288
+ numeric("rainEvent", require_sleep.t("the rain this event", "la pioggia di questo evento"), require_sleep.t("Rain event", "Evento di pioggia"), "mm", "droplets"),
100289
+ numeric("uv", require_sleep.t("the UV index", "l’indice UV"), require_sleep.t("UV", "UV"), "", "cloud-sun"),
100290
+ numeric("solarRadiation", require_sleep.t("the solar radiation", "la radiazione solare"), require_sleep.t("Solar", "Sole"), "W/m²", "cloud-sun"),
100291
+ numeric("dewPoint", require_sleep.t("the dew point", "il punto di rugiada"), require_sleep.t("Dew point", "Punto di rugiada"), "°C", "thermometer")
100292
+ ]
100293
+ }
100294
+ };
100145
100295
  //#endregion
100146
100296
  //#region src/capabilities/webrtc-session.cap.ts
100147
100297
  /**
@@ -101270,6 +101420,7 @@ var CAPABILITY_NAMES = {
101270
101420
  embeddingEncoder: "embedding-encoder",
101271
101421
  energySystem: "energy-system",
101272
101422
  enumSensor: "enum-sensor",
101423
+ error: "error",
101273
101424
  eventEmitter: "event-emitter",
101274
101425
  faceGallery: "face-gallery",
101275
101426
  failureContribution: "failure-contribution",
@@ -101400,6 +101551,7 @@ var CAPABILITY_NAMES = {
101400
101551
  viewerUi: "viewer-ui",
101401
101552
  waterHeater: "water-heater",
101402
101553
  weather: "weather",
101554
+ weatherStation: "weather-station",
101403
101555
  webrtcSession: "webrtc-session",
101404
101556
  zoneAnalytics: "zone-analytics",
101405
101557
  zoneRules: "zone-rules",
@@ -101695,6 +101847,10 @@ var CAPABILITY_ROUTER_KEYS = [
101695
101847
  key: "enumSensor",
101696
101848
  name: "enum-sensor"
101697
101849
  },
101850
+ {
101851
+ key: "error",
101852
+ name: "error"
101853
+ },
101698
101854
  {
101699
101855
  key: "eventEmitter",
101700
101856
  name: "event-emitter"
@@ -102215,6 +102371,10 @@ var CAPABILITY_ROUTER_KEYS = [
102215
102371
  key: "weather",
102216
102372
  name: "weather"
102217
102373
  },
102374
+ {
102375
+ key: "weatherStation",
102376
+ name: "weather-station"
102377
+ },
102218
102378
  {
102219
102379
  key: "webrtcSession",
102220
102380
  name: "webrtc-session"
@@ -102314,6 +102474,7 @@ var ALL_CAPABILITY_DEFINITIONS = [
102314
102474
  embeddingEncoderCapability,
102315
102475
  energySystemCapability,
102316
102476
  enumSensorCapability,
102477
+ errorCapability,
102317
102478
  eventEmitterCapability,
102318
102479
  faceGalleryCapability,
102319
102480
  failureContributionCapability,
@@ -102444,6 +102605,7 @@ var ALL_CAPABILITY_DEFINITIONS = [
102444
102605
  require_sleep.viewerUiCapability,
102445
102606
  waterHeaterCapability,
102446
102607
  weatherCapability,
102608
+ weatherStationCapability,
102447
102609
  webrtcSessionCapability,
102448
102610
  zoneAnalyticsCapability,
102449
102611
  zoneRulesCapability,
@@ -109983,6 +110145,7 @@ var DEVICE_LOCAL_STATE_CAPS = {
109983
110145
  doorbell: doorbellCapability,
109984
110146
  energySystem: energySystemCapability,
109985
110147
  enumSensor: enumSensorCapability,
110148
+ error: errorCapability,
109986
110149
  eventEmitter: eventEmitterCapability,
109987
110150
  fanControl: fanControlCapability,
109988
110151
  featureProbe: featureProbeCapability,
@@ -110039,11 +110202,62 @@ var DEVICE_LOCAL_STATE_CAPS = {
110039
110202
  vibration: vibrationCapability,
110040
110203
  waterHeater: waterHeaterCapability,
110041
110204
  weather: weatherCapability,
110205
+ weatherStation: weatherStationCapability,
110042
110206
  zoneAnalytics: zoneAnalyticsCapability,
110043
110207
  zoneRules: zoneRulesCapability,
110044
110208
  zones: zonesCapability
110045
110209
  };
110046
110210
  //#endregion
110211
+ //#region src/device/device-error-episode.ts
110212
+ /**
110213
+ * The edge between two readings, or `null` for no edge.
110214
+ *
110215
+ * - `null`/cold → `true` is a START (a fault already open at boot is one);
110216
+ * - `true` → `false` is a RESOLVE;
110217
+ * - an UNKNOWN reading (`active: null`) is never an edge, in either direction —
110218
+ * a failed read must neither raise nor close an episode (D393, D49);
110219
+ * - `true` → `true` is the same episode, whatever the code did.
110220
+ */
110221
+ function deviceErrorEdge(previous, next) {
110222
+ if (next.active === true && previous?.active !== true) return "start";
110223
+ if (next.active === false && previous?.active === true) return "resolve";
110224
+ return null;
110225
+ }
110226
+ function deviceErrorAlertId(deviceId) {
110227
+ return `device-error:${String(deviceId)}`;
110228
+ }
110229
+ /** The alert that opens an episode. `since` is the fault's own start, else `now`. */
110230
+ function buildDeviceErrorAlert(deviceId, deviceName, status, now) {
110231
+ const label = status.label ?? status.code ?? "Fault";
110232
+ const startedAt = status.since ?? now;
110233
+ const alertId = deviceErrorAlertId(deviceId);
110234
+ return {
110235
+ id: alertId,
110236
+ category: "device.error",
110237
+ severity: "critical",
110238
+ title: `${deviceName}: ${label}`,
110239
+ message: `${deviceName} reports a fault: ${label}.`,
110240
+ action: {
110241
+ label: "Open device",
110242
+ href: `/devices/${String(deviceId)}`,
110243
+ navigation: "app"
110244
+ },
110245
+ status: "active",
110246
+ read: false,
110247
+ createdAt: now,
110248
+ updatedAt: now,
110249
+ source: {
110250
+ type: "device",
110251
+ id: String(deviceId)
110252
+ },
110253
+ metadata: {
110254
+ episodeId: `${alertId}@${String(startedAt)}`,
110255
+ code: status.code,
110256
+ deviceSeverity: status.severity
110257
+ }
110258
+ };
110259
+ }
110260
+ //#endregion
110047
110261
  //#region src/device/base-device.ts
110048
110262
  var BaseDevice = class {
110049
110263
  id;
@@ -110344,6 +110558,68 @@ var BaseDevice = class {
110344
110558
  } catch (err) {}
110345
110559
  }
110346
110560
  /**
110561
+ * Declare that this device can report a fault (the `error` cap). The slice
110562
+ * starts UNKNOWN — a restored slice is kept, so a fault that was open before
110563
+ * a restart is compared, not announced again.
110564
+ */
110565
+ registerErrorCap() {
110566
+ this.ctx.registerNativeCap?.(errorCapability, {});
110567
+ if (this.runtimeState.getCapState(errorCapability.name) === void 0) this.setCapSlice(errorCapability, ERROR_STATUS_COLD);
110568
+ }
110569
+ /**
110570
+ * Publish the device's fault. The slice is written; on an EDGE (a fault
110571
+ * starts, or one resolves) an attention episode opens or closes through the
110572
+ * alerts cap, which the notification center announces as
110573
+ * `device-attention-required` / `-resolved`. An unknown reading is never an
110574
+ * edge. No rule exists by default: it notifies when the operator makes one.
110575
+ */
110576
+ async publishError(reading) {
110577
+ const previous = this.getCapSlice(errorCapability);
110578
+ if (reading.active === null && previous !== null && previous.active !== null) return;
110579
+ const now = Date.now();
110580
+ const edge = deviceErrorEdge(previous, reading);
110581
+ const next = edge === "start" && reading.since === null ? {
110582
+ ...reading,
110583
+ since: now
110584
+ } : reading;
110585
+ this.setCapSlice(errorCapability, next);
110586
+ if (edge === null) return;
110587
+ const alerts = this.ctx.api.alerts;
110588
+ if (alerts === void 0) {
110589
+ this.ctx.logger.warn("device error: attention event skipped — alerts capability missing", {
110590
+ tags: { deviceId: this.id },
110591
+ meta: { edge }
110592
+ });
110593
+ return;
110594
+ }
110595
+ try {
110596
+ if (edge === "start") await alerts.emit.mutate(buildDeviceErrorAlert(this.id, this.name, next, now));
110597
+ else await alerts.update.mutate({
110598
+ alertId: deviceErrorAlertId(this.id),
110599
+ patch: {
110600
+ status: "completed",
110601
+ read: true,
110602
+ updatedAt: now
110603
+ }
110604
+ });
110605
+ this.ctx.logger.info(`device error: ${edge === "start" ? "raised" : "resolved"}`, {
110606
+ tags: { deviceId: this.id },
110607
+ meta: {
110608
+ code: next.code,
110609
+ label: next.label
110610
+ }
110611
+ });
110612
+ } catch (err) {
110613
+ this.ctx.logger.warn("device error: attention event failed", {
110614
+ tags: { deviceId: this.id },
110615
+ meta: {
110616
+ edge,
110617
+ error: require_composed_stable_id.errMsg(err)
110618
+ }
110619
+ });
110620
+ }
110621
+ }
110622
+ /**
110347
110623
  * Typed read-through to a cap-keyed runtime-state slice. Drivers
110348
110624
  * call `this.getCapSlice(batteryCapability)` and the return type
110349
110625
  * is inferred from the cap's `runtimeState` Zod schema — no string
@@ -112136,6 +112412,7 @@ var DEVICE_TYPE_CONTROL_KIND = {
112136
112412
  [require_composed_stable_id.DeviceType.Control]: "control",
112137
112413
  [require_composed_stable_id.DeviceType.Presence]: "sensor",
112138
112414
  [require_composed_stable_id.DeviceType.Weather]: "weather",
112415
+ [require_composed_stable_id.DeviceType.WeatherStation]: "dummy",
112139
112416
  [require_composed_stable_id.DeviceType.Vacuum]: "vacuum",
112140
112417
  [require_composed_stable_id.DeviceType.LawnMower]: "lawn-mower",
112141
112418
  [require_composed_stable_id.DeviceType.Container]: "dummy",
@@ -113630,6 +113907,17 @@ var SENSORS_FAMILY_CONTRIBUTIONS = {
113630
113907
  doorbell: doorbellContribution,
113631
113908
  meter: meterContribution,
113632
113909
  weather: weatherContribution,
113910
+ "weather-station": contribution("weather-station", WeatherStationStatusSchema, (slice) => {
113911
+ if (slice === void 0 || slice.temperature === null) return { reading: reading("weather", "unknown") };
113912
+ const celsius = `${number(slice.temperature)}°C`;
113913
+ const facts = [fact("reading", "thermometer", require_sleep.t(celsius, celsius), "primary")];
113914
+ if (slice.humidity !== null) facts.push(fact("reading", "droplets", require_sleep.t(`${Math.round(slice.humidity)}%`, `${Math.round(slice.humidity)}%`)));
113915
+ if (slice.windSpeed !== null) facts.push(fact("reading", "wind", require_sleep.t(`${number(slice.windSpeed)} m/s`, `${number(slice.windSpeed)} m/s`)));
113916
+ return {
113917
+ reading: reading("weather", "on", false, require_sleep.t(celsius, celsius)),
113918
+ facts
113919
+ };
113920
+ }),
113633
113921
  update: updateContribution,
113634
113922
  image: imageContribution,
113635
113923
  button: buttonContribution,
@@ -115165,6 +115453,7 @@ var HERO_LAYOUT_BY_TYPE = {
115165
115453
  [require_composed_stable_id.DeviceType.Control]: CONTROL_LAYOUT,
115166
115454
  [require_composed_stable_id.DeviceType.Presence]: HERO_LAYOUT_DEFAULT,
115167
115455
  [require_composed_stable_id.DeviceType.Weather]: HERO_LAYOUT_DEFAULT,
115456
+ [require_composed_stable_id.DeviceType.WeatherStation]: HERO_LAYOUT_DEFAULT,
115168
115457
  [require_composed_stable_id.DeviceType.Vacuum]: VACUUM_LAYOUT,
115169
115458
  [require_composed_stable_id.DeviceType.LawnMower]: MOWER_LAYOUT,
115170
115459
  [require_composed_stable_id.DeviceType.Container]: HERO_LAYOUT_DEFAULT,
@@ -115890,6 +116179,7 @@ var HERO_LOOK_BY_TYPE = {
115890
116179
  [require_composed_stable_id.DeviceType.Control]: CONTROL_LOOK,
115891
116180
  [require_composed_stable_id.DeviceType.Presence]: PRESENCE_LOOK,
115892
116181
  [require_composed_stable_id.DeviceType.Weather]: WEATHER_LOOK,
116182
+ [require_composed_stable_id.DeviceType.WeatherStation]: WEATHER_LOOK,
115893
116183
  [require_composed_stable_id.DeviceType.Vacuum]: VACUUM_LOOK,
115894
116184
  [require_composed_stable_id.DeviceType.LawnMower]: MOWER_LOOK,
115895
116185
  [require_composed_stable_id.DeviceType.Container]: HERO_LOOK_DEFAULT,
@@ -116394,6 +116684,7 @@ var HERO_CAP_COVERAGE = {
116394
116684
  videoclips: { none: NOT_A_HERO_FACT },
116395
116685
  "water-heater": "contributes",
116396
116686
  weather: "contributes",
116687
+ "weather-station": "contributes",
116397
116688
  "webrtc-session": { none: NOT_A_HERO_FACT },
116398
116689
  "zone-analytics": { none: NOT_A_HERO_FACT },
116399
116690
  "zone-rules": { none: NOT_A_HERO_FACT },
@@ -119707,6 +119998,13 @@ var METHOD_ACCESS_MAP = Object.freeze({
119707
119998
  access: "view",
119708
119999
  role: "viewer"
119709
120000
  },
120001
+ "error.getStatus": {
120002
+ capName: "error",
120003
+ capScope: "device",
120004
+ addonId: null,
120005
+ access: "view",
120006
+ role: "viewer"
120007
+ },
119710
120008
  "eventEmitter.getStatus": {
119711
120009
  capName: "event-emitter",
119712
120010
  capScope: "device",
@@ -126700,6 +126998,13 @@ var METHOD_ACCESS_MAP = Object.freeze({
126700
126998
  access: "view",
126701
126999
  role: "viewer"
126702
127000
  },
127001
+ "weatherStation.getStatus": {
127002
+ capName: "weather-station",
127003
+ capScope: "device",
127004
+ addonId: null,
127005
+ access: "view",
127006
+ role: "viewer"
127007
+ },
126703
127008
  "webrtcSession.addIceCandidate": {
126704
127009
  capName: "webrtc-session",
126705
127010
  capScope: "device",
@@ -126929,6 +127234,7 @@ var KNOWN_CAP_NAMES = [
126929
127234
  "embedding-encoder",
126930
127235
  "energy-system",
126931
127236
  "enum-sensor",
127237
+ "error",
126932
127238
  "event-emitter",
126933
127239
  "face-gallery",
126934
127240
  "failure-contribution",
@@ -127059,6 +127365,7 @@ var KNOWN_CAP_NAMES = [
127059
127365
  "viewer-ui",
127060
127366
  "water-heater",
127061
127367
  "weather",
127368
+ "weather-station",
127062
127369
  "webrtc-session",
127063
127370
  "zone-analytics",
127064
127371
  "zone-rules",
@@ -127102,6 +127409,7 @@ var DEVICE_CAP_NAMES = [
127102
127409
  "doorbell",
127103
127410
  "energy-system",
127104
127411
  "enum-sensor",
127412
+ "error",
127105
127413
  "event-emitter",
127106
127414
  "fan-control",
127107
127415
  "feature-probe",
@@ -127167,6 +127475,7 @@ var DEVICE_CAP_NAMES = [
127167
127475
  "videoclips",
127168
127476
  "water-heater",
127169
127477
  "weather",
127478
+ "weather-station",
127170
127479
  "webrtc-session",
127171
127480
  "zone-analytics",
127172
127481
  "zone-rules",
@@ -127859,6 +128168,7 @@ var DEVICE_TYPE_ICON = {
127859
128168
  [require_composed_stable_id.DeviceType.Control]: "sliders-horizontal",
127860
128169
  [require_composed_stable_id.DeviceType.Presence]: "map-pin",
127861
128170
  [require_composed_stable_id.DeviceType.Weather]: "cloud-sun",
128171
+ [require_composed_stable_id.DeviceType.WeatherStation]: "cloud-sun",
127862
128172
  [require_composed_stable_id.DeviceType.Vacuum]: "bot",
127863
128173
  [require_composed_stable_id.DeviceType.LawnMower]: "tractor",
127864
128174
  [require_composed_stable_id.DeviceType.Container]: "box",
@@ -129229,6 +129539,7 @@ var CAP_NAMES_WITH_STATUS = [
129229
129539
  "doorbell",
129230
129540
  "energy-system",
129231
129541
  "enum-sensor",
129542
+ "error",
129232
129543
  "event-emitter",
129233
129544
  "fan-control",
129234
129545
  "feature-probe",
@@ -129285,7 +129596,8 @@ var CAP_NAMES_WITH_STATUS = [
129285
129596
  "valve",
129286
129597
  "vibration",
129287
129598
  "water-heater",
129288
- "weather"
129599
+ "weather",
129600
+ "weather-station"
129289
129601
  ];
129290
129602
  //#endregion
129291
129603
  //#region src/generated/method-device-selectors.ts
@@ -130273,6 +130585,11 @@ var METHOD_DEVICE_SELECTORS = Object.freeze({
130273
130585
  form: "single",
130274
130586
  optional: false
130275
130587
  }],
130588
+ "error.getStatus": [{
130589
+ name: "deviceId",
130590
+ form: "single",
130591
+ optional: false
130592
+ }],
130276
130593
  "eventEmitter.getStatus": [{
130277
130594
  name: "deviceId",
130278
130595
  form: "single",
@@ -132314,6 +132631,11 @@ var METHOD_DEVICE_SELECTORS = Object.freeze({
132314
132631
  form: "single",
132315
132632
  optional: false
132316
132633
  }],
132634
+ "weatherStation.getStatus": [{
132635
+ name: "deviceId",
132636
+ form: "single",
132637
+ optional: false
132638
+ }],
132317
132639
  "webrtcSession.addIceCandidate": [{
132318
132640
  name: "deviceId",
132319
132641
  form: "single",
@@ -132661,7 +132983,7 @@ function getCapsByProviderKind(kind) {
132661
132983
  //#region src/generated/runtime-state-durability.ts
132662
132984
  /**
132663
132985
  * Per-cap runtime-state policy, projected from every `*.cap.ts` that declares
132664
- * `runtimeState`. 83 caps: 42 `restored`, 41 `session`.
132986
+ * `runtimeState`. 85 caps: 43 `restored`, 42 `session`.
132665
132987
  *
132666
132988
  * A cap absent from this map has no runtime-state slice at all. A cap PRESENT
132667
132989
  * with `durability: 'session'` has one and has decided not to keep it.
@@ -132764,6 +133086,10 @@ var RUNTIME_STATE_POLICY = {
132764
133086
  durability: "restored",
132765
133087
  volatileFields: ["lastFetchedAt", "timestamp"]
132766
133088
  },
133089
+ "error": {
133090
+ durability: "restored",
133091
+ volatileFields: ["lastFetchedAt"]
133092
+ },
132767
133093
  "event-emitter": {
132768
133094
  durability: "session",
132769
133095
  volatileFields: []
@@ -132989,6 +133315,10 @@ var RUNTIME_STATE_POLICY = {
132989
133315
  durability: "session",
132990
133316
  volatileFields: []
132991
133317
  },
133318
+ "weather-station": {
133319
+ durability: "session",
133320
+ volatileFields: []
133321
+ },
132992
133322
  "zone-analytics": {
132993
133323
  durability: "session",
132994
133324
  volatileFields: []
@@ -133038,6 +133368,7 @@ var RESTORED_CAP_NAMES = [
133038
133368
  "device-status",
133039
133369
  "doorbell",
133040
133370
  "enum-sensor",
133371
+ "error",
133041
133372
  "flood",
133042
133373
  "gas",
133043
133374
  "humidity-sensor",
@@ -147220,11 +147551,13 @@ exports.DeviceCredentialSchema = DeviceCredentialSchema;
147220
147551
  exports.DeviceCredentialStatusSchema = DeviceCredentialStatusSchema;
147221
147552
  exports.DeviceDataEntrySchema = DeviceDataEntrySchema;
147222
147553
  exports.DeviceEnrollProofSchema = DeviceEnrollProofSchema;
147554
+ exports.DeviceErrorSeveritySchema = DeviceErrorSeveritySchema;
147223
147555
  exports.DeviceExportExposeInputSchema = ExposeInputSchema;
147224
147556
  exports.DeviceExportInstancePinSchema = InstancePinSchema;
147225
147557
  exports.DeviceExportSetExposedNameInputSchema = SetExposedNameInputSchema;
147226
147558
  exports.DeviceExportStatusSchema = DeviceExportStatusSchema;
147227
147559
  exports.DeviceExportUnexposeInputSchema = UnexposeInputSchema;
147560
+ exports.DeviceFaultSchema = DeviceFaultSchema;
147228
147561
  exports.DeviceFeature = require_composed_stable_id.DeviceFeature;
147229
147562
  exports.DeviceFiredMatchSchema = DeviceFiredMatchSchema;
147230
147563
  exports.DeviceFiredWatch = DeviceFiredWatch;
@@ -147316,6 +147649,7 @@ exports.EMBEDDING_REQUIREMENTS_UNAVAILABLE = EMBEDDING_REQUIREMENTS_UNAVAILABLE;
147316
147649
  exports.EMPTY_AUTOMATION_STATE = EMPTY_AUTOMATION_STATE;
147317
147650
  exports.EMPTY_REMOTE_ASSUMED_STATE = EMPTY_REMOTE_ASSUMED_STATE;
147318
147651
  exports.EMPTY_REMOTE_CONFIG = EMPTY_REMOTE_CONFIG;
147652
+ exports.ERROR_STATUS_COLD = ERROR_STATUS_COLD;
147319
147653
  exports.ESTIMATE_COMPUTE_RATIO_MAX = ESTIMATE_COMPUTE_RATIO_MAX;
147320
147654
  exports.ESTIMATE_COMPUTE_RATIO_MIN = ESTIMATE_COMPUTE_RATIO_MIN;
147321
147655
  exports.EVENTFUL_CAP_NAMES = EVENTFUL_CAP_NAMES;
@@ -147374,6 +147708,7 @@ exports.EnumSensorDateTimeFormatSchema = EnumSensorDateTimeFormatSchema;
147374
147708
  exports.EnumSensorStatusSchema = EnumSensorStatusSchema;
147375
147709
  exports.ErrorCodeSchema = require_sleep.ErrorCodeSchema;
147376
147710
  exports.ErrorI18nPayloadSchema = require_sleep.ErrorI18nPayloadSchema;
147711
+ exports.ErrorStatusSchema = ErrorStatusSchema;
147377
147712
  exports.EventCategory = require_event_category.EventCategory;
147378
147713
  exports.EventDensityBucketSchema = EventDensityBucketSchema;
147379
147714
  exports.EventDensityForDeviceSchema = EventDensityForDeviceSchema;
@@ -149151,6 +149486,7 @@ exports.WELL_KNOWN_TABS = require_sleep.WELL_KNOWN_TABS;
149151
149486
  exports.WELL_KNOWN_TAB_MAP = require_sleep.WELL_KNOWN_TAB_MAP;
149152
149487
  exports.WHEN_UNROLL_DEPTH = WHEN_UNROLL_DEPTH;
149153
149488
  exports.WaterHeaterStatusSchema = WaterHeaterStatusSchema;
149489
+ exports.WeatherStationStatusSchema = WeatherStationStatusSchema;
149154
149490
  exports.WeatherStatusSchema = WeatherStatusSchema;
149155
149491
  exports.WebrtcClimbHoldSchema = WebrtcClimbHoldSchema;
149156
149492
  exports.WebrtcLadderDecisionSchema = WebrtcLadderDecisionSchema;
@@ -149292,6 +149628,7 @@ exports.buildBenchStepTree = buildBenchStepTree;
149292
149628
  exports.buildCapabilityLookup = buildCapabilityLookup;
149293
149629
  exports.buildDeviceAdminUrl = buildDeviceAdminUrl;
149294
149630
  exports.buildDeviceEnrollmentLink = buildDeviceEnrollmentLink;
149631
+ exports.buildDeviceErrorAlert = buildDeviceErrorAlert;
149295
149632
  exports.buildDeviceSignatureMessage = buildDeviceSignatureMessage;
149296
149633
  exports.buildDraftJsonSchema = buildDraftJsonSchema;
149297
149634
  exports.buildDraftPrompt = buildDraftPrompt;
@@ -149560,6 +149897,8 @@ exports.deviceAttentionKind = deviceAttentionKind;
149560
149897
  exports.deviceBackendToFormat = deviceBackendToFormat;
149561
149898
  exports.deviceCredentialsCapability = deviceCredentialsCapability;
149562
149899
  exports.deviceCustomAction = require_sleep.deviceCustomAction;
149900
+ exports.deviceErrorAlertId = deviceErrorAlertId;
149901
+ exports.deviceErrorEdge = deviceErrorEdge;
149563
149902
  exports.deviceExportCapability = deviceExportCapability;
149564
149903
  exports.deviceExportStatusInstanceOf = statusInstanceOf;
149565
149904
  exports.deviceExtensionCapability = deviceExtensionCapability;
@@ -149620,6 +149959,7 @@ exports.enumerateInferenceDevices = enumerateInferenceDevices;
149620
149959
  exports.enumerateItemArrayFields = enumerateItemArrayFields;
149621
149960
  exports.enumerateSchemaFields = enumerateSchemaFields;
149622
149961
  exports.errMsg = require_composed_stable_id.errMsg;
149962
+ exports.errorCapability = errorCapability;
149623
149963
  exports.estimateNodeBenchmarkDurationMs = estimateNodeBenchmarkDurationMs;
149624
149964
  exports.evaluateAggregate = evaluateAggregate;
149625
149965
  exports.evaluateAst = require_implemented_methods.evaluateAst;
@@ -150649,6 +150989,7 @@ exports.waitUntil = waitUntil;
150649
150989
  exports.waterHeaterCapability = waterHeaterCapability;
150650
150990
  exports.wattMillisecondsToKwh = require_implemented_methods.wattMillisecondsToKwh;
150651
150991
  exports.weatherCapability = weatherCapability;
150992
+ exports.weatherStationCapability = weatherStationCapability;
150652
150993
  exports.webrtcClientHintsSchema = webrtcClientHintsSchema;
150653
150994
  exports.webrtcSessionCapability = webrtcSessionCapability;
150654
150995
  exports.weekdayOfLocalDate = weekdayOfLocalDate;