homebridge-melcloud-control 4.4.0 → 4.4.1-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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "displayName": "MELCloud Control",
3
3
  "name": "homebridge-melcloud-control",
4
- "version": "4.4.0",
4
+ "version": "4.4.1-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
@@ -934,7 +934,7 @@ class DeviceAta extends EventEmitter {
934
934
  }
935
935
 
936
936
  //holiday mode
937
- if (this.holidayModeSupport && this.accessory.holidayModeEnabled !== null) {
937
+ if (this.holidayModeSupport && this.accessory.holidayMode.Enabled !== null) {
938
938
  //control
939
939
  if (this.logDebug) this.emit('debug', `Prepare holiday mode control service`);
940
940
  this.holidayModeControlService = new Service.Switch(`${serviceName} Holiday Mode`, `holidayModeControlService${deviceId}`);
@@ -942,7 +942,7 @@ class DeviceAta extends EventEmitter {
942
942
  this.holidayModeControlService.setCharacteristic(Characteristic.ConfiguredName, `${accessoryName} Holiday Mode`);
943
943
  this.holidayModeControlService.getCharacteristic(Characteristic.On)
944
944
  .onGet(async () => {
945
- const state = this.accessory.holidayModeEnabled;
945
+ const state = this.accessory.holidayMode.Enabled;
946
946
  return state;
947
947
  })
948
948
  .onSet(async (state) => {
@@ -962,7 +962,7 @@ class DeviceAta extends EventEmitter {
962
962
  this.holidayModeControlSensorService.setCharacteristic(Characteristic.ConfiguredName, `${accessoryName} Holiday Mode Control`);
963
963
  this.holidayModeControlSensorService.getCharacteristic(Characteristic.ContactSensorState)
964
964
  .onGet(async () => {
965
- const state = this.accessory.holidayModeEnabled;
965
+ const state = this.accessory.holidayMode.Enabled;
966
966
  return state;
967
967
  })
968
968
  accessory.addService(this.holidayModeControlSensorService);
@@ -974,7 +974,7 @@ class DeviceAta extends EventEmitter {
974
974
  this.holidayModeSensorService.setCharacteristic(Characteristic.ConfiguredName, `${accessoryName} Holiday Mode`);
975
975
  this.holidayModeSensorService.getCharacteristic(Characteristic.ContactSensorState)
976
976
  .onGet(async () => {
977
- const state = this.accessory.holidayModeActive;
977
+ const state = this.accessory.holidayMode.Active;
978
978
  return state;
979
979
  })
980
980
  accessory.addService(this.holidayModeSensorService);
@@ -1506,15 +1506,14 @@ class DeviceAta extends EventEmitter {
1506
1506
 
1507
1507
  //presets schedules
1508
1508
  const presetsOnServer = deviceData.Presets ?? [];
1509
- const scheduleEnabled = deviceData.ScheduleEnabled;
1510
1509
  const schedulesOnServer = deviceData.Schedule ?? [];
1510
+ const scheduleEnabled = deviceData.ScheduleEnabled;
1511
1511
  const scenesOnServer = deviceData.Scenes ?? [];
1512
- const holidayModeEnabled = deviceData.HolidayMode?.Enabled;
1513
- const holidayModeActive = deviceData.HolidayMode?.Active ?? false;
1514
1512
 
1515
1513
  //protection
1516
1514
  const frostProtection = deviceData.FrostProtection ?? {};
1517
1515
  const overheatProtection = deviceData.OverheatProtection ?? {};
1516
+ const holidayMode = deviceData.HolidayMode ?? {};
1518
1517
 
1519
1518
  //device control
1520
1519
  const hideVaneControls = deviceData.HideVaneControls ?? false;
@@ -1569,7 +1568,11 @@ class DeviceAta extends EventEmitter {
1569
1568
  const obj = {
1570
1569
  presets: presetsOnServer,
1571
1570
  schedules: schedulesOnServer,
1571
+ scheduleEnabled: scheduleEnabled,
1572
1572
  scenes: scenesOnServer,
1573
+ frostProtection: frostProtection,
1574
+ overheatProtection: overheatProtection,
1575
+ holidayMode: holidayMode,
1573
1576
  supportsAutomaticFanSpeed: supportsAutomaticFanSpeed,
1574
1577
  supportsAirDirectionFunction: supportsAirDirectionFunction,
1575
1578
  supportsSwingFunction: supportsSwingFunction,
@@ -1606,12 +1609,7 @@ class DeviceAta extends EventEmitter {
1606
1609
  useFahrenheit: this.accountInfo.useFahrenheit ? 1 : 0,
1607
1610
  temperatureUnit: TemperatureDisplayUnits[this.accountInfo.useFahrenheit ? 1 : 0],
1608
1611
  isConnected: isConnected,
1609
- isInError: isInError,
1610
- frostProtection: frostProtection,
1611
- overheatProtection: overheatProtection,
1612
- holidayModeEnabled: holidayModeEnabled,
1613
- holidayModeActive: holidayModeActive,
1614
- scheduleEnabled: scheduleEnabled
1612
+ isInError: isInError
1615
1613
  };
1616
1614
 
1617
1615
  //characteristics array
@@ -1796,10 +1794,10 @@ class DeviceAta extends EventEmitter {
1796
1794
  }
1797
1795
 
1798
1796
  //holiday mode
1799
- if (this.holidayModeSupport && holidayModeEnabled !== null) {
1800
- this.holidayModeControlService?.updateCharacteristic(Characteristic.On, holidayModeEnabled);
1801
- this.holidayModeControlSensorService?.updateCharacteristic(Characteristic.ContactSensorState, holidayModeEnabled);
1802
- this.holidayModeSensorService?.updateCharacteristic(Characteristic.ContactSensorState, holidayModeActive);
1797
+ if (this.holidayModeSupport && holidayMode.Enabled !== null) {
1798
+ this.holidayModeControlService?.updateCharacteristic(Characteristic.On, holidayMode.Enabled);
1799
+ this.holidayModeControlSensorService?.updateCharacteristic(Characteristic.ContactSensorState, holidayMode.Enabled);
1800
+ this.holidayModeSensorService?.updateCharacteristic(Characteristic.ContactSensorState, holidayMode.Active);
1803
1801
  }
1804
1802
 
1805
1803
  //presets
package/src/deviceatw.js CHANGED
@@ -1173,7 +1173,7 @@ class DeviceAtw extends EventEmitter {
1173
1173
  }
1174
1174
 
1175
1175
  //holiday mode
1176
- if (this.holidayModeSupport && this.accessory.holidayModeEnabled !== null) {
1176
+ if (this.holidayModeSupport && this.accessory.holidayMode.Enabled !== null) {
1177
1177
  //control
1178
1178
  if (this.logDebug) this.emit('debug', `Prepare holiday mode control service`);
1179
1179
  this.holidayModeControlService = new Service.Switch(`${serviceName} Holiday Mode`, `holidayModeControlService${deviceId}`);
@@ -1181,7 +1181,7 @@ class DeviceAtw extends EventEmitter {
1181
1181
  this.holidayModeControlService.setCharacteristic(Characteristic.ConfiguredName, `${accessoryName} Holiday Mode`);
1182
1182
  this.holidayModeControlService.getCharacteristic(Characteristic.On)
1183
1183
  .onGet(async () => {
1184
- const state = this.accessory.holidayModeEnabled;
1184
+ const state = this.accessory.holidayMode.Enabled;
1185
1185
  return state;
1186
1186
  })
1187
1187
  .onSet(async (state) => {
@@ -1201,7 +1201,7 @@ class DeviceAtw extends EventEmitter {
1201
1201
  this.holidayModeControlSensorService.setCharacteristic(Characteristic.ConfiguredName, `${accessoryName} Holiday Mode Control`);
1202
1202
  this.holidayModeControlSensorService.getCharacteristic(Characteristic.ContactSensorState)
1203
1203
  .onGet(async () => {
1204
- const state = this.accessory.holidayModeEnabled;
1204
+ const state = this.accessory.holidayMode.Enabled;
1205
1205
  return state;
1206
1206
  })
1207
1207
  accessory.addService(this.holidayModeControlSensorService);
@@ -1213,7 +1213,7 @@ class DeviceAtw extends EventEmitter {
1213
1213
  this.holidayModeSensorService.setCharacteristic(Characteristic.ConfiguredName, `${accessoryName} Holiday Mode State`);
1214
1214
  this.holidayModeSensorService.getCharacteristic(Characteristic.ContactSensorState)
1215
1215
  .onGet(async () => {
1216
- const state = this.accessory.holidayModeActive;
1216
+ const state = this.accessory.holidayMode.Active;
1217
1217
  return state;
1218
1218
  })
1219
1219
  accessory.addService(this.holidayModeSensorService);
@@ -1676,12 +1676,10 @@ class DeviceAtw extends EventEmitter {
1676
1676
  const scheduleEnabled = deviceData.ScheduleEnabled;
1677
1677
  const schedulesOnServer = deviceData.Schedule ?? [];
1678
1678
  const scenesOnServer = deviceData.Scenes ?? [];
1679
- const holidayMode = deviceData.Device.HolidayMode;
1680
- const holidayModeEnabled = accountTypeMelcloud ? holidayMode : deviceData.HolidayMode?.Enabled;
1681
- const holidayModeActive = deviceData.HolidayMode?.Active ?? false;
1682
1679
 
1683
1680
  //protection
1684
1681
  const frostProtection = deviceData.FrostProtection ?? {};
1682
+ const holidayMode = deviceData.HolidayMode ?? {};
1685
1683
 
1686
1684
  //device info
1687
1685
  const supportsStanbyMode = deviceData.Device[supportStandbyKey];
@@ -1763,7 +1761,10 @@ class DeviceAtw extends EventEmitter {
1763
1761
  const obj = {
1764
1762
  presets: presetsOnServer,
1765
1763
  schedules: schedulesOnServer,
1764
+ scheduleEnabled: scheduleEnabled,
1766
1765
  scenes: scenesOnServer,
1766
+ frostProtection: frostProtection,
1767
+ holidayMode: holidayMode,
1767
1768
  power: power,
1768
1769
  inStandbyMode: inStandbyMode,
1769
1770
  unitStatus: unitStatus,
@@ -1790,11 +1791,6 @@ class DeviceAtw extends EventEmitter {
1790
1791
  temperatureUnit: TemperatureDisplayUnits[this.accountInfo.useFahrenheit ? 1 : 0],
1791
1792
  isConnected: isConnected,
1792
1793
  isInError: isInError,
1793
- frostProtection: frostProtection,
1794
- scheduleEnabled: scheduleEnabled,
1795
- holidayModeEnabled: holidayModeEnabled,
1796
- holidayModeActive: holidayModeActive,
1797
- scheduleEnabled: scheduleEnabled,
1798
1794
  zones: [],
1799
1795
  zonesSensors: []
1800
1796
  };
@@ -2202,10 +2198,10 @@ class DeviceAtw extends EventEmitter {
2202
2198
  }
2203
2199
 
2204
2200
  //holiday mode
2205
- if (this.holidayModeSupport && holidayModeEnabled !== null) {
2206
- this.holidayModeControlService?.updateCharacteristic(Characteristic.On, holidayModeEnabled);
2207
- this.holidayModeControlSensorService?.updateCharacteristic(Characteristic.ContactSensorState, holidayModeEnabled);
2208
- this.holidayModeSensorService?.updateCharacteristic(Characteristic.ContactSensorState, holidayModeActive);
2201
+ if (this.holidayModeSupport && holidayMode.Enabled !== null) {
2202
+ this.holidayModeControlService?.updateCharacteristic(Characteristic.On, holidayMode.Enabled);
2203
+ this.holidayModeControlSensorService?.updateCharacteristic(Characteristic.ContactSensorState, holidayMode.Enabled);
2204
+ this.holidayModeSensorService?.updateCharacteristic(Characteristic.ContactSensorState, holidayMode.Active);
2209
2205
  }
2210
2206
 
2211
2207
  //presets
@@ -2290,7 +2286,7 @@ class DeviceAtw extends EventEmitter {
2290
2286
  button.state = power ? (operationMode === 1) : false;
2291
2287
  break;
2292
2288
  case 53: //HOLIDAY
2293
- button.state = power ? (holidayModeEnabled === true) : false;
2289
+ button.state = power ? (holidayMode.Enabled === true) : false;
2294
2290
  break;
2295
2291
  case 10: //ALL ZONES PHYSICAL LOCK CONTROL
2296
2292
  button.state = power ? (prohibitZone1 === true && prohibitHotWater === true && prohibitZone2 === true) : false;
package/src/functions.js CHANGED
@@ -238,14 +238,14 @@ class Functions extends EventEmitter {
238
238
  );
239
239
  }
240
240
 
241
- async adjustTempProtection(oldMin, oldMax, newValue, type, minRangeMin, maxRangeMin, minRangeMax, maxRangeMax) {
242
- let min = oldMin;
243
- let max = oldMax;
241
+ async adjustTempProtection(currentMin, currentMax, value, type, minRangeMin, maxRangeMin, minRangeMax, maxRangeMax) {
242
+ let min = currentMin;
243
+ let max = currentMax;
244
244
 
245
245
  if (type === "min") {
246
- min = Math.min(Math.max(newValue, minRangeMin), maxRangeMin);
246
+ min = Math.min(Math.max(value, minRangeMin), maxRangeMin);
247
247
 
248
- if (min > oldMin && max - min < 2) {
248
+ if (min > currentMin && max - min < 2) {
249
249
  max = Math.min(min + 2, maxRangeMax);
250
250
 
251
251
  // jeśli max uderza w górną granicę → obniż min o 2
@@ -261,9 +261,9 @@ class Functions extends EventEmitter {
261
261
  }
262
262
 
263
263
  if (type === "max") {
264
- max = Math.min(Math.max(newValue, minRangeMax), maxRangeMax);
264
+ max = Math.min(Math.max(value, minRangeMax), maxRangeMax);
265
265
 
266
- if (max < oldMax && max - min < 2) {
266
+ if (max < currentMax && max - min < 2) {
267
267
  min = Math.max(max - 2, minRangeMin);
268
268
 
269
269
  // jeśli min uderza w dolną granicę → podbij max o 2