homebridge-melcloud-control 4.2.5-beta.17 → 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/index.js +1 -1
- package/package.json +1 -1
- package/src/melcloud.js +0 -1
- package/src/melcloudhome.js +4 -11
package/index.js
CHANGED
|
@@ -202,7 +202,7 @@ class MelCloudPlatform {
|
|
|
202
202
|
if (logLevel.success) log.success(`${accountName}, ${deviceTypeText}, ${deviceName}, Published as external accessory.`);
|
|
203
203
|
|
|
204
204
|
//start impulse generators\
|
|
205
|
-
const timmers = accountType === 'melcloudhome' ? [{ name: 'connect', sampling:
|
|
205
|
+
const timmers = accountType === 'melcloudhome' ? [{ name: 'connect', sampling: 3000000 }, { name: 'checkDevicesList', sampling: deviceRefreshInterval }] : [{ name: 'checkDevicesList', sampling: refreshInterval }];
|
|
206
206
|
await melCloud.impulseGenerator.state(true, timmers, false);
|
|
207
207
|
await configuredDevice.startStopImpulseGenerator(true, [{ name: 'checkState', sampling: deviceRefreshInterval }]);
|
|
208
208
|
|
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.
|
|
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
package/src/melcloudhome.js
CHANGED
|
@@ -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
|
}
|
|
@@ -276,14 +276,6 @@ class MelCloud extends EventEmitter {
|
|
|
276
276
|
page.setDefaultTimeout(GLOBAL_TIMEOUT);
|
|
277
277
|
page.setDefaultNavigationTimeout(GLOBAL_TIMEOUT);
|
|
278
278
|
|
|
279
|
-
// Clear cookies before navigation
|
|
280
|
-
try {
|
|
281
|
-
const client = await page.createCDPSession();
|
|
282
|
-
await client.send('Network.clearBrowserCookies');
|
|
283
|
-
} catch (error) {
|
|
284
|
-
if (this.logError) this.emit('error', `Clear cookies error: ${error.message}`);
|
|
285
|
-
}
|
|
286
|
-
|
|
287
279
|
try {
|
|
288
280
|
await page.goto(ApiUrlsHome.BaseURL, { waitUntil: ['domcontentloaded', 'networkidle2'], timeout: GLOBAL_TIMEOUT });
|
|
289
281
|
} catch (error) {
|
|
@@ -293,7 +285,7 @@ class MelCloud extends EventEmitter {
|
|
|
293
285
|
|
|
294
286
|
// Wait extra to ensure UI is rendered
|
|
295
287
|
await new Promise(r => setTimeout(r, 3000));
|
|
296
|
-
const loginBtn = await page.waitForSelector('button.btn--blue', { timeout: GLOBAL_TIMEOUT /
|
|
288
|
+
const loginBtn = await page.waitForSelector('button.btn--blue', { timeout: GLOBAL_TIMEOUT / 3 });
|
|
297
289
|
const loginText = await page.evaluate(el => el.textContent.trim(), loginBtn);
|
|
298
290
|
|
|
299
291
|
if (!['Zaloguj', 'Sign In', 'Login'].includes(loginText)) {
|
|
@@ -319,7 +311,7 @@ class MelCloud extends EventEmitter {
|
|
|
319
311
|
accountInfo.Info = 'Submit button not found';
|
|
320
312
|
return accountInfo;
|
|
321
313
|
}
|
|
322
|
-
await Promise.race([Promise.all([submitButton.click(), page.waitForNavigation({ waitUntil: ['domcontentloaded', 'networkidle2'], timeout: GLOBAL_TIMEOUT /
|
|
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))]);
|
|
323
315
|
|
|
324
316
|
// Extract cookies
|
|
325
317
|
let c1 = null, c2 = null;
|
|
@@ -372,6 +364,7 @@ class MelCloud extends EventEmitter {
|
|
|
372
364
|
} catch (error) {
|
|
373
365
|
throw new Error(`Connect error: ${error.message}`);
|
|
374
366
|
} finally {
|
|
367
|
+
this.locks.checkDevicesList = false;
|
|
375
368
|
if (browser) {
|
|
376
369
|
try { await browser.close(); }
|
|
377
370
|
catch (closeErr) {
|