@nebulahome/integration-sdk 1.9.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.
@@ -1,7 +1,21 @@
1
1
  import { z } from "zod";
2
+ //#region ../contracts/dist/json.d.ts
3
+ /**
4
+ * A JSON object, the shape most `jsonb` columns actually hold.
5
+ *
6
+ * Written as an index signature rather than `Record<string, JsonValue>` because `Record` is a
7
+ * mapped type, which TypeScript resolves eagerly and therefore cannot use in the recursive
8
+ * definition below (TS2456). The index signature is deferred, so it can.
9
+ */
10
+ type JsonObject = {
11
+ [key: string]: JsonValue;
12
+ };
13
+ /** Any value that survives a JSON round trip unchanged. */
14
+ type JsonValue = string | number | boolean | null | JsonValue[] | JsonObject;
15
+ //#endregion
2
16
  //#region ../contracts/dist/capabilities.d.ts
3
17
  /** Every capability an entity may declare. */
4
- 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"];
18
+ 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"];
5
19
  /** The name of a single capability. */
6
20
  type CapabilityName = (typeof CAPABILITIES)[number];
7
21
  /**
@@ -21,9 +35,15 @@ declare const capabilityStateSchema: z.ZodObject<{
21
35
  color_hs: z.ZodOptional<z.ZodObject<{
22
36
  hue: z.ZodNumber;
23
37
  saturation: z.ZodNumber;
38
+ white: z.ZodOptional<z.ZodNumber>;
39
+ isActive: z.ZodOptional<z.ZodBoolean>;
24
40
  }, z.core.$strip>>;
25
41
  color_temp: z.ZodOptional<z.ZodObject<{
26
42
  mireds: z.ZodInt;
43
+ isActive: z.ZodOptional<z.ZodBoolean>;
44
+ }, z.core.$strip>>;
45
+ effect: z.ZodOptional<z.ZodObject<{
46
+ effect: z.ZodDefault<z.ZodNullable<z.ZodString>>;
27
47
  }, z.core.$strip>>;
28
48
  cover: z.ZodOptional<z.ZodObject<{
29
49
  position: z.ZodNumber;
@@ -40,10 +60,18 @@ declare const capabilityStateSchema: z.ZodObject<{
40
60
  unlocked: "unlocked";
41
61
  jammed: "jammed";
42
62
  }>;
63
+ motion: z.ZodOptional<z.ZodEnum<{
64
+ opening: "opening";
65
+ locking: "locking";
66
+ unlocking: "unlocking";
67
+ }>>;
68
+ isOpen: z.ZodOptional<z.ZodBoolean>;
43
69
  }, z.core.$strip>>;
44
70
  thermostat: z.ZodOptional<z.ZodObject<{
45
- currentTemperature: z.ZodNumber;
71
+ currentTemperature: z.ZodOptional<z.ZodNumber>;
46
72
  targetTemperature: z.ZodNumber;
73
+ targetTemperatureLow: z.ZodOptional<z.ZodNumber>;
74
+ targetTemperatureHigh: z.ZodOptional<z.ZodNumber>;
47
75
  mode: z.ZodEnum<{
48
76
  off: "off";
49
77
  heat: "heat";
@@ -53,14 +81,21 @@ declare const capabilityStateSchema: z.ZodObject<{
53
81
  dry: "dry";
54
82
  }>;
55
83
  action: z.ZodEnum<{
84
+ fan: "fan";
56
85
  off: "off";
57
86
  idle: "idle";
58
87
  heating: "heating";
59
88
  cooling: "cooling";
60
89
  drying: "drying";
61
- fan: "fan";
90
+ preheating: "preheating";
91
+ defrosting: "defrosting";
62
92
  }>;
63
93
  humidity: z.ZodOptional<z.ZodNumber>;
94
+ targetHumidity: z.ZodOptional<z.ZodNumber>;
95
+ preset: z.ZodOptional<z.ZodNullable<z.ZodString>>;
96
+ fanMode: z.ZodOptional<z.ZodString>;
97
+ swingMode: z.ZodOptional<z.ZodString>;
98
+ swingHorizontalMode: z.ZodOptional<z.ZodString>;
64
99
  }, z.core.$strip>>;
65
100
  sensor_numeric: z.ZodOptional<z.ZodObject<{
66
101
  value: z.ZodNumber;
@@ -82,8 +117,17 @@ declare const capabilityStateSchema: z.ZodObject<{
82
117
  volume: z.ZodNumber;
83
118
  isMuted: z.ZodBoolean;
84
119
  source: z.ZodOptional<z.ZodString>;
120
+ soundMode: z.ZodOptional<z.ZodString>;
121
+ isShuffled: z.ZodOptional<z.ZodBoolean>;
122
+ repeat: z.ZodOptional<z.ZodEnum<{
123
+ off: "off";
124
+ all: "all";
125
+ one: "one";
126
+ }>>;
85
127
  mediaTitle: z.ZodOptional<z.ZodString>;
86
128
  mediaArtist: z.ZodOptional<z.ZodString>;
129
+ mediaAlbum: z.ZodOptional<z.ZodString>;
130
+ mediaImagePath: z.ZodOptional<z.ZodString>;
87
131
  mediaDurationSeconds: z.ZodOptional<z.ZodNumber>;
88
132
  mediaPositionSeconds: z.ZodOptional<z.ZodNumber>;
89
133
  }, z.core.$strip>>;
@@ -91,6 +135,7 @@ declare const capabilityStateSchema: z.ZodObject<{
91
135
  isStreamAvailable: z.ZodBoolean;
92
136
  snapshotPath: z.ZodOptional<z.ZodString>;
93
137
  isRecording: z.ZodDefault<z.ZodBoolean>;
138
+ isMotionDetectionOn: z.ZodOptional<z.ZodBoolean>;
94
139
  }, z.core.$strip>>;
95
140
  button: z.ZodOptional<z.ZodObject<{}, z.core.$strip>>;
96
141
  update: z.ZodOptional<z.ZodObject<{
@@ -98,6 +143,9 @@ declare const capabilityStateSchema: z.ZodObject<{
98
143
  latestVersion: z.ZodDefault<z.ZodNullable<z.ZodString>>;
99
144
  isInstalling: z.ZodDefault<z.ZodBoolean>;
100
145
  progress: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
146
+ title: z.ZodOptional<z.ZodString>;
147
+ releaseSummary: z.ZodOptional<z.ZodString>;
148
+ releaseUrl: z.ZodOptional<z.ZodURL>;
101
149
  }, z.core.$strip>>;
102
150
  lawn_mower: z.ZodOptional<z.ZodObject<{
103
151
  activity: z.ZodEnum<{
@@ -128,8 +176,36 @@ declare const capabilityStateSchema: z.ZodObject<{
128
176
  rooms: z.ZodDefault<z.ZodArray<z.ZodObject<{
129
177
  id: z.ZodString;
130
178
  name: z.ZodString;
179
+ outline: z.ZodOptional<z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>>;
131
180
  }, z.core.$strip>>>;
132
181
  isResumable: z.ZodDefault<z.ZodBoolean>;
182
+ fanSpeed: z.ZodOptional<z.ZodString>;
183
+ cleanMode: z.ZodOptional<z.ZodEnum<{
184
+ vacuum: "vacuum";
185
+ mop: "mop";
186
+ vacuum_and_mop: "vacuum_and_mop";
187
+ }>>;
188
+ waterLevel: z.ZodOptional<z.ZodString>;
189
+ }, z.core.$strip>>;
190
+ fan: z.ZodOptional<z.ZodObject<{
191
+ percentage: z.ZodOptional<z.ZodNumber>;
192
+ preset: z.ZodOptional<z.ZodNullable<z.ZodString>>;
193
+ isOscillating: z.ZodOptional<z.ZodBoolean>;
194
+ direction: z.ZodOptional<z.ZodEnum<{
195
+ forward: "forward";
196
+ reverse: "reverse";
197
+ }>>;
198
+ }, z.core.$strip>>;
199
+ location: z.ZodOptional<z.ZodObject<{
200
+ zone: z.ZodDefault<z.ZodNullable<z.ZodString>>;
201
+ latitude: z.ZodOptional<z.ZodNumber>;
202
+ longitude: z.ZodOptional<z.ZodNumber>;
203
+ accuracyMeters: z.ZodOptional<z.ZodNumber>;
204
+ locationName: z.ZodOptional<z.ZodString>;
205
+ distanceKm: z.ZodOptional<z.ZodNumber>;
206
+ ipAddress: z.ZodOptional<z.ZodString>;
207
+ macAddress: z.ZodOptional<z.ZodString>;
208
+ hostName: z.ZodOptional<z.ZodString>;
133
209
  }, z.core.$strip>>;
134
210
  image: z.ZodOptional<z.ZodObject<{
135
211
  contentType: z.ZodEnum<{
@@ -148,19 +224,21 @@ declare const capabilityStateSchema: z.ZodObject<{
148
224
  /** The composite state of an entity, keyed by capability. */
