homey-api 3.14.1 → 3.14.3

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.
@@ -3,15 +3,14 @@
3
3
  const DriverV3 = require('../../HomeyAPIV3/ManagerDrivers/Driver');
4
4
 
5
5
  class Driver extends DriverV3 {
6
-
7
6
  static transformGet(item) {
8
7
  item = super.transformGet(item);
9
8
 
10
9
  item.ownerId = item.id;
11
10
  item.ownerUri = item.uri;
12
- item.ownerName = item.uriObj.name;
13
- item.ownerIconObj = item.uriObj.iconObj;
14
- item.color = item.uriObj.color;
11
+ item.ownerName = item.uriObj?.name;
12
+ item.ownerIconObj = item.uriObj?.iconObj;
13
+ item.color = item.uriObj?.color;
15
14
  item.id = `${item.uri}:${item.id}`;
16
15
 
17
16
  delete item.uri;
@@ -19,7 +18,6 @@ class Driver extends DriverV3 {
19
18
 
20
19
  return item;
21
20
  }
22
-
23
21
  }
24
22
 
25
23
  module.exports = Driver;
@@ -4,16 +4,12 @@ const ManagerInsightsV3 = require('../HomeyAPIV3/ManagerInsights');
4
4
  const Log = require('./ManagerInsights/Log');
5
5
 
6
6
  class ManagerInsights extends ManagerInsightsV3 {
7
-
8
7
  static CRUD = {
9
8
  ...super.CRUD,
10
9
  Log,
11
- }
10
+ };
12
11
 
13
- async getLog({
14
- $cache = true,
15
- id,
16
- }) {
12
+ async getLog({ $cache = true, id }) {
17
13
  if ($cache === true && this.__cache['log'][id]) {
18
14
  return this.__cache['log'][id];
19
15
  }
@@ -25,11 +21,16 @@ class ManagerInsights extends ManagerInsightsV3 {
25
21
  }
26
22
 
27
23
  async getLogEntries({ id, resolution }) {
28
- return this.__super__getLogEntries({
24
+ const result = await this.__super__getLogEntries({
29
25
  id: id.split(':').reverse()[0],
30
26
  uri: id.split(':', 3).join(':'),
31
27
  resolution,
32
28
  });
29
+
30
+ return {
31
+ ...result,
32
+ id: id,
33
+ };
33
34
  }
34
35
 
35
36
  async deleteLogEntries({ id }) {
@@ -41,7 +42,6 @@ class ManagerInsights extends ManagerInsightsV3 {
41
42
 
42
43
  // deleteLog
43
44
  // updateLog
44
-
45
45
  }
46
46
 
47
47
  module.exports = ManagerInsights;
@@ -129,7 +129,7 @@ class HomeyAPIV3 extends HomeyAPI {
129
129
  this.__baseUrlPromise = this.discoverBaseUrl().then(({ baseUrl }) => {
130
130
  return baseUrl;
131
131
  });
132
- this.__baseUrlPromise.catch(() => { });
132
+ this.__baseUrlPromise.catch(() => {});
133
133
  }
134
134
 
135
135
  return this.__baseUrlPromise;
@@ -163,8 +163,8 @@ class HomeyAPIV3 extends HomeyAPI {
163
163
  const ManagerClass = this.constructor.MANAGERS[managerName]
164
164
  ? this.constructor.MANAGERS[managerName]
165
165
  : (() => {
166
- return class extends Manager { };
167
- })();
166
+ return class extends Manager {};
167
+ })();
168
168
 
169
169
  ManagerClass.ID = manager.id;
170
170
 
@@ -217,7 +217,8 @@ class HomeyAPIV3 extends HomeyAPI {
217
217
 
218
218
  if (this.__strategies.includes(HomeyAPI.DISCOVERY_STRATEGIES.REMOTE_FORWARDED)) {
219
219
  if (this.__properties.remoteUrlForwarded) {
220
- urls[HomeyAPI.DISCOVERY_STRATEGIES.REMOTE_FORWARDED] = `${this.__properties.remoteUrlForwarded}`;
220
+ urls[HomeyAPI.DISCOVERY_STRATEGIES.REMOTE_FORWARDED] =
221
+ `${this.__properties.remoteUrlForwarded}`;
221
222
  }
222
223
  }
223
224
 
@@ -252,7 +253,7 @@ class HomeyAPIV3 extends HomeyAPI {
252
253
  this.__baseUrl = baseUrl;
253
254
  this.__strategyId = strategyId;
254
255
  })
255
- .catch(() => { });
256
+ .catch(() => {});
256
257
 
257
258
  // Ping method
258
259
  const ping = async (strategyId, timeout) => {
@@ -271,11 +272,11 @@ class HomeyAPIV3 extends HomeyAPI {
271
272
  const text = await response.text();
272
273
 
273
274
  if (!response.ok) {
274
- throw new Error(text || response.statusText)
275
+ throw new Error(text || response.statusText);
275
276
  }
276
277
 
277
278
  if (text === 'false') {
278
- throw new Error('Invalid Homey ID')
279
+ throw new Error('Invalid Homey ID');
279
280
  }
280
281
 
281
282
  const homeyId = response.headers.get('X-Homey-ID');
@@ -302,9 +303,15 @@ class HomeyAPIV3 extends HomeyAPI {
302
303
 
303
304
  // Ping localSecure (https://xxx-xxx-xxx-xx.homey.homeylocal.com)
304
305
  if (urls[HomeyAPI.DISCOVERY_STRATEGIES.LOCAL_SECURE]) {
305
- pings[HomeyAPI.DISCOVERY_STRATEGIES.LOCAL_SECURE] = ping(HomeyAPI.DISCOVERY_STRATEGIES.LOCAL_SECURE, 1200);
306
- pings[HomeyAPI.DISCOVERY_STRATEGIES.LOCAL_SECURE].catch(err => {
307
- this.__debug(`Ping ${HomeyAPI.DISCOVERY_STRATEGIES.LOCAL_SECURE} Error:`, err && err.message);
306
+ pings[HomeyAPI.DISCOVERY_STRATEGIES.LOCAL_SECURE] = ping(
307
+ HomeyAPI.DISCOVERY_STRATEGIES.LOCAL_SECURE,
308
+ 1200
309
+ );
310
+ pings[HomeyAPI.DISCOVERY_STRATEGIES.LOCAL_SECURE].catch((err) => {
311
+ this.__debug(
312
+ `Ping ${HomeyAPI.DISCOVERY_STRATEGIES.LOCAL_SECURE} Error:`,
313
+ err && err.message
314
+ );
308
315
  this.__debug(urls[HomeyAPI.DISCOVERY_STRATEGIES.LOCAL_SECURE]);
309
316
  });
310
317
  }
@@ -312,7 +319,7 @@ class HomeyAPIV3 extends HomeyAPI {
312
319
  // Ping local (http://xxx-xxx-xxx-xxx)
313
320
  if (urls[HomeyAPI.DISCOVERY_STRATEGIES.LOCAL]) {
314
321
  pings[HomeyAPI.DISCOVERY_STRATEGIES.LOCAL] = ping(HomeyAPI.DISCOVERY_STRATEGIES.LOCAL, 1000);
315
- pings[HomeyAPI.DISCOVERY_STRATEGIES.LOCAL].catch(err =>
322
+ pings[HomeyAPI.DISCOVERY_STRATEGIES.LOCAL].catch((err) =>
316
323
  this.__debug(`Ping ${HomeyAPI.DISCOVERY_STRATEGIES.LOCAL} Error:`, err && err.message)
317
324
  );
318
325
  }
@@ -320,7 +327,7 @@ class HomeyAPIV3 extends HomeyAPI {
320
327
  // Ping mdns (http://homey-<homeyId>.local)
321
328
  if (urls[HomeyAPI.DISCOVERY_STRATEGIES.MDNS]) {
322
329
  pings[HomeyAPI.DISCOVERY_STRATEGIES.MDNS] = ping(HomeyAPI.DISCOVERY_STRATEGIES.MDNS, 3000);
323
- pings[HomeyAPI.DISCOVERY_STRATEGIES.MDNS].catch(err =>
330
+ pings[HomeyAPI.DISCOVERY_STRATEGIES.MDNS].catch((err) =>
324
331
  this.__debug(`Ping ${HomeyAPI.DISCOVERY_STRATEGIES.MDNS} Error:`, err && err.message)
325
332
  );
326
333
  }
@@ -328,7 +335,7 @@ class HomeyAPIV3 extends HomeyAPI {
328
335
  // Ping cloud (https://<homeyId>.connect.athom.com)
329
336
  if (urls[HomeyAPI.DISCOVERY_STRATEGIES.CLOUD]) {
330
337
  pings[HomeyAPI.DISCOVERY_STRATEGIES.CLOUD] = ping(HomeyAPI.DISCOVERY_STRATEGIES.CLOUD, 5000);
331
- pings[HomeyAPI.DISCOVERY_STRATEGIES.CLOUD].catch(err =>
338
+ pings[HomeyAPI.DISCOVERY_STRATEGIES.CLOUD].catch((err) =>
332
339
  this.__debug(`Ping ${HomeyAPI.DISCOVERY_STRATEGIES.CLOUD} Error:`, err && err.message)
333
340
  );
334
341
  }
@@ -339,15 +346,18 @@ class HomeyAPIV3 extends HomeyAPI {
339
346
  HomeyAPI.DISCOVERY_STRATEGIES.REMOTE_FORWARDED,
340
347
  2000
341
348
  );
342
- pings[HomeyAPI.DISCOVERY_STRATEGIES.REMOTE_FORWARDED].catch(err =>
343
- this.__debug(`Ping ${HomeyAPI.DISCOVERY_STRATEGIES.REMOTE_FORWARDED} Error:`, err && err.message)
349
+ pings[HomeyAPI.DISCOVERY_STRATEGIES.REMOTE_FORWARDED].catch((err) =>
350
+ this.__debug(
351
+ `Ping ${HomeyAPI.DISCOVERY_STRATEGIES.REMOTE_FORWARDED} Error:`,
352
+ err && err.message
353
+ )
344
354
  );
345
355
  }
346
356
 
347
357
  // Select the best route
348
358
  if (pings[HomeyAPI.DISCOVERY_STRATEGIES.LOCAL_SECURE]) {
349
359
  pings[HomeyAPI.DISCOVERY_STRATEGIES.LOCAL_SECURE]
350
- .then(result => resolve(result))
360
+ .then((result) => resolve(result))
351
361
  .catch(() => {
352
362
  const promises = [];
353
363
 
@@ -373,42 +383,42 @@ class HomeyAPIV3 extends HomeyAPI {
373
383
 
374
384
  return Util.promiseAny(promises);
375
385
  })
376
- .then(result => resolve(result))
386
+ .then((result) => resolve(result))
377
387
  .catch(() => reject(new APIErrorHomeyOffline()));
378
388
  } else if (pings[HomeyAPI.DISCOVERY_STRATEGIES.LOCAL]) {
379
389
  pings[HomeyAPI.DISCOVERY_STRATEGIES.LOCAL]
380
- .then(result => resolve(result))
390
+ .then((result) => resolve(result))
381
391
  .catch(() => {
382
392
  if (pings[HomeyAPI.DISCOVERY_STRATEGIES.CLOUD]) {
383
393
  pings[HomeyAPI.DISCOVERY_STRATEGIES.CLOUD]
384
- .then(result => resolve(result))
385
- .catch(err => reject(new APIErrorHomeyOffline(err)));
394
+ .then((result) => resolve(result))
395
+ .catch((err) => reject(new APIErrorHomeyOffline(err)));
386
396
  }
387
397
  });
388
398
  } else if (pings[HomeyAPI.DISCOVERY_STRATEGIES.MDNS]) {
389
399
  pings[HomeyAPI.DISCOVERY_STRATEGIES.MDNS]
390
- .then(result => resolve(result))
400
+ .then((result) => resolve(result))
391
401
  .catch(() => {
392
402
  if (pings[HomeyAPI.DISCOVERY_STRATEGIES.CLOUD]) {
393
403
  pings[HomeyAPI.DISCOVERY_STRATEGIES.CLOUD]
394
- .then(result => resolve(result))
395
- .catch(err => reject(new APIErrorHomeyOffline(err)));
404
+ .then((result) => resolve(result))
405
+ .catch((err) => reject(new APIErrorHomeyOffline(err)));
396
406
  }
397
407
  });
398
408
  } else if (pings[HomeyAPI.DISCOVERY_STRATEGIES.REMOTE_FORWARDED]) {
399
409
  pings[HomeyAPI.DISCOVERY_STRATEGIES.REMOTE_FORWARDED]
400
- .then(result => resolve(result))
410
+ .then((result) => resolve(result))
401
411
  .catch(() => {
402
412
  if (pings[HomeyAPI.DISCOVERY_STRATEGIES.CLOUD]) {
403
413
  pings[HomeyAPI.DISCOVERY_STRATEGIES.CLOUD]
404
- .then(result => resolve(result))
405
- .catch(err => reject(new APIErrorHomeyOffline(err)));
414
+ .then((result) => resolve(result))
415
+ .catch((err) => reject(new APIErrorHomeyOffline(err)));
406
416
  }
407
417
  });
408
418
  } else if (pings[HomeyAPI.DISCOVERY_STRATEGIES.CLOUD]) {
409
419
  pings[HomeyAPI.DISCOVERY_STRATEGIES.CLOUD]
410
- .then(result => resolve(result))
411
- .catch(err => reject(new APIErrorHomeyOffline(err)));
420
+ .then((result) => resolve(result))
421
+ .catch((err) => reject(new APIErrorHomeyOffline(err)));
412
422
  } else {
413
423
  reject(new APIErrorHomeyOffline());
414
424
  }
@@ -483,12 +493,13 @@ class HomeyAPIV3 extends HomeyAPI {
483
493
  try {
484
494
  resBodyJson = JSON.parse(resBodyText);
485
495
  // eslint-disable-next-line no-empty
486
- } catch (err) { }
496
+ } catch (err) {}
487
497
  }
488
498
 
489
499
  if (!res.ok) {
490
- // If Session Expired, clear the stored token
491
- if (resStatusCode === 401 && shouldRetry === true && token != null) {
500
+ // If Session Expired, clear the stored token. Only try if AthomCloudAPI is available so we
501
+ // never try to refresh on local api's.
502
+ if (resStatusCode === 401 && shouldRetry === true && token != null && this.__api != null) {
492
503
  this.__debug('Session expired');
493
504
  await this.refreshForToken(token, isRetryAfterRefresh);
494
505
 
@@ -559,7 +570,7 @@ class HomeyAPIV3 extends HomeyAPI {
559
570
  .then(() => {
560
571
  this.__loginPromise = null;
561
572
  })
562
- .catch(err => {
573
+ .catch((err) => {
563
574
  this.__debug('Error Logging In:', err);
564
575
  this.__loginPromise = null;
565
576
  this.__token = null;
@@ -604,9 +615,10 @@ class HomeyAPIV3 extends HomeyAPI {
604
615
  this.__refreshSessionPromise = this.__refreshSession();
605
616
 
606
617
  this.__refreshSessionPromise
607
- .catch(err => {
618
+ .catch((err) => {
608
619
  this.__debug('Error refreshing session:', err);
609
- }).finally(() => {
620
+ })
621
+ .finally(() => {
610
622
  this.__refreshSessionPromise = null;
611
623
  });
612
624
  }
@@ -643,8 +655,8 @@ class HomeyAPIV3 extends HomeyAPI {
643
655
  });
644
656
 
645
657
  this.__refreshMap[token]
646
- .then(() => { })
647
- .catch(err => {
658
+ .then(() => {})
659
+ .catch((err) => {
648
660
  this.__debug('Error Refreshing Token:', err);
649
661
  })
650
662
  .finally(() => {
@@ -671,11 +683,11 @@ class HomeyAPIV3 extends HomeyAPI {
671
683
  async subscribe(
672
684
  uri,
673
685
  {
674
- onConnect = () => { },
675
- onReconnect = () => { },
676
- onReconnectError = () => { },
677
- onDisconnect = () => { },
678
- onEvent = () => { },
686
+ onConnect = () => {},
687
+ onReconnect = () => {},
688
+ onReconnectError = () => {},
689
+ onDisconnect = () => {},
690
+ onEvent = () => {},
679
691
  }
680
692
  ) {
681
693
  this.__debug('subscribe', uri);
@@ -688,11 +700,11 @@ class HomeyAPIV3 extends HomeyAPI {
688
700
  return;
689
701
  }
690
702
 
691
- this.__homeySocket.once('disconnect', reason => {
703
+ this.__homeySocket.once('disconnect', (reason) => {
692
704
  reject(new Error(reason));
693
705
  });
694
706
  this.__debug('subscribing', uri);
695
- this.__homeySocket.emit('subscribe', uri, err => {
707
+ this.__homeySocket.emit('subscribe', uri, (err) => {
696
708
  if (err) {
697
709
  this.__debug('Failed to subscribe', uri, err);
698
710
  return reject(err);
@@ -715,7 +727,7 @@ class HomeyAPIV3 extends HomeyAPI {
715
727
  onConnect();
716
728
 
717
729
  // On Disconnect
718
- const __onDisconnect = reason => {
730
+ const __onDisconnect = (reason) => {
719
731
  onDisconnect(reason);
720
732
  };
721
733
  this.__socket.on('disconnect', __onDisconnect);
@@ -732,11 +744,11 @@ class HomeyAPIV3 extends HomeyAPI {
732
744
  return;
733
745
  }
734
746
 
735
- this.__homeySocket.once('disconnect', reason => {
747
+ this.__homeySocket.once('disconnect', (reason) => {
736
748
  reject(new Error(reason));
737
749
  });
738
750
  this.__debug('subscribing', uri);
739
- this.__homeySocket.emit('subscribe', uri, err => {
751
+ this.__homeySocket.emit('subscribe', uri, (err) => {
740
752
  if (err) {
741
753
  this.__debug('Failed to subscribe', uri, err);
742
754
  return reject(err);
@@ -754,7 +766,7 @@ class HomeyAPIV3 extends HomeyAPI {
754
766
 
755
767
  onReconnect();
756
768
  })
757
- .catch(err => onReconnectError(err));
769
+ .catch((err) => onReconnectError(err));
758
770
  };
759
771
  this.__socket.on('reconnect', __onReconnect);
760
772
 
@@ -795,12 +807,12 @@ class HomeyAPIV3 extends HomeyAPI {
795
807
  reconnection: this.__reconnect,
796
808
  });
797
809
 
798
- this.__socket.on('disconnect', reason => {
810
+ this.__socket.on('disconnect', (reason) => {
799
811
  this.__debug('SocketIOClient.onDisconnect', reason);
800
812
  this.emit('disconnect', reason);
801
813
  });
802
814
 
803
- this.__socket.on('error', err => {
815
+ this.__socket.on('error', (err) => {
804
816
  this.__debug('SocketIOClient.onError', err.message);
805
817
  this.emit('error', err);
806
818
  });
@@ -815,17 +827,17 @@ class HomeyAPIV3 extends HomeyAPI {
815
827
  this.emit('reconnect_attempt');
816
828
  });
817
829
 
818
- this.__socket.on('reconnecting', attempt => {
830
+ this.__socket.on('reconnecting', (attempt) => {
819
831
  this.__debug(`SocketIOClient.onReconnecting (Attempt #${attempt})`);
820
832
  this.emit('reconnecting');
821
833
  });
822
834
 
823
- this.__socket.on('reconnect_error', err => {
835
+ this.__socket.on('reconnect_error', (err) => {
824
836
  this.__debug('SocketIOClient.onReconnectError', err.message, err);
825
837
  this.emit('reconnect_error');
826
838
  });
827
839
 
828
- this.__socket.on('connect_error', err => {
840
+ this.__socket.on('connect_error', (err) => {
829
841
  this.__debug('SocketIOClient.onConnectError', err.message);
830
842
  this.emit('connect_error');
831
843
  reject(err);
@@ -839,7 +851,7 @@ class HomeyAPIV3 extends HomeyAPI {
839
851
  this.__debug('SocketIOClient.onConnect.onHandshakeClientSuccess');
840
852
  resolve();
841
853
  })
842
- .catch(err => {
854
+ .catch((err) => {
843
855
  this.__debug('SocketIOClient.onConnect.onHandshakeClientError', err.message);
844
856
  reject(err);
845
857
  });
@@ -849,7 +861,7 @@ class HomeyAPIV3 extends HomeyAPI {
849
861
  });
850
862
  });
851
863
 
852
- this.__connectPromise.catch(err => {
864
+ this.__connectPromise.catch((err) => {
853
865
  this.__debug('SocketIOClient Error', err.message);
854
866
  delete this.__connectPromise;
855
867
  });
@@ -868,7 +880,7 @@ class HomeyAPIV3 extends HomeyAPI {
868
880
  // Also disconnect __homeySocket?
869
881
 
870
882
  if (this.__socket) {
871
- await new Promise(resolve => {
883
+ await new Promise((resolve) => {
872
884
  if (this.__socket.connected) {
873
885
  this.__socket.once('disconnect', () => resolve());
874
886
  this.__socket.disconnect();
@@ -919,7 +931,7 @@ class HomeyAPIV3 extends HomeyAPI {
919
931
  resolve();
920
932
  });
921
933
 
922
- this.__homeySocket.once('connect_error', err => {
934
+ this.__homeySocket.once('connect_error', (err) => {
923
935
  this.__debug(`SocketIOClient.Namespace[${namespace}].onConnectError`, err.message);
924
936
  if (err) {
925
937
  if (err instanceof Error) {
@@ -928,7 +940,9 @@ class HomeyAPIV3 extends HomeyAPI {
928
940
 
929
941
  // .statusCode for homey-core .code for homey-client.
930
942
  if (typeof err === 'object') {
931
- return reject(new HomeyAPIError({ error_description: err.message }, err.statusCode || err.code));
943
+ return reject(
944
+ new HomeyAPIError({ error_description: err.message }, err.statusCode || err.code)
945
+ );
932
946
  }
933
947
 
934
948
  return reject(new Error(String(err)));
@@ -937,19 +951,21 @@ class HomeyAPIV3 extends HomeyAPI {
937
951
  reject(new Error(`Unknown error connecting to namespace ${namespace}.`));
938
952
  });
939
953
 
940
- this.__homeySocket.on('disconnect', reason => {
954
+ this.__homeySocket.on('disconnect', (reason) => {
941
955
  this.__debug(`SocketIOClient.Namespace[${namespace}].onDisconnect`, reason);
942
956
  });
943
957
 
944
- this.__homeySocket.on('reconnecting', attempt => {
945
- this.__debug(`SocketIOClient.Namespace[${namespace}].onReconnecting (Attempt #${attempt})`);
958
+ this.__homeySocket.on('reconnecting', (attempt) => {
959
+ this.__debug(
960
+ `SocketIOClient.Namespace[${namespace}].onReconnecting (Attempt #${attempt})`
961
+ );
946
962
  });
947
963
 
948
964
  this.__homeySocket.on('reconnect', () => {
949
965
  this.__debug(`SocketIOClient.Namespace[${namespace}].onReconnect`);
950
966
  });
951
967
 
952
- this.__homeySocket.on('reconnect_error', err => {
968
+ this.__homeySocket.on('reconnect_error', (err) => {
953
969
  this.__debug(`SocketIOClient.Namespace[${namespace}].onReconnectError`, err.message);
954
970
  });
955
971
 
@@ -957,7 +973,7 @@ class HomeyAPIV3 extends HomeyAPI {
957
973
  });
958
974
  };
959
975
 
960
- const handshakeClient = async token => {
976
+ const handshakeClient = async (token) => {
961
977
  return new Promise((resolve, reject) => {
962
978
  this.__socket.emit(
963
979
  'handshakeClient',
@@ -1005,7 +1021,8 @@ class HomeyAPIV3 extends HomeyAPI {
1005
1021
 
1006
1022
  return onResult(result);
1007
1023
  } catch (err) {
1008
- if (err.statusCode === 401 || err.code === 401) {
1024
+ // Only try if AthomCloudAPI is available so we never try to refresh on local api's.
1025
+ if ((err.statusCode === 401 || err.code === 401) && this.__api != null) {
1009
1026
  this.__debug('Token expired, refreshing...');
1010
1027
  await this.refreshForToken(token, false);
1011
1028
  const result = await Util.timeout(
@@ -1027,7 +1044,7 @@ class HomeyAPIV3 extends HomeyAPI {
1027
1044
  return true;
1028
1045
  }
1029
1046
 
1030
- return this.__session.intersectedScopes.some(availableScope => {
1047
+ return this.__session.intersectedScopes.some((availableScope) => {
1031
1048
  return this.constructor.instanceOfScope(scope, availableScope);
1032
1049
  });
1033
1050
  }
package/lib/Util.js CHANGED
@@ -58,6 +58,11 @@ class Util {
58
58
  }
59
59
  }
60
60
 
61
+ if (err.type === 'aborted') {
62
+ // https://github.com/node-fetch/node-fetch/blob/2.x/src/abort-error.js
63
+ throw new APIErrorTimeout(timeoutMessage ?? `Timeout after ${timeoutDuration}ms`);
64
+ }
65
+
61
66
  throw err;
62
67
  } finally {
63
68
  clearTimeout(abortTimeout);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "homey-api",
3
- "version": "3.14.1",
3
+ "version": "3.14.3",
4
4
  "description": "Homey API",
5
5
  "main": "index.js",
6
6
  "files": [