homey-lib 2.45.3 → 2.46.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.
Files changed (46) hide show
  1. package/.eslintignore +2 -1
  2. package/assets/app/schema.d.ts +546 -0
  3. package/assets/app/schema.json +136 -0
  4. package/assets/capability/schema.d.ts +53 -0
  5. package/helpers/index.js +21 -0
  6. package/index.js +48 -24
  7. package/lib/App/index.js +184 -5
  8. package/lib/Capability/index.js +42 -0
  9. package/lib/Device/index.js +10 -0
  10. package/lib/Energy/index.js +6 -0
  11. package/lib/Media/index.js +3 -0
  12. package/lib/Signal/index.js +25 -0
  13. package/lib/Signal/validators.js +21 -0
  14. package/lib/Util/file.js +84 -0
  15. package/lib/Util/index.js +72 -0
  16. package/lib/Util/zigbee.js +225 -0
  17. package/package.json +11 -3
  18. package/tsconfig.types.json +15 -0
  19. package/types/assets/app/schema.d.ts +546 -0
  20. package/types/assets/capability/schema.d.ts +53 -0
  21. package/types/helpers/index.d.ts +12 -0
  22. package/types/helpers/index.d.ts.map +1 -0
  23. package/types/index.d.ts +24 -0
  24. package/types/index.d.ts.map +1 -0
  25. package/types/lib/App/index.d.ts +140 -0
  26. package/types/lib/App/index.d.ts.map +1 -0
  27. package/types/lib/Capability/index.d.ts +61 -0
  28. package/types/lib/Capability/index.d.ts.map +1 -0
  29. package/types/lib/Device/index.d.ts +18 -0
  30. package/types/lib/Device/index.d.ts.map +1 -0
  31. package/types/lib/Energy/index.d.ts +12 -0
  32. package/types/lib/Energy/index.d.ts.map +1 -0
  33. package/types/lib/Media/index.d.ts +8 -0
  34. package/types/lib/Media/index.d.ts.map +1 -0
  35. package/types/lib/Signal/index.d.ts +52 -0
  36. package/types/lib/Signal/index.d.ts.map +1 -0
  37. package/types/lib/Signal/validators.d.ts +37 -0
  38. package/types/lib/Signal/validators.d.ts.map +1 -0
  39. package/types/lib/Util/file.d.ts +27 -0
  40. package/types/lib/Util/file.d.ts.map +1 -0
  41. package/types/lib/Util/index.d.ts +76 -0
  42. package/types/lib/Util/index.d.ts.map +1 -0
  43. package/types/lib/Util/zigbee.d.ts +88 -0
  44. package/types/lib/Util/zigbee.d.ts.map +1 -0
  45. package/webpack/index.js +1 -1
  46. package/webpack.config.js +1 -0
package/.eslintignore CHANGED
@@ -1,3 +1,4 @@
1
1
  /examples
2
2
  /webpack
