homey-lib 2.45.2 → 2.45.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/.eslintignore +2 -1
  2. package/assets/app/schema.d.ts +507 -0
  3. package/assets/capability/schema.d.ts +53 -0
  4. package/helpers/index.js +11 -0
  5. package/index.js +47 -24
  6. package/lib/App/index.js +125 -7
  7. package/lib/Capability/index.js +42 -0
  8. package/lib/Device/index.js +10 -0
  9. package/lib/Energy/index.js +6 -0
  10. package/lib/Media/index.js +3 -0
  11. package/lib/Signal/index.js +25 -0
  12. package/lib/Signal/validators.js +21 -0
  13. package/lib/Util/index.js +10 -0
  14. package/package.json +11 -3
  15. package/tsconfig.types.json +15 -0
  16. package/types/assets/app/schema.d.ts +507 -0
  17. package/types/assets/capability/schema.d.ts +53 -0
  18. package/types/helpers/index.d.ts +11 -0
  19. package/types/helpers/index.d.ts.map +1 -0
  20. package/types/index.d.ts +23 -0
  21. package/types/index.d.ts.map +1 -0
  22. package/types/lib/App/index.d.ts +140 -0
  23. package/types/lib/App/index.d.ts.map +1 -0
  24. package/types/lib/Capability/index.d.ts +61 -0
  25. package/types/lib/Capability/index.d.ts.map +1 -0
  26. package/types/lib/Device/index.d.ts +18 -0
  27. package/types/lib/Device/index.d.ts.map +1 -0
  28. package/types/lib/Energy/index.d.ts +12 -0
  29. package/types/lib/Energy/index.d.ts.map +1 -0
  30. package/types/lib/Media/index.d.ts +8 -0
  31. package/types/lib/Media/index.d.ts.map +1 -0
  32. package/types/lib/Signal/index.d.ts +52 -0
  33. package/types/lib/Signal/index.d.ts.map +1 -0
  34. package/types/lib/Signal/validators.d.ts +37 -0
  35. package/types/lib/Signal/validators.d.ts.map +1 -0
  36. package/types/lib/Util/index.d.ts +23 -0
  37. package/types/lib/Util/index.d.ts.map +1 -0
  38. package/webpack/index.js +1 -1
