homebridge-melcloud-control 4.0.0-beta.273 → 4.0.0-beta.274

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 +6 -6
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.273",
4
+ "version": "4.0.0-beta.274",
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
@@ -301,15 +301,15 @@ class MelCloud extends EventEmitter {
301
301
  await page.type('input[name="password"]', this.passwd, { delay: 50 });
302
302
 
303
303
  const button1 = await page.$('input[type="Submit"]');
304
- await Promise.all([
305
- button1.click(),
306
- page.waitForNavigation({ waitUntil: 'networkidle2', timeout: 10000 })
307
- ]);
304
+ await Promise.all([button1.click(), page.waitForNavigation({ waitUntil: 'networkidle2', timeout: 10000 })]);
308
305
 
309
306
  // 4. Czekamy na przekierowanie z 'code' w URL
310
- await page.waitForFunction(() => window.location.href.includes('code'), { timeout: 15000 });
307
+ await page.waitForNavigation({ waitUntil: 'networkidle2', timeout: 20000 });
311
308
  const currentUrl = page.url();
312
- const authCode = new URL(currentUrl).searchParams.get('code');
309
+ if (currentUrl.includes('code=')) {
310
+ const code = new URL(currentUrl).searchParams.get('code');
311
+ console.log('Authorization code:', code);
312
+ }
313
313
 
314
314
  if (!authCode) throw new Error('Authorization code not found in URL');
315
315