homebridge-melcloud-control 4.4.0-beta.1 → 4.4.0-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.4.0-beta.1",
4
+ "version": "4.4.0-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
@@ -758,8 +758,9 @@ class DeviceAta extends EventEmitter {
758
758
  })
759
759
  .onSet(async (value) => {
760
760
  try {
761
- deviceData.FrostProtection.Max = value;
762
- if (this.logInfo) this.emit('info', `Set frost protection max. temperature: ${value}${this.accessory.temperatureUnit}`);
761
+ let { min, max } = await this.functions.normalizeFrostProtection(deviceData.FrostProtection.Min, value);
762
+ deviceData.FrostProtection.Max = max;
763
+ if (this.logInfo) this.emit('info', `Set frost protection max. temperature: ${max}${this.accessory.temperatureUnit}`);
763
764
  await this.melCloudAta.send(this.accountType, this.displayType, deviceData, 'frostprotection');
764
765
  } catch (error) {
765
766
  if (this.logWarn) this.emit('warn', `Set frost protection max. temperature error: ${error}`);
@@ -777,8 +778,10 @@ class DeviceAta extends EventEmitter {
777
778
  })
778
779
  .onSet(async (value) => {
779
780
  try {
780
- deviceData.FrostProtection.Min = value;
781
- if (this.logInfo) this.emit('info', `Set frost protection min. temperature: ${value}${this.accessory.temperatureUnit}`);
781
+ let { min, max } = await this.functions.normalizeFrostProtection(value, deviceData.FrostProtection.Max);
782
+ deviceData.FrostProtection.Min = min;
783
+ ;
784
+ if (this.logInfo) this.emit('info', `Set frost protection min. temperature: ${min}${this.accessory.temperatureUnit}`);
782
785
  await this.melCloudAta.send(this.accountType, this.displayType, deviceData, 'frostprotection');
783
786
  } catch (error) {
784
787
  if (this.logWarn) this.emit('warn', `Set frost protection min. temperature error: ${error}`);
@@ -873,8 +876,9 @@ class DeviceAta extends EventEmitter {
873
876
  })
874
877
  .onSet(async (value) => {
875
878
  try {
876
- deviceData.OverheatProtection.Max = value;
877
- if (this.logInfo) this.emit('info', `Set overheat protection max. temperature: ${value}${this.accessory.temperatureUnit}`);
879
+ let { min, max } = await this.functions.normalizeOverheatProtection(deviceData.OverheatProtection.Min, value);
880
+ deviceData.OverheatProtection.Max = max;
881
+ if (this.logInfo) this.emit('info', `Set overheat protection max. temperature: ${max}${this.accessory.temperatureUnit}`);
878
882
  await this.melCloudAta.send(this.accountType, this.displayType, deviceData, 'overheatprotection');
879
883
  } catch (error) {
880
884
  if (this.logWarn) this.emit('warn', `Set overheat protection max. temperature error: ${error}`);
@@ -892,8 +896,9 @@ class DeviceAta extends EventEmitter {
892
896
  })
893
897
  .onSet(async (value) => {
894
898
  try {
895
- deviceData.OverheatProtection.Min = value;
896
- if (this.logInfo) this.emit('info', `Set overheat protection min. temperature: ${value}${this.accessory.temperatureUnit}`);
899
+ let { min, max } = await this.functions.normalizeOverheatProtection(value, deviceData.OverheatProtection.Max);
900
+ deviceData.OverheatProtection.Min = min;
901
+ if (this.logInfo) this.emit('info', `Set overheat protection min. temperature: ${min}${this.accessory.temperatureUnit}`);
897
902
  await this.melCloudAta.send(this.accountType, this.displayType, deviceData, 'overheatprotection');
898
903
  } catch (error) {
899
904
  if (this.logWarn) this.emit('warn', `Set overheat protection min. temperature error: ${error}`);
@@ -1767,7 +1772,7 @@ class DeviceAta extends EventEmitter {
1767
1772
  if (this.frostProtectionSupport && frostProtection.Enabled !== null) {
1768
1773
  this.frostProtectionControlService?.updateCharacteristic(Characteristic.Active, frostProtection.Enabled);
1769
1774
  this.frostProtectionControlService?.updateCharacteristic(Characteristic.CurrentHeaterCoolerState, frostProtection.Active ? 2 : 1);
1770
- this.frostProtectionControlService?.updateCharacteristic(Characteristic.TargetHeaterCoolerState, frostProtection.Active ? 2 : 1);
1775
+ this.frostProtectionControlService?.updateCharacteristic(Characteristic.TargetHeaterCoolerState, 0);
1771
1776
  this.frostProtectionControlService?.updateCharacteristic(Characteristic.CurrentTemperature, roomTemperature);
1772
1777
  this.frostProtectionControlService?.updateCharacteristic(Characteristic.CoolingThresholdTemperature, frostProtection.Max);
1773
1778
  this.frostProtectionControlService?.updateCharacteristic(Characteristic.HeatingThresholdTemperature, frostProtection.Min);
@@ -1779,7 +1784,7 @@ class DeviceAta extends EventEmitter {
1779
1784
  if (this.overheatProtectionSupport && overheatProtection.Enabled !== null) {
1780
1785
  this.overheatProtectionControlService?.updateCharacteristic(Characteristic.Active, overheatProtection.Enabled);
1781
1786
  this.overheatProtectionControlService?.updateCharacteristic(Characteristic.CurrentHeaterCoolerState, overheatProtection.Active ? 2 : 1);
1782
- this.overheatProtectionControlService?.updateCharacteristic(Characteristic.TargetHeaterCoolerState, overheatProtection.Active ? 2 : 1);
1787
+ this.overheatProtectionControlService?.updateCharacteristic(Characteristic.TargetHeaterCoolerState, 0);
1783
1788
  this.overheatProtectionControlService?.updateCharacteristic(Characteristic.CurrentTemperature, roomTemperature);
1784
1789
  this.overheatProtectionControlService?.updateCharacteristic(Characteristic.CoolingThresholdTemperature, overheatProtection.Max);
1785
1790
  this.overheatProtectionControlService?.updateCharacteristic(Characteristic.HeatingThresholdTemperature, overheatProtection.Min);
@@ -240,22 +240,20 @@ class MelCloudAta extends EventEmitter {
240
240
  case "melcloudhome":
241
241
  switch (flag) {
242
242
  case 'frostprotection':
243
- let { frostMin, frostMax } = await this.functions.normalizeFrostProtection(deviceData.FrostProtection.Min, deviceData.FrostProtection.Max);
244
243
  payload = {
245
244
  enabled: deviceData.FrostProtection.Enabled,
246
- min: frostMin,
247
- max: frostMax,
245
+ min: deviceData.FrostProtection.Min,
246
+ max: deviceData.FrostProtection.Max,
248
247
  units: { ATA: [deviceData.DeviceID] }
249
248
  };
250
249
  method = 'POST';
251
250
  path = ApiUrlsHome.PostProtectionFrost;
252
251
  break;
253
252
  case 'overheatprotection':
254
- let { overMin, overMax } = await this.functions.normalizeOverheatProtection(deviceData.OverheatProtection.Min, deviceData.OverheatProtection.Max);
255
253
  payload = {
256
254
  enabled: deviceData.OverheatProtection.Enabled,
257
- min: overMin,
258
- max: overMax,
255
+ min: deviceData.OverheatProtection.Min,
256
+ max: deviceData.OverheatProtection.Max,
259
257
  units: { ATA: [deviceData.DeviceID] }
260
258
  };
261
259
  method = 'POST';