homebridge-melcloud-control 4.1.2-beta.71 → 4.1.2-beta.73

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.
@@ -131,8 +131,6 @@
131
131
 
132
132
  // Tworzenie przycisków
133
133
  accounts.forEach((account, i) => {
134
- this.accountIndex = i;
135
-
136
134
  const button = document.createElement("button");
137
135
  button.type = "button";
138
136
  button.id = `button${i}`;
@@ -142,6 +140,7 @@
142
140
  container.appendChild(button);
143
141
 
144
142
  button.addEventListener('click', async () => {
143
+ this.accountIndex = i;
145
144
 
146
145
  // Zmieniamy klasę wszystkich przycisków
147
146
  accounts.forEach((_, j) => {
@@ -231,6 +230,7 @@
231
230
 
232
231
  document.getElementById('logIn').addEventListener('click', async () => {
233
232
  await homebridge.updatePluginConfig(pluginConfig);
233
+ await homebridge.savePluginConfig(pluginConfig);
234
234
 
235
235
  document.getElementById(`logIn`).className = "btn btn-primary";
236
236
  updateInfo('info', '', 'white');
@@ -249,21 +249,21 @@
249
249
 
250
250
  // Initialize devices arrays
251
251
  const newDevices = { ata: [], ataPresets: [], atw: [], atwPresets: [], erv: [], ervPresets: [] };
252
- const devicesByType = { ata: [], atw: [], erv: [] };
252
+ const melcloudDevices = { ata: [], atw: [], erv: [] };
253
253
 
254
254
  response.Devices.forEach(d => {
255
- if (d.Type === 0) devicesByType.ata.push(d);
256
- if (d.Type === 1) devicesByType.atw.push(d);
257
- if (d.Type === 3) devicesByType.erv.push(d);
255
+ if (d.Type === 0) melcloudDevices.ata.push(d);
256
+ if (d.Type === 1) melcloudDevices.atw.push(d);
257
+ if (d.Type === 3) melcloudDevices.erv.push(d);
258
258
  });
259
259
 
260
260
  account.ataDevices = (account.ataDevices || []).filter(d => String(d.id) !== '0');
261
261
  account.atwDevices = (account.atwDevices || []).filter(d => String(d.id) !== '0');
262
262
  account.ervDevices = (account.ervDevices || []).filter(d => String(d.id) !== '0');
263
263
 
264
- const removedAta = removeStaleDevices(account.ataDevices, devicesByType.ata);
265
- const removedAtw = removeStaleDevices(account.atwDevices, devicesByType.atw);
266
- const removedErv = removeStaleDevices(account.ervDevices, devicesByType.erv);
264
+ const removedAta = removeStaleDevices(account.ataDevices, melcloudDevices.ata);
265
+ const removedAtw = removeStaleDevices(account.atwDevices, melcloudDevices.atw);
266
+ const removedErv = removeStaleDevices(account.ervDevices, melcloudDevices.erv);
267
267
 
268
268
  const handleDevices = (devicesInMelCloud, devicesInConfig, typeString, newArr, newPresets) => {
269
269
  try {
@@ -323,9 +323,9 @@
323
323
  }
324
324
  };
325
325
 
326
- account.ataDevices = handleDevices(devicesByType.ata, account.ataDevices, "Air Conditioner", newDevices.ata, newDevices.ataPresets);
327
- account.atwDevices = handleDevices(devicesByType.atw, account.atwDevices, "Heat Pump", newDevices.atw, newDevices.atwPresets);
328
- account.ervDevices = handleDevices(devicesByType.erv, account.ervDevices, "Energy Recovery Ventilation", newDevices.erv, newDevices.ervPresets);
326
+ account.ataDevices = handleDevices(melcloudDevices.ata, account.ataDevices, "Air Conditioner", newDevices.ata, newDevices.ataPresets);
327
+ account.atwDevices = handleDevices(melcloudDevices.atw, account.atwDevices, "Heat Pump", newDevices.atw, newDevices.atwPresets);
328
+ account.ervDevices = handleDevices(melcloudDevices.erv, account.ervDevices, "Energy Recovery Ventilation", newDevices.erv, newDevices.ervPresets);
329
329
 
330
330
  const newDevicesCount = newDevices.ata.length + newDevices.atw.length + newDevices.erv.length;
331
331
  const newPresetsCount = newDevices.ataPresets.length + newDevices.atwPresets.length + newDevices.ervPresets.length;
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.71",
4
+ "version": "4.1.2-beta.73",
5
5
  "description": "Homebridge plugin to control Mitsubishi Air Conditioner, Heat Pump and Energy Recovery Ventilation.",
6
6
  "license": "MIT",
7
7
  "author": "grzegorz914",