homebridge-melcloud-control 4.0.0-beta.177 → 4.0.0-beta.179

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.177",
4
+ "version": "4.0.0-beta.179",
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,6 +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: "Auto", 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", 6: "Auto" },
46
+ FanSpeedCurrentMapEnumToString: { 0: "Zero", 1: "One", 2: "Two", 3: "Three", 4: "Four", 5: "Five", 6: "Auto" },
46
47
  VaneVerticalDirectionMapStringToEnum: { "Auto": 0, "One": 1, "Two": 2, "Three": 3, "Four": 4, "Five": 5, "Six": 6, "Swing": 7 },
47
48
  VaneVerticalDirectionMapEnumToString: { 0: "Auto", 1: "One", 2: "Two", 3: "Three", 4: "Four", 5: "Five", 6: "Six", 7: "Swing" },
48
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 },
package/src/deviceata.js CHANGED
@@ -319,19 +319,20 @@ class DeviceAta extends EventEmitter {
319
319
  try {
320
320
  switch (value) {
321
321
  case 0: //AUTO - AUTO
322
- deviceData.Device.OperationMode = autoDryFanMode;
322
+ value = autoDryFanMode;
323
323
  break;
324
324
  case 1: //HEAT - HEAT
325
- deviceData.Device.OperationMode = heatDryFanMode;
325
+ value = heatDryFanMode;
326
326
  break;
327
327
  case 2: //COOL - COOL
328
- deviceData.Device.OperationMode = coolDryFanMode;
328
+ value = coolDryFanMode;
329
329
  break;
330
330
  };
331
331
 
332
+ deviceData.Device.OperationMode = value;
332
333
  deviceData.Device.EffectiveFlags = AirConditioner.EffectiveFlags.OperationMode;
333
334
  await this.melCloudAta.send(this.accountType, this.displayMode, deviceData);
334
- if (this.logInfo) this.emit('info', `Set operation mode: ${AirConditioner.OperationModeMapEnumToString[deviceData.Device.OperationMode]}`);
335
+ if (this.logInfo) this.emit('info', `Set operation mode: ${AirConditioner.OperationModeMapEnumToString[value]}`);
335
336
  } catch (error) {
336
337
  if (this.logWarn) this.emit('warn', `Set operation mode error: ${error}`);
337
338
  };
@@ -357,21 +358,23 @@ class DeviceAta extends EventEmitter {
357
358
  const fanKey = this.accountType === 'melcloud' ? 'FanSpeed' : 'SetFanSpeed';
358
359
  switch (numberOfFanSpeeds) {
359
360
  case 2: //Fan speed mode 2
360
- deviceData.Device[fanKey] = supportsAutomaticFanSpeed ? [0, 1, 2, 0][value] : [1, 1, 2][value];
361
+ value = supportsAutomaticFanSpeed ? [0, 1, 2, 0][value] : [1, 1, 2][value];
361
362
  break;
362
363
  case 3: //Fan speed mode 3
363
- deviceData.Device[fanKey] = supportsAutomaticFanSpeed ? [0, 1, 2, 3, 0][value] : [1, 1, 2, 3][value];
364
+ value = supportsAutomaticFanSpeed ? [0, 1, 2, 3, 0][value] : [1, 1, 2, 3][value];
364
365
  break;
365
366
  case 4: //Fan speed mode 4
366
- deviceData.Device[fanKey] = supportsAutomaticFanSpeed ? [0, 1, 2, 3, 4, 0][value] : [1, 1, 2, 3, 4][value];
367
+ value = supportsAutomaticFanSpeed ? [0, 1, 2, 3, 4, 0][value] : [1, 1, 2, 3, 4][value];
367
368
  break;
368
369
  case 5: //Fan speed mode 5
369
- deviceData.Device[fanKey] = supportsAutomaticFanSpeed ? [0, 1, 2, 3, 4, 5, 0][value] : [1, 1, 2, 3, 4, 5][value];
370
+ value = supportsAutomaticFanSpeed ? [0, 1, 2, 3, 4, 5, 0][value] : [1, 1, 2, 3, 4, 5][value];
370
371
  break;
371
372
  };
373
+
374
+ deviceData.Device[fanKey] = value
372
375
  deviceData.Device.EffectiveFlags = AirConditioner.EffectiveFlags.SetFanSpeed;
373
376
  await this.melCloudAta.send(this.accountType, this.displayMode, deviceData);
374
- if (this.logInfo) this.emit('info', `Set fan speed mode: ${AirConditioner.FanSpeedMapEnumToString[deviceData.Device[fanKey]]}`);
377
+ if (this.logInfo) this.emit('info', `Set fan speed mode: ${AirConditioner.FanSpeedMapEnumToString[value]}`);
375
378
  } catch (error) {
376
379
  if (this.logWarn) this.emit('warn', `Set fan speed mode error: ${error}`);
377
380
  };
@@ -498,28 +501,30 @@ class DeviceAta extends EventEmitter {
498
501
  try {
499
502
  switch (value) {
500
503
  case 0: //OFF - POWER OFF
504
+ value = deviceData.Device.OperationMode;
501
505
  deviceData.Device.Power = false;
502
506
  deviceData.Device.EffectiveFlags = AirConditioner.EffectiveFlags.Power;
503
507
  break;
504
508
  case 1: //HEAT - HEAT
505
509
  deviceData.Device.Power = true;
506
- deviceData.Device.OperationMode = heatDryFanMode;
510
+ value = heatDryFanMode;
507
511
  deviceData.Device.EffectiveFlags = AirConditioner.EffectiveFlags.PowerOperationModeSetTemperature;
508
512
  break;
509
513
  case 2: //COOL - COOL
514
+ value = coolDryFanMode;
510
515
  deviceData.Device.Power = true;
511
- deviceData.Device.OperationMode = coolDryFanMode;
512
516
  deviceData.Device.EffectiveFlags = AirConditioner.EffectiveFlags.PowerOperationModeSetTemperature
513
517
  break;
514
518
  case 3: //AUTO - AUTO
519
+ value = autoDryFanMode;
515
520
  deviceData.Device.Power = true;
516
- deviceData.Device.OperationMode = autoDryFanMode;
517
521
  deviceData.Device.EffectiveFlags = AirConditioner.EffectiveFlags.PowerOperationModeSetTemperature;
518
522
  break;
519
523
  };
520
524
 
525
+ deviceData.Device.OperationMode = value;
521
526
  await this.melCloudAta.send(this.accountType, this.displayMode, deviceData);
522
- const operationModeText = AirConditioner.OperationModeMapEnumToString[deviceData.Device.OperationMode];
527
+ const operationModeText = AirConditioner.OperationModeMapEnumToString[value];
523
528
  if (this.logInfo) this.emit('info', `Set operation mode: ${operationModeText}`);
524
529
  } catch (error) {
525
530
  if (this.logWarn) this.emit('warn', `Set operation mode error: ${error}`);
@@ -1108,8 +1113,8 @@ class DeviceAta extends EventEmitter {
1108
1113
  .updateCharacteristic(Characteristic.CurrentTemperature, roomTemperature)
1109
1114
  .updateCharacteristic(Characteristic.LockPhysicalControls, obj.lockPhysicalControl)
1110
1115
  .updateCharacteristic(Characteristic.TemperatureDisplayUnits, obj.useFahrenheit)
1111
- .updateCharacteristic(Characteristic.CoolingThresholdTemperature, obj.targetOperationMode === 0 ? defaultCoolingSetTemperature : setTemperature);
1112
- if (supportsHeat) this.melCloudService?.updateCharacteristic(Characteristic.HeatingThresholdTemperature, obj.targetOperationMode === 0 ? defaultHeatingSetTemperature : setTemperature);
1116
+ .updateCharacteristic(Characteristic.CoolingThresholdTemperature, operationMode === 8 ? defaultCoolingSetTemperature : setTemperature);
1117
+ if (supportsHeat) this.melCloudService?.updateCharacteristic(Characteristic.HeatingThresholdTemperature, operationMode === 8 ? defaultHeatingSetTemperature : setTemperature);
1113
1118
  if (supportsFanSpeed) this.melCloudService?.updateCharacteristic(Characteristic.RotationSpeed, obj.currentFanSpeed);
1114
1119
  if (supportsSwingFunction) this.melCloudService?.updateCharacteristic(Characteristic.SwingMode, obj.currentSwingMode);
1115
1120
  break;
@@ -1319,7 +1324,7 @@ class DeviceAta extends EventEmitter {
1319
1324
  this.emit('info', `Current temperature: ${roomTemperature}${obj.temperatureUnit}`);
1320
1325
  if (supportsOutdoorTemperature && outdoorTemperature !== null) this.emit('info', `Outdoor temperature: ${outdoorTemperature}${obj.temperatureUnit}`);
1321
1326
  if (supportsFanSpeed) this.emit('info', `Target fan speed: ${AirConditioner.FanSpeedMapEnumToString[setFanSpeed]}`);
1322
- if (supportsFanSpeed) this.emit('info', `Current fan speed: ${AirConditioner.FanSpeedMapEnumToString[actualFanSpeed]}`);
1327
+ if (supportsFanSpeed) this.emit('info', `Current fan speed: ${AirConditioner.FanSpeedCurrentMapEnumToString[actualFanSpeed]}`);
1323
1328
  if (vaneHorizontalDirection !== null) this.emit('info', `Vane horizontal: ${AirConditioner.VaneHorizontalDirectionMapEnumToString[vaneHorizontalDirection]}`);
1324
1329
  if (vaneVerticalDirection !== null) this.emit('info', `Vane vertical: ${AirConditioner.VaneVerticalDirectionMapEnumToString[vaneVerticalDirection]}`);
1325
1330
  if (supportsSwingFunction) this.emit('info', `Air direction: ${AirConditioner.AirDirectionMapEnumToString[obj.currentSwingMode]}`);