149
225
  type CapabilityState = z.output<typeof capabilityStateSchema>;
150
226
  //#endregion
151
- //#region ../contracts/dist/json.d.ts
227
+ //#region ../contracts/dist/entity-id.d.ts
228
+ /** The kinds of thing an entity can be. The domain is the part before the dot. */
229
+ 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"];
230
+ /** The kind of thing an entity is. */
231
+ type EntityDomain = (typeof ENTITY_DOMAINS)[number];
152
232
  /**
153
- * A JSON object, the shape most `jsonb` columns actually hold.
233
+ * Validates an entity identifier and brands the result.
154
234
  *
155
- * Written as an index signature rather than `Record<string, JsonValue>` because `Record` is a
156
- * mapped type, which TypeScript resolves eagerly and therefore cannot use in the recursive
157
- * definition below (TS2456). The index signature is deferred, so it can.
235
+ * The brand means an `EntityId` cannot be produced from a bare string without going through
236
+ * validation. Identifiers reach the database as primary lookups and NATS as subject tokens, so
237
+ * an unvalidated one does not fail where it was created - it fails somewhere else, later.
158
238
  */
159
- type JsonObject = {
160
- [key: string]: JsonValue;
161
- };
162
- /** Any value that survives a JSON round trip unchanged. */
163
- type JsonValue = string | number | boolean | null | JsonValue[] | JsonObject;
239
+ declare const entityIdSchema: z.core.$ZodBranded<z.ZodString, "EntityId", "out">;
240
+ /** A validated `<domain>.<object_id>` identifier. */
241
+ type EntityId = z.output<typeof entityIdSchema>;
164
242
  //#endregion
