homebridge-melcloud-control 4.3.16-beta.7 → 4.3.16-beta.8

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 +80 -12
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.16-beta.7",
4
+ "version": "4.3.16-beta.8",
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
@@ -710,7 +710,7 @@ class DeviceAta extends EventEmitter {
710
710
  })
711
711
  .onSet(async (state) => {
712
712
  try {
713
- deviceData.FrostProtection.Enabled = state;
713
+ deviceData.FrostProtection.Enabled = state ? true : false;
714
714
  if (this.logInfo) this.emit('info', `Frost protection: ${state ? 'Enabled' : 'Disabled'}`);
715
715
  await this.melCloudAta.send(this.accountType, this.displayType, deviceData, 'frostprotection');
716
716
  } catch (error) {
@@ -734,11 +734,11 @@ class DeviceAta extends EventEmitter {
734
734
  })
735
735
  .onSet(async (value) => {
736
736
  try {
737
- deviceData.Device.FrostProtection.Enabled = true;
737
+ deviceData.FrostProtection.Enabled = true;
738
738
  if (this.logInfo) this.emit('info', `Frost protection: Enabled`);
739
739
  await this.melCloudAta.send(this.accountType, this.displayType, deviceData, 'frostprotection');
740
740
  } catch (error) {
741
- if (this.logWarn) this.emit('warn', `Set operation mode error: ${error}`);
741
+ if (this.logWarn) this.emit('warn', `Set frost protection error: ${error}`);
742
742
  };
743
743
  });
744
744
  frostProtectionControlService.getCharacteristic(Characteristic.CurrentTemperature)
@@ -746,7 +746,7 @@ class DeviceAta extends EventEmitter {
746
746
  const value = this.accessory.roomTemperature;
747
747
  return value;
748
748
  });
749
- frostProtectionControlService.getCharacteristic(Characteristic.CoolingThresholdTemperature) //frost max
749
+ frostProtectionControlService.getCharacteristic(Characteristic.CoolingThresholdTemperature) //max
750
750
  .setProps({
751
751
  minValue: 6,
752
752
  maxValue: 16,
@@ -765,7 +765,7 @@ class DeviceAta extends EventEmitter {
765
765
  if (this.logWarn) this.emit('warn', `Set frost protection max. temperature error: ${error}`);
766
766
  };
767
767
  });
768
- frostProtectionControlService.getCharacteristic(Characteristic.HeatingThresholdTemperature) //frost min
768
+ frostProtectionControlService.getCharacteristic(Characteristic.HeatingThresholdTemperature) //min
769
769
  .setProps({
770
770
  minValue: 4,
771
771
  maxValue: 14,
@@ -815,24 +815,92 @@ class DeviceAta extends EventEmitter {
815
815
  if (this.overheatProtectionSupport && this.accessory.overheatProtectionEnabled !== null) {
816
816
  //control
817
817
  if (this.logDebug) this.emit('debug', `Prepare overheat protection control service`);
818
- this.overheatProtectionControlService = new Service.Switch(`${serviceName} Overheat Protection`, `overheatProtectionControlService${deviceId}`);
819
- this.overheatProtectionControlService.addOptionalCharacteristic(Characteristic.ConfiguredName);
820
- this.overheatProtectionControlService.setCharacteristic(Characteristic.ConfiguredName, `${accessoryName} Overheat Protection`);
821
- this.overheatProtectionControlService.getCharacteristic(Characteristic.On)
818
+ const overheatProtectionControlService = new Service.HeaterCooler(`${serviceName} Overheat Protection`, `overheatProtectionControlService${deviceId}`);
819
+ overheatProtectionControlService.addOptionalCharacteristic(Characteristic.ConfiguredName);
820
+ overheatProtectionControlService.setCharacteristic(Characteristic.ConfiguredName, `${accessoryName} Overheat Protection`);
821
+ overheatProtectionControlService.getCharacteristic(Characteristic.Active)
822
822
  .onGet(async () => {
823
- const state = this.accessory.overheatProtectionEnabled;
823
+ const state = this.accessory.overheatProtection.Enabled;
824
824
  return state;
825
825
  })
826
826
  .onSet(async (state) => {
827
827
  try {
828
- deviceData.OverheatProtection.Enabled = state;
828
+ deviceData.OverheatProtection.Enabled = state ? true : false;
829
829
  if (this.logInfo) this.emit('info', `Overheat protection: ${state ? 'Enabled' : 'Disabled'}`);
830
830
  await this.melCloudAta.send(this.accountType, this.displayType, deviceData, 'overheatprotection');
831
831
  } catch (error) {
832
832
  if (this.logWarn) this.emit('warn', `Set overheat protection error: ${error}`);
833
833
  };
834
834
  });
835
- accessory.addService(this.overheatProtectionControlService);
835
+ overheatProtectionControlService.getCharacteristic(Characteristic.CurrentHeaterCoolerState)
836
+ .onGet(async () => {
837
+ const value = this.accessory.overheatProtection.Active ? 2 : 1;
838
+ return value;
839
+ })
840
+ overheatProtectionControlService.getCharacteristic(Characteristic.TargetHeaterCoolerState)
841
+ .setProps({
842
+ minValue: 0,
843
+ maxValue: 0,
844
+ validValues: [0]
845
+ })
846
+ .onGet(async () => {
847
+ const value = 0
848
+ return value;
849
+ })
850
+ .onSet(async (value) => {
851
+ try {
852
+ deviceData.OverheatProtection.Enabled = true;
853
+ if (this.logInfo) this.emit('info', `Set overheat protection: Enabled`);
854
+ await this.melCloudAta.send(this.accountType, this.displayType, deviceData, 'overheatprotection');
855
+ } catch (error) {
856
+ if (this.logWarn) this.emit('warn', `Set overheat protection error: ${error}`);
857
+ };
858
+ });
859
+ overheatProtectionControlService.getCharacteristic(Characteristic.CurrentTemperature)
860
+ .onGet(async () => {
861
+ const value = this.accessory.roomTemperature;
862
+ return value;
863
+ });
864
+ overheatProtectionControlService.getCharacteristic(Characteristic.CoolingThresholdTemperature) //max
865
+ .setProps({
866
+ minValue: 33,
867
+ maxValue: 40,
868
+ minStep: 1
869
+ })
870
+ .onGet(async () => {
871
+ const value = this.accessory.overheatProtection.Max;
872
+ return value;
873
+ })
874
+ .onSet(async (value) => {
875
+ try {
876
+ deviceData.OverheatProtection.Max = value;
877
+ if (this.logInfo) this.emit('info', `Set overheat protection max. temperature: ${value}${this.accessory.temperatureUnit}`);
878
+ await this.melCloudAta.send(this.accountType, this.displayType, deviceData, 'overheatprotection');
879
+ } catch (error) {
880
+ if (this.logWarn) this.emit('warn', `Set overheat protection max. temperature error: ${error}`);
881
+ };
882
+ });
883
+ overheatProtectionControlService.getCharacteristic(Characteristic.HeatingThresholdTemperature) //min
884
+ .setProps({
885
+ minValue: 31,
886
+ maxValue: 38,
887
+ minStep: 1
888
+ })
889
+ .onGet(async () => {
890
+ const value = this.accessory.overheatProtection.Min;
891
+ return value;
892
+ })
893
+ .onSet(async (value) => {
894
+ try {
895
+ deviceData.OverheatProtection.Min = value;
896
+ if (this.logInfo) this.emit('info', `Set overheat protection min. temperature: ${value}${this.accessory.temperatureUnit}`);
897
+ await this.melCloudAta.send(this.accountType, this.displayType, deviceData, 'overheatprotection');
898
+ } catch (error) {
899
+ if (this.logWarn) this.emit('warn', `Set overheat protection min. temperature error: ${error}`);
900
+ };
901
+ });
902
+ this.overheatProtectionControlService = overheatProtectionControlService;
903
+ accessory.addService(overheatProtectionControlService);
836
904
 
837
905
  if (this.logDebug) this.emit('debug', `Prepare overheat protection control sensor service`);
838
906
  this.overheatProtectionControlSensorService = new Service.ContactSensor(`${serviceName} Overheat Protection Control`, `overheatProtectionControlSensorService${deviceId}`);