homebridge-melcloud-control 4.7.3-beta.7 → 4.7.3-beta.8
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 +14 -34
- package/package.json +1 -1
|
@@ -142,7 +142,7 @@
|
|
|
142
142
|
formElements.language.value = account.language || '0';
|
|
143
143
|
formElements.accountType.value = account.type || 'disabled';
|
|
144
144
|
formElements.logIn.disabled = !(account.name && account.user && account.passwd && account.language && account.type !== 'disabled');
|
|
145
|
-
formElements.configButton.disabled = !(account.ataDevices
|
|
145
|
+
formElements.configButton.disabled = !((account.ataDevices?.length ?? 0) > 0 || (account.atwDevices?.length ?? 0) > 0 || (account.ervDevices?.length ?? 0) > 0);
|
|
146
146
|
|
|
147
147
|
this.account = account;
|
|
148
148
|
});
|
|
@@ -160,7 +160,7 @@
|
|
|
160
160
|
account.language = formElements.language.value;
|
|
161
161
|
account.type = formElements.accountType.value;
|
|
162
162
|
formElements.logIn.disabled = !(account.name && account.user && account.passwd && account.language && account.type !== 'disabled');
|
|
163
|
-
formElements.configButton.disabled = !(account.ataDevices
|
|
163
|
+
formElements.configButton.disabled = !((account.ataDevices?.length ?? 0) > 0 || (account.atwDevices?.length ?? 0) > 0 || (account.ervDevices?.length ?? 0) > 0);
|
|
164
164
|
|
|
165
165
|
await homebridge.updatePluginConfig(pluginConfig);
|
|
166
166
|
await homebridge.savePluginConfig();
|
|
@@ -233,20 +233,11 @@
|
|
|
233
233
|
return map;
|
|
234
234
|
}
|
|
235
235
|
|
|
236
|
-
// Helper to generate summary string
|
|
237
|
-
function summarizeChanges(type, ata, atw, erv) {
|
|
238
|
-
const parts = [];
|
|
239
|
-
if (ata.length) parts.push(`ATA: ${ata.length}`);
|
|
240
|
-
if (atw.length) parts.push(`ATW: ${atw.length}`);
|
|
241
|
-
if (erv.length) parts.push(`ERV: ${erv.length}`);
|
|
242
|
-
return parts.length ? `${type}: ${parts.join(', ')}` : '';
|
|
243
|
-
}
|
|
244
|
-
|
|
245
236
|
// Login & Sync Logic
|
|
246
237
|
document.getElementById('logIn').addEventListener('click', async () => {
|
|
247
238
|
document.getElementById('logIn').disabled = true;
|
|
248
239
|
const lightingMode = homebridge.userCurrentLightingMode();
|
|
249
|
-
const fontColor = lightingMode === 'dark' ? '
|
|
240
|
+
const fontColor = lightingMode === 'dark' ? 'white' : 'black';
|
|
250
241
|
|
|
251
242
|
updateInfo('info', 'Connecting to MELCloud', fontColor);
|
|
252
243
|
updateInfo('info1', '', fontColor);
|
|
@@ -270,11 +261,7 @@
|
|
|
270
261
|
account.ervDevices = account.ervDevices ?? [];
|
|
271
262
|
|
|
272
263
|
// Prepare MELCloud data
|
|
273
|
-
const newInMelCloud = {
|
|
274
|
-
ata: [], ataPresets: [], ataSchedules: [], ataScenes: [],
|
|
275
|
-
atw: [], atwPresets: [], atwSchedules: [], atwScenes: [],
|
|
276
|
-
erv: [], ervPresets: [], ervSchedules: [], ervScenes: []
|
|
277
|
-
};
|
|
264
|
+
const newInMelCloud = { ata: [], ataPresets: [], ataSchedules: [], ataScenes: [], atw: [], atwPresets: [], atwSchedules: [], atwScenes: [], erv: [], ervPresets: [], ervSchedules: [], ervScenes: [] };
|
|
278
265
|
const devicesInMelCloudByType = { ata: [], atw: [], erv: [] };
|
|
279
266
|
const scenesInMelCloud = response.Scenes ?? [];
|
|
280
267
|
|
|
@@ -415,23 +402,16 @@
|
|
|
415
402
|
const removedPresetsCount = removedFromConfig.presets.length;
|
|
416
403
|
const removedSchedulesCount = removedFromConfig.schedules.length;
|
|
417
404
|
const removedScenesCount = removedFromConfig.scenes.length;
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
if (newDevicesCount
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
if (
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
// Removed items
|
|
429
|
-
const removedParts = [];
|
|
430
|
-
if (removedDevicesCount) removedParts.push(summarizeChanges('Devices', removedFromConfig.ata, removedFromConfig.atw, removedFromConfig.erv));
|
|
431
|
-
if (removedPresetsCount) removedParts.push(`Presets: ${removedPresetsCount}`);
|
|
432
|
-
if (removedSchedulesCount) removedParts.push(`Schedules: ${removedSchedulesCount}`);
|
|
433
|
-
if (removedScenesCount) removedParts.push(`Scenes: ${removedScenesCount}`);
|
|
434
|
-
if (removedParts.length) updateInfo('info1', `Removed old: ${removedParts.join('; ')}`, 'orange');
|
|
405
|
+
|
|
406
|
+
if (!newDevicesCount && !newPresetsCount && !newSchedulesCount && !newScenesCount && !removedDevicesCount && !removedPresetsCount && !removedSchedulesCount && !removedScenesCount) {
|
|
407
|
+
updateInfo('info', 'No changes detected.', fontColor);
|
|
408
|
+
}
|
|
409
|
+
if (newDevicesCount || newPresetsCount || newSchedulesCount || newScenesCount) {
|
|
410
|
+
updateInfo('info', `Found new ${newDevicesCount ? `devices:` : ''} ${newInMelCloud.ata.length ? `ATA: ${newInMelCloud.ata.length},` : ''} ${newInMelCloud.atw.length ? `ATW: ${newInMelCloud.atw.length},` : ''} ${newInMelCloud.erv.length ? `ERV: ${newInMelCloud.erv.length},` : ''} ${newPresetsCount ? `presets:` : ''} ${newInMelCloud.ataPresets.length ? `ATA: ${newInMelCloud.ataPresets.length},` : ''} ${newInMelCloud.atwPresets.length ? `ATW: ${newInMelCloud.atwPresets.length}, ` : ''} ${newInMelCloud.ervPresets.length ? `ERV: ${newInMelCloud.ervPresets.length},` : ''} ${newSchedulesCount ? `schedules:` : ''} ${newInMelCloud.ataSchedules.length ? `ATA: ${newInMelCloud.ataSchedules.length},` : ''} ${newInMelCloud.atwSchedules.length ? `ATW: ${newInMelCloud.atwSchedules.length},` : ''} ${newInMelCloud.ervSchedules.length ? `ERV: ${newInMelCloud.ervSchedules.length}, ` : ''} ${newScenesCount ? `scenes:` : ''} ${newInMelCloud.ataScenes.length ? `ATA: ${newInMelCloud.ataScenes.length},` : ''} ${newInMelCloud.atwScenes.length ? `ATW: ${newInMelCloud.atwScenes.length},` : ''} ${newInMelCloud.ervScenes.length ? `ERV: ${newInMelCloud.ervScenes.length}` : ''}.`, 'green');
|
|
411
|
+
}
|
|
412
|
+
if (removedDevicesCount || removedPresetsCount || removedSchedulesCount || removedScenesCount) {
|
|
413
|
+
updateInfo('info1', `Removed old ${removedDevicesCount ? `devices:` : ''} ${removedFromConfig.ata.length ? `ATA: ${removedFromConfig.ata.length},` : ''} ${removedFromConfig.atw.length ? `ATW: ${removedFromConfig.atw.length},` : ''} ${removedFromConfig.erv.length ? `ERV: ${removedFromConfig.erv.length},` : ''} ${removedPresetsCount ? `presets: ${removedPresetsCount},` : ''} ${removedSchedulesCount ? `schedules: ${removedSchedulesCount},` : ''} ${removedScenesCount ? `scenes: ${removedScenesCount}` : ''}.`, 'orange');
|
|
414
|
+
}
|
|
435
415
|
|
|
436
416
|
await homebridge.updatePluginConfig(pluginConfig);
|
|
437
417
|
await homebridge.savePluginConfig();
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"displayName": "MELCloud Control",
|
|
3
3
|
"name": "homebridge-melcloud-control",
|
|
4
|
-
"version": "4.7.3-beta.
|
|
4
|
+
"version": "4.7.3-beta.8",
|
|
5
5
|
"description": "Homebridge plugin to control Mitsubishi Air Conditioner, Heat Pump and Energy Recovery Ventilation.",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"author": "grzegorz914",
|