homebridge-melcloud-control 2.5.0-beta.11 → 2.5.0-beta.13

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.
@@ -118,7 +118,8 @@
118
118
  refreshInterval: refreshInterval
119
119
  };
120
120
  const response = await homebridge.request('/connect', payload);
121
- const info = response.info;
121
+ homebridge.toast.info(`Response: ${JSON.stringify(response, null, 2)}`);
122
+ const info = response.info ?? '';
122
123
  const status = response.status;
123
124
  const devices = response.data ?? [];
124
125
 
@@ -24,53 +24,48 @@ class PluginUiServer extends HomebridgePluginUiServer {
24
24
  const accountInfoFile = `${this.homebridgeStoragePath}/melcloud/${accountName}_Account`;
25
25
  const deviceInfoFile = `${this.homebridgeStoragePath}/melcloud/${accountName}_Device_`;
26
26
  const buildingsFile = `${this.homebridgeStoragePath}/melcloud/${accountName}_Buildings`;
27
- let data = {};
28
27
 
29
- try {
30
- const melCloud = new MelCloud(user, passwd, language, accountInfoFile, deviceInfoFile, buildingsFile, enableDebugMode, refreshInterval, true);
31
- melCloud.on('devicesList', (devices) => {
32
- return data = {
33
- info: 'Check devices list complete.',
34
- status: 0,
35
- data: devices
28
+ let data = {};
29
+ const melCloud = new MelCloud(user, passwd, language, accountInfoFile, deviceInfoFile, buildingsFile, enableDebugMode, refreshInterval, true);
30
+ melCloud.on('devicesList', (devices) => {
31
+ data = {
32
+ info: 'Check devices list complete.',
33
+ status: 0,
34
+ data: devices
35
+ };
36
+ })
37
+ .on('success', (message) => {
38
+ data = {
39
+ info: message,
40
+ status: 1
36
41
  };
37
42
  })
38
- .on('success', (message) => {
39
- return data = {
40
- info: message,
41
- status: 1
42
- };
43
- })
44
- .on('message', (message) => {
45
- return data = {
46
- info: message,
47
- status: 2
48
- };
49
- })
50
- .on('debug', (debug) => {
51
- return data = {
52
- info: debug,
53
- status: 3
54
- };
55
- })
56
- .on('warn', (warn) => {
57
- return data = {
58
- info: warn,
59
- status: 4
60
- };
61
- })
62
- .on('error', async (error) => {
63
- return data = {
64
- info: error,
65
- status: 5
66
- };
67
- });
68
- } catch (error) {
69
- return data = {
70
- info: error,
71
- status: 5
72
- };
73
- };
43
+ .on('message', (message) => {
44
+ data = {
45
+ info: message,
46
+ status: 2
47
+ };
48
+ })
49
+ .on('debug', (debug) => {
50
+ data = {
51
+ info: debug,
52
+ status: 3
53
+ };
54
+ })
55
+ .on('warn', (warn) => {
56
+ data = {
57
+ info: warn,
58
+ status: 4
59
+ };
60
+ })
61
+ .on('error', async (error) => {
62
+ data = {
63
+ info: error,
64
+ status: 5
65
+ };
66
+ });
67
+
68
+ return data;
74
69
  };
75
70
  };
76
71
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "displayName": "MELCloud Control",
3
3
  "name": "homebridge-melcloud-control",
4
- "version": "2.5.0-beta.11",
4
+ "version": "2.5.0-beta.13",
5
5
  "description": "Homebridge plugin to control Mitsubishi Air Conditioner, Heat Pump and Energy Recovery Ventilation.",
6
6
  "license": "MIT",
7
7
  "author": "grzegorz914",