165
243
  //#region ../contracts/dist/bluetooth.d.ts
166
244
  /**
@@ -189,29 +267,13 @@ type BluetoothAdvert = z.output<typeof bluetoothAdvertSchema>;
189
267
  */
190
268
  declare const bluetoothProxyProfileSchema: z.ZodObject<{
191
269
  modes: z.ZodArray<z.ZodEnum<{
192
- passive: "passive";
193
270
  active: "active";
271
+ passive: "passive";
194
272
  }>>;
195
273
  }, z.core.$strict>;
196
274
  /** What a device that can be a proxy declares. */
197
275
  type BluetoothProxyProfile = z.output<typeof bluetoothProxyProfileSchema>;
198
276
  //#endregion
199
- //#region ../contracts/dist/entity-id.d.ts
200
- /** The kinds of thing an entity can be. The domain is the part before the dot. */
201
- 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"];
202
- /** The kind of thing an entity is. */
203
- type EntityDomain = (typeof ENTITY_DOMAINS)[number];
204
- /**
205
- * Validates an entity identifier and brands the result.
206
- *
207
- * The brand means an `EntityId` cannot be produced from a bare string without going through
208
- * validation. Identifiers reach the database as primary lookups and NATS as subject tokens, so
209
- * an unvalidated one does not fail where it was created - it fails somewhere else, later.
210
- */
211
- declare const entityIdSchema: z.core.$ZodBranded<z.ZodString, "EntityId", "out">;
212
- /** A validated `<domain>.<object_id>` identifier. */
213
- type EntityId = z.output<typeof entityIdSchema>;
214
- //#endregion
215
277
  //#region ../contracts/dist/registration.d.ts
216
278
  /**
217
279
  * How history should aggregate a numeric entity.
@@ -234,16 +296,8 @@ type EntityStateClass = (typeof ENTITY_STATE_CLASSES)[number];
234
296
  declare const declaredCapabilitiesSchema: z.ZodRecord<z.ZodEnum<{
235
297
  number: "number";
236
298
  custom: "custom";
237
- on_off: "on_off";
238
- level: "level";
239
- color_hs: "color_hs";
240
- color_temp: "color_temp";
241
299
  cover: "cover";
242
300
  lock: "lock";
243
- thermostat: "thermostat";
244
- sensor_numeric: "sensor_numeric";
245
- sensor_binary: "sensor_binary";
246
- sensor_text: "sensor_text";
247
301
  media_player: "media_player";
248
302
  camera: "camera";
249
303
  button: "button";
@@ -251,7 +305,18 @@ declare const declaredCapabilitiesSchema: z.ZodRecord<z.ZodEnum<{
251
305
  lawn_mower: "lawn_mower";
252
306
  select: "select";
253
307
  vacuum: "vacuum";
308
+ fan: "fan";
254
309
  image: "image";
310
+ level: "level";
311
+ on_off: "on_off";
312
+ color_hs: "color_hs";
313
+ color_temp: "color_temp";
314
+ effect: "effect";
315
+ thermostat: "thermostat";
316
+ sensor_numeric: "sensor_numeric";
317
+ sensor_binary: "sensor_binary";
318
+ sensor_text: "sensor_text";
319
+ location: "location";
255
320
  }> & z.core.$partial, z.ZodType<JsonObject, unknown, z.core.$ZodTypeInternals<JsonObject, unknown>>>;
256
321
  /** What an entity declares it can do, with the device's own limits for each. */
257
322
  type DeclaredCapabilities = z.output<typeof declaredCapabilitiesSchema>;
