homebridge-melcloud-control 4.5.5-beta.7 → 4.5.5-beta.9
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.
|
@@ -139,8 +139,6 @@
|
|
|
139
139
|
container.appendChild(button);
|
|
140
140
|
|
|
141
141
|
button.addEventListener('click', async () => {
|
|
142
|
-
this.account = account;
|
|
143
|
-
|
|
144
142
|
// Zmieniamy klasę wszystkich przycisków
|
|
145
143
|
accounts.forEach((_, j) => {
|
|
146
144
|
document.getElementById(`button${j}`).className = (j === i ? 'btn btn-primary' : 'btn btn-secondary');
|
|
@@ -157,6 +155,8 @@
|
|
|
157
155
|
formElements.language.value = account.language || '0';
|
|
158
156
|
formElements.accountType.value = account.type || 'disabled';
|
|
159
157
|
formElements.logIn.disabled = !(account.name && account.user && account.passwd && account.language && account.type);
|
|
158
|
+
|
|
159
|
+
this.account = account;
|
|
160
160
|
});
|
|
161
161
|
});
|
|
162
162
|
|
|
@@ -249,19 +249,19 @@
|
|
|
249
249
|
|
|
250
250
|
// Login & Sync Logic
|
|
251
251
|
document.getElementById('logIn').addEventListener('click', async () => {
|
|
252
|
-
homebridge.showSpinner();
|
|
253
252
|
document.getElementById('logIn').className = "btn btn-primary";
|
|
254
|
-
updateInfo('info', '', 'white');
|
|
253
|
+
updateInfo('info', 'Connecting to MELCloud', 'white');
|
|
255
254
|
updateInfo('info1', '', 'white');
|
|
256
255
|
updateInfo('info2', '', 'white');
|
|
256
|
+
homebridge.showSpinner();
|
|
257
257
|
|
|
258
258
|
try {
|
|
259
259
|
const account = this.account;
|
|
260
260
|
const response = await homebridge.request('/connect', account);
|
|
261
261
|
|
|
262
262
|
if (!response.State) {
|
|
263
|
-
homebridge.hideSpinner();
|
|
264
263
|
updateInfo('info', response.Info, 'red');
|
|
264
|
+
homebridge.hideSpinner();
|
|
265
265
|
return;
|
|
266
266
|
}
|
|
267
267
|
|
|
@@ -271,11 +271,12 @@
|
|
|
271
271
|
const scenesInMelCloud = response.Scenes ?? [];
|
|
272
272
|
|
|
273
273
|
// Split devices by type
|
|
274
|
-
response.Devices
|
|
274
|
+
const devices = response.Devices;
|
|
275
|
+
for (const device of devices) {
|
|
275
276
|
if (device.Type === 0) devicesInMelCloudByType.ata.push(device);
|
|
276
277
|
if (device.Type === 1) devicesInMelCloudByType.atw.push(device);
|
|
277
278
|
if (device.Type === 3) devicesInMelCloudByType.erv.push(device);
|
|
278
|
-
}
|
|
279
|
+
};
|
|
279
280
|
|
|
280
281
|
// Clean up local config
|
|
281
282
|
account.ataDevices = (account.ataDevices ?? []).filter(d => String(d.id) !== '0');
|
|
@@ -403,6 +404,7 @@
|
|
|
403
404
|
|
|
404
405
|
await homebridge.updatePluginConfig(pluginConfig);
|
|
405
406
|
await homebridge.savePluginConfig(pluginConfig);
|
|
407
|
+
homebridge.hideSpinner();
|
|
406
408
|
} catch (error) {
|
|
407
409
|
updateInfo('info', `Prepare config error`, "yellow");
|
|
408
410
|
updateInfo('info1', `Error: ${JSON.stringify(error)}`, "red");
|
|
@@ -411,5 +413,6 @@
|
|
|
411
413
|
homebridge.hideSpinner();
|
|
412
414
|
}
|
|
413
415
|
});
|
|
416
|
+
|
|
414
417
|
})();
|
|
415
418
|
</script>
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"displayName": "MELCloud Control",
|
|
3
3
|
"name": "homebridge-melcloud-control",
|
|
4
|
-
"version": "4.5.5-beta.
|
|
4
|
+
"version": "4.5.5-beta.9",
|
|
5
5
|
"description": "Homebridge plugin to control Mitsubishi Air Conditioner, Heat Pump and Energy Recovery Ventilation.",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"author": "grzegorz914",
|