@nebulahome/integration-sdk 1.8.0 → 1.10.0

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.
@@ -830,7 +830,7 @@ function defineTransport(spec) {
830
830
  * bundle built with this SDK says `^<major>.<minor>.0`.
831
831
  */
832
832
  /** The SDK's own version: `1.0.0`, or a prerelease of it. */
833
- const SDK_VERSION = "1.8.0";
833
+ const SDK_VERSION = "1.10.0";
834
834
  /**
835
835
  * The runtime range a bundle built with this SDK declares: this version's major and minor, so a
836
836
  * platform with the same contract or a later one of the same major loads it.
package/dist/index.d.ts CHANGED
@@ -1,8 +1,22 @@
1
1
  import { z } from "zod";
2
2
  //#endregion
3
+ //#region ../contracts/dist/json.d.ts
4
+ /**
5
+ * A JSON object, the shape most `jsonb` columns actually hold.
6
+ *
7
+ * Written as an index signature rather than `Record<string, JsonValue>` because `Record` is a
8
+ * mapped type, which TypeScript resolves eagerly and therefore cannot use in the recursive
9
+ * definition below (TS2456). The index signature is deferred, so it can.
10
+ */
11
+ type JsonObject = {
12
+ [key: string]: JsonValue;
13
+ };
14
+ /** Any value that survives a JSON round trip unchanged. */
15
+ type JsonValue = string | number | boolean | null | JsonValue[] | JsonObject;
16
+ //#endregion
3
17
  //#region ../contracts/dist/capabilities.d.ts
4
18
  /** Every capability an entity may declare. */
5
- declare const CAPABILITIES: readonly ["on_off", "level", "color_hs", "color_temp", "cover", "lock", "thermostat", "sensor_numeric", "sensor_binary", "sensor_text", "media_player", "camera", "button", "update", "lawn_mower", "select", "number", "vacuum", "image", "custom"];
19
+ declare const CAPABILITIES: readonly ["on_off", "level", "color_hs", "color_temp", "effect", "cover", "lock", "thermostat", "sensor_numeric", "sensor_binary", "sensor_text", "media_player", "camera", "button", "update", "lawn_mower", "select", "number", "vacuum", "fan", "location", "image", "custom"];
6
20
  /** The name of a single capability. */
7
21
  type CapabilityName = (typeof CAPABILITIES)[number];
8
22
  /**
@@ -22,9 +36,15 @@ declare const capabilityStateSchema: z.ZodObject<{
22
36
  color_hs: z.ZodOptional<z.ZodObject<{
23
37
  hue: z.ZodNumber;
24
38
  saturation: z.ZodNumber;
39
+ white: z.ZodOptional<z.ZodNumber>;
40
+ isActive: z.ZodOptional<z.ZodBoolean>;
25
41
  }, z.core.$strip>>;
26
42
  color_temp: z.ZodOptional<z.ZodObject<{
27
43
  mireds: z.ZodInt;
44
+ isActive: z.ZodOptional<z.ZodBoolean>;
45
+ }, z.core.$strip>>;
46
+ effect: z.ZodOptional<z.ZodObject<{
47
+ effect: z.ZodDefault<z.ZodNullable<z.ZodString>>;
28
48
  }, z.core.$strip>>;
29
49
  cover: z.ZodOptional<z.ZodObject<{
30
50
  position: z.ZodNumber;
@@ -41,10 +61,18 @@ declare const capabilityStateSchema: z.ZodObject<{
41
61
  unlocked: "unlocked";
42
62
  jammed: "jammed";
43
63
  }>;
64
+ motion: z.ZodOptional<z.ZodEnum<{
65
+ opening: "opening";
66
+ locking: "locking";
67
+ unlocking: "unlocking";
68
+ }>>;
69
+ isOpen: z.ZodOptional<z.ZodBoolean>;
44
70
  }, z.core.$strip>>;
45
71
  thermostat: z.ZodOptional<z.ZodObject<{
46
- currentTemperature: z.ZodNumber;
72
+ currentTemperature: z.ZodOptional<z.ZodNumber>;
47
73
  targetTemperature: z.ZodNumber;
74
+ targetTemperatureLow: z.ZodOptional<z.ZodNumber>;
75
+ targetTemperatureHigh: z.ZodOptional<z.ZodNumber>;
48
76
  mode: z.ZodEnum<{
49
77
  off: "off";
50
78
  heat: "heat";
@@ -54,14 +82,21 @@ declare const capabilityStateSchema: z.ZodObject<{
54
82
  dry: "dry";
55
83
  }>;
56
84
  action: z.ZodEnum<{
85
+ fan: "fan";
57
86
  off: "off";
58
87
  idle: "idle";
59
88
  heating: "heating";
60
89
  cooling: "cooling";
61
90
  drying: "drying";
62
- fan: "fan";
91
+ preheating: "preheating";
92
+ defrosting: "defrosting";
63
93
  }>;
64
94
  humidity: z.ZodOptional<z.ZodNumber>;
95
+ targetHumidity: z.ZodOptional<z.ZodNumber>;
96
+ preset: z.ZodOptional<z.ZodNullable<z.ZodString>>;
97
+ fanMode: z.ZodOptional<z.ZodString>;
98
+ swingMode: z.ZodOptional<z.ZodString>;
99
+ swingHorizontalMode: z.ZodOptional<z.ZodString>;
65
100
  }, z.core.$strip>>;
66
101
  sensor_numeric: z.ZodOptional<z.ZodObject<{
67
102
  value: z.ZodNumber;
@@ -83,8 +118,17 @@ declare const capabilityStateSchema: z.ZodObject<{
83
118
  volume: z.ZodNumber;
84
119
  isMuted: z.ZodBoolean;
85
120
  source: z.ZodOptional<z.ZodString>;
121
+ soundMode: z.ZodOptional<z.ZodString>;
122
+ isShuffled: z.ZodOptional<z.ZodBoolean>;
123
+ repeat: z.ZodOptional<z.ZodEnum<{
124
+ off: "off";
125
+ all: "all";
126
+ one: "one";
127
+ }>>;
86
128
  mediaTitle: z.ZodOptional<z.ZodString>;
87
129
  mediaArtist: z.ZodOptional<z.ZodString>;
130
+ mediaAlbum: z.ZodOptional<z.ZodString>;
131
+ mediaImagePath: z.ZodOptional<z.ZodString>;
88
132
  mediaDurationSeconds: z.ZodOptional<z.ZodNumber>;
89
133
  mediaPositionSeconds: z.ZodOptional<z.ZodNumber>;
90
134
  }, z.core.$strip>>;
@@ -92,6 +136,7 @@ declare const capabilityStateSchema: z.ZodObject<{
92
136
  isStreamAvailable: z.ZodBoolean;
93
137
  snapshotPath: z.ZodOptional<z.ZodString>;
94
138
  isRecording: z.ZodDefault<z.ZodBoolean>;
139
+ isMotionDetectionOn: z.ZodOptional<z.ZodBoolean>;
95
140
  }, z.core.$strip>>;
96
141
  button: z.ZodOptional<z.ZodObject<{}, z.core.$strip>>;
97
142
  update: z.ZodOptional<z.ZodObject<{
@@ -99,6 +144,9 @@ declare const capabilityStateSchema: z.ZodObject<{
99
144
  latestVersion: z.ZodDefault<z.ZodNullable<z.ZodString>>;
100
145
  isInstalling: z.ZodDefault<z.ZodBoolean>;
101
146
  progress: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
147
+ title: z.ZodOptional<z.ZodString>;
148
+ releaseSummary: z.ZodOptional<z.ZodString>;
149
+ releaseUrl: z.ZodOptional<z.ZodURL>;
102
150
  }, z.core.$strip>>;
103
151
  lawn_mower: z.ZodOptional<z.ZodObject<{
104
152
  activity: z.ZodEnum<{
@@ -129,8 +177,36 @@ declare const capabilityStateSchema: z.ZodObject<{
129
177
  rooms: z.ZodDefault<z.ZodArray<z.ZodObject<{
130
178
  id: z.ZodString;
131
179
  name: z.ZodString;
180
+ outline: z.ZodOptional<z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>>;
132
181
  }, z.core.$strip>>>;
133
182
  isResumable: z.ZodDefault<z.ZodBoolean>;
183
+ fanSpeed: z.ZodOptional<z.ZodString>;
184
+ cleanMode: z.ZodOptional<z.ZodEnum<{
185
+ vacuum: "vacuum";
186
+ mop: "mop";
187
+ vacuum_and_mop: "vacuum_and_mop";
188
+ }>>;
189
+ waterLevel: z.ZodOptional<z.ZodString>;
190
+ }, z.core.$strip>>;
191
+ fan: z.ZodOptional<z.ZodObject<{
192
+ percentage: z.ZodOptional<z.ZodNumber>;
193
+ preset: z.ZodOptional<z.ZodNullable<z.ZodString>>;
194
+ isOscillating: z.ZodOptional<z.ZodBoolean>;
195
+ direction: z.ZodOptional<z.ZodEnum<{
196
+ forward: "forward";
197
+ reverse: "reverse";
198
+ }>>;
199
+ }, z.core.$strip>>;
200
+ location: z.ZodOptional<z.ZodObject<{
201
+ zone: z.ZodDefault<z.ZodNullable<z.ZodString>>;
202
+ latitude: z.ZodOptional<z.ZodNumber>;
203
+ longitude: z.ZodOptional<z.ZodNumber>;
204
+ accuracyMeters: z.ZodOptional<z.ZodNumber>;
205
+ locationName: z.ZodOptional<z.ZodString>;
206
+ distanceKm: z.ZodOptional<z.ZodNumber>;
207
+ ipAddress: z.ZodOptional<z.ZodString>;
208
+ macAddress: z.ZodOptional<z.ZodString>;
209
+ hostName: z.ZodOptional<z.ZodString>;
134
210
  }, z.core.$strip>>;
135
211
  image: z.ZodOptional<z.ZodObject<{
136
212
  contentType: z.ZodEnum<{
@@ -149,19 +225,21 @@ declare const capabilityStateSchema: z.ZodObject<{
149
225
  /** The composite state of an entity, keyed by capability. */
150
226
  type CapabilityState = z.output<typeof capabilityStateSchema>;
151
227
  //#endregion
152
- //#region ../contracts/dist/json.d.ts
228
+ //#region ../contracts/dist/entity-id.d.ts
229
+ /** The kinds of thing an entity can be. The domain is the part before the dot. */
230
+ declare const ENTITY_DOMAINS: readonly ["light", "switch", "sensor", "binary_sensor", "cover", "lock", "climate", "media_player", "camera", "button", "update", "lawn_mower", "select", "number", "vacuum", "fan", "device_tracker", "geo_location", "image", "custom", "alias"];
231
+ /** The kind of thing an entity is. */
232
+ type EntityDomain = (typeof ENTITY_DOMAINS)[number];
153
233
  /**
154
- * A JSON object, the shape most `jsonb` columns actually hold.
234
+ * Validates an entity identifier and brands the result.
155
235
  *
156
- * Written as an index signature rather than `Record<string, JsonValue>` because `Record` is a
157
- * mapped type, which TypeScript resolves eagerly and therefore cannot use in the recursive
158
- * definition below (TS2456). The index signature is deferred, so it can.
236
+ * The brand means an `EntityId` cannot be produced from a bare string without going through
237
+ * validation. Identifiers reach the database as primary lookups and NATS as subject tokens, so
238
+ * an unvalidated one does not fail where it was created - it fails somewhere else, later.
159
239
  */
160
- type JsonObject = {
161
- [key: string]: JsonValue;
162
- };
163
- /** Any value that survives a JSON round trip unchanged. */
164
- type JsonValue = string | number | boolean | null | JsonValue[] | JsonObject;
240
+ declare const entityIdSchema: z.core.$ZodBranded<z.ZodString, "EntityId", "out">;
241
+ /** A validated `<domain>.<object_id>` identifier. */
242
+ type EntityId = z.output<typeof entityIdSchema>;
165
243
  //#endregion
166
244
  //#region ../contracts/dist/bluetooth.d.ts
167
245
  /** How a scanner listens: passive only hears, active also asks devices for more. */
@@ -194,8 +272,8 @@ type BluetoothAdvert = z.output<typeof bluetoothAdvertSchema>;
194
272
  */
195
273
  declare const bluetoothProxyProfileSchema: z.ZodObject<{
196
274
  modes: z.ZodArray<z.ZodEnum<{
197
- passive: "passive";
198
275
  active: "active";
276
+ passive: "passive";
199
277
  }>>;
200
278
  }, z.core.$strict>;
201
279
  /** What a device that can be a proxy declares. */
@@ -203,8 +281,8 @@ type BluetoothProxyProfile = z.output<typeof bluetoothProxyProfileSchema>;
203
281
  /** Arguments of `bluetooth-proxy.install`. */
204
282
  declare const bluetoothProxyInstallArgsSchema: z.ZodObject<{
205
283
  mode: z.ZodEnum<{
206
- passive: "passive";
207
284
  active: "active";
285
+ passive: "passive";
208
286
  }>;
209
287
  }, z.core.$strip>;
210
288
  /** Arguments of `bluetooth-proxy.install`: the mode to rest in, which the hub picks. */
@@ -229,8 +307,8 @@ declare const bluetoothProxyStateSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
229
307
  }, z.core.$strip>, z.ZodObject<{
230
308
  eligible: z.ZodLiteral<false>;
231
309
  reason: z.ZodEnum<{
232
- gen1: "gen1";
233
310
  battery: "battery";
311
+ gen1: "gen1";
234
312
  firmware: "firmware";
235
313
  "no-bluetooth": "no-bluetooth";
236
314
  unsupported: "unsupported";
@@ -240,22 +318,6 @@ declare const bluetoothProxyStateSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
240
318
  /** Whether a device can be a proxy, and whether it is. */
241
319
  type BluetoothProxyState = z.output<typeof bluetoothProxyStateSchema>;
242
320
  //#endregion
243
- //#region ../contracts/dist/entity-id.d.ts
244
- /** The kinds of thing an entity can be. The domain is the part before the dot. */
245
- declare const ENTITY_DOMAINS: readonly ["light", "switch", "sensor", "binary_sensor", "cover", "lock", "climate", "media_player", "camera", "button", "update", "lawn_mower", "select", "number", "vacuum", "image", "custom", "alias"];
246
- /** The kind of thing an entity is. */
247
- type EntityDomain = (typeof ENTITY_DOMAINS)[number];
248
- /**
249
- * Validates an entity identifier and brands the result.
250
- *
251
- * The brand means an `EntityId` cannot be produced from a bare string without going through
252
- * validation. Identifiers reach the database as primary lookups and NATS as subject tokens, so
253
- * an unvalidated one does not fail where it was created - it fails somewhere else, later.
254
- */
255
- declare const entityIdSchema: z.core.$ZodBranded<z.ZodString, "EntityId", "out">;
256
- /** A validated `<domain>.<object_id>` identifier. */
257
- type EntityId = z.output<typeof entityIdSchema>;
258
- //#endregion
259
321
  //#region ../contracts/dist/registration.d.ts
260
322
  /**
261
323
  * How history should aggregate a numeric entity.
@@ -278,17 +340,8 @@ type EntityStateClass = (typeof ENTITY_STATE_CLASSES)[number];
278
340
  declare const declaredCapabilitiesSchema: z.ZodRecord<z.ZodEnum<{
279
341
  number: "number";
280
342
  custom: "custom";
281
- image: "image";
282
- level: "level";
283
- on_off: "on_off";
284
- color_hs: "color_hs";
285
- color_temp: "color_temp";
286
343
  cover: "cover";
287
344
  lock: "lock";
288
- thermostat: "thermostat";
289
- sensor_numeric: "sensor_numeric";
290
- sensor_binary: "sensor_binary";
291
- sensor_text: "sensor_text";
292
345
  media_player: "media_player";
293
346
  camera: "camera";
294
347
  button: "button";
@@ -296,6 +349,18 @@ declare const declaredCapabilitiesSchema: z.ZodRecord<z.ZodEnum<{
296
349
  lawn_mower: "lawn_mower";
297
350
  select: "select";
298
351
  vacuum: "vacuum";
352
+ fan: "fan";
353
+ image: "image";
354
+ level: "level";
355
+ on_off: "on_off";
356
+ color_hs: "color_hs";
357
+ color_temp: "color_temp";
358
+ effect: "effect";
359
+ thermostat: "thermostat";
360
+ sensor_numeric: "sensor_numeric";
361
+ sensor_binary: "sensor_binary";
362
+ sensor_text: "sensor_text";
363
+ location: "location";
299
364
  }> & z.core.$partial, z.ZodType<JsonObject, unknown, z.core.$ZodTypeInternals<JsonObject, unknown>>>;
300
365
  /** What an entity declares it can do, with the device's own limits for each. */
301
366
  type DeclaredCapabilities = z.output<typeof declaredCapabilitiesSchema>;
@@ -335,9 +400,15 @@ declare const stateReportSchema: z.ZodObject<{
335
400
  color_hs: z.ZodOptional<z.ZodObject<{
336
401
  hue: z.ZodNumber;
337
402
  saturation: z.ZodNumber;
403
+ white: z.ZodOptional<z.ZodNumber>;
404
+ isActive: z.ZodOptional<z.ZodBoolean>;
338
405
  }, z.core.$strip>>;
339
406
  color_temp: z.ZodOptional<z.ZodObject<{
340
407
  mireds: z.ZodInt;
408
+ isActive: z.ZodOptional<z.ZodBoolean>;
409
+ }, z.core.$strip>>;
410
+ effect: z.ZodOptional<z.ZodObject<{
411
+ effect: z.ZodDefault<z.ZodNullable<z.ZodString>>;
341
412
  }, z.core.$strip>>;
342
413
  cover: z.ZodOptional<z.ZodObject<{
343
414
  position: z.ZodNumber;
@@ -354,10 +425,18 @@ declare const stateReportSchema: z.ZodObject<{
354
425
  unlocked: "unlocked";
355
426
  jammed: "jammed";
356
427
  }>;
428
+ motion: z.ZodOptional<z.ZodEnum<{
429
+ opening: "opening";
430
+ locking: "locking";
431
+ unlocking: "unlocking";
432
+ }>>;
433
+ isOpen: z.ZodOptional<z.ZodBoolean>;
357
434
  }, z.core.$strip>>;
358
435
  thermostat: z.ZodOptional<z.ZodObject<{
359
- currentTemperature: z.ZodNumber;
436
+ currentTemperature: z.ZodOptional<z.ZodNumber>;
360
437
  targetTemperature: z.ZodNumber;
438
+ targetTemperatureLow: z.ZodOptional<z.ZodNumber>;
439
+ targetTemperatureHigh: z.ZodOptional<z.ZodNumber>;
361
440
  mode: z.ZodEnum<{
362
441
  off: "off";
363
442
  heat: "heat";
@@ -367,14 +446,21 @@ declare const stateReportSchema: z.ZodObject<{
367
446
  dry: "dry";
368
447
  }>;
369
448
  action: z.ZodEnum<{
449
+ fan: "fan";
370
450
  off: "off";
371
451
  idle: "idle";
372
452
  heating: "heating";
373
453
  cooling: "cooling";
374
454
  drying: "drying";
375
- fan: "fan";
455
+ preheating: "preheating";
456
+ defrosting: "defrosting";
376
457
  }>;
377
458
  humidity: z.ZodOptional<z.ZodNumber>;
459
+ targetHumidity: z.ZodOptional<z.ZodNumber>;
460
+ preset: z.ZodOptional<z.ZodNullable<z.ZodString>>;
461
+ fanMode: z.ZodOptional<z.ZodString>;
462
+ swingMode: z.ZodOptional<z.ZodString>;
463
+ swingHorizontalMode: z.ZodOptional<z.ZodString>;
378
464
  }, z.core.$strip>>;
379
465
  sensor_numeric: z.ZodOptional<z.ZodObject<{
380
466
  value: z.ZodNumber;
@@ -396,8 +482,17 @@ declare const stateReportSchema: z.ZodObject<{
396
482
  volume: z.ZodNumber;
397
483
  isMuted: z.ZodBoolean;
398
484
  source: z.ZodOptional<z.ZodString>;
485
+ soundMode: z.ZodOptional<z.ZodString>;
486
+ isShuffled: z.ZodOptional<z.ZodBoolean>;
487
+ repeat: z.ZodOptional<z.ZodEnum<{
488
+ off: "off";
489
+ all: "all";
490
+ one: "one";
491
+ }>>;
399
492
  mediaTitle: z.ZodOptional<z.ZodString>;
400
493
  mediaArtist: z.ZodOptional<z.ZodString>;
494
+ mediaAlbum: z.ZodOptional<z.ZodString>;
495
+ mediaImagePath: z.ZodOptional<z.ZodString>;
401
496
  mediaDurationSeconds: z.ZodOptional<z.ZodNumber>;
402
497
  mediaPositionSeconds: z.ZodOptional<z.ZodNumber>;
403
498
  }, z.core.$strip>>;
@@ -405,6 +500,7 @@ declare const stateReportSchema: z.ZodObject<{
405
500
  isStreamAvailable: z.ZodBoolean;
406
501
  snapshotPath: z.ZodOptional<z.ZodString>;
407
502
  isRecording: z.ZodDefault<z.ZodBoolean>;
503
+ isMotionDetectionOn: z.ZodOptional<z.ZodBoolean>;
408
504
  }, z.core.$strip>>;
409
505
  button: z.ZodOptional<z.ZodObject<{}, z.core.$strip>>;
410
506
  update: z.ZodOptional<z.ZodObject<{
@@ -412,6 +508,9 @@ declare const stateReportSchema: z.ZodObject<{
412
508
  latestVersion: z.ZodDefault<z.ZodNullable<z.ZodString>>;
413
509
  isInstalling: z.ZodDefault<z.ZodBoolean>;
414
510
  progress: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
511
+ title: z.ZodOptional<z.ZodString>;
512
+ releaseSummary: z.ZodOptional<z.ZodString>;
513
+ releaseUrl: z.ZodOptional<z.ZodURL>;
415
514
  }, z.core.$strip>>;
416
515
  lawn_mower: z.ZodOptional<z.ZodObject<{
417
516
  activity: z.ZodEnum<{
@@ -442,8 +541,36 @@ declare const stateReportSchema: z.ZodObject<{
442
541
  rooms: z.ZodDefault<z.ZodArray<z.ZodObject<{
443
542
  id: z.ZodString;
444
543
  name: z.ZodString;
544
+ outline: z.ZodOptional<z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>>;
445
545
  }, z.core.$strip>>>;
446
546
  isResumable: z.ZodDefault<z.ZodBoolean>;
547
+ fanSpeed: z.ZodOptional<z.ZodString>;
548
+ cleanMode: z.ZodOptional<z.ZodEnum<{
549
+ vacuum: "vacuum";
550
+ mop: "mop";
551
+ vacuum_and_mop: "vacuum_and_mop";
552
+ }>>;
553
+ waterLevel: z.ZodOptional<z.ZodString>;
554
+ }, z.core.$strip>>;
555
+ fan: z.ZodOptional<z.ZodObject<{
556
+ percentage: z.ZodOptional<z.ZodNumber>;
557
+ preset: z.ZodOptional<z.ZodNullable<z.ZodString>>;
558
+ isOscillating: z.ZodOptional<z.ZodBoolean>;
559
+ direction: z.ZodOptional<z.ZodEnum<{
560
+ forward: "forward";
561
+ reverse: "reverse";
562
+ }>>;
563
+ }, z.core.$strip>>;
564
+ location: z.ZodOptional<z.ZodObject<{
565
+ zone: z.ZodDefault<z.ZodNullable<z.ZodString>>;
566
+ latitude: z.ZodOptional<z.ZodNumber>;
567
+ longitude: z.ZodOptional<z.ZodNumber>;
568
+ accuracyMeters: z.ZodOptional<z.ZodNumber>;
569
+ locationName: z.ZodOptional<z.ZodString>;
570
+ distanceKm: z.ZodOptional<z.ZodNumber>;
571
+ ipAddress: z.ZodOptional<z.ZodString>;
572
+ macAddress: z.ZodOptional<z.ZodString>;
573
+ hostName: z.ZodOptional<z.ZodString>;
447
574
  }, z.core.$strip>>;
448
575
  image: z.ZodOptional<z.ZodObject<{
449
576
  contentType: z.ZodEnum<{
@@ -673,6 +800,52 @@ declare const setupFieldSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
673
800
  equals: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodBoolean]>>;
674
801
  }, z.core.$strict>>;
675
802
  isLive: z.ZodOptional<z.ZodBoolean>;
803
+ }, z.core.$strict>, z.ZodObject<{
804
+ type: z.ZodLiteral<"entity">;
805
+ domains: z.ZodOptional<z.ZodArray<z.ZodEnum<{
806
+ number: "number";
807
+ cover: "cover";
808
+ lock: "lock";
809
+ media_player: "media_player";
810
+ camera: "camera";
811
+ button: "button";
812
+ update: "update";
813
+ lawn_mower: "lawn_mower";
814
+ select: "select";
815
+ vacuum: "vacuum";
816
+ fan: "fan";
817
+ image: "image";
818
+ custom: "custom";
819
+ alias: "alias";
820
+ switch: "switch";
821
+ light: "light";
822
+ binary_sensor: "binary_sensor";
823
+ climate: "climate";
824
+ sensor: "sensor";
825
+ device_tracker: "device_tracker";
826
+ geo_location: "geo_location";
827
+ }>>>;
828
+ key: z.ZodString;
829
+ label: z.ZodString;
830
+ help: z.ZodOptional<z.ZodString>;
831
+ isRequired: z.ZodDefault<z.ZodBoolean>;
832
+ shownWhen: z.ZodOptional<z.ZodObject<{
833
+ key: z.ZodString;
834
+ equals: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodBoolean]>>;
835
+ }, z.core.$strict>>;
836
+ isLive: z.ZodOptional<z.ZodBoolean>;
837
+ }, z.core.$strict>, z.ZodObject<{
838
+ type: z.ZodLiteral<"icon">;
839
+ default: z.ZodOptional<z.ZodString>;
840
+ key: z.ZodString;
841
+ label: z.ZodString;
842
+ help: z.ZodOptional<z.ZodString>;
843
+ isRequired: z.ZodDefault<z.ZodBoolean>;
844
+ shownWhen: z.ZodOptional<z.ZodObject<{
845
+ key: z.ZodString;
846
+ equals: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodBoolean]>>;
847
+ }, z.core.$strict>>;
848
+ isLive: z.ZodOptional<z.ZodBoolean>;
676
849
  }, z.core.$strict>], "type">;
677
850
  /** One field of a group. */
678
851
  type SetupField = z.output<typeof setupFieldSchema>;
@@ -1262,7 +1435,8 @@ type Integration<TOptions = JsonObject> = {
1262
1435
  continueCommand?: (target: CommandTarget, step: CommandStep, context: MappingContext) => TransportRequest | null;
1263
1436
  /**
1264
1437
  * Reads what a message says about the device itself, beyond its entities: the firmware it runs
1265
- * now, which changes when it is updated and is otherwise only known from when it was found.
1438
+ * now, which changes when it is updated and is otherwise only known from when it was found;
1439
+ * and how it is set up, when that decides its entities (`descriptor`).
1266
1440
  *
1267
1441
  * Optional: an integration whose messages say nothing of the kind leaves it out.
1268
1442
  *
@@ -1282,6 +1456,56 @@ type Integration<TOptions = JsonObject> = {
1282
1456
  * @returns The stream source and what it is told to read, or undefined for an entity with none.
1283
1457
  */
1284
1458
  streamOf?: (entityId: EntityId, context: MappingContext) => StreamRequest | undefined;
1459
+ /**
1460
+ * What a device can tell of its past numeric readings - prices already published, a meter's
1461
+ * stored records - and how they are asked for. The hub asks once, right after the device is
1462
+ * first added: one request for the last `days`, sent through the transport like a command, and
1463
+ * what comes back goes into the entities' history, never into their state.
1464
+ *
1465
+ * Optional: without it a device's history starts when it is added.
1466
+ */
1467
+ history?: HistoryImport;
1468
+ };
1469
+ /** How a driver imports a device's past readings when it is added. */
1470
+ type HistoryImport = {
1471
+ /**
1472
+ * How far back to ask, in days: at most 28, the time the hub keeps raw readings for, less a
1473
+ * margin.
1474
+ */
1475
+ readonly days: number;
1476
+ /**
1477
+ * The request asking for the past.
1478
+ *
1479
+ * @param range - From when and until when, ISO 8601: until is the moment the device was added.
1480
+ * @param context - The claim, the settings and the entities' ids.
1481
+ * @returns The request, which the transport performs like a command's.
1482
+ */
1483
+ request: (range: HistoryRange, context: MappingContext) => TransportRequest;
1484
+ /**
1485
+ * Reads the past readings an answer holds, entity by entity. Only numeric sensors keep them:
1486
+ * readings for any other entity, at or after the moment the device was added, or older than
1487
+ * `days`, are left out.
1488
+ *
1489
+ * @param answer - What the transport answered.
1490
+ * @param context - The claim, the settings and the entities' ids.
1491
+ * @returns The readings of each entity.
1492
+ */
1493
+ toReadings: (answer: unknown, context: MappingContext) => PastReadings[];
1494
+ };
1495
+ /** A stretch of the past, ISO 8601. */
1496
+ type HistoryRange = {
1497
+ readonly from: string;
1498
+ readonly to: string;
1499
+ };
1500
+ /** Past readings of one entity. */
1501
+ type PastReadings = {
1502
+ readonly entityId: EntityId;
1503
+ readonly readings: readonly PastReading[];
1504
+ };
1505
+ /** One past reading: when it was taken, ISO 8601, and its value. */
1506
+ type PastReading = {
1507
+ readonly at: string;
1508
+ readonly value: number;
1285
1509
  };
1286
1510
  /** How one camera's picture is read: which source, told what. */
1287
1511
  type StreamRequest = {
@@ -1292,6 +1516,17 @@ type StreamRequest = {
1292
1516
  type DeviceInfo = {
1293
1517
  readonly swVersion?: string;
1294
1518
  readonly hwVersion?: string;
1519
+ /**
1520
+ * What the device is now, for a device whose entities depend on how it is set up - a Bot in
1521
+ * switch or in press mode: the claim's own descriptor while it is still that, a new one to
1522
+ * describe it from once it changed. Left out when the message does not say.
1523
+ *
1524
+ * A new one is taken when the device still says it thirty seconds later - a message saying
1525
+ * the claim's own again drops it. The device is then described again: an entity
1526
+ * described both times stays, with its history; one no longer described is removed, with its
1527
+ * history; one described only now is added.
1528
+ */
1529
+ readonly descriptor?: unknown;
1295
1530
  };
1296
1531
  //#endregion
1297
1532
  //#region ../package-runtime/dist/stream.d.ts
@@ -2027,4 +2262,4 @@ export declare function defineAccountModule(factory: AccountFactory): AccountFac
2027
2262
  */
2028
2263
  export declare function defineStreamModule(factory: StreamFactory): StreamFactory;
2029
2264
  //#endregion
2030
- export type { AccountFactory, AccountHandle, AccountIdentity, AccountModule, AccountModuleStep, AccountStepContext, BluetoothAdvert, BluetoothAdvertInput, BluetoothProxyFilterArgs, BluetoothProxyInstallArgs, BluetoothProxyProfile, BluetoothProxyState, BluetoothScanMode, BluetoothScanner, BluetoothScannerOptions, BluetoothSighting, BundleBluetooth, BundleCodecs, BundleImages, BundleLogFn, BundleLogger, BundleSdk, Claim, CommandStep, CommandTarget, DeviceDescriptor, DeviceInfo, Discovered, DiscoveryListenContext, DiscoverySource, DiscoverySourceFactory, EntityDescriptor, FlipperIrCode, FlipperIrFile, ImageBlob, InfraredCode, InfraredCodec, InfraredImportProblem, InfraredLearnArgs, InfraredProfile, InfraredProtocol, InfraredProtocolName, InfraredSendArgs, InfraredSignal, InfraredSweepArgs, InfraredSweepResult, Integration, IntegrationFactory, ListenerStatus, ManagedMqtt, ManagedMqttOptions, ManagedSocket, ManagedSocketClose, ManagedSocketHeaders, ManagedSocketOptions, ManagedUdpSocket, ManagedUdpSocketOptions, MappingContext, MdnsAnnouncement, OpenMqtt, OpenRtsp, OpenSerial, OpenUdpSocket, OpenWebSocket, PaletteColour, PalettedPicture, PassedOverSighting, PlatformMqtt, PlatformServices, ReportedState, RtspFrame, RtspOptions, SerialDeviceConfig, SerialLine, SerialLineInput, SerialSession, SerialSighting, Sighting, StreamFactory, StreamFrame, StreamRequest, StreamSink, StreamSource, StreamSourceSpec, StreamTrack, Transport, TransportConnection, TransportContext, TransportFactory, TransportInbound, TransportLookContext, TransportRequest, TransportSpec, TransportStatus, TransportSubscription, UdpPeer };
2265
+ export type { AccountFactory, AccountHandle, AccountIdentity, AccountModule, AccountModuleStep, AccountStepContext, BluetoothAdvert, BluetoothAdvertInput, BluetoothProxyFilterArgs, BluetoothProxyInstallArgs, BluetoothProxyProfile, BluetoothProxyState, BluetoothScanMode, BluetoothScanner, BluetoothScannerOptions, BluetoothSighting, BundleBluetooth, BundleCodecs, BundleImages, BundleLogFn, BundleLogger, BundleSdk, Claim, CommandStep, CommandTarget, DeviceDescriptor, DeviceInfo, Discovered, DiscoveryListenContext, DiscoverySource, DiscoverySourceFactory, EntityDescriptor, FlipperIrCode, FlipperIrFile, HistoryImport, HistoryRange, ImageBlob, InfraredCode, InfraredCodec, InfraredImportProblem, InfraredLearnArgs, InfraredProfile, InfraredProtocol, InfraredProtocolName, InfraredSendArgs, InfraredSignal, InfraredSweepArgs, InfraredSweepResult, Integration, IntegrationFactory, ListenerStatus, ManagedMqtt, ManagedMqttOptions, ManagedSocket, ManagedSocketClose, ManagedSocketHeaders, ManagedSocketOptions, ManagedUdpSocket, ManagedUdpSocketOptions, MappingContext, MdnsAnnouncement, OpenMqtt, OpenRtsp, OpenSerial, OpenUdpSocket, OpenWebSocket, PaletteColour, PalettedPicture, PassedOverSighting, PastReading, PastReadings, PlatformMqtt, PlatformServices, ReportedState, RtspFrame, RtspOptions, SerialDeviceConfig, SerialLine, SerialLineInput, SerialSession, SerialSighting, Sighting, StreamFactory, StreamFrame, StreamRequest, StreamSink, StreamSource, StreamSourceSpec, StreamTrack, Transport, TransportConnection, TransportContext, TransportFactory, TransportInbound, TransportLookContext, TransportRequest, TransportSpec, TransportStatus, TransportSubscription, UdpPeer };