homebridge-melcloud-control 4.3.0-beta.46 → 4.3.0-beta.48

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.3.0-beta.46",
4
+ "version": "4.3.0-beta.48",
5
5
  "description": "Homebridge plugin to control Mitsubishi Air Conditioner, Heat Pump and Energy Recovery Ventilation.",
6
6
  "license": "MIT",
7
7
  "author": "grzegorz914",
@@ -92,11 +92,6 @@ class MelCloudAta extends EventEmitter {
92
92
  this.headers = devicesData.Headers;
93
93
  const deviceData = devicesData.Devices.find(device => device.DeviceID === this.deviceId);
94
94
 
95
- //check state changes
96
- const deviceDataHasNotChanged = JSON.stringify(deviceData) === JSON.stringify(this.deviceData);
97
- if (deviceDataHasNotChanged) return;
98
- this.deviceData = deviceData;
99
-
100
95
  if (this.accountType === 'melcloudhome') {
101
96
  deviceData.Scenes = devicesData.Scenes ?? [];
102
97
  deviceData.Device.OperationMode = AirConditioner.OperationModeMapStringToEnum[deviceData.Device.OperationMode] ?? deviceData.Device.OperationMode;
@@ -147,8 +142,9 @@ class MelCloudAta extends EventEmitter {
147
142
  if (parsedMessage.message === 'Forbidden') return;
148
143
 
149
144
  const messageData = parsedMessage?.[0]?.Data;
150
- const unitId = messageData?.id;
145
+ if (!messageData) return;
151
146
 
147
+ const unitId = messageData?.id;
152
148
  switch (unitId) {
153
149
  case this.deviceId:
154
150
  const messageType = parsedMessage[0].messageType;
@@ -227,6 +223,11 @@ class MelCloudAta extends EventEmitter {
227
223
  this.emit('mqtt', 'State', deviceData.Device);
228
224
  }
229
225
 
226
+ //check state changes
227
+ const deviceDataHasNotChanged = JSON.stringify(deviceData) === JSON.stringify(this.deviceData);
228
+ if (deviceDataHasNotChanged) return;
229
+ this.deviceData = deviceData;
230
+
230
231
  //emit info
231
232
  this.emit('deviceInfo', indoor.model, outdoor.model, serialNumber, firmwareAppVersion);
232
233