homebridge-melcloud-control 4.0.0-beta.502 → 4.0.0-beta.504

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/CHANGELOG.md CHANGED
@@ -16,7 +16,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
16
16
  - do not configure it manually, always using Homebridge UI
17
17
  - required Homebridge v2.0.0 and above
18
18
  - v4 Added support for MELCloud Home.
19
- - do not use Homebridge UI > v5.5.0 because of brack config.json
19
+
20
+ ## Warning
21
+
22
+ - Do not use Homebridge UI > v5.5.0 because of break config.json
20
23
 
21
24
  ## [4.0.0] - (xx.11.2025)
22
25
 
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.502",
4
+ "version": "4.0.0-beta.504",
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,9 +1,11 @@
1
1
  import axios from 'axios';
2
+ import { exec } from 'child_process';
2
3
  import EventEmitter from 'events';
3
4
  import puppeteer from 'puppeteer-core';
4
5
  import ImpulseGenerator from './impulsegenerator.js';
5
6
  import Functions from './functions.js';
6
7
  import { ApiUrls, ApiUrlsHome } from './constants.js';
8
+ const execPromise = promisify(exec);
7
9
 
8
10
  class MelCloud extends EventEmitter {
9
11
  constructor(account, accountFile, buildingsFile, devicesFile, pluginStart = false) {
@@ -311,6 +313,16 @@ class MelCloud extends EventEmitter {
311
313
  return accountInfo;
312
314
  }
313
315
 
316
+ try {
317
+ const { stdout } = await execPromise(`"${chromiumPath}" --version`);
318
+ this.emit('warn', `Test 0`);
319
+ if (this.logDebug) this.emit('debug', `Chromium detected: ${stdout.trim()}`);
320
+ } catch (err) {
321
+ accountInfo.State = false;
322
+ accountInfo.Info = `Chromium found at ${chromiumPath}, but cannot be executed: ${err.message}`;
323
+ return accountInfo;
324
+ }
325
+
314
326
  this.emit('warn', `Test 1`);
315
327
  browser = await puppeteer.launch({
316
328
  headless: true,
@@ -344,13 +356,19 @@ class MelCloud extends EventEmitter {
344
356
  page.on('close', () => { if (this.logDebug) this.emit('debug', 'Page was closed unexpectedly'); });
345
357
  browser.on('disconnected', () => { if (this.logWarn) this.emit('debug', 'Browser disconnected unexpectedly'); });
346
358
 
347
- page.setDefaultTimeout(30000);
348
- page.setDefaultNavigationTimeout(30000);
359
+ page.setDefaultTimeout(45000);
360
+ page.setDefaultNavigationTimeout(45000);
349
361
 
350
362
  // Now safe to navigate
351
363
  this.emit('warn', `Test 4`);
352
- await page.goto(ApiUrlsHome.BaseURL, { waitUntil: ['domcontentloaded', 'networkidle2'] });
353
- await new Promise(r => setTimeout(r, 3500));
364
+ try {
365
+ await page.goto(ApiUrlsHome.BaseURL, { waitUntil: ['domcontentloaded', 'networkidle2'], timeout: 45000 });
366
+ } catch (err) {
367
+ accountInfo.State = false;
368
+ accountInfo.Info = `Navigation to ${ApiUrlsHome.BaseURL} failed: ${err.message}`;
369
+ return accountInfo;
370
+ }
371
+ await new Promise(r => setTimeout(r, 4000));
354
372
 
355
373
  let loginBtn;
356
374
  try {