homebridge-melcloud-control 4.0.0-beta.415 → 4.0.0-beta.417

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
@@ -89,7 +89,7 @@ class MelCloudPlatform {
89
89
  .on('start', async () => {
90
90
  try {
91
91
  //melcloud account
92
- const melCloud = new MelCloud(accountType, user, passwd, language, accountFile, buildingsFile, devicesFile, logLevel.warn, logLevel.error, logLevel.debug, false)
92
+ const melCloud = new MelCloud(account, accountFile, buildingsFile, devicesFile, false)
93
93
  .on('success', (msg) => logLevel.success && log.success(`${accountName}, ${msg}`))
94
94
  .on('info', (msg) => logLevel.info && log.info(`${accountName}, ${msg}`))
95
95
  .on('debug', (msg) => logLevel.debug && log.info(`${accountName}, debug: ${msg}`))
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "displayName": "MELCloud Control",
3
3
  "name": "homebridge-melcloud-control",
4
- "version": "4.0.0-beta.415",
4
+ "version": "4.0.0-beta.417",
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
@@ -9,35 +9,24 @@ import Functions from './functions.js';
9
9
  import { ApiUrls, ApiUrlsHome } from './constants.js';
10
10
 
11
11
  class MelCloud extends EventEmitter {
12
- constructor(accountType, user, passwd, language, accountFile, buildingsFile, devicesFile, logWarn, logError, logDebug, requestConfig) {
12
+ constructor(account, accountFile, buildingsFile, devicesFile, requestConfig) {
13
13
  super();
14
- this.accountType = accountType;
15
- this.user = user;
16
- this.passwd = passwd;
17
- this.language = language;
14
+ this.accountType = account.type;
15
+ this.user = account.user;
16
+ this.passwd = account.passwd;
17
+ this.language = account.language;
18
+ this.logWarn = account.log?.warn;
19
+ this.logError = account.log?.error;
20
+ this.logDebug = account.log?.debug;
18
21
  this.accountFile = accountFile;
19
22
  this.buildingsFile = buildingsFile;
20
23
  this.devicesFile = devicesFile;
21
- this.logWarn = logWarn;
22
- this.logError= logError;
23
- this.logDebug = logDebug;
24
24
  this.requestConfig = requestConfig;
25
25
  this.devicesId = [];
26
26
  this.contextKey = '';
27
27
  this.functions = new Functions();
28
-
29
28
  this.tokens = null;
30
29
 
31
- this.loginData = {
32
- Email: user,
33
- Password: passwd,
34
- Language: language,
35
- AppVersion: '1.34.12',
36
- CaptchaChallenge: '',
37
- CaptchaResponse: '',
38
- Persist: true
39
- };
40
-
41
30
  if (!requestConfig) {
42
31
  this.impulseGenerator = new ImpulseGenerator()
43
32
  .on('connect', async () => {
@@ -155,7 +144,17 @@ class MelCloud extends EventEmitter {
155
144
  timeout: 15000,
156
145
  });
157
146
 
158
- const accountData = await axiosInstanceLogin(ApiUrls.ClientLogin, { data: this.loginData });
147
+ const loginData = {
148
+ Email: this.user,
149
+ Password: this.passwd,
150
+ Language: this.language,
151
+ AppVersion: '1.34.12',
152
+ CaptchaChallenge: '',
153
+ CaptchaResponse: '',
154
+ Persist: true
155
+ };
156
+
157
+ const accountData = await axiosInstanceLogin(ApiUrls.ClientLogin, { data: loginData });
159
158
  const account = accountData.data;
160
159
  const accountInfo = account.LoginData;
161
160
  const contextKey = accountInfo?.ContextKey;
@@ -307,6 +306,7 @@ class MelCloud extends EventEmitter {
307
306
  passwd: this.passwd,
308
307
  logWarn: this.logWarn,
309
308
  logError: this.logError,
309
+ logDebug: this.logDebug,
310
310
  })
311
311
  .on('success', message => this.emit('success', message))
312
312
  .on('warn', warn => this.emit('warn', warn))