homebridge-melcloud-control 3.1.7 → 3.1.9

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/CHANGELOG.md CHANGED
@@ -16,6 +16,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
16
16
  - do not configure it manually, always using Config UI X
17
17
  - required Homebridge v2.0.0 and above
18
18
 
19
+ ## [3.1.9] - (05.08.2024)
20
+
21
+ ## Changes
22
+
23
+ - prevent load device if display mode set to 0 or unknown [#150](https://github.com/grzegorz914/homebridge-melcloud-control/issues/150)
24
+ - cleanup
25
+
26
+ ## [3.1.8] - (03.08.2024)
27
+
28
+ ## Changes
29
+
30
+ - fix [#149](https://github.com/grzegorz914/homebridge-melcloud-control/issues/149)
31
+ - cleanup
32
+
19
33
  ## [3.1.4] - (02.08.2024)
20
34
 
21
35
  ## Changes
@@ -183,6 +183,8 @@
183
183
  const ataDevicesInConfigExist = pluginConfig[0].accounts[this.deviceIndex].ataDevices ?? false;
184
184
  const atwDevicesInConfigExist = pluginConfig[0].accounts[this.deviceIndex].atwDevices ?? false;
185
185
  const ervDevicesInConfigExist = pluginConfig[0].accounts[this.deviceIndex].ervDevices ?? false;
186
+
187
+ //check key of devices in config exist
186
188
  const ataDevicesInConfig = !ataDevicesInConfigExist ? pluginConfig[0].accounts[this.deviceIndex].ataDevices = [] : ataDevicesInConfigExist;
187
189
  const atwDevicesInConfig = !atwDevicesInConfigExist ? pluginConfig[0].accounts[this.deviceIndex].atwDevices = [] : atwDevicesInConfigExist;
188
190
  const ervDevicesInConfig = !ervDevicesInConfigExist ? pluginConfig[0].accounts[this.deviceIndex].ervDevices = [] : ervDevicesInConfigExist;
package/index.js CHANGED
@@ -107,8 +107,9 @@ class MelCloudPlatform {
107
107
  for (const device of account.ataDevices) {
108
108
  //chack device from config exist on melcloud
109
109
  const deviceId = device.id;
110
+ const displayMode = device.displayMode > 0 ?? false;
110
111
  const deviceExistInMelCloud = devices.some(dev => dev.DeviceID === deviceId);
111
- if (!deviceExistInMelCloud || device.displayMode === 0) {
112
+ if (!deviceExistInMelCloud || !displayMode) {
112
113
  continue;
113
114
  };
114
115
 
@@ -145,8 +146,9 @@ class MelCloudPlatform {
145
146
  for (const device of account.atwDevices) {
146
147
  //chack device from config exist on melcloud
147
148
  const deviceId = device.id;
148
- const deviceExistInMelCloud = devices.some(dev => dev.DeviceID === device.id);
149
- if (!deviceExistInMelCloud || device.displayMode === 0) {
149
+ const displayMode = device.displayMode > 0 ?? false;
150
+ const deviceExistInMelCloud = devices.some(dev => dev.DeviceID === deviceId);
151
+ if (!deviceExistInMelCloud || !displayMode) {
150
152
  continue;
151
153
  };
152
154
 
@@ -183,8 +185,9 @@ class MelCloudPlatform {
183
185
  for (const device of account.ervDevices) {
184
186
  //chack device from config exist on melcloud
185
187
  const deviceId = device.id;
186
- const deviceExistInMelCloud = devices.some(dev => dev.DeviceID === device.id);
187
- if (!deviceExistInMelCloud || device.displayMode === 0) {
188
+ const displayMode = device.displayMode > 0 ?? false;
189
+ const deviceExistInMelCloud = devices.some(dev => dev.DeviceID === deviceId);
190
+ if (!deviceExistInMelCloud || !displayMode) {
188
191
  continue;
189
192
  };
190
193
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "displayName": "MELCloud Control",
3
3
  "name": "homebridge-melcloud-control",
4
- "version": "3.1.7",
4
+ "version": "3.1.9",
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
@@ -812,23 +812,23 @@ class DeviceAta extends EventEmitter {
812
812
  let fanSpeedModeText = 0; //AUTO, 1, 2, 3, 4, 5, 6, OFF
813
813
  switch (numberOfFanSpeeds) {
814
814
  case 2: //Fan speed mode 2
815
- deviceState.fanSpeed = hasAutomaticFanSpeed ? [0, 1, 2, 0][value] : [1, 1, 2][value];
815
+ deviceState.SetFanSpeed = hasAutomaticFanSpeed ? [0, 1, 2, 0][value] : [1, 1, 2][value];
816
816
  fanSpeedModeText = hasAutomaticFanSpeed ? [7, 1, 2, 0][value] : [7, 1, 2][value];
817
817
  break;
818
818
  case 3: //Fan speed mode 3
819
- deviceState.fanSpeed = hasAutomaticFanSpeed ? [0, 1, 2, 3, 0][value] : [1, 1, 2, 3][value];
819
+ deviceState.SetFanSpeed = hasAutomaticFanSpeed ? [0, 1, 2, 3, 0][value] : [1, 1, 2, 3][value];
820
820
  fanSpeedModeText = hasAutomaticFanSpeed ? [7, 1, 2, 3, 0][value] : [7, 1, 2, 3][value];
821
821
  break;
822
822
  case 4: //Fan speed mode 4
823
- deviceState.fanSpeed = hasAutomaticFanSpeed ? [0, 1, 2, 3, 4, 0][value] : [1, 1, 2, 3, 4][value];
823
+ deviceState.SetFanSpeed = hasAutomaticFanSpeed ? [0, 1, 2, 3, 4, 0][value] : [1, 1, 2, 3, 4][value];
824
824
  fanSpeedModeText = hasAutomaticFanSpeed ? [7, 1, 2, 3, 4, 0][value] : [7, 1, 2, 3, 4][value];
825
825
  break;
826
826
  case 5: //Fan speed mode 5
827
- deviceState.fanSpeed = hasAutomaticFanSpeed ? [0, 1, 2, 3, 4, 5, 0][value] : [1, 1, 2, 3, 4, 5][value];
827
+ deviceState.SetFanSpeed = hasAutomaticFanSpeed ? [0, 1, 2, 3, 4, 5, 0][value] : [1, 1, 2, 3, 4, 5][value];
828
828
  fanSpeedModeText = hasAutomaticFanSpeed ? [7, 1, 2, 3, 4, 5, 0][value] : [7, 1, 2, 3, 4, 5][value];
829
829
  break;
830
830
  case 6: //Fan speed mode 6
831
- deviceState.fanSpeed = hasAutomaticFanSpeed ? [0, 1, 2, 3, 4, 5, 6, 0][value] : [1, 1, 2, 3, 4, 5, 6][value];
831
+ deviceState.SetFanSpeed = hasAutomaticFanSpeed ? [0, 1, 2, 3, 4, 5, 6, 0][value] : [1, 1, 2, 3, 4, 5, 6][value];
832
832
  fanSpeedModeText = hasAutomaticFanSpeed ? [7, 1, 2, 3, 4, 5, 6, 0][value] : [7, 1, 2, 3, 4, 5, 6][value];
833
833
  break;
834
834
  };
package/src/deviceatw.js CHANGED
@@ -440,9 +440,6 @@ class DeviceAtw extends EventEmitter {
440
440
  .updateCharacteristic(Characteristic.TemperatureDisplayUnits, useFahrenheit);
441
441
  }
442
442
  break;
443
- default: //unknown display type detected
444
- this.emit('message', `Unknown display type: ${displayType} detected.`);
445
- break;
446
443
  };
447
444
 
448
445
  //push value to arrays
package/src/deviceerv.js CHANGED
@@ -747,24 +747,22 @@ class DeviceErv extends EventEmitter {
747
747
  })
748
748
  .onSet(async (value) => {
749
749
  try {
750
- let fanSpeed = 0; //AUTO, 1, 2, 3, 4
751
750
  let fanSpeedModeText = 0; //AUTO, 1, 2, 3, 4, OFF
752
751
  switch (ataNumberOfFanSpeeds) {
753
752
  case 2: //Fan speed mode 2
754
- fanSpeed = ataHasAutomaticFanSpeed ? [0, 1, 2, 0][value] : [1, 1, 2][value];
753
+ deviceState.SetFanSpeed = ataHasAutomaticFanSpeed ? [0, 1, 2, 0][value] : [1, 1, 2][value];
755
754
  fanSpeedModeText = ataHasAutomaticFanSpeed ? [5, 1, 2, 0][value] : [5, 1, 2][value];
756
755
  break;
757
756
  case 3: //Fan speed mode 3
758
- fanSpeed = ataHasAutomaticFanSpeed ? [0, 1, 2, 3, 0][value] : [1, 1, 2, 3][value];
757
+ deviceState.SetFanSpeed = ataHasAutomaticFanSpeed ? [0, 1, 2, 3, 0][value] : [1, 1, 2, 3][value];
759
758
  fanSpeedModeText = ataHasAutomaticFanSpeed ? [5, 1, 2, 3, 0][value] : [5, 1, 2, 3][value];
760
759
  break;
761
760
  case 4: //Fan speed mode 4
762
- fanSpeed = ataHasAutomaticFanSpeed ? [0, 1, 2, 3, 4, 0][value] : [1, 1, 2, 3, 4][value];
761
+ deviceState.SetFanSpeed = ataHasAutomaticFanSpeed ? [0, 1, 2, 3, 4, 0][value] : [1, 1, 2, 3, 4][value];
763
762
  fanSpeedModeText = ataHasAutomaticFanSpeed ? [5, 1, 2, 3, 4, 0][value] : [5, 1, 2, 3, 4][value];
764
763
  break;
765
764
  };
766
765
 
767
- deviceState.SetFanSpeed = fanSpeed;
768
766
  deviceState.EffectiveFlags = CONSTANTS.Ventilation.EffectiveFlags.SetFanSpeed;
769
767
  await this.melCloudErv.send(deviceState);
770
768
  const info = this.disableLogInfo ? false : this.emit('message', `Set fan speed mode: ${CONSTANTS.Ventilation.FanSpeed[fanSpeedModeText]}`);