homebridge-melcloud-control 4.3.5-beta.18 → 4.3.5-beta.19

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
@@ -117,21 +117,21 @@ class MelCloudPlatform {
117
117
  if (logLevel.error) log.error(`${accountName}, Connect error: ${error.message ?? error}`);
118
118
  return;
119
119
  }
120
- if (logLevel.success) log.success(accountInfo.Info);
120
+ if (logLevel.success) log.success(`${accountName}, ${accountInfo.Info}`);
121
121
 
122
122
  //check devices list
123
- let devicesList;
123
+ let melcloudDevicesList;
124
124
  try {
125
- devicesList = await melcloud.checkDevicesList();
126
- if (!devicesList.State) {
127
- if (logLevel.warn) log.warn(`${accountName}, ${devicesList.Info}`);
125
+ melcloudDevicesList = await melcloud.checkDevicesList();
126
+ if (!melcloudDevicesList.State) {
127
+ if (logLevel.warn) log.warn(`${accountName}, ${melcloudDevicesList.Info}`);
128
128
  return;
129
129
  }
130
130
  } catch (error) {
131
131
  if (logLevel.error) log.error(`${accountName}, Check devices list error: ${error.message ?? error}`);
132
132
  return;
133
133
  }
134
- if (logLevel.debug) log.info(devicesList.Info);
134
+ if (logLevel.debug) log.info(melcloudDevicesList.Info);
135
135
 
136
136
  //start account impulse generator
137
137
  await melcloud.impulseGenerator.state(true, timmers, false);
@@ -146,7 +146,7 @@ class MelCloudPlatform {
146
146
  for (const [index, device] of devices.entries()) {
147
147
  //chack device from config exist on melcloud
148
148
  const displayType = device.displayType > 0;
149
- const deviceExistInMelCloud = devicesList.Devices.some(dev => dev.DeviceID === device.id);
149
+ const deviceExistInMelCloud = melcloudDevicesList.Devices.some(dev => dev.DeviceID === device.id);
150
150
  if (!deviceExistInMelCloud || !displayType) continue;
151
151
 
152
152
  device.id = String(device.id);
@@ -180,15 +180,15 @@ class MelCloudPlatform {
180
180
  let configuredDevice;
181
181
  switch (deviceType) {
182
182
  case 0: //ATA
183
- configuredDevice = new DeviceAta(api, account, device, defaultTempsFile, accountInfo, accountFile, melcloud);
183
+ configuredDevice = new DeviceAta(api, account, device, defaultTempsFile, accountInfo, accountFile, melcloud, melcloudDevicesList);
184
184
  break;
185
185
  case 1: //ATW
186
- configuredDevice = new DeviceAtw(api, account, device, defaultTempsFile, accountInfo, accountFile, melcloud);
186
+ configuredDevice = new DeviceAtw(api, account, device, defaultTempsFile, accountInfo, accountFile, melcloud, melcloudDevicesList);
187
187
  break;
188
188
  case 2:
189
189
  break;
190
190
  case 3: //ERV
191
- configuredDevice = new DeviceErv(api, account, device, defaultTempsFile, accountInfo, accountFile, melcloud);
191
+ configuredDevice = new DeviceErv(api, account, device, defaultTempsFile, accountInfo, accountFile, melcloud, melcloudDevicesList);
192
192
  break;
193
193
  default:
194
194
  if (logLevel.warn) log.warn(`${accountName}, ${deviceTypeString}, ${deviceName}, unknown device: ${deviceType}.`);
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.18",
4
+ "version": "4.3.5-beta.19",
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/melcloud.js CHANGED
@@ -14,7 +14,7 @@ class MelCloud extends EventEmitter {
14
14
  this.logWarn = account.log?.warn;
15
15
  this.logError = account.log?.error;
16
16
  this.logDebug = account.log?.debug;
17
-
17
+
18
18
  this.accountFile = accountFile;
19
19
  this.buildingsFile = buildingsFile;
20
20
  this.headers = {};
@@ -171,7 +171,7 @@ class MelCloud extends EventEmitter {
171
171
  });
172
172
 
173
173
  accountInfo.State = true;
174
- accountInfo.Info = 'Connect to MELCloud Success';
174
+ accountInfo.Info = 'Connect Success';
175
175
  accountInfo.UseFahrenheit = loginData.UseFahrenheit;
176
176
  accountInfo.Account = account;
177
177
  await this.functions.saveData(this.accountFile, accountInfo);
@@ -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) {
7
+ constructor(account, device, defaultTempsFile, accountFile, melcloud, melcloudDevicesList) {
8
8
  super();
9
9
  this.accountType = account.type;
10
10
  this.logSuccess = account.log?.success;
@@ -25,6 +25,8 @@ class MelCloudAta extends EventEmitter {
25
25
  this.deviceData = {};
26
26
  this.headers = {};
27
27
 
28
+ if (!this.logDebug) this.emit('debug', `MELCloud: ${JSON.stringify(melcloud, null, 2)}`);
29
+
28
30
  let deviceData = null;
29
31
  melcloud.on('devicesList', async (devicesData) => {
30
32
  this.headers = devicesData.Headers;
@@ -4,7 +4,7 @@ import Functions from './functions.js';
4
4
  import { ApiUrls, ApiUrlsHome, HeatPump } from './constants.js';
5
5
 
6
6
  class MelCloudAtw extends EventEmitter {
7
- constructor(account, device, defaultTempsFile, accountFile, melcloud) {
7
+ constructor(account, device, defaultTempsFile, accountFile, melcloud, melcloudDevicesList) {
8
8
  super();
9
9
  this.accountType = account.type;
10
10
  this.logSuccess = account.log?.success;
@@ -4,7 +4,7 @@ import Functions from './functions.js';
4
4
  import { ApiUrls, ApiUrlsHome, Ventilation } from './constants.js';
5
5
 
6
6
  class MelCloudErv extends EventEmitter {
7
- constructor(account, device, defaultTempsFile, accountFile, melcloud) {
7
+ constructor(account, device, defaultTempsFile, accountFile, melcloud, melcloudDevicesList) {
8
8
  super();
9
9
  this.accountType = account.type;
10
10
  this.logSuccess = account.log?.success;
@@ -441,7 +441,7 @@ class MelCloudHome extends EventEmitter {
441
441
  };
442
442
 
443
443
  accountInfo.State = true;
444
- accountInfo.Info = 'Connect to MELCloud Home Success';
444
+ accountInfo.Info = 'Connect Success';
445
445
  await this.functions.saveData(this.accountFile, accountInfo);
446
446
 
447
447
  return accountInfo;