@@ -0,0 +1,507 @@
1
+ /* eslint-disable */
2
+ /**
3
+ * This file was automatically generated by json-schema-to-typescript.
4
+ * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
5
+ * and run json-schema-to-typescript to regenerate this file.
6
+ */
7
+
8
+ export type I18NObject =
9
+ | string
10
+ | {
11
+ /**
12
+ * This interface was referenced by `undefined`'s JSON-Schema definition
13
+ * via the `patternProperty` "^.*$".
14
+ */
15
+ [k: string]: string;
16
+ };
17
+ export type DriverSettings = (
18
+ | {
19
+ type: "text" | "password" | "textarea" | "label";
20
+ id: string | number;
21
+ label: I18NObject;
22
+ hint?: I18NObject;
23
+ value?: string;
24
+ pattern?: string;
25
+ highlight?: true;
26
+ zwave?: ZwaveSetting;
27
+ [k: string]: unknown;
28
+ }
29
+ | {
30
+ type: "number" | "slider";
31
+ id: string | number;
32
+ label: I18NObject;
33
+ hint?: I18NObject;
34
+ value?: number;
35
+ units?: I18NObject;
36
+ attr?: {
37
+ min?: number;
38
+ max?: number;
39
+ step?: number;
40
+ [k: string]: unknown;
41
+ };
42
+ min?: number;
43
+ max?: number;
44
+ step?: number;
45
+ highlight?: true;
46
+ zwave?: ZwaveSetting;
47
+ [k: string]: unknown;
48
+ }
49
+ | {
50
+ type: "radio" | "dropdown";
51
+ id: string | number;
52
+ label: I18NObject;
53
+ hint?: I18NObject;
54
+ value?: string;
55
+ values: {
56
+ id: string;
57
+ label: I18NObject;
58
+ [k: string]: unknown;
59
+ }[];
60
+ highlight?: true;
61
+ zwave?: ZwaveSetting;
62
+ [k: string]: unknown;
63
+ }
64
+ | {
65
+ type: "checkbox";
66
+ id: string | number;
67
+ label: I18NObject;
68
+ hint?: I18NObject;
69
+ value?: boolean;
70
+ highlight?: true;
71
+ zwave?: ZwaveSetting;
72
+ [k: string]: unknown;
73
+ }
74
+ | {
75
+ type: "group";
76
+ label: I18NObject;
77
+ children: DriverSettings;
78
+ highlight?: true;
79
+ zwave?: ZwaveSetting;
80
+ [k: string]: unknown;
81
+ }
82
+ )[];
83
+ export type AppSettings = (
84
+ | {
85
+ type: "text" | "password" | "textarea" | "label";
86
+ id: string;
87
+ title: I18NObject;
88
+ hint?: I18NObject;
89
+ value?: string;
90
+ pattern?: string;
91
+ [k: string]: unknown;
92
+ }
93
+ | {
94
+ type: "number" | "slider";
95
+ id: string;
96
+ title: I18NObject;
97
+ hint?: I18NObject;
98
+ value?: number;
99
+ units?: I18NObject;
100
+ min?: number;
101
+ max?: number;
102
+ step?: number;
103
+ [k: string]: unknown;
104
+ }
105
+ | {
106
+ type: "radio" | "dropdown";
107
+ id: string;
108
+ title: I18NObject;
109
+ hint?: I18NObject;
110
+ value?: string;
111
+ values: {
112
+ id: string;
113
+ title: I18NObject;
114
+ [k: string]: unknown;
115
+ }[];
116
+ [k: string]: unknown;
117
+ }
118
+ | {
119
+ type: "checkbox";
120
+ id: string;
121
+ title: I18NObject;
122
+ hint?: I18NObject;
123
+ value?: boolean;
124
+ [k: string]: unknown;
125
+ }
126
+ | {
127
+ type: "group";
128
+ title: I18NObject;
129
+ children: AppSettings;
130
+ [k: string]: unknown;
131
+ }
132
+ )[];
133
+
134
+ export interface App {
135
+ id: string;
136
+ name: I18NObject;
137
+ description?: I18NObject;
138
+ author: Author;
139
+ images?: Images;
140
+ version: string;
141
+ compatibility: string;
142
+ sdk?: number;
143
+ platforms?: ("cloud" | "local")[];
144
+ platformLocalRequiredFeatures?: ("nfc" | "speaker" | "ledring" | "matter" | "camera-streaming")[];
145
+ platformLocalOptionalFeatures?: ("nfc" | "speaker" | "ledring" | "matter" | "camera-streaming")[];
146
+ runtime?: "nodejs" | "python";
147
+ pythonVersion?: string;
148
+ pythonPackages?: string[];
149
+ tags?: I18NArray;
150
+ permissions?: string[];
151
+ bugs?: {
152
+ url?: string;
153
+ [k: string]: unknown;
154
+ };
155
+ homepage?: string;
156
+ support?: string;
157
+ source?: string;
158
+ athomForumDiscussionId?: number;
159
+ homeyCommunityTopicId?: number;
160
+ category?: string | string[];
161
+ contributors?: {
162
+ /**
163
+ * This interface was referenced by `undefined`'s JSON-Schema definition
164
+ * via the `patternProperty` "^(developers|translators)$".
165
+ */
166
+ [k: string]: Author[];
167
+ };
168
+ contributing?: {
169
+ donate?: {
170
+ githubSponsors?: {
171
+ username?: string;
172
+ };
173
+ bunq?: {
174
+ username?: string;
175
+ };
176
+ patreon?: {
177
+ username?: string;
178
+ };
179
+ paypal?: {
180
+ username?: string;
181
+ email?: string;
182
+ fundraiserCharityId?: number;
183
+ currency?: string;
184
+ };
185
+ };
186
+ [k: string]: unknown;
187
+ };
188
+ screensavers?: {
189
+ name?: string;
190
+ title?: I18NObject;
191
+ [k: string]: unknown;
192
+ }[];
193
+ capabilities?: {
194
+ /**
195
+ * This interface was referenced by `undefined`'s JSON-Schema definition
196
+ * via the `patternProperty` "^.*$".
197
+ */
198
+ [k: string]: {
199
+ [k: string]: unknown;
200
+ };
201
+ };
202
+ drivers?: {
203
+ id: string;
204
+ name: I18NObject;
205
+ class: string;
206
+ capabilities: string[];
207
+ capabilitiesOptions?: {
208
+ [k: string]: unknown;
209
+ };
210
+ images?: Images;
211
+ deprecated?: true;
212
+ discovery?: string;
213
+ energy?: {
214
+ approximation?:
215
+ | {
216
+ usageOn: number;
217
+ usageOff: number;
218
+ }
219
+ | {
220
+ usageConstant: number;
221
+ };
222
+ cumulative?: true;
223
+ cumulativeImportedCapability?: string;
224
+ cumulativeExportedCapability?: string;
225
+ electricCar?: true;
226
+ evCharger?: true;
227
+ homeBattery?: true;
228
+ meterPowerImportedCapability?: string;
229
+ meterPowerExportedCapability?: string;
230
+ /**
231
+ * @minItems 1
232
+ */
233
+ batteries?: [string, ...string[]];
234
+ [k: string]: unknown;
235
+ };
236
+ pair?: {
237
+ id: string;
238
+ template?: string;
239
+ options?: {
240
+ [k: string]: unknown;
241
+ };
242
+ navigation?: {
243
+ prev?: string;
244
+ next?: string;
245
+ [k: string]: unknown;
246
+ };
247
+ [k: string]: unknown;
248
+ }[];
249
+ settings?: DriverSettings;
250
+ gtin?: string | string[];
251
+ matter?: MatterDevice;
252
+ zwave?: ZwaveDevice;
253
+ zigbee?: ZigbeeDevice;
254
+ rf433?: {
255
+ satelliteMode?: boolean;
256
+ [k: string]: unknown;
257
+ };
258
+ infrared?: {
259
+ satelliteMode?: boolean;
260
+ [k: string]: unknown;
261
+ };
262
+ platforms?: ("cloud" | "local")[];
263
+ connectivity?: ("lan" | "cloud" | "ble" | "zwave" | "zigbee" | "infrared" | "rf433" | "rf868" | "matter")[];
264
+ [k: string]: unknown;
265
+ }[];
266
+ flow?: {
267
+ triggers?: FlowCard[];
268
+ conditions?: FlowCard[];
269
+ actions?: FlowCard[];
270
+ [k: string]: unknown;
271
+ };
272
+ signals?: {
273
+ /**
274
+ * This interface was referenced by `undefined`'s JSON-Schema definition
275
+ * via the `patternProperty` "^(433|868|ir)$".
276
+ */
277
+ [k: string]: {
278
+ [k: string]: unknown;
279
+ };
280
+ };
281
+ brandColor?: string;
282
+ discovery?: {
283
+ /**
284
+ * This interface was referenced by `undefined`'s JSON-Schema definition
285
+ * via the `patternProperty` "^.*$".
286
+ */
287
+ [k: string]: {
288
+ type: "mdns-sd" | "ssdp" | "mac";
289
+ id?: string;
290
+ conditions?: {
291
+ field: string;
292
+ match: {
293
+ type: "string" | "regex";
294
+ value: string;
295
+ };
296
+ }[][];
297
+ "mdns-sd"?: {
298
+ name: string;
299
+ protocol: "tcp" | "udp";
300
+ };
301
+ ssdp?: {
302
+ search: string;
303
+ };
304
+ mac?: {
305
+ /**
306
+ * @minItems 1
307
+ * @maxItems 32
308
+ */
309
+ manufacturer: [[number, number, number], ...[number, number, number][]];
310
+ };
311
+ };
312
+ };
313
+ widgets?: {
314
+ /**
315
+ * This interface was referenced by `undefined`'s JSON-Schema definition
316
+ * via the `patternProperty` "^.*$".
317
+ */
318
+ [k: string]: {
319
+ name: I18NObject;
320
+ height?: number | string;
321
+ transparent?: boolean;
322
+ settings?: unknown[];
323
+ devices?: {
324
+ type: "global" | "app";
325
+ singular: boolean;
326
+ filter?: {
327
+ class?: string;
328
+ capabilities?: string;
329
+ [k: string]: unknown;
330
+ };
331
+ [k: string]: unknown;
332
+ };
333
+ api?: {
334
+ /**
335
+ * This interface was referenced by `undefined`'s JSON-Schema definition
336
+ * via the `patternProperty` "^.*$".
337
+ */
338
+ [k: string]: {
339
+ method: "GET" | "POST" | "PUT" | "DELETE";
340
+ path: string;
341
+ [k: string]: unknown;
342
+ };
343
+ };
344
+ id: string;
345
+ deprecated?: boolean;
346
+ [k: string]: unknown;
347
+ };
348
+ };
349
+ settings?: AppSettings;
350
+ [k: string]: unknown;
351
+ }
352
+ export interface Author {
353
+ name: string;
354
+ email?: string;
355
+ website?: string;
356
+ [k: string]: unknown;
357
+ }
358
+ export interface Images {
359
+ large: string;
360
+ small: string;
361
+ xlarge?: string;
362
+ }
363
+ export interface I18NArray {
364
+ /**
365
+ * This interface was referenced by `I18NArray`'s JSON-Schema definition
366
+ * via the `patternProperty` "^.*$".
367
+ */
368
+ [k: string]: string[];
369
+ }
370
+ export interface ZwaveSetting {
371
+ index: number;
372
+ size: 1 | 2 | 4;
373
+ signed?: boolean;
374
+ [k: string]: unknown;
375
+ }
376
+ export interface MatterDevice {
377
+ vendorId: number | number[];
378
+ productId: number | number[];
379
+ deviceVendorId?: number | number[];
380
+ deviceProductName?: string | string[];
381
+ learnmode?: {
382
+ image?: string;
383
+ instruction: I18NObject;
384
+ [k: string]: unknown;
385
+ };
386
+ [k: string]: unknown;
387
+ }
388
+ export interface ZwaveDevice {
389
+ manufacturerId: number | number[];
390
+ productTypeId: number | number[];
391
+ productId: number | number[];
392
+ learnmode?: {
393
+ image?: string;
394
+ instruction: I18NObject;
395
+ [k: string]: unknown;
396
+ };
397
+ associationGroups?: number[];
398
+ associationGroupsMultiChannel?: number[];
399
+ associationGroupsOptions?: {
400
+ hint?: I18NObject;
401
+ [k: string]: unknown;
402
+ };
403
+ wakeUpInterval?: number;
404
+ defaultConfiguration?: {
405
+ id: number;
406
+ size: 1 | 2 | 4;
407
+ value: number | string;
408
+ multiChannelNodes?: {
409
+ [k: string]: unknown;
410
+ };
411
+ [k: string]: unknown;
412
+ }[];
413
+ [k: string]: unknown;
414
+ }
415
+ export interface ZigbeeDevice {
416
+ manufacturerName: string | string[];
417
+ productId: string | string[];
418
+ endpoints: {
419
+ [k: string]: {
420
+ clusters?: number[];
421
+ bindings?: number[];
422
+ };
423
+ };
424
+ learnmode?: {
425
+ image?: string;
426
+ instruction: I18NObject;
427
+ [k: string]: unknown;
428
+ };
429
+ [k: string]: unknown;
430
+ }
431
+ export interface FlowCard {
432
+ id: string;
433
+ title: I18NObject;
434
+ titleFormatted?: I18NObject;
435
+ deprecated?: true;
436
+ highlight?: true;
437
+ advanced?: true;
438
+ platforms?: ("cloud" | "local")[];
439
+ droptoken?: ("boolean" | "number" | "string" | "image") | ("boolean" | "number" | "string" | "image")[];
440
+ tokens?: {
441
+ name: string;
442
+ type?: "boolean" | "number" | "string" | "image";
443
+ title: I18NObject;
444
+ example?: I18NObject | number | boolean;
445
+ [k: string]: unknown;
446
+ }[];
447
+ args?: (
448
+ | {
449
+ name: string;
450
+ type: "device";
451
+ filter:
452
+ | string
453
+ | {
454
+ [k: string]: unknown;
455
+ };
456
+ [k: string]: unknown;
457
+ }
458
+ | {
459
+ title?: I18NObject;
460
+ name: string;
461
+ type: "text" | "autocomplete" | "device" | "date" | "time" | "color" | "checkbox" | "code";
462
+ placeholder?: I18NObject;
463
+ filter?:
464
+ | string
465
+ | {
466
+ [k: string]: unknown;
467
+ };
468
+ [k: string]: unknown;
469
+ }
470
+ | {
471
+ title?: I18NObject;
472
+ name: string;
473
+ type: "number" | "range";
474
+ min?: number;
475
+ max?: number;
476
+ step?: number;
477
+ label?: I18NObject;
478
+ labelMultiplier?: number;
479
+ labelDecimals?: number;
480
+ [k: string]: unknown;
481
+ }
482
+ | {
483
+ title?: I18NObject;
484
+ name: string;
485
+ type: "dropdown";
486
+ values: {
487
+ id: string;
488
+ title?: I18NObject;
489
+ [k: string]: unknown;
490
+ }[];
491
+ [k: string]: unknown;
492
+ }
493
+ | {
494
+ title?: I18NObject;
495
+ name: string;
496
+ type: "multiselect";
497
+ conjunction: "and" | "or";
498
+ values: {
499
+ id: string;
500
+ title: I18NObject;
501
+ [k: string]: unknown;
502
+ }[];
503
+ [k: string]: unknown;
504
+ }
505
+ )[];
506
+ [k: string]: unknown;
507
+ }
@@ -0,0 +1,53 @@
1
+ /* eslint-disable */
2
+ /**
3
+ * This file was automatically generated by json-schema-to-typescript.
4
+ * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
5
+ * and run json-schema-to-typescript to regenerate this file.
6
+ */
7
+
8
+ export type Capability = {
9
+ [k: string]: unknown;
10
+ } & {
11
+ title: I18NObject;
12
+ desc?: I18NObject;
13
+ type: "boolean" | "number" | "string" | "enum";
14
+ getable?: boolean;
15
+ setable?: boolean;
16
+ icon?: string;
17
+ insights?: boolean;
18
+ insightsTitleTrue?: I18NObject;
19
+ insightsTitleFalse?: I18NObject;
20
+ chartType?: "line" | "area" | "stepLine" | "column" | "spline" | "splineArea" | "scatter";
21
+ decimals?: number;
22
+ min?: number;
23
+ max?: number;
24
+ step?: number;
25
+ units?: I18NObject;
26
+ values?: {
27
+ id: string;
28
+ title: I18NObject;
29
+ [k: string]: unknown;
30
+ }[];
31
+ uiComponent?:
32
+ | ("thermostat" | "media" | "toggle" | "slider" | "ternary" | "button" | "color" | "picker" | "sensor" | "battery")
33
+ | null;
34
+ [k: string]: unknown;
35
+ } & (
36
+ | {
37
+ type?: "enum";
38
+ [k: string]: unknown;
39
+ }
40
+ | {
41
+ type?: "boolean" | "number" | "string";
42
+ [k: string]: unknown;
43
+ }
44
+ );
45
+ export type I18NObject =
46
+ | string
47
+ | {
48
+ /**
49
+ * This interface was referenced by `undefined`'s JSON-Schema definition
50
+ * via the `patternProperty` "^.*$".
51
+ */
52
+ [k: string]: string;
53
+ };
@@ -0,0 +1,11 @@
1
+ export const openAsync: typeof fs.open.__promisify__;
2
+ export const closeAsync: typeof fs.close.__promisify__;
3
+ export const readAsync: typeof fs.read.__promisify__;
4
+ export const statAsync: typeof fs.stat.__promisify__;
5
+ export const readFileAsync: typeof fs.readFile.__promisify__;
6
+ export const readDirAsync: typeof fs.readdir.__promisify__;
7
+ export const lstatAsync: typeof fs.lstat.__promisify__;
8
+ export const imageSizeAsync: Function;
9
+ import fs = require("fs");
10
+ export { join, extname, basename, dirname };
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../helpers/index.js"],"names":[],"mappings":"wBAWe,4BAA4B;yBAE5B,6BAA6B;wBAE7B,4BAA4B;wBAE5B,4BAA4B;4BAE5B,gCAAgC;2BAEhC,+BAA+B;yBAE/B,6BAA6B"}
@@ -0,0 +1,23 @@
1
+ export const getDeviceClasses: typeof Device.getClasses;
2
+ export const getDeviceClass: typeof Device.getClass;
3
+ export const getCapabilities: typeof Capability.getCapabilities;
4
+ export const getCapability: typeof Capability.getCapability;
5
+ export const hasCapability: typeof Capability.hasCapability;
6
+ export const getAppLocales: typeof App.getLocales;
7
+ export const getAppCategories: typeof App.getCategories;
8
+ export const getAppPermissions: typeof App.getPermissions;
9
+ export const getAppBrandColor: typeof App.getBrandColor;
10
+ export const getMediaCodecs: typeof Media.getCodecs;
11
+ export const getCurrencies: typeof Energy.getCurrencies;
12
+ export const getBatteries: typeof Energy.getBatteries;
13
+ export type AppManifest = import("./assets/app/schema").App;
14
+ export type CapabilityDefinition = import("./assets/capability/schema").Capability;
15
+ import App = require("./lib/App");
16
+ import Capability = require("./lib/Capability");
17
+ import Device = require("./lib/Device");
18
+ import Energy = require("./lib/Energy");
19
+ import Media = require("./lib/Media");
20
+ import Signal = require("./lib/Signal");
21
+ import Util = require("./lib/Util");
22
+ export { App, Capability, Device, Energy, Media, Signal, Util };
23
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.js"],"names":[],"mappings":"+BAkBW,OAAO,MAAM,CAAC,UAAU;6BAExB,OAAO,MAAM,CAAC,QAAQ;8BAGtB,OAAO,UAAU,CAAC,eAAe;4BAEjC,OAAO,UAAU,CAAC,aAAa;4BAE/B,OAAO,UAAU,CAAC,aAAa;4BAG/B,OAAO,GAAG,CAAC,UAAU;+BAErB,OAAO,GAAG,CAAC,aAAa;gCAExB,OAAO,GAAG,CAAC,cAAc;+BAEzB,OAAO,GAAG,CAAC,aAAa;6BAGxB,OAAO,KAAK,CAAC,SAAS;4BAGtB,OAAO,MAAM,CAAC,aAAa;2BAE3B,OAAO,MAAM,CAAC,YAAY;0BAGvB,OAAO,qBAAqB,EAAE,GAAG;mCACjC,OAAO,4BAA4B,EAAE,UAAU"}