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 +1 -1
- package/src/constants.js +2 -1
- package/src/functions.js +35 -10
- package/src/melcloudata.js +2 -2
- package/src/melcloudhome.js +2 -2
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.
|
|
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: "
|
|
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 {
|
|
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 {
|
|
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 {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
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 {
|
|
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
|
-
|
|
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;
|
package/src/melcloudata.js
CHANGED
|
@@ -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
|
}
|
package/src/melcloudhome.js
CHANGED
|
@@ -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 (
|
|
345
|
-
this.emit('error', `CDP WebSocketCreated handler error: ${
|
|
344
|
+
} catch (error) {
|
|
345
|
+
if (this.logError) this.emit('error', `CDP WebSocketCreated handler error: ${error.message}`);
|
|
346
346
|
}
|
|
347
347
|
});
|
|
348
348
|
|