homebridge-melcloud-control 4.0.0-beta.17 → 4.0.0-beta.19
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/melcloud.js +13 -11
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.19",
|
|
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/melcloud.js
CHANGED
|
@@ -222,26 +222,28 @@ class MelCloud extends EventEmitter {
|
|
|
222
222
|
this.emit('warn', 'Opening login page...');
|
|
223
223
|
await page.goto(loginUrl, { waitUntil: 'networkidle2' });
|
|
224
224
|
|
|
225
|
+
// Kliknij przycisk logowania
|
|
226
|
+
const loginBtn = await page.$('a[href*="login"], button:has-text("Zaloguj"), button:has-text("Sign in")');
|
|
227
|
+
if (!loginBtn) throw new Error('Login button not found on homepage');
|
|
228
|
+
await Promise.all([
|
|
229
|
+
loginBtn.click(),
|
|
230
|
+
page.waitForNavigation({ waitUntil: 'networkidle2', timeout: 20000 })
|
|
231
|
+
]);
|
|
232
|
+
|
|
233
|
+
// Poczekaj, aż strona przekieruje do Cognito login
|
|
234
|
+
await page.waitForSelector('input[name="username"]', { timeout: 15000 });
|
|
235
|
+
|
|
225
236
|
this.emit('warn', 'Typing credentials...');
|
|
226
237
|
await page.type('input[name="username"]', this.user, { delay: 50 });
|
|
227
238
|
await page.type('input[name="password"]', this.passwd, { delay: 50 });
|
|
228
239
|
|
|
229
240
|
// Kliknij przycisk logowania
|
|
230
|
-
const
|
|
241
|
+
const button1 = await page.$('input[type="submit"]');
|
|
231
242
|
await Promise.all([
|
|
232
|
-
|
|
243
|
+
button1.click(),
|
|
233
244
|
page.waitForNavigation({ waitUntil: 'networkidle2', timeout: 20000 })
|
|
234
245
|
]);
|
|
235
246
|
|
|
236
|
-
// Obsługa ewentualnego "Stay signed in?"
|
|
237
|
-
const staySignedInBtn = await page.$('input[type="submit"]');
|
|
238
|
-
if (staySignedInBtn) {
|
|
239
|
-
await Promise.all([
|
|
240
|
-
staySignedInBtn.click(),
|
|
241
|
-
page.waitForNavigation({ waitUntil: 'networkidle2', timeout: 20000 })
|
|
242
|
-
]);
|
|
243
|
-
}
|
|
244
|
-
|
|
245
247
|
let c1 = null, c2 = null;
|
|
246
248
|
const start = Date.now();
|
|
247
249
|
|