homebridge-melcloud-control 3.3.21-beta.4 → 3.3.21-beta.6

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": "3.3.21-beta.4",
4
+ "version": "3.3.21-beta.6",
5
5
  "description": "Homebridge plugin to control Mitsubishi Air Conditioner, Heat Pump and Energy Recovery Ventilation.",
6
6
  "license": "MIT",
7
7
  "author": "grzegorz914",
@@ -58,14 +58,14 @@
58
58
  ],
59
59
  "HorizontalVane": [
60
60
  "AUTO",
61
- "1",
62
- "2",
63
- "3",
64
- "4",
65
- "5",
66
- "SPLIT",
61
+ "LL",
62
+ "L",
63
+ "C",
64
+ "R",
65
+ "RR",
66
+ "6",
67
67
  "7",
68
- "8",
68
+ "SPLIT",
69
69
  "9",
70
70
  "10",
71
71
  "11",
package/src/deviceata.js CHANGED
@@ -597,8 +597,8 @@ class DeviceAta extends EventEmitter {
597
597
  const info = hasOutdoorTemperature && outdoorTemperature !== null ? this.emit('message', `Outdoor temperature: ${outdoorTemperature}${this.accessory.temperatureUnit}`) : false;
598
598
  const info3 = modelSupportsFanSpeed ? this.emit('message', `Target fan speed: ${CONSTANTS.AirConditioner.FanSpeed[fanSpeed]}`) : false;
599
599
  const info4 = modelSupportsFanSpeed ? this.emit('message', `Current fan speed: ${CONSTANTS.AirConditioner.FanSpeed[actualFanSpeed]}`) : false;
600
- const info5 = vaneHorizontalDirection !== null ? this.emit('message', `Vane horizontal: ${CONSTANTS.AirConditioner.HorizontalVane[vaneHorizontalDirection]}`) : false;
601
- const info6 = vaneVerticalDirection !== null ? this.emit('message', `Vane vertical: ${CONSTANTS.AirConditioner.VerticalVane[vaneVerticalDirection]}`) : false;
600
+ const info5 = vaneHorizontalDirection !== null ? this.emit('message', `Vane horizontal: ${CONSTANTS.AirConditioner.HorizontalVane[vaneHorizontalDirection] ?? vaneHorizontalDirection}`) : false;
601
+ const info6 = vaneVerticalDirection !== null ? this.emit('message', `Vane vertical: ${CONSTANTS.AirConditioner.VerticalVane[vaneVerticalDirection] ?? vaneVerticalDirection}`) : false;
602
602
  const info7 = swingFunction ? this.emit('message', `Air direction: ${CONSTANTS.AirConditioner.AirDirection[this.accessory.swingMode]}`) : false;
603
603
  this.emit('message', `Temperature display unit: ${this.accessory.temperatureUnit}`);
604
604
  this.emit('message', `Lock physical controls: ${this.accessory.lockPhysicalControl ? 'LOCKED' : 'UNLOCKED'}`);
@@ -334,18 +334,20 @@ class MelCloudAta extends EventEmitter {
334
334
  }
335
335
 
336
336
  //check state changes
337
- const deviceStateHasNotChanged = JSON.stringify(deviceState) === JSON.stringify(this.deviceState);
338
- this.deviceState = deviceStateHasNotChanged ? this.deviceState : deviceState;
339
- this.deviceData = deviceStateHasNotChanged ? this.deviceData : deviceData;
337
+ const deviceDataHasNotChanged = JSON.stringify(deviceState) === JSON.stringify(this.deviceState);
338
+ if (deviceDataHasNotChanged) {
339
+ return;
340
+ }
341
+ this.deviceState = deviceState;
340
342
 
341
343
  //external integrations
342
- this.emit('externalIntegrations', this.deviceData);
344
+ this.emit('externalIntegrations', deviceData);
343
345
 
344
346
  //emit info
345
347
  this.emit('deviceInfo', manufacturer, modelIndoor, modelOutdoor, serialNumber, firmwareAppVersion);
346
348
 
347
349
  //emit state
348
- this.emit('deviceState', this.deviceData);
350
+ this.emit('deviceState', deviceData);
349
351
 
350
352
  return true;
351
353
  } catch (error) {
@@ -423,11 +425,18 @@ class MelCloudAta extends EventEmitter {
423
425
  }
424
426
 
425
427
  await this.axiosInstancePost(CONSTANTS.ApiUrls.SetAta, payload);
426
- this.deviceData = deviceData;
428
+ this.updateData(deviceData);
427
429
  return true;
428
430
  } catch (error) {
429
431
  throw new Error(`Send data error: ${error.message || error}`);
430
432
  };
431
433
  };
434
+
435
+ updateData(deviceData) {
436
+ setTimeout(() => {
437
+ this.emit('externalIntegrations', deviceData);
438
+ this.emit('deviceState', deviceData);
439
+ }, 500);
440
+ }
432
441
  };
433
442
  module.exports = MelCloudAta;
@@ -470,11 +470,18 @@ class MelCloudAtw extends EventEmitter {
470
470
  }
471
471
 
472
472
  await this.axiosInstancePost(CONSTANTS.ApiUrls.SetAtw, payload);
473
- this.emit('deviceState', deviceData);
473
+ this.updateData(deviceData);
474
474
  return true;
475
475
  } catch (error) {
476
476
  throw new Error(`Send data error: ${error.message || error}`);
477
477
  };
478
478
  };
479
+
480
+ updateData(deviceData) {
481
+ setTimeout(() => {
482
+ this.emit('externalIntegrations', deviceData);
483
+ this.emit('deviceState', deviceData);
484
+ }, 500);
485
+ }
479
486
  };
480
487
  module.exports = MelCloudAtw;
@@ -396,11 +396,18 @@ class MelCloudErv extends EventEmitter {
396
396
  }
397
397
 
398
398
  await this.axiosInstancePost(CONSTANTS.ApiUrls.SetErv, payload);
399
- this.emit('deviceState', deviceData);
399
+ this.updateData(deviceData);
400
400
  return true;
401
401
  } catch (error) {
402
402
  throw new Error(`Send data error: ${error.message || error}`);
403
403
  };
404
404
  };
405
+
406
+ updateData(deviceData) {
407
+ setTimeout(() => {
408
+ this.emit('externalIntegrations', deviceData);
409
+ this.emit('deviceState', deviceData);
410
+ }, 500);
411
+ }
405
412
  };
406
413
  module.exports = MelCloudErv;