@nebulahome/integration-sdk 1.5.0 → 1.6.1
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 +33 -0
- package/FILES.md +191 -1
- package/README.md +7 -4
- package/dist/chunks/node-dist.js +1163 -47
- package/dist/chunks/node-index.d.ts +432 -21
- package/dist/chunks/node-project.js +932 -10
- package/dist/chunks/node-rolldown-runtime.js +10 -1
- package/dist/index.d.ts +513 -9
- package/dist/index.js +51 -1
- package/dist/schemas.d.ts +103 -18
- 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 +394 -0
- package/schemas/driver.schema.json +76 -1
- package/schemas/manifest.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"];
|
|
@@ -200,24 +234,24 @@ type EntityStateClass = (typeof ENTITY_STATE_CLASSES)[number];
|
|
|
200
234
|
declare const declaredCapabilitiesSchema: z.ZodRecord<z.ZodEnum<{
|
|
201
235
|
number: "number";
|
|
202
236
|
custom: "custom";
|
|
203
|
-
|
|
204
|
-
button: "button";
|
|
205
|
-
sensor_numeric: "sensor_numeric";
|
|
206
|
-
sensor_text: "sensor_text";
|
|
207
|
-
sensor_binary: "sensor_binary";
|
|
208
|
-
on_off: "on_off";
|
|
237
|
+
image: "image";
|
|
209
238
|
level: "level";
|
|
239
|
+
on_off: "on_off";
|
|
210
240
|
color_hs: "color_hs";
|
|
211
241
|
color_temp: "color_temp";
|
|
212
242
|
cover: "cover";
|
|
213
243
|
lock: "lock";
|
|
214
244
|
thermostat: "thermostat";
|
|
245
|
+
sensor_numeric: "sensor_numeric";
|
|
246
|
+
sensor_binary: "sensor_binary";
|
|
247
|
+
sensor_text: "sensor_text";
|
|
215
248
|
media_player: "media_player";
|
|
216
249
|
camera: "camera";
|
|
250
|
+
button: "button";
|
|
217
251
|
update: "update";
|
|
218
252
|
lawn_mower: "lawn_mower";
|
|
253
|
+
select: "select";
|
|
219
254
|
vacuum: "vacuum";
|
|
220
|
-
image: "image";
|
|
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. */
|
|
223
257
|
type DeclaredCapabilities = z.output<typeof declaredCapabilitiesSchema>;
|
|
@@ -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.
|
|
@@ -747,22 +844,22 @@ declare const modbusTemplateSchema: z.ZodObject<{
|
|
|
747
844
|
icon: z.ZodOptional<z.ZodString>;
|
|
748
845
|
domain: z.ZodEnum<{
|
|
749
846
|
number: "number";
|
|
750
|
-
|
|
751
|
-
|
|
847
|
+
button: "button";
|
|
848
|
+
select: "select";
|
|
752
849
|
switch: "switch";
|
|
753
850
|
light: "light";
|
|
754
|
-
|
|
755
|
-
|
|
851
|
+
binary_sensor: "binary_sensor";
|
|
852
|
+
sensor: "sensor";
|
|
756
853
|
}>;
|
|
757
854
|
capabilities: z.ZodRecord<z.ZodEnum<{
|
|
758
855
|
number: "number";
|
|
759
|
-
|
|
760
|
-
|
|
856
|
+
level: "level";
|
|
857
|
+
on_off: "on_off";
|
|
761
858
|
sensor_numeric: "sensor_numeric";
|
|
762
|
-
sensor_text: "sensor_text";
|
|
763
859
|
sensor_binary: "sensor_binary";
|
|
764
|
-
|
|
765
|
-
|
|
860
|
+
sensor_text: "sensor_text";
|
|
861
|
+
button: "button";
|
|
862
|
+
select: "select";
|
|
766
863
|
}> & z.core.$partial, z.ZodObject<{
|
|
767
864
|
read: z.ZodOptional<z.ZodObject<{
|
|
768
865
|
function: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>, z.ZodLiteral<4>]>;
|
|
@@ -797,6 +894,150 @@ declare const modbusTemplateSchema: z.ZodObject<{
|
|
|
797
894
|
/** A template, checked. */
|
|
798
895
|
type ModbusTemplate = z.output<typeof modbusTemplateSchema>;
|
|
799
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
|
+
/**
|
|
927
|
+
* One Broadlink tick: 8192/269 µs, about 30.45 µs - a duration in µs times 269/8192 is ticks,
|
|
928
|
+
* as measured against real firmware (broadlink-async). The inverse, 32.84 µs, made codes from
|
|
929
|
+
* other sources about 7 % short on the air.
|
|
930
|
+
*/
|
|
931
|
+
declare const BROADLINK_TICK_US: number;
|
|
932
|
+
/** The carrier an infrared code is on when its format does not say: 38 kHz, as most remotes. */
|
|
933
|
+
declare const DEFAULT_IR_CARRIER_HZ = 38000;
|
|
934
|
+
/**
|
|
935
|
+
* Reads a Broadlink packet, as its app and similar open-source implementations write one: base64
|
|
936
|
+
* of a type byte, a repeat count, the length of what follows, and each pulse in ticks - one byte,
|
|
937
|
+
* or 0x00 and two bytes big-endian for a longer one - closed by 0x0d 0x05.
|
|
938
|
+
*
|
|
939
|
+
* @param text - The base64.
|
|
940
|
+
* @returns The code, its protocol recognised where it can be.
|
|
941
|
+
* @throws {ValidationError} When it is not a packet, or its pulses do not hold.
|
|
942
|
+
*/
|
|
943
|
+
declare function decodeBroadlink(text: string): InfraredCode;
|
|
944
|
+
/**
|
|
945
|
+
* Writes a code as a Broadlink packet: sent once, closed by 0x0d 0x05 and filled out to whole
|
|
946
|
+
* 16-byte blocks, as a Broadlink learns one. Radio goes on 315 MHz for a code nearer that than
|
|
947
|
+
* 433.
|
|
948
|
+
*
|
|
949
|
+
* @param code - The code.
|
|
950
|
+
* @returns The base64.
|
|
951
|
+
*/
|
|
952
|
+
declare function encodeBroadlink(code: InfraredCode): string;
|
|
953
|
+
/**
|
|
954
|
+
* Reads Pronto hex in its learned form: `0000`, the frequency word, the number of pairs sent once
|
|
955
|
+
* and of those repeated, then each pair's mark and space in periods of the carrier. What is sent
|
|
956
|
+
* once comes first, then the repeated part once.
|
|
957
|
+
*
|
|
958
|
+
* @param text - The words, four hex digits each.
|
|
959
|
+
* @returns The code, its protocol recognised where it can be.
|
|
960
|
+
* @throws {ValidationError} When it is not learned Pronto, or its pulses do not hold.
|
|
961
|
+
*/
|
|
962
|
+
declare function decodePronto(text: string): InfraredCode;
|
|
963
|
+
/**
|
|
964
|
+
* Writes a code as learned Pronto hex, every pair sent once; a code ending on a mark gets a pause
|
|
965
|
+
* after it, since Pronto counts pairs.
|
|
966
|
+
*
|
|
967
|
+
* @param code - The code.
|
|
968
|
+
* @returns The words, upper case; null for a radio code, which Pronto cannot carry.
|
|
969
|
+
*/
|
|
970
|
+
declare function encodePronto(code: InfraredCode): string | null;
|
|
971
|
+
/**
|
|
972
|
+
* Reads a list of microseconds: unsigned, a mark and a space in turn - `9000 4500 560 …` - or
|
|
973
|
+
* signed, a mark positive and a space negative - `[9000, -4500, 560, …]` - where two of a kind in
|
|
974
|
+
* a row are one pulse and a leading space is dropped. Spaces, commas, semicolons and brackets all
|
|
975
|
+
* separate.
|
|
976
|
+
*
|
|
977
|
+
* @param text - The list.
|
|
978
|
+
* @param carrierHz - The carrier, which a list does not say.
|
|
979
|
+
* @returns The infrared code, its protocol recognised where it can be.
|
|
980
|
+
* @throws {ValidationError} When a value is not a whole number of microseconds above 0.
|
|
981
|
+
*/
|
|
982
|
+
declare function decodeRawTimings(text: string, carrierHz?: number): InfraredCode;
|
|
983
|
+
/**
|
|
984
|
+
* Writes a code as a signed list: a mark positive, a space negative.
|
|
985
|
+
*
|
|
986
|
+
* @param code - The code.
|
|
987
|
+
* @returns `9000, -4500, 560, …`.
|
|
988
|
+
*/
|
|
989
|
+
declare function encodeRawTimings(code: InfraredCode): string;
|
|
990
|
+
/**
|
|
991
|
+
* Recognises the protocol a train of pulses was sent in.
|
|
992
|
+
*
|
|
993
|
+
* @param pulses - The pulses, a mark first.
|
|
994
|
+
* @returns The protocol with its address and command, or undefined for one not recognised.
|
|
995
|
+
*/
|
|
996
|
+
declare function decodeInfraredProtocol(pulses: readonly number[]): InfraredProtocol | undefined;
|
|
997
|
+
/**
|
|
998
|
+
* A code with its protocol, when its pulses are one the codec recognises.
|
|
999
|
+
*
|
|
1000
|
+
* @param code - The code.
|
|
1001
|
+
* @returns The code, with `protocol` when an infrared code's pulses are recognised.
|
|
1002
|
+
*/
|
|
1003
|
+
declare function withInfraredProtocol(code: InfraredCode): InfraredCode;
|
|
1004
|
+
/**
|
|
1005
|
+
* Writes a protocol's address and command as a code to send: what a Flipper Zero's `parsed` entry
|
|
1006
|
+
* becomes.
|
|
1007
|
+
*
|
|
1008
|
+
* @param protocol - The protocol, its address and its command.
|
|
1009
|
+
* @returns The code, on the protocol's carrier, the protocol beside it.
|
|
1010
|
+
* @throws {ValidationError} When the address or the command does not fit the protocol.
|
|
1011
|
+
*/
|
|
1012
|
+
declare function encodeInfraredProtocol(protocol: InfraredProtocol): InfraredCode;
|
|
1013
|
+
/** A line of an imported text not understood, and why. */
|
|
1014
|
+
type InfraredImportProblem = {
|
|
1015
|
+
/** The line, counted from 1; null for a problem of the whole text. */
|
|
1016
|
+
readonly line: number | null;
|
|
1017
|
+
readonly text: string;
|
|
1018
|
+
readonly reason: string;
|
|
1019
|
+
};
|
|
1020
|
+
/** A code a Flipper Zero file names: its button's name, and the line its entry starts on. */
|
|
1021
|
+
type FlipperIrCode = {
|
|
1022
|
+
readonly name: string;
|
|
1023
|
+
readonly line: number;
|
|
1024
|
+
readonly code: InfraredCode;
|
|
1025
|
+
};
|
|
1026
|
+
/** What reading a Flipper Zero file found: its codes, and the lines it could not use. */
|
|
1027
|
+
type FlipperIrFile = {
|
|
1028
|
+
readonly codes: FlipperIrCode[];
|
|
1029
|
+
readonly problems: InfraredImportProblem[];
|
|
1030
|
+
};
|
|
1031
|
+
/**
|
|
1032
|
+
* Reads a Flipper Zero `.ir` file - one remote's signals, or a library's - every entry a button:
|
|
1033
|
+
* `name`, then `type: parsed` with a `protocol`, an `address` and a `command`, or `type: raw` with
|
|
1034
|
+
* a `frequency`, a `duty_cycle` and the `data` in microseconds.
|
|
1035
|
+
*
|
|
1036
|
+
* @param text - The file.
|
|
1037
|
+
* @returns The codes, each named as its entry, and every line that could not be used, with why.
|
|
1038
|
+
*/
|
|
1039
|
+
declare function parseFlipperIr(text: string): FlipperIrFile;
|
|
1040
|
+
//#endregion
|
|
800
1041
|
//#region ../package-runtime/dist/transport.d.ts
|
|
801
1042
|
/** What an integration asks a transport to do, expressed as data. */
|
|
802
1043
|
type TransportRequest = {
|
|
@@ -1473,6 +1714,74 @@ type ModbusSession = {
|
|
|
1473
1714
|
};
|
|
1474
1715
|
/** Opens a session to a Modbus server. */
|
|
1475
1716
|
type OpenModbus = (server: ModbusServerOptions) => ModbusSession;
|
|
1717
|
+
/**
|
|
1718
|
+
* A serial port held through the Serial broker, which gives every port exactly one holder: bytes
|
|
1719
|
+
* as they come, and bytes to send.
|
|
1720
|
+
*
|
|
1721
|
+
* Once the port is gone - unplugged, closed by the owner from the Brokers page - `onClose` is
|
|
1722
|
+
* called and nothing more arrives; a write then rejects with an error whose `name` is
|
|
1723
|
+
* `SerialClosed`.
|
|
1724
|
+
*/
|
|
1725
|
+
type SerialSession = {
|
|
1726
|
+
/**
|
|
1727
|
+
* Sends bytes, resolving once the port took them.
|
|
1728
|
+
*
|
|
1729
|
+
* @throws {Error} `SerialClosed` once the session is closed.
|
|
1730
|
+
*/
|
|
1731
|
+
write: (bytes: Uint8Array) => Promise<void>;
|
|
1732
|
+
/**
|
|
1733
|
+
* Hears every chunk the port reads, in order, as it arrives: a chunk is not a message, so a
|
|
1734
|
+
* protocol framed by lines or lengths puts the chunks together itself.
|
|
1735
|
+
*
|
|
1736
|
+
* @returns Stops hearing.
|
|
1737
|
+
*/
|
|
1738
|
+
onData: (listener: (bytes: Uint8Array) => void) => () => void;
|
|
1739
|
+
/**
|
|
1740
|
+
* Hears the port go: unplugged, taken back by the owner, or closed here. Called once.
|
|
1741
|
+
*
|
|
1742
|
+
* @returns Stops hearing.
|
|
1743
|
+
*/
|
|
1744
|
+
onClose: (listener: (reason: string) => void) => () => void;
|
|
1745
|
+
/** Lets go of the port, so another holder may open it. */
|
|
1746
|
+
close: () => Promise<void>;
|
|
1747
|
+
};
|
|
1748
|
+
/**
|
|
1749
|
+
* Opens a serial port the device holds - the `portId` and `line` its config's `serial` block
|
|
1750
|
+
* carries, as the owner picked them when adding it - through the Serial broker.
|
|
1751
|
+
*
|
|
1752
|
+
* Rejects with an error whose `name` says why: `SerialPortHeld` - another device, a broker, the
|
|
1753
|
+
* console or a container holds it - or `SerialPortMissing` - no such port, or it is not plugged in.
|
|
1754
|
+
*/
|
|
1755
|
+
type OpenSerial = (portId: string, line: SerialLineInput) => Promise<SerialSession>;
|
|
1756
|
+
/** Which proxy is reporting: the device it is, as its connection names it. */
|
|
1757
|
+
type BluetoothScannerOptions = {
|
|
1758
|
+
/** The connection the proxy is reached over: its transport's connection key. */
|
|
1759
|
+
readonly key: string;
|
|
1760
|
+
/** The proxy itself, as that connection names its devices. */
|
|
1761
|
+
readonly deviceKey: string;
|
|
1762
|
+
};
|
|
1763
|
+
/**
|
|
1764
|
+
* A Bluetooth proxy's channel to the Bluetooth broker: what it hears goes in here, and the house
|
|
1765
|
+
* sees it as heard by that proxy.
|
|
1766
|
+
*/
|
|
1767
|
+
type BluetoothScanner = {
|
|
1768
|
+
/**
|
|
1769
|
+
* Reports advertisements heard - addresses, how loud, what each carries. The broker checks each
|
|
1770
|
+
* and drops one that does not hold; reporting the same one again is how a proxy says it still
|
|
1771
|
+
* hears it.
|
|
1772
|
+
*/
|
|
1773
|
+
report: (adverts: readonly BluetoothAdvertInput[]) => void;
|
|
1774
|
+
/** Stops reporting: the proxy is no longer one, or its connection went. */
|
|
1775
|
+
close: () => void;
|
|
1776
|
+
};
|
|
1777
|
+
/** The house's Bluetooth, as a vendor whose devices can be proxies reaches it. */
|
|
1778
|
+
type BundleBluetooth = {
|
|
1779
|
+
/**
|
|
1780
|
+
* Opens a proxy's scanner, for a device whose profile declares `bluetoothProxy`. One per proxy:
|
|
1781
|
+
* opening it again replaces the first.
|
|
1782
|
+
*/
|
|
1783
|
+
readonly scanner: (options: BluetoothScannerOptions) => BluetoothScanner;
|
|
1784
|
+
};
|
|
1476
1785
|
/**
|
|
1477
1786
|
* The house's MQTT broker, as the hub reaches it: the one the hub runs, with the hub's own
|
|
1478
1787
|
* username - or the broker `NEBULA_MQTT_URL` names. Read again each time it is needed: a session
|
|
@@ -1502,7 +1811,14 @@ type PalettedPicture = {
|
|
|
1502
1811
|
/** One index into the palette per pixel, row after row from the top left. */
|
|
1503
1812
|
readonly pixels: Uint8Array;
|
|
1504
1813
|
};
|
|
1505
|
-
/**
|
|
1814
|
+
/**
|
|
1815
|
+
* The platform's infrared codec, `infrared-codes.ts`: Broadlink packets, Pronto hex, raw timings
|
|
1816
|
+
* and Flipper Zero `.ir` files read into the platform's code and written back out, and the
|
|
1817
|
+
* protocols recognised in it. A blaster's integration converts between its own format and the
|
|
1818
|
+
* code the `infrared.*` ops carry with it.
|
|
1819
|
+
*/
|
|
1820
|
+
type InfraredCodec = typeof infrared_codes_d_exports;
|
|
1821
|
+
/** What a bundle decoding what its devices send needs, and could not bring as a dependency. */
|
|
1506
1822
|
type BundleCodecs = {
|
|
1507
1823
|
/**
|
|
1508
1824
|
* Unpacks an LZMA stream in the alone format (`.lzma`): a 13-byte header - the properties and
|
|
@@ -1511,6 +1827,14 @@ type BundleCodecs = {
|
|
|
1511
1827
|
* @throws {Error} When the stream is corrupt.
|
|
1512
1828
|
*/
|
|
1513
1829
|
readonly lzma: (bytes: Uint8Array) => Buffer;
|
|
1830
|
+
/**
|
|
1831
|
+
* The infrared codec: `decodeBroadlink`, `encodeBroadlink`, `decodePronto`, `encodePronto`,
|
|
1832
|
+
* `decodeRawTimings`, `encodeRawTimings`, `parseFlipperIr`, `decodeInfraredProtocol`,
|
|
1833
|
+
* `encodeInfraredProtocol`, `withInfraredProtocol`. Handed over rather than imported because it
|
|
1834
|
+
* validates with zod, which a bundle's code reaches only as `sdk.z`; a code that does not hold
|
|
1835
|
+
* throws a `ValidationError`.
|
|
1836
|
+
*/
|
|
1837
|
+
readonly infrared: InfraredCodec;
|
|
1514
1838
|
};
|
|
1515
1839
|
/** Pictures a bundle draws, for an image entity. */
|
|
1516
1840
|
type BundleImages = {
|
|
@@ -1536,6 +1860,10 @@ type BundleSdk = {
|
|
|
1536
1860
|
readonly openMqtt: OpenMqtt;
|
|
1537
1861
|
/** A session to a Modbus server, through the hub's one connection to it. */
|
|
1538
1862
|
readonly openModbus: OpenModbus;
|
|
1863
|
+
/** A serial port a device of the vendor holds, through the Serial broker. */
|
|
1864
|
+
readonly openSerial: OpenSerial;
|
|
1865
|
+
/** The house's Bluetooth, for a vendor whose devices are proxies. */
|
|
1866
|
+
readonly bluetooth: BundleBluetooth;
|
|
1539
1867
|
/** How a camera's stream source is written, as defineTransport is for a transport. */
|
|
1540
1868
|
readonly defineStreamSource: typeof defineStreamSource;
|
|
1541
1869
|
/** An RTSP session over TCP, yielding a camera's H.264 as it comes. */
|
|
@@ -1793,8 +2121,8 @@ declare const vendorManifestSchema: z.ZodObject<{
|
|
|
1793
2121
|
}>>>;
|
|
1794
2122
|
internetRequired: z.ZodDefault<z.ZodBoolean>;
|
|
1795
2123
|
twins: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
1796
|
-
mac: "mac";
|
|
1797
2124
|
serial: "serial";
|
|
2125
|
+
mac: "mac";
|
|
1798
2126
|
}>>>;
|
|
1799
2127
|
setup: z.ZodOptional<z.ZodString>;
|
|
1800
2128
|
account: z.ZodOptional<z.ZodString>;
|
|
@@ -1805,9 +2133,12 @@ declare const vendorManifestSchema: z.ZodObject<{
|
|
|
1805
2133
|
matter: "matter";
|
|
1806
2134
|
mqtt: "mqtt";
|
|
1807
2135
|
modbus: "modbus";
|
|
2136
|
+
serial: "serial";
|
|
1808
2137
|
http: "http";
|
|
1809
2138
|
ble: "ble";
|
|
1810
2139
|
zigbee: "zigbee";
|
|
2140
|
+
thread: "thread";
|
|
2141
|
+
ir: "ir";
|
|
1811
2142
|
}>>;
|
|
1812
2143
|
}, z.core.$strict>]>>>;
|
|
1813
2144
|
streams: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
@@ -1901,6 +2232,9 @@ declare const bundleManifestSchema: z.ZodObject<{
|
|
|
1901
2232
|
matter: "matter";
|
|
1902
2233
|
mqtt: "mqtt";
|
|
1903
2234
|
modbus: "modbus";
|
|
2235
|
+
infrared: "infrared";
|
|
2236
|
+
serial: "serial";
|
|
2237
|
+
bluetooth: "bluetooth";
|
|
1904
2238
|
}>;
|
|
1905
2239
|
defaultIcon: z.ZodOptional<z.ZodString>;
|
|
1906
2240
|
webPagePort: z.ZodOptional<z.ZodInt>;
|
|
@@ -1908,6 +2242,23 @@ declare const bundleManifestSchema: z.ZodObject<{
|
|
|
1908
2242
|
profile: z.ZodOptional<z.ZodString>;
|
|
1909
2243
|
entry: z.ZodOptional<z.ZodString>;
|
|
1910
2244
|
template: z.ZodOptional<z.ZodString>;
|
|
2245
|
+
serial: z.ZodOptional<z.ZodObject<{
|
|
2246
|
+
baudRate: z.ZodInt;
|
|
2247
|
+
dataBits: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<5>, z.ZodLiteral<6>, z.ZodLiteral<7>, z.ZodLiteral<8>]>>;
|
|
2248
|
+
parity: z.ZodDefault<z.ZodEnum<{
|
|
2249
|
+
none: "none";
|
|
2250
|
+
even: "even";
|
|
2251
|
+
odd: "odd";
|
|
2252
|
+
mark: "mark";
|
|
2253
|
+
space: "space";
|
|
2254
|
+
}>>;
|
|
2255
|
+
stopBits: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<1.5>, z.ZodLiteral<2>]>>;
|
|
2256
|
+
flowControl: z.ZodDefault<z.ZodEnum<{
|
|
2257
|
+
none: "none";
|
|
2258
|
+
rtscts: "rtscts";
|
|
2259
|
+
xonxoff: "xonxoff";
|
|
2260
|
+
}>>;
|
|
2261
|
+
}, z.core.$strict>>;
|
|
1911
2262
|
setup: z.ZodString;
|
|
1912
2263
|
id: z.ZodString;
|
|
1913
2264
|
version: z.ZodString;
|
|
@@ -2087,6 +2438,58 @@ declare const vendorDiscoverySchema: z.ZodObject<{
|
|
|
2087
2438
|
options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
2088
2439
|
}, z.core.$strict>>>;
|
|
2089
2440
|
}, z.core.$strict>>;
|
|
2441
|
+
serial: z.ZodOptional<z.ZodObject<{
|
|
2442
|
+
match: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
2443
|
+
path: z.ZodString;
|
|
2444
|
+
equals: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
|
|
2445
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
2446
|
+
path: z.ZodString;
|
|
2447
|
+
exists: z.ZodLiteral<true>;
|
|
2448
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
2449
|
+
path: z.ZodString;
|
|
2450
|
+
oneOf: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
|
|
2451
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
2452
|
+
path: z.ZodString;
|
|
2453
|
+
startsWith: z.ZodString;
|
|
2454
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
2455
|
+
path: z.ZodString;
|
|
2456
|
+
endsWith: z.ZodString;
|
|
2457
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
2458
|
+
path: z.ZodString;
|
|
2459
|
+
contains: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
|
|
2460
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
2461
|
+
path: z.ZodString;
|
|
2462
|
+
min: z.ZodOptional<z.ZodNumber>;
|
|
2463
|
+
max: z.ZodOptional<z.ZodNumber>;
|
|
2464
|
+
}, z.core.$strict>]>>;
|
|
2465
|
+
model: z.ZodDefault<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
2466
|
+
}, z.core.$strict>>;
|
|
2467
|
+
bluetooth: z.ZodOptional<z.ZodObject<{
|
|
2468
|
+
match: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
2469
|
+
path: z.ZodString;
|
|
2470
|
+
equals: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
|
|
2471
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
2472
|
+
path: z.ZodString;
|
|
2473
|
+
exists: z.ZodLiteral<true>;
|
|
2474
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
2475
|
+
path: z.ZodString;
|
|
2476
|
+
oneOf: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
|
|
2477
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
2478
|
+
path: z.ZodString;
|
|
2479
|
+
startsWith: z.ZodString;
|
|
2480
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
2481
|
+
path: z.ZodString;
|
|
2482
|
+
endsWith: z.ZodString;
|
|
2483
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
2484
|
+
path: z.ZodString;
|
|
2485
|
+
contains: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
|
|
2486
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
2487
|
+
path: z.ZodString;
|
|
2488
|
+
min: z.ZodOptional<z.ZodNumber>;
|
|
2489
|
+
max: z.ZodOptional<z.ZodNumber>;
|
|
2490
|
+
}, z.core.$strict>]>>;
|
|
2491
|
+
model: z.ZodDefault<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
2492
|
+
}, z.core.$strict>>;
|
|
2090
2493
|
adopt: z.ZodDefault<z.ZodEnum<{
|
|
2091
2494
|
owner: "owner";
|
|
2092
2495
|
automatic: "automatic";
|
|
@@ -2105,6 +2508,8 @@ type DiscoveryDriver = {
|
|
|
2105
2508
|
readonly id: string;
|
|
2106
2509
|
/** The driver's own name, offered as its one model when it lists none. */
|
|
2107
2510
|
readonly name: string;
|
|
2511
|
+
/** How it is written: a `serial` driver takes the ports the Serial broker proposes. */
|
|
2512
|
+
readonly kind?: string;
|
|
2108
2513
|
/**
|
|
2109
2514
|
* What reaches its devices. A driver on a broker's transport - `matter`, `mqtt-house` - takes
|
|
2110
2515
|
* only that broker's devices, and no other driver does.
|
|
@@ -2242,6 +2647,10 @@ type LoadedBundle = {
|
|
|
2242
2647
|
readonly directory: string;
|
|
2243
2648
|
/** The template a Modbus driver reads its devices through, every entity with its id. */
|
|
2244
2649
|
readonly modbusTemplate?: ModbusTemplate;
|
|
2650
|
+
/** That its devices are IR blasters, as its profile declares: what they send, and learn. */
|
|
2651
|
+
readonly infrared?: InfraredProfile;
|
|
2652
|
+
/** That its devices can be Bluetooth proxies, as its profile declares: how they scan. */
|
|
2653
|
+
readonly bluetoothProxy?: BluetoothProxyProfile;
|
|
2245
2654
|
};
|
|
2246
2655
|
/**
|
|
2247
2656
|
* Which of the two places a vendor was read from.
|
|
@@ -2289,6 +2698,8 @@ type LoadedVendor = {
|
|
|
2289
2698
|
readonly transports: readonly string[];
|
|
2290
2699
|
/** The wires its devices are reached over, for its card: see {@link wiresOf}. */
|
|
2291
2700
|
readonly wires: readonly TransportWire[];
|
|
2701
|
+
/** What its devices can be for the brokers, for its chips: see {@link vendorRolesOf}. */
|
|
2702
|
+
readonly roles?: readonly VendorRole[];
|
|
2292
2703
|
/** The transports the vendor ships itself, ready to register: `shelly/rpc`. */
|
|
2293
2704
|
readonly ownTransports: readonly Transport[];
|
|
2294
2705
|
/** The stream sources the vendor ships, ready to register: `bambulab/camera`. */
|
|
@@ -2318,4 +2729,4 @@ type BundleFailure = {
|
|
|
2318
2729
|
readonly vendorId?: string;
|
|
2319
2730
|
};
|
|
2320
2731
|
//#endregion
|
|
2321
|
-
export {
|
|
2732
|
+
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 };
|