homebridge-melcloud-control 2.3.0-beta.22 → 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/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`, `ataDisableAutoMode`
29
+ - added to config.json `ataHeatDryFanMode`, `ataAutoDryFanMode`
30
30
  - added [#132](https://github.com/grzegorz914/homebridge-melcloud-control/issues/132)
31
31
  - cleanup
32
32
  - config schema updated
@@ -205,7 +205,7 @@
205
205
  "required": true
206
206
  },
207
207
  "ataDisplayMode": {
208
- "title": "Control Mode",
208
+ "title": "Control",
209
209
  "type": "integer",
210
210
  "minimum": 0,
211
211
  "maximum": 1,
@@ -224,32 +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
- "ataTemperatureSensor": {
231
- "title": "Temperature Sensor Room",
232
- "type": "boolean",
233
- "default": false,
234
- "description": "This enable extra room temperature sensor to use with automations in HomeKit app.",
235
- "required": false
236
- },
237
- "ataTemperatureSensorOutdoor": {
238
- "title": "Temperature Sensor Outdoor",
239
- "type": "boolean",
240
- "default": false,
241
- "description": "This enable extra outdoor temperature sensor to use with automations in HomeKit app.",
242
- "required": false
243
- },
244
- "ataPresets": {
245
- "title": "Presets",
246
- "type": "boolean",
247
- "default": false,
248
- "description": "This enable extra buttons for configured presets and display it in HomeKit app.",
249
- "required": false
250
- },
251
230
  "ataHeatDryFanMode": {
252
- "title": "Heat Mode",
231
+ "title": "Heat",
253
232
  "type": "integer",
254
233
  "minimum": 0,
255
234
  "maximum": 3,
@@ -280,11 +259,46 @@
280
259
  ]
281
260
  }
282
261
  ],
283
- "description": "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.",
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.",
284
298
  "required": true
285
299
  },
286
300
  "ataAutoDryFanMode": {
287
- "title": "Auto Mode",
301
+ "title": "Auto",
288
302
  "type": "integer",
289
303
  "minimum": 0,
290
304
  "maximum": 3,
@@ -315,9 +329,30 @@
315
329
  ]
316
330
  }
317
331
  ],
318
- "description": "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.",
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.",
319
333
  "required": true
320
334
  },
335
+ "ataPresets": {
336
+ "title": "Presets",
337
+ "type": "boolean",
338
+ "default": false,
339
+ "description": "This enable extra buttons for configured presets and display it in HomeKit app.",
340
+ "required": false
341
+ },
342
+ "ataTemperatureSensor": {
343
+ "title": "Room",
344
+ "type": "boolean",
345
+ "default": false,
346
+ "description": "This enable extra room temperature sensor to use with automations in HomeKit app.",
347
+ "required": false
348
+ },
349
+ "ataTemperatureSensorOutdoor": {
350
+ "title": "Outdoor",
351
+ "type": "boolean",
352
+ "default": false,
353
+ "description": "This enable extra outdoor temperature sensor to use with automations in HomeKit app.",
354
+ "required": false
355
+ },
321
356
  "ataButtons": {
322
357
  "title": "Button / Sensor",
323
358
  "type": "array",
@@ -1394,9 +1429,9 @@
1394
1429
  "title": "Air Conditioner",
1395
1430
  "items": [
1396
1431
  "accounts[].ataDisplayMode",
1397
- "accounts[].ataPresets",
1398
1432
  "accounts[].ataHeatDryFanMode",
1399
1433
  "accounts[].ataAutoDryFanMode",
1434
+ "accounts[].ataPresets",
1400
1435
  {
1401
1436
  "key": "accounts[]",
1402
1437
  "type": "section",
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.22",
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
- //variables
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
- currentOperationMode = !power ? 0 : inStandbyMode ? 1 : [0, 2, 3, 3, 1, 1, 1, 1, (setTemperature < roomTemperature) ? 3 : 2, 2, 1, 3][operationMode]; //INACTIVE, IDLE, HEATING, COOLING
227
- targetOperationMode = [operationMode, 1, [1, 1, 1, 1][this.heatDryFanMode], 2, 2, 2, 2, [0, 0, 0, 0][this.autoDryFanMode], 0, 1, 1, 2][operationMode]; //AUTO, HEAT, COOL
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
- //operating mode 0, HEAT, DRY, COOL, 4, 5, 6, FAN, AUTO, ISEE HEAT, ISEE DRY, ISEE COOL
281
- currentOperationMode = !power || inStandbyMode ? 0 : [0, 1, 2, 2, 2, 2, 2, 2, (setTemperature < roomTemperature) ? 2 : 1, 1, 1, 2][operationMode]; //OFF, HEAT, COOL
282
- targetOperationMode = !power || inStandbyMode ? 0 : [0, 1, [1, 1, 1, 1][this.heatDryFanMode], 2, 2, 2, 2, [3, 3, 3, 3][this.autoDryFanMode], 3, 1, 1, 2][operationMode]; //OFF, HEAT, COOL, AUTO
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, 8, modelSupportsDry ? 2 : deviceState.OperationMode, 7][this.heatDryFanMode]; //NONE, HEAT - 1, DRY - 2, FAN - 7
627
- const autoDryFanMode = [deviceState.OperationMode, 1, modelSupportsDry ? 2 : deviceState.OperationMode, 7][this.autoDryFanMode]; //NONE, AUTO - 8, DRY - 2, FAN - 7
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 = 3;
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 = 3;
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
@@ -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 ?? false;
131
- const hasOutdoorTemperature = device.HasOutdoorTemperature ?? false
130
+ const hasHalfDegreeIncrements = device.HasHalfDegreeIncrements;
131
+ const hasOutdoorTemperature = device.HasOutdoorTemperature;
132
132
  const modelIsAirCurtain = device.ModelIsAirCurtain;
133
- const modelSupportsFanSpeed = device.ModelSupportsFanSpeed ?? false;
134
- const modelSupportsAuto = device.ModelSupportsAuto ?? false;
135
- const modelSupportsHeat = device.ModelSupportsHeat ?? false;
136
- const modelSupportsDry = device.ModelSupportsDry ?? false;
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;