homebridge-melcloud-control 4.6.4 → 4.6.6-beta.0
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/config.schema.json +27 -3
- package/homebridge-ui/public/index.html +39 -7
- package/package.json +2 -2
package/config.schema.json
CHANGED
|
@@ -10,6 +10,11 @@
|
|
|
10
10
|
"schema": {
|
|
11
11
|
"type": "object",
|
|
12
12
|
"properties": {
|
|
13
|
+
"name": {
|
|
14
|
+
"title": "Platform",
|
|
15
|
+
"type": "string",
|
|
16
|
+
"default": "MELCLoud Control"
|
|
17
|
+
},
|
|
13
18
|
"accounts": {
|
|
14
19
|
"type": "array",
|
|
15
20
|
"title": "Accounts",
|
|
@@ -2343,8 +2348,8 @@
|
|
|
2343
2348
|
"host": {
|
|
2344
2349
|
"title": "IP/Hostname",
|
|
2345
2350
|
"type": "string",
|
|
2346
|
-
"placeholder": "
|
|
2347
|
-
"
|
|
2351
|
+
"placeholder": "192.168.1.20 or mqtt.local",
|
|
2352
|
+
"pattern": "^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}|([a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)(\\.([a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?))*)$",
|
|
2348
2353
|
"description": "Here set the IP/Hostname of MQTT Broker.",
|
|
2349
2354
|
"condition": {
|
|
2350
2355
|
"functionBody": "return model.devices[arrayIndices].mqtt.enable === true;"
|
|
@@ -2430,7 +2435,26 @@
|
|
|
2430
2435
|
}
|
|
2431
2436
|
]
|
|
2432
2437
|
}
|
|
2433
|
-
}
|
|
2438
|
+
},
|
|
2439
|
+
"allOf": [
|
|
2440
|
+
{
|
|
2441
|
+
"if": {
|
|
2442
|
+
"required": [
|
|
2443
|
+
"enable"
|
|
2444
|
+
],
|
|
2445
|
+
"properties": {
|
|
2446
|
+
"enable": {
|
|
2447
|
+
"const": true
|
|
2448
|
+
}
|
|
2449
|
+
}
|
|
2450
|
+
},
|
|
2451
|
+
"then": {
|
|
2452
|
+
"required": [
|
|
2453
|
+
"host"
|
|
2454
|
+
]
|
|
2455
|
+
}
|
|
2456
|
+
}
|
|
2457
|
+
]
|
|
2434
2458
|
}
|
|
2435
2459
|
},
|
|
2436
2460
|
"required": [
|
|
@@ -257,8 +257,17 @@
|
|
|
257
257
|
return;
|
|
258
258
|
}
|
|
259
259
|
|
|
260
|
+
// Ensure device arrays exist before handling
|
|
261
|
+
account.ataDevices = account.ataDevices ?? [];
|
|
262
|
+
account.atwDevices = account.atwDevices ?? [];
|
|
263
|
+
account.ervDevices = account.ervDevices ?? [];
|
|
264
|
+
|
|
260
265
|
// Prepare MELCloud data
|
|
261
|
-
const newInMelCloud = {
|
|
266
|
+
const newInMelCloud = {
|
|
267
|
+
ata: [], ataPresets: [], ataSchedules: [], ataScenes: [],
|
|
268
|
+
atw: [], atwPresets: [], atwSchedules: [], atwScenes: [],
|
|
269
|
+
erv: [], ervPresets: [], ervSchedules: [], ervScenes: []
|
|
270
|
+
};
|
|
262
271
|
const devicesInMelCloudByType = { ata: [], atw: [], erv: [] };
|
|
263
272
|
const scenesInMelCloud = response.Scenes ?? [];
|
|
264
273
|
|
|
@@ -279,7 +288,7 @@
|
|
|
279
288
|
// Map UnitId → Scenes
|
|
280
289
|
const unitIdToScenes = mapUnitIdToScenes(scenesInMelCloud);
|
|
281
290
|
|
|
282
|
-
// Generic device handler (
|
|
291
|
+
// Generic device handler (handles devices, presets, schedules, and scenes)
|
|
283
292
|
const handleDevices = (devicesInMelCloud, devicesInConfig, newDevices, newPresets, newSchedules, newScenes) => {
|
|
284
293
|
const configDevicesMap = new Map(devicesInConfig.map(dev => [String(dev.id), dev]));
|
|
285
294
|
|
|
@@ -362,10 +371,33 @@
|
|
|
362
371
|
return devicesInConfig;
|
|
363
372
|
};
|
|
364
373
|
|
|
365
|
-
// Execute device handlers
|
|
366
|
-
account.ataDevices = handleDevices(
|
|
367
|
-
|
|
368
|
-
|
|
374
|
+
// Execute device handlers with safe initialization
|
|
375
|
+
account.ataDevices = handleDevices(
|
|
376
|
+
devicesInMelCloudByType.ata,
|
|
377
|
+
account.ataDevices,
|
|
378
|
+
newInMelCloud.ata,
|
|
379
|
+
newInMelCloud.ataPresets,
|
|
380
|
+
newInMelCloud.ataSchedules,
|
|
381
|
+
newInMelCloud.ataScenes
|
|
382
|
+
);
|
|
383
|
+
|
|
384
|
+
account.atwDevices = handleDevices(
|
|
385
|
+
devicesInMelCloudByType.atw,
|
|
386
|
+
account.atwDevices,
|
|
387
|
+
newInMelCloud.atw,
|
|
388
|
+
newInMelCloud.atwPresets,
|
|
389
|
+
newInMelCloud.atwSchedules,
|
|
390
|
+
newInMelCloud.atwScenes
|
|
391
|
+
);
|
|
392
|
+
|
|
393
|
+
account.ervDevices = handleDevices(
|
|
394
|
+
devicesInMelCloudByType.erv,
|
|
395
|
+
account.ervDevices,
|
|
396
|
+
newInMelCloud.erv,
|
|
397
|
+
newInMelCloud.ervPresets,
|
|
398
|
+
newInMelCloud.ervSchedules,
|
|
399
|
+
newInMelCloud.ervScenes
|
|
400
|
+
);
|
|
369
401
|
|
|
370
402
|
// Summary counts
|
|
371
403
|
const newDevicesCount = newInMelCloud.ata.length + newInMelCloud.atw.length + newInMelCloud.erv.length;
|
|
@@ -389,6 +421,7 @@
|
|
|
389
421
|
|
|
390
422
|
await homebridge.updatePluginConfig(pluginConfig);
|
|
391
423
|
await homebridge.savePluginConfig();
|
|
424
|
+
|
|
392
425
|
} catch (error) {
|
|
393
426
|
updateInfo('info', `Prepare config error`, "red");
|
|
394
427
|
updateInfo('info1', `Error: ${JSON.stringify(error)}`, "red");
|
|
@@ -397,6 +430,5 @@
|
|
|
397
430
|
homebridge.hideSpinner();
|
|
398
431
|
}
|
|
399
432
|
});
|
|
400
|
-
|
|
401
433
|
})();
|
|
402
434
|
</script>
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"displayName": "MELCloud Control",
|
|
3
3
|
"name": "homebridge-melcloud-control",
|
|
4
|
-
"version": "4.6.
|
|
4
|
+
"version": "4.6.6-beta.0",
|
|
5
5
|
"description": "Homebridge plugin to control Mitsubishi Air Conditioner, Heat Pump and Energy Recovery Ventilation.",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"author": "grzegorz914",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"mqtt": "^5.14.1",
|
|
40
40
|
"axios": "^1.13.2",
|
|
41
41
|
"express": "^5.2.1",
|
|
42
|
-
"puppeteer": "^24.
|
|
42
|
+
"puppeteer": "^24.36.0",
|
|
43
43
|
"ws": "^8.19.0"
|
|
44
44
|
},
|
|
45
45
|
"keywords": [
|