iobroker.renault 0.0.9 → 0.0.10

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.
@@ -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,9 +1,9 @@
1
1
  {
2
2
  "common": {
3
3
  "name": "renault",
4
- "version": "0.0.9",
4
+ "version": "0.0.10",
5
5
  "news": {
6
- "0.0.9": {
6
+ "0.0.10": {
7
7
  "en": "update apikey"
8
8
  },
9
9
  "0.0.8": {
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: "VAX7XYKGfa92yMvXculCkEFyfZbuM7Ss",
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: "VAX7XYKGfa92yMvXculCkEFyfZbuM7Ss",
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",
@@ -323,7 +332,7 @@ class Renault extends utils.Adapter {
323
332
  ];
324
333
 
325
334
  const headers = {
326
- apikey: "Ae9FDWugRxZQAGm3Sxgk7uJn6Q4CGEA2",
335
+ apikey: this.apiKeyUpdate,
327
336
  "content-type": "application/json",
328
337
  accept: "*/*",
329
338
  "user-agent": "MYRenault/39 CFNetwork/1312 Darwin/21.0.0",
@@ -506,7 +515,7 @@ class Renault extends utils.Adapter {
506
515
  method: "post",
507
516
  url: url,
508
517
  headers: {
509
- apikey: "Ae9FDWugRxZQAGm3Sxgk7uJn6Q4CGEA2",
518
+ apikey: this.apiKeyUpdate,
510
519
  "content-type": "application/vnd.api+json",
511
520
  accept: "*/*",
512
521
  "user-agent": "MYRenault/39 CFNetwork/1312 Darwin/21.0.0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iobroker.renault",
3
- "version": "0.0.9",
3
+ "version": "0.0.10",
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.5.1",
27
+ "@iobroker/adapter-core": "^2.6.0",
28
28
  "axios": "^0.24.0",
29
29
  "json-bigint": "^1.0.0",
30
- "qs": "^6.10.1"
30
+ "qs": "^6.10.3"
31
31
  },
32
32
  "devDependencies": {
33
- "@iobroker/testing": "^2.5.2",
34
- "@types/chai": "^4.2.22",
35
- "@types/chai-as-promised": "^7.1.4",
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.0.0",
38
- "@types/node": "^14.17.19",
37
+ "@types/mocha": "^9.1.0",
38
+ "@types/node": "^14.18.12",
39
39
  "@types/proxyquire": "^1.3.28",
40
- "@types/sinon": "^10.0.4",
41
- "@types/sinon-chai": "^3.2.5",
42
- "chai": "^4.3.4",
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
- "gulp": "^4.0.2",
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": "~4.4.3"
49
+ "typescript": "^4.6.2"
51
50
  },
52
51
  "main": "main.js",
53
52
  "files": [