homebridge-melcloud-control 2.5.0-beta.10 → 2.5.0-beta.12

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
 
@@ -155,10 +156,13 @@
155
156
  document.getElementById('info').innerHTML = info;
156
157
  document.getElementById('info').style.color = 'red';
157
158
  break;
159
+ default:
160
+ document.getElementById('info').innerHTML = `Received unknown status: ${status}, please try again.`;
161
+ document.getElementById('info').style.color = 'yellow';
162
+ break;
158
163
  };
159
164
 
160
165
  homebridge.hideSpinner();
161
- document.getElementById('info').innerHTML = 'Please try again.';
162
166
  } catch (e) {
163
167
  document.getElementById('info').innerHTML = 'Please try again.';
164
168
  homebridge.toast.error(`Data error: ${e.message}`);
@@ -29,50 +29,48 @@ class PluginUiServer extends HomebridgePluginUiServer {
29
29
  try {
30
30
  const melCloud = new MelCloud(user, passwd, language, accountInfoFile, deviceInfoFile, buildingsFile, enableDebugMode, refreshInterval, true);
31
31
  melCloud.on('devicesList', (devices) => {
32
- data = {
32
+ return data = {
33
33
  info: 'Check devices list complete.',
34
34
  status: 0,
35
35
  data: devices
36
36
  };
37
37
  })
38
38
  .on('success', (message) => {
39
- data = {
39
+ return data = {
40
40
  info: message,
41
41
  status: 1
42
42
  };
43
43
  })
44
44
  .on('message', (message) => {
45
- data = {
45
+ return data = {
46
46
  info: message,
47
47
  status: 2
48
48
  };
49
49
  })
50
50
  .on('debug', (debug) => {
51
- data = {
51
+ return data = {
52
52
  info: debug,
53
53
  status: 3
54
54
  };
55
55
  })
56
56
  .on('warn', (warn) => {
57
- data = {
57
+ return data = {
58
58
  info: warn,
59
59
  status: 4
60
60
  };
61
61
  })
62
62
  .on('error', async (error) => {
63
- data = {
63
+ return data = {
64
64
  info: error,
65
65
  status: 5
66
66
  };
67
67
  });
68
68
  } catch (error) {
69
- data = {
69
+ return data = {
70
70
  info: error,
71
71
  status: 5
72
72
  };
73
73
  };
74
-
75
- return data;
76
74
  };
77
75
  };
78
76
 
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.10",
4
+ "version": "2.5.0-beta.12",
5
5
  "description": "Homebridge plugin to control Mitsubishi Air Conditioner, Heat Pump and Energy Recovery Ventilation.",
6
6
  "license": "MIT",
7
7
  "author": "grzegorz914",