homebridge-melcloud-control 4.3.15-beta.0 → 4.3.16-beta.0
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 +47 -16
- package/src/melcloudhome.js +3 -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.3.
|
|
4
|
+
"version": "4.3.16-beta.0",
|
|
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
|
@@ -55,8 +55,6 @@ class Functions extends EventEmitter {
|
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
async ensureChromiumInstalled() {
|
|
58
|
-
let chromiumPath = null;
|
|
59
|
-
|
|
60
58
|
try {
|
|
61
59
|
// --- Detect OS ---
|
|
62
60
|
const { stdout: osOut } = await execPromise("uname -s");
|
|
@@ -70,7 +68,10 @@ class Functions extends EventEmitter {
|
|
|
70
68
|
|
|
71
69
|
// --- Detect Docker ---
|
|
72
70
|
let isDocker = false;
|
|
73
|
-
try {
|
|
71
|
+
try {
|
|
72
|
+
await access("/.dockerenv");
|
|
73
|
+
isDocker = true;
|
|
74
|
+
} catch { }
|
|
74
75
|
try {
|
|
75
76
|
const { stdout } = await execPromise("cat /proc/1/cgroup || true");
|
|
76
77
|
if (stdout.includes("docker") || stdout.includes("containerd")) isDocker = true;
|
|
@@ -83,7 +84,10 @@ class Functions extends EventEmitter {
|
|
|
83
84
|
"/Applications/Chromium.app/Contents/MacOS/Chromium"
|
|
84
85
|
];
|
|
85
86
|
for (const p of macCandidates) {
|
|
86
|
-
try {
|
|
87
|
+
try {
|
|
88
|
+
await access(p, fs.constants.X_OK);
|
|
89
|
+
return p;
|
|
90
|
+
} catch { }
|
|
87
91
|
}
|
|
88
92
|
return null;
|
|
89
93
|
}
|
|
@@ -98,19 +102,31 @@ class Functions extends EventEmitter {
|
|
|
98
102
|
|
|
99
103
|
// Try existing
|
|
100
104
|
for (const p of armCandidates) {
|
|
101
|
-
try {
|
|
105
|
+
try {
|
|
106
|
+
await access(p, fs.constants.X_OK);
|
|
107
|
+
return p;
|
|
108
|
+
} catch { }
|
|
102
109
|
}
|
|
103
110
|
|
|
104
111
|
// If not in Docker, try apt installation
|
|
105
112
|
if (!isDocker) {
|
|
106
|
-
try {
|
|
107
|
-
|
|
108
|
-
|
|
113
|
+
try {
|
|
114
|
+
await execPromise("sudo apt-get update -y");
|
|
115
|
+
} catch { }
|
|
116
|
+
try {
|
|
117
|
+
await execPromise("sudo apt-get install -y chromium-browser chromium-codecs-ffmpeg || true");
|
|
118
|
+
} catch { }
|
|
119
|
+
try {
|
|
120
|
+
await execPromise("sudo apt-get install -y chromium || true");
|
|
121
|
+
} catch { }
|
|
109
122
|
}
|
|
110
123
|
|
|
111
124
|
// Retry after installation
|
|
112
125
|
for (const p of armCandidates) {
|
|
113
|
-
try {
|
|
126
|
+
try {
|
|
127
|
+
await access(p, fs.constants.X_OK);
|
|
128
|
+
return p;
|
|
129
|
+
} catch { }
|
|
114
130
|
}
|
|
115
131
|
|
|
116
132
|
return null;
|
|
@@ -118,7 +134,10 @@ class Functions extends EventEmitter {
|
|
|
118
134
|
|
|
119
135
|
// --- QNAP / Entware ---
|
|
120
136
|
let entwareExists = false;
|
|
121
|
-
try {
|
|
137
|
+
try {
|
|
138
|
+
await access("/opt/bin/opkg", fs.constants.X_OK);
|
|
139
|
+
entwareExists = true;
|
|
140
|
+
} catch { }
|
|
122
141
|
|
|
123
142
|
if (entwareExists) {
|
|
124
143
|
try {
|
|
@@ -134,7 +153,10 @@ class Functions extends EventEmitter {
|
|
|
134
153
|
"/usr/local/chromium/bin/chromium"
|
|
135
154
|
];
|
|
136
155
|
for (const p of synoCandidates) {
|
|
137
|
-
try {
|
|
156
|
+
try {
|
|
157
|
+
await access(p, fs.constants.X_OK);
|
|
158
|
+
return p;
|
|
159
|
+
} catch { }
|
|
138
160
|
}
|
|
139
161
|
|
|
140
162
|
// --- Linux x64 ---
|
|
@@ -154,13 +176,21 @@ class Functions extends EventEmitter {
|
|
|
154
176
|
} catch { }
|
|
155
177
|
|
|
156
178
|
for (const p of linuxCandidates) {
|
|
157
|
-
try {
|
|
179
|
+
try {
|
|
180
|
+
await access(p, fs.constants.X_OK);
|
|
181
|
+
return p;
|
|
182
|
+
} catch { }
|
|
158
183
|
}
|
|
159
184
|
|
|
160
185
|
// Docker: try installing chromium inside container (if allowed)
|
|
161
186
|
if (isDocker) {
|
|
162
|
-
try {
|
|
163
|
-
|
|
187
|
+
try {
|
|
188
|
+
await execPromise("apt-get update -y && apt-get install -y chromium || true");
|
|
189
|
+
} catch { }
|
|
190
|
+
try {
|
|
191
|
+
await access("/usr/bin/chromium", fs.constants.X_OK);
|
|
192
|
+
return "/usr/bin/chromium";
|
|
193
|
+
} catch { }
|
|
164
194
|
}
|
|
165
195
|
|
|
166
196
|
// Install missing libraries
|
|
@@ -170,7 +200,9 @@ class Functions extends EventEmitter {
|
|
|
170
200
|
"apk add --no-cache nspr nss libx11 libxcomposite libxdamage libxrandr atk cups libdrm libgbm alsa-lib || true"
|
|
171
201
|
];
|
|
172
202
|
for (const cmd of depCommands) {
|
|
173
|
-
try {
|
|
203
|
+
try {
|
|
204
|
+
await execPromise(`sudo ${cmd}`);
|
|
205
|
+
} catch { }
|
|
174
206
|
}
|
|
175
207
|
|
|
176
208
|
return null;
|
|
@@ -183,7 +215,6 @@ class Functions extends EventEmitter {
|
|
|
183
215
|
}
|
|
184
216
|
}
|
|
185
217
|
|
|
186
|
-
|
|
187
218
|
isValidValue(v) {
|
|
188
219
|
return v !== undefined && v !== null && !(typeof v === 'number' && Number.isNaN(v));
|
|
189
220
|
}
|
package/src/melcloudhome.js
CHANGED
|
@@ -219,7 +219,7 @@ class MelCloudHome extends EventEmitter {
|
|
|
219
219
|
|
|
220
220
|
async connect() {
|
|
221
221
|
if (this.logDebug) this.emit('debug', 'Connecting to MELCloud Home');
|
|
222
|
-
const GLOBAL_TIMEOUT =
|
|
222
|
+
const GLOBAL_TIMEOUT = 120000;
|
|
223
223
|
|
|
224
224
|
let browser;
|
|
225
225
|
try {
|
|
@@ -311,7 +311,7 @@ class MelCloudHome extends EventEmitter {
|
|
|
311
311
|
.on('open', () => {
|
|
312
312
|
this.socketConnected = true;
|
|
313
313
|
this.connecting = false;
|
|
314
|
-
if (this.
|
|
314
|
+
if (this.logDebug) this.emit('debug', `Web Socket Connect Success`);
|
|
315
315
|
|
|
316
316
|
// heartbeat
|
|
317
317
|
this.heartbeat = setInterval(() => {
|
|
@@ -424,7 +424,7 @@ class MelCloudHome extends EventEmitter {
|
|
|
424
424
|
this.emit('client', this.client);
|
|
425
425
|
|
|
426
426
|
accountInfo.State = true;
|
|
427
|
-
accountInfo.Info =
|
|
427
|
+
accountInfo.Info = `Connect Success ${this.socketConnected ? ', Web Socket Connected' : ''}`;
|
|
428
428
|
await this.functions.saveData(this.accountFile, accountInfo);
|
|
429
429
|
|
|
430
430
|
return accountInfo;
|