homebridge-melcloud-control 4.3.11-beta.10 → 4.3.11-beta.11

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.3.11-beta.10",
4
+ "version": "4.3.11-beta.11",
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/constants.js CHANGED
@@ -23,7 +23,7 @@ export const ApiUrlsHome = {
23
23
  GetConfiguration: "https://melcloudhome.com/api/configuration",
24
24
  GetUserContext: "/api/user/context",
25
25
  GetUserScenes: "/api/user/scenes",
26
- PostSchedule: " /api/cloudschedule/deviceid", // POST {"days":[2],"time":"17:59:00","enabled":true,"id":"53c5e804-0663-47d0-85c2-2d8ccd2573de","power":false,"operationMode":null,"setPoint":null,"vaneVerticalDirection":null,"vaneHorizontalDirection":null,"setFanSpeed":null}
26
+ PostSchedule: "/api/cloudschedule/deviceid", // POST {"days":[2],"time":"17:59:00","enabled":true,"id":"53c5e804-0663-47d0-85c2-2d8ccd2573de","power":false,"operationMode":null,"setPoint":null,"vaneVerticalDirection":null,"vaneHorizontalDirection":null,"setFanSpeed":null}
27
27
  PostProtectionFrost: "/api/protection/frost", // POST {"enabled":true,"min":13,"max":16,"units":{"ATA":["ef333525-2699-4290-af5a-2922566676da"]}}
28
28
  PostProtectionOverheat: "/api/protection/overheat", // POST {"enabled":true,"min":32,"max":35,"units":{"ATA":["ef333525-2699-4290-af5a-2922566676da"]}}
29
29
  PostHolidayMode: " /api/holidaymode", // POST {"enabled":true,"startDate":"2025-11-11T17:42:24.913","endDate":"2026-06-01T09:18:00","units":{"ATA":["ef333525-2699-4290-af5a-2922566676da"]}}
@@ -35,6 +35,7 @@ export const ApiUrlsHome = {
35
35
  Enable: "/api/scene/sceneid/enable",
36
36
  Disable: "/api/scene/sceneid/disable",
37
37
  },
38
+ DeleteSchedule: "/api/cloudschedule/deviceid/scheduleid",
38
39
  Referers: {
39
40
  GetPutScenes: "https://melcloudhome.com/scenes",
40
41
  PostHolidayMode: "https://melcloudhome.com/ata/deviceid/holidaymode",
package/src/functions.js CHANGED
@@ -58,35 +58,52 @@ class Functions extends EventEmitter {
58
58
  let chromiumPath = '/usr/bin/chromium-browser';
59
59
 
60
60
  try {
61
+ // Detect OS
61
62
  const { stdout: osOut } = await execPromise('uname -s');
62
63
  const osName = osOut.trim();
63
64
  if (this.logDebug) this.emit('debug', `Detected OS: ${osName}`);
64
65
 
66
+ // Detect Architecture
65
67
  const { stdout: archOut } = await execPromise('uname -m');
66
68
  const arch = archOut.trim();
67
69
  if (this.logDebug) this.emit('debug', `Detected architecture: ${arch}`);
68
70
 
69
71
  // Docker detection
70
72
  let isDocker = false;
71
- try { await access('/.dockerenv', fs.constants.F_OK); isDocker = true; } catch { }
73
+ try {
74
+ await access('/.dockerenv', fs.constants.F_OK);
75
+ isDocker = true;
76
+ } catch { }
77
+
72
78
  try {
73
79
  const { stdout } = await execPromise('cat /proc/1/cgroup || true');
74
80
  if (stdout.includes('docker') || stdout.includes('containerd')) isDocker = true;
75
81
  } catch { }
76
- if (isDocker && this.logDebug) this.emit('debug', 'Running inside Docker container.');
82
+ if (isDocker && this.logDebug) this.emit('debug', 'Running inside Docker container');
77
83
 
78
84
  // macOS
79
85
  if (osName === 'Darwin') {
80
86
  chromiumPath = '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome';
81
- 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
+ }
82
93
  }
83
94
 
84
95
  // ARM
85
96
  if (arch.startsWith('arm') || arch.startsWith('aarch')) {
86
- try { await access(chromiumPath, fs.constants.X_OK); return chromiumPath; }
87
- catch {
88
- try { await execPromise('sudo apt-get update -y && sudo apt-get install -y chromium-browser chromium-codecs-ffmpeg'); return chromiumPath; }
89
- catch { return null; }
97
+ try {
98
+ await access(chromiumPath, fs.constants.X_OK);
99
+ return chromiumPath;
100
+ } catch {
101
+ try {
102
+ await execPromise('sudo apt-get update -y && sudo apt-get install -y chromium-browser chromium-codecs-ffmpeg');
103
+ return chromiumPath;
104
+ } catch {
105
+ return null;
106
+ }
90
107
  }
91
108
  }
92
109
 
@@ -100,7 +117,11 @@ class Functions extends EventEmitter {
100
117
 
101
118
  // Entware (QNAP)
102
119
  let entwareExists = false;
103
- 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);
122
+ entwareExists = true;
123
+ } catch { }
124
+
104
125
  if (entwareExists) {
105
126
  try {
106
127
  await execPromise('/opt/bin/opkg update');
@@ -115,7 +136,12 @@ class Functions extends EventEmitter {
115
136
  'apk add --no-cache nspr nss libx11 libxcomposite libxdamage libxrandr atk cups libdrm libgbm alsa-lib',
116
137
  'yum install -y nspr nss libX11 libXcomposite libXdamage libXrandr atk cups libdrm libgbm alsa-lib'
117
138
  ];
118
- for (const cmd of depCommands) { try { await execPromise(`sudo ${cmd}`); } catch { } }
139
+
140
+ for (const cmd of depCommands) {
141
+ try {
142
+ await execPromise(`sudo ${cmd}`);
143
+ } catch { }
144
+ }
119
145
 
120
146
  process.env.LD_LIBRARY_PATH = `/usr/lib:/usr/lib64:${process.env.LD_LIBRARY_PATH || ''}`;
121
147
  return systemChromium;
@@ -123,7 +149,6 @@ class Functions extends EventEmitter {
123
149
 
124
150
  if (this.logDebug) this.emit('debug', `Unsupported OS: ${osName}`);
125
151
  return null;
126
-
127
152
  } catch (error) {
128
153
  if (this.logError) this.emit('error', `Chromium detection/install error: ${error.message}`);
129
154
  return null;
@@ -324,7 +324,7 @@ class MelCloudAta extends EventEmitter {
324
324
  //sens payload
325
325
  headers['Content-Type'] = 'application/json; charset=utf-8';
326
326
  headers.Origin = ApiUrlsHome.Origin;
327
- if (this.logDebug) this.emit('debug', `Send data: ${JSON.stringify(payload, null, 2)}`);
327
+ if (!this.logDebug) this.emit('debug', `Send data: ${JSON.stringify(payload, null, 2)}`);
328
328
 
329
329
  await axios(path, {
330
330
  method: method,
@@ -339,7 +339,7 @@ class MelCloudAta extends EventEmitter {
339
339
  return;
340
340
  }
341
341
  } catch (error) {
342
- if (error.response?.status === 500) return true; // Return 500 for schedule hovewer working correct
342
+ //if (error.response?.status === 500) return true; // Return 500 for schedule hovewer working correct
343
343
  throw new Error(`Send data error: ${error.message}`);
344
344
  }
345
345
  }
@@ -341,8 +341,8 @@ class MelCloudHome extends EventEmitter {
341
341
  hash = params.get('hash');
342
342
  if (this.logDebug) this.emit('debug', `MelCloudHome WS hash detected: ${hash}`);
343
343
  }
344
- } catch (err) {
345
- this.emit('error', `CDP WebSocketCreated handler error: ${err.message}`);
344
+ } catch (error) {
345
+ if (this.logError) this.emit('error', `CDP WebSocketCreated handler error: ${error.message}`);
346
346
  }
347
347
  });
348
348