homebridge-melcloud-control 4.0.0-beta.504 → 4.0.0-beta.506
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 +5 -7
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.506",
|
|
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
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import axios from 'axios';
|
|
2
2
|
import { exec } from 'child_process';
|
|
3
|
+
import { promisify } from 'util';
|
|
3
4
|
import EventEmitter from 'events';
|
|
4
5
|
import puppeteer from 'puppeteer-core';
|
|
5
6
|
import ImpulseGenerator from './impulsegenerator.js';
|
|
@@ -317,9 +318,9 @@ class MelCloud extends EventEmitter {
|
|
|
317
318
|
const { stdout } = await execPromise(`"${chromiumPath}" --version`);
|
|
318
319
|
this.emit('warn', `Test 0`);
|
|
319
320
|
if (this.logDebug) this.emit('debug', `Chromium detected: ${stdout.trim()}`);
|
|
320
|
-
} catch (
|
|
321
|
+
} catch (error) {
|
|
321
322
|
accountInfo.State = false;
|
|
322
|
-
accountInfo.Info = `Chromium found at ${chromiumPath}, but cannot be executed: ${
|
|
323
|
+
accountInfo.Info = `Chromium found at ${chromiumPath}, but cannot be executed: ${error.message}`;
|
|
323
324
|
return accountInfo;
|
|
324
325
|
}
|
|
325
326
|
|
|
@@ -356,16 +357,13 @@ class MelCloud extends EventEmitter {
|
|
|
356
357
|
page.on('close', () => { if (this.logDebug) this.emit('debug', 'Page was closed unexpectedly'); });
|
|
357
358
|
browser.on('disconnected', () => { if (this.logWarn) this.emit('debug', 'Browser disconnected unexpectedly'); });
|
|
358
359
|
|
|
359
|
-
page.setDefaultTimeout(45000);
|
|
360
|
-
page.setDefaultNavigationTimeout(45000);
|
|
361
|
-
|
|
362
360
|
// Now safe to navigate
|
|
363
361
|
this.emit('warn', `Test 4`);
|
|
364
362
|
try {
|
|
365
363
|
await page.goto(ApiUrlsHome.BaseURL, { waitUntil: ['domcontentloaded', 'networkidle2'], timeout: 45000 });
|
|
366
|
-
} catch (
|
|
364
|
+
} catch (error) {
|
|
367
365
|
accountInfo.State = false;
|
|
368
|
-
accountInfo.Info = `Navigation to ${ApiUrlsHome.BaseURL} failed: ${
|
|
366
|
+
accountInfo.Info = `Navigation to ${ApiUrlsHome.BaseURL} failed: ${error.message}`;
|
|
369
367
|
return accountInfo;
|
|
370
368
|
}
|
|
371
369
|
await new Promise(r => setTimeout(r, 4000));
|