homebridge-melcloud-control 2.3.0-beta.2 → 2.3.0-beta.20

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/index.js CHANGED
@@ -210,5 +210,23 @@ class MelCloudPlatform {
210
210
  };
211
211
 
212
212
  module.exports = (api) => {
213
+ const { Service, Characteristic, Units, Formats, Perms } = api.hap;
214
+ //custom characteristics
215
+ class CustomTargetHeaterCoolerState extends Characteristic {
216
+ constructor() {
217
+ super('Target Mode', '000000B2-0000-1000-8000-0026BB765291');
218
+ this.setProps({
219
+ format: Formats.UINT8,
220
+ minValue: 1,
221
+ maxValue: 2,
222
+ minStep: 1,
223
+ validValues: [1, 2],
224
+ perms: [Perms.NOTIFY, Perms.PAIRED_READ, Perms.PAIRED_WRITE]
225
+ });
226
+ this.value = this.getDefaultValue();
227
+ }
228
+ }
229
+ Characteristic.CustomTargetHeaterCoolerState = CustomTargetHeaterCoolerState;
230
+
213
231
  api.registerPlatform(CONSTANTS.PluginName, CONSTANTS.PlatformName, MelCloudPlatform, true);
214
232
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "displayName": "MELCloud Control",
3
3
  "name": "homebridge-melcloud-control",
4
- "version": "2.3.0-beta.2",
4
+ "version": "2.3.0-beta.20",
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
@@ -182,8 +182,6 @@ class DeviceAta extends EventEmitter {
182
182
  this.swingFunction = swingFunction;
183
183
  this.numberOfFanSpeeds = numberOfFanSpeeds;
184
184
  this.modelSupportsFanSpeed = modelSupportsFanSpeed;
185
- this.modelSupportsAuto = modelSupportsAuto;
186
- this.modelSupportsHeat = modelSupportsHeat;
187
185
  this.modelSupportsDry = modelSupportsDry;
188
186
  this.temperatureIncrement = temperatureIncrement;
189
187
  this.temperatureUnit = CONSTANTS.TemperatureDisplayUnits[useFahrenheit];
@@ -219,7 +217,7 @@ class DeviceAta extends EventEmitter {
219
217
 
220
218
  let operationModeSetPropsMinValue = 0;
221
219
  let operationModeSetPropsMaxValue = 3;
222
- let operationModeSetPropsValidValues = [0, 1, 2, 3];
220
+ let operationModeSetPropsValidValues = [0];
223
221
  let fanSpeedSetPropsMaxValue = 2;
224
222
 
225
223
  switch (displayMode) {
@@ -492,7 +490,6 @@ class DeviceAta extends EventEmitter {
492
490
  this.operationModeSetPropsValidValues = operationModeSetPropsValidValues;
493
491
  this.fanSpeedSetPropsMaxValue = fanSpeedSetPropsMaxValue;
494
492
 
495
- await new Promise(resolve => setTimeout(resolve, 150));
496
493
  const accessory = await this.prepareAccessory(accountInfo, deviceState, deviceId, deviceTypeText, deviceName, accountName);
497
494
  this.emit('publishAccessory', accessory);
498
495
  this.startPrepareAccessory = false;
@@ -632,8 +629,8 @@ class DeviceAta extends EventEmitter {
632
629
 
633
630
  switch (displayMode) {
634
631
  case 0: //Heater Cooler
635
- const debug = this.enableDebugMode ? this.emit('debug', `Prepare heather/cooler service`) : false;
636
- this.melCloudService = accessory.addService(Service.HeaterCooler, serviceName, `HeaterCooler ${deviceId}`);
632
+ const debug = this.enableDebugMode ? this.emit('debug', `Prepare heater/cooler service`) : false;
633
+ this.melCloudService = new Service.HeaterCooler(serviceName, `HeaterCooler ${deviceId}`);
637
634
  this.melCloudService.getCharacteristic(Characteristic.Active)
638
635
  .onGet(async () => {
639
636
  const state = this.power;
@@ -655,12 +652,13 @@ class DeviceAta extends EventEmitter {
655
652
  const value = this.currentOperationMode;
656
653
  return value;
657
654
  });
658
- this.melCloudService.getCharacteristic(Characteristic.TargetHeaterCoolerState)
655
+ this.melCloudService.getCharacteristic(Characteristic.TargetHeaterCoolerState)
659
656
  .setProps({
660
657
  minValue: this.operationModeSetPropsMinValue,
661
658
  maxValue: this.operationModeSetPropsMaxValue,
662
659
  validValues: this.operationModeSetPropsValidValues
663
660
  })
661
+ this.melCloudService.getCharacteristic(Characteristic.TargetHeaterCoolerState)
664
662
  .onGet(async () => {
665
663
  const value = this.targetOperationMode; //1 = HEAT, 2 = DRY 3 = COOL, 7 = FAN, 8 = AUTO
666
664
  return value;
@@ -841,6 +839,7 @@ class DeviceAta extends EventEmitter {
841
839
  this.emit('warn', `Set temperature display unit error: ${error}`);
842
840
  };
843
841
  });
842
+ accessory.addService(this.melCloudService);
844
843
  break;
845
844
  case 1: //Thermostat
846
845
  const debug1 = this.enableDebugMode ? this.emit('debug', `Prepare thermostat service`) : false;
package/src/deviceatw.js CHANGED
@@ -676,7 +676,6 @@ class DeviceAtw extends EventEmitter {
676
676
  //start prepare accessory
677
677
  if (this.startPrepareAccessory) {
678
678
  try {
679
- await new Promise(resolve => setTimeout(resolve, 150));
680
679
  const accessory = await this.prepareAccessory(accountInfo, deviceState, deviceId, deviceTypeText, deviceName, accountName);
681
680
  this.emit('publishAccessory', accessory);
682
681
  this.startPrepareAccessory = false;
package/src/deviceerv.js CHANGED
@@ -472,7 +472,6 @@ class DeviceErv extends EventEmitter {
472
472
  this.operationModeSetPropsValidValues = operationModeSetPropsValidValues;
473
473
  this.fanSpeedSetPropsMaxValue = fanSpeedSetPropsMaxValue;
474
474
 
475
- await new Promise(resolve => setTimeout(resolve, 150));
476
475
  const accessory = await this.prepareAccessory(accountInfo, deviceState, deviceId, deviceTypeText, deviceName, accountName);
477
476
  this.emit('publishAccessory', accessory);
478
477
  this.startPrepareAccessory = false;