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