homebridge-melcloud-control 4.0.0-beta.279 → 4.0.0-beta.280
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/package.json +1 -1
- package/src/melcloud.js +4 -8
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"displayName": "MELCloud Control",
|
|
3
3
|
"name": "homebridge-melcloud-control",
|
|
4
|
-
"version": "4.0.0-beta.
|
|
4
|
+
"version": "4.0.0-beta.280",
|
|
5
5
|
"description": "Homebridge plugin to control Mitsubishi Air Conditioner, Heat Pump and Energy Recovery Ventilation.",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"author": "grzegorz914",
|
package/src/melcloud.js
CHANGED
|
@@ -303,18 +303,14 @@ class MelCloud extends EventEmitter {
|
|
|
303
303
|
await Promise.all([button1.click(), page.waitForNavigation({ waitUntil: 'networkidle2', timeout: 10000 })]);
|
|
304
304
|
|
|
305
305
|
let authCode = null;
|
|
306
|
-
const
|
|
306
|
+
const timeout = 15000;
|
|
307
307
|
const start = Date.now();
|
|
308
308
|
|
|
309
|
-
|
|
310
|
-
while (!authCode && Date.now() - start < maxWait) {
|
|
309
|
+
while (!authCode && Date.now() - start < timeout) {
|
|
311
310
|
const url = await page.evaluate(() => window.location.href);
|
|
312
311
|
const match = url.match(/[?&]code=([^&]+)/);
|
|
313
|
-
if (match)
|
|
314
|
-
|
|
315
|
-
break;
|
|
316
|
-
}
|
|
317
|
-
await new Promise(r => setTimeout(r, 200));
|
|
312
|
+
if (match) authCode = match[1];
|
|
313
|
+
else await new Promise(r => setTimeout(r, 200));
|
|
318
314
|
}
|
|
319
315
|
|
|
320
316
|
if (!authCode) {
|