homey-api 3.4.25 → 3.4.27

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.
@@ -508,6 +508,12 @@
508
508
  }
509
509
  }
510
510
  },
511
+ "getAcceptedInvites": {
512
+ "path": "/user/me/accepted_invites",
513
+ "method": "get",
514
+ "private": true,
515
+ "parameters": {}
516
+ },
511
517
  "updateAuthenticatedUserPassword": {
512
518
  "path": "/user/me/password",
513
519
  "method": "post",
@@ -564,6 +570,23 @@
564
570
  }
565
571
  }
566
572
  },
573
+ "acceptInvite": {
574
+ "path": "/user/{userId}/accept_invite/{inviterId}",
575
+ "method": "post",
576
+ "private": true,
577
+ "parameters": {
578
+ "userId": {
579
+ "in": "path",
580
+ "type": "string",
581
+ "required": true
582
+ },
583
+ "inviterId": {
584
+ "in": "path",
585
+ "type": "string",
586
+ "required": true
587
+ }
588
+ }
589
+ },
567
590
  "getBridges": {
568
591
  "path": "/bridge/",
569
592
  "method": "get",
@@ -760,6 +783,15 @@
760
783
  },
761
784
  "devices": {
762
785
  "type": "array"
786
+ },
787
+ "eMMCestLifeTimeA": {
788
+ "type": "number"
789
+ },
790
+ "eMMCestLifeTimeB": {
791
+ "type": "number"
792
+ },
793
+ "eMMCpreEOLInfo": {
794
+ "type": "number"
763
795
  }
764
796
  }
765
797
  }
@@ -846,6 +878,15 @@
846
878
  },
847
879
  "devices": {
848
880
  "type": "array"
881
+ },
882
+ "eMMCestLifeTimeA": {
883
+ "type": "number"
884
+ },
885
+ "eMMCestLifeTimeB": {
886
+ "type": "number"
887
+ },
888
+ "eMMCpreEOLInfo": {
889
+ "type": "number"
849
890
  }
850
891
  }
851
892
  }
@@ -2485,6 +2485,8 @@ export class AthomCloudAPI {
2485
2485
 
2486
2486
  getAuthenticatedUser(opts: { additionalScopes?: string }): Promise<any>;
2487
2487
 
2488
+ getAcceptedInvites(): Promise<any>;
2489
+
2488
2490
  updateAuthenticatedUserPassword(opts: {
2489
2491
  password?: string;
2490
2492
 
@@ -2501,6 +2503,12 @@ export class AthomCloudAPI {
2501
2503
  sessionId: string;
2502
2504
  }): Promise<any>;
2503
2505
 
2506
+ acceptInvite(opts: {
2507
+ userId: string;
2508
+
2509
+ inviterId: string;
2510
+ }): Promise<any>;
2511
+
2504
2512
  getBridges(opts: {
2505
2513
  serial?: string;
2506
2514
 
@@ -2594,6 +2602,12 @@ export class AthomCloudAPI {
2594
2602
  apps: Array<any>;
2595
2603
 
2596
2604
  devices: Array<any>;
2605
+
2606
+ eMMCestLifeTimeA: number;
2607
+
2608
+ eMMCestLifeTimeB: number;
2609
+
2610
+ eMMCpreEOLInfo: number;
2597
2611
  };
2598
2612
  }): Promise<any>;
2599
2613
 
@@ -2638,6 +2652,12 @@ export class AthomCloudAPI {
2638
2652
  apps: Array<any>;
2639
2653
 
2640
2654
  devices: Array<any>;
2655
+
2656
+ eMMCestLifeTimeA: number;
2657
+
2658
+ eMMCestLifeTimeB: number;
2659
+
2660
+ eMMCpreEOLInfo: number;
2641
2661
  };
2642
2662
  }): Promise<any>;
2643
2663
 
@@ -3025,6 +3045,8 @@ export class AthomCloudAPI {
3025
3045
 
3026
3046
  getAuthenticatedUser(opts: { additionalScopes?: string }): Promise<any>;
3027
3047
 
3048
+ getAcceptedInvites(): Promise<any>;
3049
+
3028
3050
  updateAuthenticatedUserPassword(opts: {
3029
3051
  password?: string;
3030
3052
 
@@ -3041,6 +3063,12 @@ export class AthomCloudAPI {
3041
3063
  sessionId: string;
3042
3064
  }): Promise<any>;
3043
3065
 
3066
+ acceptInvite(opts: {
3067
+ userId: string;
3068
+
3069
+ inviterId: string;
3070
+ }): Promise<any>;
3071
+
3044
3072
  getBridges(opts: {
3045
3073
  serial?: string;
3046
3074
 
@@ -3134,6 +3162,12 @@ export class AthomCloudAPI {
3134
3162
  apps: Array<any>;
3135
3163
 
3136
3164
  devices: Array<any>;
3165
+
3166
+ eMMCestLifeTimeA: number;
3167
+
3168
+ eMMCestLifeTimeB: number;
3169
+
3170
+ eMMCpreEOLInfo: number;
3137
3171
  };
3138
3172
  }): Promise<any>;
3139
3173
 
@@ -3178,6 +3212,12 @@ export class AthomCloudAPI {
3178
3212
  apps: Array<any>;
3179
3213
 
3180
3214
  devices: Array<any>;
3215
+
3216
+ eMMCestLifeTimeA: number;
3217
+
3218
+ eMMCestLifeTimeB: number;
3219
+
3220
+ eMMCpreEOLInfo: number;
3181
3221
  };
3182
3222
  }): Promise<any>;
