homebridge-melcloud-control 3.8.3-beta.4 → 3.8.3-beta.5

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 +24 -32
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "displayName": "MELCloud Control",
3
3
  "name": "homebridge-melcloud-control",
4
- "version": "3.8.3-beta.4",
4
+ "version": "3.8.3-beta.5",
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
@@ -297,9 +297,9 @@ class DeviceAta extends EventEmitter {
297
297
  switch (this.displayMode) {
298
298
  case 1: //Heater Cooler
299
299
  const debug = this.enableDebugMode ? this.emit('debug', `Prepare heater/cooler service`) : false;
300
- this.melCloudService = new Service.HeaterCooler(serviceName, `HeaterCooler ${deviceId}`);
301
- this.melCloudService.setPrimaryService(true);
302
- this.melCloudService.getCharacteristic(Characteristic.Active)
300
+ const melCloudService = accessory.addService(Service.HeaterCooler, serviceName, `HeaterCooler ${deviceId}`);
301
+ melCloudService.setPrimaryService(true);
302
+ melCloudService.getCharacteristic(Characteristic.Active)
303
303
  .onGet(async () => {
304
304
  const state = mielHvac.power;
305
305
  return state;
@@ -314,12 +314,12 @@ class DeviceAta extends EventEmitter {
314
314
  this.emit('warn', `Set power error: ${error}`);
315
315
  };
316
316
  });
317
- this.melCloudService.getCharacteristic(Characteristic.CurrentHeaterCoolerState)
317
+ melCloudService.getCharacteristic(Characteristic.CurrentHeaterCoolerState)
318
318
  .onGet(async () => {
319
319
  const value = mielHvac.currentOperationMode;
320
320
  return value;
321
321
  });
322
- this.melCloudService.getCharacteristic(Characteristic.TargetHeaterCoolerState)
322
+ melCloudService.getCharacteristic(Characteristic.TargetHeaterCoolerState)
323
323
  .setProps({
324
324
  minValue: mielHvac.operationModeSetPropsMinValue,
325
325
  maxValue: mielHvac.operationModeSetPropsMaxValue,
@@ -351,13 +351,13 @@ class DeviceAta extends EventEmitter {
351
351
  this.emit('warn', `Set operation mode error: ${error}`);
352
352
  };
353
353
  });
354
- this.melCloudService.getCharacteristic(Characteristic.CurrentTemperature)
354
+ melCloudService.getCharacteristic(Characteristic.CurrentTemperature)
355
355
  .onGet(async () => {
356
356
  const value = mielHvac.roomTemperature;
357
357
  return value;
358
358
  });
359
359
  if (modelSupportsFanSpeed) {
360
- this.melCloudService.getCharacteristic(Characteristic.RotationSpeed)
360
+ melCloudService.getCharacteristic(Characteristic.RotationSpeed)
361
361
  .setProps({
362
362
  minValue: 0,
363
363
  maxValue: mielHvac.fanSpeedSetPropsMaxValue,
@@ -401,7 +401,7 @@ class DeviceAta extends EventEmitter {
401
401
  });
402
402
  };
403
403
  if (swingFunction) {
404
- this.melCloudService.getCharacteristic(Characteristic.SwingMode)
404
+ melCloudService.getCharacteristic(Characteristic.SwingMode)
405
405
  .onGet(async () => {
406
406
  //Vane Horizontal: Auto, 1, 2, 3, 4, 5, 6, 12 = Swing //Vertical: Auto, 1, 2, 3, 4, 5, 7 = Swing
407
407
  const value = mielHvac.swingMode;
@@ -419,7 +419,7 @@ class DeviceAta extends EventEmitter {
419
419
  };
420
420
  });
421
421
  };
422
- this.melCloudService.getCharacteristic(Characteristic.CoolingThresholdTemperature)
422
+ melCloudService.getCharacteristic(Characteristic.CoolingThresholdTemperature)
423
423
  .setProps({
424
424
  minValue: mielHvac.minTempCoolDry,
425
425
  maxValue: mielHvac.maxTempCoolDry,
@@ -440,7 +440,7 @@ class DeviceAta extends EventEmitter {
440
440
  };
441
441
  });
442
442
  if (modelSupportsHeat) {
443
- this.melCloudService.getCharacteristic(Characteristic.HeatingThresholdTemperature)
443
+ melCloudService.getCharacteristic(Characteristic.HeatingThresholdTemperature)
444
444
  .setProps({
445
445
  minValue: mielHvac.minTempHeat,
446
446
  maxValue: mielHvac.maxTempHeat,
@@ -461,7 +461,7 @@ class DeviceAta extends EventEmitter {
461
461
  };
462
462
  });
463
463
  };
464
- this.melCloudService.getCharacteristic(Characteristic.LockPhysicalControls)
464
+ melCloudService.getCharacteristic(Characteristic.LockPhysicalControls)
465
465
  .onGet(async () => {
466
466
  const value = mielHvac.lockPhysicalControl;
467
467
  return value;
@@ -479,7 +479,7 @@ class DeviceAta extends EventEmitter {
479
479
  this.emit('warn', `Set lock physical controls error: ${error}`);
480
480
  };
481
481
  });
482
- this.melCloudService.getCharacteristic(Characteristic.TemperatureDisplayUnits)
482
+ melCloudService.getCharacteristic(Characteristic.TemperatureDisplayUnits)
483
483
  .onGet(async () => {
484
484
  const value = mielHvac.useFahrenheit;
485
485
  return value;
@@ -494,18 +494,18 @@ class DeviceAta extends EventEmitter {
494
494
  this.emit('warn', `Set temperature display unit error: ${error}`);
495
495
  };
496
496
  });
497
- accessory.addService(this.melCloudService);
497
+ this.melCloudService = melCloudService;
498
498
  break;
499
499
  case 2: //Thermostat
500
500
  const debug1 = this.enableDebugMode ? this.emit('debug', `Prepare thermostat service`) : false;
501
- this.melCloudService = new Service.Thermostat(serviceName, `Thermostat ${deviceId}`);
502
- this.melCloudService.setPrimaryService(true);
503
- this.melCloudService.getCharacteristic(Characteristic.CurrentHeatingCoolingState)
501
+ const melCloudServiceT = accessory.addService(Service.Thermostat, serviceName, `Thermostat ${deviceId}`);
502
+ melCloudServiceT.setPrimaryService(true);
503
+ melCloudServiceT.getCharacteristic(Characteristic.CurrentHeatingCoolingState)
504
504
  .onGet(async () => {
505
505
  const value = mielHvac.currentOperationMode;
506
506
  return value;
507
507
  });
508
- this.melCloudService.getCharacteristic(Characteristic.TargetHeatingCoolingState)
508
+ melCloudServiceT.getCharacteristic(Characteristic.TargetHeatingCoolingState)
509
509
  .setProps({
510
510
  minValue: mielHvac.operationModeSetPropsMinValue,
511
511
  maxValue: mielHvac.operationModeSetPropsMaxValue,
@@ -546,12 +546,12 @@ class DeviceAta extends EventEmitter {
546
546
  this.emit('warn', `Set operation mode error: ${error}`);
547
547
  };
548
548
  });
549
- this.melCloudService.getCharacteristic(Characteristic.CurrentTemperature)
549
+ melCloudServiceT.getCharacteristic(Characteristic.CurrentTemperature)
550
550
  .onGet(async () => {
551
551
  const value = mielHvac.roomTemperature;
552
552
  return value;
553
553
  });
554
- this.melCloudService.getCharacteristic(Characteristic.TargetTemperature)
554
+ melCloudServiceT.getCharacteristic(Characteristic.TargetTemperature)
555
555
  .setProps({
556
556
  minValue: mielHvac.minTempHeat,
557
557
  maxValue: mielHvac.maxTempHeat,
@@ -571,7 +571,7 @@ class DeviceAta extends EventEmitter {
571
571
  this.emit('warn', `Set temperature error: ${error}`);
572
572
  };
573
573
  });
574
- this.melCloudService.getCharacteristic(Characteristic.TemperatureDisplayUnits)
574
+ melCloudServiceT.getCharacteristic(Characteristic.TemperatureDisplayUnits)
575
575
  .onGet(async () => {
576
576
  const value = mielHvac.useFahrenheit;
577
577
  return value;
@@ -586,7 +586,7 @@ class DeviceAta extends EventEmitter {
586
586
  this.emit('warn', `Set temperature display unit error: ${error}`);
587
587
  };
588
588
  });
589
- accessory.addService(this.melCloudService);
589
+ this.melCloudServiceT = melCloudServiceT;
590
590
  break;
591
591
  };
592
592
 
@@ -1059,8 +1059,6 @@ class DeviceAta extends EventEmitter {
1059
1059
 
1060
1060
  };
1061
1061
 
1062
- this.emit('warn', `Update characteristics: ${power ? 1 : 0}, ${obj.currentOperationMode}, ${obj.targetOperationMode}, ${roomTemperature}, ${setTemperature}`);
1063
-
1064
1062
  //operating mode 0, HEAT, DRY, COOL, 4, 5, 6, FAN, AUTO, ISEE HEAT, ISEE DRY, ISEE COOL
1065
1063
  switch (this.displayMode) {
1066
1064
  case 1: //Heater Cooler
@@ -1133,12 +1131,8 @@ class DeviceAta extends EventEmitter {
1133
1131
  };
1134
1132
  };
1135
1133
 
1136
- //add obj to mielHvac
1137
- this.mielHvac = obj;
1138
-
1139
1134
  //update characteristics
1140
1135
  if (this.melCloudService) {
1141
- this.emit('warn', `Update characteristics: ${power ? 1 : 0}, ${obj.currentOperationMode}, ${obj.targetOperationMode}, ${roomTemperature}, ${obj.lockPhysicalControl}`);
1142
1136
  this.melCloudService
1143
1137
  .updateCharacteristic(Characteristic.Active, power ? 1 : 0)
1144
1138
  .updateCharacteristic(Characteristic.CurrentHeaterCoolerState, obj.currentOperationMode)
@@ -1197,12 +1191,8 @@ class DeviceAta extends EventEmitter {
1197
1191
  obj.operationModeSetPropsMaxValue = modelSupportsAuto && modelSupportsHeat ? 3 : !modelSupportsAuto && modelSupportsHeat ? 2 : modelSupportsAuto && !modelSupportsHeat ? 3 : 2;
1198
1192
  obj.operationModeSetPropsValidValues = modelSupportsAuto && modelSupportsHeat ? [0, 1, 2, 3] : !modelSupportsAuto && modelSupportsHeat ? [0, 1, 2] : modelSupportsAuto && !modelSupportsHeat ? [0, 2, 3] : [0, 2];
1199
1193
 
1200
- //add obj to mielHvac
1201
- this.mielHvac = obj;
1202
-
1203
1194
  //update characteristics
1204
- if (this.melCloudService) {
1205
- this.emit('warn', `Update characteristics: ${power ? 1 : 0}, ${obj.currentOperationMode}, ${obj.targetOperationMode}, ${roomTemperature}, ${obj.useFahrenheit}`);
1195
+ if (this.melCloudServiceT) {
1206
1196
  this.melCloudService
1207
1197
  .updateCharacteristic(Characteristic.CurrentHeatingCoolingState, obj.currentOperationMode)
1208
1198
  .updateCharacteristic(Characteristic.TargetHeatingCoolingState, obj.targetOperationMode)
@@ -1212,6 +1202,8 @@ class DeviceAta extends EventEmitter {
1212
1202
  };
1213
1203
  break;
1214
1204
  };
1205
+ //add obj to mielHvac
1206
+ this.mielHvac = obj;
1215
1207
 
1216
1208
  if (this.roomTemperatureSensorService) {
1217
1209
  this.roomTemperatureSensorService