homebridge-melcloud-control 4.1.2-beta.60 → 4.1.2-beta.62

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.1.2-beta.60",
4
+ "version": "4.1.2-beta.62",
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
@@ -70,39 +70,56 @@ class Functions extends EventEmitter {
70
70
 
71
71
  // --- Detect Docker ---
72
72
  let isDocker = false;
73
- try { await access('/.dockerenv', fs.constants.F_OK); isDocker = true; } catch { }
73
+ try {
74
+ await access('/.dockerenv', fs.constants.F_OK); isDocker = true;
75
+ } catch { }
76
+
74
77
  try {
75
78
  const { stdout } = await execPromise('cat /proc/1/cgroup || true');
76
79
  if (stdout.includes('docker') || stdout.includes('containerd')) isDocker = true;
77
80
  } catch { }
81
+
78
82
  if (isDocker && this.logDebug) this.emit('debug', 'Running inside Docker container.');
79
83
 
80
84
  // === macOS ===
81
85
  if (osName === 'Darwin') {
82
86
  chromiumPath = '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome';
83
- try { await access(chromiumPath, fs.constants.X_OK); return chromiumPath; } catch { return null; }
87
+ try {
88
+ await access(chromiumPath, fs.constants.X_OK);
89
+ return chromiumPath;
90
+ } catch {
91
+ return null;
92
+ }
84
93
  }
85
94
 
86
95
  // === ARM ===
87
96
  if (arch.startsWith('arm')) {
88
- try { await access('/usr/bin/chromium-browser', fs.constants.X_OK); return '/usr/bin/chromium-browser'; }
89
- catch {
90
- try { await execPromise('sudo apt-get update -y && sudo apt-get install -y chromium-browser chromium-codecs-ffmpeg'); return '/usr/bin/chromium-browser'; }
91
- catch { return null; }
97
+ try {
98
+ await access('/usr/bin/chromium-browser', fs.constants.X_OK);
99
+ return '/usr/bin/chromium-browser';
100
+ } catch {
101
+ try {
102
+ await execPromise('sudo apt-get update -y && sudo apt-get install -y chromium-browser chromium-codecs-ffmpeg');
103
+ return '/usr/bin/chromium-browser';
104
+ } catch {
105
+ return null;
106
+ }
92
107
  }
93
108
  }
94
109
 
95
110
  // === Linux x64 ===
96
111
  if (osName === 'Linux') {
112
+ let systemChromium = null;
97
113
  try {
98
114
  const { stdout: checkOut } = await execPromise('which chromium || which chromium-browser || true');
99
- chromiumPath = checkOut.trim();
100
- if (chromiumPath) return chromiumPath;
115
+ systemChromium = checkOut.trim() || null;
101
116
  } catch { }
102
117
 
103
118
  // --- Detect Entware (QNAP) ---
104
119
  let entwareExists = false;
105
- try { await access('/opt/bin/opkg', fs.constants.X_OK); entwareExists = true; } catch { }
120
+ try {
121
+ await access('/opt/bin/opkg', fs.constants.X_OK); entwareExists = true;
122
+ } catch { }
106
123
 
107
124
  if (entwareExists) {
108
125
  try {
@@ -119,14 +136,14 @@ class Functions extends EventEmitter {
119
136
  'yum install -y nspr nss libX11 libXcomposite libXdamage libXrandr atk cups libdrm libgbm alsa-lib'
120
137
  ];
121
138
  for (const cmd of depInstall) {
122
- try { await execPromise(`sudo ${cmd}`); } catch { }
139
+ try {
140
+ await execPromise(`sudo ${cmd}`);
141
+ } catch { }
123
142
  }
124
143
 
125
144
  // Set LD_LIBRARY_PATH so Puppeteer's Chromium can find libs
126
145
  process.env.LD_LIBRARY_PATH = '/usr/lib:/usr/lib64:' + (process.env.LD_LIBRARY_PATH || '');
127
-
128
- // Return null since Chromium itself nie instaluje – Puppeteer użyje swojego binarnego
129
- return null;
146
+ return systemChromium;
130
147
  }
131
148
 
132
149
  if (this.logDebug) this.emit('debug', `Unsupported OS: ${osName}.`);
package/src/melcloud.js CHANGED
@@ -348,6 +348,8 @@ class MelCloud extends EventEmitter {
348
348
  if (this.logDebug) this.emit('debug', `Using bundled Chromium from Puppeteer at ${chromiumPath}`);
349
349
  }
350
350
  } catch { }
351
+ } else {
352
+ if (this.logDebug) this.emit('debug', `Using system Chromium at ${chromiumPath}`);
351
353
  }
352
354
 
353
355
  if (!chromiumPath) {