iobroker.bmw 2.5.0 → 2.5.1
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 +5 -1
- package/main.js +13 -2
- package/package.json +1 -1
package/io-package.json
CHANGED
package/main.js
CHANGED
|
@@ -50,7 +50,10 @@ class Bmw extends utils.Adapter {
|
|
|
50
50
|
this.statusBlock = {};
|
|
51
51
|
this.nonChargingHistory = {};
|
|
52
52
|
this.subscribeStates("*");
|
|
53
|
-
|
|
53
|
+
if (!this.config.username || !this.config.password) {
|
|
54
|
+
this.log.error("Please set username and password");
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
54
57
|
await this.login();
|
|
55
58
|
if (this.session.access_token) {
|
|
56
59
|
await this.getVehicles();
|
|
@@ -85,6 +88,7 @@ class Bmw extends utils.Adapter {
|
|
|
85
88
|
password: this.config.password,
|
|
86
89
|
grant_type: "authorization_code",
|
|
87
90
|
};
|
|
91
|
+
|
|
88
92
|
const authUrl = await this.requestClient({
|
|
89
93
|
method: "post",
|
|
90
94
|
url: "https://customer.bmwgroup.com/gcdm/oauth/authenticate",
|
|
@@ -103,7 +107,13 @@ class Bmw extends utils.Adapter {
|
|
|
103
107
|
this.log.error(JSON.stringify(error.response.data));
|
|
104
108
|
}
|
|
105
109
|
if (error.response && error.response.status === 401) {
|
|
106
|
-
this.log.error("Please check username and password");
|
|
110
|
+
this.log.error("Please check username and password or too many logins in 5 minutes");
|
|
111
|
+
|
|
112
|
+
this.log.error("Start relogin in 5min");
|
|
113
|
+
this.reLoginTimeout && clearTimeout(this.reLoginTimeout);
|
|
114
|
+
this.reLoginTimeout = setTimeout(() => {
|
|
115
|
+
this.login();
|
|
116
|
+
}, 5000 * 60 * 1);
|
|
107
117
|
}
|
|
108
118
|
if (error.response && error.response.status === 400) {
|
|
109
119
|
this.log.error("Please check username and password");
|
|
@@ -428,6 +438,7 @@ class Bmw extends utils.Adapter {
|
|
|
428
438
|
this.log.error(error);
|
|
429
439
|
error.response && this.log.error(JSON.stringify(error.response.data));
|
|
430
440
|
this.log.error("Start relogin in 1min");
|
|
441
|
+
this.reLoginTimeout && clearTimeout(this.reLoginTimeout);
|
|
431
442
|
this.reLoginTimeout = setTimeout(() => {
|
|
432
443
|
this.login();
|
|
433
444
|
}, 1000 * 60 * 1);
|