homebridge-melcloud-control 4.0.0-beta.422 → 4.0.0-beta.423

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.
@@ -229,9 +229,8 @@
229
229
  homebridge.showSpinner();
230
230
 
231
231
  try {
232
- const acc = pluginConfig[0].accounts[this.accountIndex];
233
- const payload = { accountName: acc.name, user: acc.user, passwd: acc.passwd, language: acc.language, accountType: acc.type };
234
- const devicesInMelCloud = await homebridge.request('/connect', payload);
232
+ const account = pluginConfig[0].accounts[this.accountIndex];
233
+ const devicesInMelCloud = await homebridge.request('/connect', account);
235
234
 
236
235
  // Initialize devices arrays
237
236
  const newDevices = { ata: [], ataPresets: [], atw: [], atwPresets: [], erv: [], ervPresets: [] };
@@ -243,13 +242,13 @@
243
242
  if (d.Type === 3) devicesByType.erv.push(d);
244
243
  });
245
244
 
246
- acc.ataDevices ??= [];
247
- acc.atwDevices ??= [];
248
- acc.ervDevices ??= [];
245
+ account.ataDevices ??= [];
246
+ account.atwDevices ??= [];
247
+ account.ervDevices ??= [];
249
248
 
250
- const removedAta = removeStaleDevices(acc.ataDevices, devicesByType.ata);
251
- const removedAtw = removeStaleDevices(acc.atwDevices, devicesByType.atw);
252
- const removedErv = removeStaleDevices(acc.ervDevices, devicesByType.erv);
249
+ const removedAta = removeStaleDevices(account.ataDevices, devicesByType.ata);
250
+ const removedAtw = removeStaleDevices(account.atwDevices, devicesByType.atw);
251
+ const removedErv = removeStaleDevices(account.ervDevices, devicesByType.erv);
253
252
 
254
253
  const handleDevices = (devicesInCloud, devicesInConfig, typeString, newArr, newPresets) => {
255
254
  devicesInCloud.forEach(device => {
@@ -286,9 +285,9 @@
286
285
  });
287
286
  };
288
287
 
289
- handleDevices(devicesByType.ata, acc.ataDevices, "Air Conditioner", newDevices.ata, newDevices.ataPresets);
290
- handleDevices(devicesByType.atw, acc.atwDevices, "Heat Pump", newDevices.atw, newDevices.atwPresets);
291
- handleDevices(devicesByType.erv, acc.ervDevices, "Energy Recovery Ventilation", newDevices.erv, newDevices.ervPresets);
288
+ handleDevices(devicesByType.ata, account.ataDevices, "Air Conditioner", newDevices.ata, newDevices.ataPresets);
289
+ handleDevices(devicesByType.atw, account.atwDevices, "Heat Pump", newDevices.atw, newDevices.atwPresets);
290
+ handleDevices(devicesByType.erv, account.ervDevices, "Energy Recovery Ventilation", newDevices.erv, newDevices.ervPresets);
292
291
 
293
292
  const newDevicesCount = newDevices.ata.length + newDevices.atw.length + newDevices.erv.length;
294
293
  const newPresetsCount = newDevices.ataPresets.length + newDevices.atwPresets.length + newDevices.ervPresets.length;
@@ -12,16 +12,12 @@ class PluginUiServer extends HomebridgePluginUiServer {
12
12
  this.ready();
13
13
  };
14
14
 
15
- async start(payload) {
16
- const accountName = payload.accountName;
17
- const user = payload.user;
18
- const passwd = payload.passwd;
19
- const language = payload.language;
20
- const accountType = payload.accountType;
15
+ async start(account) {
16
+ const accountName = account.name;
21
17
  const accountFile = `${this.homebridgeStoragePath}/melcloud/${accountName}_Account`;
22
18
  const buildingsFile = `${this.homebridgeStoragePath}/melcloud/${accountName}_Buildings`;
23
19
  const devicesFile = `${this.homebridgeStoragePath}/melcloud/${accountName}_Devices`;
24
- const melCloud = new MelCloud(accountType, user, passwd, language, accountFile, buildingsFile, devicesFile, false, true);
20
+ const melCloud = new MelCloud(account, accountFile, buildingsFile, devicesFile, false, true);
25
21
 
26
22
  try {
27
23
  await melCloud.connect();
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.422",
4
+ "version": "4.0.0-beta.423",
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
@@ -342,7 +342,6 @@ class MelCloud extends EventEmitter {
342
342
  });
343
343
 
344
344
  const page = await browser.newPage();
345
-
346
345
  page.on('error', err => this.emit('error', `Page crashed: ${err.message}`));
347
346
  page.on('pageerror', err => this.emit('error', `Browser error: ${err.message}`));
348
347
  page.on('close', () => this.emit('debug', 'Page was closed unexpectedly'));