iobroker.renault 0.0.16 → 0.0.17

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 +2 -2
  2. package/main.js +18 -17
  3. package/package.json +1 -1
package/io-package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "common": {
3
3
  "name": "renault",
4
- "version": "0.0.16",
4
+ "version": "0.0.17",
5
5
  "news": {
6
- "0.0.16": {
6
+ "0.0.17": {
7
7
  "en": "update apikey"
8
8
  },
9
9
  "0.0.15": {
package/main.js CHANGED
@@ -48,24 +48,25 @@ class Renault extends utils.Adapter {
48
48
  //DE API Key
49
49
  this.apiKey = "3_7PLksOyBRkHv126x5WhHb-5pqC1qFR8pQjxSeLB6nhAnPERTUlwnYoznHSxwX668";
50
50
  this.apiKeyUpdate = "YjkKtHmGfaceeuExUDKGxrLZGGvtVS0J";
51
- await this.requestClient({
52
- method: "get",
53
- url: "https://raw.githubusercontent.com/db-EV/ZoePHP/main/src/api-keys.php",
54
- })
55
-
56
- .then((res) => {
57
- this.log.debug(JSON.stringify(res.data));
58
- const data = res.data;
59
- //find kamereon_api via regex
60
- const regex = /\$kamereon_api\s*=\s*['"]([^'"]+)['"]/;
61
- const match = data.match(regex);
62
- if (match && match[1]) {
63
- this.apiKeyUpdate = match[1];
64
- }
51
+ try {
52
+ await this.requestClient({
53
+ method: "get",
54
+ url: "https://raw.githubusercontent.com/hacf-fr/renault-api/main/src/renault_api/const.py",
65
55
  })
66
- .catch((error) => {
67
- this.log.debug(error);
68
- });
56
+
57
+ .then((res) => {
58
+ this.log.debug(JSON.stringify(res.data));
59
+
60
+ if (res.data.split('KAMEREON_APIKEY = "')[2] && res.data.split('KAMEREON_APIKEY = "')[2].split('"')[0]) {
61
+ this.apiKeyUpdate = res.data.split('KAMEREON_APIKEY = "')[2].split('"')[0];
62
+ }
63
+ })
64
+ .catch((error) => {
65
+ this.log.debug(error);
66
+ });
67
+ } catch (error) {
68
+ this.log.debug(error);
69
+ }
69
70
  if (this.config.apiKeyUpdate) {
70
71
  this.apiKeyUpdate = this.config.apiKeyUpdate;
71
72
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iobroker.renault",
3
- "version": "0.0.16",
3
+ "version": "0.0.17",
4
4
  "description": "Adapter for Renault and Renault",
5
5
  "author": {
6
6
  "name": "TA2k",