homebridge-melcloud-control 2.3.0-beta.24 → 2.3.0-beta.26

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/CHANGELOG.md CHANGED
@@ -26,7 +26,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
26
26
  ## Changes
27
27
 
28
28
  - removed from config.json `ataDisableAutoMode`, `ataDisableHeatMode`, `ataAutoHeatMode`
29
- - added to config.json `ataHeatDryFanMode`, `ataAutoDryFanMode`
29
+ - added to config.json `ataHeatDryFanMode`, `ataCoolDryFanMode`, `ataAutoDryFanMode`
30
30
  - added [#132](https://github.com/grzegorz914/homebridge-melcloud-control/issues/132)
31
31
  - cleanup
32
32
  - config schema updated
package/README.md CHANGED
@@ -48,7 +48,7 @@ Homebridge plugin for Air Conditioner, Heat Pump and Energy Recovery Ventilation
48
48
  * Swing mode `AUTO/SWING`.
49
49
  * Physical lock controls `LOCK/UNLOCK`.
50
50
  * Temperature display unit `°F/°C`.
51
- * Assign operating mode for `HEAT/AUTO`.
51
+ * Assign operating mode for `HEAT/COOL/AUTO`.
52
52
  * Thermostat:
53
53
  * Power `ON/OFF`.
54
54
  * Operating mode `POWER OFF/HEAT/COOL/AUTO`.
@@ -177,10 +177,11 @@ Homebridge plugin for Air Conditioner, Heat Pump and Energy Recovery Ventilation
177
177
  | `passwd` | Here set the MELCloud password. |
178
178
  | `language` | Here select the MELCloud language. |
179
179
  | `ataDisplayMode` | Here select main control mode `Heater/Cooler`, `Thermostat`. |
180
- | `ataTemperatureSensor` | This enable extra `Room` temperature sensors to use with automations in HomeKit app. |
181
- | `ataTemperatureSensorOutdoor` | This enable extra `Outdoor` temperature sensors to use with automations in HomeKit app. |
182
180
  | `ataHeatDryFanMode` | Here select operation mode for `Heat`, if selected `Heat` and the mode is not supported by device then will be disabled, in other cases will use selected mode. |
181
+ | `ataCoolDryFanMode` | Here select operation mode for `Cool`, if selected `Cool` and the mode is not supported by device then will be disabled, in other cases will use selected mode. |
183
182
  | `ataAutoDryFanMode` | Here select operation mode for `Auto`, if selected `Auto` and the mode is not supported by device then will be disabled, in other cases will use selected mode. |
183
+ | `ataTemperatureSensor` | This enable extra `Room` temperature sensors to use with automations in HomeKit app. |
184
+ | `ataTemperatureSensorOutdoor` | This enable extra `Outdoor` temperature sensors to use with automations in HomeKit app. |
184
185
  | `ataPresets` | This enable extra buttons for configured presets and display it in HomeKit app. |
185
186
  | `ataButtons.name` | Here set `Button Name` which You want expose to the `Homebridge/HomeKit`. |
186
187
  | `ataButtons.mode` | Here select button mode, VH - Vane Horizontal, VV - Vane Horizontal. |
@@ -1430,6 +1430,7 @@
1430
1430
  "items": [
1431
1431
  "accounts[].ataDisplayMode",
1432
1432
  "accounts[].ataHeatDryFanMode",
1433
+ "accounts[].ataCoolDryFanMode",
1433
1434
  "accounts[].ataAutoDryFanMode",
1434
1435
  "accounts[].ataPresets",
1435
1436
  {
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.24",
4
+ "version": "2.3.0-beta.26",
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
@@ -69,6 +69,15 @@ class DeviceAta extends EventEmitter {
69
69
  this.offline = false;
70
70
  this.currentOperationMode = 0;
71
71
  this.targetOperationMode = 0;
72
+ this.fanSpeed = 0;
73
+ this.swingMode = 0;
74
+ this.lockPhysicalControls = 0;
75
+ this.useFahrenheit = 0;
76
+
77
+ this.operationModeSetPropsMinValue = 0;
78
+ this.operationModeSetPropsMaxValue = 3;
79
+ this.operationModeSetPropsValidValues = [0];
80
+ this.fanSpeedSetPropsMaxValue = 2;
72
81
 
73
82
  //melcloud device
74
83
  this.melCloudAta = new MelCloudAta({
@@ -217,15 +226,6 @@ class DeviceAta extends EventEmitter {
217
226
  this.presetsCount = this.presetsEnabled ? presets.length : 0;
218
227
 
219
228
  //operating mode
220
- let fanSpeed = 0;
221
- let swingMode = 0;
222
- let lockPhysicalControls = 0;
223
-
224
- let operationModeSetPropsMinValue = 0;
225
- let operationModeSetPropsMaxValue = 3;
226
- let operationModeSetPropsValidValues = [0];
227
- let fanSpeedSetPropsMaxValue = 2;
228
-
229
229
  switch (displayMode) {
230
230
  case 0: //Heater Cooler
231
231
  //operating mode 0, HEAT, DRY, COOL, 4, 5, 6, FAN, AUTO, ISEE HEAT, ISEE DRY, ISEE COOL
@@ -278,44 +278,43 @@ class DeviceAta extends EventEmitter {
278
278
  break;
279
279
  case false:
280
280
  this.currentOperationMode = 0;
281
- this.targetOperationMode = 0;
282
281
  break;
283
282
  };
284
- operationModeSetPropsMinValue = modelSupportsAuto && modelSupportsHeat ? 0 : !modelSupportsAuto && modelSupportsHeat ? 1 : modelSupportsAuto && !modelSupportsHeat ? 0 : 2;
285
- operationModeSetPropsMaxValue = 2
286
- operationModeSetPropsValidValues = modelSupportsAuto && modelSupportsHeat ? [0, 1, 2] : !modelSupportsAuto && modelSupportsHeat ? [1, 2] : modelSupportsAuto && !modelSupportsHeat ? [0, 2] : [2];
283
+ this.operationModeSetPropsMinValue = modelSupportsAuto && modelSupportsHeat ? 0 : !modelSupportsAuto && modelSupportsHeat ? 1 : modelSupportsAuto && !modelSupportsHeat ? 0 : 2;
284
+ this.operationModeSetPropsMaxValue = 2
285
+ this.operationModeSetPropsValidValues = modelSupportsAuto && modelSupportsHeat ? [0, 1, 2] : !modelSupportsAuto && modelSupportsHeat ? [1, 2] : modelSupportsAuto && !modelSupportsHeat ? [0, 2] : [2];
287
286
 
288
287
  //fan speed mode
289
288
  if (modelSupportsFanSpeed) {
290
289
  switch (numberOfFanSpeeds) {
291
290
  case 2: //Fan speed mode 2
292
- fanSpeed = hasAutomaticFanSpeed ? [3, 1, 2][setFanSpeed] : [0, 1, 2][setFanSpeed];
293
- fanSpeedSetPropsMaxValue = hasAutomaticFanSpeed ? 3 : 2;
291
+ this.fanSpeed = hasAutomaticFanSpeed ? [3, 1, 2][setFanSpeed] : [0, 1, 2][setFanSpeed];
292
+ this.fanSpeedSetPropsMaxValue = hasAutomaticFanSpeed ? 3 : 2;
294
293
  break;
295
294
  case 3: //Fan speed mode 3
296
- fanSpeed = hasAutomaticFanSpeed ? [4, 1, 2, 3][setFanSpeed] : [0, 1, 2, 3][setFanSpeed];
297
- fanSpeedSetPropsMaxValue = hasAutomaticFanSpeed ? 4 : 3;
295
+ this.fanSpeed = hasAutomaticFanSpeed ? [4, 1, 2, 3][setFanSpeed] : [0, 1, 2, 3][setFanSpeed];
296
+ this.fanSpeedSetPropsMaxValue = hasAutomaticFanSpeed ? 4 : 3;
298
297
  break;
299
298
  case 4: //Fan speed mode 4
300
- fanSpeed = hasAutomaticFanSpeed ? [5, 1, 2, 3, 4][setFanSpeed] : [0, 1, 2, 3, 4][setFanSpeed];
301
- fanSpeedSetPropsMaxValue = hasAutomaticFanSpeed ? 5 : 4;
299
+ this.fanSpeed = hasAutomaticFanSpeed ? [5, 1, 2, 3, 4][setFanSpeed] : [0, 1, 2, 3, 4][setFanSpeed];
300
+ this.fanSpeedSetPropsMaxValue = hasAutomaticFanSpeed ? 5 : 4;
302
301
  break;
303
302
  case 5: //Fan speed mode 5
304
- fanSpeed = hasAutomaticFanSpeed ? [6, 1, 2, 3, 4, 5][setFanSpeed] : [0, 1, 2, 3, 4, 5][setFanSpeed];
305
- fanSpeedSetPropsMaxValue = hasAutomaticFanSpeed ? 6 : 5;
303
+ this.fanSpeed = hasAutomaticFanSpeed ? [6, 1, 2, 3, 4, 5][setFanSpeed] : [0, 1, 2, 3, 4, 5][setFanSpeed];
304
+ this.fanSpeedSetPropsMaxValue = hasAutomaticFanSpeed ? 6 : 5;
306
305
  break;
307
306
  case 6: //Fan speed mode 6
308
- fanSpeed = hasAutomaticFanSpeed ? [7, 1, 2, 3, 4, 5, 6][setFanSpeed] : [0, 1, 2, 3, 4, 5, 6][setFanSpeed];
309
- fanSpeedSetPropsMaxValue = hasAutomaticFanSpeed ? 7 : 6;
307
+ this.fanSpeed = hasAutomaticFanSpeed ? [7, 1, 2, 3, 4, 5, 6][setFanSpeed] : [0, 1, 2, 3, 4, 5, 6][setFanSpeed];
308
+ this.fanSpeedSetPropsMaxValue = hasAutomaticFanSpeed ? 7 : 6;
310
309
  break;
311
310
  };
312
311
  };
313
312
 
314
313
  //swing and vane mode
315
- swingMode = swingFunction && vaneHorizontal === 12 && vaneVertical === 7 ? 1 : 0;
314
+ this.swingMode = swingFunction && vaneHorizontal === 12 && vaneVertical === 7 ? 1 : 0;
316
315
 
317
316
  //lock physical controls
318
- lockPhysicalControls = prohibitSetTemperature && prohibitOperationMode && prohibitPower ? 1 : 0;
317
+ this.lockPhysicalControls = prohibitSetTemperature && prohibitOperationMode && prohibitPower ? 1 : 0;
319
318
 
320
319
  //update characteristics
321
320
  if (this.melCloudService) {
@@ -326,61 +325,68 @@ class DeviceAta extends EventEmitter {
326
325
  .updateCharacteristic(Characteristic.CurrentTemperature, roomTemperature)
327
326
  .updateCharacteristic(Characteristic.HeatingThresholdTemperature, setTemperature)
328
327
  .updateCharacteristic(Characteristic.CoolingThresholdTemperature, setTemperature)
329
- .updateCharacteristic(Characteristic.LockPhysicalControls, lockPhysicalControls)
330
- .updateCharacteristic(Characteristic.TemperatureDisplayUnits, useFahrenheit);
331
- const updateRS = modelSupportsFanSpeed ? this.melCloudService.updateCharacteristic(Characteristic.RotationSpeed, fanSpeed) : false;
332
- const updateSM = swingFunction ? this.melCloudService.updateCharacteristic(Characteristic.SwingMode, swingMode) : false;
328
+ .updateCharacteristic(Characteristic.LockPhysicalControls, this.lockPhysicalControls)
329
+ .updateCharacteristic(Characteristic.TemperatureDisplayUnits, this.useFahrenheit);
330
+ const updateRS = modelSupportsFanSpeed ? this.melCloudService.updateCharacteristic(Characteristic.RotationSpeed, this.fanSpeed) : false;
331
+ const updateSM = swingFunction ? this.melCloudService.updateCharacteristic(Characteristic.SwingMode, this.swingMode) : false;
333
332
  };
334
333
  break;
335
334
  case 1: //Thermostat
336
- switch (power && !inStandbyMode) {
335
+ switch (power) {
337
336
  case true:
338
- switch (operationMode) {
339
- case 1: //HEAT
340
- this.currentOperationMode = 1; //OFF, HEAT, COOL
341
- this.targetOperationMode = 1; //OFF, HEAT, COOL, AUTO
342
- break;
343
- case 2: //DRY
344
- this.currentOperationMode = 2;
345
- this.targetOperationMode = 2;
346
- break;
347
- case 3: //COOL
348
- this.currentOperationMode = 2;
349
- this.targetOperationMode = 2;
350
- break;
351
- case 7: //FAN
352
- this.currentOperationMode = 2;
353
- this.targetOperationMode = 2;
354
- break;
355
- case 8: //AUTO
356
- this.currentOperationMode = setTemperature < roomTemperature ? 2 : 1;
357
- this.targetOperationMode = 3;
358
- break;
359
- case 9: //ISEE HEAT
360
- this.currentOperationMode = 1
361
- this.targetOperationMode = 1;
362
- break;
363
- case 10: //ISEE DRY
364
- this.currentOperationMode = 2;
365
- this.targetOperationMode = 2;
366
- break;
367
- case 11: //ISEE COOL;
368
- this.currentOperationMode = 2;
369
- this.targetOperationMode = 2;
337
+ switch (!inStandbyMode) {
338
+ case true:
339
+ switch (operationMode) {
340
+ case 1: //HEAT
341
+ this.currentOperationMode = 1; //OFF, HEAT, COOL
342
+ this.targetOperationMode = 1; //OFF, HEAT, COOL, AUTO
343
+ break;
344
+ case 2: //DRY
345
+ this.currentOperationMode = 2;
346
+ this.targetOperationMode = 2;
347
+ break;
348
+ case 3: //COOL
349
+ this.currentOperationMode = 2;
350
+ this.targetOperationMode = 2;
351
+ break;
352
+ case 7: //FAN
353
+ this.currentOperationMode = 2;
354
+ this.targetOperationMode = 2;
355
+ break;
356
+ case 8: //AUTO
357
+ this.currentOperationMode = setTemperature < roomTemperature ? 2 : 1;
358
+ this.targetOperationMode = 3;
359
+ break;
360
+ case 9: //ISEE HEAT
361
+ this.currentOperationMode = 1
362
+ this.targetOperationMode = 1;
363
+ break;
364
+ case 10: //ISEE DRY
365
+ this.currentOperationMode = 2;
366
+ this.targetOperationMode = 2;
367
+ break;
368
+ case 11: //ISEE COOL;
369
+ this.currentOperationMode = 2;
370
+ this.targetOperationMode = 2;
371
+ break;
372
+ default:
373
+ this.emit('warn', `Unknown operating mode: ${operationMode}`);
374
+ break;
375
+ };
370
376
  break;
371
- default:
372
- this.emit('warn', `Unknown operating mode: ${operationMode}`);
377
+ case false:
378
+ this.currentOperationMode = 0;
379
+ this.targetOperationMode = 0;
373
380
  break;
374
381
  };
375
- break;
376
382
  case false:
377
383
  this.currentOperationMode = 0;
378
384
  this.targetOperationMode = 0;
379
385
  break;
380
386
  };
381
- operationModeSetPropsMinValue = 0
382
- operationModeSetPropsMaxValue = modelSupportsAuto && modelSupportsHeat ? 3 : !modelSupportsAuto && modelSupportsHeat ? 2 : modelSupportsAuto && !modelSupportsHeat ? 3 : 2;
383
- operationModeSetPropsValidValues = modelSupportsAuto && modelSupportsHeat ? [0, 1, 2, 3] : !modelSupportsAuto && modelSupportsHeat ? [0, 1, 2] : modelSupportsAuto && !modelSupportsHeat ? [0, 2, 3] : [0, 2];
387
+ this.operationModeSetPropsMinValue = 0
388
+ this.operationModeSetPropsMaxValue = modelSupportsAuto && modelSupportsHeat ? 3 : !modelSupportsAuto && modelSupportsHeat ? 2 : modelSupportsAuto && !modelSupportsHeat ? 3 : 2;
389
+ this.operationModeSetPropsValidValues = modelSupportsAuto && modelSupportsHeat ? [0, 1, 2, 3] : !modelSupportsAuto && modelSupportsHeat ? [0, 1, 2] : modelSupportsAuto && !modelSupportsHeat ? [0, 2, 3] : [0, 2];
384
390
 
385
391
  //update characteristics
386
392
  if (this.melCloudService) {
@@ -389,7 +395,7 @@ class DeviceAta extends EventEmitter {
389
395
  .updateCharacteristic(Characteristic.TargetHeatingCoolingState, this.targetOperationMode)
390
396
  .updateCharacteristic(Characteristic.CurrentTemperature, roomTemperature)
391
397
  .updateCharacteristic(Characteristic.TargetTemperature, setTemperature)
392
- .updateCharacteristic(Characteristic.TemperatureDisplayUnits, useFahrenheit);
398
+ .updateCharacteristic(Characteristic.TemperatureDisplayUnits, this.useFahrenheit);
393
399
  };
394
400
  break;
395
401
  };
@@ -399,12 +405,9 @@ class DeviceAta extends EventEmitter {
399
405
  this.roomTemperature = roomTemperature;
400
406
  this.outdoorTemperature = outdoorTemperature;
401
407
  this.setTemperature = setTemperature;
402
- this.fanSpeed = fanSpeed;
403
408
  this.setFanSpeed = setFanSpeed;
404
- this.swingMode = swingMode;
405
409
  this.vaneHorizontal = vaneHorizontal;
406
410
  this.vaneVertical = vaneVertical;
407
- this.lockPhysicalControls = lockPhysicalControls;
408
411
 
409
412
  if (this.roomTemperatureSensorService) {
410
413
  this.roomTemperatureSensorService
@@ -516,7 +519,7 @@ class DeviceAta extends EventEmitter {
516
519
  button.state = power ? (setFanSpeed === 6) : false;
517
520
  break;
518
521
  case 37: //PHYSICAL LOCK CONTROLS ALL
519
- button.state = (lockPhysicalControls === 1);
522
+ button.state = (this.lockPhysicalControls === 1);
520
523
  break;
521
524
  case 38: //PHYSICAL LOCK CONTROLS POWER
522
525
  button.state = (prohibitPower === true);
@@ -573,19 +576,14 @@ class DeviceAta extends EventEmitter {
573
576
  const info1 = displayMode === 0 ? this.emit('message', `Heating threshold temperature: ${setTemperature}${this.temperatureUnit}`) : false;
574
577
  const info2 = displayMode === 0 ? this.emit('message', `Cooling threshold temperature: ${setTemperature}${this.temperatureUnit}`) : false;
575
578
  const info3 = modelSupportsFanSpeed ? this.emit('message', `Fan speed mode: ${CONSTANTS.AirConditioner.FanSpeed[setFanSpeed]}`) : false;
576
- const info4 = swingFunction ? this.emit('message', `Vane swing mode: ${CONSTANTS.AirConditioner.AirDirection[swingMode ? 6 : 0]}`) : false;
579
+ const info4 = swingFunction ? this.emit('message', `Vane swing mode: ${CONSTANTS.AirConditioner.AirDirection[this.swingMode ? 6 : 0]}`) : false;
577
580
  this.emit('message', `Temperature display unit: ${this.temperatureUnit}`);
578
- this.emit('message', `Lock physical controls: ${lockPhysicalControls ? 'LOCKED' : 'UNLOCKED'}`);
581
+ this.emit('message', `Lock physical controls: ${this.lockPhysicalControls ? 'LOCKED' : 'UNLOCKED'}`);
579
582
  };
580
583
 
581
584
  //start prepare accessory
582
585
  if (this.startPrepareAccessory) {
583
586
  try {
584
- this.operationModeSetPropsMinValue = operationModeSetPropsMinValue;
585
- this.operationModeSetPropsMaxValue = operationModeSetPropsMaxValue;
586
- this.operationModeSetPropsValidValues = operationModeSetPropsValidValues;
587
- this.fanSpeedSetPropsMaxValue = fanSpeedSetPropsMaxValue;
588
-
589
587
  const accessory = await this.prepareAccessory(accountInfo, deviceState, deviceId, deviceTypeText, deviceName, accountName);
590
588
  this.emit('publishAccessory', accessory);
591
589
  this.startPrepareAccessory = false;