homebridge-melcloud-control 4.3.2-beta.12 → 4.3.2-beta.14

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