homebridge-melcloud-control 4.3.3-beta.21 → 4.3.3-beta.22
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/homebridge-ui/public/index.html +96 -91
- package/package.json +1 -1
|
@@ -295,102 +295,107 @@
|
|
|
295
295
|
configDevicesMap.set(deviceId, deviceInConfig);
|
|
296
296
|
}
|
|
297
297
|
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
const
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
// === Process presets/schedules ===
|
|
332
|
-
const schedules = device.Schedules || [];
|
|
333
|
-
const schedulesInConfig = deviceInConfig.schedules || [];
|
|
334
|
-
const scheduleIds = new Set(schedulesInConfig.map(s => String(s.id)));
|
|
335
|
-
|
|
336
|
-
let addedNewSchedule = false;
|
|
337
|
-
schedules.forEach((schedule, index) => {
|
|
338
|
-
const scheduleId = String(schedule.Id);
|
|
339
|
-
if (!scheduleIds.has(scheduleId)) {
|
|
340
|
-
const presetObj = {
|
|
341
|
-
id: scheduleId,
|
|
342
|
-
displayType: 0,
|
|
343
|
-
name: `Schedule ${index}`,
|
|
344
|
-
namePrefix: false
|
|
345
|
-
};
|
|
346
|
-
schedulesInConfig.push(presetObj);
|
|
347
|
-
newPresets.push(presetObj);
|
|
348
|
-
scheduleIds.add(scheduleId);
|
|
349
|
-
addedNewSchedule = true;
|
|
350
|
-
}
|
|
351
|
-
});
|
|
352
|
-
|
|
353
|
-
// === Remove placeholder schedules (id === '0') if new ones were added ===
|
|
354
|
-
if (addedNewSchedule) {
|
|
355
|
-
const beforeCount = schedulesInConfig.length;
|
|
356
|
-
deviceInConfig.schedules = schedulesInConfig.filter(s => String(s.id) !== '0');
|
|
357
|
-
const removedCount = beforeCount - deviceInConfig.schedules.length;
|
|
358
|
-
|
|
359
|
-
if (removedCount > 0 && removedCount < beforeCount) {
|
|
360
|
-
updateInfo('info2', `Removed ${removedCount} placeholder schedule from device ${device.DeviceID}`, 'yellow');
|
|
298
|
+
if (account.type === 'melcloud') {
|
|
299
|
+
|
|
300
|
+
// === Process presets ===
|
|
301
|
+
const presets = device.Presets || [];
|
|
302
|
+
const presetsInConfig = deviceInConfig.presets || [];
|
|
303
|
+
const presetIds = new Set(presetsInConfig.map(p => String(p.id)));
|
|
304
|
+
|
|
305
|
+
let addedNewPreset = false;
|
|
306
|
+
presets.forEach((preset, index) => {
|
|
307
|
+
const presetId = String(preset.ID);
|
|
308
|
+
if (!presetIds.has(presetId)) {
|
|
309
|
+
const presetObj = {
|
|
310
|
+
id: presetId,
|
|
311
|
+
displayType: 0,
|
|
312
|
+
name: preset.NumberDescription || `Preset ${index}`,
|
|
313
|
+
namePrefix: false
|
|
314
|
+
};
|
|
315
|
+
presetsInConfig.push(presetObj);
|
|
316
|
+
newPresets.push(presetObj);
|
|
317
|
+
presetIds.add(presetId);
|
|
318
|
+
addedNewPreset = true;
|
|
319
|
+
}
|
|
320
|
+
});
|
|
321
|
+
|
|
322
|
+
// === Remove placeholder presets/schedules (id === '0') if new ones were added ===
|
|
323
|
+
if (addedNewPreset) {
|
|
324
|
+
const beforeCount = presetsInConfig.length;
|
|
325
|
+
deviceInConfig.presets = presetsInConfig.filter(p => String(p.id) !== '0');
|
|
326
|
+
const removedCount = beforeCount - deviceInConfig.presets.length;
|
|
327
|
+
|
|
328
|
+
if (removedCount > 0 && removedCount < beforeCount) {
|
|
329
|
+
updateInfo('info2', `Removed ${removedCount} placeholder preset from device ${device.DeviceID}`, 'yellow');
|
|
330
|
+
}
|
|
361
331
|
}
|
|
362
332
|
}
|
|
363
333
|
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
334
|
+
if (account.type === 'melcloudhome') {
|
|
335
|
+
// === Process presets/schedules ===
|
|
336
|
+
const schedules = device.Schedules || [];
|
|
337
|
+
const schedulesInConfig = deviceInConfig.schedules || [];
|
|
338
|
+
const scheduleIds = new Set(schedulesInConfig.map(s => String(s.id)));
|
|
339
|
+
|
|
340
|
+
let addedNewSchedule = false;
|
|
341
|
+
schedules.forEach((schedule, index) => {
|
|
342
|
+
const scheduleId = String(schedule.Id);
|
|
343
|
+
if (!scheduleIds.has(scheduleId)) {
|
|
344
|
+
const presetObj = {
|
|
345
|
+
id: scheduleId,
|
|
346
|
+
displayType: 0,
|
|
347
|
+
name: `Schedule ${index}`,
|
|
348
|
+
namePrefix: false
|
|
349
|
+
};
|
|
350
|
+
schedulesInConfig.push(presetObj);
|
|
351
|
+
newPresets.push(presetObj);
|
|
352
|
+
scheduleIds.add(scheduleId);
|
|
353
|
+
addedNewSchedule = true;
|
|
354
|
+
}
|
|
355
|
+
});
|
|
356
|
+
|
|
357
|
+
// === Remove placeholder schedules (id === '0') if new ones were added ===
|
|
358
|
+
if (addedNewSchedule) {
|
|
359
|
+
const beforeCount = schedulesInConfig.length;
|
|
360
|
+
deviceInConfig.schedules = schedulesInConfig.filter(s => String(s.id) !== '0');
|
|
361
|
+
const removedCount = beforeCount - deviceInConfig.schedules.length;
|
|
362
|
+
|
|
363
|
+
if (removedCount > 0 && removedCount < beforeCount) {
|
|
364
|
+
updateInfo('info2', `Removed ${removedCount} placeholder schedule from device ${device.DeviceID}`, 'yellow');
|
|
365
|
+
}
|
|
383
366
|
}
|
|
384
|
-
});
|
|
385
|
-
|
|
386
|
-
// === Remove placeholder scenes (id === '0') if new ones were added ===
|
|
387
|
-
if (addedNewScenes) {
|
|
388
|
-
const beforeCount = scenesInConfig.length;
|
|
389
|
-
deviceInConfig.scenes = scenesInConfig.filter(s => String(s.id) !== '0');
|
|
390
|
-
const removedCount = beforeCount - deviceInConfig.scenes.length;
|
|
391
367
|
|
|
392
|
-
|
|
393
|
-
|
|
368
|
+
// === Process scenes ===
|
|
369
|
+
const scenes = device.Scenes || [];
|
|
370
|
+
const scenesInConfig = deviceInConfig.scenes || [];
|
|
371
|
+
const sceneIds = new Set(scenesInConfig.map(s => String(s.id)));
|
|
372
|
+
|
|
373
|
+
let addedNewScenes = false;
|
|
374
|
+
scenes.forEach((scene, index) => {
|
|
375
|
+
const sceneId = String(scene.Id);
|
|
376
|
+
if (!sceneIds.has(sceneId)) {
|
|
377
|
+
const sceneObj = {
|
|
378
|
+
id: sceneId,
|
|
379
|
+
displayType: 0,
|
|
380
|
+
name: scene.Name || `Scene ${index}`,
|
|
381
|
+
namePrefix: false
|
|
382
|
+
};
|
|
383
|
+
scenesInConfig.push(sceneObj);
|
|
384
|
+
newScenes.push(sceneObj);
|
|
385
|
+
sceneIds.add(sceneId);
|
|
386
|
+
addedNewScenes = true;
|
|
387
|
+
}
|
|
388
|
+
});
|
|
389
|
+
|
|
390
|
+
// === Remove placeholder scenes (id === '0') if new ones were added ===
|
|
391
|
+
if (addedNewScenes) {
|
|
392
|
+
const beforeCount = scenesInConfig.length;
|
|
393
|
+
deviceInConfig.scenes = scenesInConfig.filter(s => String(s.id) !== '0');
|
|
394
|
+
const removedCount = beforeCount - deviceInConfig.scenes.length;
|
|
395
|
+
|
|
396
|
+
if (removedCount > 0 && removedCount < beforeCount) {
|
|
397
|
+
updateInfo('info2', `Removed ${removedCount} placeholder scene from device ${device.DeviceID}`, 'yellow');
|
|
398
|
+
}
|
|
394
399
|
}
|
|
395
400
|
}
|
|
396
401
|
|
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.3-beta.
|
|
4
|
+
"version": "4.3.3-beta.22",
|
|
5
5
|
"description": "Homebridge plugin to control Mitsubishi Air Conditioner, Heat Pump and Energy Recovery Ventilation.",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"author": "grzegorz914",
|