homey-api 1.5.25 → 1.5.28

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.
@@ -837,6 +837,23 @@
837
837
  }
838
838
  }
839
839
  },
840
+ "addHomeyLicense": {
841
+ "path": "/homey/{homeyId}/license/{license}",
842
+ "method": "post",
843
+ "private": true,
844
+ "parameters": {
845
+ "homeyId": {
846
+ "in": "path",
847
+ "type": "string",
848
+ "required": true
849
+ },
850
+ "license": {
851
+ "in": "path",
852
+ "type": "string",
853
+ "required": true
854
+ }
855
+ }
856
+ },
840
857
  "createHomeyUser": {
841
858
  "path": "/homey/{homeyId}/user",
842
859
  "method": "post",
@@ -329,6 +329,32 @@
329
329
  }
330
330
  }
331
331
  },
332
+ "deferSubscription": {
333
+ "path": "/subscription/defer",
334
+ "method": "post",
335
+ "parameters": {
336
+ "sku": {
337
+ "type": "string",
338
+ "in": "body"
339
+ },
340
+ "packageName": {
341
+ "type": "string",
342
+ "in": "body"
343
+ },
344
+ "athomId": {
345
+ "type": "string",
346
+ "in": "body"
347
+ },
348
+ "quantity": {
349
+ "type": "number",
350
+ "in": "body"
351
+ },
352
+ "duration": {
353
+ "type": "string",
354
+ "in": "body"
355
+ }
356
+ }
357
+ },
332
358
  "getExpiredSubscriptions": {
333
359
  "path": "/subscription/expired",
334
360
  "method": "post",
@@ -2459,6 +2459,10 @@
2459
2459
  "x-homey-readonly": true,
2460
2460
  "type": "boolean"
2461
2461
  },
2462
+ "triggerable": {
2463
+ "x-homey-readonly": true,
2464
+ "type": "boolean"
2465
+ },
2462
2466
  "trigger": {
2463
2467
  "type": "object",
2464
2468
  "required": [
@@ -2863,6 +2867,10 @@
2863
2867
  "x-homey-readonly": true,
2864
2868
  "type": "boolean"
2865
2869
  },
2870
+ "triggerable": {
2871
+ "x-homey-readonly": true,
2872
+ "type": "boolean"
2873
+ },
2866
2874
  "folder": {
2867
2875
  "type": [
2868
2876
  "string",
@@ -2906,6 +2914,25 @@
2906
2914
  }
2907
2915
  },
2908
2916
  "operations": {
2917
+ "triggerAdvancedFlow": {
2918
+ "method": "POST",
2919
+ "path": "/advancedflow/:id/trigger",
2920
+ "private": false,
2921
+ "scopes": [
2922
+ "homey.flow.start"
2923
+ ],
2924
+ "parameters": {
2925
+ "id": {
2926
+ "in": "path",
2927
+ "required": true,
2928
+ "type": "string"
2929
+ },
2930
+ "state": {
2931
+ "in": "body",
2932
+ "root": true
2933
+ }
2934
+ }
2935
+ },
2909
2936
  "deleteAdvancedFlow": {
2910
2937
  "method": "DELETE",
2911
2938
  "path": "/advancedflow/:id",
@@ -5375,6 +5402,24 @@
5375
5402
  ],
5376
5403
  "parameters": {}
5377
5404
  },
5405
+ "stopCPUProfile": {
5406
+ "method": "POST",
5407
+ "path": "/cpuprofile/stop",
5408
+ "private": true,
5409
+ "scopes": [
5410
+ "homey.system.readonly"
5411
+ ],
5412
+ "parameters": {}
5413
+ },
5414
+ "startCPUProfile": {
5415
+ "method": "POST",
5416
+ "path": "/cpuprofile/start",
5417
+ "private": true,
5418
+ "scopes": [
5419
+ "homey.system.readonly"
5420
+ ],
5421
+ "parameters": {}
5422
+ },
5378
5423
  "createHeapdump": {
5379
5424
  "method": "POST",
5380
5425
  "path": "/heapdump",
@@ -1210,6 +1210,8 @@
1210
1210
 
1211
1211
  broken: boolean;
1212
1212
 
1213
+ triggerable: boolean;
1214
+
1213
1215
  folder: string | null;
1214
1216
 
1215
1217
  cards: object;
@@ -1234,6 +1236,8 @@
1234
1236
 
1235
1237
  broken: boolean;
1236
1238
 
1239
+ triggerable: boolean;
1240
+
1237
1241
  trigger: object;
1238
1242
 
1239
1243
  conditions: Array<any>;
@@ -6641,6 +6645,29 @@
6641
6645
 
6642
6646
 
6643
6647
 
6648
+ triggerAdvancedFlow(
6649
+
6650
+
6651
+
6652
+
6653
+ opts: {
6654
+
6655
+
6656
+ id: string,
6657
+
6658
+
6659
+
6660
+ state: *,
6661
+
6662
+
6663
+ },
6664
+
6665
+
6666
+
6667
+
6668
+ ):
6669
+ Promise<any>;
6670
+
6644
6671
  deleteAdvancedFlow(
6645
6672
 
6646
6673
 
@@ -2534,6 +2534,29 @@
2534
2534
 
2535
2535
 
2536
2536
 
2537
+ ):
2538
+ Promise<any>;
2539
+
2540
+ addHomeyLicense(
2541
+
2542
+
2543
+
2544
+
2545
+ opts: {
2546
+
2547
+
2548
+ homeyId: string,
2549
+
2550
+
2551
+
2552
+ license: string,
2553
+
2554
+
2555
+ },
2556
+
2557
+
2558
+
2559
+
2537
2560
  ):
2538
2561
  Promise<any>;
2539
2562
 
@@ -4619,6 +4642,41 @@
4619
4642
 
4620
4643
 
4621
4644
 
4645
+ ):
4646
+ Promise<any>;
4647
+
4648
+ deferSubscription(
4649
+
4650
+
4651
+
4652
+
4653
+ opts: {
4654
+
4655
+
4656
+ sku: string,
4657
+
4658
+
4659
+
4660
+ packageName: string,
4661
+
4662
+
4663
+
4664
+ athomId: string,
4665
+
4666
+
4667
+
4668
+ quantity: number,
4669
+
4670
+
4671
+
4672
+ duration: string,
4673
+
4674
+
4675
+ },
4676
+
4677
+
4678
+
4679
+
4622
4680
  ):
4623
4681
  Promise<any>;
4624
4682
 
@@ -5532,6 +5590,19 @@
5532
5590
  ):
