homebridge-melcloud-control 4.0.0-beta.190 → 4.0.0-beta.192

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.0.0-beta.190",
4
+ "version": "4.0.0-beta.192",
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/constants.js CHANGED
@@ -43,7 +43,7 @@ export const AirConditioner = {
43
43
  OperationModeMapEnumToString: { 0: "0", 1: "Heat", 2: "Dry", 3: "Cool", 4: "4", 5: "5", 6: "6", 7: "Fan", 8: "Automatic", 9: "Isee Heat", 10: "Isee Dry", 11: "Isee Cool" },
44
44
  FanSpeedMapStringToEnum: { "Auto": 0, "One": 1, "Two": 2, "Three": 3, "Four": 4, "Five": 5 },
45
45
  FanSpeedMapEnumToString: { 0: "Auto", 1: "One", 2: "Two", 3: "Three", 4: "Four", 5: "Five" },
46
- FanSpeedCurrentMapEnumToString: { 0: "Zero", 1: "One", 2: "Two", 3: "Three", 4: "Four", 5: "Five" },
46
+ FanSpeedCurrentMapEnumToString: { 0: "Quiet", 1: "One", 2: "Two", 3: "Three", 4: "Four", 5: "Five" },
47
47
  VaneVerticalDirectionMapStringToEnum: { "Auto": 0, "One": 1, "Two": 2, "Three": 3, "Four": 4, "Five": 5, "Six": 6, "Swing": 7 },
48
48
  VaneVerticalDirectionMapEnumToString: { 0: "Auto", 1: "One", 2: "Two", 3: "Three", 4: "Four", 5: "Five", 6: "Six", 7: "Swing" },
49
49
  VaneHorizontalDirectionMapStringToEnum: { "Auto": 0, "Left": 1, "LeftCentre": 2, "Centre": 3, "RightCentre": 4, "Right": 5, "Six": 6, "Seven": 7, "Split": 8, "Nine": 9, "Ten": 10, "Eleven": 11, "Swing": 12 },
@@ -67,8 +67,7 @@ class MelCloudAta extends EventEmitter {
67
67
  deviceData.Device.DefaultCoolingSetTemperature = this.defaultCoolingSetTemperature;
68
68
  deviceData.Device.FirmwareAppVersion = '4.0.0';
69
69
  }
70
-
71
- if (!this.logDebug) this.emit('warn', `Device Data: ${JSON.stringify(deviceData, null, 2)}`);
70
+ if (this.logDebug) this.emit('debug', `Device Data: ${JSON.stringify(deviceData, null, 2)}`);
72
71
 
73
72
  //device info
74
73
  const hideVaneControls = deviceData.HideVaneControls ?? false;
@@ -208,14 +207,14 @@ class MelCloudAta extends EventEmitter {
208
207
  deviceData.Device.SetTemperature = (deviceData.Device.DefaultCoolingSetTemperature + deviceData.Device.DefaultHeatingSetTemperature) / 2;
209
208
  break;
210
209
  default:
211
- break;
210
+ if (this.logWarn) this.emit('warn', `Unknown operation mode: ${deviceData.Device.OperationMode}`);
211
+ return;
212
212
  }
213
213
  break;
214
-
215
214
  case 2: // Thermostat
216
215
  break;
217
-
218
216
  default:
217
+ if (this.logWarn) this.emit('warn', `Unknown display mode: ${displayMode}`);
219
218
  return;
220
219
  }
221
220
 
@@ -239,6 +238,7 @@ class MelCloudAta extends EventEmitter {
239
238
  HasPendingCommand: true
240
239
  }
241
240
  };
241
+ if (this.logDebug) this.emit('debug', `Send Data: ${JSON.stringify(settings.data, null, 2)}`);
242
242
 
243
243
  await axiosInstancePost(ApiUrls.SetAta, payload);
244
244
  this.emit('deviceState', deviceData);
@@ -264,7 +264,6 @@ class MelCloudAta extends EventEmitter {
264
264
  });
265
265
 
266
266
  // Calculate temp
267
- this.emit('warn', JSON.stringify(deviceData.Device, null, 2));
268
267
  switch (displayMode) {
269
268
  case 1: //Heather/Cooler
270
269
  switch (deviceData.Device.OperationMode) {
@@ -288,14 +287,14 @@ class MelCloudAta extends EventEmitter {
288
287
  break;
289
288
  default:
290
289
  if (this.logWarn) this.emit('warn', `Unknown operation mode: ${deviceData.Device.OperationMode}`);
291
- break;
290
+ return;
292
291
  };
293
292
  case 2: //Thermostat
294
293
  deviceData.Device.SetTemperature = deviceData.Device.SetTemperature;
295
294
  break;
296
295
  default:
297
296
  if (this.logWarn) this.emit('warn', `Unknown display mode: ${displayMode}`);
298
- break;
297
+ return;
299
298
  };
300
299
 
301
300
  const settings = {
@@ -308,8 +307,7 @@ class MelCloudAta extends EventEmitter {
308
307
  VaneVerticalDirection: AirConditioner.VaneVerticalDirectionMapEnumToString[deviceData.Device.VaneVerticalDirection]
309
308
  }
310
309
  };
311
-
312
- this.emit('warn', JSON.stringify(settings, null, 2));
310
+ if (this.logDebug) this.emit('debug', `Send Data: ${JSON.stringify(settings.data, null, 2)}`);
313
311
 
314
312
  const path = ApiUrlsHome.SetAta.replace('deviceid', deviceData.DeviceID);
315
313
  await axiosInstancePut(path, settings);