homebridge-melcloud-control 4.2.5-beta.0 → 4.2.5-beta.2

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "displayName": "MELCloud Control",
3
3
  "name": "homebridge-melcloud-control",
4
- "version": "4.2.5-beta.0",
4
+ "version": "4.2.5-beta.2",
5
5
  "description": "Homebridge plugin to control Mitsubishi Air Conditioner, Heat Pump and Energy Recovery Ventilation.",
6
6
  "license": "MIT",
7
7
  "author": "grzegorz914",
package/src/deviceata.js CHANGED
@@ -56,7 +56,7 @@ class DeviceAta extends EventEmitter {
56
56
  this.restFulConnected = false;
57
57
  this.mqtt = account.mqtt ?? {};
58
58
  this.mqttConnected = false;
59
-
59
+
60
60
  const serviceType = [null, Service.MotionSensor, Service.OccupancySensor, Service.ContactSensor, Service.MotionSensor, Service.OccupancySensor, Service.ContactSensor];
61
61
  const characteristicType = [null, Characteristic.MotionDetected, Characteristic.OccupancyDetected, Characteristic.ContactSensorState, Characteristic.MotionDetected, Characteristic.OccupancyDetected, Characteristic.ContactSensorState];
62
62
 
@@ -349,8 +349,9 @@ class DeviceAta extends EventEmitter {
349
349
  .onSet(async (state) => {
350
350
  try {
351
351
  deviceData.Device.Power = state ? true : false;
352
- await this.melCloudAta.send(this.accountType, this.displayType, deviceData, AirConditioner.EffectiveFlags.Power);
352
+
353
353
  if (this.logInfo) this.emit('info', `Set power: ${state ? 'On' : 'Off'}`);
354
+ await this.melCloudAta.send(this.accountType, this.displayType, deviceData, AirConditioner.EffectiveFlags.Power);
354
355
  } catch (error) {
355
356
  if (this.logWarn) this.emit('warn', `Set power error: ${error}`);
356
357
  };
@@ -387,8 +388,8 @@ class DeviceAta extends EventEmitter {
387
388
  break;
388
389
  };
389
390
 
390
- await this.melCloudAta.send(this.accountType, this.displayType, deviceData, AirConditioner.EffectiveFlags.OperationMode);
391
391
  if (this.logInfo) this.emit('info', `Set operation mode: ${AirConditioner.OperationModeMapEnumToString[value]}`);
392
+ await this.melCloudAta.send(this.accountType, this.displayType, deviceData, AirConditioner.EffectiveFlags.OperationMode);
392
393
  } catch (error) {
393
394
  if (this.logWarn) this.emit('warn', `Set operation mode error: ${error}`);
394
395
  };
@@ -427,9 +428,9 @@ class DeviceAta extends EventEmitter {
427
428
  break;
428
429
  };
429
430
 
430
- deviceData.Device[fanKey] = value
431
- await this.melCloudAta.send(this.accountType, this.displayType, deviceData, AirConditioner.EffectiveFlags.SetFanSpeed);
431
+ deviceData.Device[fanKey] = value;
432
432
  if (this.logInfo) this.emit('info', `Set fan speed mode: ${AirConditioner.FanSpeedMapEnumToString[value]}`);
433
+ await this.melCloudAta.send(this.accountType, this.displayType, deviceData, AirConditioner.EffectiveFlags.SetFanSpeed);
433
434
  } catch (error) {
434
435
  if (this.logWarn) this.emit('warn', `Set fan speed mode error: ${error}`);
435
436
  };
@@ -446,8 +447,8 @@ class DeviceAta extends EventEmitter {
446
447
  try {
447
448
  deviceData.Device.VaneHorizontalDirection = value ? 12 : 0;
448
449
  deviceData.Device.VaneVerticalDirection = value ? 7 : 0;
449
- await this.melCloudAta.send(this.accountType, this.displayType, deviceData, AirConditioner.EffectiveFlags.VaneVerticalVaneHorizontal);
450
450
  if (this.logInfo) this.emit('info', `Set air direction mode: ${AirConditioner.AirDirectionMapEnumToString[value]}`);
451
+ await this.melCloudAta.send(this.accountType, this.displayType, deviceData, AirConditioner.EffectiveFlags.VaneVerticalVaneHorizontal);
451
452
  } catch (error) {
452
453
  if (this.logWarn) this.emit('warn', `Set vane swing mode error: ${error}`);
453
454
  };
@@ -467,8 +468,8 @@ class DeviceAta extends EventEmitter {
467
468
  try {
468
469
  const tempKey = this.accessory.operationMode === 8 ? 'DefaultCoolingSetTemperature' : 'SetTemperature';
469
470
  deviceData.Device[tempKey] = value;
470
- await this.melCloudAta.send(this.accountType, this.displayType, deviceData, AirConditioner.EffectiveFlags.SetTemperature);
471
471
  if (this.logInfo) this.emit('info', `Set cooling threshold temperature: ${value}${this.accessory.temperatureUnit}`);
472
+ await this.melCloudAta.send(this.accountType, this.displayType, deviceData, AirConditioner.EffectiveFlags.SetTemperature);
472
473
  } catch (error) {
473
474
  if (this.logWarn) this.emit('warn', `Set cooling threshold temperature error: ${error}`);
474
475
  };
@@ -488,8 +489,8 @@ class DeviceAta extends EventEmitter {
488
489
  try {
489
490
  const tempKey = this.accessory.operationMode === 8 ? 'DefaultHeatingSetTemperature' : 'SetTemperature';
490
491
  deviceData.Device[tempKey] = value;
491
- await this.melCloudAta.send(this.accountType, this.displayType, deviceData, AirConditioner.EffectiveFlags.SetTemperature);
492
492
  if (this.logInfo) this.emit('info', `Set heating threshold temperature: ${value}${this.accessory.temperatureUnit}`);
493
+ await this.melCloudAta.send(this.accountType, this.displayType, deviceData, AirConditioner.EffectiveFlags.SetTemperature);
493
494
  } catch (error) {
494
495
  if (this.logWarn) this.emit('warn', `Set heating threshold temperature error: ${error}`);
495
496
  };
@@ -508,8 +509,8 @@ class DeviceAta extends EventEmitter {
508
509
  deviceData.Device.ProhibitSetTemperature = value;
509
510
  deviceData.Device.ProhibitOperationMode = value;
510
511
  deviceData.Device.ProhibitPower = value;
512
+ if (this.logInfo) this.emit('info', `Set local physical controls: ${value ? 'Lock' : 'Unlock'}`);
511
513
  await this.melCloudAta.send(this.accountType, this.displayType, deviceData, AirConditioner.EffectiveFlags.Prohibit);
512
- if (this.logInfo) this.emit('info', `Set local physical controls: ${value ? 'LOCK' : 'UNLOCK'}`);
513
514
  } catch (error) {
514
515
  if (this.logWarn) this.emit('warn', `Set lock physical controls error: ${error}`);
515
516
  };
@@ -525,8 +526,8 @@ class DeviceAta extends EventEmitter {
525
526
  try {
526
527
  value = [false, true][value];
527
528
  this.accessory.useFahrenheit = value;
528
- this.emit('melCloud', 'UseFahrenheit', value);
529
529
  if (this.logInfo) this.emit('info', `Set temperature display unit: ${TemperatureDisplayUnits[value]}`);
530
+ this.emit('melCloud', 'UseFahrenheit', value);
530
531
  } catch (error) {
531
532
  if (this.logWarn) this.emit('warn', `Set temperature display unit error: ${error}`);
532
533
  };
@@ -579,9 +580,8 @@ class DeviceAta extends EventEmitter {
579
580
  };
580
581
 
581
582
  deviceData.Device.OperationMode = value;
583
+ if (this.logInfo) this.emit('info', `Set operation mode: ${AirConditioner.OperationModeMapEnumToString[value]}`);
582
584
  await this.melCloudAta.send(this.accountType, this.displayType, deviceData, flag);
583
- const operationModeText = AirConditioner.OperationModeMapEnumToString[value];
584
- if (this.logInfo) this.emit('info', `Set operation mode: ${operationModeText}`);
585
585
  } catch (error) {
586
586
  if (this.logWarn) this.emit('warn', `Set operation mode error: ${error}`);
587
587
  };
@@ -604,8 +604,8 @@ class DeviceAta extends EventEmitter {
604
604
  .onSet(async (value) => {
605
605
  try {
606
606
  deviceData.Device.SetTemperature = value;
607
- await this.melCloudAta.send(this.accountType, this.displayType, deviceData, AirConditioner.EffectiveFlags.SetTemperature);
608
607
  if (this.logInfo) this.emit('info', `Set temperature: ${value}${this.accessory.temperatureUnit}`);
608
+ await this.melCloudAta.send(this.accountType, this.displayType, deviceData, AirConditioner.EffectiveFlags.SetTemperature);
609
609
  } catch (error) {
610
610
  if (this.logWarn) this.emit('warn', `Set temperature error: ${error}`);
611
611
  };
@@ -619,10 +619,10 @@ class DeviceAta extends EventEmitter {
619
619
  if (this.account.type === 'melcloudhome') return;
620
620
 
621
621
  try {
622
- value = [false, true][value];
622
+ value = value ? true : false;
623
623
  this.accessory.useFahrenheit = value;
624
- this.emit('melCloud', 'UseFahrenheit', value);
625
624
  if (this.logInfo) this.emit('info', `Set temperature display unit: ${TemperatureDisplayUnits[value]}`);
625
+ this.emit('melCloud', 'UseFahrenheit', value);
626
626
  } catch (error) {
627
627
  if (this.logWarn) this.emit('warn', `Set temperature display unit error: ${error}`);
628
628
  };
@@ -725,8 +725,8 @@ class DeviceAta extends EventEmitter {
725
725
  .onSet(async (state) => {
726
726
  try {
727
727
  deviceData.FrostProtection.Enabled = state;
728
+ if (this.logInfo) this.emit('info', `Frost protection: ${state ? 'Enable' : 'Disable'}`);
728
729
  await this.melCloudAta.send(this.accountType, this.displayType, deviceData, 'frostprotection');
729
- if (this.logInfo) this.emit('info', `Frost protection: ${state ? 'Enabled' : 'Disabled'}`);
730
730
  } catch (error) {
731
731
  if (this.logWarn) this.emit('warn', `Set frost protection error: ${error}`);
732
732
  };
@@ -772,8 +772,8 @@ class DeviceAta extends EventEmitter {
772
772
  .onSet(async (state) => {
773
773
  try {
774
774
  deviceData.OverheatProtection.Enabled = state;
775
+ if (this.logInfo) this.emit('info', `Overheat protection: ${state ? 'Enable' : 'Disable'}`);
775
776
  await this.melCloudAta.send(this.accountType, this.displayType, deviceData, 'overheatprotection');
776
- if (this.logInfo) this.emit('info', `Overheat protection: ${state ? 'Enabled' : 'Disabled'}`);
777
777
  } catch (error) {
778
778
  if (this.logWarn) this.emit('warn', `Set overheat protection error: ${error}`);
779
779
  };
@@ -818,8 +818,8 @@ class DeviceAta extends EventEmitter {
818
818
  .onSet(async (state) => {
819
819
  try {
820
820
  deviceData.HolidayMode.Enabled = state;
821
+ if (this.logInfo) this.emit('info', `Holiday mode: ${state ? 'Enable' : 'Disable'}`);
821
822
  await this.melCloudAta.send(this.accountType, this.displayType, deviceData, 'holidaymode');
822
- if (this.logInfo) this.emit('info', `Holiday mode: ${state ? 'Enabled' : 'Disabled'}`);
823
823
  } catch (error) {
824
824
  if (this.logWarn) this.emit('warn', `Set holiday mode error: ${error}`);
825
825
  };
@@ -900,8 +900,8 @@ class DeviceAta extends EventEmitter {
900
900
  break;
901
901
  };
902
902
 
903
+ if (this.logInfo) this.emit('info', `Preset ${name}: ${state ? 'Set:' : 'Unset:'}`);
903
904
  await this.melCloudAta.send(this.accountType, this.displayType, deviceData, AirConditioner.EffectiveFlags.Presets);
904
- if (this.logInfo) this.emit('info', `Preset ${name}: ${state ? 'Set:' : 'Unset:'} ${name}`);
905
905
  } catch (error) {
906
906
  if (this.logWarn) this.emit('warn', `Set preset error: ${error}`);
907
907
  };
@@ -957,10 +957,10 @@ class DeviceAta extends EventEmitter {
957
957
  .onSet(async (state) => {
958
958
  try {
959
959
  deviceData.ScheduleEnabled = state;
960
+ if (this.logInfo) this.emit('info', `Schedules: ${state ? 'Enable' : 'Disable'}`);
960
961
  await this.melCloudAta.send(this.accountType, this.displayType, deviceData, 'schedule');
961
- if (this.logInfo) this.emit('info', `Schedule ${name}: ${state ? 'Enabled' : 'Disabled'}`);
962
962
  } catch (error) {
963
- if (this.logWarn) this.emit('warn', `Set schedule error: ${error}`);
963
+ if (this.logWarn) this.emit('warn', `Set schedules error: ${error}`);
964
964
  };
965
965
  });
966
966
  accessory.addService(this.scheduleControlService);
@@ -1026,8 +1026,8 @@ class DeviceAta extends EventEmitter {
1026
1026
  .onSet(async (state) => {
1027
1027
  try {
1028
1028
  sceneData.Enabled = state;
1029
+ if (this.logInfo) this.emit('info', `Scene ${name}: ${state ? 'Enable' : 'Disable'}`);
1029
1030
  await this.melCloudAta.send(this.accountType, this.displayType, deviceData, 'scene', sceneData);
1030
- if (this.logInfo) this.emit('info', `Scene ${name}: ${state ? 'Enabled' : 'Disabled'}`);
1031
1031
  } catch (error) {
1032
1032
  if (this.logWarn) this.emit('warn', `Set scene error: ${error}`);
1033
1033
  };
@@ -1281,8 +1281,8 @@ class DeviceAta extends EventEmitter {
1281
1281
  break;
1282
1282
  };
1283
1283
 
1284
- await this.melCloudAta.send(this.accountType, this.displayType, deviceData, flag);
1285
1284
  if (this.logInfo) this.emit('info', `${state ? `Set: ${name}` : `Unset: ${name}, Set: ${button.previousValue}`}`);
1285
+ await this.melCloudAta.send(this.accountType, this.displayType, deviceData, flag);
1286
1286
  } catch (error) {
1287
1287
  if (this.logWarn) this.emit('warn', `Set button error: ${error}`);
1288
1288
  };
package/src/deviceatw.js CHANGED
@@ -357,8 +357,8 @@ class DeviceAtw extends EventEmitter {
357
357
  switch (i) {
358
358
  case 0: //Heat Pump
359
359
  deviceData.Device.Power = state ? true : false;
360
- await this.melCloudAtw.send(this.accountType, this.displayType, deviceData, HeatPump.EffectiveFlags.Power);
361
360
  if (this.logInfo) this.emit('info', `${zoneName}, Set power: ${state ? 'On' : 'Off'}`);
361
+ await this.melCloudAtw.send(this.accountType, this.displayType, deviceData, HeatPump.EffectiveFlags.Power);
362
362
  break;
363
363
  };
364
364
  } catch (error) {
@@ -457,8 +457,8 @@ class DeviceAtw extends EventEmitter {
457
457
  break;
458
458
  };
459
459
 
460
- await this.melCloudAtw.send(this.accountType, this.displayType, deviceData, flag);
461
460
  if (this.logInfo) this.emit('info', `${zoneName}, Set operation mode: ${operationModeText}`);
461
+ await this.melCloudAtw.send(this.accountType, this.displayType, deviceData, flag);
462
462
  } catch (error) {
463
463
  if (this.logWarn) this.emit('warn', `${zoneName}, Set operation mode error: ${error}`);
464
464
  };
@@ -531,8 +531,8 @@ class DeviceAtw extends EventEmitter {
531
531
  break;
532
532
  };
533
533
 
534
- if (i > 0) await this.melCloudAtw.send(this.accountType, this.displayType, deviceData, flag);
535
534
  if (this.logInfo && i !== 0) this.emit('info', `${zoneName}, Set cooling threshold temperature: ${value}${this.accessory.temperatureUnit}`);
535
+ if (i > 0) await this.melCloudAtw.send(this.accountType, this.displayType, deviceData, flag);
536
536
  } catch (error) {
537
537
  if (this.logWarn) this.emit('warn', `${zoneName}, Set cooling threshold temperature error: ${error}`);
538
538
  };
@@ -596,8 +596,8 @@ class DeviceAtw extends EventEmitter {
596
596
  break;
597
597
  };
598
598
 
599
- if (i > 0) await this.melCloudAtw.send(this.accountType, this.displayType, deviceData, flag);
600
599
  if (this.logInfo && i !== 0) this.emit('info', `${zoneName}, Set heating threshold temperature: ${value}${this.accessory.temperatureUnit}`);
600
+ if (i > 0) await this.melCloudAtw.send(this.accountType, this.displayType, deviceData, flag);
601
601
  } catch (error) {
602
602
  if (this.logWarn) this.emit('warn', `${zoneName}, Set heating threshold temperature error: ${error}`);
603
603
  };
@@ -634,8 +634,8 @@ class DeviceAtw extends EventEmitter {
634
634
  break;
635
635
  };
636
636
 
637
+ if (this.logInfo) this.emit('info', `${zoneName}, Set lock physical controls: ${value ? 'Lock' : 'Unlock'}`);
637
638
  await this.melCloudAtw.send(this.accountType, this.displayType, deviceData);
638
- if (this.logInfo) this.emit('info', `${zoneName}, Set lock physical controls: ${value ? 'LOCK' : 'UNLOCK'}`);
639
639
  } catch (error) {
640
640
  if (this.logWarn) this.emit('warn', `${zoneName}, Set lock physical controls error: ${error}`);
641
641
  };
@@ -651,8 +651,8 @@ class DeviceAtw extends EventEmitter {
651
651
  try {
652
652
  value = [false, true][value];
653
653
  this.accessory.useFahrenheit = value;
654
- this.emit('melCloud', 'UseFahrenheit', value);
655
654
  if (this.logInfo) this.emit('info', `Set temperature display unit: ${TemperatureDisplayUnits[value]}`);
655
+ this.emit('melCloud', 'UseFahrenheit', value);
656
656
  } catch (error) {
657
657
  if (this.logWarn) this.emit('warn', `Set temperature display unit error: ${error}`);
658
658
  };
@@ -772,8 +772,8 @@ class DeviceAtw extends EventEmitter {
772
772
  break;
773
773
  };
774
774
 
775
- await this.melCloudAtw.send(this.accountType, this.displayType, deviceData, flag);
776
775
  if (this.logInfo) this.emit('info', `${zoneName}, Set operation mode: ${operationModeText}`);
776
+ await this.melCloudAtw.send(this.accountType, this.displayType, deviceData, flag);
777
777
  } catch (error) {
778
778
  if (this.logWarn) this.emit('warn', `${zoneName}, Set operation mode error: ${error}`);
779
779
  };
@@ -820,8 +820,8 @@ class DeviceAtw extends EventEmitter {
820
820
  break;
821
821
  };
822
822
 
823
- if (i > 0) await this.melCloudAtw.send(this.accountType, this.displayType, deviceData, flag);
824
823
  if (this.logInfo && i !== 0) this.emit('info', `${zoneName}, Set temperature: ${value}${this.accessory.temperatureUnit}`);
824
+ if (i > 0) await this.melCloudAtw.send(this.accountType, this.displayType, deviceData, flag);
825
825
  } catch (error) {
826
826
  if (this.logWarn) this.emit('warn', `${zoneName}, Set temperature error: ${error}`);
827
827
  };
@@ -835,10 +835,10 @@ class DeviceAtw extends EventEmitter {
835
835
  if (this.account.type === 'melcloudhome') return;
836
836
 
837
837
  try {
838
- value = [false, true][value];
838
+ value = value ? true : false;
839
839
  this.accessory.useFahrenheit = value;
840
- this.emit('melCloud', 'UseFahrenheit', value);
841
840
  if (this.logInfo) this.emit('info', `Set temperature display unit: ${TemperatureDisplayUnits[value]}`);
841
+ this.emit('melCloud', 'UseFahrenheit', value);
842
842
  } catch (error) {
843
843
  if (this.logWarn) this.emit('warn', `Set temperature display unit error: ${error}`);
844
844
  };
@@ -1137,8 +1137,8 @@ class DeviceAtw extends EventEmitter {
1137
1137
  .onSet(async (state) => {
1138
1138
  try {
1139
1139
  deviceData.HolidayMode.Enabled = state;
1140
- await this.melCloudAta.send(this.accountType, this.displayType, deviceData, 'holidaymode');
1141
- if (this.logInfo) this.emit('info', `Holiday mode: ${state ? 'Enabled' : 'Disabled'}`);
1140
+ if (this.logInfo) this.emit('info', `Holiday mode: ${state ? 'Enable' : 'Disable'}`);
1141
+ await this.melCloudAtw.send(this.accountType, this.displayType, deviceData, 'holidaymode');
1142
1142
  } catch (error) {
1143
1143
  if (this.logWarn) this.emit('warn', `Set holiday mode error: ${error}`);
1144
1144
  };
@@ -1219,8 +1219,8 @@ class DeviceAtw extends EventEmitter {
1219
1219
  break;
1220
1220
  };
1221
1221
 
1222
- await this.melCloudAta.send(this.accountType, this.displayType, deviceData, AirConditioner.EffectiveFlags.Presets);
1223
- if (this.logInfo) this.emit('info', `Preset ${name}: ${state ? 'Set:' : 'Unset:'} ${name}`);
1222
+ if (this.logInfo) this.emit('info', `Preset ${name}: ${state ? 'Set:' : 'Unset:'}`);
1223
+ await this.melCloudAtw.send(this.accountType, this.displayType, deviceData, AirConditioner.EffectiveFlags.Presets);
1224
1224
  } catch (error) {
1225
1225
  if (this.logWarn) this.emit('warn', `Set preset error: ${error}`);
1226
1226
  };
@@ -1276,10 +1276,10 @@ class DeviceAtw extends EventEmitter {
1276
1276
  .onSet(async (state) => {
1277
1277
  try {
1278
1278
  deviceData.ScheduleEnabled = state;
1279
- await this.melCloudAta.send(this.accountType, this.displayType, deviceData, 'schedule');
1280
- if (this.logInfo) this.emit('info', `Schedule ${name}: ${state ? 'Enabled' : 'Disabled'}`);
1279
+ if (this.logInfo) this.emit('info', `Schedules: ${state ? 'Enable' : 'Disable'}`);
1280
+ await this.melCloudAtw.send(this.accountType, this.displayType, deviceData, 'schedule');
1281
1281
  } catch (error) {
1282
- if (this.logWarn) this.emit('warn', `Set schedule error: ${error}`);
1282
+ if (this.logWarn) this.emit('warn', `Set schedules error: ${error}`);
1283
1283
  };
1284
1284
  });
1285
1285
  accessory.addService(this.scheduleControlService);
@@ -1345,8 +1345,8 @@ class DeviceAtw extends EventEmitter {
1345
1345
  .onSet(async (state) => {
1346
1346
  try {
1347
1347
  sceneData.Enabled = state;
1348
- await this.melCloudAta.send(this.accountType, this.displayType, deviceData, 'scene', sceneData);
1349
- if (this.logInfo) this.emit('info', `Scene ${name}: ${state ? 'Enabled' : 'Disabled'}`);
1348
+ if (this.logInfo) this.emit('info', `Scene ${name}: ${state ? 'Enable' : 'Disable'}`);
1349
+ await this.melCloudAtw.send(this.accountType, this.displayType, deviceData, 'scene', sceneData);
1350
1350
  } catch (error) {
1351
1351
  if (this.logWarn) this.emit('warn', `Set scene error: ${error}`);
1352
1352
  };
@@ -1534,8 +1534,8 @@ class DeviceAtw extends EventEmitter {
1534
1534
  break;
1535
1535
  };
1536
1536
 
1537
- await this.melCloudAtw.send(this.accountType, this.displayType, deviceData, flag);
1538
1537
  if (this.logInfo) this.emit('info', `${state ? `Set: ${name}` : `Unset: ${name}, Set: ${button.previousValue}`}`);
1538
+ await this.melCloudAtw.send(this.accountType, this.displayType, deviceData, flag);
1539
1539
  } catch (error) {
1540
1540
  if (this.logWarn) this.emit('warn', `Set button error: ${error}`);
1541
1541
  };
package/src/deviceerv.js CHANGED
@@ -320,8 +320,8 @@ class DeviceErv extends EventEmitter {
320
320
  .onSet(async (state) => {
321
321
  try {
322
322
  deviceData.Device.Power = state ? true : false;
323
- await this.melCloudErv.send(this.accountType, this.displayType, deviceData, Ventilation.EffectiveFlags.Power);
324
323
  if (this.logInfo) this.emit('info', `Set power: ${state ? 'On' : 'Off'}`);
324
+ await this.melCloudErv.send(this.accountType, this.displayType, deviceData, Ventilation.EffectiveFlags.Power);
325
325
  } catch (error) {
326
326
  if (this.logWarn) this.emit('warn', `Set power error: ${error}`);
327
327
  };
@@ -355,9 +355,8 @@ class DeviceErv extends EventEmitter {
355
355
  break;
356
356
  };
357
357
 
358
+ if (this.logInfo) this.emit('info', `Set operation mode: ${Ventilation.VentilationModeMapEnumToString[deviceData.Device.VentilationMode]}`);
358
359
  await this.melCloudErv.send(this.accountType, this.displayType, deviceData, Ventilation.EffectiveFlags.VentilationMode);
359
- const operationModeText = Ventilation.VentilationModeMapEnumToString[deviceData.Device.VentilationMode];
360
- if (this.logInfo) this.emit('info', `Set operation mode: ${operationModeText}`);
361
360
  } catch (error) {
362
361
  if (this.logWarn) this.emit('warn', `Set operation mode error: ${error}`);
363
362
  };
@@ -395,9 +394,9 @@ class DeviceErv extends EventEmitter {
395
394
  break;;
396
395
  };
397
396
 
398
- deviceData.Device.SetFanSpeed = value
399
- await this.melCloudErv.send(this.accountType, this.displayType, deviceData, Ventilation.EffectiveFlags.SetFanSpeed);
397
+ deviceData.Device.SetFanSpeed = value;
400
398
  if (this.logInfo) this.emit('info', `Set fan speed mode: ${Ventilation.FanSpeedMapEnumToString[value]}`);
399
+ await this.melCloudErv.send(this.accountType, this.displayType, deviceData, Ventilation.EffectiveFlags.SetFanSpeed);
401
400
  } catch (error) {
402
401
  if (this.logWarn) this.emit('warn', `Set fan speed mode error: ${error}`);
403
402
  };
@@ -418,8 +417,8 @@ class DeviceErv extends EventEmitter {
418
417
  .onSet(async (value) => {
419
418
  try {
420
419
  deviceData.Device.DefaultCoolingSetTemperature = value;
421
- await this.melCloudErv.send(this.accountType, this.displayType, deviceData, Ventilation.EffectiveFlags.SetTemperature);
422
420
  if (this.logInfo) this.emit('info', `Set cooling threshold temperature: ${value}${this.accessory.temperatureUnit}`);
421
+ await this.melCloudErv.send(this.accountType, this.displayType, deviceData, Ventilation.EffectiveFlags.SetTemperature);
423
422
  } catch (error) {
424
423
  if (this.logWarn) this.emit('warn', `Set cooling threshold temperature error: ${error}`);
425
424
  };
@@ -440,29 +439,13 @@ class DeviceErv extends EventEmitter {
440
439
  .onSet(async (value) => {
441
440
  try {
442
441
  deviceData.Device.DefaultHeatingSetTemperature = value;
443
- await this.melCloudErv.send(this.accountType, this.displayType, deviceData, Ventilation.EffectiveFlags.SetTemperature);
444
442
  if (this.logInfo) this.emit('info', `Set heating threshold temperature: ${value}${this.accessory.temperatureUnit}`);
443
+ await this.melCloudErv.send(this.accountType, this.displayType, deviceData, Ventilation.EffectiveFlags.SetTemperature);
445
444
  } catch (error) {
446
445
  if (this.logWarn) this.emit('warn', `Set heating threshold temperature error: ${error}`);
447
446
  };
448
447
  });
449
448
  };
450
- //this.melCloudService.getCharacteristic(Characteristic.LockPhysicalControls)
451
- // .onGet(async () => {
452
- // const value = this.accessory.lockPhysicalControl;
453
- // if (this.logInfo) this.emit('info', `Lock physical controls: ${value ? 'LOCKED' : 'UNLOCKED'}`);
454
- // return value;
455
- // })
456
- // .onSet(async (value) => {
457
- // try {
458
- // value = value ? true : false;
459
- // deviceData.Device = deviceData.Device;
460
- // await this.melCloudErv.send(this.accountType, this.displayType, deviceData, Ventilation.EffectiveFlags.Prohibit);
461
- // if (this.logInfo) this.emit('info', `Set local physical controls: ${value ? 'LOCK' : 'UNLOCK'}`);
462
- // } catch (error) {
463
- // if (this.logWarn) this.emit('warn', `Set lock physical controls error: ${error}`);
464
- // };
465
- // });
466
449
  this.melCloudService.getCharacteristic(Characteristic.TemperatureDisplayUnits)
467
450
  .onGet(async () => {
468
451
  const value = this.accessory.useFahrenheit;
@@ -474,8 +457,8 @@ class DeviceErv extends EventEmitter {
474
457
  try {
475
458
  value = [false, true][value];
476
459
  this.accessory.useFahrenheit = value;
477
- this.emit('melCloud', 'UseFahrenheit', value);
478
460
  if (this.logInfo) this.emit('info', `Set temperature display unit: ${TemperatureDisplayUnits[value]}`);
461
+ this.emit('melCloud', 'UseFahrenheit', value);
479
462
  } catch (error) {
480
463
  if (this.logWarn) this.emit('warn', `Set temperature display unit error: ${error}`);
481
464
  };
@@ -526,9 +509,8 @@ class DeviceErv extends EventEmitter {
526
509
  break;
527
510
  };
528
511
 
512
+ if (this.logInfo) this.emit('info', `Set operation mode: ${Ventilation.VentilationModeMapEnumToString[deviceData.Device.VentilationMode]}`);
529
513
  await this.melCloudErv.send(this.accountType, this.displayType, deviceData, flag);
530
- const operationModeText = Ventilation.VentilationModeMapEnumToString[deviceData.Device.VentilationMode];
531
- if (this.logInfo) this.emit('info', `Set operation mode: ${operationModeText}`);
532
514
  } catch (error) {
533
515
  if (this.logWarn) this.emit('warn', `Set operation mode error: ${error}`);
534
516
  };
@@ -551,8 +533,8 @@ class DeviceErv extends EventEmitter {
551
533
  .onSet(async (value) => {
552
534
  try {
553
535
  deviceData.Device.SetTemperature = value;
554
- await this.melCloudErv.send(this.accountType, this.displayType, deviceData, Ventilation.EffectiveFlags.SetTemperature);
555
536
  if (this.logInfo) this.emit('info', `Set temperature: ${value}${this.accessory.temperatureUnit}`);
537
+ await this.melCloudErv.send(this.accountType, this.displayType, deviceData, Ventilation.EffectiveFlags.SetTemperature);
556
538
  } catch (error) {
557
539
  if (this.logWarn) this.emit('warn', `Set temperature error: ${error}`);
558
540
  };
@@ -568,8 +550,8 @@ class DeviceErv extends EventEmitter {
568
550
  try {
569
551
  value = [false, true][value];
570
552
  this.accessory.useFahrenheit = value;
571
- this.emit('melCloud', 'UseFahrenheit', value);
572
553
  if (this.logInfo) this.emit('info', `Set temperature display unit: ${TemperatureDisplayUnits[value]}`);
554
+ this.emit('melCloud', 'UseFahrenheit', value);
573
555
  } catch (error) {
574
556
  if (this.logWarn) this.emit('warn', `Set temperature display unit error: ${error}`);
575
557
  };
@@ -759,8 +741,8 @@ class DeviceErv extends EventEmitter {
759
741
  .onSet(async (state) => {
760
742
  try {
761
743
  deviceData.HolidayMode.Enabled = state;
762
- await this.melCloudAta.send(this.accountType, this.displayType, deviceData, 'holidaymode');
763
- if (this.logInfo) this.emit('info', `Holiday mode: ${state ? 'Enabled' : 'Disabled'}`);
744
+ if (this.logInfo) this.emit('info', `Holiday mode: ${state ? 'Enable' : 'Disable'}`);
745
+ await this.melCloudErv.send(this.accountType, this.displayType, deviceData, 'holidaymode');
764
746
  } catch (error) {
765
747
  if (this.logWarn) this.emit('warn', `Set holiday mode error: ${error}`);
766
748
  };
@@ -841,8 +823,8 @@ class DeviceErv extends EventEmitter {
841
823
  break;
842
824
  };
843
825
 
844
- await this.melCloudAta.send(this.accountType, this.displayType, deviceData, AirConditioner.EffectiveFlags.Presets);
845
- if (this.logInfo) this.emit('info', `Preset ${name}: ${state ? 'Set:' : 'Unset:'} ${name}`);
826
+ if (this.logInfo) this.emit('info', `Preset ${name}: ${state ? 'Set:' : 'Unset:'}`);
827
+ await this.melCloudErv.send(this.accountType, this.displayType, deviceData, AirConditioner.EffectiveFlags.Presets);
846
828
  } catch (error) {
847
829
  if (this.logWarn) this.emit('warn', `Set preset error: ${error}`);
848
830
  };
@@ -898,10 +880,10 @@ class DeviceErv extends EventEmitter {
898
880
  .onSet(async (state) => {
899
881
  try {
900
882
  deviceData.ScheduleEnabled = state;
901
- await this.melCloudAta.send(this.accountType, this.displayType, deviceData, 'schedule');
902
- if (this.logInfo) this.emit('info', `Schedule ${name}: ${state ? 'Enabled' : 'Disabled'}`);
883
+ if (this.logInfo) this.emit('info', `Schedules: ${state ? 'Enable' : 'Disable'}`);
884
+ await this.melCloudErv.send(this.accountType, this.displayType, deviceData, 'schedule');
903
885
  } catch (error) {
904
- if (this.logWarn) this.emit('warn', `Set schedule error: ${error}`);
886
+ if (this.logWarn) this.emit('warn', `Set schedule serror: ${error}`);
905
887
  };
906
888
  });
907
889
  accessory.addService(this.scheduleControlService);
@@ -967,8 +949,8 @@ class DeviceErv extends EventEmitter {
967
949
  .onSet(async (state) => {
968
950
  try {
969
951
  sceneData.Enabled = state;
970
- await this.melCloudAta.send(this.accountType, this.displayType, deviceData, 'scene', sceneData);
971
- if (this.logInfo) this.emit('info', `Scene ${name}: ${state ? 'Enabled' : 'Disabled'}`);
952
+ if (this.logInfo) this.emit('info', `Scene ${name}: ${state ? 'Enable' : 'Disable'}`);
953
+ await this.melCloudErv.send(this.accountType, this.displayType, deviceData, 'scene', sceneData);
972
954
  } catch (error) {
973
955
  if (this.logWarn) this.emit('warn', `Set scene error: ${error}`);
974
956
  };
@@ -1095,8 +1077,8 @@ class DeviceErv extends EventEmitter {
1095
1077
  break;
1096
1078
  };
1097
1079
 
1098
- await this.melCloudErv.send(this.accountType, this.displayType, deviceData, flag);
1099
1080
  if (this.logInfo) this.emit('info', `${state ? `Set: ${buttonName}` : `Unset: ${buttonName}, Set: ${button.previousValue}`}`);
1081
+ await this.melCloudErv.send(this.accountType, this.displayType, deviceData, flag);
1100
1082
  } catch (error) {
1101
1083
  if (this.logWarn) this.emit('warn', `Set button error: ${error}`);
1102
1084
  };