5533
5591
  string;
5534
5592
 
5593
+ promiseAny(
5594
+
5595
+
5596
+
5597
+
5598
+ promises: Array<Promise>,
5599
+
5600
+
5601
+
5602
+
5603
+ ):
5604
+ Promise<any>;
5605
+
5535
5606
  }
5536
5607
 
5537
5608
 
@@ -6299,6 +6370,8 @@
6299
6370
 
6300
6371
  broken: boolean;
6301
6372
 
6373
+ triggerable: boolean;
6374
+
6302
6375
  folder: string | null;
6303
6376
 
6304
6377
  cards: object;
@@ -6323,6 +6396,8 @@
6323
6396
 
6324
6397
  broken: boolean;
6325
6398
 
6399
+ triggerable: boolean;
6400
+
6326
6401
  trigger: object;
6327
6402
 
6328
6403
  conditions: Array<any>;
@@ -12078,6 +12153,29 @@
12078
12153
 
12079
12154
 
12080
12155
 
12156
+ triggerAdvancedFlow(
12157
+
12158
+
12159
+
12160
+
12161
+ opts: {
12162
+
12163
+
12164
+ id: string,
12165
+
12166
+
12167
+
12168
+ state: *,
12169
+
12170
+
12171
+ },
12172
+
12173
+
12174
+
12175
+
12176
+ ):
12177
+ Promise<any>;
12178
+
12081
12179
  deleteAdvancedFlow(
12082
12180
 
12083
12181
 
@@ -14223,6 +14321,16 @@
14223
14321
 
14224
14322
  runGC(
14225
14323
 
14324
+ ):
14325
+ Promise<any>;
14326
+
14327
+ stopCPUProfile(
14328
+
14329
+ ):
14330
+ Promise<any>;
14331
+
14332
+ startCPUProfile(
14333
+
14226
14334
  ):
14227
14335
  Promise<any>;
14228
14336
 
@@ -416,8 +416,8 @@ class Manager extends EventEmitter {
416
416
  this.__debug('onConnect');
417
417
  this.__connected = true;
418
418
  },
419
- onDisconnect: () => {
420
- this.__debug('onDisconnect');
419
+ onDisconnect: reason => {
420
+ this.__debug(`onDisconnect Reason:${reason}`);
421
421
  this.__connected = false;
422
422
 
423
423
  // Clear CRUD Item cache
@@ -505,8 +505,8 @@ class HomeyAPIV2 extends HomeyAPI {
505
505
  onConnect();
506
506
 
507
507
  // On Disconnect
508
- const __onDisconnect = () => {
509
- onDisconnect();
508
+ const __onDisconnect = reason => {
509
+ onDisconnect(reason);
510
510
  };
511
511
  this.__io.on('disconnect', __onDisconnect);
512
512
 
@@ -550,6 +550,7 @@ class HomeyAPIV2 extends HomeyAPI {
550
550
  return new Promise((resolve, reject) => {
551
551
  this.__debug(`SocketIOClient ${baseUrl}`);
552
552
  this.__io = SocketIOClient(baseUrl, {
553
+ autoConnect: false,
553
554
  transports: ['websocket'],
554
555
  transportOptions: {
555
556
  pingTimeout: 8000,
@@ -607,6 +608,7 @@ class HomeyAPIV2 extends HomeyAPI {
607
608
  reject(err);
608
609
  });
609
610
  });
611
+ this.__io.connect();
610
612
  });
611
613
  });
612
614
  this.io.catch(err => {
@@ -667,28 +669,29 @@ class HomeyAPIV2 extends HomeyAPI {
667
669
  throw err;
668
670
  })
669
671
  .then(({ namespace }) => {
672
+ this.__debug('SocketIOClient.onHandshakeClientSuccess', `Namespace: ${namespace}`);
673
+
670
674
  return new Promise((resolve, reject) => {
671
- this.__debug('SocketIOClient.onHandshakeClientSuccess', `Namespace: ${namespace}`);
672
675
  this.__ioNamespace = this.__io.io.socket(namespace);
673
676
  this.__ioNamespace.once('connect', () => {
674
- this.__debug('SocketIOClient.Namespace.onConnect');
677
+ this.__debug(`SocketIOClient.Namespace[${namespace}].onConnect`);
675
678
  resolve();
676
679
  });
677
680
  this.__ioNamespace.once('connect_error', err => {
678
- this.__debug('SocketIOClient.Namespace.onConnectError', err.message);
681
+ this.__debug(`SocketIOClient.Namespace[${namespace}].onConnectError`, err.message);
679
682
  reject(err);
680
683
  });
681
684
  this.__ioNamespace.on('reconnecting', attempt => {
682
- this.__debug(`SocketIOClient.Namespace.onReconnecting (Attempt #${attempt})`);
685
+ this.__debug(`SocketIOClient.Namespace[${namespace}].onReconnecting (Attempt #${attempt})`);
683
686
  });
684
687
  this.__ioNamespace.on('reconnect', () => {
685
- this.__debug('SocketIOClient.Namespace.onReconnect');
688
+ this.__debug(`SocketIOClient.Namespace[${namespace}].onReconnect`);
686
689
  });
687
690
  this.__ioNamespace.on('reconnect_error', err => {
688
- this.__debug('SocketIOClient.Namespace.onReconnectError', err.message);
691
+ this.__debug(`SocketIOClient.Namespace[${namespace}].onReconnectError`, err.message);
689
692
  });
690
693
  this.__ioNamespace.on('disconnect', reason => {
691
- this.__debug('SocketIOClient.Namespace.onDisconnect', reason);
694
+ this.__debug(`SocketIOClient.Namespace[${namespace}].onDisconnect`, reason);
692
695
  });
693
696
  this.__ioNamespace.connect();
694
697
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "homey-api",
3
- "version": "1.5.25",
3
+ "version": "1.5.28",
4
4
  "description": "Homey API",
5
5
  "main": "index.js",
6
6
  "types": "assets/types/homey-api.d.ts",