homebridge-melcloud-control 4.4.1-beta.16 → 4.4.1-beta.18

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "displayName": "MELCloud Control",
3
3
  "name": "homebridge-melcloud-control",
4
- "version": "4.4.1-beta.16",
4
+ "version": "4.4.1-beta.18",
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
@@ -144,10 +144,9 @@ class Functions extends EventEmitter {
144
144
  if (!isDocker) {
145
145
  try {
146
146
  this.emit('debug', `Try install chromium`);
147
- await execPromise('sudo apt-get update -y');
148
- await execPromise('sudo apt-get install -y chromium || true');
149
- await execPromise('sudo apt-get install -y chromium-browser chromium-codecs-ffmpeg || true');
150
- await execPromise('sudo apt-get install -y libnspr4 libnss3 libx11-6 libxcomposite1 libxdamage1 libxrandr2 libatk1.0-0 libcups2 libdrm2 libgbm1 libasound2 || true');
147
+ await execPromise('sudo apt update -y');
148
+ await execPromise('sudo apt install -y chromium chromium-browser chromium-codecs-ffmpeg || true');
149
+ await execPromise('sudo apt install -y libnspr4 libnss3 libx11-6 libxcomposite1 libxdamage1 libxrandr2 libatk1.0-0 libcups2 libdrm2 libgbm1 libasound2 || true');
151
150
  } catch (error) {
152
151
  this.emit('debug', `Install chromium failed ${error}`);
153
152
  }
@@ -184,7 +183,7 @@ class Functions extends EventEmitter {
184
183
 
185
184
  if (isDocker) {
186
185
  try {
187
- await execPromise('apt-get update -y && apt-get install -y chromium || true');
186
+ await execPromise('apt update -y && apt install -y chromium || true');
188
187
  await access('/usr/bin/chromium', fs.constants.X_OK);
189
188
  result.path = '/usr/bin/chromium';
190
189
  return result;
@@ -227,17 +227,25 @@ class MelCloudHome extends EventEmitter {
227
227
  const chromiumInfo = await this.functions.ensureChromiumInstalled();
228
228
  let chromiumPath = chromiumInfo.path;
229
229
 
230
- // Try Puppeteer Chromium if path null
231
- if (!chromiumPath) {
232
- try {
233
- chromiumPath = puppeteer.executablePath();
234
- if (!this.logDebug) this.emit('debug', `Using Puppeteer Chromium (${chromiumInfo.arch}) at ${chromiumPath}`);
235
- } catch (error) {
236
- accountInfo.Info = `No Chromium available for architecture ${chromiumInfo.arch}`;
230
+ // If path is found, use it
231
+ if (chromiumPath) {
232
+ if (!this.logDebug) this.emit('debug', `Using system Chromium (${chromiumInfo.arch}) at ${chromiumPath}`);
233
+ } else {
234
+ if (chromiumInfo.arch === 'arm') {
235
+ accountInfo.Info = `No Chromium found for ARM. Please install it manually and try again.`;
237
236
  return accountInfo;
237
+ } else {
238
+ try {
239
+ chromiumPath = puppeteer.executablePath();
240
+ if (!this.logDebug) this.emit('debug', `Using Puppeteer Chromium (${chromiumInfo.arch}) at ${chromiumPath}`);
241
+ } catch (error) {
242
+ accountInfo.Info = `No Chromium available for architecture ${chromiumInfo.arch}`;
243
+ return accountInfo;
244
+ }
238
245
  }
239
246
  }
240
247
 
248
+
241
249
  // Verify Chromium executable
242
250
  try {
243
251
  const { stdout } = await execPromise(`"${chromiumPath}" --version`);