homebridge-melcloud-control 4.4.0-beta.21 → 4.4.0-beta.23

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/melcloudata.js +3 -12
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.21",
4
+ "version": "4.4.0-beta.23",
5
5
  "description": "Homebridge plugin to control Mitsubishi Air Conditioner, Heat Pump and Energy Recovery Ventilation.",
6
6
  "license": "MIT",
7
7
  "author": "grzegorz914",
@@ -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 || this.lock) return;
48
+ if (!messageData || !deviceData) return;
51
49
 
52
50
  let updateState = false;
53
51
  const unitId = messageData?.id;
@@ -279,6 +277,7 @@ class MelCloudAta extends EventEmitter {
279
277
  payload = { enabled: deviceData.ScheduleEnabled };
280
278
  method = 'PUT';
281
279
  path = ApiUrlsHome.PutScheduleEnabled.replace('deviceid', deviceData.DeviceID);
280
+ update = true;
282
281
  break;
283
282
  case 'scene':
284
283
  method = 'PUT';
@@ -315,7 +314,7 @@ class MelCloudAta extends EventEmitter {
315
314
  //send payload
316
315
  if (this.logDebug) this.emit('debug', `Send data: ${JSON.stringify(payload, null, 2)}`);
317
316
  await this.client(path, { method: method, data: payload });
318
- if (update) this.update(deviceData);
317
+ if (update) this.emit('deviceState', deviceData);
319
318
 
320
319
  return true;
321
320
  default:
@@ -325,14 +324,6 @@ class MelCloudAta extends EventEmitter {
325
324
  throw new Error(`Send data error: ${error.message}`);
326
325
  }
327
326
  }
328
-
329
- update(deviceData) {
330
- this.lock = true;
331
- this.emit('deviceState', deviceData)
332
- setTimeout(() => {
333
- this.lock = false;
334
- }, 5000);
335
- }
336
327
  }
337
328
 
338
329
  export default MelCloudAta;