iobroker.renault 0.0.9 → 0.0.12
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 +5 -2
- package/main.js +20 -5
- package/package.json +13 -14
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
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
|
});
|
|
@@ -158,6 +164,9 @@ class Renault extends utils.Adapter {
|
|
|
158
164
|
this.log.error(error);
|
|
159
165
|
if (error.response) {
|
|
160
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
|
+
}
|
|
161
170
|
}
|
|
162
171
|
});
|
|
163
172
|
}
|
|
@@ -166,7 +175,7 @@ class Renault extends utils.Adapter {
|
|
|
166
175
|
method: "get",
|
|
167
176
|
url: "https://api-wired-prod-1-euw1.wrd-aws.com/commerce/v1/accounts/" + this.account.accountId + "/vehicles?country=" + this.country + "&oms=false",
|
|
168
177
|
headers: {
|
|
169
|
-
apikey:
|
|
178
|
+
apikey: this.apiKeyUpdate,
|
|
170
179
|
"content-type": "application/json",
|
|
171
180
|
accept: "*/*",
|
|
172
181
|
"user-agent": "MYRenault/39 CFNetwork/1312 Darwin/21.0.0",
|
|
@@ -211,6 +220,7 @@ class Renault extends utils.Adapter {
|
|
|
211
220
|
{ command: "actions/charging-start", name: "True = Start, False = Stop" },
|
|
212
221
|
{ command: "charge/pause-resume", name: "True = Start, False = Stop" },
|
|
213
222
|
{ command: "charge/start", name: "True = Start, False = Stop" },
|
|
223
|
+
{ command: "refresh", name: "True = Refresh Data" },
|
|
214
224
|
];
|
|
215
225
|
remoteArray.forEach((remote) => {
|
|
216
226
|
this.setObjectNotExists(device.vin + ".remote." + remote.command, {
|
|
@@ -323,7 +333,7 @@ class Renault extends utils.Adapter {
|
|
|
323
333
|
];
|
|
324
334
|
|
|
325
335
|
const headers = {
|
|
326
|
-
apikey:
|
|
336
|
+
apikey: this.apiKeyUpdate,
|
|
327
337
|
"content-type": "application/json",
|
|
328
338
|
accept: "*/*",
|
|
329
339
|
"user-agent": "MYRenault/39 CFNetwork/1312 Darwin/21.0.0",
|
|
@@ -477,6 +487,11 @@ class Renault extends utils.Adapter {
|
|
|
477
487
|
if (path === "hvac-temperature") {
|
|
478
488
|
return;
|
|
479
489
|
}
|
|
490
|
+
if (path === "refresh") {
|
|
491
|
+
this.log.info("Force refresh");
|
|
492
|
+
this.updateDevices();
|
|
493
|
+
return;
|
|
494
|
+
}
|
|
480
495
|
if (!this.account) {
|
|
481
496
|
this.log.error("No account found");
|
|
482
497
|
return;
|
|
@@ -506,7 +521,7 @@ class Renault extends utils.Adapter {
|
|
|
506
521
|
method: "post",
|
|
507
522
|
url: url,
|
|
508
523
|
headers: {
|
|
509
|
-
apikey:
|
|
524
|
+
apikey: this.apiKeyUpdate,
|
|
510
525
|
"content-type": "application/vnd.api+json",
|
|
511
526
|
accept: "*/*",
|
|
512
527
|
"user-agent": "MYRenault/39 CFNetwork/1312 Darwin/21.0.0",
|
|
@@ -528,7 +543,7 @@ class Renault extends utils.Adapter {
|
|
|
528
543
|
clearTimeout(this.refreshTimeout);
|
|
529
544
|
this.refreshTimeout = setTimeout(async () => {
|
|
530
545
|
await this.updateDevices();
|
|
531
|
-
},
|
|
546
|
+
}, 20 * 1000);
|
|
532
547
|
}
|
|
533
548
|
}
|
|
534
549
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "iobroker.renault",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.12",
|
|
4
4
|
"description": "Adapter for Renault and Renault",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "TA2k",
|
|
@@ -24,30 +24,29 @@
|
|
|
24
24
|
"url": "https://github.com/TA2k/ioBroker.renault"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@iobroker/adapter-core": "^2.
|
|
27
|
+
"@iobroker/adapter-core": "^2.6.0",
|
|
28
28
|
"axios": "^0.24.0",
|
|
29
29
|
"json-bigint": "^1.0.0",
|
|
30
|
-
"qs": "^6.10.
|
|
30
|
+
"qs": "^6.10.3"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@iobroker/testing": "^2.5.
|
|
34
|
-
"@types/chai": "^4.
|
|
35
|
-
"@types/chai-as-promised": "^7.1.
|
|
33
|
+
"@iobroker/testing": "^2.5.6",
|
|
34
|
+
"@types/chai": "^4.3.0",
|
|
35
|
+
"@types/chai-as-promised": "^7.1.5",
|
|
36
36
|
"@types/gulp": "^4.0.9",
|
|
37
|
-
"@types/mocha": "^9.
|
|
38
|
-
"@types/node": "^14.
|
|
37
|
+
"@types/mocha": "^9.1.0",
|
|
38
|
+
"@types/node": "^14.18.12",
|
|
39
39
|
"@types/proxyquire": "^1.3.28",
|
|
40
|
-
"@types/sinon": "^10.0.
|
|
41
|
-
"@types/sinon-chai": "^3.2.
|
|
42
|
-
"chai": "^4.3.
|
|
40
|
+
"@types/sinon": "^10.0.11",
|
|
41
|
+
"@types/sinon-chai": "^3.2.8",
|
|
42
|
+
"chai": "^4.3.6",
|
|
43
43
|
"chai-as-promised": "^7.1.1",
|
|
44
44
|
"eslint": "^7.32.0",
|
|
45
|
-
"
|
|
46
|
-
"mocha": "^9.1.2",
|
|
45
|
+
"mocha": "^9.2.2",
|
|
47
46
|
"proxyquire": "^2.1.3",
|
|
48
47
|
"sinon": "^11.1.2",
|
|
49
48
|
"sinon-chai": "^3.7.0",
|
|
50
|
-
"typescript": "
|
|
49
|
+
"typescript": "^4.6.2"
|
|
51
50
|
},
|
|
52
51
|
"main": "main.js",
|
|
53
52
|
"files": [
|