homebridge-melcloud-control 4.4.1-beta.39 → 4.4.1-beta.40

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.
@@ -334,11 +334,17 @@
334
334
 
335
335
  // SCENES
336
336
  deviceInConfig.scenes = deviceInConfig.scenes ?? [];
337
+
338
+ // Usuwanie nieaktualnych scen
337
339
  removedFromConfig.scenes.push(...removeStaleEntities(deviceInConfig.scenes, scenesInMelCloud, s => s.id, s => s.Id));
338
340
  const sceneIds = new Set(deviceInConfig.scenes.map(s => String(s.id)));
339
341
  scenesInMelCloud.forEach((scene, index) => {
340
342
  const sceneId = String(scene.Id);
341
- if (!sceneIds.has(sceneId)) {
343
+
344
+ // Sprawdzamy, czy scena dotyczy danego urządzenia w AtaSceneSettings lub AtwSceneSettings
345
+ const appliesToDevice = (scene.AtaSceneSettings ?? []).some(s => s.UnitId === deviceInConfig.id) || (scene.AtwSceneSettings ?? []).some(s => s.UnitId === deviceInConfig.id) || (scene.ErvSceneSettings ?? []).some(s => s.UnitId === deviceInConfig.id);
346
+
347
+ if (appliesToDevice && !sceneIds.has(sceneId)) {
342
348
  const sceneObj = {
343
349
  id: sceneId,
344
350
  displayType: 0,
@@ -346,9 +352,11 @@
346
352
  namePrefix: false
347
353
  };
348
354
  deviceInConfig.scenes.push(sceneObj);
349
- if (index === 0) newScenes.push(sceneObj);
355
+ newScenes.push(sceneObj);
350
356
  }
351
357
  });
358
+
359
+
352
360
  }
353
361
  });
354
362
 
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.39",
4
+ "version": "4.4.1-beta.40",
5
5
  "description": "Homebridge plugin to control Mitsubishi Air Conditioner, Heat Pump and Energy Recovery Ventilation.",
6
6
  "license": "MIT",
7
7
  "author": "grzegorz914",