homebridge-melcloud-control 4.1.2-beta.66 → 4.1.2-beta.67
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 +13 -11
- package/package.json +1 -1
|
@@ -272,21 +272,11 @@
|
|
|
272
272
|
const typeKey = isMelcloud ? 'Presets' : 'Schedule';
|
|
273
273
|
const typeKey1 = isMelcloud ? 'presets' : 'schedules';
|
|
274
274
|
|
|
275
|
+
let addedNewDevice = false;
|
|
275
276
|
devicesInMelCloud.forEach(device => {
|
|
276
277
|
const deviceId = String(device.DeviceID);
|
|
277
278
|
let deviceInConfig = configDevicesMap.get(deviceId);
|
|
278
279
|
|
|
279
|
-
// === Remove placeholder devices with id '0' before adding new ===
|
|
280
|
-
const beforeDevicesCount = devicesInConfig.length;
|
|
281
|
-
devicesInConfig = devicesInConfig.filter(d => String(d.id) !== '0');
|
|
282
|
-
if (devicesInConfig.length !== beforeDevicesCount) {
|
|
283
|
-
updateInfo('info2', `Removed placeholder devices with id '0'`, 'yellow');
|
|
284
|
-
|
|
285
|
-
// Rebuild map after filtering
|
|
286
|
-
configDevicesMap.clear();
|
|
287
|
-
devicesInConfig.forEach(dev => configDevicesMap.set(String(dev.id), dev));
|
|
288
|
-
}
|
|
289
|
-
|
|
290
280
|
// === Create device if missing ===
|
|
291
281
|
if (!deviceInConfig) {
|
|
292
282
|
deviceInConfig = {
|
|
@@ -302,6 +292,18 @@
|
|
|
302
292
|
devicesInConfig.push(deviceInConfig);
|
|
303
293
|
newArr.push(deviceInConfig);
|
|
304
294
|
configDevicesMap.set(deviceId, deviceInConfig);
|
|
295
|
+
addedNewDevice = true;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
// === Remove placeholder devices (id === '0') if new ones were added ===
|
|
299
|
+
if (addedNewDevice) {
|
|
300
|
+
const beforeCount = devicesInConfig.length;
|
|
301
|
+
deviceInConfig = devicesInConfig.filter(d => String(d.id) !== '0');
|
|
302
|
+
const removedCount = beforeCount - deviceInConfig.length;
|
|
303
|
+
|
|
304
|
+
if (removedCount > 0 && removedCount < beforeCount) {
|
|
305
|
+
updateInfo('info1', `Removed ${removedCount} placeholder from device ${device.DeviceID}`, 'yellow');
|
|
306
|
+
}
|
|
305
307
|
}
|
|
306
308
|
|
|
307
309
|
// === Process presets/schedules ===
|
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.
|
|
4
|
+
"version": "4.1.2-beta.67",
|
|
5
5
|
"description": "Homebridge plugin to control Mitsubishi Air Conditioner, Heat Pump and Energy Recovery Ventilation.",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"author": "grzegorz914",
|