iobroker.toyota 0.2.5 → 0.2.6

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.
package/io-package.json CHANGED
@@ -1,8 +1,12 @@
1
1
  {
2
2
  "common": {
3
3
  "name": "toyota",
4
- "version": "0.2.5",
4
+ "version": "0.2.6",
5
5
  "news": {
6
+ "0.2.6": {
7
+ "en": "Skip endpoints that are not available",
8
+ "de": "Überspringen von Endpunkten, die nicht verfügbar sind"
9
+ },
6
10
  "0.2.5": {
7
11
  "en": "Add option to disable trip fetching",
8
12
  "de": "Option zum Deaktivieren des Abrufs von Trips hinzugefügt"
package/main.js CHANGED
@@ -30,6 +30,7 @@ class Toyota extends utils.Adapter {
30
30
  this.token = null;
31
31
  this.uuid = null;
32
32
  this.session = {};
33
+ this.blockedEndpoints = {};
33
34
  this.cookieJar = new tough.CookieJar();
34
35
  this.requestClient = axios.create({
35
36
  withCredentials: true,
@@ -511,7 +512,10 @@ class Toyota extends utils.Adapter {
511
512
  'x-api-key': 'tTZipv6liF74PwMfk9Ed68AQ0bISswwf3iHQdqcF',
512
513
  };
513
514
  for (const vin of this.deviceArray) {
514
- statusArray.forEach(async (element) => {
515
+ for (const element of statusArray) {
516
+ if (this.blockedEndpoints[vin] && this.blockedEndpoints[vin].includes(element.path)) {
517
+ continue;
518
+ }
515
519
  const url = element.url.replace('$vin', vin);
516
520
  headers.vin = vin;
517
521
 
@@ -548,12 +552,19 @@ class Toyota extends utils.Adapter {
548
552
 
549
553
  return;
550
554
  }
555
+ if (error.response.status >= 500) {
556
+ this.log.warn(JSON.stringify(error.response.data));
557
+ this.log.info(element.path + ' receive 500 error. Skip until restart');
558
+ this.blockedEndpoints[vin] = this.blockedEndpoints[vin] || [];
559
+ this.blockedEndpoints[vin].push(element.path);
560
+ return;
561
+ }
551
562
  }
552
563
  this.log.error(url);
553
564
  this.log.error(error);
554
565
  error.response && this.log.error(JSON.stringify(error.response.data));
555
566
  });
556
- });
567
+ }
557
568
  }
558
569
  }
559
570
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iobroker.toyota",
3
- "version": "0.2.5",
3
+ "version": "0.2.6",
4
4
  "description": "Adapter for myT Toyota/Lexus App",
5
5
  "author": {
6
6
  "name": "TA2k",