homebridge-melcloud-control 4.0.0-beta.85 → 4.0.0-beta.86

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.
@@ -200,6 +200,16 @@
200
200
  document.getElementById(`logIn`).className = "btn btn-primary";
201
201
  updateInfo('info', 'Connecting...', 'yellow');
202
202
 
203
+ // Ensure each account has independent device arrays (avoid shared references)
204
+ if (Array.isArray(pluginConfig?.[0]?.accounts)) {
205
+ pluginConfig[0].accounts = pluginConfig[0].accounts.map(acc => ({
206
+ ...acc,
207
+ ataDevices: Array.isArray(acc.ataDevices) ? structuredClone(acc.ataDevices) : [],
208
+ atwDevices: Array.isArray(acc.atwDevices) ? structuredClone(acc.atwDevices) : [],
209
+ ervDevices: Array.isArray(acc.ervDevices) ? structuredClone(acc.ervDevices) : []
210
+ }));
211
+ }
212
+
203
213
  try {
204
214
  const acc = pluginConfig[0].accounts[this.accountIndex];
205
215
  const payload = { accountName: acc.name, user: acc.user, passwd: acc.passwd, language: acc.language, displayType: acc.displayType };
@@ -285,10 +295,6 @@
285
295
  updateInfo('info2', `Removed devices: ATA: ${removedAta.length}, ATW: ${removedAtw.length}, ERV: ${removedErv.length}.`, 'orange');
286
296
  }
287
297
 
288
- console.log('Account 0:', pluginConfig[0].accounts[0].ataDevices);
289
- console.log('Account 1:', pluginConfig[0].accounts[1].ataDevices);
290
- console.log('Same ref?', pluginConfig[0].accounts[0].ataDevices === pluginConfig[0].accounts[1].ataDevices);
291
-
292
298
  // Correct save (must be array)
293
299
  await homebridge.updatePluginConfig(pluginConfig);
294
300
  await homebridge.savePluginConfig(pluginConfig);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "displayName": "MELCloud Control",
3
3
  "name": "homebridge-melcloud-control",
4
- "version": "4.0.0-beta.85",
4
+ "version": "4.0.0-beta.86",
5
5
  "description": "Homebridge plugin to control Mitsubishi Air Conditioner, Heat Pump and Energy Recovery Ventilation.",
6
6
  "license": "MIT",
7
7
  "author": "grzegorz914",