homebridge-melcloud-control 4.0.0-beta.288 → 4.0.0-beta.289

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/melcloud.js +5 -5
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.288",
4
+ "version": "4.0.0-beta.289",
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
@@ -314,9 +314,9 @@ class MelCloud extends EventEmitter {
314
314
  const html = await page.content();
315
315
 
316
316
  // Check for form_post response (HTML with hidden form)
317
- const formCodeMatch = data.match(/name="code"\s+value="([^"]+)"/);
318
- const formStateMatch = data.match(/name="state"\s+value="([^"]+)"/);
319
- const formActionMatch = data.match(/action="([^"]+)"/);
317
+ const formCodeMatch = html.match(/name="code"\s+value="([^"]+)"/);
318
+ const formStateMatch = html.match(/name="state"\s+value="([^"]+)"/);
319
+ const formActionMatch = html.match(/action="([^"]+)"/);
320
320
 
321
321
  if (formCodeMatch && formStateMatch && formActionMatch) {
322
322
  console.log('Found form_post response, submitting to callback endpoint...');
@@ -327,7 +327,7 @@ class MelCloud extends EventEmitter {
327
327
  }
328
328
 
329
329
  // Check for melcloudhome:// redirect in JS
330
- const bodyCodeMatch = data.match(/melcloudhome:\/\/[^"'\s]*[?&]code=([^&"'\s]+)/);
330
+ const bodyCodeMatch = html.match(/melcloudhome:\/\/[^"'\s]*[?&]code=([^&"'\s]+)/);
331
331
  if (bodyCodeMatch) {
332
332
  console.log('Found authorization code in response body (JS)');
333
333
  resolve(bodyCodeMatch[1]);
@@ -335,7 +335,7 @@ class MelCloud extends EventEmitter {
335
335
  }
336
336
 
337
337
  // 🆕 NEW: Check for data-url with code parameter (like in 500 error pages)
338
- const dataUrlMatch = data.match(/data-url="[^"]*code=([^&"']+)/);
338
+ const dataUrlMatch = html.match(/data-url="[^"]*code=([^&"']+)/);
339
339
  if (dataUrlMatch) {
340
340
  console.log('Found authorization code in data-url attribute');
341
341
  resolve(dataUrlMatch[1]);