homebridge-melcloud-control 4.0.0-beta.437 → 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 +22 -9
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.437",
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
 
@@ -109,7 +116,7 @@ class Functions {
109
116
  return chromiumPath;
110
117
  }
111
118
 
112
- throw new Error('Chromium not found. Attempting installation...');
119
+ console.log('Chromium not found. Attempting installation...');
113
120
 
114
121
  // --- apt-get ---
115
122
  try {
@@ -120,7 +127,7 @@ class Functions {
120
127
  console.log('Chromium installed successfully via apt-get.');
121
128
  return chromiumPath;
122
129
  } catch {
123
- throw new Error('apt-get install failed. Trying apk or yum...');
130
+ console.log('apt-get install failed. Trying apk or yum...');
124
131
  }
125
132
 
126
133
  // --- apk (Alpine) ---
@@ -132,7 +139,7 @@ class Functions {
132
139
  console.log('Chromium installed successfully via apk.');
133
140
  return chromiumPath;
134
141
  } catch {
135
- throw new Error('apk install failed. Trying yum...');
142
+ console.log('apk install failed. Trying yum...');
136
143
  }
137
144
 
138
145
  // --- yum (RHEL/CentOS) ---
@@ -144,21 +151,27 @@ class Functions {
144
151
  console.log('Chromium installed successfully via yum.');
145
152
  return chromiumPath;
146
153
  } catch {
147
- throw new Error('yum install failed. Falling back to Puppeteer bundled Chromium.');
154
+ console.log('yum install failed. Falling back to Puppeteer bundled Chromium.');
148
155
  }
149
156
 
150
157
  // --- Fallback Puppeteer Chromium ---
158
+ const puppeteer = await import('puppeteer-core');
151
159
  chromiumPath = puppeteer.executablePath();
152
- throw new Error(`Using bundled Puppeteer Chromium at ${chromiumPath}`);
160
+ if (!chromiumPath) {
161
+ console.log('Puppeteer bundled Chromium not found');
162
+ throw new Error('Puppeteer bundled Chromium not found');
163
+ }
164
+ console.log(`Using bundled Puppeteer Chromium at ${chromiumPath}`);
153
165
  return chromiumPath;
154
166
 
155
167
  } catch (err) {
156
- if (this.logError) this.emit('error', `Chromium detection/install error: ${err.message}`);
168
+ console.log(`Chromium detection/install error: ${err.message}`);
157
169
  throw err;
158
170
  }
159
171
  }
160
172
 
161
173
 
174
+
162
175
  async isRunningInDocker() {
163
176
  try {
164
177
  if (fs.existsSync('/.dockerenv')) return true;