homebridge-melcloud-control 4.3.5-beta.24 → 4.3.5-beta.26

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/index.js CHANGED
@@ -132,7 +132,6 @@ class MelCloudPlatform {
132
132
  return;
133
133
  }
134
134
  if (logLevel.debug) log.info(devicesList.Info);
135
- const melcloudDevices = devicesList.Devices;
136
135
 
137
136
  //start account impulse generator
138
137
  await melcloud.impulseGenerator.state(true, timmers, false);
@@ -147,7 +146,7 @@ class MelCloudPlatform {
147
146
  for (const [index, device] of devices.entries()) {
148
147
  //chack device from config exist on melcloud
149
148
  const displayType = device.displayType > 0;
150
- const deviceExistInMelCloud = melcloudDevices.some(dev => dev.DeviceID === device.id);
149
+ const deviceExistInMelCloud = devicesList.Devices.some(dev => dev.DeviceID === device.id);
151
150
  if (!deviceExistInMelCloud || !displayType) continue;
152
151
 
153
152
  device.id = String(device.id);
@@ -181,7 +180,7 @@ class MelCloudPlatform {
181
180
  let configuredDevice;
182
181
  switch (deviceType) {
183
182
  case 0: //ATA
184
- configuredDevice = new DeviceAta(api, account, device, defaultTempsFile, accountInfo, accountFile, melcloud, melcloudDevices);
183
+ configuredDevice = new DeviceAta(api, account, device, defaultTempsFile, accountInfo, accountFile, melcloud, devicesList);
185
184
  break;
186
185
  case 1: //ATW
187
186
  configuredDevice = new DeviceAtw(api, account, device, defaultTempsFile, accountInfo, accountFile, melcloud);
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.5-beta.24",
4
+ "version": "4.3.5-beta.26",
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/deviceata.js CHANGED
@@ -7,7 +7,7 @@ import { TemperatureDisplayUnits, AirConditioner } from './constants.js';
7
7
  let Accessory, Characteristic, Service, Categories, AccessoryUUID;
8
8
 
9
9
  class DeviceAta extends EventEmitter {
10
- constructor(api, account, device, defaultTempsFile, accountInfo, accountFile, melcloud, melcloudDevices) {
10
+ constructor(api, account, device, defaultTempsFile, accountInfo, accountFile, melcloud, melcloudDevicesList) {
11
11
  super();
12
12
 
13
13
  Accessory = api.platformAccessory;
@@ -18,7 +18,7 @@ class DeviceAta extends EventEmitter {
18
18
 
19
19
  //account config
20
20
  this.melcloud = melcloud;
21
- this.melcloudDevices = melcloudDevices;
21
+ this.melcloudDevicesList = melcloudDevicesList;
22
22
  this.account = account;
23
23
  this.accountType = account.type;
24
24
  this.accountName = account.name;
@@ -1321,7 +1321,7 @@ class DeviceAta extends EventEmitter {
1321
1321
  async start() {
1322
1322
  try {
1323
1323
  //melcloud device
1324
- this.melCloudAta = new MelCloudAta(this.account, this.device, this.defaultTempsFile, this.accountFile, this.melcloud, this.melcloudDevices)
1324
+ this.melCloudAta = new MelCloudAta(this.account, this.device, this.defaultTempsFile, this.accountFile, this.melcloud, this.melcloudDevicesList)
1325
1325
  .on('deviceInfo', (modelIndoor, modelOutdoor, serialNumber, firmwareAppVersion) => {
1326
1326
  if (this.logDeviceInfo && this.displayDeviceInfo) {
1327
1327
  this.emit('devInfo', `---- ${this.deviceTypeString}: ${this.deviceName} ----`);
@@ -4,7 +4,7 @@ import Functions from './functions.js';
4
4
  import { ApiUrls, ApiUrlsHome, AirConditioner } from './constants.js';
5
5
 
6
6
  class MelCloudAta extends EventEmitter {
7
- constructor(account, device, defaultTempsFile, accountFile, melcloud, melcloudDevices) {
7
+ constructor(account, device, defaultTempsFile, accountFile, melcloud, melcloudDevicesList) {
8
8
  super();
9
9
  this.accountType = account.type;
10
10
  this.logSuccess = account.log?.success;
@@ -23,17 +23,15 @@ class MelCloudAta extends EventEmitter {
23
23
 
24
24
  //set default values
25
25
  this.deviceData = {};
26
- this.headers = melcloudDevices.Headers;
26
+ this.headers = {}
27
27
 
28
28
  let deviceData = null;
29
29
  melcloud.on('devicesList', async (devicesData) => {
30
30
  this.headers = devicesData.Headers;
31
- deviceData = devicesData.Devices.find(device => device.DeviceID === this.deviceId);
31
+ deviceData = devicesData.Devices.find(device => device.DeviceID === device.id);
32
32
  if (!deviceData) return;
33
33
  deviceData.Scenes = devicesData.Scenes ?? [];
34
34
 
35
- if (!this.logDebug) this.emit('debug', `MELCloud: ${JSON.stringify(melcloudDevices, null, 2)}`);
36
-
37
35
  //update state
38
36
  await this.updateState(deviceData);
39
37
  }).on('webSocket', async (parsedMessage) => {
@@ -95,8 +93,9 @@ class MelCloudAta extends EventEmitter {
95
93
  });
96
94
 
97
95
  //only update state once at the beginning
98
- const deviceInMelcloud = melcloudDevices.find(device => device.DeviceID === this.deviceId)
99
- deviceInMelcloud.Scenes = melcloudDevices.Scenes ?? [];
96
+ const deviceInMelcloud = melcloudDevicesList.Devices.find(device => device.DeviceID === this.deviceId)
97
+ deviceInMelcloud.Scenes = melcloudDevicesList.Scenes ?? [];
98
+ this.headers = melcloudDevicesList.Headers;
100
99
  this.updateState(deviceInMelcloud);
101
100
  }
102
101