homebridge-melcloud-control 4.0.0-beta.120 → 4.0.0-beta.121

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/deviceata.js +26 -26
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "displayName": "MELCloud Control",
3
3
  "name": "homebridge-melcloud-control",
4
- "version": "4.0.0-beta.120",
4
+ "version": "4.0.0-beta.121",
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
@@ -353,27 +353,27 @@ class DeviceAta extends EventEmitter {
353
353
  .onSet(async (value) => {
354
354
  try {
355
355
  let fanSpeedModeText = '';
356
- const key = this.accountType === 'melcloud' ? 'FanSpeed' : 'SetFanSpeed';
356
+ const fanKey = this.accountType === 'melcloud' ? 'FanSpeed' : 'SetFanSpeed';
357
357
  switch (numberOfFanSpeeds) {
358
358
  case 2: //Fan speed mode 2
359
359
  fanSpeedModeText = hasAutomaticFanSpeed ? [7, 1, 2, 0][value] : [7, 1, 2][value];
360
- deviceData.Device[key] = hasAutomaticFanSpeed ? [0, 1, 2, 0][value] : [1, 1, 2][value];
360
+ deviceData.Device[fanKey] = hasAutomaticFanSpeed ? [0, 1, 2, 0][value] : [1, 1, 2][value];
361
361
  break;
362
362
  case 3: //Fan speed mode 3
363
363
  fanSpeedModeText = hasAutomaticFanSpeed ? [7, 1, 2, 3, 0][value] : [7, 1, 2, 3][value];
364
- deviceData.Device[key] = hasAutomaticFanSpeed ? [0, 1, 2, 3, 0][value] : [1, 1, 2, 3][value];
364
+ deviceData.Device[fanKey] = hasAutomaticFanSpeed ? [0, 1, 2, 3, 0][value] : [1, 1, 2, 3][value];
365
365
  break;
366
366
  case 4: //Fan speed mode 4
367
367
  fanSpeedModeText = hasAutomaticFanSpeed ? [7, 1, 2, 3, 4, 0][value] : [7, 1, 2, 3, 4][value];
368
- deviceData.Device[key] = hasAutomaticFanSpeed ? [0, 1, 2, 3, 4, 0][value] : [1, 1, 2, 3, 4][value];
368
+ deviceData.Device[fanKey] = hasAutomaticFanSpeed ? [0, 1, 2, 3, 4, 0][value] : [1, 1, 2, 3, 4][value];
369
369
  break;
370
370
  case 5: //Fan speed mode 5
371
371
  5; fanSpeedModeText = hasAutomaticFanSpeed ? [7, 1, 2, 3, 4, 5, 0][value] : [7, 1, 2, 3, 4, 5][value];
372
- deviceData.Device[key] = hasAutomaticFanSpeed ? [0, 1, 2, 3, 4, 5, 0][value] : [1, 1, 2, 3, 4, 5][value];
372
+ deviceData.Device[fanKey] = hasAutomaticFanSpeed ? [0, 1, 2, 3, 4, 5, 0][value] : [1, 1, 2, 3, 4, 5][value];
373
373
  break;
374
374
  case 6: //Fan speed mode 6
375
375
  fanSpeedModeText = hasAutomaticFanSpeed ? [7, 1, 2, 3, 4, 5, 6, 0][value] : [7, 1, 2, 3, 4, 5, 6][value];
376
- deviceData.Device[key] = hasAutomaticFanSpeed ? [0, 1, 2, 3, 4, 5, 6, 0][value] : [1, 1, 2, 3, 4, 5, 6][value];
376
+ deviceData.Device[fanKey] = hasAutomaticFanSpeed ? [0, 1, 2, 3, 4, 5, 6, 0][value] : [1, 1, 2, 3, 4, 5, 6][value];
377
377
  break;
378
378
  };
379
379
  deviceData.Device.EffectiveFlags = AirConditioner.EffectiveFlags.SetFanSpeed;
@@ -637,7 +637,7 @@ class DeviceAta extends EventEmitter {
637
637
  })
638
638
  .onSet(async (state) => {
639
639
  try {
640
- const key = this.accountType === 'melcloud' ? 'FanSpeed' : 'SetFanSpeed';
640
+ const fanKey = this.accountType === 'melcloud' ? 'FanSpeed' : 'SetFanSpeed';
641
641
  switch (state) {
642
642
  case true:
643
643
  preset.previousSettings = deviceData.Device;
@@ -646,7 +646,7 @@ class DeviceAta extends EventEmitter {
646
646
  deviceData.Device.SetTemperature = presetData.SetTemperature;
647
647
  deviceData.Device.VaneHorizontalDirection = presetData.VaneHorizontal;
648
648
  deviceData.Device.VaneVerticalDirection = presetData.VaneVertical;
649
- deviceData.Device[key] = presetData[key];
649
+ deviceData.Device[fanKey] = presetData[fanKey];
650
650
  deviceData.Device.EffectiveFlags = AirConditioner.EffectiveFlags.Presets;
651
651
  break;
652
652
  case false:
@@ -655,7 +655,7 @@ class DeviceAta extends EventEmitter {
655
655
  deviceData.Device.SetTemperature = preset.previousSettings.SetTemperature;
656
656
  deviceData.Device.VaneHorizontalDirection = preset.previousSettings.VaneHorizontalDirection;
657
657
  deviceData.Device.VaneVerticalDirection = preset.previousSettings.VaneVerticalDirection;
658
- deviceData.Device[key] = preset.previousSettings[key];
658
+ deviceData.Device[fanKey] = preset.previousSettings[fanKey];
659
659
  deviceData.Device.EffectiveFlags = AirConditioner.EffectiveFlags.Presets;
660
660
  break;
661
661
  };
@@ -837,45 +837,45 @@ class DeviceAta extends EventEmitter {
837
837
  deviceData.HideVaneControls = state;
838
838
  break;
839
839
  case 30: //FAN SPEED MODE AUTO
840
- button.previousValue = state ? deviceData.Device[key] : button.previousValue ?? deviceData.Device[key];
840
+ button.previousValue = state ? deviceData.Device[fanKey] : button.previousValue ?? deviceData.Device[fanKey];
841
841
  deviceData.Device.Power = true;
842
- deviceData.Device[key] = state ? 0 : button.previousValue;
842
+ deviceData.Device[fanKey] = state ? 0 : button.previousValue;
843
843
  deviceData.Device.EffectiveFlags = AirConditioner.EffectiveFlags.PowerSetFanSpeed;
844
844
  break;
845
845
  case 31: //FAN SPEED MODE 1
846
- button.previousValue = state ? deviceData.Device[key] : button.previousValue ?? deviceData.Device[key];
846
+ button.previousValue = state ? deviceData.Device[fanKey] : button.previousValue ?? deviceData.Device[fanKey];
847
847
  deviceData.Device.Power = true;
848
- deviceData.Device[key] = state ? 1 : button.previousValue;
848
+ deviceData.Device[fanKey] = state ? 1 : button.previousValue;
849
849
  deviceData.Device.EffectiveFlags = AirConditioner.EffectiveFlags.PowerSetFanSpeed;
850
850
  break;
851
851
  case 32: //FAN SPEED MODE 2
852
- button.previousValue = state ? deviceData.Device[key] : button.previousValue ?? deviceData.Device[key];
852
+ button.previousValue = state ? deviceData.Device[fanKey] : button.previousValue ?? deviceData.Device[fanKey];
853
853
  deviceData.Device.Power = true;
854
- deviceData.Device[key] = state ? 2 : button.previousValue;
854
+ deviceData.Device[fanKey] = state ? 2 : button.previousValue;
855
855
  deviceData.Device.EffectiveFlags = AirConditioner.EffectiveFlags.PowerSetFanSpeed;
856
856
  break;
857
857
  case 33: //FAN SPEED MODE 3
858
- button.previousValue = state ? deviceData.Device[key] : button.previousValue ?? deviceData.Device[key];
858
+ button.previousValue = state ? deviceData.Device[fanKey] : button.previousValue ?? deviceData.Device[fanKey];
859
859
  deviceData.Device.Power = true;
860
- deviceData.Device[key] = state ? 3 : button.previousValue;
860
+ deviceData.Device[fanKey] = state ? 3 : button.previousValue;
861
861
  deviceData.Device.EffectiveFlags = AirConditioner.EffectiveFlags.PowerSetFanSpeed;
862
862
  break;
863
863
  case 34: //FAN MODE 4
864
- button.previousValue = state ? deviceData.Device[key] : button.previousValue ?? deviceData.Device[key];
864
+ button.previousValue = state ? deviceData.Device[fanKey] : button.previousValue ?? deviceData.Device[fanKey];
865
865
  deviceData.Device.Power = true;
866
- deviceData.Device[key] = state ? 4 : button.previousValue;
866
+ deviceData.Device[fanKey] = state ? 4 : button.previousValue;
867
867
  deviceData.Device.EffectiveFlags = AirConditioner.EffectiveFlags.PowerSetFanSpeed;
868
868
  break;
869
869
  case 35: //FAN SPEED MODE 5
870
- button.previousValue = state ? deviceData.Device[key] : button.previousValue ?? deviceData.Device[key];
870
+ button.previousValue = state ? deviceData.Device[fanKey] : button.previousValue ?? deviceData.Device[fanKey];
871
871
  deviceData.Device.Power = true;
872
- deviceData.Device[key] = state ? 5 : button.previousValue;
872
+ deviceData.Device[fanKey] = state ? 5 : button.previousValue;
873
873
  deviceData.Device.EffectiveFlags = AirConditioner.EffectiveFlags.PowerSetFanSpeed;
874
874
  break;
875
875
  case 36: //FAN SPEED MODE 6
876
- button.previousValue = state ? deviceData.Device[key] : button.previousValue ?? deviceData.Device[key];
876
+ button.previousValue = state ? deviceData.Device[fanKey] : button.previousValue ?? deviceData.Device[fanKey];
877
877
  deviceData.Device.Power = true;
878
- deviceData.Device[key] = state ? 6 : button.previousValue;
878
+ deviceData.Device[fanKey] = state ? 6 : button.previousValue;
879
879
  deviceData.Device.EffectiveFlags = AirConditioner.EffectiveFlags.PowerSetFanSpeed;
880
880
  break;
881
881
  case 37: //PHYSICAL LOCK CONTROLS
@@ -974,7 +974,7 @@ class DeviceAta extends EventEmitter {
974
974
  const maxTempCoolDry = 31;
975
975
 
976
976
  //device state
977
- const key = this.accountType === 'melcloud' ? 'FanSpeed' : 'SetFanSpeed';
977
+ const fanKey = this.accountType === 'melcloud' ? 'FanSpeed' : 'SetFanSpeed';
978
978
  const power = deviceData.Device.Power ?? false;
979
979
  const inStandbyMode = deviceData.Device.InStandbyMode ?? false;
980
980
  const roomTemperature = deviceData.Device.RoomTemperature;
@@ -983,7 +983,7 @@ class DeviceAta extends EventEmitter {
983
983
  const defaultCoolingSetTemperature = deviceData.Device.DefaultCoolingSetTemperature ?? 23;
984
984
  const actualFanSpeed = deviceData.Device.ActualFanSpeed;
985
985
  const automaticFanSpeed = deviceData.Device.AutomaticFanSpeed;
986
- const fanSpeed = deviceData.Device[key];
986
+ const fanSpeed = deviceData.Device[fanKey];
987
987
  const operationMode = deviceData.Device.OperationMode;
988
988
  const vaneVerticalDirection = deviceData.Device.VaneVerticalDirection;
989
989
  const vaneVerticalSwing = deviceData.Device.VaneVerticalSwing;
@@ -1187,7 +1187,7 @@ class DeviceAta extends EventEmitter {
1187
1187
  && presetData.OperationMode === operationMode
1188
1188
  && presetData.VaneHorizontal === vaneHorizontalDirection
1189
1189
  && presetData.VaneVertical === vaneVerticalDirection
1190
- && presetData[key] === fanSpeed) : false;
1190
+ && presetData[fanKey] === fanSpeed) : false;
1191
1191
 
1192
1192
  const characteristicType = preset.characteristicType;
1193
1193
  this.presetsServices?.[i]?.updateCharacteristic(characteristicType, preset.state);