homebridge-melcloud-control 4.0.0-beta.467 → 4.0.0-beta.469

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.
@@ -231,6 +231,11 @@
231
231
  try {
232
232
  const account = pluginConfig[0].accounts[this.accountIndex];
233
233
  const devicesInMelCloud = await homebridge.request('/connect', account);
234
+ if (devicesInMelCloud === 'No chromium installed') {
235
+ homebridge.hideSpinner();
236
+ updateInfo('info', 'Chromium not found on Your device, please install it manually and try again.', 'Red');
237
+ return;
238
+ }
234
239
 
235
240
  // Initialize devices arrays
236
241
  const newDevices = { ata: [], ataPresets: [], atw: [], atwPresets: [], erv: [], ervPresets: [] };
package/index.js CHANGED
@@ -56,7 +56,7 @@ class MelCloudPlatform {
56
56
  info: account.log?.info,
57
57
  warn: account.log?.warn,
58
58
  error: account.log?.error,
59
- debug: true//account.log?.debug
59
+ debug: account.log?.debug
60
60
  };
61
61
 
62
62
 
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.467",
4
+ "version": "4.0.0-beta.469",
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/functions.js CHANGED
@@ -91,7 +91,6 @@ class Functions extends EventEmitter {
91
91
  if (this.logDebug) this.emit('debug', `Using system Chrome at ${chromiumPath}`);
92
92
  return chromiumPath;
93
93
  } catch {
94
- if (this.logDebug) this.emit('debug', 'System Chrome not found on macOS, will use Puppeteer bundled Chromium.');
95
94
  return null;
96
95
  }
97
96
  }
@@ -109,7 +108,6 @@ class Functions extends EventEmitter {
109
108
  if (this.logDebug) this.emit('debug', 'Chromium installed successfully on ARM.');
110
109
  return '/usr/bin/chromium-browser';
111
110
  } catch {
112
- if (this.logError) this.emit('error', 'Failed to install Chromium on ARM. Bundled Chromium will likely not work.');
113
111
  return null;
114
112
  }
115
113
  }
@@ -147,8 +145,8 @@ class Functions extends EventEmitter {
147
145
  if (this.logDebug) this.emit('debug', `Chromium installed successfully at ${chromiumPath}`);
148
146
  return chromiumPath;
149
147
  }
150
- } catch (err) {
151
- if (this.logDebug) this.emit('debug', `Install attempt failed: ${cmd} → ${err.message}`);
148
+ } catch (error) {
149
+ if (this.logDebug) this.emit('debug', `Install attempt failed: ${cmd} → ${error.message}`);
152
150
  }
153
151
  }
154
152
 
@@ -160,25 +158,19 @@ class Functions extends EventEmitter {
160
158
  if (this.logDebug) this.emit('debug', 'Chromium installed successfully inside Docker at /usr/bin/chromium');
161
159
  return '/usr/bin/chromium';
162
160
  } catch {
163
- if (this.logError) this.emit('error', 'Failed to install Chromium inside Docker.');
161
+ return null;
164
162
  }
165
163
  }
166
-
167
- if (this.logDebug) this.emit('debug', 'Chromium not found on Linux. Using Puppeteer bundled Chromium.');
168
164
  return null;
169
165
  }
170
166
 
171
167
  // Unknown OS
172
- if (this.logDebug) this.emit('debug', `Unsupported OS: ${osName}. Using Puppeteer bundled Chromium.`);
168
+ if (this.logDebug) this.emit('debug', `Unsupported OS: ${osName}.`);
173
169
  return null;
174
-
175
170
  } catch (error) {
176
171
  if (this.logError) this.emit('error', `Chromium detection/install error: ${error.message}`);
177
- if (this.logDebug) this.emit('debug', 'Using Puppeteer bundled Chromium due to detection error.');
178
172
  return null;
179
173
  }
180
174
  }
181
-
182
-
183
175
  }
184
176
  export default Functions
package/src/melcloud.js CHANGED
@@ -14,7 +14,7 @@ class MelCloud extends EventEmitter {
14
14
  this.language = account.language;
15
15
  this.logWarn = account.log?.warn;
16
16
  this.logError = account.log?.error;
17
- this.logDebug = true//account.log?.debug;
17
+ this.logDebug = account.log?.debug;
18
18
  this.accountFile = accountFile;
19
19
  this.buildingsFile = buildingsFile;
20
20
  this.devicesFile = devicesFile;
@@ -93,10 +93,7 @@ class MelCloud extends EventEmitter {
93
93
 
94
94
  for (const building of buildingsList) {
95
95
  if (!building.Structure) {
96
- this.emit(
97
- 'warn',
98
- `Building missing structure: ${building.BuildingName || 'Unnamed'}`
99
- );
96
+ this.emit('warn', `Building missing structure: ${building.BuildingName || 'Unnamed'}`);
100
97
  continue;
101
98
  }
102
99
 
@@ -118,10 +115,7 @@ class MelCloud extends EventEmitter {
118
115
 
119
116
  if (this.logDebug) {
120
117
  const count = allDevices.length;
121
- this.emit(
122
- 'debug',
123
- `Found ${count} devices in building: ${building.BuildingName || 'Unnamed'}`
124
- );
118
+ this.emit('debug', `Found ${count} devices in building: ${building.Name || 'Unnamed'}`);
125
119
  }
126
120
 
127
121
  devices.push(...allDevices);
@@ -304,10 +298,15 @@ class MelCloud extends EventEmitter {
304
298
 
305
299
  try {
306
300
  const chromiumPath = await this.functions.ensureChromiumInstalled();
301
+ if (!chromiumPath) {
302
+ if (this.logWarn) this.emit('warn', 'Chromium not found on Your device, please install it manually and try again.');
303
+ return 'No chromium installed';
304
+ }
307
305
 
308
306
  browser = await puppeteer.launch({
309
307
  headless: true,
310
- executablePath: chromiumPath || puppeteer.executablePath(),
308
+ executablePath: chromiumPath,
309
+ timeout: 45000,
311
310
  args: [
312
311
  '--no-sandbox',
313
312
  '--disable-setuid-sandbox',
@@ -336,8 +335,8 @@ class MelCloud extends EventEmitter {
336
335
  page.on('close', () => { if (this.logDebug) this.emit('debug', 'Page was closed unexpectedly'); });
337
336
  browser.on('disconnected', () => { if (this.logWarn) this.emit('debug', 'Browser disconnected unexpectedly'); });
338
337
 
339
- page.setDefaultTimeout(30000);
340
- page.setDefaultNavigationTimeout(30000);
338
+ page.setDefaultTimeout(60000);
339
+ page.setDefaultNavigationTimeout(60000);
341
340
 
342
341
  // Now safe to navigate
343
342
  await page.goto(ApiUrlsHome.BaseURL, { waitUntil: ['domcontentloaded', 'networkidle2'] });
@@ -447,7 +446,7 @@ class MelCloud extends EventEmitter {
447
446
  }
448
447
 
449
448
  async connect(refresh) {
450
- const TIMEOUT_MS = 60000;
449
+ const TIMEOUT_MS = 75000;
451
450
 
452
451
  try {
453
452
  const result = await Promise.race([
@@ -461,7 +460,7 @@ class MelCloud extends EventEmitter {
461
460
  return {};
462
461
  }
463
462
  })(),
464
- new Promise((_, reject) => setTimeout(() => reject(new Error('Connection timeout (60s)')), TIMEOUT_MS))
463
+ new Promise((_, reject) => setTimeout(() => reject(new Error('Connection timeout (75s)')), TIMEOUT_MS))
465
464
  ]);
466
465
 
467
466
  return result;