3183
3223
 
@@ -5605,6 +5645,8 @@ export class AthomCloudAPI {
5605
5645
 
5606
5646
  getAuthenticatedUser(opts: { additionalScopes?: string }): Promise<any>;
5607
5647
 
5648
+ getAcceptedInvites(): Promise<any>;
5649
+
5608
5650
  updateAuthenticatedUserPassword(opts: {
5609
5651
  password?: string;
5610
5652
 
@@ -5621,6 +5663,12 @@ export class AthomCloudAPI {
5621
5663
  sessionId: string;
5622
5664
  }): Promise<any>;
5623
5665
 
5666
+ acceptInvite(opts: {
5667
+ userId: string;
5668
+
5669
+ inviterId: string;
5670
+ }): Promise<any>;
5671
+
5624
5672
  getBridges(opts: {
5625
5673
  serial?: string;
5626
5674
 
@@ -5714,6 +5762,12 @@ export class AthomCloudAPI {
5714
5762
  apps: Array<any>;
5715
5763
 
5716
5764
  devices: Array<any>;
5765
+
5766
+ eMMCestLifeTimeA: number;
5767
+
5768
+ eMMCestLifeTimeB: number;
5769
+
5770
+ eMMCpreEOLInfo: number;
5717
5771
  };
5718
5772
  }): Promise<any>;
5719
5773
 
@@ -5758,6 +5812,12 @@ export class AthomCloudAPI {
5758
5812
  apps: Array<any>;
5759
5813
 
5760
5814
  devices: Array<any>;
5815
+
5816
+ eMMCestLifeTimeA: number;
5817
+
5818
+ eMMCestLifeTimeB: number;
5819
+
5820
+ eMMCpreEOLInfo: number;
5761
5821
  };
5762
5822
  }): Promise<any>;
5763
5823
 
@@ -6145,6 +6205,8 @@ export class AthomCloudAPI {
6145
6205
 
6146
6206
  getAuthenticatedUser(opts: { additionalScopes?: string }): Promise<any>;
6147
6207
 
6208
+ getAcceptedInvites(): Promise<any>;
6209
+
6148
6210
  updateAuthenticatedUserPassword(opts: {
6149
6211
  password?: string;
6150
6212
 
@@ -6161,6 +6223,12 @@ export class AthomCloudAPI {
6161
6223
  sessionId: string;
6162
6224
  }): Promise<any>;
6163
6225
 
6226
+ acceptInvite(opts: {
6227
+ userId: string;
6228
+
6229
+ inviterId: string;
6230
+ }): Promise<any>;
6231
+
6164
6232
  getBridges(opts: {
6165
6233
  serial?: string;
6166
6234
 
@@ -6254,6 +6322,12 @@ export class AthomCloudAPI {
6254
6322
  apps: Array<any>;
6255
6323
 
6256
6324
  devices: Array<any>;
6325
+
6326
+ eMMCestLifeTimeA: number;
6327
+
6328
+ eMMCestLifeTimeB: number;
6329
+
6330
+ eMMCpreEOLInfo: number;
6257
6331
  };
6258
6332
  }): Promise<any>;
6259
6333
 
@@ -6298,6 +6372,12 @@ export class AthomCloudAPI {
6298
6372
  apps: Array<any>;
6299
6373
 
6300
6374
  devices: Array<any>;
6375
+
6376
+ eMMCestLifeTimeA: number;
6377
+
6378
+ eMMCestLifeTimeB: number;
6379
+
6380
+ eMMCpreEOLInfo: number;
6301
6381
  };
6302
6382
  }): Promise<any>;
6303
6383
 
@@ -17,6 +17,8 @@ const ManagerInsights = require('./HomeyAPIV2/ManagerInsights');
17
17
  */
