homebridge-melcloud-control 3.9.0-beta.1 → 3.9.0-beta.3

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.
@@ -209,8 +209,9 @@
209
209
 
210
210
  // remove stale devices
211
211
  for (let i = configArray.length - 1; i >= 0; i--) {
212
- if (!melcloudIds.includes(configArray[i].id)) {
213
- removedArray.push(configArray[i]);
212
+ const device = configArray[i];
213
+ if (device.id !== 0 && !melcloudIds.includes(device.id)) {
214
+ removedArray.push(device);
214
215
  configArray.splice(i, 1);
215
216
  }
216
217
  }
@@ -246,51 +247,15 @@
246
247
  });
247
248
  }
248
249
 
249
- const ataTemplate = {
250
- displayMode: 1,
251
- heatDryFanMode: 1,
252
- coolDryFanMode: 1,
253
- autoDryFanMode: 1,
254
- temperatureSensor: false,
255
- temperatureSensorOutdoor: false,
256
- };
257
-
258
- const atwTemplate = {
259
- displayMode: 1,
260
- hideZone: 0,
261
- temperatureSensor: false,
262
- temperatureSensorFlow: false,
263
- temperatureSensorReturn: false,
264
- temperatureSensorFlowZone1: false,
265
- temperatureSensorReturnZone1: false,
266
- temperatureSensorFlowWaterTank: false,
267
- temperatureSensorReturnWaterTank: false,
268
- temperatureSensorFlowZone2: false,
269
- temperatureSensorReturnZone2: false,
270
- temperatureSensorOutdoor: false,
271
- };
272
-
273
- const ervTemplate = {
274
- displayMode: 1,
275
- temperatureSensor: false,
276
- temperatureSensorOutdoor: false,
277
- temperatureSensorSupply: false,
278
- };
250
+ const ataTemplate = { displayMode: 1, heatDryFanMode: 1, coolDryFanMode: 1, autoDryFanMode: 1, temperatureSensor: false, temperatureSensorOutdoor: false };
251
+ const atwTemplate = { displayMode: 1, hideZone: 0, temperatureSensor: false, temperatureSensorFlow: false, temperatureSensorReturn: false, temperatureSensorFlowZone1: false, temperatureSensorReturnZone1: false, temperatureSensorFlowWaterTank: false, temperatureSensorReturnWaterTank: false, temperatureSensorFlowZone2: false, temperatureSensorReturnZone2: false, temperatureSensorOutdoor: false };
252
+ const ervTemplate = { displayMode: 1, temperatureSensor: false, temperatureSensorOutdoor: false, temperatureSensorSupply: false };
279
253
 
280
254
  handleDevices(devicesByTypeInMelCloud.ata, ataDevicesInConfig, newDevices.ata, newDevices.ataPresets, removedDevices.ata, "Air Conditioner", ataTemplate);
281
255
  handleDevices(devicesByTypeInMelCloud.atw, atwDevicesInConfig, newDevices.atw, newDevices.atwPresets, removedDevices.atw, "Heat Pump", atwTemplate);
282
256
  handleDevices(devicesByTypeInMelCloud.erv, ervDevicesInConfig, newDevices.erv, newDevices.ervPresets, removedDevices.erv, "Energy Recovery Ventilation", ervTemplate);
283
257
 
284
- const textAta = `ATA: ${newDevices.ata.length}`;
285
- const textAtw = `ATW: ${newDevices.atw.length}`;
286
- const textErv = `ERV: ${newDevices.erv.length}`;
287
- const textRemovedAta = `ATA: ${removedDevices.ata.length}`;
288
- const textRemovedAtw = `ATW: ${removedDevices.atw.length}`;
289
- const textRemovedErv = `ERV: ${removedDevices.erv.length}`;
290
- const textAtaPresets = `ATA Presets: ${newDevices.ataPresets.length}`;
291
- const textAtwPresets = `ATW Presets: ${newDevices.atwPresets.length}`;
292
- const textErvPresets = `ERV Presets: ${newDevices.ervPresets.length}`;
293
-
258
+ const formatDeviceNames = (arr) => arr.map(d => d.name).join(', ') || 'None';
294
259
  const newDevicesCount = newDevices.ata.length + newDevices.atw.length + newDevices.erv.length;
295
260
  const newPresetsCount = newDevices.ataPresets.length + newDevices.atwPresets.length + newDevices.ervPresets.length;
296
261
  const removedDevicesCount = removedDevices.ata.length + removedDevices.atw.length + removedDevices.erv.length;
@@ -299,18 +264,14 @@
299
264
  updateInfo('info', 'No changes (already synced).', 'white');
300
265
  } else {
301
266
  if (newDevicesCount > 0) {
302
- updateInfo('info', `Found, ${textAta}, ${textAtw}, ${textErv}.`, 'green');
267
+ updateInfo('info', `New Devices Found: ATA: ${formatDeviceNames(newDevices.ata)}, ATW: ${formatDeviceNames(newDevices.atw)}, ERV: ${formatDeviceNames(newDevices.erv)}`, 'green');
303
268
  updateInfo('info2', 'Now You can configure it.', 'green');
304
269
  }
305
270
  if (newPresetsCount > 0) {
306
- updateInfo('info1', `${textAtaPresets}, ${textAtwPresets}, ${textErvPresets}.`, 'green');
307
- if (newDevicesCount === 0) {
308
- updateInfo('info', `Found, ${textAtaPresets}, ${textAtwPresets}, ${textErvPresets}.`, 'green');
309
- updateInfo('info1', 'Now You can configure it.', 'green');
310
- }
271
+ updateInfo('info1', `New Presets: ATA: ${newDevices.ataPresets.length}, ATW: ${newDevices.atwPresets.length}, ERV: ${newDevices.ervPresets.length}`, 'green');
311
272
  }
312
273
  if (removedDevicesCount > 0) {
313
- updateInfo('info', `Removed, ${textRemovedAta}, ${textRemovedAtw}, ${textRemovedErv}.`, 'orange');
274
+ updateInfo('info', `Removed Devices: ATA: ${formatDeviceNames(removedDevices.ata)}, ATW: ${formatDeviceNames(removedDevices.atw)}, ERV: ${formatDeviceNames(removedDevices.erv)}`, 'orange');
314
275
  }
315
276
  }
316
277
 
@@ -328,6 +289,7 @@
328
289
  });
329
290
  })();
330
291
  </script>
292
+
331
293
  </body>
332
294
 
333
295
  </html>
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "displayName": "MELCloud Control",
3
3
  "name": "homebridge-melcloud-control",
4
- "version": "3.9.0-beta.1",
4
+ "version": "3.9.0-beta.3",
5
5
  "description": "Homebridge plugin to control Mitsubishi Air Conditioner, Heat Pump and Energy Recovery Ventilation.",
6
6
  "license": "MIT",
7
7
  "author": "grzegorz914",