homebridge-melcloud-control 4.2.5-beta.18 → 4.2.5-beta.19

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "displayName": "MELCloud Control",
3
3
  "name": "homebridge-melcloud-control",
4
- "version": "4.2.5-beta.18",
4
+ "version": "4.2.5-beta.19",
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
@@ -52,7 +52,6 @@ class MelCloud extends EventEmitter {
52
52
  }
53
53
  }
54
54
 
55
- // MELCloud
56
55
  async checkDevicesList() {
57
56
  try {
58
57
  const devicesList = { State: false, Info: null, Devices: [], Scenes: [] }
@@ -61,7 +61,6 @@ class MelCloud extends EventEmitter {
61
61
  }
62
62
  }
63
63
 
64
- // MELCloud Home
65
64
  async checkScenesList() {
66
65
  try {
67
66
  if (this.logDebug) this.emit('debug', `Scanning for scenes`);
@@ -210,6 +209,7 @@ class MelCloud extends EventEmitter {
210
209
  } catch (error) {
211
210
  if (error.response?.status === 401) {
212
211
  if (this.logWarn) this.emit('warn', 'Check devices list not possible, cookies expired, trying to get new.');
212
+ this.locks.checkDevicesList = true;
213
213
  await this.connect();
214
214
  return;
215
215
  }
@@ -285,7 +285,7 @@ class MelCloud extends EventEmitter {
285
285
 
286
286
  // Wait extra to ensure UI is rendered
287
287
  await new Promise(r => setTimeout(r, 3000));
288
- const loginBtn = await page.waitForSelector('button.btn--blue', { timeout: GLOBAL_TIMEOUT / 4 });
288
+ const loginBtn = await page.waitForSelector('button.btn--blue', { timeout: GLOBAL_TIMEOUT / 3 });
289
289
  const loginText = await page.evaluate(el => el.textContent.trim(), loginBtn);
290
290
 
291
291
  if (!['Zaloguj', 'Sign In', 'Login'].includes(loginText)) {
@@ -311,7 +311,7 @@ class MelCloud extends EventEmitter {
311
311
  accountInfo.Info = 'Submit button not found';
312
312
  return accountInfo;
313
313
  }
314
- await Promise.race([Promise.all([submitButton.click(), page.waitForNavigation({ waitUntil: ['domcontentloaded', 'networkidle2'], timeout: GLOBAL_TIMEOUT / 4 })]), new Promise(r => setTimeout(r, GLOBAL_TIMEOUT / 3))]);
314
+ await Promise.race([Promise.all([submitButton.click(), page.waitForNavigation({ waitUntil: ['domcontentloaded', 'networkidle2'], timeout: GLOBAL_TIMEOUT / 3 })]), new Promise(r => setTimeout(r, GLOBAL_TIMEOUT / 3))]);
315
315
 
316
316
  // Extract cookies
317
317
  let c1 = null, c2 = null;
@@ -364,6 +364,7 @@ class MelCloud extends EventEmitter {
364
364
  } catch (error) {
365
365
  throw new Error(`Connect error: ${error.message}`);
366
366
  } finally {
367
+ this.locks.checkDevicesList = false;
367
368
  if (browser) {
368
369
  try { await browser.close(); }
369
370
  catch (closeErr) {