homebridge-melcloud-control 4.4.1-beta.42 → 4.4.1-beta.43
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.
|
@@ -205,13 +205,13 @@
|
|
|
205
205
|
});
|
|
206
206
|
|
|
207
207
|
// Generic remove function
|
|
208
|
-
|
|
208
|
+
// Generic remove function
|
|
209
|
+
function removeStaleEntities(configEntities, MelcloudEntities, getConfigId, getMelcloudId) {
|
|
209
210
|
const serverIds = new Set((MelcloudEntities ?? []).map(item => String(getMelcloudId(item))));
|
|
210
211
|
const removedEntities = [];
|
|
211
212
|
|
|
212
213
|
for (let i = configEntities.length - 1; i >= 0; i--) {
|
|
213
214
|
const entity = configEntities[i];
|
|
214
|
-
if (filterFn && !filterFn(entity)) continue; // jeśli nie dotyczy tego urządzenia, pomiń
|
|
215
215
|
const entityId = String(getConfigId(entity));
|
|
216
216
|
|
|
217
217
|
if (!serverIds.has(entityId)) {
|
|
@@ -223,7 +223,6 @@
|
|
|
223
223
|
return removedEntities;
|
|
224
224
|
}
|
|
225
225
|
|
|
226
|
-
|
|
227
226
|
// Update info on page
|
|
228
227
|
function updateInfo(id, text, color) {
|
|
229
228
|
const el = document.getElementById(id);
|
|
@@ -349,14 +348,11 @@
|
|
|
349
348
|
}
|
|
350
349
|
});
|
|
351
350
|
|
|
351
|
+
// SCENES
|
|
352
352
|
// SCENES
|
|
353
353
|
deviceInConfig.scenes = deviceInConfig.scenes ?? [];
|
|
354
354
|
const scenesForDevice = unitIdToScenes.get(deviceId) ?? [];
|
|
355
|
-
|
|
356
|
-
// Usuń stare sceny tylko dla tego urządzenia
|
|
357
355
|
removedFromConfig.scenes.push(...removeStaleEntities(deviceInConfig.scenes, scenesForDevice, s => s.id, s => s.Id));
|
|
358
|
-
|
|
359
|
-
// Dodaj nowe sceny dla tego urządzenia
|
|
360
356
|
const existingSceneIds = new Set(deviceInConfig.scenes.map(s => String(s.id)));
|
|
361
357
|
scenesForDevice.forEach((scene, index) => {
|
|
362
358
|
const sceneId = String(scene.Id);
|
|
@@ -371,7 +367,6 @@
|
|
|
371
367
|
newScenes.push(sceneObj);
|
|
372
368
|
}
|
|
373
369
|
});
|
|
374
|
-
|
|
375
370
|
}
|
|
376
371
|
});
|
|
377
372
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"displayName": "MELCloud Control",
|
|
3
3
|
"name": "homebridge-melcloud-control",
|
|
4
|
-
"version": "4.4.1-beta.
|
|
4
|
+
"version": "4.4.1-beta.43",
|
|
5
5
|
"description": "Homebridge plugin to control Mitsubishi Air Conditioner, Heat Pump and Energy Recovery Ventilation.",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"author": "grzegorz914",
|