iobroker.renault 0.0.14 → 0.0.15

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.
Files changed (3) hide show
  1. package/io-package.json +4 -1
  2. package/main.js +14 -5
  3. package/package.json +10 -11
package/io-package.json CHANGED
@@ -1,8 +1,11 @@
1
1
  {
2
2
  "common": {
3
3
  "name": "renault",
4
- "version": "0.0.14",
4
+ "version": "0.0.15",
5
5
  "news": {
6
+ "0.0.15": {
7
+ "en": "fix charge start and reduce error logs"
8
+ },
6
9
  "0.0.14": {
7
10
  "en": "add charging stop"
8
11
  },
package/main.js CHANGED
@@ -447,6 +447,10 @@ class Renault extends utils.Adapter {
447
447
  }
448
448
  }
449
449
  }
450
+ if (error.response && error.response.status >= 500) {
451
+ this.log.warn(`Renault Server error: ${error.response.status} `);
452
+ return;
453
+ }
450
454
  this.log.error(url);
451
455
  this.log.error(error);
452
456
  error.response && this.log.error(JSON.stringify(error.response.data));
@@ -502,6 +506,8 @@ class Renault extends utils.Adapter {
502
506
  if (!string) {
503
507
  return;
504
508
  }
509
+ string = string.replace("actions/", "");
510
+ string = string.replace("/", "-");
505
511
  const camelC = string.replace(/-([a-z])/g, function (g) {
506
512
  return g[1].toUpperCase();
507
513
  });
@@ -549,10 +555,12 @@ class Renault extends utils.Adapter {
549
555
  }
550
556
  const command = path.split("/")[1];
551
557
  let action = state.val ? "start" : "cancel";
552
- if (path === "charging-start") {
553
- action = state.val ? "start" : "stop";
558
+ let midPart = "kca/car-adapter/v1/cars/";
559
+ if (path === "charge/pause-resume") {
560
+ action = state.val ? "resume" : "pause";
561
+ midPart = "kcm/v1/vehicles/";
554
562
  }
555
- const data = { data: { type: this.toCamelCase(command), attributes: { action: action } } };
563
+ const data = { data: { type: this.toCamelCase(path), attributes: { action: action } } };
556
564
  if (command === "hvac-start") {
557
565
  const temperatureState = await this.getStateAsync(deviceId + ".remote.hvac-temperature");
558
566
  if (temperatureState) {
@@ -564,7 +572,8 @@ class Renault extends utils.Adapter {
564
572
  const url =
565
573
  "https://api-wired-prod-1-euw1.wrd-aws.com/commerce/v1/accounts/" +
566
574
  this.account.accountId +
567
- "/kamereon/kca/car-adapter/v1/cars/" +
575
+ "/kamereon/" +
576
+ midPart +
568
577
  deviceId +
569
578
  "/" +
570
579
  path +
@@ -586,7 +595,7 @@ class Renault extends utils.Adapter {
586
595
  data: data,
587
596
  })
588
597
  .then((res) => {
589
- this.log.debug(JSON.stringify(res.data));
598
+ this.log.info(JSON.stringify(res.data));
590
599
  return res.data;
591
600
  })
592
601
  .catch((error) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iobroker.renault",
3
- "version": "0.0.14",
3
+ "version": "0.0.15",
4
4
  "description": "Adapter for Renault and Renault",
5
5
  "author": {
6
6
  "name": "TA2k",
@@ -24,29 +24,28 @@
24
24
  "url": "https://github.com/TA2k/ioBroker.renault"
25
25
  },
26
26
  "dependencies": {
27
- "@iobroker/adapter-core": "^2.6.2",
27
+ "@iobroker/adapter-core": "^2.6.7",
28
28
  "axios": "^0.27.2",
29
29
  "json-bigint": "^1.0.0",
30
30
  "qs": "^6.11.0"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@iobroker/testing": "^4.1.0",
34
- "@types/chai": "^4.3.3",
34
+ "@types/chai": "^4.3.4",
35
35
  "@types/chai-as-promised": "^7.1.5",
36
- "@types/gulp": "^4.0.9",
37
36
  "@types/mocha": "^9.1.1",
38
- "@types/node": "^18.7.16",
37
+ "@types/node": "^18.11.9",
39
38
  "@types/proxyquire": "^1.3.28",
40
39
  "@types/sinon": "^10.0.13",
41
- "@types/sinon-chai": "^3.2.8",
42
- "chai": "^4.3.6",
40
+ "@types/sinon-chai": "^3.2.9",
41
+ "chai": "^4.3.7",
43
42
  "chai-as-promised": "^7.1.1",
44
- "eslint": "^8.23.0",
45
- "mocha": "^10.0.0",
43
+ "eslint": "^8.27.0",
44
+ "mocha": "^10.1.0",
46
45
  "proxyquire": "^2.1.3",
47
- "sinon": "^14.0.0",
46
+ "sinon": "^14.0.2",
48
47
  "sinon-chai": "^3.7.0",
49
- "typescript": "^4.8.3"
48
+ "typescript": "^4.9.3"
50
49
  },
51
50
  "main": "main.js",
52
51
  "files": [