iobroker.renault 0.0.6 → 0.0.9
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/README.md +4 -5
- package/io-package.json +6 -3
- package/main.js +33 -20
- package/package.json +73 -71
package/README.md
CHANGED
|
@@ -12,13 +12,12 @@
|
|
|
12
12
|
|
|
13
13
|
**Tests:** 
|
|
14
14
|
|
|
15
|
-
## renault adapter for ioBroker
|
|
16
|
-
|
|
17
|
-
Adapter for Renault and Renault
|
|
15
|
+
## renault/dacia adapter for ioBroker
|
|
18
16
|
|
|
17
|
+
Adapter for Renault and Dacia
|
|
19
18
|
## Loginablauf
|
|
20
19
|
|
|
21
|
-
Die myRenault Mail und Passwort eingeben.
|
|
20
|
+
Die myRenault/myDacia Mail und Passwort eingeben.
|
|
22
21
|
|
|
23
22
|
## Steuern
|
|
24
23
|
|
|
@@ -29,7 +28,7 @@ renault.0.vin.remote auf true setzen steuert den jeweiligen Befehl
|
|
|
29
28
|
|
|
30
29
|
## Changelog
|
|
31
30
|
|
|
32
|
-
### 0.0.
|
|
31
|
+
### 0.0.7
|
|
33
32
|
|
|
34
33
|
* (TA2k) initial release
|
|
35
34
|
|
package/io-package.json
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"common": {
|
|
3
3
|
"name": "renault",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.9",
|
|
5
5
|
"news": {
|
|
6
|
-
"0.0.
|
|
6
|
+
"0.0.9": {
|
|
7
|
+
"en": "update apikey"
|
|
8
|
+
},
|
|
9
|
+
"0.0.8": {
|
|
7
10
|
"en": "initial release",
|
|
8
11
|
"de": "Erstveröffentlichung",
|
|
9
12
|
"ru": "Начальная версия",
|
|
@@ -69,7 +72,7 @@
|
|
|
69
72
|
},
|
|
70
73
|
"dependencies": [
|
|
71
74
|
{
|
|
72
|
-
"js-controller": ">=3.
|
|
75
|
+
"js-controller": ">=3.2.0"
|
|
73
76
|
}
|
|
74
77
|
],
|
|
75
78
|
"globalDependencies": [
|
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
|
/**
|
|
@@ -134,7 +135,7 @@ class Renault extends utils.Adapter {
|
|
|
134
135
|
"Content-Type": "application/json",
|
|
135
136
|
Accept: "*/*",
|
|
136
137
|
"User-Agent": "MYRenault/39 CFNetwork/1312 Darwin/21.0.0",
|
|
137
|
-
apiKey: "
|
|
138
|
+
apiKey: "VAX7XYKGfa92yMvXculCkEFyfZbuM7Ss",
|
|
138
139
|
"Accept-Language": "de-de",
|
|
139
140
|
"x-gigya-id_token": this.session.id_token,
|
|
140
141
|
},
|
|
@@ -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");
|
|
@@ -153,6 +154,7 @@ class Renault extends utils.Adapter {
|
|
|
153
154
|
this.account = filteredAccounts[0];
|
|
154
155
|
})
|
|
155
156
|
.catch((error) => {
|
|
157
|
+
this.log.error("Error while getting account");
|
|
156
158
|
this.log.error(error);
|
|
157
159
|
if (error.response) {
|
|
158
160
|
this.log.error(JSON.stringify(error.response.data));
|
|
@@ -164,7 +166,7 @@ class Renault extends utils.Adapter {
|
|
|
164
166
|
method: "get",
|
|
165
167
|
url: "https://api-wired-prod-1-euw1.wrd-aws.com/commerce/v1/accounts/" + this.account.accountId + "/vehicles?country=" + this.country + "&oms=false",
|
|
166
168
|
headers: {
|
|
167
|
-
apikey: "
|
|
169
|
+
apikey: "VAX7XYKGfa92yMvXculCkEFyfZbuM7Ss",
|
|
168
170
|
"content-type": "application/json",
|
|
169
171
|
accept: "*/*",
|
|
170
172
|
"user-agent": "MYRenault/39 CFNetwork/1312 Darwin/21.0.0",
|
|
@@ -227,6 +229,7 @@ class Renault extends utils.Adapter {
|
|
|
227
229
|
}
|
|
228
230
|
})
|
|
229
231
|
.catch((error) => {
|
|
232
|
+
this.log.error("Error while getting vehicle list");
|
|
230
233
|
this.log.error(error);
|
|
231
234
|
error.response && this.log.error(JSON.stringify(error.response.data));
|
|
232
235
|
});
|
|
@@ -327,8 +330,8 @@ class Renault extends utils.Adapter {
|
|
|
327
330
|
"accept-language": "de-de",
|
|
328
331
|
"x-gigya-id_token": this.session.id_token,
|
|
329
332
|
};
|
|
330
|
-
this.deviceArray
|
|
331
|
-
|
|
333
|
+
for (const vin of this.deviceArray) {
|
|
334
|
+
for (const element of statusArray) {
|
|
332
335
|
if (this.ignoreState.includes(element.path)) {
|
|
333
336
|
return;
|
|
334
337
|
}
|
|
@@ -366,27 +369,30 @@ class Renault extends utils.Adapter {
|
|
|
366
369
|
|
|
367
370
|
return;
|
|
368
371
|
}
|
|
369
|
-
if (
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
372
|
+
if (this.firstUpdate) {
|
|
373
|
+
if (
|
|
374
|
+
error.response.status === 403 ||
|
|
375
|
+
error.response.status === 404 ||
|
|
376
|
+
error.response.status === 500 ||
|
|
377
|
+
error.response.status === 501 ||
|
|
378
|
+
error.response.status === 502 ||
|
|
379
|
+
error.response.status === 400
|
|
380
|
+
) {
|
|
381
|
+
this.ignoreState.push(element.path);
|
|
382
|
+
this.log.info("Feature not found. Ignore " + element.path + " for updates.");
|
|
383
|
+
this.log.info(error);
|
|
384
|
+
error.response && this.log.info(JSON.stringify(error.response.data));
|
|
385
|
+
return;
|
|
386
|
+
}
|
|
382
387
|
}
|
|
383
388
|
}
|
|
384
389
|
this.log.error(url);
|
|
385
390
|
this.log.error(error);
|
|
386
391
|
error.response && this.log.error(JSON.stringify(error.response.data));
|
|
387
392
|
});
|
|
388
|
-
}
|
|
389
|
-
}
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
this.firstUpdate = false;
|
|
390
396
|
}
|
|
391
397
|
async refreshToken() {
|
|
392
398
|
if (!this.session_data) {
|
|
@@ -432,6 +438,9 @@ class Renault extends utils.Adapter {
|
|
|
432
438
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
433
439
|
}
|
|
434
440
|
toCamelCase(string) {
|
|
441
|
+
if (!string) {
|
|
442
|
+
return;
|
|
443
|
+
}
|
|
435
444
|
const camelC = string.replace(/-([a-z])/g, function (g) {
|
|
436
445
|
return g[1].toUpperCase();
|
|
437
446
|
});
|
|
@@ -468,6 +477,10 @@ class Renault extends utils.Adapter {
|
|
|
468
477
|
if (path === "hvac-temperature") {
|
|
469
478
|
return;
|
|
470
479
|
}
|
|
480
|
+
if (!this.account) {
|
|
481
|
+
this.log.error("No account found");
|
|
482
|
+
return;
|
|
483
|
+
}
|
|
471
484
|
const command = path.split("/")[1];
|
|
472
485
|
const data = { data: { type: this.toCamelCase(command), attributes: { action: state.val ? "start" : "cancel" } } };
|
|
473
486
|
if (command === "hvac-start") {
|
package/package.json
CHANGED
|
@@ -1,73 +1,75 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
"
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
"
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
"
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
"
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
2
|
+
"name": "iobroker.renault",
|
|
3
|
+
"version": "0.0.9",
|
|
4
|
+
"description": "Adapter for Renault and Renault",
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "TA2k",
|
|
7
|
+
"email": "tombox2020@gmail.com"
|
|
8
|
+
},
|
|
9
|
+
"contributors": [
|
|
10
|
+
{
|
|
11
|
+
"name": "fungus75"
|
|
12
|
+
}
|
|
13
|
+
],
|
|
14
|
+
"homepage": "https://github.com/TA2k/ioBroker.renault",
|
|
15
|
+
"license": "MIT",
|
|
16
|
+
"keywords": [
|
|
17
|
+
"renault",
|
|
18
|
+
"Renault",
|
|
19
|
+
"dacia",
|
|
20
|
+
"Dacia"
|
|
21
|
+
],
|
|
22
|
+
"repository": {
|
|
23
|
+
"type": "git",
|
|
24
|
+
"url": "https://github.com/TA2k/ioBroker.renault"
|
|
25
|
+
},
|
|
26
|
+
"dependencies": {
|
|
27
|
+
"@iobroker/adapter-core": "^2.5.1",
|
|
28
|
+
"axios": "^0.24.0",
|
|
29
|
+
"json-bigint": "^1.0.0",
|
|
30
|
+
"qs": "^6.10.1"
|
|
31
|
+
},
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"@iobroker/testing": "^2.5.2",
|
|
34
|
+
"@types/chai": "^4.2.22",
|
|
35
|
+
"@types/chai-as-promised": "^7.1.4",
|
|
36
|
+
"@types/gulp": "^4.0.9",
|
|
37
|
+
"@types/mocha": "^9.0.0",
|
|
38
|
+
"@types/node": "^14.17.19",
|
|
39
|
+
"@types/proxyquire": "^1.3.28",
|
|
40
|
+
"@types/sinon": "^10.0.4",
|
|
41
|
+
"@types/sinon-chai": "^3.2.5",
|
|
42
|
+
"chai": "^4.3.4",
|
|
43
|
+
"chai-as-promised": "^7.1.1",
|
|
44
|
+
"eslint": "^7.32.0",
|
|
45
|
+
"gulp": "^4.0.2",
|
|
46
|
+
"mocha": "^9.1.2",
|
|
47
|
+
"proxyquire": "^2.1.3",
|
|
48
|
+
"sinon": "^11.1.2",
|
|
49
|
+
"sinon-chai": "^3.7.0",
|
|
50
|
+
"typescript": "~4.4.3"
|
|
51
|
+
},
|
|
52
|
+
"main": "main.js",
|
|
53
|
+
"files": [
|
|
54
|
+
"admin{,/!(src)/**}/!(tsconfig|tsconfig.*).json",
|
|
55
|
+
"admin{,/!(src)/**}/*.{html,css,png,svg,jpg,js}",
|
|
56
|
+
"lib/",
|
|
57
|
+
"www/",
|
|
58
|
+
"io-package.json",
|
|
59
|
+
"LICENSE",
|
|
60
|
+
"main.js"
|
|
61
|
+
],
|
|
62
|
+
"scripts": {
|
|
63
|
+
"test:js": "mocha --config test/mocharc.custom.json \"{!(node_modules|test)/**/*.test.js,*.test.js,test/**/test!(PackageFiles|Startup).js}\"",
|
|
64
|
+
"test:package": "mocha test/package --exit",
|
|
65
|
+
"test:unit": "mocha test/unit --exit",
|
|
66
|
+
"test:integration": "mocha test/integration --exit",
|
|
67
|
+
"test": "npm run test:js && npm run test:package",
|
|
68
|
+
"check": "tsc --noEmit -p tsconfig.check.json",
|
|
69
|
+
"lint": "eslint"
|
|
70
|
+
},
|
|
71
|
+
"bugs": {
|
|
72
|
+
"url": "https://github.com/TA2k/ioBroker.renault/issues"
|
|
73
|
+
},
|
|
74
|
+
"readmeFilename": "README.md"
|
|
73
75
|
}
|