homebridge-melcloud-control 3.3.12-beta.25 → 3.3.12-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "displayName": "MELCloud Control",
3
3
  "name": "homebridge-melcloud-control",
4
- "version": "3.3.12-beta.25",
4
+ "version": "3.3.12-beta.3",
5
5
  "description": "Homebridge plugin to control Mitsubishi Air Conditioner, Heat Pump and Energy Recovery Ventilation.",
6
6
  "license": "MIT",
7
7
  "author": "grzegorz914",
@@ -73,6 +73,12 @@
73
73
  ],
74
74
  "AirDirection": [
75
75
  "AUTO",
76
+ "1",
77
+ "2",
78
+ "3",
79
+ "4",
80
+ "5",
81
+ "6",
76
82
  "SWING"
77
83
  ],
78
84
  "FanSpeed": [
package/src/deviceata.js CHANGED
@@ -252,6 +252,7 @@ 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: ${TargetTemperature}`);
255
256
  //accessory
256
257
  this.accessory.presets = presetsOnServer;
257
258
  this.accessory.hasAutomaticFanSpeed = hasAutomaticFanSpeed;
@@ -294,7 +295,7 @@ class DeviceAta extends EventEmitter {
294
295
  this.accessory.targetOperationMode = 1; //AUTO, HEAT, COOL
295
296
  break;
296
297
  case 2: //DRY
297
- this.accessory.currentOperationMode = 1;
298
+ this.accessory.currentOperationMode = roomTemperature < setTemperature ? 1 : 3;
298
299
  this.accessory.targetOperationMode = this.autoDryFanMode === 2 ? 0 : this.heatDryFanMode === 2 ? 1 : this.coolDryFanMode === 2 ? 2 : this.accessory.targetOperationMode;
299
300
  break;
300
301
  case 3: //COOL
@@ -306,7 +307,20 @@ class DeviceAta extends EventEmitter {
306
307
  this.accessory.targetOperationMode = this.autoDryFanMode === 3 ? 0 : this.heatDryFanMode === 3 ? 1 : this.coolDryFanMode === 3 ? 2 : this.accessory.targetOperationMode;
307
308
  break;
308
309
  case 8: //AUTO
309
- this.accessory.currentOperationMode = roomTemperature < setTemperature ? 2 : roomTemperature > setTemperature ? 3 : 1;
310
+ const curentModeInAuto = roomTemperature < defaultHeatingSetTemperature ? 'HEATING' : roomTemperature > defaultCoolingSetTemperature ? 'COOLING' : '';
311
+ switch (curentModeInAuto) {
312
+ case 'HEATING': //HEATING
313
+ const heatingToFan = roomTemperature > defaultHeatingSetTemperature + 1;
314
+ this.accessory.currentOperationMode = heatingToFan ? 1 : 2;
315
+ break;
316
+ case 'COOLING': //COOLING
317
+ const coolingToFan = roomTemperature < defaultCoolingSetTemperature - 1;
318
+ this.accessory.currentOperationMode = coolingToFan ? 1 : 3;
319
+ break;
320
+ default: //FAN
321
+ this.accessory.currentOperationMode = roomTemperature <= defaultHeatingSetTemperature ? 2 : roomTemperature >= defaultCoolingSetTemperature ? 3 : 1;
322
+ break;
323
+ };
310
324
  this.accessory.targetOperationMode = 0;
311
325
  break;
312
326
  case 9: //ISEE HEAT
@@ -314,7 +328,7 @@ class DeviceAta extends EventEmitter {
314
328
  this.accessory.targetOperationMode = 1;
315
329
  break;
316
330
  case 10: //ISEE DRY
317
- this.accessory.currentOperationMode = 1;
331
+ this.accessory.currentOperationMode = roomTemperature < setTemperature ? 1 : 3;
318
332
  this.accessory.targetOperationMode = this.autoDryFanMode === 2 ? 0 : this.heatDryFanMode === 2 ? 1 : this.coolDryFanMode === 2 ? 2 : this.accessory.targetOperationMode;
319
333
  break;
320
334
  case 11: //ISEE COOL;
@@ -375,8 +389,8 @@ class DeviceAta extends EventEmitter {
375
389
  .updateCharacteristic(Characteristic.CurrentTemperature, roomTemperature)
376
390
  .updateCharacteristic(Characteristic.LockPhysicalControls, this.accessory.lockPhysicalControl)
377
391
  .updateCharacteristic(Characteristic.TemperatureDisplayUnits, this.accessory.useFahrenheit);
378
- const updateDefCool = modelSupportsCool ? this.melCloudService.updateCharacteristic(Characteristic.CoolingThresholdTemperature, setTemperature) : false;
379
- const updateDefHeat = modelSupportsHeat ? this.melCloudService.updateCharacteristic(Characteristic.HeatingThresholdTemperature, this.accessory.targetOperationMode !== 1 ? 10 : setTemperature) : false;
392
+ const updateDefHeat = modelSupportsHeat ? this.melCloudService.updateCharacteristic(Characteristic.HeatingThresholdTemperature, operationMode === 8 ? defaultHeatingSetTemperature : setTemperature) : false;
393
+ const updateDefCool = modelSupportsCool ? this.melCloudService.updateCharacteristic(Characteristic.CoolingThresholdTemperature, operationMode === 8 ? defaultCoolingSetTemperature : setTemperature) : false;
380
394
  const updateRS = modelSupportsFanSpeed ? this.melCloudService.updateCharacteristic(Characteristic.RotationSpeed, this.accessory.fanSpeed) : false;
381
395
  const updateSM = swingFunction ? this.melCloudService.updateCharacteristic(Characteristic.SwingMode, this.accessory.swingMode) : false;
382
396
  };
@@ -388,35 +402,48 @@ class DeviceAta extends EventEmitter {
388
402
  case true:
389
403
  switch (operationMode) {
390
404
  case 1: //HEAT
391
- this.accessory.currentOperationMode = roomTemperature > setTemperature ? 0 : 1; //OFF, HEATING, COOLING
405
+ this.accessory.currentOperationMode = 1; //OFF, HEATING, COOLING
392
406
  this.accessory.targetOperationMode = 1; //OFF, HEAT, COOL, AUTO
393
407
  break;
394
408
  case 2: //DRY
395
- this.accessory.currentOperationMode = 0;
409
+ this.accessory.currentOperationMode = 2;
396
410
  this.accessory.targetOperationMode = this.autoDryFanMode === 2 ? 3 : this.heatDryFanMode === 2 ? 1 : this.coolDryFanMode === 2 ? 2 : this.accessory.targetOperationMode;
397
411
  break;
398
412
  case 3: //COOL
399
- this.accessory.currentOperationMode = roomTemperature < setTemperature ? 0 : 2;
413
+ this.accessory.currentOperationMode = 2;
400
414
  this.accessory.targetOperationMode = 2;
401
415
  break;
402
416
  case 7: //FAN
403
- this.accessory.currentOperationMode = 0;
417
+ this.accessory.currentOperationMode = 2;
404
418
  this.accessory.targetOperationMode = this.autoDryFanMode === 3 ? 3 : this.heatDryFanMode === 3 ? 1 : this.coolDryFanMode === 3 ? 2 : this.accessory.targetOperationMode;
405
419
  break;
406
420
  case 8: //AUTO
407
- this.accessory.currentOperationMode = roomTemperature < setTemperature ? 1 : roomTemperature > setTemperature ? 2 : 0;
421
+ const curentModeInAuto = roomTemperature < defaultHeatingSetTemperature ? 'HEATING' : roomTemperature > defaultCoolingSetTemperature ? 'COOLING' : '';
422
+ switch (curentModeInAuto) {
423
+ case 'HEATING': //HEATING
424
+ const heatingToFan = roomTemperature > defaultHeatingSetTemperature + 1;
425
+ this.accessory.currentOperationMode = heatingToFan ? 0 : 1;
426
+ break;
427
+ case 'COOLING': //COOLING
428
+ const coolingToFan = roomTemperature < defaultCoolingSetTemperature - 1;
429
+ this.accessory.currentOperationMode = cooling ? 0 : 2;
430
+ break;
431
+ default: //FAN
432
+ this.accessory.currentOperationMode = roomTemperature <= defaultHeatingSetTemperature ? 1 : roomTemperature >= defaultCoolingSetTemperature ? 2 : 0;
433
+ break;
434
+ };
408
435
  this.accessory.targetOperationMode = 3;
409
436
  break;
410
437
  case 9: //ISEE HEAT
411
- this.accessory.currentOperationMode = roomTemperature > setTemperature ? 0 : 1;
438
+ this.accessory.currentOperationMode = 1
412
439
  this.accessory.targetOperationMode = 1;
413
440
  break;
414
441
  case 10: //ISEE DRY
415
- this.accessory.currentOperationMode = 0;
442
+ this.accessory.currentOperationMode = 2;
416
443
  this.accessory.targetOperationMode = this.autoDryFanMode === 2 ? 3 : this.heatDryFanMode === 2 ? 1 : this.coolDryFanMode === 2 ? 2 : this.accessory.targetOperationMode;
417
444
  break;
418
445
  case 11: //ISEE COOL;
419
- this.accessory.currentOperationMode = roomTemperature < setTemperature ? 0 : 2;
446
+ this.accessory.currentOperationMode = 2;
420
447
  this.accessory.targetOperationMode = 2;
421
448
  break;
422
449
  default:
@@ -444,6 +471,8 @@ class DeviceAta extends EventEmitter {
444
471
  .updateCharacteristic(Characteristic.CurrentTemperature, roomTemperature)
445
472
  .updateCharacteristic(Characteristic.TargetTemperature, setTemperature)
446
473
  .updateCharacteristic(Characteristic.TemperatureDisplayUnits, this.accessory.useFahrenheit);
474
+ const updateDefHeat = modelSupportsAuto && modelSupportsHeat ? this.melCloudService.updateCharacteristic(Characteristic.HeatingThresholdTemperature, defaultHeatingSetTemperature) : false;
475
+ const updateDefCool = modelSupportsAuto && modelSupportsCool ? this.melCloudService.updateCharacteristic(Characteristic.CoolingThresholdTemperature, defaultCoolingSetTemperature) : false;
447
476
  };
448
477
  break;
449
478
  };
@@ -610,14 +639,16 @@ class DeviceAta extends EventEmitter {
610
639
  this.emit('message', `Power: ${power ? 'ON' : 'OFF'}`);
611
640
  this.emit('message', `Target operation mode: ${CONSTANTS.AirConditioner.DriveMode[operationMode]}`);
612
641
  this.emit('message', `Current operation mode: ${this.displayMode === 1 ? CONSTANTS.AirConditioner.CurrentOperationModeHeatherCooler[this.accessory.currentOperationMode] : CONSTANTS.AirConditioner.CurrentOperationModeThermostat[this.accessory.currentOperationMode]}`);
613
- this.emit('message', `Target temperature: ${setTemperature}${this.accessory.temperatureUnit}`);
642
+ const info0 = operationMode !== 8 ? this.emit('message', `Target temperature: ${setTemperature}${this.accessory.temperatureUnit}`) : false;
614
643
  this.emit('message', `Current temperature: ${roomTemperature}${this.accessory.temperatureUnit}`);
615
644
  const info = hasOutdoorTemperature && deviceData.Device.OutdoorTemperature !== null ? this.emit('message', `Outdoor temperature: ${outdoorTemperature}${this.accessory.temperatureUnit}`) : false;
645
+ const info1 = operationMode === 8 && modelSupportsHeat ? this.emit('message', `Heating threshold temperature: ${defaultHeatingSetTemperature}${this.accessory.temperatureUnit}`) : false;
646
+ const info2 = operationMode === 8 && modelSupportsCool ? this.emit('message', `Cooling threshold temperature: ${defaultCoolingSetTemperature}${this.accessory.temperatureUnit}`) : false;
616
647
  const info3 = modelSupportsFanSpeed ? this.emit('message', `Target fan speed: ${CONSTANTS.AirConditioner.FanSpeed[fanSpeed]}`) : false;
617
648
  const info4 = modelSupportsFanSpeed ? this.emit('message', `Current fan speed: ${CONSTANTS.AirConditioner.FanSpeed[actualFanSpeed]}`) : false;
618
649
  const info5 = vaneHorizontalDirection !== null ? this.emit('message', `Vane horizontal: ${CONSTANTS.AirConditioner.HorizontalVane[vaneHorizontalDirection]}`) : false;
619
650
  const info6 = vaneVerticalDirection !== null ? this.emit('message', `Vane vertical: ${CONSTANTS.AirConditioner.VerticalVane[vaneVerticalDirection]}`) : false;
620
- const info7 = swingFunction ? this.emit('message', `Air direction: ${CONSTANTS.AirConditioner.AirDirection[this.accessory.swingMode]}`) : false;
651
+ const info7 = swingFunction ? this.emit('message', `Air direction: ${CONSTANTS.AirConditioner.AirDirection[this.accessory.swingMode ? 7 : 0]}`) : false;
621
652
  this.emit('message', `Temperature display unit: ${this.accessory.temperatureUnit}`);
622
653
  this.emit('message', `Lock physical controls: ${this.accessory.lockPhysicalControl ? 'LOCKED' : 'UNLOCKED'}`);
623
654
  };
@@ -891,32 +922,41 @@ class DeviceAta extends EventEmitter {
891
922
  deviceData.Device.VaneVertical = value ? 7 : 0;
892
923
  deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.VaneHorizontal + CONSTANTS.AirConditioner.EffectiveFlags.VaneVertical;
893
924
  await this.melCloudAta.send(deviceData);
894
- const info = this.disableLogInfo ? false : this.emit('message', `Set air direction mode: ${CONSTANTS.AirConditioner.AirDirection[value]}`);
925
+ const info = this.disableLogInfo ? false : this.emit('message', `Set air direction mode: ${CONSTANTS.AirConditioner.AirDirection[value ? 7 : 0]}`);
895
926
  } catch (error) {
896
927
  this.emit('warn', `Set vane swing mode error: ${error}`);
897
928
  };
898
929
  });
899
930
  };
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
- });
931
+ if (modelSupportsCool) {
932
+ this.melCloudService.getCharacteristic(Characteristic.CoolingThresholdTemperature)
933
+ .setProps({
934
+ minValue: 16,
935
+ maxValue: 31,
936
+ minStep: this.accessory.temperatureIncrement
937
+ })
938
+ .onGet(async () => {
939
+ const value = this.accessory.operationMode === 8 ? this.accessory.defaultCoolingSetTemperature : this.accessory.setTemperature;
940
+ return value;
941
+ })
942
+ .onSet(async (value) => {
943
+ try {
944
+ switch (this.accessory.operationMode) {
945
+ case 8: //AUTO - AUTO
946
+ deviceData.Device.DefaultCoolingSetTemperature = value;
947
+ break;
948
+ default:
949
+ deviceData.Device.SetTemperature = value;
950
+ break
951
+ };
952
+ deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.SetTemperature;
953
+ await this.melCloudAta.send(deviceData);
954
+ const info = this.disableLogInfo ? false : this.emit('message', `Set cooling threshold temperature: ${value}${this.accessory.temperatureUnit}`);
955
+ } catch (error) {
956
+ this.emit('warn', `Set cooling threshold temperature error: ${error}`);
957
+ };
958
+ });
959
+ };
920
960
  if (modelSupportsHeat) {
921
961
  this.melCloudService.getCharacteristic(Characteristic.HeatingThresholdTemperature)
922
962
  .setProps({
@@ -925,19 +965,23 @@ class DeviceAta extends EventEmitter {
925
965
  minStep: this.accessory.temperatureIncrement
926
966
  })
927
967
  .onGet(async () => {
928
- const value = this.accessory.targetOperationMode !== 1 ? 10 : this.accessory.setTemperature;
968
+ const value = this.accessory.operationMode === 8 ? this.accessory.defaultHeatingSetTemperature : this.accessory.setTemperature;
929
969
  return value;
930
970
  })
931
971
  .onSet(async (value) => {
932
972
  try {
933
- if (this.accessory.targetOperationMode !== 1) {
934
- this.melCloudService.updateCharacteristic(Characteristic.HeatingThresholdTemperature, 10)
935
- return;
973
+ switch (this.accessory.operationMode) {
974
+ case 8: //AUTO - AUTO
975
+ deviceData.Device.DefaultHeatingSetTemperature = value;
976
+ break;
977
+ default:
978
+ deviceData.Device.SetTemperature = value;
979
+ break
936
980
  };
937
981
 
938
982
  deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.SetTemperature;
939
983
  await this.melCloudAta.send(deviceData);
940
- const info = this.disableLogInfo ? false : this.emit('message', `Set heat temperature: ${value}${this.accessory.temperatureUnit}`);
984
+ const info = this.disableLogInfo ? false : this.emit('message', `Set heating threshold temperature: ${value}${this.accessory.temperatureUnit}`);
941
985
  } catch (error) {
942
986
  this.emit('warn', `Set heating threshold temperature error: ${error}`);
943
987
  };
@@ -1052,6 +1096,52 @@ class DeviceAta extends EventEmitter {
1052
1096
  this.emit('warn', `Set temperature error: ${error}`);
1053
1097
  };
1054
1098
  });
1099
+ if (modelSupportsAuto) {
1100
+ if (modelSupportsHeat) {
1101
+ this.melCloudService.getCharacteristic(Characteristic.HeatingThresholdTemperature)
1102
+ .setProps({
1103
+ minValue: 10,
1104
+ maxValue: 31,
1105
+ minStep: this.accessory.temperatureIncrement
1106
+ })
1107
+ .onGet(async () => {
1108
+ const value = this.accessory.defaultHeatingSetTemperature;
1109
+ return value;
1110
+ })
1111
+ .onSet(async (value) => {
1112
+ try {
1113
+ deviceData.Device.DefaultHeatingSetTemperature = value;
1114
+ deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.SetTemperature;
1115
+ await this.melCloudAta.send(deviceData);
1116
+ const info = this.disableLogInfo ? false : this.emit('message', `Set heating threshold temperature: ${value}${this.accessory.temperatureUnit}`);
1117
+ } catch (error) {
1118
+ this.emit('warn', `Set heating threshold temperature error: ${error}`);
1119
+ };
1120
+ });
1121
+ };
1122
+ if (modelSupportsCool) {
1123
+ this.melCloudService.getCharacteristic(Characteristic.CoolingThresholdTemperature)
1124
+ .setProps({
1125
+ minValue: 16,
1126
+ maxValue: 31,
1127
+ minStep: this.accessory.temperatureIncrement
1128
+ })
1129
+ .onGet(async () => {
1130
+ const value = this.accessory.defaultCoolingSetTemperature;
1131
+ return value;
1132
+ })
1133
+ .onSet(async (value) => {
1134
+ try {
1135
+ deviceData.Device.DefaultCoolingSetTemperature = value;
1136
+ deviceData.Device.EffectiveFlags = CONSTANTS.AirConditioner.EffectiveFlags.SetTemperature;
1137
+ await this.melCloudAta.send(deviceData);
1138
+ const info = this.disableLogInfo ? false : this.emit('message', `Set cooling threshold temperature: ${value}${this.accessory.temperatureUnit}`);
1139
+ } catch (error) {
1140
+ this.emit('warn', `Set cooling threshold temperature error: ${error}`);
1141
+ };
1142
+ });
1143
+ };
1144
+ };
1055
1145
  this.melCloudService.getCharacteristic(Characteristic.TemperatureDisplayUnits)
1056
1146
  .onGet(async () => {
1057
1147
  const value = this.accessory.useFahrenheit;
package/src/deviceatw.js CHANGED
@@ -1428,6 +1428,118 @@ 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
+ };
1431
1543
  melCloudServiceT.getCharacteristic(Characteristic.TemperatureDisplayUnits)
1432
1544
  .onGet(async () => {
1433
1545
  const value = this.accessory.useFahrenheit;
package/src/deviceerv.js CHANGED
@@ -407,6 +407,8 @@ 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;
410
412
  };
411
413
  break;
412
414
  };
@@ -540,10 +542,12 @@ class DeviceErv extends EventEmitter {
540
542
  this.emit('message', `Power: ${power ? 'ON' : 'OFF'}`);
541
543
  this.emit('message', `Target ventilation mode: ${CONSTANTS.Ventilation.OperationMode[ventilationMode]}`);
542
544
  this.emit('message', `Current entilation mode: ${CONSTANTS.Ventilation.OperationMode[actualVentilationMode]}`);
543
- this.emit('message', `Target temperature: ${targetTemperature}${this.accessory.temperatureUnit}`);
544
545
  this.emit('message', `Room temperature: ${roomTemperature}${this.accessory.temperatureUnit}`);
546
+ const info = hasCoolOperationMode || hasHeatOperationMode ? this.emit('message', `Target temperature: ${targetTemperature}${this.accessory.temperatureUnit}`) : false;
545
547
  const info1 = hasSupplyTemperature && deviceData.Device.SupplyTemperature !== null ? this.emit('message', `Supply temperature: ${roomTemperature}${this.accessory.temperatureUnit}`) : false;
546
548
  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;
547
551
  this.emit('message', `Fan speed mode: ${CONSTANTS.Ventilation.FanSpeed[setFanSpeed]}`);
548
552
  this.emit('message', `Temperature display unit: ${this.accessory.temperatureUnit}`);
549
553
  this.emit('message', `Core maintenance: ${CONSTANTS.Ventilation.CoreMaintenance[coreMaintenanceRequired]}`);
@@ -957,6 +961,52 @@ class DeviceErv extends EventEmitter {
957
961
  this.emit('warn', `Set temperature error: ${error}`);
958
962
  };
959
963
  });
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
+ };
960
1010
  this.melCloudService.getCharacteristic(Characteristic.TemperatureDisplayUnits)
961
1011
  .onGet(async () => {
962
1012
  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 ?? 21,
418
- DefaultCoolingSetTemperature: deviceData.Device.DefaultCoolingSetTemperature ?? 23,
417
+ DefaultHeatingSetTemperature: deviceData.Device.DefaultHeatingSetTemperature,
418
+ DefaultCoolingSetTemperature: deviceData.Device.DefaultCoolingSetTemperature,
419
419
  InStandbyMode: deviceData.Device.InStandbyMode,
420
420
  ProhibitSetTemperature: deviceData.Device.ProhibitSetTemperature,
421
421
  ProhibitOperationMode: deviceData.Device.ProhibitOperationMode,