homey-api 3.0.0-rc.7 → 3.0.0-rc.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,177 @@
1
1
  {
2
2
  "managers": {
3
+ "ManagerAlarms": {
4
+ "id": "alarms",
5
+ "idCamelCase": "alarms",
6
+ "items": {
7
+ "Alarm": {
8
+ "id": "alarm",
9
+ "schema": {
10
+ "repetition": {
11
+ "type": "object",
12
+ "properties": {
13
+ "required": [
14
+ "monday",
15
+ "tuesday",
16
+ "wednesday",
17
+ "thursday",
18
+ "friday",
19
+ "saturday",
20
+ "sunday"
21
+ ],
22
+ "monday": {
23
+ "type": "boolean"
24
+ },
25
+ "tuesday": {
26
+ "type": "boolean"
27
+ },
28
+ "wednesday": {
29
+ "type": "boolean"
30
+ },
31
+ "thursday": {
32
+ "type": "boolean"
33
+ },
34
+ "friday": {
35
+ "type": "boolean"
36
+ },
37
+ "saturday": {
38
+ "type": "boolean"
39
+ },
40
+ "sunday": {
41
+ "type": "boolean"
42
+ }
43
+ }
44
+ }
45
+ }
46
+ }
47
+ },
48
+ "operations": {
49
+ "getAlarms": {
50
+ "method": "get",
51
+ "path": "/alarm",
52
+ "private": false,
53
+ "scopes": [
54
+ "homey.alarm.readonly"
55
+ ],
56
+ "crud": {
57
+ "type": "getAll",
58
+ "item": "Alarm"
59
+ },
60
+ "parameters": {}
61
+ },
62
+ "getAlarm": {
63
+ "method": "get",
64
+ "path": "/alarm/:id",
65
+ "private": false,
66
+ "scopes": [
67
+ "homey.alarm.readonly"
68
+ ],
69
+ "crud": {
70
+ "type": "getOne",
71
+ "item": "Alarm"
72
+ },
73
+ "parameters": {
74
+ "id": {
75
+ "in": "path",
76
+ "type": "string",
77
+ "required": true
78
+ }
79
+ }
80
+ },
81
+ "createAlarm": {
82
+ "method": "post",
83
+ "path": "/alarm",
84
+ "private": false,
85
+ "scopes": [
86
+ "homey.alarm"
87
+ ],
88
+ "crud": {
89
+ "type": "createOne",
90
+ "item": "Alarm"
91
+ },
92
+ "parameters": {
93
+ "alarm": {
94
+ "in": "body",
95
+ "type": "object",
96
+ "root": true,
97
+ "required": true,
98
+ "properties": {
99
+ "name": {
100
+ "type": "string"
101
+ },
102
+ "time": {
103
+ "type": "string"
104
+ },
105
+ "enabled": {
106
+ "type": "boolean"
107
+ },
108
+ "repetition": {
109
+ "type": "object"
110
+ }
111
+ }
112
+ }
113
+ }
114
+ },
115
+ "updateAlarm": {
116
+ "method": "put",
117
+ "path": "/alarm/:id",
118
+ "private": false,
119
+ "scopes": [
120
+ "homey.alarm"
121
+ ],
122
+ "crud": {
123
+ "type": "updateOne",
124
+ "item": "Alarm"
125
+ },
126
+ "parameters": {
127
+ "id": {
128
+ "in": "path",
129
+ "type": "string",
130
+ "required": true
131
+ },
132
+ "alarm": {
133
+ "in": "body",
134
+ "type": "object",
135
+ "root": true,
136
+ "required": true,
137
+ "properties": {
138
+ "name": {
139
+ "type": "string"
140
+ },
141
+ "time": {
142
+ "type": "string"
143
+ },
144
+ "enabled": {
145
+ "type": "boolean"
146
+ },
147
+ "repetition": {
148
+ "type": "object"
149
+ }
150
+ }
151
+ }
152
+ }
153
+ },
154
+ "deleteAlarm": {
155
+ "method": "delete",
156
+ "path": "/alarm/:id",
157
+ "private": false,
158
+ "scopes": [
159
+ "homey.alarm"
160
+ ],
161
+ "crud": {
162
+ "type": "deleteOne",
163
+ "item": "Alarm"
164
+ },
165
+ "parameters": {
166
+ "id": {
167
+ "in": "path",
168
+ "type": "string",
169
+ "required": true
170
+ }
171
+ }
172
+ }
173
+ }
174
+ },
3
175
  "ManagerApi": {
4
176
  "id": "api",
5
177
  "idCamelCase": "api",
@@ -418,25 +590,6 @@
418
590
  "homey.system.readonly"
419
591
  ],
420
592
  "parameters": {}
421
- },
422
- "runCommand": {
423
- "method": "post",
424
- "path": "/command",
425
- "private": false,
426
- "scopes": [
427
- "homey.system"
428
- ],
429
- "parameters": {
430
- "command": {
431
- "in": "body",
432
- "type": "string",
433
- "required": true
434
- },
435
- "opts": {
436
- "in": "body",
437
- "type": "object"
438
- }
439
- }
440
593
  }
441
594
  }
