homebridge-melcloud-control 4.4.0-beta.17 → 4.4.0-beta.18
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 +7 -2
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.18",
|
|
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
|
@@ -24,12 +24,15 @@ class MelCloudAta extends EventEmitter {
|
|
|
24
24
|
//set default values
|
|
25
25
|
this.deviceData = {};
|
|
26
26
|
this.client = melcloud.client;
|
|
27
|
+
this.lock = false;
|
|
27
28
|
|
|
28
29
|
//handle melcloud events
|
|
29
30
|
let deviceData = null;
|
|
30
31
|
melcloud.on('client', (client) => {
|
|
31
32
|
this.client = client;
|
|
32
33
|
}).on('devicesList', async (devicesData) => {
|
|
34
|
+
if (this.lock) return;
|
|
35
|
+
|
|
33
36
|
try {
|
|
34
37
|
deviceData = devicesData.Devices.find(device => device.DeviceID === this.deviceId);
|
|
35
38
|
if (!deviceData) return;
|
|
@@ -321,9 +324,11 @@ class MelCloudAta extends EventEmitter {
|
|
|
321
324
|
}
|
|
322
325
|
|
|
323
326
|
update(deviceData) {
|
|
327
|
+
this.lock = true;
|
|
328
|
+
this.emit('deviceState', deviceData)
|
|
324
329
|
setTimeout(() => {
|
|
325
|
-
this.
|
|
326
|
-
},
|
|
330
|
+
this.lock = false;
|
|
331
|
+
}, 5000);
|
|
327
332
|
}
|
|
328
333
|
}
|
|
329
334
|
|