3
- /react-native
3
+ /react-native
4
+ /types
@@ -0,0 +1,546 @@
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 Integrity = string;
84
+ export type AppSettings = (
85
+ | {
86
+ type: "text" | "password" | "textarea" | "label";
87
+ id: string;
88
+ title: I18NObject;
89
+ hint?: I18NObject;
90
+ value?: string;
91
+ pattern?: string;
92
+ [k: string]: unknown;
93
+ }
94
+ | {
95
+ type: "number" | "slider";
96
+ id: string;
97
+ title: I18NObject;
98
+ hint?: I18NObject;
99
+ value?: number;
100
+ units?: I18NObject;
101
+ min?: number;
102
+ max?: number;
103
+ step?: number;
104
+ [k: string]: unknown;
105
+ }
106
+ | {
107
+ type: "radio" | "dropdown";
108
+ id: string;
109
+ title: I18NObject;
110
+ hint?: I18NObject;
111
+ value?: string;
112
+ values: {
113
+ id: string;
114
+ title: I18NObject;
115
+ [k: string]: unknown;
116
+ }[];
117
+ [k: string]: unknown;
118
+ }
119
+ | {
120
+ type: "checkbox";
121
+ id: string;
122
+ title: I18NObject;
123
+ hint?: I18NObject;
124
+ value?: boolean;
125
+ [k: string]: unknown;
126
+ }
127
+ | {
128
+ type: "group";
129
+ title: I18NObject;
130
+ children: AppSettings;
131
+ [k: string]: unknown;
132
+ }
133
+ )[];
134
+
135
+ export interface App {
136
+ id: string;
137
+ name: I18NObject;
138
+ description?: I18NObject;
139
+ author: Author;
140
+ images?: Images;
141
+ version: string;
142
+ compatibility: string;
143
+ sdk?: number;
144
+ platforms?: ("cloud" | "local")[];
145
+ platformLocalRequiredFeatures?: ("nfc" | "speaker" | "ledring" | "matter" | "camera-streaming")[];
146
+ platformLocalOptionalFeatures?: ("nfc" | "speaker" | "ledring" | "matter" | "camera-streaming")[];
147
+ runtime?: "nodejs" | "python";
148
+ pythonVersion?: string;
149
+ pythonPackages?: string[];
150
+ tags?: I18NArray;
151
+ permissions?: string[];
152
+ bugs?: {
153
+ url?: string;
154
+ [k: string]: unknown;
155
+ };
156
+ homepage?: string;
157
+ support?: string;
158
+ source?: string;
159
+ athomForumDiscussionId?: number;
160
+ homeyCommunityTopicId?: number;
161
+ category?: string | string[];
162
+ contributors?: {
163
+ /**
164
+ * This interface was referenced by `undefined`'s JSON-Schema definition
165
+ * via the `patternProperty` "^(developers|translators)$".
166
+ */
167
+ [k: string]: Author[];
168
+ };
169
+ contributing?: {
170
+ donate?: {
171
+ githubSponsors?: {
172
+ username?: string;
173
+ };
174
+ bunq?: {
175
+ username?: string;
176
+ };
177
+ patreon?: {
178
+ username?: string;
179
+ };
180
+ paypal?: {
181
+ username?: string;
182
+ email?: string;
183
+ fundraiserCharityId?: number;
184
+ currency?: string;
185
+ };
186
+ };
187
+ [k: string]: unknown;
188
+ };
189
+ screensavers?: {
190
+ name?: string;
191
+ title?: I18NObject;
192
+ [k: string]: unknown;
193
+ }[];
194
+ capabilities?: {
195
+ /**
196
+ * This interface was referenced by `undefined`'s JSON-Schema definition
197
+ * via the `patternProperty` "^.*$".
198
+ */
199
+ [k: string]: {
200
+ [k: string]: unknown;
201
+ };
202
+ };
203
+ drivers?: {
204
+ id: string;
205
+ name: I18NObject;
206
+ class: string;
207
+ capabilities: string[];
208
+ capabilitiesOptions?: {
209
+ [k: string]: unknown;
210
+ };
211
+ images?: Images;
212
+ deprecated?: true;
213
+ discovery?: string;
214
+ energy?: {
215
+ approximation?:
216
+ | {
217
+ usageOn: number;
218
+ usageOff: number;
219
+ }
220
+ | {
221
+ usageConstant: number;
222
+ };
223
+ cumulative?: true;
224
+ cumulativeImportedCapability?: string;
225
+ cumulativeExportedCapability?: string;
226
+ electricCar?: true;
227
+ evCharger?: true;
228
+ homeBattery?: true;
229
+ meterPowerImportedCapability?: string;
230
+ meterPowerExportedCapability?: string;
231
+ /**
232
+ * @minItems 1
233
+ */
234
+ batteries?: [string, ...string[]];
235
+ [k: string]: unknown;
236
+ };
237
+ pair?: {
238
+ id: string;
239
+ template?: string;
240
+ options?: {
241
+ [k: string]: unknown;
242
+ };
243
+ navigation?: {
244
+ prev?: string;
245
+ next?: string;
246
+ [k: string]: unknown;
247
+ };
248
+ [k: string]: unknown;
249
+ }[];
250
+ settings?: DriverSettings;
251
+ firmwareUpdates?: ZigbeeFirmwareUpdates;
252
+ gtin?: string | string[];
253
+ matter?: MatterDevice;
254
+ zwave?: ZwaveDevice;
255
+ zigbee?: ZigbeeDevice;
256
+ rf433?: {
257
+ satelliteMode?: boolean;
258
+ [k: string]: unknown;
259
+ };
260
+ infrared?: {
261
+ satelliteMode?: boolean;
262
+ [k: string]: unknown;
263
+ };
264
+ platforms?: ("cloud" | "local")[];
265
+ connectivity?: ("lan" | "cloud" | "ble" | "zwave" | "zigbee" | "infrared" | "rf433" | "rf868" | "matter")[];
266
+ [k: string]: unknown;
267
+ }[];
268
+ flow?: {
269
+ triggers?: FlowCard[];
270
+ conditions?: FlowCard[];
271
+ actions?: FlowCard[];
272
+ [k: string]: unknown;
273
+ };
274
+ signals?: {
275
+ /**
276
+ * This interface was referenced by `undefined`'s JSON-Schema definition
277
+ * via the `patternProperty` "^(433|868|ir)$".
278
+ */
279
+ [k: string]: {
280
+ [k: string]: unknown;
281
+ };
282
+ };
283
+ brandColor?: string;
284
+ discovery?: {
285
+ /**
286
+ * This interface was referenced by `undefined`'s JSON-Schema definition
287
+ * via the `patternProperty` "^.*$".
288
+ */
289
+ [k: string]: {
290
+ type: "mdns-sd" | "ssdp" | "mac";
291
+ id?: string;
292
+ conditions?: {
293
+ field: string;
294
+ match: {
295
+ type: "string" | "regex";
296
+ value: string;
297
+ };
298
+ }[][];
299
+ "mdns-sd"?: {
300
+ name: string;
301
+ protocol: "tcp" | "udp";
302
+ };
303
+ ssdp?: {
304
+ search: string;
305
+ };
306
+ mac?: {
307
+ /**
308
+ * @minItems 1
309
+ * @maxItems 32
310
+ */
311
+ manufacturer: [[number, number, number], ...[number, number, number][]];
312
+ };
313
+ };
314
+ };
315
+ widgets?: {
316
+ /**
317
+ * This interface was referenced by `undefined`'s JSON-Schema definition
318
+ * via the `patternProperty` "^.*$".
319
+ */
320
+ [k: string]: {
321
+ name: I18NObject;
322
+ height?: number | string;
323
+ transparent?: boolean;
324
+ settings?: unknown[];
325
+ devices?: {
326
+ type: "global" | "app";
327
+ singular: boolean;
328
+ filter?: {
329
+ class?: string;
330
+ capabilities?: string;
331
+ [k: string]: unknown;
332
+ };
333
+ [k: string]: unknown;
334
+ };
335
+ api?: {
336
+ /**
337
+ * This interface was referenced by `undefined`'s JSON-Schema definition
338
+ * via the `patternProperty` "^.*$".
339
+ */
340
+ [k: string]: {
341
+ method: "GET" | "POST" | "PUT" | "DELETE";
342
+ path: string;
343
+ [k: string]: unknown;
344
+ };
345
+ };
346
+ id: string;
347
+ deprecated?: boolean;
348
+ [k: string]: unknown;
349
+ };
350
+ };
351
+ settings?: AppSettings;
352
+ [k: string]: unknown;
353
+ }
354
+ export interface Author {
355
+ name: string;
356
+ email?: string;
357
+ website?: string;
358
+ [k: string]: unknown;
359
+ }
360
+ export interface Images {
361
+ large: string;
362
+ small: string;
363
+ xlarge?: string;
364
+ }
365
+ export interface I18NArray {
366
+ /**
367
+ * This interface was referenced by `I18NArray`'s JSON-Schema definition
368
+ * via the `patternProperty` "^.*$".
369
+ */
370
+ [k: string]: string[];
371
+ }
372
+ export interface ZwaveSetting {
373
+ index: number;
374
+ size: 1 | 2 | 4;
375
+ signed?: boolean;
376
+ [k: string]: unknown;
377
+ }
378
+ export interface ZigbeeFirmwareUpdates {
379
+ queryNextImageTimeout?: number;
380
+ minImageBlockPeriod?: number;
381
+ maxImageBlockSize?: number;
382
+ imageBlockRequestTimeout?: number;
383
+ upgradeEndRequestTimeout?: number;
384
+ upgradeEndDelay?: number;
385
+ postUpgradeAnnounceTimeout?: number;
386
+ /**
387
+ * @minItems 1
388
+ */
389
+ updates: [ZigbeeFirmwareUpdate, ...ZigbeeFirmwareUpdate[]];
390
+ }
391
+ export interface ZigbeeFirmwareUpdate {
392
+ changelog: I18NObject;
393
+ device: ZigbeeFirmwareUpdateDevice;
394
+ /**
395
+ * @minItems 1
396
+ */
397
+ files: [ZigbeeFirmwareUpdateFile, ...ZigbeeFirmwareUpdateFile[]];
398
+ }
399
+ export interface ZigbeeFirmwareUpdateDevice {
400
+ manufacturerName: string | string[];
401
+ productId: string | string[];
402
+ }
403
+ export interface ZigbeeFirmwareUpdateFile {
404
+ fileVersion: number;
405
+ imageType: number;
406
+ manufacturerCode: number;
407
+ minFileVersion?: number;
408
+ maxFileVersion?: number;
409
+ minHardwareVersion?: number;
410
+ maxHardwareVersion?: number;
411
+ size: number;
412
+ name: string;
413
+ integrity: Integrity;
414
+ }
415
+ export interface MatterDevice {
416
+ vendorId: number | number[];
417
+ productId: number | number[];
418
+ deviceVendorId?: number | number[];
419
+ deviceProductName?: string | string[];
420
+ learnmode?: {
421
+ image?: string;
422
+ instruction: I18NObject;
423
+ [k: string]: unknown;
424
+ };
425
+ [k: string]: unknown;
426
+ }
427
+ export interface ZwaveDevice {
428
+ manufacturerId: number | number[];
429
+ productTypeId: number | number[];
430
+ productId: number | number[];
431
+ learnmode?: {
432
+ image?: string;
433
+ instruction: I18NObject;
434
+ [k: string]: unknown;
435
+ };
436
+ associationGroups?: number[];
437
+ associationGroupsMultiChannel?: number[];
438
+ associationGroupsOptions?: {
439
+ hint?: I18NObject;
440
+ [k: string]: unknown;
441
+ };
442
+ wakeUpInterval?: number;
443
+ defaultConfiguration?: {
444
+ id: number;
445
+ size: 1 | 2 | 4;
446
+ value: number | string;
447
+ multiChannelNodes?: {
448
+ [k: string]: unknown;
449
+ };
450
+ [k: string]: unknown;
451
+ }[];
452
+ [k: string]: unknown;
453
+ }
454
+ export interface ZigbeeDevice {
455
+ manufacturerName: string | string[];
456
+ productId: string | string[];
457
+ endpoints: {
458
+ [k: string]: {
459
+ clusters?: number[];
460
+ bindings?: number[];
461
+ };
462
+ };
463
+ learnmode?: {
464
+ image?: string;
465
+ instruction: I18NObject;
466
+ [k: string]: unknown;
467
+ };
468
+ [k: string]: unknown;
469
+ }
470
+ export interface FlowCard {
471
+ id: string;
472
+ title: I18NObject;
473
+ titleFormatted?: I18NObject;
474
+ deprecated?: true;
475
+ highlight?: true;
476
+ advanced?: true;
477
+ platforms?: ("cloud" | "local")[];
478
+ droptoken?: ("boolean" | "number" | "string" | "image") | ("boolean" | "number" | "string" | "image")[];
479
+ tokens?: {
480
+ name: string;
481
+ type?: "boolean" | "number" | "string" | "image";
482
+ title: I18NObject;
483
+ example?: I18NObject | number | boolean;
484
+ [k: string]: unknown;
485
+ }[];
486
+ args?: (
487
+ | {
488
+ name: string;
489
+ type: "device";
490
+ filter:
491
+ | string
492
+ | {
493
+ [k: string]: unknown;
494
+ };
495
+ [k: string]: unknown;
496
+ }
497
+ | {
498
+ title?: I18NObject;
499
+ name: string;
500
+ type: "text" | "autocomplete" | "device" | "date" | "time" | "color" | "checkbox" | "code";
501
+ placeholder?: I18NObject;
502
+ filter?:
503
+ | string
504
+ | {
505
+ [k: string]: unknown;
506
+ };
507
+ [k: string]: unknown;
508
+ }
509
+ | {
510
+ title?: I18NObject;
511
+ name: string;
512
+ type: "number" | "range";
513
+ min?: number;
514
+ max?: number;
515
+ step?: number;
516
+ label?: I18NObject;
517
+ labelMultiplier?: number;
518
+ labelDecimals?: number;
519
+ [k: string]: unknown;
520
+ }
521
+ | {
522
+ title?: I18NObject;
523
+ name: string;
524
+ type: "dropdown";
525
+ values: {
526
+ id: string;
527
+ title?: I18NObject;
528
+ [k: string]: unknown;
529
+ }[];
530
+ [k: string]: unknown;
531
+ }
532
+ | {
533
+ title?: I18NObject;
534
+ name: string;
535
+ type: "multiselect";
536
+ conjunction: "and" | "or";
537
+ values: {
538
+ id: string;
539
+ title: I18NObject;
540
+ [k: string]: unknown;
541
+ }[];
542
+ [k: string]: unknown;
543
+ }
544
+ )[];
545
+ [k: string]: unknown;
546
+ }
@@ -32,6 +32,135 @@
32
32
  },