442
595
  },
@@ -3562,6 +3715,21 @@
3562
3715
  "homey.system"
3563
3716
  ],
3564
3717
  "parameters": {}
3718
+ },
3719
+ "setDebug": {
3720
+ "method": "put",
3721
+ "path": "/debug",
3722
+ "private": false,
3723
+ "scopes": [
3724
+ "homey.system"
3725
+ ],
3726
+ "parameters": {
3727
+ "namespace": {
3728
+ "in": "body",
3729
+ "type": "string",
3730
+ "required": true
3731
+ }
3732
+ }
3565
3733
  }
3566
3734
  }
3567
3735
  },
@@ -4401,6 +4569,30 @@
4401
4569
  "homey.system"
4402
4570
  ],
4403
4571
  "parameters": {}
4572
+ },
4573
+ "getLog": {
4574
+ "method": "get",
4575
+ "path": "/log",
4576
+ "private": false,
4577
+ "scopes": [
4578
+ "homey.system"
4579
+ ],
4580
+ "parameters": {}
4581
+ },
4582
+ "setLogEnabled": {
4583
+ "method": "put",
4584
+ "path": "/log",
4585
+ "private": false,
4586
+ "scopes": [
4587
+ "homey.system"
4588
+ ],
4589
+ "parameters": {
4590
+ "enabled": {
4591
+ "in": "body",
4592
+ "type": "boolean",
4593
+ "required": true
4594
+ }
4595
+ }
4404
4596
  }
4405
4597
  }
4406
4598
  }
@@ -279,7 +279,7 @@
279
279
 
280
280
 
281
281
 
282
- debug: function,
282
+ debug: function | null,
283
283
 
284
284
 
285
285
  },
@@ -2224,6 +2224,22 @@
2224
2224
 
2225
2225
 
2226
2226
 
2227
+
2228
+
2229
+
2230
+
2231
+
2232
+ export namespace HomeyAPIV3Local.ManagerAlarms {
2233
+
2234
+ export class Alarm {
2235
+
2236
+
2237
+
2238
+
2239
+
2240
+ }
2241
+
2242
+ }
2227
2243
 
2228
2244
 
2229
2245
 
@@ -10281,6 +10297,150 @@
10281
10297
 
10282
10298
 
10283
10299
 
