homebridge-melcloud-control 2.5.0-beta.15 → 2.5.0-beta.16
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/homebridge-ui/public/index.html +0 -16
- package/homebridge-ui/server.js +11 -40
- package/package.json +1 -1
- package/src/melcloud.js +9 -5
|
@@ -137,22 +137,6 @@
|
|
|
137
137
|
await homebridge.savePluginConfig(pluginConfig);
|
|
138
138
|
break;
|
|
139
139
|
case 1:
|
|
140
|
-
document.getElementById('info').innerHTML = info;
|
|
141
|
-
document.getElementById('info').style.color = 'green';
|
|
142
|
-
break;
|
|
143
|
-
case 2:
|
|
144
|
-
document.getElementById('info').innerHTML = info;
|
|
145
|
-
document.getElementById('info').style.color = 'white';
|
|
146
|
-
break;
|
|
147
|
-
case 3:
|
|
148
|
-
document.getElementById('info').innerHTML = info;
|
|
149
|
-
document.getElementById('info').style.color = 'gray';
|
|
150
|
-
break;
|
|
151
|
-
case 4:
|
|
152
|
-
document.getElementById('info').innerHTML = info;
|
|
153
|
-
document.getElementById('info').style.color = 'yellow';
|
|
154
|
-
break;
|
|
155
|
-
case 5:
|
|
156
140
|
document.getElementById('info').innerHTML = info;
|
|
157
141
|
document.getElementById('info').style.color = 'red';
|
|
158
142
|
break;
|
package/homebridge-ui/server.js
CHANGED
|
@@ -25,50 +25,21 @@ class PluginUiServer extends HomebridgePluginUiServer {
|
|
|
25
25
|
const deviceInfoFile = `${this.homebridgeStoragePath}/melcloud/${accountName}_Device_`;
|
|
26
26
|
const buildingsFile = `${this.homebridgeStoragePath}/melcloud/${accountName}_Buildings`;
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
try {
|
|
29
|
+
let data = {};
|
|
30
|
+
const melCloud = new MelCloud(user, passwd, language, accountInfoFile, deviceInfoFile, buildingsFile, enableDebugMode, refreshInterval, true);
|
|
31
|
+
const devices = melCloud.chackDevicesList();
|
|
32
|
+
return data = {
|
|
32
33
|
info: 'Check devices list complete.',
|
|
33
34
|
status: 0,
|
|
34
35
|
data: devices
|
|
35
36
|
};
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
};
|
|
43
|
-
return data;
|
|
44
|
-
})
|
|
45
|
-
.on('message', (message) => {
|
|
46
|
-
data = {
|
|
47
|
-
info: message,
|
|
48
|
-
status: 2
|
|
49
|
-
};
|
|
50
|
-
return data;
|
|
51
|
-
})
|
|
52
|
-
.on('debug', (debug) => {
|
|
53
|
-
data = {
|
|
54
|
-
info: debug,
|
|
55
|
-
status: 3
|
|
56
|
-
};
|
|
57
|
-
return data;
|
|
58
|
-
})
|
|
59
|
-
.on('warn', (warn) => {
|
|
60
|
-
return data = {
|
|
61
|
-
info: warn,
|
|
62
|
-
status: 4
|
|
63
|
-
};
|
|
64
|
-
})
|
|
65
|
-
.on('error', async (error) => {
|
|
66
|
-
data = {
|
|
67
|
-
info: error,
|
|
68
|
-
status: 5
|
|
69
|
-
};
|
|
70
|
-
return data;
|
|
71
|
-
});
|
|
37
|
+
} catch (error) {
|
|
38
|
+
return data = {
|
|
39
|
+
info: error,
|
|
40
|
+
status: 1
|
|
41
|
+
};
|
|
42
|
+
};
|
|
72
43
|
};
|
|
73
44
|
};
|
|
74
45
|
|
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.
|
|
4
|
+
"version": "2.5.0-beta.16",
|
|
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
|
@@ -121,6 +121,11 @@ class MelCloud extends EventEmitter {
|
|
|
121
121
|
//save melcloud info to the file
|
|
122
122
|
await this.saveData(this.accountInfoFile, accountInfo);
|
|
123
123
|
|
|
124
|
+
//return if connect for config
|
|
125
|
+
if (this.connectForConfig) {
|
|
126
|
+
return;
|
|
127
|
+
};
|
|
128
|
+
|
|
124
129
|
//check devices list
|
|
125
130
|
await this.chackDevicesList();
|
|
126
131
|
|
|
@@ -129,7 +134,7 @@ class MelCloud extends EventEmitter {
|
|
|
129
134
|
|
|
130
135
|
//start impulse generator
|
|
131
136
|
const timers = [{ name: 'checkDevicesList', sampling: this.refreshInterval }];
|
|
132
|
-
|
|
137
|
+
this.impulseGenerator.start(timers);
|
|
133
138
|
|
|
134
139
|
return true;
|
|
135
140
|
} catch (error) {
|
|
@@ -176,11 +181,10 @@ class MelCloud extends EventEmitter {
|
|
|
176
181
|
}
|
|
177
182
|
const debug3 = this.enableDebugMode ? this.emit('debug', `Found: ${devicesCount} devices.`) : false;
|
|
178
183
|
|
|
179
|
-
//
|
|
180
|
-
this.emit('devicesList', devices);
|
|
184
|
+
//return devices list for config
|
|
181
185
|
if (this.connectForConfig) {
|
|
182
|
-
return;
|
|
183
|
-
}
|
|
186
|
+
return devices;
|
|
187
|
+
};
|
|
184
188
|
|
|
185
189
|
//get device info fom devices
|
|
186
190
|
for (const deviceInfo of devices) {
|