diff --git a/README.md b/README.md index 08613bd..9978fa8 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,8 @@ Feel free to follow the discussions in the german [iobroker forum](https://forum Placeholder for the next version (at the beginning of the line): ### **WORK IN PROGRESS** --> -### 0.1.8 (2024-11-22) + +### 0.1.9 (2024-11-22) - battery status v2 moved to to batter-statusv2 object folder diff --git a/io-package.json b/io-package.json index ca30a92..ddac935 100644 --- a/io-package.json +++ b/io-package.json @@ -1,9 +1,9 @@ { "common": { "name": "nissan", - "version": "0.1.8", + "version": "0.1.9", "news": { - "0.1.8": { + "0.1.9": { "en": "battery status v2 moved to to batter-statusv2 object folder", "de": "batteriestatus v2 in den objektordner batter-statusv2 verschoben", "ru": "статус батареи v2 перенесен в папку объекта batter-statusv2", diff --git a/main.js b/main.js index 347f946..63e7c4f 100644 --- a/main.js +++ b/main.js @@ -46,7 +46,8 @@ class Nissan extends utils.Adapter { //bolliy -- this.isConnected = false; this.isReady = false; //object path already created - this.useLegacyBattery = false; + this.skipArray = []; + //bolliy ++ } @@ -531,7 +532,7 @@ class Nissan extends utils.Adapter { for (const element of statusArray) { const url = element.url.replace('$vin', vin).replace('$gen', this.canGen[vin]).replace('$user', this.userId); - if (this.useLegacyBattery && element.path === 'battery-statusv2') { + if (this.skipArray.includes(vin + '.' + element.path)) { continue; } await this.requestClient({ @@ -565,9 +566,9 @@ class Nissan extends utils.Adapter { if (error.response && error.response.status === 502) { return; } - if (error.response && error.response.status === 501 && element.path === 'battery-statusv2') { - this.log.info('Battery status v2 not available disabled until restart'); - this.useLegacyBattery = true; + if (error.response && (error.response.status === 501 || error.response.status === 403)) { + this.log.info(`Skip ${element.path} for ${vin} code: ${error.response && error.response.status} until next restart`); + this.skipArray.push(vin + '.' + element.path); return; } if (error.response && error.response.status === 401 && element.path === 'cockpit') {