homebridge-melcloud-control 3.3.12-beta.9 → 3.3.13-beta.0

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/README.md CHANGED
@@ -164,8 +164,8 @@ Homebridge plugin for Air Conditioner, Heat Pump and Energy Recovery Ventilation
164
164
 
165
165
  ### AUTO Mode
166
166
 
167
- * The dead band between Heating and Cooling setpoint must be 2°C or greater.
168
- * If the room temperature `<` Heating Setpoint, the unit will be set to HEAT with a setpoint of 23°C.
167
+ * Here we can only set target temperature and the rest is calculated internally:
168
+ * If the room temperature `<` Heating Setpoint, the unit will be set to HEAT with a setpoint of 23°C.
169
169
  * In HEAT, if the room temperature `>` Heating Setpoint `+` 1°C, the unit will be set to FAN.
170
170
  * In FAN, if the room temperature `>` Cooling Setpoint, the unit will be set to COOL with a setpoint of 19°C.
171
171
  * In COOL, if the room temperature `<` Cooling Setpoint `-` 1°C, the unit will be set to FAN.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "displayName": "MELCloud Control",
3
3
  "name": "homebridge-melcloud-control",
4
- "version": "3.3.12-beta.9",
4
+ "version": "3.3.13-beta.0",
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
@@ -230,6 +230,12 @@ class DeviceAta extends EventEmitter {
230
230
  const modelSupportsHeat = this.heatDryFanMode >= 1 && modelSupportsHeat1;
231
231
  const modelSupportsDry = deviceData.Device.ModelSupportsDry ?? false;
232
232
  const modelSupportsCool = this.coolDryFanMode >= 1;
233
+ const minTempHeat = deviceData.Device.MinTempHeat ?? 10;
234
+ const maxTempHeat = deviceData.Device.MaxTempHeat ?? 31;
235
+ const minTempCoolDry = deviceData.Device.MinTempCoolDry ?? 16;
236
+ const maxTempCoolDry = deviceData.Device.MaxTempCoolDry ?? 31;
237
+ const minTempAutomatic = deviceData.Device.MinTempAutomatic ?? 16;
238
+ const maxTempAutomatic = deviceData.Device.MaxTempAutomatic ?? 31;
233
239
 
234
240
  //device state
235
241
  const power = deviceData.Device.Power ?? false;
@@ -252,7 +258,6 @@ class DeviceAta extends EventEmitter {
252
258
  const temperatureIncrement = deviceData.Device.TemperatureIncrement ?? 1;
253
259
  const outdoorTemperature = deviceData.Device.OutdoorTemperature;
254
260
 
255
- this.emit('message', `Target temp: ${setTemperature}`);
256
261
  //accessory
257
262
  this.accessory.presets = presetsOnServer;
258
263
  this.accessory.hasAutomaticFanSpeed = hasAutomaticFanSpeed;
@@ -265,6 +270,11 @@ class DeviceAta extends EventEmitter {
265
270
  this.accessory.modelSupportsHeat = modelSupportsHeat;
266
271
  this.accessory.modelSupportsDry = modelSupportsDry;
267
272
  this.accessory.modelSupportsCool = modelSupportsCool;
273
+ this.accessory.minTempHeat = minTempHeat;
274
+ this.accessory.maxTempHeat = maxTempHeat;
275
+ this.accessory.minTempCoolDry = minTempCoolDry;
276
+ this.accessory.maxTempCoolDry = dmaxTempCoolDry;
277
+
268
278
  this.accessory.power = power ? 1 : 0;
269
279
  this.accessory.inStandbyMode = inStandbyMode;
270
280
  this.accessory.operationMode = operationMode;
@@ -295,7 +305,7 @@ class DeviceAta extends EventEmitter {
295
305
  this.accessory.targetOperationMode = 1; //AUTO, HEAT, COOL
296
306
  break;
297
307
  case 2: //DRY
298
- this.accessory.currentOperationMode = roomTemperature < setTemperature ? 1 : 3;
308
+ this.accessory.currentOperationMode = 1;
299
309
  this.accessory.targetOperationMode = this.autoDryFanMode === 2 ? 0 : this.heatDryFanMode === 2 ? 1 : this.coolDryFanMode === 2 ? 2 : this.accessory.targetOperationMode;
300
310
  break;
301
311
  case 3: //COOL
@@ -307,19 +317,7 @@ class DeviceAta extends EventEmitter {
307
317
  this.accessory.targetOperationMode = this.autoDryFanMode === 3 ? 0 : this.heatDryFanMode === 3 ? 1 : this.coolDryFanMode === 3 ? 2 : this.accessory.targetOperationMode;
308
318
  break;
309
319
  case 8: //AUTO
310
- switch (this.accessory.currentOperationMode) {
311
- case 2: //HEATING
312
- const heatingToFan = roomTemperature > (defaultHeatingSetTemperature + 1);
313
- this.accessory.currentOperationMode = heatingToFan ? 1 : 2;
314
- break;
315
- case 3: //COOLING
316
- const coolingToFan = roomTemperature < (defaultCoolingSetTemperature - 1);
317
- this.accessory.currentOperationMode = coolingToFan ? 1 : 3;
318
- break;
319
- default: //FAN
320
- this.accessory.currentOperationMode = roomTemperature >= defaultHeatingSetTemperature && roomTemperature <= defaultCoolingSetTemperature ? 1 : roomTemperature < defaultHeatingSetTemperature ? 2 : roomTemperature > defaultCoolingSetTemperature ? 3 : 1;
321
- break;
322
- };
320
+ this.accessory.currentOperationMode = roomTemperature < setTemperature ? 2 : roomTemperature > setTemperature ? 3 : 1;
323
321
  this.accessory.targetOperationMode = 0;
324
322
  break;
325
323
  case 9: //ISEE HEAT
@@ -327,7 +325,7 @@ class DeviceAta extends EventEmitter {
327
325
  this.accessory.targetOperationMode = 1;
328
326
  break;
329
327
  case 10: //ISEE DRY
330
- this.accessory.currentOperationMode = roomTemperature < setTemperature ? 1 : 3;
328
+ this.accessory.currentOperationMode = 1;
331
329
  this.accessory.targetOperationMode = this.autoDryFanMode === 2 ? 0 : this.heatDryFanMode === 2 ? 1 : this.coolDryFanMode === 2 ? 2 : this.accessory.targetOperationMode;
332
330
  break;
333
331
  case 11: //ISEE COOL;
@@ -387,9 +385,9 @@ class DeviceAta extends EventEmitter {
387
385
  .updateCharacteristic(Characteristic.TargetHeaterCoolerState, this.accessory.targetOperationMode)
388
386
  .updateCharacteristic(Characteristic.CurrentTemperature, roomTemperature)
389
387
  .updateCharacteristic(Characteristic.LockPhysicalControls, this.accessory.lockPhysicalControl)
390
- .updateCharacteristic(Characteristic.TemperatureDisplayUnits, this.accessory.useFahrenheit);
391
- const updateDefHeat = modelSupportsHeat ? this.melCloudService.updateCharacteristic(Characteristic.HeatingThresholdTemperature, operationMode === 8 ? defaultHeatingSetTemperature : setTemperature) : false;
392
- const updateDefCool = modelSupportsCool ? this.melCloudService.updateCharacteristic(Characteristic.CoolingThresholdTemperature, operationMode === 8 ? defaultCoolingSetTemperature : setTemperature) : false;
388
+ .updateCharacteristic(Characteristic.TemperatureDisplayUnits, this.accessory.useFahrenheit)
389
+ .updateCharacteristic(Characteristic.CoolingThresholdTemperature, defaultCoolingSetTemperature);
390
+ const updateDefHeat = modelSupportsHeat ? this.melCloudService.updateCharacteristic(Characteristic.HeatingThresholdTemperature, defaultHeatingSetTemperature) : false;
393
391
  const updateRS = modelSupportsFanSpeed ? this.melCloudService.updateCharacteristic(Characteristic.RotationSpeed, this.accessory.fanSpeed) : false;
394
392
  const updateSM = swingFunction ? this.melCloudService.updateCharacteristic(Characteristic.SwingMode, this.accessory.swingMode) : false;
395
393
  };
@@ -401,48 +399,35 @@ class DeviceAta extends EventEmitter {
401
399
  case true:
402
400
  switch (operationMode) {
403
401
  case 1: //HEAT
404
- this.accessory.currentOperationMode = 1; //OFF, HEATING, COOLING
402
+ this.accessory.currentOperationMode = roomTemperature > setTemperature ? 0 : 1; //OFF, HEATING, COOLING
405
403
  this.accessory.targetOperationMode = 1; //OFF, HEAT, COOL, AUTO
406
404
  break;
407
405
  case 2: //DRY
408
- this.accessory.currentOperationMode = 2;
406
+ this.accessory.currentOperationMode = 0;
409
407
  this.accessory.targetOperationMode = this.autoDryFanMode === 2 ? 3 : this.heatDryFanMode === 2 ? 1 : this.coolDryFanMode === 2 ? 2 : this.accessory.targetOperationMode;
410
408
  break;
411
409
  case 3: //COOL
412
- this.accessory.currentOperationMode = 2;
410
+ this.accessory.currentOperationMode = roomTemperature < setTemperature ? 0 : 2;
413
411
  this.accessory.targetOperationMode = 2;
414
412
  break;
415
413
  case 7: //FAN
416
- this.accessory.currentOperationMode = 2;
414
+ this.accessory.currentOperationMode = 0;
417
415
  this.accessory.targetOperationMode = this.autoDryFanMode === 3 ? 3 : this.heatDryFanMode === 3 ? 1 : this.coolDryFanMode === 3 ? 2 : this.accessory.targetOperationMode;
418
416
  break;
419
417
  case 8: //AUTO
420
- const curentModeInAuto = roomTemperature < defaultHeatingSetTemperature ? 'HEATING' : roomTemperature > defaultCoolingSetTemperature ? 'COOLING' : '';
421
- switch (curentModeInAuto) {
422
- case 'HEATING': //HEATING
423
- const heatingToFan = roomTemperature > defaultHeatingSetTemperature + 1;
424
- this.accessory.currentOperationMode = heatingToFan ? 0 : 1;
425
- break;
426
- case 'COOLING': //COOLING
427
- const coolingToFan = roomTemperature < defaultCoolingSetTemperature - 1;
428
- this.accessory.currentOperationMode = cooling ? 0 : 2;
429
- break;
430
- default: //FAN
431
- this.accessory.currentOperationMode = roomTemperature <= defaultHeatingSetTemperature ? 1 : roomTemperature >= defaultCoolingSetTemperature ? 2 : 0;
432
- break;
433
- };
418
+ this.accessory.currentOperationMode = roomTemperature < setTemperature ? 1 : roomTemperature > setTemperature ? 2 : 0;
434
419
  this.accessory.targetOperationMode = 3;
435
420
  break;
436
421
  case 9: //ISEE HEAT
437
- this.accessory.currentOperationMode = 1
422
+ this.accessory.currentOperationMode = roomTemperature > setTemperature ? 0 : 1;
438
423
  this.accessory.targetOperationMode = 1;
439
424
  break;
440
425
  case 10: //ISEE DRY
441
- this.accessory.currentOperationMode = 2;
426
+ this.accessory.currentOperationMode = 0;
442
427
  this.accessory.targetOperationMode = this.autoDryFanMode === 2 ? 3 : this.heatDryFanMode === 2 ? 1 : this.coolDryFanMode === 2 ? 2 : this.accessory.targetOperationMode;
443
428
  break;
444
429
  case 11: //ISEE COOL;
445
- this.accessory.currentOperationMode = 2;
430
+ this.accessory.currentOperationMode = roomTemperature < setTemperature ? 0 : 2;
446
431
  this.accessory.targetOperationMode = 2;
447
432
  break;
448
433
  default:
@@ -470,8 +455,6 @@ class DeviceAta extends EventEmitter {
470
455
  .updateCharacteristic(Characteristic.CurrentTemperature, roomTemperature)
471
456
  .updateCharacteristic(Characteristic.TargetTemperature, setTemperature)
472
457
  .updateCharacteristic(Characteristic.TemperatureDisplayUnits, this.accessory.useFahrenheit);
473
- const updateDefHeat = modelSupportsAuto && modelSupportsHeat ? this.melCloudService.updateCharacteristic(Characteristic.HeatingThresholdTemperature, defaultHeatingSetTemperature) : false;
474
- const updateDefCool = modelSupportsAuto && modelSupportsCool ? this.melCloudService.updateCharacteristic(Characteristic.CoolingThresholdTemperature, defaultCoolingSetTemperature) : false;
475
458
  };
476
459
  break;
477
460
  };
@@ -638,11 +621,9 @@ class DeviceAta extends EventEmitter {
638
621
  this.emit('message', `Power: ${power ? 'ON' : 'OFF'}`);
639
622
  this.emit('message', `Target operation mode: ${CONSTANTS.AirConditioner.DriveMode[operationMode]}`);
640
623
  this.emit('message', `Current operation mode: ${this.displayMode === 1 ? CONSTANTS.AirConditioner.CurrentOperationModeHeatherCooler[this.accessory.currentOperationMode] : CONSTANTS.AirConditioner.CurrentOperationModeThermostat[this.accessory.currentOperationMode]}`);
641
- const info0 = operationMode !== 8 ? this.emit('message', `Target temperature: ${setTemperature}${this.accessory.temperatureUnit}`) : false;
624
+ this.emit('message', `Target temperature: ${setTemperature}${this.accessory.temperatureUnit}`);
642
625
  this.emit('message', `Current temperature: ${roomTemperature}${this.accessory.temperatureUnit}`);
643
- const info = hasOutdoorTemperature && deviceData.Device.OutdoorTemperature !== null ? this.emit('message', `Outdoor temperature: ${outdoorTemperature}${this.accessory.temperatureUnit}`) : false;
644
- const info1 = operationMode === 8 && modelSupportsHeat ? this.emit('message', `Heating threshold temperature: ${defaultHeatingSetTemperature}${this.accessory.temperatureUnit}`) : false;
645
- const info2 = operationMode === 8 && modelSupportsCool ? this.emit('message', `Cooling threshold temperature: ${defaultCoolingSetTemperature}${this.accessory.temperatureUnit}`) : false;
626
+ const info = hasOutdoorTemperature && outdoorTemperature !== null ? this.emit('message', `Outdoor temperature: ${outdoorTemperature}${this.accessory.temperatureUnit}`) : false;
646
627
  const info3 = modelSupportsFanSpeed ? this.emit('message', `Target fan speed: ${CONSTANTS.AirConditioner.FanSpeed[fanSpeed]}`) : false;
647
628
  const info4 = modelSupportsFanSpeed ? this.emit('message', `Current fan speed: ${CONSTANTS.AirConditioner.FanSpeed[actualFanSpeed]}`) : false;
648
629
  const info5 = vaneHorizontalDirection !== null ? this.emit('message', `Vane horizontal: ${CONSTANTS.AirConditioner.HorizontalVane[vaneHorizontalDirection]}`) : false;
@@ -927,57 +908,40 @@ class DeviceAta extends EventEmitter {
927
908
  };
928
909
  });
929
910
  };
930
- if (modelSupportsCool) {
931
- this.melCloudService.getCharacteristic(Characteristic.CoolingThresholdTemperature)
932
- .setProps({
933
- minValue: 16,
934
- maxValue: 31,
935
- minStep: this.accessory.temperatureIncrement
936
- })
937
- .onGet(async () => {
938
- const value = this.accessory.operationMode === 8 ? this.accessory.defaultCoolingSetTemperature : this.accessory.setTemperature;
939
- return value;
940
- })
941
- .onSet(async (value) => {
942
- try {
943
- switch (this.accessory.operationMode) {
944
- case 8: //AUTO - AUTO
945
- deviceData.Device.DefaultCoolingSetTemperature = value;
946
- break;
947
- default:
948
- deviceData.Device.SetTemperature = value;
949
- break
950
- };
951
- deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.SetTemperature;
952
- await this.melCloudAta.send(deviceData);
953
- const info = this.disableLogInfo ? false : this.emit('message', `Set cooling threshold temperature: ${value}${this.accessory.temperatureUnit}`);
954
- } catch (error) {
955
- this.emit('warn', `Set cooling threshold temperature error: ${error}`);
956
- };
957
- });
958
- };
911
+ this.melCloudService.getCharacteristic(Characteristic.CoolingThresholdTemperature)
912
+ .setProps({
913
+ minValue: this.accessory.minTempCoolDry,
914
+ maxValue: this.accessory.maxTempCoolDry,
915
+ minStep: this.accessory.temperatureIncrement
916
+ })
917
+ .onGet(async () => {
918
+ const value = this.accessory.defaultCoolingSetTemperature;
919
+ return value;
920
+ })
921
+ .onSet(async (value) => {
922
+ try {
923
+ deviceData.Device.DefaultCoolingSetTemperature = value;
924
+ deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.SetTemperature;
925
+ await this.melCloudAta.send(deviceData);
926
+ const info = this.disableLogInfo ? false : this.emit('message', `Set cooling threshold temperature: ${value}${this.accessory.temperatureUnit}`);
927
+ } catch (error) {
928
+ this.emit('warn', `Set cooling threshold temperature error: ${error}`);
929
+ };
930
+ });
959
931
  if (modelSupportsHeat) {
960
932
  this.melCloudService.getCharacteristic(Characteristic.HeatingThresholdTemperature)
961
933
  .setProps({
962
- minValue: 10,
963
- maxValue: 31,
934
+ minValue: this.accessory.minTempHeat,
935
+ maxValue: this.accessory.maxTempHeat,
964
936
  minStep: this.accessory.temperatureIncrement
965
937
  })
966
938
  .onGet(async () => {
967
- const value = this.accessory.operationMode === 8 ? this.accessory.defaultHeatingSetTemperature : this.accessory.setTemperature;
939
+ const value = this.accessory.defaultHeatingSetTemperature;
968
940
  return value;
969
941
  })
970
942
  .onSet(async (value) => {
971
943
  try {
972
- switch (this.accessory.operationMode) {
973
- case 8: //AUTO - AUTO
974
- deviceData.Device.DefaultHeatingSetTemperature = value;
975
- break;
976
- default:
977
- deviceData.Device.SetTemperature = value;
978
- break
979
- };
980
-
944
+ deviceData.Device.DefaultHeatingSetTemperature = value;
981
945
  deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.SetTemperature;
982
946
  await this.melCloudAta.send(deviceData);
983
947
  const info = this.disableLogInfo ? false : this.emit('message', `Set heating threshold temperature: ${value}${this.accessory.temperatureUnit}`);
@@ -1095,52 +1059,6 @@ class DeviceAta extends EventEmitter {
1095
1059
  this.emit('warn', `Set temperature error: ${error}`);
1096
1060
  };
1097
1061
  });
1098
- if (modelSupportsAuto) {
1099
- if (modelSupportsHeat) {
1100
- this.melCloudService.getCharacteristic(Characteristic.HeatingThresholdTemperature)
1101
- .setProps({
1102
- minValue: 10,
1103
- maxValue: 31,
1104
- minStep: this.accessory.temperatureIncrement
1105
- })
1106
- .onGet(async () => {
1107
- const value = this.accessory.defaultHeatingSetTemperature;
1108
- return value;
1109
- })
1110
- .onSet(async (value) => {
1111
- try {
1112
- deviceData.Device.DefaultHeatingSetTemperature = value;
1113
- deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.SetTemperature;
1114
- await this.melCloudAta.send(deviceData);
1115
- const info = this.disableLogInfo ? false : this.emit('message', `Set heating threshold temperature: ${value}${this.accessory.temperatureUnit}`);
1116
- } catch (error) {
1117
- this.emit('warn', `Set heating threshold temperature error: ${error}`);
1118
- };
1119
- });
1120
- };
1121
- if (modelSupportsCool) {
1122
- this.melCloudService.getCharacteristic(Characteristic.CoolingThresholdTemperature)
1123
- .setProps({
1124
- minValue: 16,
1125
- maxValue: 31,
1126
- minStep: this.accessory.temperatureIncrement
1127
- })
1128
- .onGet(async () => {
1129
- const value = this.accessory.defaultCoolingSetTemperature;
1130
- return value;
1131
- })
1132
- .onSet(async (value) => {
1133
- try {
1134
- deviceData.Device.DefaultCoolingSetTemperature = value;
1135
- deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.SetTemperature;
1136
- await this.melCloudAta.send(deviceData);
1137
- const info = this.disableLogInfo ? false : this.emit('message', `Set cooling threshold temperature: ${value}${this.accessory.temperatureUnit}`);
1138
- } catch (error) {
1139
- this.emit('warn', `Set cooling threshold temperature error: ${error}`);
1140
- };
1141
- });
1142
- };
1143
- };
1144
1062
  this.melCloudService.getCharacteristic(Characteristic.TemperatureDisplayUnits)
1145
1063
  .onGet(async () => {
1146
1064
  const value = this.accessory.useFahrenheit;
package/src/deviceatw.js CHANGED
@@ -421,8 +421,8 @@ class DeviceAtw extends EventEmitter {
421
421
  .updateCharacteristic(Characteristic.CurrentTemperature, roomTemperature)
422
422
  .updateCharacteristic(Characteristic.LockPhysicalControls, lockPhysicalControl)
423
423
  .updateCharacteristic(Characteristic.TemperatureDisplayUnits, this.accessory.useFahrenheit);
424
- const updateDefHeat = heatCoolModes === 0 || heatCoolModes === 1 ? this.melCloudServices[i].updateCharacteristic(Characteristic.HeatingThresholdTemperature, setTemperature) : false;
425
424
  const updateDefCool = heatCoolModes === 0 || heatCoolModes === 2 ? this.melCloudServices[i].updateCharacteristic(Characteristic.CoolingThresholdTemperature, setTemperature) : false;
425
+ const updateDefHeat = heatCoolModes === 0 || heatCoolModes === 1 ? this.melCloudServices[i].updateCharacteristic(Characteristic.HeatingThresholdTemperature, setTemperature) : false;
426
426
  }
427
427
  break;
428
428
  case 2: //Thermostat
@@ -1428,118 +1428,6 @@ class DeviceAtw extends EventEmitter {
1428
1428
  this.emit('warn', `${zoneName}, Set temperature error: ${error}`);
1429
1429
  };
1430
1430
  });
1431
- //only for heat/cool, only cool and not for hot water tank
1432
- if ((heatCoolModes === 0 || heatCoolModes === 2) && i !== caseHotWater) {
1433
- melCloudServiceT.getCharacteristic(Characteristic.CoolingThresholdTemperature)
1434
- .setProps({
1435
- minValue: this.accessory.zones[i].temperaturesSetPropsMinValue,
1436
- maxValue: this.accessory.zones[i].temperaturesSetPropsMaxValue,
1437
- minStep: this.accessory.temperatureIncrement
1438
- })
1439
- .onGet(async () => {
1440
- const value = this.accessory.zones[i].setTemperature;
1441
- return value;
1442
- })
1443
- .onSet(async (value) => {
1444
- try {
1445
- switch (i) {
1446
- case 0: //Heat Pump
1447
- //deviceData.Device.SetTemperatureZone1 = value;
1448
- //deviceData.Device.EffectiveFlags = CONSTANTS.HeatPump.EffectiveFlags.SetTemperatureZone1;
1449
- break;
1450
- case 1: //Zone 1
1451
- switch (this.accessory.operationModeZone1) {
1452
- case 1: //HEAT FLOW
1453
- deviceData.Device.SetHeatFlowTemperatureZone1 = value;
1454
- deviceData.Device.EffectiveFlags = CONSTANTS.HeatPump.EffectiveFlags.SetHeatFlowTemperatureZone1;
1455
- break;
1456
- case 4: //COOL FLOW
1457
- deviceData.Device.SetCoolFlowTemperatureZone1 = value;
1458
- deviceData.Device.EffectiveFlags = CONSTANTS.HeatPump.EffectiveFlags.SetCoolFlowTemperatureZone1;
1459
- break;
1460
- };
1461
- break;
1462
- case caseHotWater: //Hot Water
1463
- deviceData.Device.SetTankWaterTemperature = value;
1464
- deviceData.Device.EffectiveFlags = CONSTANTS.HeatPump.EffectiveFlags.SetTankWaterTemperature;
1465
- break;
1466
- case caseZone2: //Zone 2
1467
- switch (this.accessory.operationModeZone2) {
1468
- case 1: //HEAT FLOW
1469
- deviceData.Device.SetHeatFlowTemperatureZone2 = value;
1470
- deviceData.Device.EffectiveFlags = CONSTANTS.HeatPump.EffectiveFlags.SetHeatFlowTemperatureZone2;
1471
- break;
1472
- case 4: //COOL FLOW
1473
- deviceData.Device.SetCoolFlowTemperatureZone2 = value;
1474
- deviceData.Device.EffectiveFlags = CONSTANTS.HeatPump.EffectiveFlags.SetCoolFlowTemperatureZone2;
1475
- break;
1476
- };
1477
- break;
1478
- };
1479
-
1480
- const set = i > 0 ? await this.melCloudAtw.send(deviceData) : false;
1481
- const info = this.disableLogInfo || i === 0 ? false : this.emit('message', `${zoneName}, Set cooling threshold temperature: ${value}${this.accessory.temperatureUnit}`);
1482
- } catch (error) {
1483
- this.emit('warn', `${zoneName}, Set cooling threshold temperature error: ${error}`);
1484
- };
1485
- });
1486
- };
1487
- //device can heat/cool or only heat
1488
- if (heatCoolModes === 0 || heatCoolModes === 1) {
1489
- melCloudServiceT.getCharacteristic(Characteristic.HeatingThresholdTemperature)
1490
- .setProps({
1491
- minValue: this.accessory.zones[i].temperaturesSetPropsMinValue,
1492
- maxValue: this.accessory.zones[i].temperaturesSetPropsMaxValue,
1493
- minStep: this.accessory.temperatureIncrement
1494
- })
1495
- .onGet(async () => {
1496
- const value = this.accessory.zones[i].setTemperature;
1497
- return value;
1498
- })
1499
- .onSet(async (value) => {
1500
- try {
1501
- switch (i) {
1502
- case 0: //Heat Pump
1503
- //deviceData.Device.SetTemperatureZone1 = value;
1504
- //deviceData.Device.EffectiveFlags = CONSTANTS.HeatPump.EffectiveFlags.SetTemperatureZone1;
1505
- break;
1506
- case 1: //Zone 1
1507
- switch (this.accessory.operationModeZone1) {
1508
- case 1: //HEAT FLOW
1509
- deviceData.Device.SetHeatFlowTemperatureZone1 = value;
1510
- deviceData.Device.EffectiveFlags = CONSTANTS.HeatPump.EffectiveFlags.SetHeatFlowTemperatureZone1;
1511
- break;
1512
- case 4: //COOL FLOW
1513
- deviceData.Device.SetCoolFlowTemperatureZone1 = value;
1514
- deviceData.Device.EffectiveFlags = CONSTANTS.HeatPump.EffectiveFlags.SetCoolFlowTemperatureZone1;
1515
- break;
1516
- };
1517
- break;
1518
- case caseHotWater: //Hot Water
1519
- deviceData.Device.SetTankWaterTemperature = value;
1520
- deviceData.Device.EffectiveFlags = CONSTANTS.HeatPump.EffectiveFlags.SetTankWaterTemperature;
1521
- break;
1522
- case caseZone2: //Zone 2
1523
- switch (this.accessory.operationModeZone2) {
1524
- case 1: //HEAT FLOW
1525
- deviceData.Device.SetHeatFlowTemperatureZone2 = value;
1526
- deviceData.Device.EffectiveFlags = CONSTANTS.HeatPump.EffectiveFlags.SetHeatFlowTemperatureZone2;
1527
- break;
1528
- case 4: //COOL FLOW
1529
- deviceData.Device.SetCoolFlowTemperatureZone2 = value;
1530
- deviceData.Device.EffectiveFlags = CONSTANTS.HeatPump.EffectiveFlags.SetCoolFlowTemperatureZone2;
1531
- break;
1532
- };
1533
- break;
1534
- };
1535
-
1536
- const set = i > 0 ? await this.melCloudAtw.send(deviceData) : false;
1537
- const info = this.disableLogInfo || i === 0 ? false : this.emit('message', `${zoneName}, Set heating threshold temperature: ${value}${this.accessory.temperatureUnit}`);
1538
- } catch (error) {
1539
- this.emit('warn', `${zoneName}, Set heating threshold temperature error: ${error}`);
1540
- };
1541
- });
1542
- };
1543
1431
  melCloudServiceT.getCharacteristic(Characteristic.TemperatureDisplayUnits)
1544
1432
  .onGet(async () => {
1545
1433
  const value = this.accessory.useFahrenheit;
package/src/deviceerv.js CHANGED
@@ -354,8 +354,8 @@ class DeviceErv extends EventEmitter {
354
354
  .updateCharacteristic(Characteristic.RotationSpeed, this.accessory.fanSpeed)
355
355
  .updateCharacteristic(Characteristic.LockPhysicalControls, this.accessory.lockPhysicalControl)
356
356
  .updateCharacteristic(Characteristic.TemperatureDisplayUnits, this.accessory.useFahrenheit);
357
- const updateDefHeat = hasHeatOperationMode ? this.melCloudService.updateCharacteristic(Characteristic.HeatingThresholdTemperature, ventilationMode === 2 ? defaultHeatingSetTemperature : setTemperature) : false;
358
- const updateDefCool = hasCoolOperationMode ? this.melCloudService.updateCharacteristic(Characteristic.CoolingThresholdTemperature, ventilationMode === 2 ? defaultCoolingSetTemperature : setTemperature) : false;
357
+ const updateDefCool = hasCoolOperationMode ? this.melCloudService.updateCharacteristic(Characteristic.CoolingThresholdTemperature, setTemperature) : false;
358
+ const updateDefHeat = hasHeatOperationMode ? this.melCloudService.updateCharacteristic(Characteristic.HeatingThresholdTemperature, ventilationMode !== 2 ? 10 : setTemperature) : false;
359
359
  };
360
360
  break;
361
361
  case 2: //Thermostat
@@ -407,8 +407,6 @@ class DeviceErv extends EventEmitter {
407
407
  .updateCharacteristic(Characteristic.CurrentTemperature, roomTemperature)
408
408
  .updateCharacteristic(Characteristic.TargetTemperature, targetTemperature)
409
409
  .updateCharacteristic(Characteristic.TemperatureDisplayUnits, this.accessory.useFahrenheit);
410
- const updateDefHeat = hasAutoVentilationMode && hasHeatOperationMode ? this.melCloudService.updateCharacteristic(Characteristic.HeatingThresholdTemperature, defaultHeatingSetTemperature) : false;
411
- const updateDefCool = hasAutoVentilationMode && hasCoolOperationMode ? this.melCloudService.updateCharacteristic(Characteristic.CoolingThresholdTemperature, defaultCoolingSetTemperature) : false;
412
410
  };
413
411
  break;
414
412
  };
@@ -542,12 +540,10 @@ class DeviceErv extends EventEmitter {
542
540
  this.emit('message', `Power: ${power ? 'ON' : 'OFF'}`);
543
541
  this.emit('message', `Target ventilation mode: ${CONSTANTS.Ventilation.OperationMode[ventilationMode]}`);
544
542
  this.emit('message', `Current entilation mode: ${CONSTANTS.Ventilation.OperationMode[actualVentilationMode]}`);
543
+ this.emit('message', `Target temperature: ${targetTemperature}${this.accessory.temperatureUnit}`);
545
544
  this.emit('message', `Room temperature: ${roomTemperature}${this.accessory.temperatureUnit}`);
546
- const info = hasCoolOperationMode || hasHeatOperationMode ? this.emit('message', `Target temperature: ${targetTemperature}${this.accessory.temperatureUnit}`) : false;
547
545
  const info1 = hasSupplyTemperature && deviceData.Device.SupplyTemperature !== null ? this.emit('message', `Supply temperature: ${roomTemperature}${this.accessory.temperatureUnit}`) : false;
548
546
  const info2 = hasOutdoorTemperature && deviceData.Device.OutdoorTemperature !== null ? this.emit('message', `Outdoor temperature: ${roomTemperature}${this.accessory.temperatureUnit}`) : false;
549
- const info3 = ventilationMode === 2 && hasHeatOperationMode ? this.emit('message', `Heating threshold temperature: ${defaultHeatingSetTemperature}${this.accessory.temperatureUnit}`) : false;
550
- const info4 = ventilationMode === 2 && hasCoolOperationMode ? this.emit('message', `Cooling threshold temperature: ${defaultCoolingSetTemperature}${this.accessory.temperatureUnit}`) : false;
551
547
  this.emit('message', `Fan speed mode: ${CONSTANTS.Ventilation.FanSpeed[setFanSpeed]}`);
552
548
  this.emit('message', `Temperature display unit: ${this.accessory.temperatureUnit}`);
553
549
  this.emit('message', `Core maintenance: ${CONSTANTS.Ventilation.CoreMaintenance[coreMaintenanceRequired]}`);
@@ -802,22 +798,15 @@ class DeviceErv extends EventEmitter {
802
798
  minStep: this.accessory.temperatureIncrement
803
799
  })
804
800
  .onGet(async () => {
805
- const value = this.accessorydefaultCoolingSetTemperature;
801
+ const value = this.accessory.setTemperature;
806
802
  return value;
807
803
  })
808
804
  .onSet(async (value) => {
809
805
  try {
810
- switch (this.accessory.ventilationMode) {
811
- case 2: //AUTO - AUTO
812
- deviceData.Device.DefaultCoolingSetTemperature = value;
813
- break;
814
- default:
815
- deviceData.Device.SetTemperature = value;
816
- break
817
- };
818
- deviceData.Device.EffectiveFlags = CONSTANTS.Ventilation.EffectiveFlags.SetTemperature;
806
+ deviceData.Device.SetTemperature = value;
807
+ deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.SetTemperature;
819
808
  await this.melCloudErv.send(deviceData);
820
- const info = this.disableLogInfo ? false : this.emit('message', `Set cooling threshold temperature: ${value}${this.accessory.temperatureUnit}`);
809
+ const info = this.disableLogInfo ? false : this.emit('message', `Set temperature: ${value}${this.accessory.temperatureUnit}`);
821
810
  } catch (error) {
822
811
  this.emit('warn', `Set cooling threshold temperature error: ${error}`);
823
812
  };
@@ -832,22 +821,19 @@ class DeviceErv extends EventEmitter {
832
821
  minStep: this.accessory.temperatureIncrement
833
822
  })
834
823
  .onGet(async () => {
835
- const value = this.accessory.defaultHeatingSetTemperature;
824
+ const value = this.accessory.targetOperationMode !== 1 ? 10 : this.accessory.setTemperature;
836
825
  return value;
837
826
  })
838
827
  .onSet(async (value) => {
839
828
  try {
840
- switch (this.accessory.ventilationMode) {
841
- case 2: //AUTO - AUTO
842
- deviceData.Device.DefaultHeatingSetTemperature = value;
843
- break;
844
- default:
845
- deviceData.Device.SetTemperature = value;
846
- break
829
+ if (this.accessory.targetOperationMode !== 1) {
830
+ this.melCloudService.updateCharacteristic(Characteristic.HeatingThresholdTemperature, 10)
831
+ return;
847
832
  };
848
- deviceData.Device.EffectiveFlags = CONSTANTS.Ventilation.EffectiveFlags.SetTemperature;
833
+
834
+ deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.SetTemperature;
849
835
  await this.melCloudErv.send(deviceData);
850
- const info = this.disableLogInfo ? false : this.emit('message', `Set heating threshold temperature: ${value}${this.accessory.temperatureUnit}`);
836
+ const info = this.disableLogInfo ? false : this.emit('message', `Set temperature: ${value}${this.accessory.temperatureUnit}`);
851
837
  } catch (error) {
852
838
  this.emit('warn', `Set heating threshold temperature error: ${error}`);
853
839
  };
@@ -961,52 +947,6 @@ class DeviceErv extends EventEmitter {
961
947
  this.emit('warn', `Set temperature error: ${error}`);
962
948
  };
963
949
  });
964
- if (hasAutoVentilationMode) {
965
- if (hasHeatOperationMode) {
966
- this.melCloudService.getCharacteristic(Characteristic.HeatingThresholdTemperature)
967
- .setProps({
968
- minValue: 10,
969
- maxValue: 31,
970
- minStep: this.accessory.temperatureIncrement
971
- })
972
- .onGet(async () => {
973
- const value = this.accessory.defaultHeatingSetTemperature;
974
- return value;
975
- })
976
- .onSet(async (value) => {
977
- try {
978
- deviceData.Device.DefaultHeatingSetTemperature = value;
979
- deviceData.Device.EffectiveFlags = CONSTANTS.Ventilation.EffectiveFlags.SetTemperature;
980
- await this.melCloudErv.send(deviceData);
981
- const info = this.disableLogInfo ? false : this.emit('message', `Set heating threshold temperature: ${value}${this.accessory.temperatureUnit}`);
982
- } catch (error) {
983
- this.emit('warn', `Set heating threshold temperature error: ${error}`);
984
- };
985
- });
986
- };
987
- if (hasCoolOperationMode) {
988
- this.melCloudService.getCharacteristic(Characteristic.CoolingThresholdTemperature)
989
- .setProps({
990
- minValue: 16,
991
- maxValue: 31,
992
- minStep: this.accessory.temperatureIncrement
993
- })
994
- .onGet(async () => {
995
- const value = this.accessory.defaultCoolingSetTemperature;
996
- return value;
997
- })
998
- .onSet(async (value) => {
999
- try {
1000
- deviceData.Device.DefaultCoolingSetTemperature = value;
1001
- deviceData.Device.EffectiveFlags = CONSTANTS.Ventilation.EffectiveFlags.SetTemperature;
1002
- await this.melCloudErv.send(deviceData);
1003
- const info = this.disableLogInfo ? false : this.emit('message', `Set cooling threshold temperature: ${value}${this.accessory.temperatureUnit}`);
1004
- } catch (error) {
1005
- this.emit('warn', `Set cooling threshold temperature error: ${error}`);
1006
- };
1007
- });
1008
- };
1009
- };
1010
950
  this.melCloudService.getCharacteristic(Characteristic.TemperatureDisplayUnits)
1011
951
  .onGet(async () => {
1012
952
  const value = this.accessory.useFahrenheit;
@@ -370,34 +370,31 @@ class MelCloudAta extends EventEmitter {
370
370
  async send(deviceData) {
371
371
  try {
372
372
  //prevent to set out of range temp
373
- const minTempHeat = deviceData.Device.MinTempHeat ?? 10;
374
- const maxTempHeat = deviceData.Device.MaxTempHeat ?? 31;
375
- const minTempCoolDry = deviceData.Device.MinTempCoolDry ?? 16;
376
- const maxTempCoolDry = deviceData.Device.MaxTempCoolDry ?? 31;
377
- const minTempAutomatic = deviceData.Device.MinTempAutomatic ?? 16;
378
- const maxTempAutomatic = deviceData.Device.MaxTempAutomatic ?? 31;
379
-
380
-
381
373
  switch (deviceData.Device.OperationMode) {//operating mode 0, HEAT, DRY, COOL, 4, 5, 6, FAN, AUTO, ISEE HEAT, ISEE DRY, ISEE COOL
382
374
  case 1:
383
- deviceData.Device.SetTemperature = deviceData.Device.SetTemperature < minTempHeat ? minTempHeat : deviceData.Device.SetTemperature;
384
- deviceData.Device.SetTemperature = deviceData.Device.SetTemperature > maxTempHeat ? maxTempHeat : deviceData.Device.SetTemperature;
375
+ deviceData.Device.SetTemperature = deviceData.Device.DefaultHeatingSetTemperature;
385
376
  break;
386
377
  case 2:
387
- deviceData.Device.SetTemperature = deviceData.Device.SetTemperature < minTempCoolDry ? minTempCoolDry : deviceData.Device.SetTemperature;
388
- deviceData.Device.SetTemperature = deviceData.Device.SetTemperature > maxTempCoolDry ? maxTempCoolDry : deviceData.Device.SetTemperature;
378
+ deviceData.Device.SetTemperature = deviceData.Device.DefaultCoolingSetTemperature;
389
379
  break;
390
380
  case 3:
391
- deviceData.Device.SetTemperature = deviceData.Device.SetTemperature < minTempCoolDry ? minTempCoolDry : deviceData.Device.SetTemperature;
392
- deviceData.Device.SetTemperature = deviceData.Device.SetTemperature > maxTempCoolDry ? maxTempCoolDry : deviceData.Device.SetTemperature;
381
+ deviceData.Device.SetTemperature = deviceData.Device.DefaultCoolingSetTemperature;
393
382
  break;
394
383
  case 7:
395
- deviceData.Device.SetTemperature = deviceData.Device.SetTemperature < 10 ? 10 : deviceData.Device.SetTemperature;
396
- deviceData.Device.SetTemperature = deviceData.Device.SetTemperature > 31 ? 31 : deviceData.Device.SetTemperature;
384
+ deviceData.Device.SetTemperature = deviceData.Device.DefaultCoolingSetTemperature;
397
385
  break;
398
386
  case 8:
399
- deviceData.Device.SetTemperature = deviceData.Device.SetTemperature < minTempAutomatic ? minTempAutomatic : deviceData.Device.SetTemperature;
400
- deviceData.Device.SetTemperature = deviceData.Device.SetTemperature > maxTempAutomatic ? maxTempAutomatic : deviceData.Device.SetTemperature;
387
+ const setTemp = (deviceData.Device.DefaultCoolingSetTemperature + deviceData.Device.DefaultHeatingSetTemperature) / 2;
388
+ deviceData.Device.SetTemperature = setTemp;
389
+ break;
390
+ case 9:
391
+ deviceData.Device.SetTemperature = deviceData.Device.DefaultHeatingSetTemperature;
392
+ break;
393
+ case 10:
394
+ deviceData.Device.SetTemperature = deviceData.Device.DefaultCoolingSetTemperature;
395
+ break;
396
+ case 11:
397
+ deviceData.Device.SetTemperature = deviceData.Device.DefaultCoolingSetTemperature;
401
398
  break;
402
399
  default:
403
400
  this.emit('warn', `Trying to set nknown operating mode: ${deviceData.Device.OperationMode}`);
@@ -414,8 +411,8 @@ class MelCloudAta extends EventEmitter {
414
411
  OperationMode: deviceData.Device.OperationMode,
415
412
  VaneHorizontal: deviceData.Device.VaneHorizontalDirection,
416
413
  VaneVertical: deviceData.Device.VaneVerticalDirection,
417
- DefaultHeatingSetTemperature: deviceData.Device.DefaultHeatingSetTemperature,
418
- DefaultCoolingSetTemperature: deviceData.Device.DefaultCoolingSetTemperature,
414
+ DefaultHeatingSetTemperature: deviceData.Device.DefaultHeatingSetTemperature ?? 21,
415
+ DefaultCoolingSetTemperature: deviceData.Device.DefaultCoolingSetTemperature ?? 23,
419
416
  InStandbyMode: deviceData.Device.InStandbyMode,
420
417
  ProhibitSetTemperature: deviceData.Device.ProhibitSetTemperature,
421
418
  ProhibitOperationMode: deviceData.Device.ProhibitOperationMode,