homebridge-melcloud-control 4.2.3-beta.21 → 4.2.3-beta.23

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.2.3-beta.21",
4
+ "version": "4.2.3-beta.23",
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
@@ -1691,7 +1691,7 @@ class DeviceAta extends EventEmitter {
1691
1691
 
1692
1692
  //log current state
1693
1693
  if (this.logInfo) {
1694
- this.emit('info', `Power: ${power ? 'ON' : 'OFF'}`);
1694
+ this.emit('info', `Power: ${power ? 'On' : 'Off'}`);
1695
1695
  this.emit('info', `Target operation mode: ${AirConditioner.OperationModeMapEnumToString[operationMode]}`);
1696
1696
  this.emit('info', `Current operation mode: ${this.displayType === 1 ? AirConditioner.CurrentOperationModeHeatherCoolerMapEnumToString[obj.currentOperationMode] : AirConditioner.CurrentOperationModeThermostatMapEnumToString[obj.currentOperationMode]}`);
1697
1697
  this.emit('info', `Target temperature: ${setTemperature}${obj.temperatureUnit}`);
package/src/deviceatw.js CHANGED
@@ -1885,11 +1885,11 @@ class DeviceAtw extends EventEmitter {
1885
1885
  let operationModeText = '';
1886
1886
  switch (i) {
1887
1887
  case caseHeatPump: //Heat Pump - HEAT, COOL, OFF
1888
- this.emit('info', `${heatPumpName}, Power: ${power ? 'ON' : 'OFF'}`)
1888
+ this.emit('info', `${heatPumpName}, Power: ${power ? 'On' : 'Off'}`)
1889
1889
  this.emit('info', `${heatPumpName}, Operation mode: ${HeatPump.SystemMapEnumToString[unitStatus]}`);
1890
1890
  this.emit('info', `${heatPumpName},'Outdoor temperature: ${roomTemperature}${obj.temperatureUnit}`);
1891
1891
  this.emit('info', `${heatPumpName}, Temperature display unit: ${obj.temperatureUnit}`);
1892
- this.emit('info', `${heatPumpName}, Lock physical controls: ${lockPhysicalControl ? 'LOCKED' : 'UNLOCKED'}`);
1892
+ this.emit('info', `${heatPumpName}, Lock physical controls: ${lockPhysicalControl ? 'Locked' : 'Unlocked'}`);
1893
1893
  break;
1894
1894
  case caseZone1: //Zone 1 - HEAT THERMOSTAT, HEAT FLOW, HEAT CURVE, COOL THERMOSTAT, COOL FLOW, FLOOR DRY UP
1895
1895
  operationModeText = idleZone1 ? HeatPump.ZoneOperationMapEnumToString[6] : HeatPump.ZoneOperationMapEnumToString[operationModeZone1];
@@ -1897,7 +1897,7 @@ class DeviceAtw extends EventEmitter {
1897
1897
  this.emit('info', `${zone1Name}, Temperature: ${roomTemperature}${obj.temperatureUnit}`);
1898
1898
  this.emit('info', `${zone1Name}, Target temperature: ${setTemperature}${obj.temperatureUnit}`)
1899
1899
  this.emit('info', `${zone1Name}, Temperature display unit: ${obj.temperatureUnit}`);
1900
- this.emit('info', `${zone1Name}, Lock physical controls: ${lockPhysicalControl ? 'LOCKED' : 'UNLOCKED'}`);
1900
+ this.emit('info', `${zone1Name}, Lock physical controls: ${lockPhysicalControl ? 'Locked' : 'Unlocked'}`);
1901
1901
  break;
1902
1902
  case caseHotWater: //Hot Water - AUTO, HEAT NOW
1903
1903
  operationModeText = operationMode === 1 ? HeatPump.ForceDhwMapEnumToString[1] : HeatPump.ForceDhwMapEnumToString[forcedHotWaterMode ? 1 : 0];
@@ -1905,7 +1905,7 @@ class DeviceAtw extends EventEmitter {
1905
1905
  this.emit('info', `${hotWaterName}, Temperature: ${roomTemperature}${obj.temperatureUnit}`);
1906
1906
  this.emit('info', `${hotWaterName}, Target temperature: ${setTemperature}${obj.temperatureUnit}`)
1907
1907
  this.emit('info', `${hotWaterName}, Temperature display unit: ${obj.temperatureUnit}`);
1908
- this.emit('info', `${hotWaterName}, Lock physical controls: ${lockPhysicalControl ? 'LOCKED' : 'UNLOCKED'}`);
1908
+ this.emit('info', `${hotWaterName}, Lock physical controls: ${lockPhysicalControl ? 'Locked' : 'Unlocked'}`);
1909
1909
  break;
1910
1910
  case caseZone2: //Zone 2 - HEAT THERMOSTAT, HEAT FLOW, HEAT CURVE, COOL THERMOSTAT, COOL FLOW, FLOOR DRY UP
1911
1911
  operationModeText = idleZone2 ? HeatPump.ZoneOperationMapEnumToString[6] : HeatPump.ZoneOperationMapEnumToString[operationModeZone2];
@@ -1913,7 +1913,7 @@ class DeviceAtw extends EventEmitter {
1913
1913
  this.emit('info', `${zone2Name}, Temperature: ${roomTemperature}${obj.temperatureUnit}`);
1914
1914
  this.emit('info', `${zone2Name}, Target temperature: ${setTemperature}${obj.temperatureUnit}`)
1915
1915
  this.emit('info', `${zone2Name}, Temperature display unit: ${obj.temperatureUnit}`);
1916
- this.emit('info', `${zone2Name}, Lock physical controls: ${lockPhysicalControl ? 'LOCKED' : 'UNLOCKED'}`);
1916
+ this.emit('info', `${zone2Name}, Lock physical controls: ${lockPhysicalControl ? 'Locked' : 'Unlocked'}`);
1917
1917
  break;
1918
1918
  };
1919
1919
  };
package/src/deviceerv.js CHANGED
@@ -1400,7 +1400,7 @@ class DeviceErv extends EventEmitter {
1400
1400
 
1401
1401
  //log current state
1402
1402
  if (this.logInfo) {
1403
- this.emit('info', `Power: ${power ? 'ON' : 'OFF'}`);
1403
+ this.emit('info', `Power: ${power ? 'On' : 'Off'}`);
1404
1404
  this.emit('info', `Target ventilation mode: ${Ventilation.OperationModeMapEnumToString[ventilationMode]}`);
1405
1405
  this.emit('info', `Current ventilation mode: ${Ventilation.OperationModeMapEnumToString[actualVentilationMode]}`);
1406
1406
  this.emit('info', `Target temperature: ${setTemperature}${obj.temperatureUnit}`);
package/src/melcloud.js CHANGED
@@ -86,6 +86,7 @@ class MelCloud extends EventEmitter {
86
86
  await this.functions.saveData(this.buildingsFile, buildingsList);
87
87
  if (this.logDebug) this.emit('debug', `Buildings list saved`);
88
88
 
89
+ const devices = [];
89
90
  for (const building of buildingsList) {
90
91
  if (!building.Structure) {
91
92
  this.emit('warn', `Building missing structure: ${building.BuildingName || 'Unnamed'}`);
@@ -110,20 +111,21 @@ class MelCloud extends EventEmitter {
110
111
  });
111
112
 
112
113
  if (this.logDebug) this.emit('debug', `Found ${allDevices.length} devices in building: ${building.Name || 'Unnamed'}`);
113
- devicesList.Devices.push(...allDevices);
114
+ devices.push(...allDevices);
114
115
  }
115
116
 
116
- const devicesCount = devicesList.Devices.length;
117
+ const devicesCount = devices.length;
117
118
  if (devicesCount === 0) {
118
119
  devicesList.Info = 'No devices found'
119
120
  return devicesList;
120
121
  }
122
+ devicesList.State = true;
123
+ devicesList.Info = `Found ${devicesCount} devices`;
124
+ devicesList.Devices = devices;
121
125
 
122
- await this.functions.saveData(this.devicesFile, devicesList.Devices);
126
+ await this.functions.saveData(this.devicesFile, devicesList);
123
127
  if (this.logDebug) this.emit('debug', `${devicesCount} devices saved`);
124
128
 
125
- devicesList.State = true;
126
- devicesList.Info = `Found ${devicesCount} devices`;
127
129
  return devicesList;
128
130
  } catch (error) {
129
131
  throw new Error(`Check devices list error: ${error.message}`);
@@ -52,7 +52,7 @@ class MelCloudAta extends EventEmitter {
52
52
  try {
53
53
  //read device info from file
54
54
  const devicesData = await this.functions.readData(this.devicesFile, true);
55
- const deviceData = devicesData.find(device => device.DeviceID === this.deviceId);
55
+ const deviceData = devicesData.Devices.find(device => device.DeviceID === this.deviceId);
56
56
 
57
57
  if (this.accountType === 'melcloudhome') {
58
58
  deviceData.Device.OperationMode = AirConditioner.OperationModeMapStringToEnum[deviceData.Device.OperationMode] ?? deviceData.Device.OperationMode;
@@ -52,7 +52,7 @@ class MelCloudAtw extends EventEmitter {
52
52
  try {
53
53
  //read device info from file
54
54
  const devicesData = await this.functions.readData(this.devicesFile, true);
55
- const deviceData = devicesData.find(device => device.DeviceID === this.deviceId);
55
+ const deviceData = devicesData.Devices.find(device => device.DeviceID === this.deviceId);
56
56
 
57
57
  if (this.accountType === 'melcloudhome') {
58
58
  }
@@ -52,7 +52,7 @@ class MelCloudErv extends EventEmitter {
52
52
  try {
53
53
  //read device info from file
54
54
  const devicesData = await this.functions.readData(this.devicesFile, true);
55
- const deviceData = devicesData.find(device => device.DeviceID === this.deviceId);
55
+ const deviceData = devicesData.Devices.find(device => device.DeviceID === this.deviceId);
56
56
 
57
57
  if (this.accountType === 'melcloudhome') {
58
58
  //read default temps
@@ -166,12 +166,13 @@ class MelCloud extends EventEmitter {
166
166
  return devicesList;
167
167
  }
168
168
 
169
- await this.functions.saveData(this.devicesFile, devices);
170
- if (this.logDebug) this.emit('debug', `${devicesCount} devices saved`);
171
-
172
169
  devicesList.State = true;
173
170
  devicesList.Info = `Found ${devicesCount} devices`;
174
171
  devicesList.Devices = devices;
172
+
173
+ await this.functions.saveData(this.devicesFile, devicesList);
174
+ if (this.logDebug) this.emit('debug', `${devicesCount} devices saved`);
175
+
175
176
  return devicesList;
176
177
  } catch (error) {
177
178
  if (error.response?.status === 401) {