homebridge-melcloud-control 4.3.2-beta.18 → 4.3.2-beta.19

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.2-beta.18",
4
+ "version": "4.3.2-beta.19",
5
5
  "description": "Homebridge plugin to control Mitsubishi Air Conditioner, Heat Pump and Energy Recovery Ventilation.",
6
6
  "license": "MIT",
7
7
  "author": "grzegorz914",
@@ -126,11 +126,6 @@ class MelCloudAta extends EventEmitter {
126
126
  this.emit('mqtt', 'State', deviceData.Device);
127
127
  }
128
128
 
129
- //check state changes
130
- const deviceDataNotChanged = JSON.stringify(deviceData) === JSON.stringify(this.deviceData);
131
- if (deviceDataNotChanged) return;
132
- this.deviceData = deviceData;
133
-
134
129
  //emit info
135
130
  this.emit('deviceInfo', indoor.model, outdoor.model, serialNumber, firmwareAppVersion);
136
131
 
@@ -154,6 +149,15 @@ class MelCloudAta extends EventEmitter {
154
149
  const deviceData = devicesData.Devices.find(device => device.DeviceID === this.deviceId);
155
150
  deviceData.Scenes = devicesData.Scenes ?? [];
156
151
 
152
+ //check state changes
153
+ const deviceDataNotChanged = JSON.stringify(deviceData) === JSON.stringify(this.deviceData);
154
+ if (!deviceDataNotChanged) {
155
+ this.deviceData = deviceData;
156
+
157
+ //update state
158
+ await this.updateState(deviceData);
159
+ }
160
+
157
161
  //web cocket connection
158
162
  if (this.accountType === 'melcloudhome' && !this.connecting && !this.socketConnected) {
159
163
  this.connecting = true;
@@ -234,9 +238,6 @@ class MelCloudAta extends EventEmitter {
234
238
  }
235
239
  }
236
240
 
237
- //update state
238
- await this.updateState(deviceData);
239
-
240
241
  return true;
241
242
  } catch (error) {
242
243
  throw new Error(`Check state error: ${error.message}`);