homebridge-melcloud-control 4.3.3-beta.25 → 4.3.3-beta.27

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.
@@ -299,12 +299,12 @@
299
299
  if (account.type === 'melcloud') {
300
300
 
301
301
  // === Process presets ===
302
- const presets = device.Presets || [];
302
+ const presetsInMelCloud = device.Presets || [];
303
303
  const presetsInConfig = deviceInConfig.presets || [];
304
304
  const presetIds = new Set(presetsInConfig.map(p => String(p.id)));
305
305
 
306
306
  let addedNewPreset = false;
307
- presets.forEach((preset, index) => {
307
+ presetsInMelCloud.forEach((preset, index) => {
308
308
  const presetId = String(preset.ID);
309
309
  if (!presetIds.has(presetId)) {
310
310
  const presetObj = {
@@ -336,12 +336,12 @@
336
336
  if (account.type === 'melcloudhome') {
337
337
 
338
338
  // === Process schedules ===
339
- const schedules = device.Schedule || [];
339
+ const schedulesInMelCloud = device.Schedule || [];
340
340
  const schedulesInConfig = deviceInConfig.schedules || [];
341
341
  const scheduleIds = new Set(schedulesInConfig.map(s => String(s.id)));
342
342
 
343
343
  let addedNewSchedule = false;
344
- schedules.forEach((schedule, index) => {
344
+ schedulesInMelCloud.forEach((schedule, index) => {
345
345
  const scheduleId = String(schedule.Id);
346
346
  if (!scheduleIds.has(scheduleId)) {
347
347
  const scheduleObj = {
@@ -369,12 +369,12 @@
369
369
  }
370
370
 
371
371
  // === Process scenes ===
372
- const scenes = device.Scenes || [];
372
+ const scenesInMelCloud = device.Scenes || [];
373
373
  const scenesInConfig = deviceInConfig.scenes || [];
374
374
  const sceneIds = new Set(scenesInConfig.map(s => String(s.id)));
375
375
 
376
376
  let addedNewScenes = false;
377
- scenes.forEach((scene, index) => {
377
+ scenesInMelCloud.forEach((scene, index) => {
378
378
  const sceneId = String(scene.Id);
379
379
  if (!sceneIds.has(sceneId)) {
380
380
  const sceneObj = {
@@ -425,17 +425,19 @@
425
425
  updateInfo('info', 'No changes detected.', 'white');
426
426
  } else {
427
427
  if (newDevicesCount)
428
- updateInfo('info', `Found new devices: ATA: ${newDevices.ata.length}, ATW: ${newDevices.atw.length}, ERV: ${newDevices.erv.length}.`, 'green');
429
- if (newPresetsCount || newScenesCount || newSchedulesCount)
430
- updateInfo('info1', `Found new ${account.type === 'melcloud' ? 'presets' : 'schedules'}: ATA: ${account.type === 'melcloud' ? newDevices.ataPresets.length : newDevices.ataSchedules.length}, ATW: ${account.type === 'melcloud' ? newDevices.atwPresets.length : newDevices.atwSchedules.length}, ERV: ${account.type === 'melcloud' ? newDevices.ervPresets.length : newDevices.ervSchedules.length}, Scenes: ${newDevices.scenes.length}.`, 'green');
428
+ updateInfo('info', `Found new devices: ${newDevices.ata.length ? `ATA: ${newDevices.ata.length},` : ''} ${newDevices.atw.length ? `ATW: ${newDevices.atw.length},` : ''} ${newDevices.erv.length ? `ERV: ${newDevices.erv.length},` : ''}.`, 'green');
429
+ if (newPresetsCount)
430
+ updateInfo('info1', `Found new presets: ${newDevices.ataPresets.length ? `ATA: ${newDevices.ataPresets.length},` : ''} ${newDevices.atwPresets.length ? `ATW: ${newDevices.atwPresets.length},` : ''} ${newDevices.ervPresets.length ? `ERV: ${newDevices.ervPresets.length}` : ''}.`, 'green');
431
+ if (newScenesCount || newSchedulesCount)
432
+ updateInfo('info1', `Found new schedules: ${newDevices.ataSchedules.length ? `ATA: ${newDevices.ataSchedules.length},` : ''} ${newDevices.atwSchedules.length ? `ATW: ${newDevices.atwSchedules.length},` : ''} ${newDevices.ervSchedules.length ? `ERV: ${newDevices.ervSchedules.length},` : ''} ${newDevices.scenes.length ? `Scenes: ${newDevices.scenes.length}` : ''}.`, 'green');
431
433
  if (removedDevicesCount)
432
- updateInfo('info2', `Removed devices: ATA: ${removedAta.length}, ATW: ${removedAtw.length}, ERV: ${removedErv.length}.`, 'orange');
434
+ updateInfo('info2', `Removed devices: ${removedAta.length ? `ATA: ${removedAta.length},` : ''} ${removedAtw.length ? `ATW: ${removedAtw.length},` : ''} ${removedErv.length ? `ERV: ${removedErv.length}` : ''}.`, 'orange');
433
435
  }
434
436
 
435
437
  await homebridge.updatePluginConfig(pluginConfig);
436
438
  await homebridge.savePluginConfig(pluginConfig);
437
439
  } catch (error) {
438
- updateInfo('info', `Connect error ${JSON.stringify(error)}`, 'red');
440
+ updateInfo('info', `Prepare config error ${JSON.stringify(error)}`, 'red');
439
441
  document.getElementById('logIn').className = "btn btn-secondary";
440
442
  } finally {
441
443
  document.getElementById('logIn').className = "btn btn-secondary";
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.25",
4
+ "version": "4.3.3-beta.27",
5
5
  "description": "Homebridge plugin to control Mitsubishi Air Conditioner, Heat Pump and Energy Recovery Ventilation.",
6
6
  "license": "MIT",
7
7
  "author": "grzegorz914",