iobroker.renault 0.0.6 → 0.0.7
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 +2 -2
- package/main.js +25 -18
- package/package.json +1 -1
package/io-package.json
CHANGED
package/main.js
CHANGED
|
@@ -27,6 +27,7 @@ class Renault extends utils.Adapter {
|
|
|
27
27
|
this.deviceArray = [];
|
|
28
28
|
this.json2iob = new Json2iob(this);
|
|
29
29
|
this.ignoreState = [];
|
|
30
|
+
this.firstUpdate = true;
|
|
30
31
|
}
|
|
31
32
|
|
|
32
33
|
/**
|
|
@@ -142,7 +143,7 @@ class Renault extends utils.Adapter {
|
|
|
142
143
|
.then((res) => {
|
|
143
144
|
this.log.debug(JSON.stringify(res.data));
|
|
144
145
|
const filteredAccounts = res.data.currentUser.accounts.filter(function (el) {
|
|
145
|
-
return el.accountType === "MYRENAULT" && el.accountStatus === "ACTIVE";
|
|
146
|
+
return (el.accountType === "MYRENAULT" || el.accountType === "MYDACIA") && el.accountStatus === "ACTIVE";
|
|
146
147
|
});
|
|
147
148
|
if (filteredAccounts.length === 0) {
|
|
148
149
|
this.log.error("No Account found");
|
|
@@ -327,8 +328,8 @@ class Renault extends utils.Adapter {
|
|
|
327
328
|
"accept-language": "de-de",
|
|
328
329
|
"x-gigya-id_token": this.session.id_token,
|
|
329
330
|
};
|
|
330
|
-
this.deviceArray
|
|
331
|
-
|
|
331
|
+
for (const vin of this.deviceArray) {
|
|
332
|
+
for (const element of statusArray) {
|
|
332
333
|
if (this.ignoreState.includes(element.path)) {
|
|
333
334
|
return;
|
|
334
335
|
}
|
|
@@ -366,27 +367,30 @@ class Renault extends utils.Adapter {
|
|
|
366
367
|
|
|
367
368
|
return;
|
|
368
369
|
}
|
|
369
|
-
if (
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
370
|
+
if (this.firstUpdate) {
|
|
371
|
+
if (
|
|
372
|
+
error.response.status === 403 ||
|
|
373
|
+
error.response.status === 404 ||
|
|
374
|
+
error.response.status === 500 ||
|
|
375
|
+
error.response.status === 501 ||
|
|
376
|
+
error.response.status === 502 ||
|
|
377
|
+
error.response.status === 400
|
|
378
|
+
) {
|
|
379
|
+
this.ignoreState.push(element.path);
|
|
380
|
+
this.log.info("Feature not found. Ignore " + element.path + " for updates.");
|
|
381
|
+
this.log.info(error);
|
|
382
|
+
error.response && this.log.info(JSON.stringify(error.response.data));
|
|
383
|
+
return;
|
|
384
|
+
}
|
|
382
385
|
}
|
|
383
386
|
}
|
|
384
387
|
this.log.error(url);
|
|
385
388
|
this.log.error(error);
|
|
386
389
|
error.response && this.log.error(JSON.stringify(error.response.data));
|
|
387
390
|
});
|
|
388
|
-
}
|
|
389
|
-
}
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
this.firstUpdate = false;
|
|
390
394
|
}
|
|
391
395
|
async refreshToken() {
|
|
392
396
|
if (!this.session_data) {
|
|
@@ -432,6 +436,9 @@ class Renault extends utils.Adapter {
|
|
|
432
436
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
433
437
|
}
|
|
434
438
|
toCamelCase(string) {
|
|
439
|
+
if (!string) {
|
|
440
|
+
return;
|
|
441
|
+
}
|
|
435
442
|
const camelC = string.replace(/-([a-z])/g, function (g) {
|
|
436
443
|
return g[1].toUpperCase();
|
|
437
444
|
});
|