homebridge-melcloud-control 4.0.0-beta.267 → 4.0.0-beta.268

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 (2) hide show
  1. package/package.json +1 -1
  2. package/src/melcloud.js +8 -4
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.267",
4
+ "version": "4.0.0-beta.268",
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
@@ -302,10 +302,11 @@ class MelCloud extends EventEmitter {
302
302
  }
303
303
  }
304
304
 
305
- if (!loginBtn) throw new Error('Login button not found');
305
+ if (!loginBtn && this.logWarn) this.emit('warn', `Login button not found`);
306
+
306
307
  await Promise.all([
307
308
  loginBtn.click(),
308
- page.waitForNavigation({ waitUntil: 'networkidle2' })
309
+ page.waitForNavigation({ waitUntil: 'networkidle2', timeout: 10000 })
309
310
  ]);
310
311
 
311
312
  // 3. Wypełnij login i hasło
@@ -313,8 +314,11 @@ class MelCloud extends EventEmitter {
313
314
  await page.type('input[name="username"]', this.user, { delay: 50 });
314
315
  await page.type('input[name="password"]', this.passwd, { delay: 50 });
315
316
 
316
- const submitBtn = await page.$('input[type="submit"]');
317
- await submitBtn?.click();
317
+ const button1 = await page.$('input[type="submit"]');
318
+ await Promise.all([
319
+ button1.click(),
320
+ page.waitForNavigation({ waitUntil: 'networkidle2', timeout: 10000 })
321
+ ]);
318
322
 
319
323
  // 4. Czekamy na przekierowanie z 'code' w URL
320
324
  await page.waitForFunction(() => window.location.href.includes('code'), { timeout: 15000 });