homebridge-melcloud-control 4.0.0-beta.81 → 4.0.0-beta.83

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.
@@ -107,12 +107,13 @@
107
107
  this.accountIndex = 0;
108
108
  const accountsCount = pluginConfig[0].accounts.length;
109
109
  for (let i = 0; i < accountsCount; i++) {
110
+ const acc = pluginConfig[0].accounts[i];
110
111
  const button = document.createElement("button");
111
112
  button.type = "button";
112
113
  button.id = `button${i}`;
113
114
  button.className = "btn btn-primary";
114
115
  button.style.textTransform = 'none';
115
- button.innerText = pluginConfig[0].accounts[i].name;
116
+ button.innerText = acc.name;
116
117
  document.getElementById("accountButton").appendChild(button);
117
118
 
118
119
  button.addEventListener('click', async () => {
@@ -128,14 +129,13 @@
128
129
  document.getElementById('language').value = acc.language || '0';
129
130
  document.getElementById('displayType').value = acc.displayType || 'disabled';
130
131
  document.getElementById('logIn').disabled = !(acc.name && acc.user && acc.passwd && acc.language && acc.displayType);
131
- this.accountIndex = i;
132
132
  });
133
133
 
134
134
  if (i === accountsCount - 1) document.getElementById(`button0`).click();
135
+ this.accountIndex = i;
135
136
  }
136
137
 
137
138
  document.getElementById('melCloudAccount').style.display = 'block';
138
-
139
139
  document.getElementById('configForm').addEventListener('input', async () => {
140
140
  const acc = pluginConfig[0].accounts[this.accountIndex];
141
141
  acc.name = document.querySelector('#name').value;
@@ -146,8 +146,8 @@
146
146
 
147
147
  document.getElementById('logIn').disabled = !(acc.name && acc.user && acc.passwd && acc.languaged && acc.displayType);
148
148
 
149
- await homebridge.updatePluginConfig(pluginConfig);
150
- await homebridge.savePluginConfig(pluginConfig);
149
+ await homebridge.updatePluginConfig(acc);
150
+ await homebridge.savePluginConfig(acc);
151
151
  });
152
152
 
153
153
  // --- Config Button Toggle ---
@@ -179,7 +179,7 @@
179
179
 
180
180
  for (let i = configDevices.length - 1; i >= 0; i--) {
181
181
  const device = configDevices[i];
182
- if (device.id !== 0 && !melcloudIds.includes(device.id)) {
182
+ if (device.id !== "0" && !melcloudIds.includes(device.id)) {
183
183
  removedDevices.push(device);
184
184
  configDevices.splice(i, 1);
185
185
  }
@@ -263,8 +263,8 @@
263
263
  if (removedDevicesCount) updateInfo('info2', `Removed devices: ATA: ${removedAta.length}, ATW: ${removedAtw.length}, ERV: ${removedErv.length}.`, 'orange');
264
264
  }
265
265
 
266
- await homebridge.updatePluginConfig(pluginConfig);
267
- await homebridge.savePluginConfig(pluginConfig);
266
+ await homebridge.updatePluginConfig(acc);
267
+ await homebridge.savePluginConfig(acc);
268
268
  document.getElementById('logIn').className = "btn btn-secondary";
269
269
 
270
270
  } catch (error) {
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.81",
4
+ "version": "4.0.0-beta.83",
5
5
  "description": "Homebridge plugin to control Mitsubishi Air Conditioner, Heat Pump and Energy Recovery Ventilation.",
6
6
  "license": "MIT",
7
7
  "author": "grzegorz914",