homebridge-melcloud-control 4.4.1-beta.17 → 4.4.1-beta.19

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.17",
4
+ "version": "4.4.1-beta.19",
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
@@ -83,7 +83,7 @@ class Functions extends EventEmitter {
83
83
  if (stdout.includes('docker') || stdout.includes('containerd')) isDocker = true;
84
84
  } catch { }
85
85
 
86
- const result = { path: null, arch };
86
+ const result = { path: null, arch, system: null };
87
87
 
88
88
  /* ===================== macOS ===================== */
89
89
  if (isMac) {
@@ -95,6 +95,7 @@ class Functions extends EventEmitter {
95
95
  try {
96
96
  await access(path, fs.constants.X_OK);
97
97
  result.path = path;
98
+ result.system = 'macOS';
98
99
  return result;
99
100
  } catch { }
100
101
  }
@@ -108,6 +109,7 @@ class Functions extends EventEmitter {
108
109
  try {
109
110
  await access(path, fs.constants.X_OK);
110
111
  result.path = path;
112
+ result.system = 'QNAP';
111
113
  return result;
112
114
  } catch { }
113
115
  }
@@ -123,6 +125,7 @@ class Functions extends EventEmitter {
123
125
  try {
124
126
  await access(path, fs.constants.X_OK);
125
127
  result.path = path;
128
+ result.system = 'QNAP';
126
129
  return result;
127
130
  } catch { }
128
131
  }
@@ -137,6 +140,7 @@ class Functions extends EventEmitter {
137
140
  try {
138
141
  await access(path, fs.constants.X_OK);
139
142
  result.path = path;
143
+ result.system = 'Linux';
140
144
  return result;
141
145
  } catch { }
142
146
  }
@@ -156,6 +160,7 @@ class Functions extends EventEmitter {
156
160
  try {
157
161
  await access(path, fs.constants.X_OK);
158
162
  result.path = path;
163
+ result.system = 'Linux';
159
164
  return result;
160
165
  } catch { }
161
166
  }
@@ -177,6 +182,7 @@ class Functions extends EventEmitter {
177
182
  try {
178
183
  await access(path, fs.constants.X_OK);
179
184
  result.path = path;
185
+ result.system = 'Linux';
180
186
  return result;
181
187
  } catch { }
182
188
  }
@@ -186,6 +192,7 @@ class Functions extends EventEmitter {
186
192
  await execPromise('apt update -y && apt install -y chromium || true');
187
193
  await access('/usr/bin/chromium', fs.constants.X_OK);
188
194
  result.path = '/usr/bin/chromium';
195
+ result.system = 'Linux Docker';
189
196
  return result;
190
197
  } catch { }
191
198
  }
@@ -227,21 +227,29 @@ 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 ${chromiumInfo.system} Chromium (${chromiumInfo.arch}) at ${chromiumPath}`);
233
+ } else {
234
+ if (chromiumInfo.arch === 'arm') {
235
+ accountInfo.Info = `No Chromium found for ${chromiumInfo.system} (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 ${chromiumInfo.system} (${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`);
244
- if (!this.logDebug) this.emit('debug', `Chromium detected: ${stdout.trim()}`);
252
+ if (!this.logDebug) this.emit('debug', `Chromium for ${chromiumInfo.system} (${chromiumInfo.arch}) detected: ${stdout.trim()}`);
245
253
  } catch (error) {
246
254
  accountInfo.Info = `Chromium found at ${chromiumPath}, but cannot be executed: ${error.message}`;
247
255
  return accountInfo;