@@ -291,9 +356,15 @@ declare const stateReportSchema: z.ZodObject<{
291
356
  color_hs: z.ZodOptional<z.ZodObject<{
292
357
  hue: z.ZodNumber;
293
358
  saturation: z.ZodNumber;
359
+ white: z.ZodOptional<z.ZodNumber>;
360
+ isActive: z.ZodOptional<z.ZodBoolean>;
294
361
  }, z.core.$strip>>;
295
362
  color_temp: z.ZodOptional<z.ZodObject<{
296
363
  mireds: z.ZodInt;
364
+ isActive: z.ZodOptional<z.ZodBoolean>;
365
+ }, z.core.$strip>>;
366
+ effect: z.ZodOptional<z.ZodObject<{
367
+ effect: z.ZodDefault<z.ZodNullable<z.ZodString>>;
297
368
  }, z.core.$strip>>;
298
369
  cover: z.ZodOptional<z.ZodObject<{
299
370
  position: z.ZodNumber;
@@ -310,10 +381,18 @@ declare const stateReportSchema: z.ZodObject<{
310
381
  unlocked: "unlocked";
311
382
  jammed: "jammed";
312
383
  }>;
384
+ motion: z.ZodOptional<z.ZodEnum<{
385
+ opening: "opening";
386
+ locking: "locking";
387
+ unlocking: "unlocking";
388
+ }>>;
389
+ isOpen: z.ZodOptional<z.ZodBoolean>;
313
390
  }, z.core.$strip>>;
314
391
  thermostat: z.ZodOptional<z.ZodObject<{
315
- currentTemperature: z.ZodNumber;
392
+ currentTemperature: z.ZodOptional<z.ZodNumber>;
316
393
  targetTemperature: z.ZodNumber;
394
+ targetTemperatureLow: z.ZodOptional<z.ZodNumber>;
395
+ targetTemperatureHigh: z.ZodOptional<z.ZodNumber>;
317
396
  mode: z.ZodEnum<{
318
397
  off: "off";
319
398
  heat: "heat";
@@ -323,14 +402,21 @@ declare const stateReportSchema: z.ZodObject<{
323
402
  dry: "dry";
324
403
  }>;
325
404
  action: z.ZodEnum<{
405
+ fan: "fan";
326
406
  off: "off";
327
407
  idle: "idle";
328
408
  heating: "heating";
329
409
  cooling: "cooling";
330
410
  drying: "drying";
331
- fan: "fan";
411
+ preheating: "preheating";
412
+ defrosting: "defrosting";
332
413
  }>;
333
414
  humidity: z.ZodOptional<z.ZodNumber>;
415
+ targetHumidity: z.ZodOptional<z.ZodNumber>;
416
+ preset: z.ZodOptional<z.ZodNullable<z.ZodString>>;
417
+ fanMode: z.ZodOptional<z.ZodString>;
418
+ swingMode: z.ZodOptional<z.ZodString>;
419
+ swingHorizontalMode: z.ZodOptional<z.ZodString>;
334
420
  }, z.core.$strip>>;
335
421
  sensor_numeric: z.ZodOptional<z.ZodObject<{
336
422
  value: z.ZodNumber;
@@ -352,8 +438,17 @@ declare const stateReportSchema: z.ZodObject<{
352
438
  volume: z.ZodNumber;
353
439
  isMuted: z.ZodBoolean;
354
440
  source: z.ZodOptional<z.ZodString>;
441
+ soundMode: z.ZodOptional<z.ZodString>;
442
+ isShuffled: z.ZodOptional<z.ZodBoolean>;
443
+ repeat: z.ZodOptional<z.ZodEnum<{
444
+ off: "off";
445
+ all: "all";
446
+ one: "one";
447
+ }>>;
355
448
  mediaTitle: z.ZodOptional<z.ZodString>;
356
449
  mediaArtist: z.ZodOptional<z.ZodString>;
450
+ mediaAlbum: z.ZodOptional<z.ZodString>;
451
+ mediaImagePath: z.ZodOptional<z.ZodString>;
357
452
  mediaDurationSeconds: z.ZodOptional<z.ZodNumber>;
358
453
  mediaPositionSeconds: z.ZodOptional<z.ZodNumber>;
359
454
  }, z.core.$strip>>;
@@ -361,6 +456,7 @@ declare const stateReportSchema: z.ZodObject<{
361
456
  isStreamAvailable: z.ZodBoolean;
362
457
  snapshotPath: z.ZodOptional<z.ZodString>;
363
458
  isRecording: z.ZodDefault<z.ZodBoolean>;
459
+ isMotionDetectionOn: z.ZodOptional<z.ZodBoolean>;
364
460
  }, z.core.$strip>>;
365
461
  button: z.ZodOptional<z.ZodObject<{}, z.core.$strip>>;
366
462
  update: z.ZodOptional<z.ZodObject<{
@@ -368,6 +464,9 @@ declare const stateReportSchema: z.ZodObject<{
368
464
  latestVersion: z.ZodDefault<z.ZodNullable<z.ZodString>>;
369
465
  isInstalling: z.ZodDefault<z.ZodBoolean>;
370
466
  progress: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
467
+ title: z.ZodOptional<z.ZodString>;
468
+ releaseSummary: z.ZodOptional<z.ZodString>;
469
+ releaseUrl: z.ZodOptional<z.ZodURL>;
371
470
  }, z.core.$strip>>;
372
471
  lawn_mower: z.ZodOptional<z.ZodObject<{
373
472
  activity: z.ZodEnum<{
@@ -398,8 +497,36 @@ declare const stateReportSchema: z.ZodObject<{
398
497
  rooms: z.ZodDefault<z.ZodArray<z.ZodObject<{
399
498
  id: z.ZodString;
400
499
  name: z.ZodString;
500
+ outline: z.ZodOptional<z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>>;
401
501
  }, z.core.$strip>>>;
402
502
  isResumable: z.ZodDefault<z.ZodBoolean>;
503
+ fanSpeed: z.ZodOptional<z.ZodString>;
504
+ cleanMode: z.ZodOptional<z.ZodEnum<{
505
+ vacuum: "vacuum";
506
+ mop: "mop";
507
+ vacuum_and_mop: "vacuum_and_mop";
508
+ }>>;
509
+ waterLevel: z.ZodOptional<z.ZodString>;
510
+ }, z.core.$strip>>;
511
+ fan: z.ZodOptional<z.ZodObject<{
512
+ percentage: z.ZodOptional<z.ZodNumber>;
513
+ preset: z.ZodOptional<z.ZodNullable<z.ZodString>>;
514
+ isOscillating: z.ZodOptional<z.ZodBoolean>;
515
+ direction: z.ZodOptional<z.ZodEnum<{
516
+ forward: "forward";
517
+ reverse: "reverse";
518
+ }>>;
519
+ }, z.core.$strip>>;
520
+ location: z.ZodOptional<z.ZodObject<{
521
+ zone: z.ZodDefault<z.ZodNullable<z.ZodString>>;
522
+ latitude: z.ZodOptional<z.ZodNumber>;
523
+ longitude: z.ZodOptional<z.ZodNumber>;
524
+ accuracyMeters: z.ZodOptional<z.ZodNumber>;
525
+ locationName: z.ZodOptional<z.ZodString>;
526
+ distanceKm: z.ZodOptional<z.ZodNumber>;
527
+ ipAddress: z.ZodOptional<z.ZodString>;
528
+ macAddress: z.ZodOptional<z.ZodString>;
529
+ hostName: z.ZodOptional<z.ZodString>;
403
530
  }, z.core.$strip>>;
404
531
  image: z.ZodOptional<z.ZodObject<{
405
532
  contentType: z.ZodEnum<{
@@ -572,6 +699,52 @@ declare const setupFieldSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
572
699
  equals: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodBoolean]>>;
573
700
  }, z.core.$strict>>;
574
701
  isLive: z.ZodOptional<z.ZodBoolean>;
702
+ }, z.core.$strict>, z.ZodObject<{
703
+ type: z.ZodLiteral<"entity">;
704
+ domains: z.ZodOptional<z.ZodArray<z.ZodEnum<{
705
+ number: "number";
706
+ cover: "cover";
707
+ lock: "lock";
708
+ media_player: "media_player";
709
+ camera: "camera";
710
+ button: "button";
711
+ update: "update";
712
+ lawn_mower: "lawn_mower";
713
+ select: "select";
714
+ vacuum: "vacuum";
715
+ fan: "fan";
716
+ image: "image";
717
+ custom: "custom";
718
+ alias: "alias";
719
+ switch: "switch";
720
+ light: "light";
721
+ binary_sensor: "binary_sensor";
722
+ climate: "climate";
723
+ sensor: "sensor";
724
+ device_tracker: "device_tracker";
725
+ geo_location: "geo_location";
726
+ }>>>;
727
+ key: z.ZodString;
728
+ label: z.ZodString;
729
+ help: z.ZodOptional<z.ZodString>;
730
+ isRequired: z.ZodDefault<z.ZodBoolean>;
731
+ shownWhen: z.ZodOptional<z.ZodObject<{
732
+ key: z.ZodString;
733
+ equals: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodBoolean]>>;
734
+ }, z.core.$strict>>;
735
+ isLive: z.ZodOptional<z.ZodBoolean>;
736
+ }, z.core.$strict>, z.ZodObject<{
737
+ type: z.ZodLiteral<"icon">;
738
+ default: z.ZodOptional<z.ZodString>;
739
+ key: z.ZodString;
740
+ label: z.ZodString;
741
+ help: z.ZodOptional<z.ZodString>;
742
+ isRequired: z.ZodDefault<z.ZodBoolean>;
743
+ shownWhen: z.ZodOptional<z.ZodObject<{
744
+ key: z.ZodString;
745
+ equals: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodBoolean]>>;
746
+ }, z.core.$strict>>;
747
+ isLive: z.ZodOptional<z.ZodBoolean>;
575
748
  }, z.core.$strict>], "type">;
576
749
  /** One field of a group. */
577
750
  type SetupField = z.output<typeof setupFieldSchema>;
@@ -673,6 +846,52 @@ declare const integrationSetupSchema: z.ZodObject<{
673
846
  equals: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodBoolean]>>;
674
847
  }, z.core.$strict>>;
675
848
  isLive: z.ZodOptional<z.ZodBoolean>;
849
+ }, z.core.$strict>, z.ZodObject<{
850
+ type: z.ZodLiteral<"entity">;
851
+ domains: z.ZodOptional<z.ZodArray<z.ZodEnum<{
852
+ number: "number";
853
+ cover: "cover";
854
+ lock: "lock";
855
+ media_player: "media_player";
856
+ camera: "camera";
857
+ button: "button";
858
+ update: "update";
859
+ lawn_mower: "lawn_mower";
860
+ select: "select";
861
+ vacuum: "vacuum";
862
+ fan: "fan";
863
+ image: "image";
864
+ custom: "custom";
865
+ alias: "alias";
866
+ switch: "switch";
867
+ light: "light";
868
+ binary_sensor: "binary_sensor";
869
+ climate: "climate";
870
+ sensor: "sensor";
871
+ device_tracker: "device_tracker";
872
+ geo_location: "geo_location";
873
+ }>>>;
874
+ key: z.ZodString;
875
+ label: z.ZodString;
876
+ help: z.ZodOptional<z.ZodString>;
877
+ isRequired: z.ZodDefault<z.ZodBoolean>;
878
+ shownWhen: z.ZodOptional<z.ZodObject<{
879
+ key: z.ZodString;
880
+ equals: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodBoolean]>>;
881
+ }, z.core.$strict>>;
882
+ isLive: z.ZodOptional<z.ZodBoolean>;
883
+ }, z.core.$strict>, z.ZodObject<{
884
+ type: z.ZodLiteral<"icon">;
885
+ default: z.ZodOptional<z.ZodString>;
886
+ key: z.ZodString;
887
+ label: z.ZodString;
888
+ help: z.ZodOptional<z.ZodString>;
889
+ isRequired: z.ZodDefault<z.ZodBoolean>;
890
+ shownWhen: z.ZodOptional<z.ZodObject<{
891
+ key: z.ZodString;
892
+ equals: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodBoolean]>>;
893
+ }, z.core.$strict>>;
894
+ isLive: z.ZodOptional<z.ZodBoolean>;
676
895
  }, z.core.$strict>], "type">>>;
