homebridge-melcloud-control 4.10.9-beta.0 → 4.10.9-beta.1

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.
@@ -268,6 +268,9 @@
268
268
  updateInfo('info2', '', fontColor);
269
269
  homebridge.showSpinner();
270
270
 
271
+ const statusListener = event => updateInfo('info', event.data, fontColor);
272
+ homebridge.addEventListener('status', statusListener);
273
+
271
274
  try {
272
275
  const account = this.account;
273
276
  const accountTypeMelcloud = account.type === 'melcloud';
@@ -451,9 +454,11 @@
451
454
  await homebridge.updatePluginConfig(pluginConfig);
452
455
  await homebridge.savePluginConfig(pluginConfig);
453
456
  } catch (error) {
454
- updateInfo('info', `Prepare config error`, "red");
455
- updateInfo('info1', `Error: ${JSON.stringify(error)}`, "red");
457
+ const msg = error?.message || error?.error || String(error);
458
+ updateInfo('info', 'Connection failed', 'red');
459
+ updateInfo('info1', msg, 'red');
456
460
  } finally {
461
+ homebridge.removeEventListener('status', statusListener);
457
462
  homebridge.hideSpinner();
458
463
  $('logIn').disabled = false;
459
464
  }
@@ -24,13 +24,15 @@ class PluginUiServer extends HomebridgePluginUiServer {
24
24
  const melCloudClass = account.type === 'melcloud' ? new MelCloud(account) : new MelCloudHome(account);
25
25
 
26
26
  try {
27
+ this.pushEvent('status', 'Connecting to account...');
27
28
  const melCloudAccountData = await this.withTimeout(melCloudClass.connect(), 90_000, 'connect');
28
29
  if (!melCloudAccountData.State) return melCloudAccountData;
29
30
 
31
+ this.pushEvent('status', 'Loading devices...');
30
32
  const melCloudDevicesData = await this.withTimeout(melCloudClass.checkDevicesList(), 60_000, 'checkDevicesList');
31
33
  return melCloudDevicesData;
32
34
  } catch (error) {
33
- throw new Error(error.message ?? error);
35
+ throw new Error(error.message ?? String(error));
34
36
  }
35
37
  }
36
38
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "displayName": "MELCloud Control",
3
3
  "name": "homebridge-melcloud-control",
4
- "version": "4.10.9-beta.0",
4
+ "version": "4.10.9-beta.1",
5
5
  "description": "Homebridge plugin to control Mitsubishi Air Conditioner, Heat Pump and Energy Recovery Ventilation.",
6
6
  "license": "MIT",
7
7
  "author": "grzegorz914",