homebridge-melcloud-control 4.0.0-beta.436 → 4.0.0-beta.437
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 +1 -1
- package/src/functions.js +17 -17
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.
|
|
4
|
+
"version": "4.0.0-beta.437",
|
|
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
|
@@ -58,9 +58,9 @@ class Functions {
|
|
|
58
58
|
exec('uname -m', (e, out) => e ? rej(e) : res({ stdout: out }))
|
|
59
59
|
);
|
|
60
60
|
arch = stdout.trim();
|
|
61
|
-
|
|
61
|
+
console.log(`Detected architecture: ${arch}`);
|
|
62
62
|
} catch (err) {
|
|
63
|
-
|
|
63
|
+
throw new Error(`Failed to detect architecture: ${err.message}`);
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
// --- Detect OS ---
|
|
@@ -70,16 +70,16 @@ class Functions {
|
|
|
70
70
|
exec('uname -s', (e, out) => e ? rej(e) : res({ stdout: out }))
|
|
71
71
|
);
|
|
72
72
|
osName = stdout.trim();
|
|
73
|
-
|
|
73
|
+
console.log(`Detected OS: ${osName}`);
|
|
74
74
|
} catch (err) {
|
|
75
|
-
|
|
75
|
+
throw new Error(`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
81
|
chromiumPath = puppeteer.executablePath();
|
|
82
|
-
|
|
82
|
+
console.log(`Chromium path: ${chromiumPath}`);
|
|
83
83
|
return chromiumPath;
|
|
84
84
|
}
|
|
85
85
|
|
|
@@ -91,9 +91,9 @@ class Functions {
|
|
|
91
91
|
);
|
|
92
92
|
linuxDistro = stdout.split('\n')[0] || 'unknown';
|
|
93
93
|
} catch {
|
|
94
|
-
|
|
94
|
+
throw new Error('/etc/os-release not found, skipping OS detection.');
|
|
95
95
|
}
|
|
96
|
-
|
|
96
|
+
console.log(`Linux distro: ${linuxDistro}`);
|
|
97
97
|
|
|
98
98
|
// --- Check if Chromium exists ---
|
|
99
99
|
let chromiumCheck = '';
|
|
@@ -105,11 +105,11 @@ class Functions {
|
|
|
105
105
|
} catch { }
|
|
106
106
|
if (chromiumCheck) {
|
|
107
107
|
chromiumPath = chromiumCheck;
|
|
108
|
-
|
|
108
|
+
console.log(`Found system Chromium: ${chromiumPath}`);
|
|
109
109
|
return chromiumPath;
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
-
|
|
112
|
+
throw new Error('Chromium not found. Attempting installation...');
|
|
113
113
|
|
|
114
114
|
// --- apt-get ---
|
|
115
115
|
try {
|
|
@@ -117,10 +117,10 @@ class Functions {
|
|
|
117
117
|
exec('sudo apt-get update -y && sudo apt-get install -y chromium-browser chromium-codecs-ffmpeg', e => e ? rej(e) : res())
|
|
118
118
|
);
|
|
119
119
|
chromiumPath = '/usr/bin/chromium-browser';
|
|
120
|
-
|
|
120
|
+
console.log('Chromium installed successfully via apt-get.');
|
|
121
121
|
return chromiumPath;
|
|
122
122
|
} catch {
|
|
123
|
-
|
|
123
|
+
throw new Error('apt-get install failed. Trying apk or yum...');
|
|
124
124
|
}
|
|
125
125
|
|
|
126
126
|
// --- apk (Alpine) ---
|
|
@@ -129,10 +129,10 @@ class Functions {
|
|
|
129
129
|
exec('sudo apk add --no-cache chromium ffmpeg', e => e ? rej(e) : res())
|
|
130
130
|
);
|
|
131
131
|
chromiumPath = '/usr/bin/chromium-browser';
|
|
132
|
-
|
|
132
|
+
console.log('Chromium installed successfully via apk.');
|
|
133
133
|
return chromiumPath;
|
|
134
134
|
} catch {
|
|
135
|
-
|
|
135
|
+
throw new Error('apk install failed. Trying yum...');
|
|
136
136
|
}
|
|
137
137
|
|
|
138
138
|
// --- yum (RHEL/CentOS) ---
|
|
@@ -141,15 +141,15 @@ class Functions {
|
|
|
141
141
|
exec('sudo yum install -y chromium chromium-codecs-ffmpeg', e => e ? rej(e) : res())
|
|
142
142
|
);
|
|
143
143
|
chromiumPath = '/usr/bin/chromium-browser';
|
|
144
|
-
|
|
144
|
+
console.log('Chromium installed successfully via yum.');
|
|
145
145
|
return chromiumPath;
|
|
146
146
|
} catch {
|
|
147
|
-
|
|
147
|
+
throw new Error('yum install failed. Falling back to Puppeteer bundled Chromium.');
|
|
148
148
|
}
|
|
149
149
|
|
|
150
150
|
// --- Fallback Puppeteer Chromium ---
|
|
151
151
|
chromiumPath = puppeteer.executablePath();
|
|
152
|
-
|
|
152
|
+
throw new Error(`Using bundled Puppeteer Chromium at ${chromiumPath}`);
|
|
153
153
|
return chromiumPath;
|
|
154
154
|
|
|
155
155
|
} catch (err) {
|