homebridge-melcloud-control 2.3.0-beta.23 → 2.3.0-beta.24
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/config.schema.json +41 -6
- package/package.json +1 -1
- package/src/deviceata.js +116 -19
- package/src/melcloudata.js +7 -7
package/config.schema.json
CHANGED
|
@@ -205,7 +205,7 @@
|
|
|
205
205
|
"required": true
|
|
206
206
|
},
|
|
207
207
|
"ataDisplayMode": {
|
|
208
|
-
"title": "Control
|
|
208
|
+
"title": "Control",
|
|
209
209
|
"type": "integer",
|
|
210
210
|
"minimum": 0,
|
|
211
211
|
"maximum": 1,
|
|
@@ -224,11 +224,11 @@
|
|
|
224
224
|
]
|
|
225
225
|
}
|
|
226
226
|
],
|
|
227
|
-
"description": "Select main control mode.",
|
|
227
|
+
"description": "Select main control mode displayed in HomeKit app.",
|
|
228
228
|
"required": true
|
|
229
229
|
},
|
|
230
230
|
"ataHeatDryFanMode": {
|
|
231
|
-
"title": "Heat
|
|
231
|
+
"title": "Heat",
|
|
232
232
|
"type": "integer",
|
|
233
233
|
"minimum": 0,
|
|
234
234
|
"maximum": 3,
|
|
@@ -259,11 +259,46 @@
|
|
|
259
259
|
]
|
|
260
260
|
}
|
|
261
261
|
],
|
|
262
|
-
"description": "
|
|
262
|
+
"description": "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.",
|
|
263
|
+
"required": true
|
|
264
|
+
},
|
|
265
|
+
"ataCoolDryFanMode": {
|
|
266
|
+
"title": "Cool",
|
|
267
|
+
"type": "integer",
|
|
268
|
+
"minimum": 0,
|
|
269
|
+
"maximum": 3,
|
|
270
|
+
"default": 1,
|
|
271
|
+
"oneOf": [
|
|
272
|
+
{
|
|
273
|
+
"title": "None/Disabled",
|
|
274
|
+
"enum": [
|
|
275
|
+
0
|
|
276
|
+
]
|
|
277
|
+
},
|
|
278
|
+
{
|
|
279
|
+
"title": "Cool",
|
|
280
|
+
"enum": [
|
|
281
|
+
1
|
|
282
|
+
]
|
|
283
|
+
},
|
|
284
|
+
{
|
|
285
|
+
"title": "Dry",
|
|
286
|
+
"enum": [
|
|
287
|
+
2
|
|
288
|
+
]
|
|
289
|
+
},
|
|
290
|
+
{
|
|
291
|
+
"title": "Fan",
|
|
292
|
+
"enum": [
|
|
293
|
+
3
|
|
294
|
+
]
|
|
295
|
+
}
|
|
296
|
+
],
|
|
297
|
+
"description": "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.",
|
|
263
298
|
"required": true
|
|
264
299
|
},
|
|
265
300
|
"ataAutoDryFanMode": {
|
|
266
|
-
"title": "Auto
|
|
301
|
+
"title": "Auto",
|
|
267
302
|
"type": "integer",
|
|
268
303
|
"minimum": 0,
|
|
269
304
|
"maximum": 3,
|
|
@@ -294,7 +329,7 @@
|
|
|
294
329
|
]
|
|
295
330
|
}
|
|
296
331
|
],
|
|
297
|
-
"description": "
|
|
332
|
+
"description": "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.",
|
|
298
333
|
"required": true
|
|
299
334
|
},
|
|
300
335
|
"ataPresets": {
|
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.24",
|
|
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
|
@@ -22,6 +22,7 @@ class DeviceAta extends EventEmitter {
|
|
|
22
22
|
this.temperatureSensorOutdoor = account.ataTemperatureSensorOutdoor || false;
|
|
23
23
|
this.presetsEnabled = account.ataPresets || false;
|
|
24
24
|
this.heatDryFanMode = account.ataHeatDryFanMode || 1; //NONE, HEAT, DRY, FAN
|
|
25
|
+
this.coolDryFanMode = account.ataCoolDryFanMode || 1; //NONE, COOL, DRY, FAN
|
|
25
26
|
this.autoDryFanMode = account.ataAutoDryFanMode || 1; //NONE, AUTO, DRY, FAN
|
|
26
27
|
this.buttons = account.ataButtons || [];
|
|
27
28
|
this.disableLogInfo = account.disableLogInfo || false;
|
|
@@ -38,9 +39,8 @@ class DeviceAta extends EventEmitter {
|
|
|
38
39
|
const mqttEnabled = mqtt.enable || false;
|
|
39
40
|
this.mqttConnected = false;
|
|
40
41
|
|
|
41
|
-
//
|
|
42
|
+
//function
|
|
42
43
|
this.melCloud = melCloud; //function
|
|
43
|
-
this.startPrepareAccessory = true;
|
|
44
44
|
|
|
45
45
|
//buttons configured
|
|
46
46
|
this.buttonsConfigured = [];
|
|
@@ -63,6 +63,13 @@ class DeviceAta extends EventEmitter {
|
|
|
63
63
|
}
|
|
64
64
|
this.buttonsConfiguredCount = this.buttonsConfigured.length || 0;
|
|
65
65
|
|
|
66
|
+
//variables
|
|
67
|
+
this.startPrepareAccessory = true;
|
|
68
|
+
this.power = false;
|
|
69
|
+
this.offline = false;
|
|
70
|
+
this.currentOperationMode = 0;
|
|
71
|
+
this.targetOperationMode = 0;
|
|
72
|
+
|
|
66
73
|
//melcloud device
|
|
67
74
|
this.melCloudAta = new MelCloudAta({
|
|
68
75
|
contextKey: contextKey,
|
|
@@ -170,6 +177,7 @@ class DeviceAta extends EventEmitter {
|
|
|
170
177
|
const modelSupportsFanSpeed = deviceData.Device.ModelSupportsFanSpeed ?? false;
|
|
171
178
|
const modelSupportsHeat1 = deviceData.Device.ModelSupportsHeat ?? false;
|
|
172
179
|
const modelSupportsHeat = this.heatDryFanMode >= 1 && modelSupportsHeat1;
|
|
180
|
+
const modelSupportsCool = this.coolDryFanMode >= 1;
|
|
173
181
|
const modelSupportsAuto1 = deviceData.Device.ModelSupportsAuto ?? false;
|
|
174
182
|
const modelSupportsAuto = this.autoDryFanMode >= 1 && modelSupportsAuto1;
|
|
175
183
|
const modelSupportsDry = deviceData.Device.ModelSupportsDry ?? false;
|
|
@@ -209,8 +217,6 @@ class DeviceAta extends EventEmitter {
|
|
|
209
217
|
this.presetsCount = this.presetsEnabled ? presets.length : 0;
|
|
210
218
|
|
|
211
219
|
//operating mode
|
|
212
|
-
let currentOperationMode = 0;
|
|
213
|
-
let targetOperationMode = 0;
|
|
214
220
|
let fanSpeed = 0;
|
|
215
221
|
let swingMode = 0;
|
|
216
222
|
let lockPhysicalControls = 0;
|
|
@@ -223,8 +229,58 @@ class DeviceAta extends EventEmitter {
|
|
|
223
229
|
switch (displayMode) {
|
|
224
230
|
case 0: //Heater Cooler
|
|
225
231
|
//operating mode 0, HEAT, DRY, COOL, 4, 5, 6, FAN, AUTO, ISEE HEAT, ISEE DRY, ISEE COOL
|
|
226
|
-
|
|
227
|
-
|
|
232
|
+
switch (power) {
|
|
233
|
+
case true:
|
|
234
|
+
switch (!inStandbyMode) {
|
|
235
|
+
case true:
|
|
236
|
+
switch (operationMode) {
|
|
237
|
+
case 1: //HEAT
|
|
238
|
+
this.currentOperationMode = 2; //INACTIVE, IDLE, HEATING, COOLING
|
|
239
|
+
this.targetOperationMode = 1; //AUTO, HEAT, COOL
|
|
240
|
+
break;
|
|
241
|
+
case 2: //DRY
|
|
242
|
+
this.currentOperationMode = 3;
|
|
243
|
+
this.targetOperationMode = 2;
|
|
244
|
+
break;
|
|
245
|
+
case 3: //COOL
|
|
246
|
+
this.currentOperationMode = 3;
|
|
247
|
+
this.targetOperationMode = 2;
|
|
248
|
+
break;
|
|
249
|
+
case 7: //FAN
|
|
250
|
+
this.currentOperationMode = 3;
|
|
251
|
+
this.targetOperationMode = 2;
|
|
252
|
+
break;
|
|
253
|
+
case 8: //AUTO
|
|
254
|
+
this.currentOperationMode = setTemperature < roomTemperature ? 3 : 2;
|
|
255
|
+
this.targetOperationMode = 0;
|
|
256
|
+
break;
|
|
257
|
+
case 9: //ISEE HEAT
|
|
258
|
+
this.currentOperationMode = 2
|
|
259
|
+
this.targetOperationMode = 1;
|
|
260
|
+
break;
|
|
261
|
+
case 10: //ISEE DRY
|
|
262
|
+
this.currentOperationMode = 3;
|
|
263
|
+
this.targetOperationMode = 2;
|
|
264
|
+
break;
|
|
265
|
+
case 11: //ISEE COOL;
|
|
266
|
+
this.currentOperationMode = 3;
|
|
267
|
+
this.targetOperationMode = 2;
|
|
268
|
+
break;
|
|
269
|
+
default:
|
|
270
|
+
this.emit('warn', `Unknown operating mode: ${operationMode}`);
|
|
271
|
+
break;
|
|
272
|
+
};
|
|
273
|
+
break;
|
|
274
|
+
case false:
|
|
275
|
+
this.currentOperationMode = 1;
|
|
276
|
+
break;
|
|
277
|
+
};
|
|
278
|
+
break;
|
|
279
|
+
case false:
|
|
280
|
+
this.currentOperationMode = 0;
|
|
281
|
+
this.targetOperationMode = 0;
|
|
282
|
+
break;
|
|
283
|
+
};
|
|
228
284
|
operationModeSetPropsMinValue = modelSupportsAuto && modelSupportsHeat ? 0 : !modelSupportsAuto && modelSupportsHeat ? 1 : modelSupportsAuto && !modelSupportsHeat ? 0 : 2;
|
|
229
285
|
operationModeSetPropsMaxValue = 2
|
|
230
286
|
operationModeSetPropsValidValues = modelSupportsAuto && modelSupportsHeat ? [0, 1, 2] : !modelSupportsAuto && modelSupportsHeat ? [1, 2] : modelSupportsAuto && !modelSupportsHeat ? [0, 2] : [2];
|
|
@@ -265,8 +321,8 @@ class DeviceAta extends EventEmitter {
|
|
|
265
321
|
if (this.melCloudService) {
|
|
266
322
|
this.melCloudService
|
|
267
323
|
.updateCharacteristic(Characteristic.Active, power)
|
|
268
|
-
.updateCharacteristic(Characteristic.CurrentHeaterCoolerState, currentOperationMode)
|
|
269
|
-
.updateCharacteristic(Characteristic.TargetHeaterCoolerState, targetOperationMode)
|
|
324
|
+
.updateCharacteristic(Characteristic.CurrentHeaterCoolerState, this.currentOperationMode)
|
|
325
|
+
.updateCharacteristic(Characteristic.TargetHeaterCoolerState, this.targetOperationMode)
|
|
270
326
|
.updateCharacteristic(Characteristic.CurrentTemperature, roomTemperature)
|
|
271
327
|
.updateCharacteristic(Characteristic.HeatingThresholdTemperature, setTemperature)
|
|
272
328
|
.updateCharacteristic(Characteristic.CoolingThresholdTemperature, setTemperature)
|
|
@@ -277,9 +333,51 @@ class DeviceAta extends EventEmitter {
|
|
|
277
333
|
};
|
|
278
334
|
break;
|
|
279
335
|
case 1: //Thermostat
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
336
|
+
switch (power && !inStandbyMode) {
|
|
337
|
+
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;
|
|
370
|
+
break;
|
|
371
|
+
default:
|
|
372
|
+
this.emit('warn', `Unknown operating mode: ${operationMode}`);
|
|
373
|
+
break;
|
|
374
|
+
};
|
|
375
|
+
break;
|
|
376
|
+
case false:
|
|
377
|
+
this.currentOperationMode = 0;
|
|
378
|
+
this.targetOperationMode = 0;
|
|
379
|
+
break;
|
|
380
|
+
};
|
|
283
381
|
operationModeSetPropsMinValue = 0
|
|
284
382
|
operationModeSetPropsMaxValue = modelSupportsAuto && modelSupportsHeat ? 3 : !modelSupportsAuto && modelSupportsHeat ? 2 : modelSupportsAuto && !modelSupportsHeat ? 3 : 2;
|
|
285
383
|
operationModeSetPropsValidValues = modelSupportsAuto && modelSupportsHeat ? [0, 1, 2, 3] : !modelSupportsAuto && modelSupportsHeat ? [0, 1, 2] : modelSupportsAuto && !modelSupportsHeat ? [0, 2, 3] : [0, 2];
|
|
@@ -287,8 +385,8 @@ class DeviceAta extends EventEmitter {
|
|
|
287
385
|
//update characteristics
|
|
288
386
|
if (this.melCloudService) {
|
|
289
387
|
this.melCloudService
|
|
290
|
-
.updateCharacteristic(Characteristic.CurrentHeatingCoolingState, currentOperationMode)
|
|
291
|
-
.updateCharacteristic(Characteristic.TargetHeatingCoolingState, targetOperationMode)
|
|
388
|
+
.updateCharacteristic(Characteristic.CurrentHeatingCoolingState, this.currentOperationMode)
|
|
389
|
+
.updateCharacteristic(Characteristic.TargetHeatingCoolingState, this.targetOperationMode)
|
|
292
390
|
.updateCharacteristic(Characteristic.CurrentTemperature, roomTemperature)
|
|
293
391
|
.updateCharacteristic(Characteristic.TargetTemperature, setTemperature)
|
|
294
392
|
.updateCharacteristic(Characteristic.TemperatureDisplayUnits, useFahrenheit);
|
|
@@ -298,8 +396,6 @@ class DeviceAta extends EventEmitter {
|
|
|
298
396
|
|
|
299
397
|
this.power = power;
|
|
300
398
|
this.offline = offline;
|
|
301
|
-
this.currentOperationMode = currentOperationMode;
|
|
302
|
-
this.targetOperationMode = targetOperationMode;
|
|
303
399
|
this.roomTemperature = roomTemperature;
|
|
304
400
|
this.outdoorTemperature = outdoorTemperature;
|
|
305
401
|
this.setTemperature = setTemperature;
|
|
@@ -623,8 +719,9 @@ class DeviceAta extends EventEmitter {
|
|
|
623
719
|
const numberOfFanSpeeds = this.numberOfFanSpeeds;
|
|
624
720
|
const swingFunction = this.swingFunction;
|
|
625
721
|
const hasOutdoorTemperature = this.hasOutdoorTemperature;
|
|
626
|
-
const heatDryFanMode = [deviceState.OperationMode,
|
|
627
|
-
const
|
|
722
|
+
const heatDryFanMode = [deviceState.OperationMode, 1, modelSupportsDry ? 2 : deviceState.OperationMode, 7][this.heatDryFanMode]; //NONE, HEAT - 1, DRY - 2, FAN - 7
|
|
723
|
+
const coolDryFanMode = [deviceState.OperationMode, 3, modelSupportsDry ? 2 : deviceState.OperationMode, 7][this.heatDryFanMode]; //NONE, COOL - 1, DRY - 2, FAN - 7
|
|
724
|
+
const autoDryFanMode = [deviceState.OperationMode, 8, modelSupportsDry ? 2 : deviceState.OperationMode, 7][this.autoDryFanMode]; //NONE, AUTO - 8, DRY - 2, FAN - 7
|
|
628
725
|
const serviceName = `${deviceTypeText} ${accessoryName}`;
|
|
629
726
|
|
|
630
727
|
switch (displayMode) {
|
|
@@ -677,7 +774,7 @@ class DeviceAta extends EventEmitter {
|
|
|
677
774
|
break;
|
|
678
775
|
case 2: //COOL - COOL
|
|
679
776
|
deviceState.Power = true;
|
|
680
|
-
deviceState.OperationMode =
|
|
777
|
+
deviceState.OperationMode = coolDryFanMode;
|
|
681
778
|
deviceState.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Power + CONSTANTS.AirConditioner.EffectiveFlags.OperationMode;
|
|
682
779
|
break;
|
|
683
780
|
};
|
|
@@ -872,7 +969,7 @@ class DeviceAta extends EventEmitter {
|
|
|
872
969
|
break;
|
|
873
970
|
case 2: //COOL - COOL
|
|
874
971
|
deviceState.Power = true;
|
|
875
|
-
deviceState.OperationMode =
|
|
972
|
+
deviceState.OperationMode = coolDryFanMode;
|
|
876
973
|
deviceState.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.Power + CONSTANTS.AirConditioner.EffectiveFlags.OperationMode;
|
|
877
974
|
break;
|
|
878
975
|
case 3: //AUTO - AUTO
|
package/src/melcloudata.js
CHANGED
|
@@ -14,7 +14,7 @@ class MelCloudAta extends EventEmitter {
|
|
|
14
14
|
const accountInfoFile = config.accountInfoFile;
|
|
15
15
|
const deviceInfoFile = config.deviceInfoFile;
|
|
16
16
|
const debugLog = config.debugLog;
|
|
17
|
-
const refreshInterval= config.refreshInterval;
|
|
17
|
+
const refreshInterval = config.refreshInterval;
|
|
18
18
|
|
|
19
19
|
//set default values
|
|
20
20
|
this.deviceData = {};
|
|
@@ -127,13 +127,13 @@ class MelCloudAta extends EventEmitter {
|
|
|
127
127
|
const legacyDevice = device.LegacyDevice;
|
|
128
128
|
const unitSupportsStandbyMode = device.UnitSupportsStandbyMode;
|
|
129
129
|
const isSplitSystem = device.IsSplitSystem;
|
|
130
|
-
const hasHalfDegreeIncrements = device.HasHalfDegreeIncrements
|
|
131
|
-
const hasOutdoorTemperature = device.HasOutdoorTemperature
|
|
130
|
+
const hasHalfDegreeIncrements = device.HasHalfDegreeIncrements;
|
|
131
|
+
const hasOutdoorTemperature = device.HasOutdoorTemperature;
|
|
132
132
|
const modelIsAirCurtain = device.ModelIsAirCurtain;
|
|
133
|
-
const modelSupportsFanSpeed = device.ModelSupportsFanSpeed
|
|
134
|
-
const modelSupportsAuto = device.ModelSupportsAuto
|
|
135
|
-
const modelSupportsHeat = device.ModelSupportsHeat
|
|
136
|
-
const modelSupportsDry = device.ModelSupportsDry
|
|
133
|
+
const modelSupportsFanSpeed = device.ModelSupportsFanSpeed;
|
|
134
|
+
const modelSupportsAuto = device.ModelSupportsAuto;
|
|
135
|
+
const modelSupportsHeat = device.ModelSupportsHeat;
|
|
136
|
+
const modelSupportsDry = device.ModelSupportsDry;
|
|
137
137
|
const modelSupportsVaneVertical = device.ModelSupportsVaneVertical;
|
|
138
138
|
const modelSupportsVaneHorizontal = device.ModelSupportsVaneHorizontal;
|
|
139
139
|
const modelSupportsWideVane = device.ModelSupportsWideVane;
|