homebridge-melcloud-control 4.1.2-beta.45 → 4.1.2-beta.47
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.
|
@@ -224,6 +224,9 @@
|
|
|
224
224
|
|
|
225
225
|
document.getElementById('logIn').addEventListener('click', async () => {
|
|
226
226
|
document.getElementById(`logIn`).className = "btn btn-primary";
|
|
227
|
+
updateInfo('info', '', 'white');
|
|
228
|
+
updateInfo('info1', '', 'white');
|
|
229
|
+
updateInfo('info2', '', 'white');
|
|
227
230
|
homebridge.showSpinner();
|
|
228
231
|
|
|
229
232
|
try {
|
|
@@ -266,6 +269,17 @@
|
|
|
266
269
|
const deviceId = String(device.DeviceID);
|
|
267
270
|
let deviceInConfig = configDevicesMap.get(deviceId);
|
|
268
271
|
|
|
272
|
+
// === Remove placeholder devices with id '0' before adding new ===
|
|
273
|
+
const beforeDevicesCount = devicesInConfig.length;
|
|
274
|
+
devicesInConfig = devicesInConfig.filter(d => String(d.id) !== '0');
|
|
275
|
+
if (devicesInConfig.length !== beforeDevicesCount) {
|
|
276
|
+
updateInfo('info2', `Removed placeholder devices with id '0'`, 'yellow');
|
|
277
|
+
|
|
278
|
+
// Rebuild map after filtering
|
|
279
|
+
configDevicesMap.clear();
|
|
280
|
+
devicesInConfig.forEach(dev => configDevicesMap.set(String(dev.id), dev));
|
|
281
|
+
}
|
|
282
|
+
|
|
269
283
|
// === Create device if missing ===
|
|
270
284
|
if (!deviceInConfig) {
|
|
271
285
|
deviceInConfig = {
|
|
@@ -313,16 +327,19 @@
|
|
|
313
327
|
const removedCount = beforeCount - deviceInConfig[typeKey1].length;
|
|
314
328
|
|
|
315
329
|
if (removedCount > 0 && removedCount < beforeCount) {
|
|
316
|
-
updateInfo('
|
|
330
|
+
updateInfo('info2', `Removed ${removedCount} placeholder ${typeKey1} from device ${device.DeviceID}`, 'yellow');
|
|
317
331
|
}
|
|
318
332
|
}
|
|
319
333
|
});
|
|
334
|
+
|
|
335
|
+
// Return filtered devicesInConfig to make sure upstream code uses it
|
|
336
|
+
return devicesInConfig;
|
|
337
|
+
|
|
320
338
|
} catch (error) {
|
|
321
|
-
updateInfo('info', `Error while processing device: ${
|
|
339
|
+
updateInfo('info', `Error while processing device: ${JSON.stringify(error)}`, 'red');
|
|
322
340
|
}
|
|
323
341
|
};
|
|
324
342
|
|
|
325
|
-
|
|
326
343
|
handleDevices(devicesByType.ata, account.ataDevices, "Air Conditioner", newDevices.ata, newDevices.ataPresets);
|
|
327
344
|
handleDevices(devicesByType.atw, account.atwDevices, "Heat Pump", newDevices.atw, newDevices.atwPresets);
|
|
328
345
|
handleDevices(devicesByType.erv, account.ervDevices, "Energy Recovery Ventilation", newDevices.erv, newDevices.ervPresets);
|
|
@@ -347,8 +364,7 @@
|
|
|
347
364
|
document.getElementById('logIn').className = "btn btn-secondary";
|
|
348
365
|
|
|
349
366
|
} catch (error) {
|
|
350
|
-
updateInfo('info',
|
|
351
|
-
updateInfo('info1', `${JSON.stringify(error)}`, 'red');
|
|
367
|
+
updateInfo('info', `Connect error ${JSON.stringify(error)}`, 'red');
|
|
352
368
|
document.getElementById('logIn').className = "btn btn-secondary";
|
|
353
369
|
} finally {
|
|
354
370
|
homebridge.hideSpinner();
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"displayName": "MELCloud Control",
|
|
3
3
|
"name": "homebridge-melcloud-control",
|
|
4
|
-
"version": "4.1.2-beta.
|
|
4
|
+
"version": "4.1.2-beta.47",
|
|
5
5
|
"description": "Homebridge plugin to control Mitsubishi Air Conditioner, Heat Pump and Energy Recovery Ventilation.",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"author": "grzegorz914",
|