homebridge-melcloud-control 4.1.2-beta.68 → 4.1.2-beta.69

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.
@@ -255,9 +255,9 @@
255
255
  if (d.Type === 3) devicesByType.erv.push(d);
256
256
  });
257
257
 
258
- account.ataDevices ??= [];
259
- account.atwDevices ??= [];
260
- account.ervDevices ??= [];
258
+ account.ataDevices = (account.ataDevices || []).filter(d => String(d.id) !== '0');
259
+ account.atwDevices = (account.atwDevices || []).filter(d => String(d.id) !== '0');
260
+ account.ervDevices = (account.ervDevices || []).filter(d => String(d.id) !== '0');
261
261
 
262
262
  const removedAta = removeStaleDevices(account.ataDevices, devicesByType.ata);
263
263
  const removedAtw = removeStaleDevices(account.atwDevices, devicesByType.atw);
@@ -265,7 +265,7 @@
265
265
 
266
266
  const handleDevices = (devicesInMelCloud, devicesInConfig, typeString, newArr, newPresets) => {
267
267
  try {
268
- const configDevicesMap = new Map(devicesInConfig.map(dev => [String(dev.id), dev]));
268
+ const configDevicesMap = new Map(devicesInConfig.map(dev => [dev.id, dev]));
269
269
  const isMelcloud = account.type === 'melcloud';
270
270
 
271
271
  const idKey = isMelcloud ? 'ID' : 'Id';
@@ -293,20 +293,9 @@
293
293
  configDevicesMap.set(deviceId, deviceInConfig);
294
294
  }
295
295
 
296
- // === Remove placeholder devices (id === '0') if new ones were added ===
297
- if (devicesInConfig.length > 1 && devicesInConfig.some(d => String(d.id) === '0')) {
298
- const beforeCount = devicesInConfig.length;
299
- deviceInConfig = devicesInConfig.filter(d => String(d.id) !== '0');
300
- const removedCount = beforeCount - deviceInConfig.length;
301
-
302
- if (removedCount > 0 && removedCount < beforeCount) {
303
- updateInfo('info1', `Removed ${removedCount} ${typeString} with id === 0 from config`, 'yellow');
304
- }
305
- }
306
-
307
296
  // === Process presets/schedules ===
308
297
  const presets = device[typeKey] || [];
309
- const presetsInConfig = deviceInConfig[typeKey1] || [];
298
+ const presetsInConfig = (deviceInConfig[typeKey1] || []).filter(p => String(p.id) !== '0');
310
299
  const presetIds = new Set(presetsInConfig.map(p => String(p.id)));
311
300
 
312
301
  presets.forEach((preset, index) => {
@@ -323,17 +312,6 @@
323
312
  presetIds.add(presetId);
324
313
  }
325
314
  });
326
-
327
- // === Remove placeholder presets/schedules (id === '0') if new ones were added ===
328
- if (presetsInConfig.length > 1 && presetsInConfig.some(p => String(p.id) === '0')) {
329
- const beforeCount = presetsInConfig.length;
330
- deviceInConfig[typeKey1] = presetsInConfig.filter(p => String(p.id) !== '0');
331
- const removedCount = beforeCount - deviceInConfig[typeKey1].length;
332
-
333
- if (removedCount > 0 && removedCount < beforeCount) {
334
- updateInfo('info2', `Removed ${removedCount} ${typeKey1} with id === 0 from ${typeString} id: ${device.DeviceID}`, 'yellow');
335
- }
336
- }
337
315
  });
338
316
 
339
317
  // Return filtered devicesInConfig to make sure upstream code uses it
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.68",
4
+ "version": "4.1.2-beta.69",
5
5
  "description": "Homebridge plugin to control Mitsubishi Air Conditioner, Heat Pump and Energy Recovery Ventilation.",
6
6
  "license": "MIT",
7
7
  "author": "grzegorz914",