homebridge-melcloud-control 4.3.0-beta.5 → 4.3.0-beta.6
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/melcloudhome.js +11 -12
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.0-beta.
|
|
4
|
+
"version": "4.3.0-beta.6",
|
|
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/melcloudhome.js
CHANGED
|
@@ -273,18 +273,6 @@ class MelCloudHome extends EventEmitter {
|
|
|
273
273
|
const page = await browser.newPage();
|
|
274
274
|
page.on('error', error => this.emit('error', `Page crashed: ${error.message}`));
|
|
275
275
|
page.on('pageerror', error => this.emit('error', `Browser error: ${error.message}`));
|
|
276
|
-
// Zmienna na znaleziony hash
|
|
277
|
-
let melcloudHash = null;
|
|
278
|
-
|
|
279
|
-
// Nasłuchuj WebSocketów
|
|
280
|
-
page.on('request', req => {
|
|
281
|
-
if (req.url().startsWith('wss://ws.melcloudhome.com/?hash=')) {
|
|
282
|
-
const url = req.url();
|
|
283
|
-
const params = new URL(url).searchParams;
|
|
284
|
-
melcloudHash = params.get('hash');
|
|
285
|
-
if (!this.logDebug) this.emit('warn', `FOUND HASH: ${melcloudHash}`);
|
|
286
|
-
}
|
|
287
|
-
});
|
|
288
276
|
page.setDefaultTimeout(GLOBAL_TIMEOUT);
|
|
289
277
|
page.setDefaultNavigationTimeout(GLOBAL_TIMEOUT);
|
|
290
278
|
|
|
@@ -325,6 +313,17 @@ class MelCloudHome extends EventEmitter {
|
|
|
325
313
|
}
|
|
326
314
|
await Promise.race([Promise.all([submitButton.click(), page.waitForNavigation({ waitUntil: ['domcontentloaded', 'networkidle2'], timeout: GLOBAL_TIMEOUT / 3 })]), new Promise(r => setTimeout(r, GLOBAL_TIMEOUT / 3))]);
|
|
327
315
|
|
|
316
|
+
// Nasłuchuj WebSocketów
|
|
317
|
+
let melcloudHash = null;
|
|
318
|
+
page.on('request', req => {
|
|
319
|
+
if (req.url().startsWith('wss://ws.melcloudhome.com/?hash=')) {
|
|
320
|
+
const url = req.url();
|
|
321
|
+
const params = new URL(url).searchParams;
|
|
322
|
+
melcloudHash = params.get('hash');
|
|
323
|
+
if (!this.logDebug) this.emit('warn', `FOUND HASH: ${melcloudHash}`);
|
|
324
|
+
}
|
|
325
|
+
});
|
|
326
|
+
|
|
328
327
|
// Extract cookies
|
|
329
328
|
let c1 = null, c2 = null;
|
|
330
329
|
const start = Date.now();
|