iobroker.bmw 2.5.3 → 2.5.4
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/io-package.json +4 -1
- package/main.js +11 -7
- package/package.json +6 -8
package/io-package.json
CHANGED
package/main.js
CHANGED
|
@@ -26,6 +26,9 @@ class Bmw extends utils.Adapter {
|
|
|
26
26
|
this.on("ready", this.onReady.bind(this));
|
|
27
27
|
this.on("stateChange", this.onStateChange.bind(this));
|
|
28
28
|
this.on("unload", this.onUnload.bind(this));
|
|
29
|
+
this.userAgent = "My%20BMW/8932 CFNetwork/978.0.7 Darwin/18.7.0";
|
|
30
|
+
this.userAgentDart = "Dart/2.14 (dart:io)";
|
|
31
|
+
this.xuserAgent = "android(SP1A.210812.016.C1);brand;2.5.2(14945);row";
|
|
29
32
|
}
|
|
30
33
|
|
|
31
34
|
/**
|
|
@@ -171,7 +174,7 @@ class Bmw extends utils.Adapter {
|
|
|
171
174
|
withCredentials: true,
|
|
172
175
|
headers: {
|
|
173
176
|
"Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
|
|
174
|
-
"User-Agent":
|
|
177
|
+
"User-Agent": this.userAgent,
|
|
175
178
|
Accept: "*/*",
|
|
176
179
|
"Accept-Language": "de-de",
|
|
177
180
|
Authorization: "Basic MzFjMzU3YTAtN2ExZC00NTkwLWFhOTktMzNiOTcyNDRkMDQ4OmMwZTMzOTNkLTcwYTItNGY2Zi05ZDNjLTg1MzBhZjY0ZDU1Mg==",
|
|
@@ -254,8 +257,8 @@ class Bmw extends utils.Adapter {
|
|
|
254
257
|
const brands = ["bmw", "mini"];
|
|
255
258
|
for (const brand of brands) {
|
|
256
259
|
const headers = {
|
|
257
|
-
"user-agent":
|
|
258
|
-
"x-user-agent": "
|
|
260
|
+
"user-agent": this.userAgentDart,
|
|
261
|
+
"x-user-agent": this.xuserAgent.replace(";brand;", `;${brand};`),
|
|
259
262
|
authorization: "Bearer " + this.session.access_token,
|
|
260
263
|
"accept-language": "de-DE",
|
|
261
264
|
host: "cocoapi.bmwgroup.com",
|
|
@@ -324,6 +327,7 @@ class Bmw extends utils.Adapter {
|
|
|
324
327
|
.catch((error) => {
|
|
325
328
|
this.log.error("getvehicles v2 failed");
|
|
326
329
|
this.log.error(error);
|
|
330
|
+
error.response && this.log.error(JSON.stringify(error.response.data));
|
|
327
331
|
});
|
|
328
332
|
}
|
|
329
333
|
}
|
|
@@ -332,8 +336,8 @@ class Bmw extends utils.Adapter {
|
|
|
332
336
|
return;
|
|
333
337
|
}
|
|
334
338
|
const headers = {
|
|
335
|
-
"user-agent":
|
|
336
|
-
"x-user-agent":
|
|
339
|
+
"user-agent": this.userAgentDart,
|
|
340
|
+
"x-user-agent": this.xuserAgent.replace(";brand;", `;bmw;`),
|
|
337
341
|
authorization: "Bearer " + this.session.access_token,
|
|
338
342
|
"accept-language": "de-DE",
|
|
339
343
|
"24-hour-format": "true",
|
|
@@ -501,8 +505,8 @@ class Bmw extends utils.Adapter {
|
|
|
501
505
|
command = command.split("_")[0];
|
|
502
506
|
|
|
503
507
|
const headers = {
|
|
504
|
-
"user-agent":
|
|
505
|
-
"x-user-agent":
|
|
508
|
+
"user-agent": this.userAgentDart,
|
|
509
|
+
"x-user-agent": this.xuserAgent.replace(";brand;", `;bmw;`),
|
|
506
510
|
authorization: "Bearer " + this.session.access_token,
|
|
507
511
|
"accept-language": "de-DE",
|
|
508
512
|
host: "cocoapi.bmwgroup.com",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "iobroker.bmw",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.4",
|
|
4
4
|
"description": "Adapter for BMW",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "TA2k",
|
|
@@ -24,9 +24,7 @@
|
|
|
24
24
|
"tough-cookie": "^4.0.0"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@
|
|
28
|
-
"@iobroker/adapter-dev": "^1.0.0",
|
|
29
|
-
"@iobroker/testing": "^2.5.4",
|
|
27
|
+
"@iobroker/testing": "^2.5.6",
|
|
30
28
|
"@types/chai": "^4.3.0",
|
|
31
29
|
"@types/chai-as-promised": "^7.1.5",
|
|
32
30
|
"@types/mocha": "^9.1.0",
|
|
@@ -36,12 +34,12 @@
|
|
|
36
34
|
"@types/sinon-chai": "^3.2.8",
|
|
37
35
|
"chai": "^4.3.6",
|
|
38
36
|
"chai-as-promised": "^7.1.1",
|
|
39
|
-
"eslint": "^8.
|
|
40
|
-
"mocha": "^9.2.
|
|
37
|
+
"eslint": "^8.13.0",
|
|
38
|
+
"mocha": "^9.2.2",
|
|
41
39
|
"proxyquire": "^2.1.3",
|
|
42
40
|
"sinon": "^13.0.1",
|
|
43
41
|
"sinon-chai": "^3.7.0",
|
|
44
|
-
"typescript": "
|
|
42
|
+
"typescript": "^4.6.3"
|
|
45
43
|
},
|
|
46
44
|
"main": "main.js",
|
|
47
45
|
"scripts": {
|
|
@@ -57,4 +55,4 @@
|
|
|
57
55
|
"url": "https://github.com/TA2k/ioBroker.bmw/issues"
|
|
58
56
|
},
|
|
59
57
|
"readmeFilename": "README.md"
|
|
60
|
-
}
|
|
58
|
+
}
|