homebridge-melcloud-control 4.0.0-beta.490 → 4.0.0-beta.492
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 +7 -16
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.492",
|
|
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
|
@@ -318,7 +318,7 @@ class MelCloud extends EventEmitter {
|
|
|
318
318
|
});
|
|
319
319
|
|
|
320
320
|
// Wait for Puppeteer target to be ready (browser internal page)
|
|
321
|
-
await new Promise(r => setTimeout(r,
|
|
321
|
+
await new Promise(r => setTimeout(r, 1500));
|
|
322
322
|
|
|
323
323
|
// Defensive check for main frame availability
|
|
324
324
|
this.emit('warn', `Test 2`);
|
|
@@ -327,11 +327,9 @@ class MelCloud extends EventEmitter {
|
|
|
327
327
|
if (!page) {
|
|
328
328
|
if (this.logWarn) this.emit('warn', 'No initial page found, creating a new one.');
|
|
329
329
|
page = await browser.newPage();
|
|
330
|
+
await new Promise(r => setTimeout(r, 2000));
|
|
330
331
|
}
|
|
331
332
|
|
|
332
|
-
// Ensure page is ready
|
|
333
|
-
await new Promise(r => setTimeout(r, 1000));
|
|
334
|
-
|
|
335
333
|
this.emit('warn', `Test 3`);
|
|
336
334
|
page.on('error', err => { if (this.logError) this.emit('error', `Page crashed: ${err.message}`); });
|
|
337
335
|
page.on('pageerror', err => { if (this.logDebug) this.emit('error', `Browser error: ${err.message}`); });
|
|
@@ -345,7 +343,7 @@ class MelCloud extends EventEmitter {
|
|
|
345
343
|
this.emit('warn', `Test 4`);
|
|
346
344
|
await page.goto(ApiUrlsHome.BaseURL, { waitUntil: ['domcontentloaded', 'networkidle2'] });
|
|
347
345
|
|
|
348
|
-
await new Promise(r => setTimeout(r,
|
|
346
|
+
await new Promise(r => setTimeout(r, 3500));
|
|
349
347
|
let loginBtn;
|
|
350
348
|
try {
|
|
351
349
|
this.emit('warn', `Test 5`);
|
|
@@ -357,12 +355,8 @@ class MelCloud extends EventEmitter {
|
|
|
357
355
|
if (this.logWarn) this.emit('warn', 'Login button not found after 5s');
|
|
358
356
|
return null;
|
|
359
357
|
}
|
|
360
|
-
this.emit('warn', `Test 5.2`);
|
|
361
358
|
|
|
362
|
-
await Promise.race([
|
|
363
|
-
Promise.all([loginBtn.click(), page.waitForNavigation({ waitUntil: ['domcontentloaded', 'networkidle2'], timeout: 15000 })]),
|
|
364
|
-
new Promise(r => setTimeout(r, 12000))
|
|
365
|
-
]);
|
|
359
|
+
await Promise.race([Promise.all([loginBtn.click(), page.waitForNavigation({ waitUntil: ['domcontentloaded', 'networkidle2'], timeout: 10000 })]), new Promise(r => setTimeout(r, 8000))]);
|
|
366
360
|
|
|
367
361
|
this.emit('warn', `Test 7`);
|
|
368
362
|
const usernameInput = await page.$('input[name="username"]');
|
|
@@ -383,10 +377,7 @@ class MelCloud extends EventEmitter {
|
|
|
383
377
|
return null;
|
|
384
378
|
}
|
|
385
379
|
|
|
386
|
-
await Promise.race([
|
|
387
|
-
Promise.all([submitButton.click(), page.waitForNavigation({ waitUntil: ['domcontentloaded', 'networkidle2'], timeout: 20000 })]),
|
|
388
|
-
new Promise(r => setTimeout(r, 15000))
|
|
389
|
-
]);
|
|
380
|
+
await Promise.race([Promise.all([submitButton.click(), page.waitForNavigation({ waitUntil: ['domcontentloaded', 'networkidle2'], timeout: 10000 })]), new Promise(r => setTimeout(r, 8000))]);
|
|
390
381
|
|
|
391
382
|
this.emit('warn', `Test 10`);
|
|
392
383
|
let c1 = null, c2 = null;
|
|
@@ -453,7 +444,7 @@ class MelCloud extends EventEmitter {
|
|
|
453
444
|
}
|
|
454
445
|
|
|
455
446
|
async connect(refresh) {
|
|
456
|
-
const TIMEOUT_MS =
|
|
447
|
+
const TIMEOUT_MS = 60000;
|
|
457
448
|
|
|
458
449
|
try {
|
|
459
450
|
const result = await Promise.race([
|
|
@@ -467,7 +458,7 @@ class MelCloud extends EventEmitter {
|
|
|
467
458
|
return {};
|
|
468
459
|
}
|
|
469
460
|
})(),
|
|
470
|
-
new Promise((_, reject) => setTimeout(() => reject(new Error('Connection timeout (
|
|
461
|
+
new Promise((_, reject) => setTimeout(() => reject(new Error('Connection timeout (60s)')), TIMEOUT_MS))
|
|
471
462
|
]);
|
|
472
463
|
|
|
473
464
|
return result;
|