homebridge-melcloud-control 4.0.0-beta.285 → 4.0.0-beta.286

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "displayName": "MELCloud Control",
3
3
  "name": "homebridge-melcloud-control",
4
- "version": "4.0.0-beta.285",
4
+ "version": "4.0.0-beta.286",
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
@@ -312,6 +312,7 @@ class MelCloud extends EventEmitter {
312
312
 
313
313
  // 2️⃣ Jeśli nie w URL, sprawdź body HTML (form_post)
314
314
  const html = await page.content();
315
+ console.log(html);
315
316
 
316
317
  // Form_post pattern
317
318
  const formCodeMatch = html.match(/name="code"\s+value="([^"]+)"/);
@@ -349,7 +350,7 @@ class MelCloud extends EventEmitter {
349
350
 
350
351
  // 5. Wymień code na access_token
351
352
  const tokenResponse = await axios.post(TOKEN_ENDPOINT, new URLSearchParams({
352
- client_id: clientId,
353
+ client_id: 'homemobile',
353
354
  grant_type: 'authorization_code',
354
355
  code: authCode,
355
356
  redirect_uri: 'melcloudhome://'
@@ -30,17 +30,14 @@ class MelCloudHomeToken {
30
30
  }
31
31
 
32
32
  async getLoginPage(authUrl) {
33
- console.log('Getting login page...');
34
33
  const res = await this.client.get(authUrl, { maxRedirects: 10 });
35
34
  return { url: res.request.res.responseUrl };
36
35
  }
37
36
 
38
37
  async getUrl() {
39
38
  try {
40
- console.log('Starting OAuth flow...');
41
39
  const pkce = this.generatePKCE();
42
40
  const state = this.generateState();
43
-
44
41
  const authUrl = new URL(AUTHORIZE_ENDPOINT);
45
42
  authUrl.searchParams.set('client_id', CLIENT_ID);
46
43
  authUrl.searchParams.set('redirect_uri', REDIRECT_URI);