iobroker.renault 0.0.7 → 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.
package/README.md CHANGED
@@ -12,13 +12,12 @@
12
12
 
13
13
  **Tests:** ![Test and Release](https://github.com/TA2k/ioBroker.renault/workflows/Test%20and%20Release/badge.svg)
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.6
31
+ ### 0.0.7
33
32
 
34
33
  * (TA2k) initial release
35
34
 
@@ -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,12 @@
1
1
  {
2
2
  "common": {
3
3
  "name": "renault",
4
- "version": "0.0.7",
4
+ "version": "0.0.10",
5
5
  "news": {
6
- "0.0.7": {
6
+ "0.0.10": {
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.0.0"
75
+ "js-controller": ">=3.2.0"
73
76
  }
74
77
  ],
75
78
  "globalDependencies": [
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: "Ae9FDWugRxZQAGm3Sxgk7uJn6Q4CGEA2",
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: "Ae9FDWugRxZQAGm3Sxgk7uJn6Q4CGEA2",
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",
@@ -228,6 +238,7 @@ class Renault extends utils.Adapter {
228
238
  }
229
239
  })
230
240
  .catch((error) => {
241
+ this.log.error("Error while getting vehicle list");
231
242
  this.log.error(error);
232
243
  error.response && this.log.error(JSON.stringify(error.response.data));
233
244
  });
@@ -321,7 +332,7 @@ class Renault extends utils.Adapter {
321
332
  ];
322
333
 
323
334
  const headers = {
324
- apikey: "Ae9FDWugRxZQAGm3Sxgk7uJn6Q4CGEA2",
335
+ apikey: this.apiKeyUpdate,
325
336
  "content-type": "application/json",
326
337
  accept: "*/*",
327
338
  "user-agent": "MYRenault/39 CFNetwork/1312 Darwin/21.0.0",
@@ -475,6 +486,10 @@ class Renault extends utils.Adapter {
475
486
  if (path === "hvac-temperature") {
476
487
  return;
477
488
  }
489
+ if (!this.account) {
490
+ this.log.error("No account found");
491
+ return;
492
+ }
478
493
  const command = path.split("/")[1];
479
494
  const data = { data: { type: this.toCamelCase(command), attributes: { action: state.val ? "start" : "cancel" } } };
480
495
  if (command === "hvac-start") {
@@ -500,7 +515,7 @@ class Renault extends utils.Adapter {
500
515
  method: "post",
501
516
  url: url,
502
517
  headers: {
503
- apikey: "Ae9FDWugRxZQAGm3Sxgk7uJn6Q4CGEA2",
518
+ apikey: this.apiKeyUpdate,
504
519
  "content-type": "application/vnd.api+json",
505
520
  accept: "*/*",
506
521
  "user-agent": "MYRenault/39 CFNetwork/1312 Darwin/21.0.0",
package/package.json CHANGED
@@ -1,73 +1,74 @@
1
1
  {
2
- "name": "iobroker.renault",
3
- "version": "0.0.7",
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
- ],
20
- "repository": {
21
- "type": "git",
22
- "url": "https://github.com/TA2k/ioBroker.renault"
23
- },
24
- "dependencies": {
25
- "@iobroker/adapter-core": "^2.5.1",
26
- "axios": "^0.24.0",
27
- "json-bigint": "^1.0.0",
28
- "qs": "^6.10.1"
29
- },
30
- "devDependencies": {
31
- "@iobroker/testing": "^2.5.2",
32
- "@types/chai": "^4.2.22",
33
- "@types/chai-as-promised": "^7.1.4",
34
- "@types/gulp": "^4.0.9",
35
- "@types/mocha": "^9.0.0",
36
- "@types/node": "^14.17.19",
37
- "@types/proxyquire": "^1.3.28",
38
- "@types/sinon": "^10.0.4",
39
- "@types/sinon-chai": "^3.2.5",
40
- "chai": "^4.3.4",
41
- "chai-as-promised": "^7.1.1",
42
- "eslint": "^7.32.0",
43
- "gulp": "^4.0.2",
44
- "mocha": "^9.1.2",
45
- "proxyquire": "^2.1.3",
46
- "sinon": "^11.1.2",
47
- "sinon-chai": "^3.7.0",
48
- "typescript": "~4.4.3"
49
- },
50
- "main": "main.js",
51
- "files": [
52
- "admin{,/!(src)/**}/!(tsconfig|tsconfig.*).json",
53
- "admin{,/!(src)/**}/*.{html,css,png,svg,jpg,js}",
54
- "lib/",
55
- "www/",
56
- "io-package.json",
57
- "LICENSE",
58
- "main.js"
59
- ],
60
- "scripts": {
61
- "test:js": "mocha --config test/mocharc.custom.json \"{!(node_modules|test)/**/*.test.js,*.test.js,test/**/test!(PackageFiles|Startup).js}\"",
62
- "test:package": "mocha test/package --exit",
63
- "test:unit": "mocha test/unit --exit",
64
- "test:integration": "mocha test/integration --exit",
65
- "test": "npm run test:js && npm run test:package",
66
- "check": "tsc --noEmit -p tsconfig.check.json",
67
- "lint": "eslint"
68
- },
69
- "bugs": {
70
- "url": "https://github.com/TA2k/ioBroker.renault/issues"
71
- },
72
- "readmeFilename": "README.md"
2
+ "name": "iobroker.renault",
3
+ "version": "0.0.10",
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"
73
74
  }