homebridge-melcloud-control 4.0.0-beta.462 → 4.0.0-beta.465
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/README.md +3 -3
- package/package.json +1 -1
- package/src/functions.js +1 -0
- package/src/melcloud.js +8 -8
package/README.md
CHANGED
|
@@ -21,8 +21,8 @@ Homebridge plugin for Air Conditioner, Heat Pump and Energy Recovery Ventilation
|
|
|
21
21
|
|
|
22
22
|
| Package | Installation | Role | Required |
|
|
23
23
|
| --- | --- | --- | --- |
|
|
24
|
-
| [Homebridge](https://github.com/homebridge/homebridge) | [Homebridge Wiki](https://github.com/homebridge/homebridge/wiki) | HomeKit Bridge | Required |
|
|
25
|
-
| [Homebridge UI](https://github.com/homebridge/homebridge-config-ui-x) | [
|
|
24
|
+
| [Homebridge v2.0.0](https://github.com/homebridge/homebridge) | [Homebridge Wiki](https://github.com/homebridge/homebridge/wiki) | HomeKit Bridge | Required |
|
|
25
|
+
| [Homebridge UI <= v5.5.0](https://github.com/homebridge/homebridge-config-ui-x) | [Homebridge UI Wiki](https://github.com/homebridge/homebridge-config-ui-x/wiki) | Homebridge Web User Interface | Required |
|
|
26
26
|
| [MELCloud](https://github.com/grzegorz914/homebridge-melcloud-control) | [Plug-In Wiki](https://github.com/grzegorz914/homebridge-melcloud-control/wiki) | Homebridge Plug-In | Required |
|
|
27
27
|
|
|
28
28
|
### About The Plugin
|
|
@@ -187,7 +187,7 @@ Homebridge plugin for Air Conditioner, Heat Pump and Energy Recovery Ventilation
|
|
|
187
187
|
### Configuration
|
|
188
188
|
|
|
189
189
|
* Run this plugin as a [Child Bridge](https://github.com/homebridge/homebridge/wiki/Child-Bridges) (Highly Recommended), this prevent crash Homebridge if plugin crashes.
|
|
190
|
-
* Install and use [Homebridge UI](https://github.com/homebridge/homebridge-config-ui-x/wiki) to configure this plugin
|
|
190
|
+
* Install and use [Homebridge UI <= v5.5.0](https://github.com/homebridge/homebridge-config-ui-x/wiki) to configure this plugin.
|
|
191
191
|
* The `sample-config.json` can be edited and used as an alternative.
|
|
192
192
|
|
|
193
193
|
<p align="center">
|
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.465",
|
|
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
package/src/melcloud.js
CHANGED
|
@@ -333,8 +333,8 @@ class MelCloud extends EventEmitter {
|
|
|
333
333
|
|
|
334
334
|
page.on('error', err => { if (this.logError) this.emit('error', `Page crashed: ${err.message}`); });
|
|
335
335
|
page.on('pageerror', err => { if (this.logError) this.emit('error', `Browser error: ${err.message}`); });
|
|
336
|
-
page.on('close', () => { if (this.
|
|
337
|
-
browser.on('disconnected', () => { if (this.
|
|
336
|
+
page.on('close', () => { if (this.logWarn) this.emit('warn', 'Page was closed unexpectedly'); });
|
|
337
|
+
browser.on('disconnected', () => { if (this.logWarn) this.emit('warn', 'Browser disconnected unexpectedly'); });
|
|
338
338
|
|
|
339
339
|
page.setDefaultTimeout(30000);
|
|
340
340
|
page.setDefaultNavigationTimeout(30000);
|
|
@@ -349,7 +349,7 @@ class MelCloud extends EventEmitter {
|
|
|
349
349
|
return btns.find(b => ['Zaloguj', 'Sign In', 'Login'].includes(b.textContent.trim()));
|
|
350
350
|
}, { timeout: 15000 }); // max 15s czekania
|
|
351
351
|
} catch {
|
|
352
|
-
this.emit('warn', 'Login button not found after 15s');
|
|
352
|
+
if (this.logWarn) this.emit('warn', 'Login button not found after 15s');
|
|
353
353
|
return null;
|
|
354
354
|
}
|
|
355
355
|
|
|
@@ -364,7 +364,7 @@ class MelCloud extends EventEmitter {
|
|
|
364
364
|
const usernameInput = await page.$('input[name="username"]');
|
|
365
365
|
const passwordInput = await page.$('input[name="password"]');
|
|
366
366
|
if (!usernameInput || !passwordInput) {
|
|
367
|
-
this.emit('warn', 'Username or password input not found');
|
|
367
|
+
if (this.logWarn) this.emit('warn', 'Username or password input not found');
|
|
368
368
|
return null;
|
|
369
369
|
}
|
|
370
370
|
|
|
@@ -373,7 +373,7 @@ class MelCloud extends EventEmitter {
|
|
|
373
373
|
|
|
374
374
|
const submitButton = await page.$('input[type="submit"], button[type="submit"]');
|
|
375
375
|
if (!submitButton) {
|
|
376
|
-
this.emit('warn', 'Submit button not found on login form');
|
|
376
|
+
if (this.logWarn) this.emit('warn', 'Submit button not found on login form');
|
|
377
377
|
return null;
|
|
378
378
|
}
|
|
379
379
|
|
|
@@ -395,7 +395,7 @@ class MelCloud extends EventEmitter {
|
|
|
395
395
|
}
|
|
396
396
|
|
|
397
397
|
if (!c1 || !c2) {
|
|
398
|
-
this.emit('warn', 'Cookies C1/C2 missing after login');
|
|
398
|
+
if (this.logWarn) this.emit('warn', 'Cookies C1/C2 missing after login');
|
|
399
399
|
return null;
|
|
400
400
|
}
|
|
401
401
|
|
|
@@ -447,7 +447,7 @@ class MelCloud extends EventEmitter {
|
|
|
447
447
|
}
|
|
448
448
|
|
|
449
449
|
async connect(refresh) {
|
|
450
|
-
const TIMEOUT_MS =
|
|
450
|
+
const TIMEOUT_MS = 60000;
|
|
451
451
|
|
|
452
452
|
try {
|
|
453
453
|
const result = await Promise.race([
|
|
@@ -461,7 +461,7 @@ class MelCloud extends EventEmitter {
|
|
|
461
461
|
return {};
|
|
462
462
|
}
|
|
463
463
|
})(),
|
|
464
|
-
new Promise((_, reject) => setTimeout(() => reject(new Error('Connection timeout (
|
|
464
|
+
new Promise((_, reject) => setTimeout(() => reject(new Error('Connection timeout (60s)')), TIMEOUT_MS))
|
|
465
465
|
]);
|
|
466
466
|
|
|
467
467
|
return result;
|