18
18
  class HomeyAPIV2 extends HomeyAPIV3 {
19
19
 
20
+ static DEFAULT_TIMEOUT = 1000 * 30;
21
+
20
22
  static MANAGERS = {
21
23
  ...super.MANAGERS,
22
24
  ManagerFlow,
@@ -102,7 +102,7 @@ class Manager extends EventEmitter {
102
102
  $validate = true,
103
103
  $cache = true,
104
104
  $updateCache = true,
105
- $timeout = operation.timeout ?? 5000,
105
+ $timeout = operation.timeout ?? this.homey.constructor.DEFAULT_TIMEOUT,
106
106
  $socket = operation.socket ?? true,
107
107
  $body = {},
108
108
  $query = {},
@@ -36,6 +36,10 @@ class HomeyAPIV3 extends HomeyAPI {
36
36
  ManagerUsers,
37
37
  };
38
38
 
39
+ static DEFAULT_TIMEOUT = 1000 * 10;
40
+ static HANDSHAKE_TIMEOUT = 1000 * 10;
41
+ static SUBSCRIBE_TIMEOUT = 1000 * 10;
42
+
39
43
  constructor({
40
44
  properties,
41
45
  strategy = [
@@ -274,6 +278,7 @@ class HomeyAPIV3 extends HomeyAPI {
274
278
  if (text === 'false') throw new Error('Invalid Homey ID');
275
279
 
276
280
  const homeyId = res.headers.get('X-Homey-ID');
281
+
277
282
  if (homeyId) {
278
283
  if (homeyId !== this.id) throw new Error('Invalid Homey ID'); // TODO: Add to Homey Connect
279
284
  }
@@ -414,13 +419,13 @@ class HomeyAPIV3 extends HomeyAPI {
414
419
  return promise;
415
420
  }
416
421
 
417
- async call({
418
- $timeout = 10000,
419
- method,
420
- headers,
421
- path,
422
- body,
423
- json = true,
422
+ async call({
423
+ $timeout = this.constructor.DEFAULT_TIMEOUT,
424
+ method,
425
+ headers,
426
+ path,
427
+ body,
428
+ json = true,
424
429
  isRetryAfterRefresh = false,
425
430
  shouldRetry = true,
426
431
  }) {
@@ -626,9 +631,9 @@ class HomeyAPIV3 extends HomeyAPI {
626
631
  .finally(() => {
627
632
  // Delete after 30 seconds some requests might still be pending an they should be able
628
633
  // to receive a rejected promise for this token.
629
- this.__refreshMap[token+'timeout'] = setTimeout(() => {
634
+ this.__refreshMap[token + 'timeout'] = setTimeout(() => {
630
635
  delete this.__refreshMap[token];
631
- delete this.__refreshMap[token+'timeout'];
636
+ delete this.__refreshMap[token + 'timeout'];
632
637
  }, 30 * 1000);
633
638
  });
634
639
  }
@@ -678,8 +683,8 @@ class HomeyAPIV3 extends HomeyAPI {
678
683
  return resolve();
679
684
  });
680
685
  }),
681
- 10000,
682
- `Failed to subscribe to ${uri} (Timeout after 10000ms).`
686
+ this.constructor.SUBSCRIBE_TIMEOUT,
687
+ `Failed to subscribe to ${uri} (Timeout after ${this.constructor.SUBSCRIBE_TIMEOUT}ms).`
683
688
  );
684
689
 
685
690
  // On Connect
@@ -722,8 +727,8 @@ class HomeyAPIV3 extends HomeyAPI {
722
727
  return resolve();
723
728
  });
724
729
  }),
725
- 10000,
726
- `Failed to subscribe to ${uri} (Timeout after 10000ms).`
730
+ this.constructor.SUBSCRIBE_TIMEOUT,
731
+ `Failed to subscribe to ${uri} (Timeout after ${this.constructor.SUBSCRIBE_TIMEOUT}ms).`
727
732
  );
728
733
 
729
734
  this.__homeySocket.on(uri, __onEvent);
@@ -975,8 +980,8 @@ class HomeyAPIV3 extends HomeyAPI {
975
980
  try {
976
981
  const result = await Util.timeout(
977
982
  handshakeClient(token),
978
- 5000,
979
- `Failed to handshake client (Timeout after 5000ms).`
983
+ this.constructor.HANDSHAKE_TIMEOUT,
984
+ `Failed to handshake client (Timeout after ${this.constructor.HANDSHAKE_TIMEOUT}ms).`
980
985
  );
981
986
 
982
987
  return onResult(result);
@@ -986,8 +991,8 @@ class HomeyAPIV3 extends HomeyAPI {
986
991
  await this.refreshForToken(token, false);
987
992
  const result = await Util.timeout(
988
993
  handshakeClient(this.__token),
989
- 5000,
990
- `Failed to handshake client (Timeout after 5000ms).`
994
+ this.constructor.HANDSHAKE_TIMEOUT,
995
+ `Failed to handshake client (Timeout after ${this.constructor.HANDSHAKE_TIMEOUT}ms).`
991
996
  );
992
997
 
993
998
  return onResult(result);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "homey-api",
3
- "version": "3.4.25",
3
+ "version": "3.4.27",
4
4
  "description": "Homey API",
5
5
  "main": "index.js",
6
6
  "files": [