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

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.12",
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
@@ -252,7 +252,6 @@ class DeviceAta extends EventEmitter {
252
252
  const temperatureIncrement = deviceData.Device.TemperatureIncrement ?? 1;
253
253
  const outdoorTemperature = deviceData.Device.OutdoorTemperature;
254
254
 
255
- this.emit('message', `Target temp: ${setTemperature}`);
256
255
  //accessory
257
256
  this.accessory.presets = presetsOnServer;
258
257
  this.accessory.hasAutomaticFanSpeed = hasAutomaticFanSpeed;
@@ -295,7 +294,7 @@ class DeviceAta extends EventEmitter {
295
294
  this.accessory.targetOperationMode = 1; //AUTO, HEAT, COOL
296
295
  break;
297
296
  case 2: //DRY
298
- this.accessory.currentOperationMode = roomTemperature < setTemperature ? 1 : 3;
297
+ this.accessory.currentOperationMode = 1;
299
298
  this.accessory.targetOperationMode = this.autoDryFanMode === 2 ? 0 : this.heatDryFanMode === 2 ? 1 : this.coolDryFanMode === 2 ? 2 : this.accessory.targetOperationMode;
300
299
  break;
301
300
  case 3: //COOL
@@ -307,19 +306,7 @@ class DeviceAta extends EventEmitter {
307
306
  this.accessory.targetOperationMode = this.autoDryFanMode === 3 ? 0 : this.heatDryFanMode === 3 ? 1 : this.coolDryFanMode === 3 ? 2 : this.accessory.targetOperationMode;
308
307
  break;
309
308
  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
- };
309
+ this.accessory.currentOperationMode = roomTemperature < setTemperature ? 2 : roomTemperature > setTemperature ? 3 : 1;
323
310
  this.accessory.targetOperationMode = 0;
324
311
  break;
325
312
  case 9: //ISEE HEAT
@@ -327,7 +314,7 @@ class DeviceAta extends EventEmitter {
327
314
  this.accessory.targetOperationMode = 1;
328
315
  break;
329
316
  case 10: //ISEE DRY
330
- this.accessory.currentOperationMode = roomTemperature < setTemperature ? 1 : 3;
317
+ this.accessory.currentOperationMode = 1;
331
318
  this.accessory.targetOperationMode = this.autoDryFanMode === 2 ? 0 : this.heatDryFanMode === 2 ? 1 : this.coolDryFanMode === 2 ? 2 : this.accessory.targetOperationMode;
332
319
  break;
333
320
  case 11: //ISEE COOL;
@@ -387,9 +374,9 @@ class DeviceAta extends EventEmitter {
387
374
  .updateCharacteristic(Characteristic.TargetHeaterCoolerState, this.accessory.targetOperationMode)
388
375
  .updateCharacteristic(Characteristic.CurrentTemperature, roomTemperature)
389
376
  .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;
377
+ .updateCharacteristic(Characteristic.TemperatureDisplayUnits, this.accessory.useFahrenheit)
378
+ .updateCharacteristic(Characteristic.CoolingThresholdTemperature, setTemperature);
379
+ const updateDefHeat = modelSupportsHeat ? this.melCloudService.updateCharacteristic(Characteristic.HeatingThresholdTemperature, this.accessory.targetOperationMode !== 1 ? 10 : setTemperature) : false;
393
380
  const updateRS = modelSupportsFanSpeed ? this.melCloudService.updateCharacteristic(Characteristic.RotationSpeed, this.accessory.fanSpeed) : false;
394
381
  const updateSM = swingFunction ? this.melCloudService.updateCharacteristic(Characteristic.SwingMode, this.accessory.swingMode) : false;
395
382
  };
@@ -401,48 +388,35 @@ class DeviceAta extends EventEmitter {
401
388
  case true:
402
389
  switch (operationMode) {
403
390
  case 1: //HEAT
404
- this.accessory.currentOperationMode = 1; //OFF, HEATING, COOLING
391
+ this.accessory.currentOperationMode = roomTemperature > setTemperature ? 0 : 1; //OFF, HEATING, COOLING
405
392
  this.accessory.targetOperationMode = 1; //OFF, HEAT, COOL, AUTO
406
393
  break;
407
394
  case 2: //DRY
408
- this.accessory.currentOperationMode = 2;
395
+ this.accessory.currentOperationMode = 0;
409
396
  this.accessory.targetOperationMode = this.autoDryFanMode === 2 ? 3 : this.heatDryFanMode === 2 ? 1 : this.coolDryFanMode === 2 ? 2 : this.accessory.targetOperationMode;
410
397
  break;
411
398
  case 3: //COOL
412
- this.accessory.currentOperationMode = 2;
399
+ this.accessory.currentOperationMode = roomTemperature < setTemperature ? 0 : 2;
413
400
  this.accessory.targetOperationMode = 2;
414
401
  break;
415
402
  case 7: //FAN
416
- this.accessory.currentOperationMode = 2;
403
+ this.accessory.currentOperationMode = 0;
417
404
  this.accessory.targetOperationMode = this.autoDryFanMode === 3 ? 3 : this.heatDryFanMode === 3 ? 1 : this.coolDryFanMode === 3 ? 2 : this.accessory.targetOperationMode;
418
405
  break;
419
406
  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
- };
407
+ this.accessory.currentOperationMode = roomTemperature < setTemperature ? 1 : roomTemperature > setTemperature ? 2 : 0;
434
408
  this.accessory.targetOperationMode = 3;
435
409
  break;
436
410
  case 9: //ISEE HEAT
437
- this.accessory.currentOperationMode = 1
411
+ this.accessory.currentOperationMode = roomTemperature > setTemperature ? 0 : 1;
438
412
  this.accessory.targetOperationMode = 1;
439
413
  break;
440
414
  case 10: //ISEE DRY
441
- this.accessory.currentOperationMode = 2;
415
+ this.accessory.currentOperationMode = 0;
442
416
  this.accessory.targetOperationMode = this.autoDryFanMode === 2 ? 3 : this.heatDryFanMode === 2 ? 1 : this.coolDryFanMode === 2 ? 2 : this.accessory.targetOperationMode;
443
417
  break;
444
418
  case 11: //ISEE COOL;
445
- this.accessory.currentOperationMode = 2;
419
+ this.accessory.currentOperationMode = roomTemperature < setTemperature ? 0 : 2;
446
420
  this.accessory.targetOperationMode = 2;
447
421
  break;
448
422
  default:
@@ -470,8 +444,6 @@ class DeviceAta extends EventEmitter {
470
444
  .updateCharacteristic(Characteristic.CurrentTemperature, roomTemperature)
471
445
  .updateCharacteristic(Characteristic.TargetTemperature, setTemperature)
472
446
  .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
447
  };
476
448
  break;
477
449
  };
@@ -638,11 +610,9 @@ class DeviceAta extends EventEmitter {
638
610
  this.emit('message', `Power: ${power ? 'ON' : 'OFF'}`);
639
611
  this.emit('message', `Target operation mode: ${CONSTANTS.AirConditioner.DriveMode[operationMode]}`);
640
612
  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;
613
+ this.emit('message', `Target temperature: ${setTemperature}${this.accessory.temperatureUnit}`);
642
614
  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;
615
+ const info = hasOutdoorTemperature && outdoorTemperature !== null ? this.emit('message', `Outdoor temperature: ${outdoorTemperature}${this.accessory.temperatureUnit}`) : false;
646
616
  const info3 = modelSupportsFanSpeed ? this.emit('message', `Target fan speed: ${CONSTANTS.AirConditioner.FanSpeed[fanSpeed]}`) : false;
647
617
  const info4 = modelSupportsFanSpeed ? this.emit('message', `Current fan speed: ${CONSTANTS.AirConditioner.FanSpeed[actualFanSpeed]}`) : false;
648
618
  const info5 = vaneHorizontalDirection !== null ? this.emit('message', `Vane horizontal: ${CONSTANTS.AirConditioner.HorizontalVane[vaneHorizontalDirection]}`) : false;
@@ -927,35 +897,26 @@ class DeviceAta extends EventEmitter {
927
897
  };
928
898
  });
929
899
  };
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
- };
900
+ this.melCloudService.getCharacteristic(Characteristic.CoolingThresholdTemperature)
901
+ .setProps({
902
+ minValue: 16,
903
+ maxValue: 31,
904
+ minStep: this.accessory.temperatureIncrement
905
+ })
906
+ .onGet(async () => {
907
+ const value = this.accessory.setTemperature;
908
+ return value;
909
+ })
910
+ .onSet(async (value) => {
911
+ try {
912
+ deviceData.Device.SetTemperature = value;
913
+ deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.SetTemperature;
914
+ await this.melCloudAta.send(deviceData);
915
+ const info = this.disableLogInfo ? false : this.emit('message', `Set temperature: ${value}${this.accessory.temperatureUnit}`);
916
+ } catch (error) {
917
+ this.emit('warn', `Set cooling threshold temperature error: ${error}`);
918
+ };
919
+ });
959
920
  if (modelSupportsHeat) {
960
921
  this.melCloudService.getCharacteristic(Characteristic.HeatingThresholdTemperature)
961
922
  .setProps({
@@ -964,23 +925,19 @@ class DeviceAta extends EventEmitter {
964
925
  minStep: this.accessory.temperatureIncrement
965
926
  })
966
927
  .onGet(async () => {
967
- const value = this.accessory.operationMode === 8 ? this.accessory.defaultHeatingSetTemperature : this.accessory.setTemperature;
928
+ const value = this.accessory.targetOperationMode !== 1 ? 10 : this.accessory.setTemperature;
968
929
  return value;
969
930
  })
970
931
  .onSet(async (value) => {
971
932
  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
933
+ if (this.accessory.targetOperationMode !== 1) {
934
+ this.melCloudService.updateCharacteristic(Characteristic.HeatingThresholdTemperature, 10)
935
+ return;
979
936
  };
980
937
 
981
938
  deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.SetTemperature;
982
939
  await this.melCloudAta.send(deviceData);
983
- const info = this.disableLogInfo ? false : this.emit('message', `Set heating threshold temperature: ${value}${this.accessory.temperatureUnit}`);
940
+ const info = this.disableLogInfo ? false : this.emit('message', `Set temperature: ${value}${this.accessory.temperatureUnit}`);
984
941
  } catch (error) {
985
942
  this.emit('warn', `Set heating threshold temperature error: ${error}`);
986
943
  };
@@ -1095,52 +1052,6 @@ class DeviceAta extends EventEmitter {
1095
1052
  this.emit('warn', `Set temperature error: ${error}`);
1096
1053
  };
1097
1054
  });
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
1055
  this.melCloudService.getCharacteristic(Characteristic.TemperatureDisplayUnits)
1145
1056
  .onGet(async () => {
1146
1057
  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;
@@ -414,8 +414,8 @@ class MelCloudAta extends EventEmitter {
414
414
  OperationMode: deviceData.Device.OperationMode,
415
415
  VaneHorizontal: deviceData.Device.VaneHorizontalDirection,
416
416
  VaneVertical: deviceData.Device.VaneVerticalDirection,
417
- DefaultHeatingSetTemperature: deviceData.Device.DefaultHeatingSetTemperature,
418
- DefaultCoolingSetTemperature: deviceData.Device.DefaultCoolingSetTemperature,
417
+ DefaultHeatingSetTemperature: deviceData.Device.DefaultHeatingSetTemperature ?? 21,
418
+ DefaultCoolingSetTemperature: deviceData.Device.DefaultCoolingSetTemperature ?? 23,
419
419
  InStandbyMode: deviceData.Device.InStandbyMode,
420
420
  ProhibitSetTemperature: deviceData.Device.ProhibitSetTemperature,
421
421
  ProhibitOperationMode: deviceData.Device.ProhibitOperationMode,