@nebulahome/integration-sdk 1.4.0 → 1.6.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.
- package/CHANGELOG.md +35 -0
- package/FILES.md +195 -3
- package/README.md +7 -4
- package/dist/chunks/node-dist.js +1170 -48
- package/dist/chunks/node-index.d.ts +432 -24
- package/dist/chunks/node-project.js +928 -10
- package/dist/chunks/node-rolldown-runtime.js +10 -1
- package/dist/index.d.ts +507 -7
- package/dist/index.js +51 -1
- package/dist/schemas.d.ts +113 -27
- package/dist/schemas.js +1 -1
- package/dist/testing.d.ts +86 -2
- package/dist/testing.js +44 -2
- package/package.json +5 -5
- package/schemas/discovery.schema.json +395 -2
- package/schemas/driver.schema.json +76 -1
- package/schemas/manifest.schema.json +5 -2
- package/schemas/modbus-template.schema.json +5 -2
- package/schemas/profile.schema.json +66 -0
|
@@ -162,6 +162,40 @@ type JsonObject = {
|
|
|
162
162
|
/** Any value that survives a JSON round trip unchanged. */
|
|
163
163
|
type JsonValue = string | number | boolean | null | JsonValue[] | JsonObject;
|
|
164
164
|
//#endregion
|
|
165
|
+
//#region ../contracts/dist/bluetooth.d.ts
|
|
166
|
+
/**
|
|
167
|
+
* One advertisement a scanner heard: what a proxy reports through `sdk.bluetooth.scanner`, and
|
|
168
|
+
* what the local adapter's D-Bus signals are turned into.
|
|
169
|
+
*/
|
|
170
|
+
declare const bluetoothAdvertSchema: z.ZodObject<{
|
|
171
|
+
address: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
172
|
+
addressType: z.ZodEnum<{
|
|
173
|
+
public: "public";
|
|
174
|
+
random: "random";
|
|
175
|
+
}>;
|
|
176
|
+
rssi: z.ZodInt;
|
|
177
|
+
name: z.ZodOptional<z.ZodString>;
|
|
178
|
+
manufacturerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>>;
|
|
179
|
+
serviceData: z.ZodOptional<z.ZodRecord<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>>;
|
|
180
|
+
serviceUuids: z.ZodOptional<z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>>;
|
|
181
|
+
at: z.ZodUnion<readonly [z.ZodDate, z.ZodPipe<z.ZodISODateTime, z.ZodTransform<Date, string>>]>;
|
|
182
|
+
}, z.core.$strip>;
|
|
183
|
+
/** One advertisement heard, as written. */
|
|
184
|
+
type BluetoothAdvertInput = z.input<typeof bluetoothAdvertSchema>;
|
|
185
|
+
/** One advertisement heard. */
|
|
186
|
+
type BluetoothAdvert = z.output<typeof bluetoothAdvertSchema>;
|
|
187
|
+
/**
|
|
188
|
+
* What a device that can be a proxy declares in its profile: the scan modes it can run.
|
|
189
|
+
*/
|
|
190
|
+
declare const bluetoothProxyProfileSchema: z.ZodObject<{
|
|
191
|
+
modes: z.ZodArray<z.ZodEnum<{
|
|
192
|
+
passive: "passive";
|
|
193
|
+
active: "active";
|
|
194
|
+
}>>;
|
|
195
|
+
}, z.core.$strict>;
|
|
196
|
+
/** What a device that can be a proxy declares. */
|
|
197
|
+
type BluetoothProxyProfile = z.output<typeof bluetoothProxyProfileSchema>;
|
|
198
|
+
//#endregion
|
|
165
199
|
//#region ../contracts/dist/entity-id.d.ts
|
|
166
200
|
/** The kinds of thing an entity can be. The domain is the part before the dot. */
|
|
167
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,21 +236,21 @@ declare const declaredCapabilitiesSchema: z.ZodRecord<z.ZodEnum<{
|
|
|
202
236
|
custom: "custom";
|
|
203
237
|
image: "image";
|
|
204
238
|
level: "level";
|
|
205
|
-
select: "select";
|
|
206
|
-
button: "button";
|
|
207
|
-
sensor_numeric: "sensor_numeric";
|
|
208
|
-
sensor_text: "sensor_text";
|
|
209
|
-
sensor_binary: "sensor_binary";
|
|
210
239
|
on_off: "on_off";
|
|
211
240
|
color_hs: "color_hs";
|
|
212
241
|
color_temp: "color_temp";
|
|
213
242
|
cover: "cover";
|
|
214
243
|
lock: "lock";
|
|
215
244
|
thermostat: "thermostat";
|
|
245
|
+
sensor_numeric: "sensor_numeric";
|
|
246
|
+
sensor_binary: "sensor_binary";
|
|
247
|
+
sensor_text: "sensor_text";
|
|
216
248
|
media_player: "media_player";
|
|
217
249
|
camera: "camera";
|
|
250
|
+
button: "button";
|
|
218
251
|
update: "update";
|
|
219
252
|
lawn_mower: "lawn_mower";
|
|
253
|
+
select: "select";
|
|
220
254
|
vacuum: "vacuum";
|
|
221
255
|
}> & z.core.$partial, z.ZodType<JsonObject, unknown, z.core.$ZodTypeInternals<JsonObject, unknown>>>;
|
|
222
256
|
/** What an entity declares it can do, with the device's own limits for each. */
|
|
@@ -388,6 +422,60 @@ declare const stateReportSchema: z.ZodObject<{
|
|
|
388
422
|
/** What an adapter publishes when a device reports. */
|
|
389
423
|
type StateReport = z.output<typeof stateReportSchema>;
|
|
390
424
|
//#endregion
|
|
425
|
+
//#region ../contracts/dist/infrared.d.ts
|
|
426
|
+
/** A code recognised as a protocol: its address and command. */
|
|
427
|
+
declare const infraredProtocolSchema: z.ZodObject<{
|
|
428
|
+
name: z.ZodEnum<{
|
|
429
|
+
nec: "nec";
|
|
430
|
+
"nec-ext": "nec-ext";
|
|
431
|
+
samsung32: "samsung32";
|
|
432
|
+
sirc: "sirc";
|
|
433
|
+
sirc15: "sirc15";
|
|
434
|
+
sirc20: "sirc20";
|
|
435
|
+
rc5: "rc5";
|
|
436
|
+
}>;
|
|
437
|
+
address: z.ZodInt;
|
|
438
|
+
command: z.ZodInt;
|
|
439
|
+
}, z.core.$strip>;
|
|
440
|
+
/** A code recognised as a protocol. */
|
|
441
|
+
type InfraredProtocol = z.output<typeof infraredProtocolSchema>;
|
|
442
|
+
/**
|
|
443
|
+
* A code, whichever blaster learned it: the pulses in microseconds, a mark then a space in turn,
|
|
444
|
+
* starting with a mark; the carrier an IR code is modulated on (0 for RF, which is on-off keyed);
|
|
445
|
+
* an RF code's frequency; and the protocol, when the codec recognises one.
|
|
446
|
+
*/
|
|
447
|
+
declare const infraredCodeSchema: z.ZodObject<{
|
|
448
|
+
signal: z.ZodEnum<{
|
|
449
|
+
ir: "ir";
|
|
450
|
+
rf: "rf";
|
|
451
|
+
}>;
|
|
452
|
+
carrierHz: z.ZodInt;
|
|
453
|
+
frequencyHz: z.ZodOptional<z.ZodInt>;
|
|
454
|
+
pulses: z.ZodArray<z.ZodInt>;
|
|
455
|
+
protocol: z.ZodOptional<z.ZodObject<{
|
|
456
|
+
name: z.ZodEnum<{
|
|
457
|
+
nec: "nec";
|
|
458
|
+
"nec-ext": "nec-ext";
|
|
459
|
+
samsung32: "samsung32";
|
|
460
|
+
sirc: "sirc";
|
|
461
|
+
sirc15: "sirc15";
|
|
462
|
+
sirc20: "sirc20";
|
|
463
|
+
rc5: "rc5";
|
|
464
|
+
}>;
|
|
465
|
+
address: z.ZodInt;
|
|
466
|
+
command: z.ZodInt;
|
|
467
|
+
}, z.core.$strip>>;
|
|
468
|
+
}, z.core.$strip>;
|
|
469
|
+
/** A code. */
|
|
470
|
+
type InfraredCode = z.output<typeof infraredCodeSchema>;
|
|
471
|
+
/** What a blaster declares in its profile: the signals it sends, and whether it can learn. */
|
|
472
|
+
declare const infraredProfileSchema: z.ZodObject<{
|
|
473
|
+
signals: z.ZodUnion<readonly [z.ZodTuple<[z.ZodLiteral<"ir">], null>, z.ZodTuple<[z.ZodLiteral<"ir">, z.ZodLiteral<"rf">], null>]>;
|
|
474
|
+
receives: z.ZodBoolean;
|
|
475
|
+
}, z.core.$strict>;
|
|
476
|
+
/** What a blaster declares. */
|
|
477
|
+
type InfraredProfile = z.output<typeof infraredProfileSchema>;
|
|
478
|
+
//#endregion
|
|
391
479
|
//#region ../contracts/dist/integration-setup.d.ts
|
|
392
480
|
/** Validates one field of a group. */
|
|
393
481
|
declare const setupFieldSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
@@ -700,11 +788,20 @@ type IntegrationSetup = z.output<typeof integrationSetupSchema>;
|
|
|
700
788
|
* The wires the interface names on a vendor's card: what a person recognises on the box, whatever
|
|
701
789
|
* transport of the platform's or of the vendor's own carries it. `udp` is a device's own protocol
|
|
702
790
|
* over plain datagrams on the network (Govee's LAN API), `modbus` Modbus TCP, `matter` the
|
|
703
|
-
* house's Matter fabric
|
|
791
|
+
* house's Matter fabric, `thread` its Thread network, `serial` a serial port (USB, RS-232/485, or
|
|
792
|
+
* one on the network), `ir` infrared and 433 MHz codes sent through a blaster.
|
|
704
793
|
*/
|
|
705
|
-
declare const TRANSPORT_WIRES: readonly ["http", "mqtt", "ble", "zigbee", "udp", "modbus", "matter"];
|
|
794
|
+
declare const TRANSPORT_WIRES: readonly ["http", "mqtt", "ble", "zigbee", "udp", "modbus", "matter", "thread", "serial", "ir"];
|
|
706
795
|
/** A wire the interface names. */
|
|
707
796
|
type TransportWire = (typeof TRANSPORT_WIRES)[number];
|
|
797
|
+
/**
|
|
798
|
+
* What a vendor's devices can be for the platform's brokers, besides devices of their own: an IR
|
|
799
|
+
* blaster the Infrared broker sends remotes' codes through, a Bluetooth proxy that listens for the
|
|
800
|
+
* house. Worked out from the profiles that declare them, and shown as chips on the vendor's page.
|
|
801
|
+
*/
|
|
802
|
+
declare const VENDOR_ROLES: readonly ["ir-blaster", "bluetooth-proxy"];
|
|
803
|
+
/** What a vendor's devices can be for the brokers. */
|
|
804
|
+
type VendorRole = (typeof VENDOR_ROLES)[number];
|
|
708
805
|
/**
|
|
709
806
|
* How the platform installed a vendor: the contents of the marker beside its builds,
|
|
710
807
|
* `hub/integrations/<vendor>/.nebula-install.json`, which names the build `hub` loads.
|
|
@@ -744,24 +841,25 @@ declare const modbusTemplateSchema: z.ZodObject<{
|
|
|
744
841
|
entities: z.ZodArray<z.ZodObject<{
|
|
745
842
|
id: z.ZodOptional<z.ZodString>;
|
|
746
843
|
name: z.ZodString;
|
|
844
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
747
845
|
domain: z.ZodEnum<{
|
|
748
846
|
number: "number";
|
|
749
|
-
|
|
750
|
-
|
|
847
|
+
button: "button";
|
|
848
|
+
select: "select";
|
|
751
849
|
switch: "switch";
|
|
752
850
|
light: "light";
|
|
753
|
-
|
|
754
|
-
|
|
851
|
+
binary_sensor: "binary_sensor";
|
|
852
|
+
sensor: "sensor";
|
|
755
853
|
}>;
|
|
756
854
|
capabilities: z.ZodRecord<z.ZodEnum<{
|
|
757
855
|
number: "number";
|
|
758
|
-
|
|
759
|
-
|
|
856
|
+
level: "level";
|
|
857
|
+
on_off: "on_off";
|
|
760
858
|
sensor_numeric: "sensor_numeric";
|
|
761
|
-
sensor_text: "sensor_text";
|
|
762
859
|
sensor_binary: "sensor_binary";
|
|
763
|
-
|
|
764
|
-
|
|
860
|
+
sensor_text: "sensor_text";
|
|
861
|
+
button: "button";
|
|
862
|
+
select: "select";
|
|
765
863
|
}> & z.core.$partial, z.ZodObject<{
|
|
766
864
|
read: z.ZodOptional<z.ZodObject<{
|
|
767
865
|
function: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>, z.ZodLiteral<4>]>;
|
|
@@ -796,6 +894,146 @@ declare const modbusTemplateSchema: z.ZodObject<{
|
|
|
796
894
|
/** A template, checked. */
|
|
797
895
|
type ModbusTemplate = z.output<typeof modbusTemplateSchema>;
|
|
798
896
|
//#endregion
|
|
897
|
+
//#region ../contracts/dist/serial-line.d.ts
|
|
898
|
+
/**
|
|
899
|
+
* How a port is spoken: the baud rate, and the framing - `9600 8N1` unless said. A driver of kind
|
|
900
|
+
* `serial` gives its defaults in this shape; the owner may change them when adding a device.
|
|
901
|
+
*/
|
|
902
|
+
declare const serialLineSchema: z.ZodObject<{
|
|
903
|
+
baudRate: z.ZodInt;
|
|
904
|
+
dataBits: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<5>, z.ZodLiteral<6>, z.ZodLiteral<7>, z.ZodLiteral<8>]>>;
|
|
905
|
+
parity: z.ZodDefault<z.ZodEnum<{
|
|
906
|
+
none: "none";
|
|
907
|
+
even: "even";
|
|
908
|
+
odd: "odd";
|
|
909
|
+
mark: "mark";
|
|
910
|
+
space: "space";
|
|
911
|
+
}>>;
|
|
912
|
+
stopBits: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<1.5>, z.ZodLiteral<2>]>>;
|
|
913
|
+
flowControl: z.ZodDefault<z.ZodEnum<{
|
|
914
|
+
none: "none";
|
|
915
|
+
rtscts: "rtscts";
|
|
916
|
+
xonxoff: "xonxoff";
|
|
917
|
+
}>>;
|
|
918
|
+
}, z.core.$strict>;
|
|
919
|
+
/** How a port is spoken, as written. */
|
|
920
|
+
type SerialLineInput = z.input<typeof serialLineSchema>;
|
|
921
|
+
/** How a port is spoken. */
|
|
922
|
+
type SerialLine = z.output<typeof serialLineSchema>;
|
|
923
|
+
declare namespace infrared_codes_d_exports {
|
|
924
|
+
export { BROADLINK_TICK_US, DEFAULT_IR_CARRIER_HZ, FlipperIrCode, FlipperIrFile, InfraredImportProblem, decodeBroadlink, decodeInfraredProtocol, decodePronto, decodeRawTimings, encodeBroadlink, encodeInfraredProtocol, encodePronto, encodeRawTimings, parseFlipperIr, withInfraredProtocol };
|
|
925
|
+
}
|
|
926
|
+
/** One Broadlink tick: 269/8192 ms, about 32.84 µs. */
|
|
927
|
+
declare const BROADLINK_TICK_US: number;
|
|
928
|
+
/** The carrier an infrared code is on when its format does not say: 38 kHz, as most remotes. */
|
|
929
|
+
declare const DEFAULT_IR_CARRIER_HZ = 38000;
|
|
930
|
+
/**
|
|
931
|
+
* Reads a Broadlink packet, as its app and similar open-source implementations write one: base64
|
|
932
|
+
* of a type byte, a repeat count, the length of what follows, and each pulse in ticks - one byte,
|
|
933
|
+
* or 0x00 and two bytes big-endian for a longer one - closed by 0x0d 0x05.
|
|
934
|
+
*
|
|
935
|
+
* @param text - The base64.
|
|
936
|
+
* @returns The code, its protocol recognised where it can be.
|
|
937
|
+
* @throws {ValidationError} When it is not a packet, or its pulses do not hold.
|
|
938
|
+
*/
|
|
939
|
+
declare function decodeBroadlink(text: string): InfraredCode;
|
|
940
|
+
/**
|
|
941
|
+
* Writes a code as a Broadlink packet: sent once, closed by 0x0d 0x05 and filled out to whole
|
|
942
|
+
* 16-byte blocks, as a Broadlink learns one. Radio goes on 315 MHz for a code nearer that than
|
|
943
|
+
* 433.
|
|
944
|
+
*
|
|
945
|
+
* @param code - The code.
|
|
946
|
+
* @returns The base64.
|
|
947
|
+
*/
|
|
948
|
+
declare function encodeBroadlink(code: InfraredCode): string;
|
|
949
|
+
/**
|
|
950
|
+
* Reads Pronto hex in its learned form: `0000`, the frequency word, the number of pairs sent once
|
|
951
|
+
* and of those repeated, then each pair's mark and space in periods of the carrier. What is sent
|
|
952
|
+
* once comes first, then the repeated part once.
|
|
953
|
+
*
|
|
954
|
+
* @param text - The words, four hex digits each.
|
|
955
|
+
* @returns The code, its protocol recognised where it can be.
|
|
956
|
+
* @throws {ValidationError} When it is not learned Pronto, or its pulses do not hold.
|
|
957
|
+
*/
|
|
958
|
+
declare function decodePronto(text: string): InfraredCode;
|
|
959
|
+
/**
|
|
960
|
+
* Writes a code as learned Pronto hex, every pair sent once; a code ending on a mark gets a pause
|
|
961
|
+
* after it, since Pronto counts pairs.
|
|
962
|
+
*
|
|
963
|
+
* @param code - The code.
|
|
964
|
+
* @returns The words, upper case; null for a radio code, which Pronto cannot carry.
|
|
965
|
+
*/
|
|
966
|
+
declare function encodePronto(code: InfraredCode): string | null;
|
|
967
|
+
/**
|
|
968
|
+
* Reads a list of microseconds: unsigned, a mark and a space in turn - `9000 4500 560 …` - or
|
|
969
|
+
* signed, a mark positive and a space negative - `[9000, -4500, 560, …]` - where two of a kind in
|
|
970
|
+
* a row are one pulse and a leading space is dropped. Spaces, commas, semicolons and brackets all
|
|
971
|
+
* separate.
|
|
972
|
+
*
|
|
973
|
+
* @param text - The list.
|
|
974
|
+
* @param carrierHz - The carrier, which a list does not say.
|
|
975
|
+
* @returns The infrared code, its protocol recognised where it can be.
|
|
976
|
+
* @throws {ValidationError} When a value is not a whole number of microseconds above 0.
|
|
977
|
+
*/
|
|
978
|
+
declare function decodeRawTimings(text: string, carrierHz?: number): InfraredCode;
|
|
979
|
+
/**
|
|
980
|
+
* Writes a code as a signed list: a mark positive, a space negative.
|
|
981
|
+
*
|
|
982
|
+
* @param code - The code.
|
|
983
|
+
* @returns `9000, -4500, 560, …`.
|
|
984
|
+
*/
|
|
985
|
+
declare function encodeRawTimings(code: InfraredCode): string;
|
|
986
|
+
/**
|
|
987
|
+
* Recognises the protocol a train of pulses was sent in.
|
|
988
|
+
*
|
|
989
|
+
* @param pulses - The pulses, a mark first.
|
|
990
|
+
* @returns The protocol with its address and command, or undefined for one not recognised.
|
|
991
|
+
*/
|
|
992
|
+
declare function decodeInfraredProtocol(pulses: readonly number[]): InfraredProtocol | undefined;
|
|
993
|
+
/**
|
|
994
|
+
* A code with its protocol, when its pulses are one the codec recognises.
|
|
995
|
+
*
|
|
996
|
+
* @param code - The code.
|
|
997
|
+
* @returns The code, with `protocol` when an infrared code's pulses are recognised.
|
|
998
|
+
*/
|
|
999
|
+
declare function withInfraredProtocol(code: InfraredCode): InfraredCode;
|
|
1000
|
+
/**
|
|
1001
|
+
* Writes a protocol's address and command as a code to send: what a Flipper Zero's `parsed` entry
|
|
1002
|
+
* becomes.
|
|
1003
|
+
*
|
|
1004
|
+
* @param protocol - The protocol, its address and its command.
|
|
1005
|
+
* @returns The code, on the protocol's carrier, the protocol beside it.
|
|
1006
|
+
* @throws {ValidationError} When the address or the command does not fit the protocol.
|
|
1007
|
+
*/
|
|
1008
|
+
declare function encodeInfraredProtocol(protocol: InfraredProtocol): InfraredCode;
|
|
1009
|
+
/** A line of an imported text not understood, and why. */
|
|
1010
|
+
type InfraredImportProblem = {
|
|
1011
|
+
/** The line, counted from 1; null for a problem of the whole text. */
|
|
1012
|
+
readonly line: number | null;
|
|
1013
|
+
readonly text: string;
|
|
1014
|
+
readonly reason: string;
|
|
1015
|
+
};
|
|
1016
|
+
/** A code a Flipper Zero file names: its button's name, and the line its entry starts on. */
|
|
1017
|
+
type FlipperIrCode = {
|
|
1018
|
+
readonly name: string;
|
|
1019
|
+
readonly line: number;
|
|
1020
|
+
readonly code: InfraredCode;
|
|
1021
|
+
};
|
|
1022
|
+
/** What reading a Flipper Zero file found: its codes, and the lines it could not use. */
|
|
1023
|
+
type FlipperIrFile = {
|
|
1024
|
+
readonly codes: FlipperIrCode[];
|
|
1025
|
+
readonly problems: InfraredImportProblem[];
|
|
1026
|
+
};
|
|
1027
|
+
/**
|
|
1028
|
+
* Reads a Flipper Zero `.ir` file - one remote's signals, or a library's - every entry a button:
|
|
1029
|
+
* `name`, then `type: parsed` with a `protocol`, an `address` and a `command`, or `type: raw` with
|
|
1030
|
+
* a `frequency`, a `duty_cycle` and the `data` in microseconds.
|
|
1031
|
+
*
|
|
1032
|
+
* @param text - The file.
|
|
1033
|
+
* @returns The codes, each named as its entry, and every line that could not be used, with why.
|
|
1034
|
+
*/
|
|
1035
|
+
declare function parseFlipperIr(text: string): FlipperIrFile;
|
|
1036
|
+
//#endregion
|
|
799
1037
|
//#region ../package-runtime/dist/transport.d.ts
|
|
800
1038
|
/** What an integration asks a transport to do, expressed as data. */
|
|
801
1039
|
type TransportRequest = {
|
|
@@ -1472,6 +1710,74 @@ type ModbusSession = {
|
|
|
1472
1710
|
};
|
|
1473
1711
|
/** Opens a session to a Modbus server. */
|
|
1474
1712
|
type OpenModbus = (server: ModbusServerOptions) => ModbusSession;
|
|
1713
|
+
/**
|
|
1714
|
+
* A serial port held through the Serial broker, which gives every port exactly one holder: bytes
|
|
1715
|
+
* as they come, and bytes to send.
|
|
1716
|
+
*
|
|
1717
|
+
* Once the port is gone - unplugged, closed by the owner from the Brokers page - `onClose` is
|
|
1718
|
+
* called and nothing more arrives; a write then rejects with an error whose `name` is
|
|
1719
|
+
* `SerialClosed`.
|
|
1720
|
+
*/
|
|
1721
|
+
type SerialSession = {
|
|
1722
|
+
/**
|
|
1723
|
+
* Sends bytes, resolving once the port took them.
|
|
1724
|
+
*
|
|
1725
|
+
* @throws {Error} `SerialClosed` once the session is closed.
|
|
1726
|
+
*/
|
|
1727
|
+
write: (bytes: Uint8Array) => Promise<void>;
|
|
1728
|
+
/**
|
|
1729
|
+
* Hears every chunk the port reads, in order, as it arrives: a chunk is not a message, so a
|
|
1730
|
+
* protocol framed by lines or lengths puts the chunks together itself.
|
|
1731
|
+
*
|
|
1732
|
+
* @returns Stops hearing.
|
|
1733
|
+
*/
|
|
1734
|
+
onData: (listener: (bytes: Uint8Array) => void) => () => void;
|
|
1735
|
+
/**
|
|
1736
|
+
* Hears the port go: unplugged, taken back by the owner, or closed here. Called once.
|
|
1737
|
+
*
|
|
1738
|
+
* @returns Stops hearing.
|
|
1739
|
+
*/
|
|
1740
|
+
onClose: (listener: (reason: string) => void) => () => void;
|
|
1741
|
+
/** Lets go of the port, so another holder may open it. */
|
|
1742
|
+
close: () => Promise<void>;
|
|
1743
|
+
};
|
|
1744
|
+
/**
|
|
1745
|
+
* Opens a serial port the device holds - the `portId` and `line` its config's `serial` block
|
|
1746
|
+
* carries, as the owner picked them when adding it - through the Serial broker.
|
|
1747
|
+
*
|
|
1748
|
+
* Rejects with an error whose `name` says why: `SerialPortHeld` - another device, a broker, the
|
|
1749
|
+
* console or a container holds it - or `SerialPortMissing` - no such port, or it is not plugged in.
|
|
1750
|
+
*/
|
|
1751
|
+
type OpenSerial = (portId: string, line: SerialLineInput) => Promise<SerialSession>;
|
|
1752
|
+
/** Which proxy is reporting: the device it is, as its connection names it. */
|
|
1753
|
+
type BluetoothScannerOptions = {
|
|
1754
|
+
/** The connection the proxy is reached over: its transport's connection key. */
|
|
1755
|
+
readonly key: string;
|
|
1756
|
+
/** The proxy itself, as that connection names its devices. */
|
|
1757
|
+
readonly deviceKey: string;
|
|
1758
|
+
};
|
|
1759
|
+
/**
|
|
1760
|
+
* A Bluetooth proxy's channel to the Bluetooth broker: what it hears goes in here, and the house
|
|
1761
|
+
* sees it as heard by that proxy.
|
|
1762
|
+
*/
|
|
1763
|
+
type BluetoothScanner = {
|
|
1764
|
+
/**
|
|
1765
|
+
* Reports advertisements heard - addresses, how loud, what each carries. The broker checks each
|
|
1766
|
+
* and drops one that does not hold; reporting the same one again is how a proxy says it still
|
|
1767
|
+
* hears it.
|
|
1768
|
+
*/
|
|
1769
|
+
report: (adverts: readonly BluetoothAdvertInput[]) => void;
|
|
1770
|
+
/** Stops reporting: the proxy is no longer one, or its connection went. */
|
|
1771
|
+
close: () => void;
|
|
1772
|
+
};
|
|
1773
|
+
/** The house's Bluetooth, as a vendor whose devices can be proxies reaches it. */
|
|
1774
|
+
type BundleBluetooth = {
|
|
1775
|
+
/**
|
|
1776
|
+
* Opens a proxy's scanner, for a device whose profile declares `bluetoothProxy`. One per proxy:
|
|
1777
|
+
* opening it again replaces the first.
|
|
1778
|
+
*/
|
|
1779
|
+
readonly scanner: (options: BluetoothScannerOptions) => BluetoothScanner;
|
|
1780
|
+
};
|
|
1475
1781
|
/**
|
|
1476
1782
|
* The house's MQTT broker, as the hub reaches it: the one the hub runs, with the hub's own
|
|
1477
1783
|
* username - or the broker `NEBULA_MQTT_URL` names. Read again each time it is needed: a session
|
|
@@ -1501,7 +1807,14 @@ type PalettedPicture = {
|
|
|
1501
1807
|
/** One index into the palette per pixel, row after row from the top left. */
|
|
1502
1808
|
readonly pixels: Uint8Array;
|
|
1503
1809
|
};
|
|
1504
|
-
/**
|
|
1810
|
+
/**
|
|
1811
|
+
* The platform's infrared codec, `infrared-codes.ts`: Broadlink packets, Pronto hex, raw timings
|
|
1812
|
+
* and Flipper Zero `.ir` files read into the platform's code and written back out, and the
|
|
1813
|
+
* protocols recognised in it. A blaster's integration converts between its own format and the
|
|
1814
|
+
* code the `infrared.*` ops carry with it.
|
|
1815
|
+
*/
|
|
1816
|
+
type InfraredCodec = typeof infrared_codes_d_exports;
|
|
1817
|
+
/** What a bundle decoding what its devices send needs, and could not bring as a dependency. */
|
|
1505
1818
|
type BundleCodecs = {
|
|
1506
1819
|
/**
|
|
1507
1820
|
* Unpacks an LZMA stream in the alone format (`.lzma`): a 13-byte header - the properties and
|
|
@@ -1510,6 +1823,14 @@ type BundleCodecs = {
|
|
|
1510
1823
|
* @throws {Error} When the stream is corrupt.
|
|
1511
1824
|
*/
|
|
1512
1825
|
readonly lzma: (bytes: Uint8Array) => Buffer;
|
|
1826
|
+
/**
|
|
1827
|
+
* The infrared codec: `decodeBroadlink`, `encodeBroadlink`, `decodePronto`, `encodePronto`,
|
|
1828
|
+
* `decodeRawTimings`, `encodeRawTimings`, `parseFlipperIr`, `decodeInfraredProtocol`,
|
|
1829
|
+
* `encodeInfraredProtocol`, `withInfraredProtocol`. Handed over rather than imported because it
|
|
1830
|
+
* validates with zod, which a bundle's code reaches only as `sdk.z`; a code that does not hold
|
|
1831
|
+
* throws a `ValidationError`.
|
|
1832
|
+
*/
|
|
1833
|
+
readonly infrared: InfraredCodec;
|
|
1513
1834
|
};
|
|
1514
1835
|
/** Pictures a bundle draws, for an image entity. */
|
|
1515
1836
|
type BundleImages = {
|
|
@@ -1535,6 +1856,10 @@ type BundleSdk = {
|
|
|
1535
1856
|
readonly openMqtt: OpenMqtt;
|
|
1536
1857
|
/** A session to a Modbus server, through the hub's one connection to it. */
|
|
1537
1858
|
readonly openModbus: OpenModbus;
|
|
1859
|
+
/** A serial port a device of the vendor holds, through the Serial broker. */
|
|
1860
|
+
readonly openSerial: OpenSerial;
|
|
1861
|
+
/** The house's Bluetooth, for a vendor whose devices are proxies. */
|
|
1862
|
+
readonly bluetooth: BundleBluetooth;
|
|
1538
1863
|
/** How a camera's stream source is written, as defineTransport is for a transport. */
|
|
1539
1864
|
readonly defineStreamSource: typeof defineStreamSource;
|
|
1540
1865
|
/** An RTSP session over TCP, yielding a camera's H.264 as it comes. */
|
|
@@ -1792,21 +2117,24 @@ declare const vendorManifestSchema: z.ZodObject<{
|
|
|
1792
2117
|
}>>>;
|
|
1793
2118
|
internetRequired: z.ZodDefault<z.ZodBoolean>;
|
|
1794
2119
|
twins: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
1795
|
-
mac: "mac";
|
|
1796
2120
|
serial: "serial";
|
|
2121
|
+
mac: "mac";
|
|
1797
2122
|
}>>>;
|
|
1798
2123
|
setup: z.ZodOptional<z.ZodString>;
|
|
1799
2124
|
account: z.ZodOptional<z.ZodString>;
|
|
1800
2125
|
transports: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
1801
2126
|
module: z.ZodString;
|
|
1802
2127
|
wires: z.ZodArray<z.ZodEnum<{
|
|
2128
|
+
udp: "udp";
|
|
1803
2129
|
matter: "matter";
|
|
1804
|
-
modbus: "modbus";
|
|
1805
2130
|
mqtt: "mqtt";
|
|
2131
|
+
modbus: "modbus";
|
|
2132
|
+
serial: "serial";
|
|
1806
2133
|
http: "http";
|
|
1807
2134
|
ble: "ble";
|
|
1808
2135
|
zigbee: "zigbee";
|
|
1809
|
-
|
|
2136
|
+
thread: "thread";
|
|
2137
|
+
ir: "ir";
|
|
1810
2138
|
}>>;
|
|
1811
2139
|
}, z.core.$strict>]>>>;
|
|
1812
2140
|
streams: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
@@ -1895,11 +2223,14 @@ declare const bundleManifestSchema: z.ZodObject<{
|
|
|
1895
2223
|
modelCodes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>>;
|
|
1896
2224
|
modelSeries: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
1897
2225
|
kind: z.ZodEnum<{
|
|
2226
|
+
declarative: "declarative";
|
|
2227
|
+
code: "code";
|
|
1898
2228
|
matter: "matter";
|
|
1899
|
-
modbus: "modbus";
|
|
1900
2229
|
mqtt: "mqtt";
|
|
1901
|
-
|
|
1902
|
-
|
|
2230
|
+
modbus: "modbus";
|
|
2231
|
+
infrared: "infrared";
|
|
2232
|
+
serial: "serial";
|
|
2233
|
+
bluetooth: "bluetooth";
|
|
1903
2234
|
}>;
|
|
1904
2235
|
defaultIcon: z.ZodOptional<z.ZodString>;
|
|
1905
2236
|
webPagePort: z.ZodOptional<z.ZodInt>;
|
|
@@ -1907,6 +2238,23 @@ declare const bundleManifestSchema: z.ZodObject<{
|
|
|
1907
2238
|
profile: z.ZodOptional<z.ZodString>;
|
|
1908
2239
|
entry: z.ZodOptional<z.ZodString>;
|
|
1909
2240
|
template: z.ZodOptional<z.ZodString>;
|
|
2241
|
+
serial: z.ZodOptional<z.ZodObject<{
|
|
2242
|
+
baudRate: z.ZodInt;
|
|
2243
|
+
dataBits: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<5>, z.ZodLiteral<6>, z.ZodLiteral<7>, z.ZodLiteral<8>]>>;
|
|
2244
|
+
parity: z.ZodDefault<z.ZodEnum<{
|
|
2245
|
+
none: "none";
|
|
2246
|
+
even: "even";
|
|
2247
|
+
odd: "odd";
|
|
2248
|
+
mark: "mark";
|
|
2249
|
+
space: "space";
|
|
2250
|
+
}>>;
|
|
2251
|
+
stopBits: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<1.5>, z.ZodLiteral<2>]>>;
|
|
2252
|
+
flowControl: z.ZodDefault<z.ZodEnum<{
|
|
2253
|
+
none: "none";
|
|
2254
|
+
rtscts: "rtscts";
|
|
2255
|
+
xonxoff: "xonxoff";
|
|
2256
|
+
}>>;
|
|
2257
|
+
}, z.core.$strict>>;
|
|
1910
2258
|
setup: z.ZodString;
|
|
1911
2259
|
id: z.ZodString;
|
|
1912
2260
|
version: z.ZodString;
|
|
@@ -2086,6 +2434,58 @@ declare const vendorDiscoverySchema: z.ZodObject<{
|
|
|
2086
2434
|
options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
2087
2435
|
}, z.core.$strict>>>;
|
|
2088
2436
|
}, z.core.$strict>>;
|
|
2437
|
+
serial: z.ZodOptional<z.ZodObject<{
|
|
2438
|
+
match: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
2439
|
+
path: z.ZodString;
|
|
2440
|
+
equals: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
|
|
2441
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
2442
|
+
path: z.ZodString;
|
|
2443
|
+
exists: z.ZodLiteral<true>;
|
|
2444
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
2445
|
+
path: z.ZodString;
|
|
2446
|
+
oneOf: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
|
|
2447
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
2448
|
+
path: z.ZodString;
|
|
2449
|
+
startsWith: z.ZodString;
|
|
2450
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
2451
|
+
path: z.ZodString;
|
|
2452
|
+
endsWith: z.ZodString;
|
|
2453
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
2454
|
+
path: z.ZodString;
|
|
2455
|
+
contains: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
|
|
2456
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
2457
|
+
path: z.ZodString;
|
|
2458
|
+
min: z.ZodOptional<z.ZodNumber>;
|
|
2459
|
+
max: z.ZodOptional<z.ZodNumber>;
|
|
2460
|
+
}, z.core.$strict>]>>;
|
|
2461
|
+
model: z.ZodDefault<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
2462
|
+
}, z.core.$strict>>;
|
|
2463
|
+
bluetooth: z.ZodOptional<z.ZodObject<{
|
|
2464
|
+
match: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
2465
|
+
path: z.ZodString;
|
|
2466
|
+
equals: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
|
|
2467
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
2468
|
+
path: z.ZodString;
|
|
2469
|
+
exists: z.ZodLiteral<true>;
|
|
2470
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
2471
|
+
path: z.ZodString;
|
|
2472
|
+
oneOf: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
|
|
2473
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
2474
|
+
path: z.ZodString;
|
|
2475
|
+
startsWith: z.ZodString;
|
|
2476
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
2477
|
+
path: z.ZodString;
|
|
2478
|
+
endsWith: z.ZodString;
|
|
2479
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
2480
|
+
path: z.ZodString;
|
|
2481
|
+
contains: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
|
|
2482
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
2483
|
+
path: z.ZodString;
|
|
2484
|
+
min: z.ZodOptional<z.ZodNumber>;
|
|
2485
|
+
max: z.ZodOptional<z.ZodNumber>;
|
|
2486
|
+
}, z.core.$strict>]>>;
|
|
2487
|
+
model: z.ZodDefault<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
2488
|
+
}, z.core.$strict>>;
|
|
2089
2489
|
adopt: z.ZodDefault<z.ZodEnum<{
|
|
2090
2490
|
owner: "owner";
|
|
2091
2491
|
automatic: "automatic";
|
|
@@ -2104,6 +2504,8 @@ type DiscoveryDriver = {
|
|
|
2104
2504
|
readonly id: string;
|
|
2105
2505
|
/** The driver's own name, offered as its one model when it lists none. */
|
|
2106
2506
|
readonly name: string;
|
|
2507
|
+
/** How it is written: a `serial` driver takes the ports the Serial broker proposes. */
|
|
2508
|
+
readonly kind?: string;
|
|
2107
2509
|
/**
|
|
2108
2510
|
* What reaches its devices. A driver on a broker's transport - `matter`, `mqtt-house` - takes
|
|
2109
2511
|
* only that broker's devices, and no other driver does.
|
|
@@ -2241,6 +2643,10 @@ type LoadedBundle = {
|
|
|
2241
2643
|
readonly directory: string;
|
|
2242
2644
|
/** The template a Modbus driver reads its devices through, every entity with its id. */
|
|
2243
2645
|
readonly modbusTemplate?: ModbusTemplate;
|
|
2646
|
+
/** That its devices are IR blasters, as its profile declares: what they send, and learn. */
|
|
2647
|
+
readonly infrared?: InfraredProfile;
|
|
2648
|
+
/** That its devices can be Bluetooth proxies, as its profile declares: how they scan. */
|
|
2649
|
+
readonly bluetoothProxy?: BluetoothProxyProfile;
|
|
2244
2650
|
};
|
|
2245
2651
|
/**
|
|
2246
2652
|
* Which of the two places a vendor was read from.
|
|
@@ -2288,6 +2694,8 @@ type LoadedVendor = {
|
|
|
2288
2694
|
readonly transports: readonly string[];
|
|
2289
2695
|
/** The wires its devices are reached over, for its card: see {@link wiresOf}. */
|
|
2290
2696
|
readonly wires: readonly TransportWire[];
|
|
2697
|
+
/** What its devices can be for the brokers, for its chips: see {@link vendorRolesOf}. */
|
|
2698
|
+
readonly roles?: readonly VendorRole[];
|
|
2291
2699
|
/** The transports the vendor ships itself, ready to register: `shelly/rpc`. */
|
|
2292
2700
|
readonly ownTransports: readonly Transport[];
|
|
2293
2701
|
/** The stream sources the vendor ships, ready to register: `bambulab/camera`. */
|
|
@@ -2317,4 +2725,4 @@ type BundleFailure = {
|
|
|
2317
2725
|
readonly vendorId?: string;
|
|
2318
2726
|
};
|
|
2319
2727
|
//#endregion
|
|
2320
|
-
export {
|
|
2728
|
+
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 };
|