homebridge-melcloud-control 4.0.0-beta.466 → 4.0.0-beta.468

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/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.466",
4
+ "version": "4.0.0-beta.468",
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
  }
@@ -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
@@ -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,14 @@ 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,
311
309
  args: [
312
310
  '--no-sandbox',
313
311
  '--disable-setuid-sandbox',
@@ -332,9 +330,9 @@ class MelCloud extends EventEmitter {
332
330
  await new Promise(r => setTimeout(r, 200));
333
331
 
334
332
  page.on('error', err => { if (this.logError) this.emit('error', `Page crashed: ${err.message}`); });
335
- page.on('pageerror', err => { if (this.logError) this.emit('error', `Browser error: ${err.message}`); });
336
- page.on('close', () => { if (this.logWarn) this.emit('warn', 'Page was closed unexpectedly'); });
337
- browser.on('disconnected', () => { if (this.logWarn) this.emit('warn', 'Browser disconnected unexpectedly'); });
333
+ page.on('pageerror', err => { if (this.logDebug) this.emit('error', `Browser error: ${err.message}`); });
334
+ page.on('close', () => { if (this.logDebug) this.emit('debug', 'Page was closed unexpectedly'); });
335
+ browser.on('disconnected', () => { if (this.logWarn) this.emit('debug', 'Browser disconnected unexpectedly'); });
338
336
 
339
337
  page.setDefaultTimeout(30000);
340
338
  page.setDefaultNavigationTimeout(30000);