677
896
  }, z.core.$strict>;
678
897
  options: z.ZodDefault<z.ZodObject<{
@@ -771,6 +990,52 @@ declare const integrationSetupSchema: z.ZodObject<{
771
990
  equals: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodBoolean]>>;
772
991
  }, z.core.$strict>>;
773
992
  isLive: z.ZodOptional<z.ZodBoolean>;
993
+ }, z.core.$strict>, z.ZodObject<{
994
+ type: z.ZodLiteral<"entity">;
995
+ domains: z.ZodOptional<z.ZodArray<z.ZodEnum<{
996
+ number: "number";
997
+ cover: "cover";
998
+ lock: "lock";
999
+ media_player: "media_player";
1000
+ camera: "camera";
1001
+ button: "button";
1002
+ update: "update";
1003
+ lawn_mower: "lawn_mower";
1004
+ select: "select";
1005
+ vacuum: "vacuum";
1006
+ fan: "fan";
1007
+ image: "image";
1008
+ custom: "custom";
1009
+ alias: "alias";
1010
+ switch: "switch";
1011
+ light: "light";
1012
+ binary_sensor: "binary_sensor";
1013
+ climate: "climate";
1014
+ sensor: "sensor";
1015
+ device_tracker: "device_tracker";
1016
+ geo_location: "geo_location";
1017
+ }>>>;
1018
+ key: z.ZodString;
1019
+ label: z.ZodString;
1020
+ help: z.ZodOptional<z.ZodString>;
1021
+ isRequired: z.ZodDefault<z.ZodBoolean>;
1022
+ shownWhen: z.ZodOptional<z.ZodObject<{
1023
+ key: z.ZodString;
1024
+ equals: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodBoolean]>>;
1025
+ }, z.core.$strict>>;
1026
+ isLive: z.ZodOptional<z.ZodBoolean>;
1027
+ }, z.core.$strict>, z.ZodObject<{
1028
+ type: z.ZodLiteral<"icon">;
1029
+ default: z.ZodOptional<z.ZodString>;
1030
+ key: z.ZodString;
1031
+ label: z.ZodString;
1032
+ help: z.ZodOptional<z.ZodString>;
1033
+ isRequired: z.ZodDefault<z.ZodBoolean>;
1034
+ shownWhen: z.ZodOptional<z.ZodObject<{
1035
+ key: z.ZodString;
1036
+ equals: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodBoolean]>>;
1037
+ }, z.core.$strict>>;
1038
+ isLive: z.ZodOptional<z.ZodBoolean>;
774
1039
  }, z.core.$strict>], "type">>>;
