homebridge-melcloud-control 4.3.2-beta.10 → 4.3.2-beta.11
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 +1 -1
- package/src/melcloudata.js +9 -10
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.
|
|
4
|
+
"version": "4.3.2-beta.11",
|
|
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/melcloudata.js
CHANGED
|
@@ -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 deviceDataHasNotChanged = JSON.stringify(deviceData) === JSON.stringify(this.deviceData);
|
|
131
|
-
if (deviceDataHasNotChanged) return;
|
|
132
|
-
this.deviceData = deviceData;
|
|
133
|
-
|
|
134
129
|
//emit info
|
|
135
130
|
this.emit('deviceInfo', indoor.model, outdoor.model, serialNumber, firmwareAppVersion);
|
|
136
131
|
|
|
@@ -195,7 +190,7 @@ class MelCloudAta extends EventEmitter {
|
|
|
195
190
|
const messageData = parsedMessage?.[0]?.Data;
|
|
196
191
|
if (!messageData) return;
|
|
197
192
|
|
|
198
|
-
let
|
|
193
|
+
let updateState = false;
|
|
199
194
|
const unitId = messageData?.id;
|
|
200
195
|
switch (unitId) {
|
|
201
196
|
case this.deviceId:
|
|
@@ -209,11 +204,11 @@ class MelCloudAta extends EventEmitter {
|
|
|
209
204
|
})
|
|
210
205
|
);
|
|
211
206
|
Object.assign(deviceData.Device, settings);
|
|
212
|
-
|
|
207
|
+
updateState = true;
|
|
213
208
|
break;
|
|
214
209
|
case 'unitWifiSignalChanged':
|
|
215
210
|
deviceData.Rssi = messageData.rssi;
|
|
216
|
-
|
|
211
|
+
updateState = true;
|
|
217
212
|
break;
|
|
218
213
|
default:
|
|
219
214
|
if (!this.logDebug) this.emit('debug', `Unit ${unitId}, received unknown message type: ${stringifyMessage}`);
|
|
@@ -226,14 +221,18 @@ class MelCloudAta extends EventEmitter {
|
|
|
226
221
|
}
|
|
227
222
|
|
|
228
223
|
//update state
|
|
229
|
-
if (
|
|
224
|
+
if (updateState) await this.updateState(deviceData);
|
|
230
225
|
});
|
|
231
226
|
} catch (error) {
|
|
232
227
|
if (this.logError) this.emit('error', `Socket connection failed: ${error}`);
|
|
233
228
|
this.cleanupSocket();
|
|
234
229
|
}
|
|
235
230
|
}
|
|
236
|
-
|
|
231
|
+
|
|
232
|
+
//check state changes
|
|
233
|
+
const deviceDataHasNotChanged = JSON.stringify(deviceData) === JSON.stringify(this.deviceData);
|
|
234
|
+
if (deviceDataHasNotChanged) return;
|
|
235
|
+
this.deviceData = deviceData;
|
|
237
236
|
|
|
238
237
|
//update state
|
|
239
238
|
await this.updateState(deviceData);
|