homebridge-melcloud-control 4.0.0-beta.438 → 4.0.0-beta.439

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/functions.js +17 -3
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.438",
4
+ "version": "4.0.0-beta.439",
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
@@ -60,7 +60,7 @@ class Functions {
60
60
  arch = stdout.trim();
61
61
  console.log(`Detected architecture: ${arch}`);
62
62
  } catch (err) {
63
- throw new Error(`Failed to detect architecture: ${err.message}`);
63
+ console.log(`Failed to detect architecture: ${err.message}`);
64
64
  }
65
65
 
66
66
  // --- Detect OS ---
@@ -72,13 +72,20 @@ class Functions {
72
72
  osName = stdout.trim();
73
73
  console.log(`Detected OS: ${osName}`);
74
74
  } catch (err) {
75
- throw new Error(`Failed to detect OS: ${err.message}`);
75
+ console.log(`Failed to detect OS: ${err.message}`);
76
76
  }
77
77
 
78
78
  // --- macOS fallback ---
79
79
  if (osName === 'Darwin') {
80
80
  console.log('Running on macOS — using Puppeteer bundled Chromium');
81
+
82
+ const puppeteer = await import('puppeteer-core');
81
83
  chromiumPath = puppeteer.executablePath();
84
+ if (!chromiumPath) {
85
+ console.log('Puppeteer bundled Chromium not found on macOS');
86
+ throw new Error('Puppeteer bundled Chromium not found on macOS');
87
+ }
88
+
82
89
  console.log(`Chromium path: ${chromiumPath}`);
83
90
  return chromiumPath;
84
91
  }
@@ -91,7 +98,7 @@ class Functions {
91
98
  );
92
99
  linuxDistro = stdout.split('\n')[0] || 'unknown';
93
100
  } catch {
94
- throw new Error('/etc/os-release not found, skipping OS detection.');
101
+ console.log('/etc/os-release not found, skipping OS detection.');
95
102
  }
96
103
  console.log(`Linux distro: ${linuxDistro}`);
97
104
 
@@ -148,16 +155,23 @@ class Functions {
148
155
  }
149
156
 
150
157
  // --- Fallback Puppeteer Chromium ---
158
+ const puppeteer = await import('puppeteer-core');
151
159
  chromiumPath = puppeteer.executablePath();
160
+ if (!chromiumPath) {
161
+ console.log('Puppeteer bundled Chromium not found');
162
+ throw new Error('Puppeteer bundled Chromium not found');
163
+ }
152
164
  console.log(`Using bundled Puppeteer Chromium at ${chromiumPath}`);
153
165
  return chromiumPath;
154
166
 
155
167
  } catch (err) {
156
168
  console.log(`Chromium detection/install error: ${err.message}`);
169
+ throw err;
157
170
  }
158
171
  }
159
172
 
160
173
 
174
+
161
175
  async isRunningInDocker() {
162
176
  try {
163
177
  if (fs.existsSync('/.dockerenv')) return true;