775
1040
  }, z.core.$strict>>;
776
1041
  polling: z.ZodOptional<z.ZodObject<{
@@ -834,8 +1099,8 @@ declare const modbusTemplateSchema: z.ZodObject<{
834
1099
  port: z.ZodDefault<z.ZodInt>;
835
1100
  unitId: z.ZodDefault<z.ZodInt>;
836
1101
  wordOrder: z.ZodDefault<z.ZodEnum<{
837
- high: "high";
838
1102
  low: "low";
1103
+ high: "high";
839
1104
  }>>;
840
1105
  pollSeconds: z.ZodDefault<z.ZodInt>;
841
1106
  entities: z.ZodArray<z.ZodObject<{
@@ -844,22 +1109,22 @@ declare const modbusTemplateSchema: z.ZodObject<{
844
1109
  icon: z.ZodOptional<z.ZodString>;
845
1110
  domain: z.ZodEnum<{
846
1111
  number: "number";
847
- button: "button";
848
- select: "select";
849
- switch: "switch";
850
1112
  light: "light";
851
- binary_sensor: "binary_sensor";
1113
+ switch: "switch";
852
1114
  sensor: "sensor";
1115
+ binary_sensor: "binary_sensor";
1116
+ button: "button";
1117
+ select: "select";
853
1118
  }>;
854
1119
  capabilities: z.ZodRecord<z.ZodEnum<{
855
1120
  number: "number";
1121
+ button: "button";
1122
+ select: "select";
856
1123
  level: "level";
857
1124
  on_off: "on_off";
858
1125
  sensor_numeric: "sensor_numeric";
859
1126
  sensor_binary: "sensor_binary";
860
1127
  sensor_text: "sensor_text";
861
- button: "button";
862
- select: "select";
863
1128
  }> & z.core.$partial, z.ZodObject<{
864
1129
  read: z.ZodOptional<z.ZodObject<{
865
1130
  function: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>, z.ZodLiteral<4>]>;
@@ -1413,6 +1678,56 @@ type Integration<TOptions = JsonObject> = {
1413
1678
  * @returns The stream source and what it is told to read, or undefined for an entity with none.
1414
1679
  */
1415
1680
  streamOf?: (entityId: EntityId, context: MappingContext) => StreamRequest | undefined;
1681
+ /**
1682
+ * What a device can tell of its past numeric readings - prices already published, a meter's
1683
+ * stored records - and how they are asked for. The hub asks once, right after the device is
1684
+ * first added: one request for the last `days`, sent through the transport like a command, and
1685
+ * what comes back goes into the entities' history, never into their state.
1686
+ *
1687
+ * Optional: without it a device's history starts when it is added.
1688
+ */
1689
+ history?: HistoryImport;
1690
+ };
1691
+ /** How a driver imports a device's past readings when it is added. */
1692
+ type HistoryImport = {
1693
+ /**
1694
+ * How far back to ask, in days: at most 28, the time the hub keeps raw readings for, less a
1695
+ * margin.
1696
+ */
1697
+ readonly days: number;
1698
+ /**
1699
+ * The request asking for the past.
1700
+ *
1701
+ * @param range - From when and until when, ISO 8601: until is the moment the device was added.
1702
+ * @param context - The claim, the settings and the entities' ids.
1703
+ * @returns The request, which the transport performs like a command's.
1704
+ */
1705
+ request: (range: HistoryRange, context: MappingContext) => TransportRequest;
1706
+ /**
1707
+ * Reads the past readings an answer holds, entity by entity. Only numeric sensors keep them:
1708
+ * readings for any other entity, at or after the moment the device was added, or older than
1709
+ * `days`, are left out.
1710
+ *
1711
+ * @param answer - What the transport answered.
1712
+ * @param context - The claim, the settings and the entities' ids.
1713
+ * @returns The readings of each entity.
1714
+ */
1715
+ toReadings: (answer: unknown, context: MappingContext) => PastReadings[];
1716
+ };
1717
+ /** A stretch of the past, ISO 8601. */
1718
+ type HistoryRange = {
1719
+ readonly from: string;
1720
+ readonly to: string;
1721
+ };
1722
+ /** Past readings of one entity. */
1723
+ type PastReadings = {
1724
+ readonly entityId: EntityId;
1725
+ readonly readings: readonly PastReading[];
1726
+ };
1727
+ /** One past reading: when it was taken, ISO 8601, and its value. */
1728
+ type PastReading = {
1729
+ readonly at: string;
1730
+ readonly value: number;
1416
1731
  };
1417
1732
  /** How one camera's picture is read: which source, told what. */
1418
1733
  type StreamRequest = {
@@ -2013,6 +2328,52 @@ declare const accountDeclarationSchema: z.ZodObject<{
2013
2328
  equals: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodBoolean]>>;
2014
2329
  }, z.core.$strict>>;
2015
2330
  isLive: z.ZodOptional<z.ZodBoolean>;
2331
+ }, z.core.$strict>, z.ZodObject<{
2332
+ type: z.ZodLiteral<"entity">;
2333
+ domains: z.ZodOptional<z.ZodArray<z.ZodEnum<{
2334
+ number: "number";
2335
+ cover: "cover";
2336
+ lock: "lock";
2337
+ media_player: "media_player";
2338
+ camera: "camera";
2339
+ button: "button";
2340
+ update: "update";
2341
+ lawn_mower: "lawn_mower";
2342
+ select: "select";
2343
+ vacuum: "vacuum";
2344
+ fan: "fan";
2345
+ image: "image";
2346
+ custom: "custom";
2347
+ alias: "alias";
2348
+ switch: "switch";
2349
+ light: "light";
2350
+ binary_sensor: "binary_sensor";
2351
+ climate: "climate";
2352
+ sensor: "sensor";
2353
+ device_tracker: "device_tracker";
2354
+ geo_location: "geo_location";
2355
+ }>>>;
2356
+ key: z.ZodString;
2357
+ label: z.ZodString;
2358
+ help: z.ZodOptional<z.ZodString>;
2359
+ isRequired: z.ZodDefault<z.ZodBoolean>;
2360
+ shownWhen: z.ZodOptional<z.ZodObject<{
2361
+ key: z.ZodString;
2362
+ equals: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodBoolean]>>;
2363
+ }, z.core.$strict>>;
2364
+ isLive: z.ZodOptional<z.ZodBoolean>;
2365
+ }, z.core.$strict>, z.ZodObject<{
2366
+ type: z.ZodLiteral<"icon">;
2367
+ default: z.ZodOptional<z.ZodString>;
2368
+ key: z.ZodString;
2369
+ label: z.ZodString;
2370
+ help: z.ZodOptional<z.ZodString>;
2371
+ isRequired: z.ZodDefault<z.ZodBoolean>;
2372
+ shownWhen: z.ZodOptional<z.ZodObject<{
2373
+ key: z.ZodString;
2374
+ equals: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodBoolean]>>;
2375
+ }, z.core.$strict>>;
2376
+ isLive: z.ZodOptional<z.ZodBoolean>;
2016
2377
  }, z.core.$strict>], "type">>>;
2017
2378
  }, z.core.$strict>;