33
33
  "additionalProperties": false
34
34
  },
35
+ "integrity": {
36
+ "type": "string",
37
+ "pattern": "^(blake2b512|blake2s256|sha256|sha384|sha512|sha512-256|sha3-256|sha3-384|sha3-512):[0-9a-fA-F]+$"
38
+ },
39
+ "zigbee-firmware-update-device": {
40
+ "type": "object",
41
+ "required": ["manufacturerName", "productId"],
42
+ "additionalProperties": false,
43
+ "properties": {
44
+ "manufacturerName": {
45
+ "oneOf": [
46
+ {
47
+ "type": "string"
48
+ },
49
+ {
50
+ "type": "array",
51
+ "items": {
52
+ "type": "string"
53
+ }
54
+ }
55
+ ]
56
+ },
57
+ "productId": {
58
+ "oneOf": [
59
+ {
60
+ "type": "string"
61
+ },
62
+ {
63
+ "type": "array",
64
+ "items": {
65
+ "type": "string"
66
+ }
67
+ }
68
+ ]
69
+ }
70
+ }
71
+ },
72
+ "zigbee-firmware-update-file": {
73
+ "type": "object",
74
+ "required": ["fileVersion", "size", "imageType", "manufacturerCode", "name", "integrity"],
75
+ "additionalProperties": false,
76
+ "properties": {
77
+ "fileVersion": {
78
+ "type": "number"
79
+ },
80
+ "imageType": {
81
+ "type": "number"
82
+ },
83
+ "manufacturerCode": {
84
+ "type": "number"
85
+ },
86
+ "minFileVersion": {
87
+ "type": "number"
88
+ },
89
+ "maxFileVersion": {
90
+ "type": "number"
91
+ },
92
+ "minHardwareVersion": {
93
+ "type": "number"
94
+ },
95
+ "maxHardwareVersion": {
96
+ "type": "number"
97
+ },
98
+ "size": {
99
+ "type": "number"
100
+ },
101
+ "name": {
102
+ "type": "string"
103
+ },
104
+ "integrity": {
105
+ "$ref": "#/definitions/integrity"
106
+ }
107
+ }
108
+ },
109
+ "zigbee-firmware-update": {
110
+ "type": "object",
111
+ "required": ["changelog", "device", "files"],
112
+ "additionalProperties": false,
113
+ "properties": {
114
+ "changelog": {
115
+ "$ref": "#/definitions/i18nObject"
116
+ },
117
+ "device": {
118
+ "$ref": "#/definitions/zigbee-firmware-update-device"
119
+ },
120
+ "files": {
121
+ "type": "array",
122
+ "minItems": 1,
123
+ "items": {
124
+ "$ref": "#/definitions/zigbee-firmware-update-file"
125
+ }
126
+ }
127
+ }
128
+ },
129
+ "zigbee-firmware-updates": {
130
+ "type": "object",
131
+ "additionalProperties": false,
132
+ "required": ["updates"],
133
+ "properties": {
134
+ "queryNextImageTimeout": {
135
+ "type": "number"
136
+ },
137
+ "minImageBlockPeriod": {
138
+ "type": "number"
139
+ },
140
+ "maxImageBlockSize": {
141
+ "type": "number"
142
+ },
143
+ "imageBlockRequestTimeout": {
144
+ "type": "number"
145
+ },
146
+ "upgradeEndRequestTimeout": {
147
+ "type": "number"
148
+ },
149
+ "upgradeEndDelay": {
150
+ "type": "number"
151
+ },
152
+ "postUpgradeAnnounceTimeout": {
153
+ "type": "number"
154
+ },
155
+ "updates": {
156
+ "type": "array",
157
+ "minItems": 1,
158
+ "items": {
159
+ "$ref": "#/definitions/zigbee-firmware-update"
160
+ }
161
+ }
162
+ }
163
+ },
35
164
  "author": {
36
165
  "required": ["name"],
37
166
  "properties": {
@@ -1316,6 +1445,13 @@
1316
1445
  "settings": {
1317
1446
  "$ref": "#/definitions/driverSettings"
1318
1447
  },
1448
+ "firmwareUpdates": {
1449
+ "oneOf": [
1450
+ {
1451
+ "$ref": "#/definitions/zigbee-firmware-updates"
1452
+ }
1453
+ ]
1454
+ },
1319
1455
  "gtin": {
1320
1456
  "oneOf": [
1321
1457
  {