homebridge-melcloud-control 4.0.0-beta.20 → 4.0.0-beta.21
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 -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.0.0-beta.
|
|
4
|
+
"version": "4.0.0-beta.21",
|
|
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
|
@@ -223,10 +223,20 @@ class MelCloud extends EventEmitter {
|
|
|
223
223
|
await page.goto(loginUrl, { waitUntil: 'networkidle2' });
|
|
224
224
|
|
|
225
225
|
// Kliknij przycisk logowania
|
|
226
|
-
const
|
|
227
|
-
|
|
226
|
+
const buttons = await page.$$('button.btn--blue'); // wszystkie buttony z klasą btn--blue
|
|
227
|
+
let loginBtn = null;
|
|
228
|
+
for (const btn of buttons) {
|
|
229
|
+
const text = await page.evaluate(el => el.textContent, btn);
|
|
230
|
+
if (text.trim() === 'Zaloguj') {
|
|
231
|
+
loginBtn = btn;
|
|
232
|
+
break;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
if (!loginBtn) throw new Error('Login button not found on homepage');
|
|
237
|
+
|
|
228
238
|
await Promise.all([
|
|
229
|
-
loginBtn
|
|
239
|
+
loginBtn.click(),
|
|
230
240
|
page.waitForNavigation({ waitUntil: 'networkidle2', timeout: 20000 })
|
|
231
241
|
]);
|
|
232
242
|
|