2018
2379
  identity: z.ZodString;
@@ -2904,4 +3265,4 @@ type BundleFailure = {
2904
3265
  readonly vendorId?: string;
2905
3266
  };
2906
3267
  //#endregion
2907
- export { CapabilityName as A, TransportRequest as C, BluetoothAdvert as D, EntityId as E, BluetoothAdvertInput as O, Discovered as S, SerialLine as T, UdpPeer as _, LoadedListenSource as a, Integration as b, SightingIdentity as c, BundleSdk as d, ManagedSocketClose as f, PlatformServices as g, ManagedUdpSocketOptions as h, LoadedDiscovery as i, CapabilityState as j, JsonObject as k, TemplateValue as l, ManagedSocketOptions as m, LoadedAccount as n, LoadedVendor as o, ManagedSocketHeaders as p, LoadedBundle as r, Association as s, BundleFailure as t, BluetoothScannerOptions as u, Claim as v, TransportSubscription as w, ReportedState as x, DeviceDescriptor as y };
3268
+ export { EntityId as A, ReportedState as C, SerialLine as D, TransportSubscription as E, CapabilityState as M, JsonObject as N, BluetoothAdvert as O, PastReadings as S, TransportRequest as T, UdpPeer as _, LoadedListenSource as a, HistoryRange as b, SightingIdentity as c, BundleSdk as d, ManagedSocketClose as f, PlatformServices as g, ManagedUdpSocketOptions as h, LoadedDiscovery as i, CapabilityName as j, BluetoothAdvertInput as k, TemplateValue as l, ManagedSocketOptions as m, LoadedAccount as n, LoadedVendor as o, ManagedSocketHeaders as p, LoadedBundle as r, Association as s, BundleFailure as t, BluetoothScannerOptions as u, Claim as v, Discovered as w, Integration as x, DeviceDescriptor as y };