iobroker.renault 0.0.8 → 0.0.11
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/admin/index_m.html +7 -0
- package/io-package.json +7 -1
- package/main.js +22 -5
- package/package.json +72 -73
package/admin/index_m.html
CHANGED
|
@@ -93,6 +93,13 @@
|
|
|
93
93
|
<label for="country" class="translate">Country</label>
|
|
94
94
|
</div>
|
|
95
95
|
</div>
|
|
96
|
+
<div class="row">
|
|
97
|
+
<div class="col s6 input-field">
|
|
98
|
+
<input type="text" class="value" id="apiKeyUpdate" />
|
|
99
|
+
<label for="apiKeyUpdate" class="translate">API Key. Wenn leer wird es automatisch gesetzt.</label>
|
|
100
|
+
</div>
|
|
101
|
+
<a href="https://github.com/db-EV/ZoePHP/blob/main/src/api-keys.php" target="_blank" class="translate">Click here for Current API Key</a>
|
|
102
|
+
</div>
|
|
96
103
|
</div>
|
|
97
104
|
</body>
|
|
98
105
|
</html>
|
package/io-package.json
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"common": {
|
|
3
3
|
"name": "renault",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.10",
|
|
5
5
|
"news": {
|
|
6
|
+
"0.0.11": {
|
|
7
|
+
"en": "add remote object for force refresh"
|
|
8
|
+
},
|
|
9
|
+
"0.0.10": {
|
|
10
|
+
"en": "update apikey"
|
|
11
|
+
},
|
|
6
12
|
"0.0.8": {
|
|
7
13
|
"en": "initial release",
|
|
8
14
|
"de": "Erstveröffentlichung",
|
package/main.js
CHANGED
|
@@ -48,6 +48,11 @@ class Renault extends utils.Adapter {
|
|
|
48
48
|
this.session = {};
|
|
49
49
|
//DE API Key
|
|
50
50
|
this.apiKey = "3_7PLksOyBRkHv126x5WhHb-5pqC1qFR8pQjxSeLB6nhAnPERTUlwnYoznHSxwX668";
|
|
51
|
+
this.apiKeyUpdate = "VAX7XYKGfa92yMvXculCkEFyfZbuM7Ss";
|
|
52
|
+
if (this.config.apiKeyUpdate) {
|
|
53
|
+
this.apiKeyUpdate = this.config.apiKeyUpdate;
|
|
54
|
+
}
|
|
55
|
+
|
|
51
56
|
this.subscribeStates("*");
|
|
52
57
|
|
|
53
58
|
await this.login();
|
|
@@ -135,13 +140,14 @@ class Renault extends utils.Adapter {
|
|
|
135
140
|
"Content-Type": "application/json",
|
|
136
141
|
Accept: "*/*",
|
|
137
142
|
"User-Agent": "MYRenault/39 CFNetwork/1312 Darwin/21.0.0",
|
|
138
|
-
apiKey:
|
|
143
|
+
apiKey: this.apiKeyUpdate,
|
|
139
144
|
"Accept-Language": "de-de",
|
|
140
145
|
"x-gigya-id_token": this.session.id_token,
|
|
141
146
|
},
|
|
142
147
|
})
|
|
143
148
|
.then((res) => {
|
|
144
149
|
this.log.debug(JSON.stringify(res.data));
|
|
150
|
+
|
|
145
151
|
const filteredAccounts = res.data.currentUser.accounts.filter(function (el) {
|
|
146
152
|
return (el.accountType === "MYRENAULT" || el.accountType === "MYDACIA") && el.accountStatus === "ACTIVE";
|
|
147
153
|
});
|
|
@@ -154,9 +160,13 @@ class Renault extends utils.Adapter {
|
|
|
154
160
|
this.account = filteredAccounts[0];
|
|
155
161
|
})
|
|
156
162
|
.catch((error) => {
|
|
163
|
+
this.log.error("Error while getting account");
|
|
157
164
|
this.log.error(error);
|
|
158
165
|
if (error.response) {
|
|
159
166
|
this.log.error(JSON.stringify(error.response.data));
|
|
167
|
+
if (error.response.data.indexOf("apikey") !== -1) {
|
|
168
|
+
this.log.error("Wrong API Key. Please update API Key in adapter settings");
|
|
169
|
+
}
|
|
160
170
|
}
|
|
161
171
|
});
|
|
162
172
|
}
|
|
@@ -165,7 +175,7 @@ class Renault extends utils.Adapter {
|
|
|
165
175
|
method: "get",
|
|
166
176
|
url: "https://api-wired-prod-1-euw1.wrd-aws.com/commerce/v1/accounts/" + this.account.accountId + "/vehicles?country=" + this.country + "&oms=false",
|
|
167
177
|
headers: {
|
|
168
|
-
apikey:
|
|
178
|
+
apikey: this.apiKeyUpdate,
|
|
169
179
|
"content-type": "application/json",
|
|
170
180
|
accept: "*/*",
|
|
171
181
|
"user-agent": "MYRenault/39 CFNetwork/1312 Darwin/21.0.0",
|
|
@@ -210,6 +220,7 @@ class Renault extends utils.Adapter {
|
|
|
210
220
|
{ command: "actions/charging-start", name: "True = Start, False = Stop" },
|
|
211
221
|
{ command: "charge/pause-resume", name: "True = Start, False = Stop" },
|
|
212
222
|
{ command: "charge/start", name: "True = Start, False = Stop" },
|
|
223
|
+
{ command: "refresh", name: "True = Refresh Data" },
|
|
213
224
|
];
|
|
214
225
|
remoteArray.forEach((remote) => {
|
|
215
226
|
this.setObjectNotExists(device.vin + ".remote." + remote.command, {
|
|
@@ -228,6 +239,7 @@ class Renault extends utils.Adapter {
|
|
|
228
239
|
}
|
|
229
240
|
})
|
|
230
241
|
.catch((error) => {
|
|
242
|
+
this.log.error("Error while getting vehicle list");
|
|
231
243
|
this.log.error(error);
|
|
232
244
|
error.response && this.log.error(JSON.stringify(error.response.data));
|
|
233
245
|
});
|
|
@@ -321,7 +333,7 @@ class Renault extends utils.Adapter {
|
|
|
321
333
|
];
|
|
322
334
|
|
|
323
335
|
const headers = {
|
|
324
|
-
apikey:
|
|
336
|
+
apikey: this.apiKeyUpdate,
|
|
325
337
|
"content-type": "application/json",
|
|
326
338
|
accept: "*/*",
|
|
327
339
|
"user-agent": "MYRenault/39 CFNetwork/1312 Darwin/21.0.0",
|
|
@@ -475,6 +487,11 @@ class Renault extends utils.Adapter {
|
|
|
475
487
|
if (path === "hvac-temperature") {
|
|
476
488
|
return;
|
|
477
489
|
}
|
|
490
|
+
if (path === "refresh") {
|
|
491
|
+
this.log.info("Force refresh");
|
|
492
|
+
this.updateDevices();
|
|
493
|
+
return;
|
|
494
|
+
}
|
|
478
495
|
if (!this.account) {
|
|
479
496
|
this.log.error("No account found");
|
|
480
497
|
return;
|
|
@@ -504,7 +521,7 @@ class Renault extends utils.Adapter {
|
|
|
504
521
|
method: "post",
|
|
505
522
|
url: url,
|
|
506
523
|
headers: {
|
|
507
|
-
apikey:
|
|
524
|
+
apikey: this.apiKeyUpdate,
|
|
508
525
|
"content-type": "application/vnd.api+json",
|
|
509
526
|
accept: "*/*",
|
|
510
527
|
"user-agent": "MYRenault/39 CFNetwork/1312 Darwin/21.0.0",
|
|
@@ -526,7 +543,7 @@ class Renault extends utils.Adapter {
|
|
|
526
543
|
clearTimeout(this.refreshTimeout);
|
|
527
544
|
this.refreshTimeout = setTimeout(async () => {
|
|
528
545
|
await this.updateDevices();
|
|
529
|
-
},
|
|
546
|
+
}, 20 * 1000);
|
|
530
547
|
}
|
|
531
548
|
}
|
|
532
549
|
}
|
package/package.json
CHANGED
|
@@ -1,75 +1,74 @@
|
|
|
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
|
-
|
|
73
|
-
|
|
74
|
-
"readmeFilename": "README.md"
|
|
2
|
+
"name": "iobroker.renault",
|
|
3
|
+
"version": "0.0.11",
|
|
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.6.0",
|
|
28
|
+
"axios": "^0.24.0",
|
|
29
|
+
"json-bigint": "^1.0.0",
|
|
30
|
+
"qs": "^6.10.3"
|
|
31
|
+
},
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"@iobroker/testing": "^2.5.6",
|
|
34
|
+
"@types/chai": "^4.3.0",
|
|
35
|
+
"@types/chai-as-promised": "^7.1.5",
|
|
36
|
+
"@types/gulp": "^4.0.9",
|
|
37
|
+
"@types/mocha": "^9.1.0",
|
|
38
|
+
"@types/node": "^14.18.12",
|
|
39
|
+
"@types/proxyquire": "^1.3.28",
|
|
40
|
+
"@types/sinon": "^10.0.11",
|
|
41
|
+
"@types/sinon-chai": "^3.2.8",
|
|
42
|
+
"chai": "^4.3.6",
|
|
43
|
+
"chai-as-promised": "^7.1.1",
|
|
44
|
+
"eslint": "^7.32.0",
|
|
45
|
+
"mocha": "^9.2.2",
|
|
46
|
+
"proxyquire": "^2.1.3",
|
|
47
|
+
"sinon": "^11.1.2",
|
|
48
|
+
"sinon-chai": "^3.7.0",
|
|
49
|
+
"typescript": "^4.6.2"
|
|
50
|
+
},
|
|
51
|
+
"main": "main.js",
|
|
52
|
+
"files": [
|
|
53
|
+
"admin{,/!(src)/**}/!(tsconfig|tsconfig.*).json",
|
|
54
|
+
"admin{,/!(src)/**}/*.{html,css,png,svg,jpg,js}",
|
|
55
|
+
"lib/",
|
|
56
|
+
"www/",
|
|
57
|
+
"io-package.json",
|
|
58
|
+
"LICENSE",
|
|
59
|
+
"main.js"
|
|
60
|
+
],
|
|
61
|
+
"scripts": {
|
|
62
|
+
"test:js": "mocha --config test/mocharc.custom.json \"{!(node_modules|test)/**/*.test.js,*.test.js,test/**/test!(PackageFiles|Startup).js}\"",
|
|
63
|
+
"test:package": "mocha test/package --exit",
|
|
64
|
+
"test:unit": "mocha test/unit --exit",
|
|
65
|
+
"test:integration": "mocha test/integration --exit",
|
|
66
|
+
"test": "npm run test:js && npm run test:package",
|
|
67
|
+
"check": "tsc --noEmit -p tsconfig.check.json",
|
|
68
|
+
"lint": "eslint"
|
|
69
|
+
},
|
|
70
|
+
"bugs": {
|
|
71
|
+
"url": "https://github.com/TA2k/ioBroker.renault/issues"
|
|
72
|
+
},
|
|
73
|
+
"readmeFilename": "README.md"
|
|
75
74
|
}
|