homebridge-melcloud-control 2.3.0-beta.24 → 2.3.0-beta.25
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 +1 -1
- package/src/deviceata.js +32 -41
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.
|
|
4
|
+
"version": "2.3.0-beta.25",
|
|
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,14 @@ 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
|
+
|
|
76
|
+
this.operationModeSetPropsMinValue = 0;
|
|
77
|
+
this.operationModeSetPropsMaxValue = 3;
|
|
78
|
+
this.operationModeSetPropsValidValues = [0];
|
|
79
|
+
this.fanSpeedSetPropsMaxValue = 2;
|
|
72
80
|
|
|
73
81
|
//melcloud device
|
|
74
82
|
this.melCloudAta = new MelCloudAta({
|
|
@@ -217,15 +225,6 @@ class DeviceAta extends EventEmitter {
|
|
|
217
225
|
this.presetsCount = this.presetsEnabled ? presets.length : 0;
|
|
218
226
|
|
|
219
227
|
//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
228
|
switch (displayMode) {
|
|
230
229
|
case 0: //Heater Cooler
|
|
231
230
|
//operating mode 0, HEAT, DRY, COOL, 4, 5, 6, FAN, AUTO, ISEE HEAT, ISEE DRY, ISEE COOL
|
|
@@ -281,41 +280,41 @@ class DeviceAta extends EventEmitter {
|
|
|
281
280
|
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,10 +325,10 @@ 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)
|
|
328
|
+
.updateCharacteristic(Characteristic.LockPhysicalControls, this.lockPhysicalControls)
|
|
330
329
|
.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;
|
|
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
|
|
@@ -378,9 +377,9 @@ class DeviceAta extends EventEmitter {
|
|
|
378
377
|
this.targetOperationMode = 0;
|
|
379
378
|
break;
|
|
380
379
|
};
|
|
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];
|
|
380
|
+
this.operationModeSetPropsMinValue = 0
|
|
381
|
+
this.operationModeSetPropsMaxValue = modelSupportsAuto && modelSupportsHeat ? 3 : !modelSupportsAuto && modelSupportsHeat ? 2 : modelSupportsAuto && !modelSupportsHeat ? 3 : 2;
|
|
382
|
+
this.operationModeSetPropsValidValues = modelSupportsAuto && modelSupportsHeat ? [0, 1, 2, 3] : !modelSupportsAuto && modelSupportsHeat ? [0, 1, 2] : modelSupportsAuto && !modelSupportsHeat ? [0, 2, 3] : [0, 2];
|
|
384
383
|
|
|
385
384
|
//update characteristics
|
|
386
385
|
if (this.melCloudService) {
|
|
@@ -399,12 +398,9 @@ class DeviceAta extends EventEmitter {
|
|
|
399
398
|
this.roomTemperature = roomTemperature;
|
|
400
399
|
this.outdoorTemperature = outdoorTemperature;
|
|
401
400
|
this.setTemperature = setTemperature;
|
|
402
|
-
this.fanSpeed = fanSpeed;
|
|
403
401
|
this.setFanSpeed = setFanSpeed;
|
|
404
|
-
this.swingMode = swingMode;
|
|
405
402
|
this.vaneHorizontal = vaneHorizontal;
|
|
406
403
|
this.vaneVertical = vaneVertical;
|
|
407
|
-
this.lockPhysicalControls = lockPhysicalControls;
|
|
408
404
|
|
|
409
405
|
if (this.roomTemperatureSensorService) {
|
|
410
406
|
this.roomTemperatureSensorService
|
|
@@ -516,7 +512,7 @@ class DeviceAta extends EventEmitter {
|
|
|
516
512
|
button.state = power ? (setFanSpeed === 6) : false;
|
|
517
513
|
break;
|
|
518
514
|
case 37: //PHYSICAL LOCK CONTROLS ALL
|
|
519
|
-
button.state = (lockPhysicalControls === 1);
|
|
515
|
+
button.state = (this.lockPhysicalControls === 1);
|
|
520
516
|
break;
|
|
521
517
|
case 38: //PHYSICAL LOCK CONTROLS POWER
|
|
522
518
|
button.state = (prohibitPower === true);
|
|
@@ -573,19 +569,14 @@ class DeviceAta extends EventEmitter {
|
|
|
573
569
|
const info1 = displayMode === 0 ? this.emit('message', `Heating threshold temperature: ${setTemperature}${this.temperatureUnit}`) : false;
|
|
574
570
|
const info2 = displayMode === 0 ? this.emit('message', `Cooling threshold temperature: ${setTemperature}${this.temperatureUnit}`) : false;
|
|
575
571
|
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;
|
|
572
|
+
const info4 = swingFunction ? this.emit('message', `Vane swing mode: ${CONSTANTS.AirConditioner.AirDirection[this.swingMode ? 6 : 0]}`) : false;
|
|
577
573
|
this.emit('message', `Temperature display unit: ${this.temperatureUnit}`);
|
|
578
|
-
this.emit('message', `Lock physical controls: ${lockPhysicalControls ? 'LOCKED' : 'UNLOCKED'}`);
|
|
574
|
+
this.emit('message', `Lock physical controls: ${this.lockPhysicalControls ? 'LOCKED' : 'UNLOCKED'}`);
|
|
579
575
|
};
|
|
580
576
|
|
|
581
577
|
//start prepare accessory
|
|
582
578
|
if (this.startPrepareAccessory) {
|
|
583
579
|
try {
|
|
584
|
-
this.operationModeSetPropsMinValue = operationModeSetPropsMinValue;
|
|
585
|
-
this.operationModeSetPropsMaxValue = operationModeSetPropsMaxValue;
|
|
586
|
-
this.operationModeSetPropsValidValues = operationModeSetPropsValidValues;
|
|
587
|
-
this.fanSpeedSetPropsMaxValue = fanSpeedSetPropsMaxValue;
|
|
588
|
-
|
|
589
580
|
const accessory = await this.prepareAccessory(accountInfo, deviceState, deviceId, deviceTypeText, deviceName, accountName);
|
|
590
581
|
this.emit('publishAccessory', accessory);
|
|
591
582
|
this.startPrepareAccessory = false;
|