10300
+ isConnected(
10301
+
10302
+ ):
10303
+ Boolean;
10304
+
10305
+ connect(
10306
+
10307
+ ):
10308
+ Promise<void>;
10309
+
10310
+ disconnect(
10311
+
10312
+ ):
10313
+ Promise<void>;
10314
+
10315
+ }
10316
+
10317
+ export class ManagerAlarms extends HomeyAPIV3Local.Manager {
10318
+
10319
+
10320
+
10321
+
10322
+
10323
+ getAlarms(
10324
+
10325
+ ):
10326
+ Promise<HomeyAPIV3Local.ManagerAlarms.Alarm>;
10327
+
10328
+ getAlarm(
10329
+
10330
+
10331
+
10332
+
10333
+ opts: {
10334
+
10335
+
10336
+ id: string,
10337
+
10338
+
10339
+ },
10340
+
10341
+
10342
+
10343
+
10344
+ ):
10345
+ Promise<HomeyAPIV3Local.ManagerAlarms.Alarm>;
10346
+
10347
+ createAlarm(
10348
+
10349
+
10350
+
10351
+
10352
+ opts: {
10353
+
10354
+
10355
+ alarm: {
10356
+
10357
+
10358
+ name: string,
10359
+
10360
+
10361
+
10362
+ time: string,
10363
+
10364
+
10365
+
10366
+ enabled: boolean,
10367
+
10368
+
10369
+
10370
+ repetition: object,
10371
+
10372
+
10373
+ },
10374
+
10375
+
10376
+ },
10377
+
10378
+
10379
+
10380
+
10381
+ ):
10382
+ Promise<HomeyAPIV3Local.ManagerAlarms.Alarm>;
10383
+
10384
+ updateAlarm(
10385
+
10386
+
10387
+
10388
+
10389
+ opts: {
10390
+
10391
+
10392
+ id: string,
10393
+
10394
+
10395
+
10396
+ alarm: {
10397
+
10398
+
10399
+ name: string,
10400
+
10401
+
10402
+
10403
+ time: string,
10404
+
10405
+
10406
+
10407
+ enabled: boolean,
10408
+
10409
+
10410
+
10411
+ repetition: object,
10412
+
10413
+
10414
+ },
10415
+
10416
+
10417
+ },
10418
+
10419
+
10420
+
10421
+
10422
+ ):
10423
+ Promise<HomeyAPIV3Local.ManagerAlarms.Alarm>;
10424
+
10425
+ deleteAlarm(
10426
+
10427
+
10428
+
10429
+
10430
+ opts: {
10431
+
10432
+
10433
+ id: string,
10434
+
10435
+
10436
+ },
10437
+
10438
+
10439
+
10440
+
10441
+ ):
10442
+ Promise<any>;
10443
+
10284
10444
  isConnected(
10285
10445
 
10286
10446
  ):
@@ -10767,29 +10927,6 @@
10767
10927
 
10768
10928
  getState(
10769
10929
 
10770
- ):
10771
- Promise<any>;
10772
-
10773
- runCommand(
10774
-
10775
-
10776
-
10777
-
10778
- opts: {
10779
-
10780
-
10781
- command: string,
10782
-
10783
-
10784
-
10785
- opts: object,
10786
-
10787
-
10788
- },
10789
-
10790
-
10791
-
10792
-
10793
10930
  ):
10794
10931
  Promise<any>;
10795
10932
 
@@ -13735,6 +13872,25 @@
13735
13872
 
13736
13873
  rebootOTA(
13737
13874
 
13875
+ ):
13876
+ Promise<any>;
13877
+
13878
+ setDebug(
13879
+
13880
+
13881
+
13882
+
13883
+ opts: {
13884
+
13885
+
13886
+ namespace: string,
13887
+
13888
+
13889
+ },
13890
+
13891
+
13892
+
13893
+
13738
13894
  ):
13739
13895
  Promise<any>;
13740
13896
 
@@ -14480,6 +14636,30 @@
14480
14636
 
14481
14637
 
14482
14638
 
14639
+ ):
14640
+ Promise<any>;
14641
+
14642
+ getLog(
14643
+
14644
+ ):
14645
+ Promise<any>;
14646
+
14647
+ setLogEnabled(
14648
+
14649
+
14650
+
14651
+
14652
+ opts: {
14653
+
14654
+
14655
+ enabled: boolean,
14656
+
14657
+
14658
+ },
14659
+
14660
+
14661
+
14662
+
14483
14663
  ):
14484
14664
  Promise<any>;
14485
14665
 
@@ -5371,7 +5371,7 @@
5371
5371
 
5372
5372
 
5373
5373
 
5374
- debug: function,
5374
+ debug: function | null,
5375
5375
 
5376
5376
 
5377
5377
  },
@@ -7614,6 +7614,22 @@
7614
7614
 
7615
7615
 
7616
7616
 
7617
+
7618
+
7619
+
7620
+
7621
+
7622
+ export namespace HomeyAPIV3Local.ManagerAlarms {
7623
+
7624
+ export class Alarm {
7625
+
7626
+
7627
+
7628
+
7629
+
7630
+ }
7631
+
7632
+ }
7617
7633
 
7618
7634
 
7619
7635
 
@@ -16178,6 +16194,150 @@
16178
16194
 
16179
16195
 
16180
16196
 
