homebridge-melcloud-control 4.4.0-beta.21 → 4.4.0-beta.22
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 +1 -15
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"displayName": "MELCloud Control",
|
|
3
3
|
"name": "homebridge-melcloud-control",
|
|
4
|
-
"version": "4.4.0-beta.
|
|
4
|
+
"version": "4.4.0-beta.22",
|
|
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
|
@@ -32,8 +32,6 @@ class MelCloudAta extends EventEmitter {
|
|
|
32
32
|
this.client = client;
|
|
33
33
|
}).on('devicesList', async (devicesData) => {
|
|
34
34
|
try {
|
|
35
|
-
if (this.lock) return;
|
|
36
|
-
|
|
37
35
|
deviceData = devicesData.Devices.find(device => device.DeviceID === this.deviceId);
|
|
38
36
|
if (!deviceData) return;
|
|
39
37
|
deviceData.Scenes = devicesData.Scenes ?? [];
|
|
@@ -47,7 +45,7 @@ class MelCloudAta extends EventEmitter {
|
|
|
47
45
|
}).on('webSocket', async (parsedMessage) => {
|
|
48
46
|
try {
|
|
49
47
|
const messageData = parsedMessage?.[0]?.Data;
|
|
50
|
-
if (!messageData || !deviceData
|
|
48
|
+
if (!messageData || !deviceData) return;
|
|
51
49
|
|
|
52
50
|
let updateState = false;
|
|
53
51
|
const unitId = messageData?.id;
|
|
@@ -199,7 +197,6 @@ class MelCloudAta extends EventEmitter {
|
|
|
199
197
|
let method = null
|
|
200
198
|
let payload = {};
|
|
201
199
|
let path = '';
|
|
202
|
-
let update = false;
|
|
203
200
|
switch (accountType) {
|
|
204
201
|
case "melcloud":
|
|
205
202
|
switch (flag) {
|
|
@@ -252,7 +249,6 @@ class MelCloudAta extends EventEmitter {
|
|
|
252
249
|
};
|
|
253
250
|
method = 'POST';
|
|
254
251
|
path = ApiUrlsHome.PostProtectionFrost;
|
|
255
|
-
update = true;
|
|
256
252
|
break;
|
|
257
253
|
case 'overheatprotection':
|
|
258
254
|
payload = {
|
|
@@ -263,7 +259,6 @@ class MelCloudAta extends EventEmitter {
|
|
|
263
259
|
};
|
|
264
260
|
method = 'POST';
|
|
265
261
|
path = ApiUrlsHome.PostProtectionOverheat;
|
|
266
|
-
update = true;
|
|
267
262
|
break;
|
|
268
263
|
case 'holidaymode':
|
|
269
264
|
payload = {
|
|
@@ -315,7 +310,6 @@ class MelCloudAta extends EventEmitter {
|
|
|
315
310
|
//send payload
|
|
316
311
|
if (this.logDebug) this.emit('debug', `Send data: ${JSON.stringify(payload, null, 2)}`);
|
|
317
312
|
await this.client(path, { method: method, data: payload });
|
|
318
|
-
if (update) this.update(deviceData);
|
|
319
313
|
|
|
320
314
|
return true;
|
|
321
315
|
default:
|
|
@@ -325,14 +319,6 @@ class MelCloudAta extends EventEmitter {
|
|
|
325
319
|
throw new Error(`Send data error: ${error.message}`);
|
|
326
320
|
}
|
|
327
321
|
}
|
|
328
|
-
|
|
329
|
-
update(deviceData) {
|
|
330
|
-
this.lock = true;
|
|
331
|
-
this.emit('deviceState', deviceData)
|
|
332
|
-
setTimeout(() => {
|
|
333
|
-
this.lock = false;
|
|
334
|
-
}, 5000);
|
|
335
|
-
}
|
|
336
322
|
}
|
|
337
323
|
|
|
338
324
|
export default MelCloudAta;
|