16197
+ isConnected(
16198
+
16199
+ ):
16200
+ Boolean;
16201
+
16202
+ connect(
16203
+
16204
+ ):
16205
+ Promise<void>;
16206
+
16207
+ disconnect(
16208
+
16209
+ ):
16210
+ Promise<void>;
16211
+
16212
+ }
16213
+
16214
+ export class ManagerAlarms extends HomeyAPIV3Local.Manager {
16215
+
16216
+
16217
+
16218
+
16219
+
16220
+ getAlarms(
16221
+
16222
+ ):
16223
+ Promise<HomeyAPIV3Local.ManagerAlarms.Alarm>;
16224
+
16225
+ getAlarm(
16226
+
16227
+
16228
+
16229
+
16230
+ opts: {
16231
+
16232
+
16233
+ id: string,
16234
+
16235
+
16236
+ },
16237
+
16238
+
16239
+
16240
+
16241
+ ):
16242
+ Promise<HomeyAPIV3Local.ManagerAlarms.Alarm>;
16243
+
16244
+ createAlarm(
16245
+
16246
+
16247
+
16248
+
16249
+ opts: {
16250
+
16251
+
16252
+ alarm: {
16253
+
16254
+
16255
+ name: string,
16256
+
16257
+
16258
+
16259
+ time: string,
16260
+
16261
+
16262
+
16263
+ enabled: boolean,
16264
+
16265
+
16266
+
16267
+ repetition: object,
16268
+
16269
+
16270
+ },
16271
+
16272
+
16273
+ },
16274
+
16275
+
16276
+
16277
+
16278
+ ):
16279
+ Promise<HomeyAPIV3Local.ManagerAlarms.Alarm>;
16280
+
16281
+ updateAlarm(
16282
+
16283
+
16284
+
16285
+
16286
+ opts: {
16287
+
16288
+
16289
+ id: string,
16290
+
16291
+
16292
+
16293
+ alarm: {
16294
+
16295
+
16296
+ name: string,
16297
+
16298
+
16299
+
16300
+ time: string,
16301
+
16302
+
16303
+
16304
+ enabled: boolean,
16305
+
16306
+
16307
+
16308
+ repetition: object,
16309
+
16310
+
16311
+ },
16312
+
16313
+
16314
+ },
16315
+
16316
+
16317
+
16318
+
16319
+ ):
16320
+ Promise<HomeyAPIV3Local.ManagerAlarms.Alarm>;
16321
+
16322
+ deleteAlarm(
16323
+
16324
+
16325
+
16326
+
16327
+ opts: {
16328
+
16329
+
16330
+ id: string,
16331
+
16332
+
16333
+ },
16334
+
16335
+
16336
+
16337
+
16338
+ ):
16339
+ Promise<any>;
16340
+
16181
16341
  isConnected(
16182
16342
 
16183
16343
  ):
@@ -16664,29 +16824,6 @@
16664
16824
 
16665
16825
  getState(
16666
16826
 
16667
- ):
16668
- Promise<any>;
16669
-
16670
- runCommand(
16671
-
16672
-
16673
-
16674
-
16675
- opts: {
16676
-
16677
-
16678
- command: string,
16679
-
16680
-
16681
-
16682
- opts: object,
16683
-
16684
-
16685
- },
16686
-
16687
-
16688
-
16689
-
16690
16827
  ):
16691
16828
  Promise<any>;
16692
16829
 
@@ -19773,6 +19910,25 @@
19773
19910
 
19774
19911
  rebootOTA(
19775
19912
 
19913
+ ):
19914
+ Promise<any>;
19915
+
19916
+ setDebug(
19917
+
19918
+
19919
+
19920
+
19921
+ opts: {
19922
+
19923
+
19924
+ namespace: string,
19925
+
19926
+
19927
+ },
19928
+
19929
+
19930
+
19931
+
19776
19932
  ):
19777
19933
  Promise<any>;
19778
19934
 
@@ -20528,6 +20684,30 @@
20528
20684
 
20529
20685
  flashFirmware(
20530
20686
 
20687
+ ):
20688
+ Promise<any>;
20689
+
20690
+ getLog(
20691
+
20692
+ ):
20693
+ Promise<any>;
20694
+
20695
+ setLogEnabled(
20696
+
20697
+
20698
+
20699
+
20700
+ opts: {
20701
+
20702
+
20703
+ enabled: boolean,
20704
+
20705
+
20706
+ },
20707
+
20708
+
20709
+
20710
+
20531
20711
  ):
20532
20712
  Promise<any>;
20533
20713
 
@@ -129,18 +129,22 @@ class HomeyAPI {
129
129
  * Create a {@link HomeyAPIV3Local} instance for use in the Apps SDK.
130
130
  * @param {Object} opts
131
131
  * @param {Homey} opts.homey — Homey instance
132
- * @param {Function} opts.debug — Debug method, defaults to `homey.app.log`
132
+ * @param {Function|null} opts.debug — Debug function, defaults to `null`
133
133
  */
134
134
  static async createAppAPI({
135
135
  homey,
136
- debug = (...props) => homey.app.log('[homey-api]', ...props),
136
+ debug = null,
137
137
  } = {}) {
138
138
  if (!homey) {
139
139
  throw new Error('Invalid Homey');
140
140
  }
141
141
 
142
+ if (debug === true) {
143
+ debug = (...props) => homey.app.log('[homey-api]', ...props);
144
+ }
145
+
142
146
  const props = {
143
- debug,
147
+ debug: debug ?? function debug() { },
144
148
  token: await homey.api.getOwnerApiToken(),
145
149
  baseUrl: await homey.api.getLocalUrl(),
146
150
  strategy: [],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "homey-api",
3
- "version": "3.0.0-rc.7",
3
+ "version": "3.0.0-rc.9",
4
4
  "description": "Homey API",
5
5
  "main": "index.js",
6
6
  "files": [