homebridge-melcloud-control 4.6.7-beta.9 → 4.7.0-beta.1

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.
package/CHANGELOG.md CHANGED
@@ -30,6 +30,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
30
30
 
31
31
  - add support for ATW, fix [#233](https://github.com/grzegorz914/homebridge-melcloud-control/issues/233), thanks @bastienb99
32
32
  - fix [#232](https://github.com/grzegorz914/homebridge-melcloud-control/issues/232)
33
+ - prevent login to melcloud if account type is set to disable
33
34
  - config schema updated
34
35
  - bump dependencies
35
36
  - cleanup
@@ -117,8 +117,6 @@
117
117
 
118
118
  // Tworzenie przycisków
119
119
  accounts.forEach((account, i) => {
120
- this.account = account;
121
-
122
120
  const button = document.createElement("button");
123
121
  button.type = "button";
124
122
  button.id = `button${i}`;
@@ -143,7 +141,8 @@
143
141
  formElements.passwd.value = account.passwd || '';
144
142
  formElements.language.value = account.language || '0';
145
143
  formElements.accountType.value = account.type || 'disabled';
146
- formElements.logIn.disabled = !(account.name && account.user && account.passwd && account.language && account.type);
144
+ formElements.logIn.disabled = !(account.name && account.user && account.passwd && account.language && account.type !== 'disabled');
145
+ formElements.configButton.disabled = !(account.ataDevices.length > 0 || account.atwDevices.length > 0 || account.ervDevices.length > 0);
147
146
 
148
147
  this.account = account;
149
148
  });
@@ -155,15 +154,13 @@
155
154
  // Jeden listener input dla całego formularza
156
155
  document.getElementById('configForm').addEventListener('input', async () => {
157
156
  const account = this.account;
158
- if (!account) return;
159
-
160
157
  account.name = formElements.name.value;
161
158
  account.user = formElements.user.value;
162
159
  account.passwd = formElements.passwd.value;
163
160
  account.language = formElements.language.value;
164
161
  account.type = formElements.accountType.value;
165
-
166
- formElements.logIn.disabled = !(account.name && account.user && account.passwd && account.language && account.type);
162
+ formElements.logIn.disabled = !(account.name && account.user && account.passwd && account.language && account.type !== 'disabled');
163
+ formElements.configButton.disabled = !(account.ataDevices.length > 0 || account.atwDevices.length > 0 || account.ervDevices.length > 0);
167
164
 
168
165
  await homebridge.updatePluginConfig(pluginConfig);
169
166
  await homebridge.savePluginConfig();
@@ -247,7 +244,7 @@
247
244
 
248
245
  // Login & Sync Logic
249
246
  document.getElementById('logIn').addEventListener('click', async () => {
250
- document.getElementById('logIn').className = "btn btn-primary";
247
+ document.getElementById('logIn').disabled = true;
251
248
  const lightingMode = homebridge.userCurrentLightingMode();
252
249
  const fontColor = lightingMode === 'dark' ? 'black' : 'white';
253
250
 
@@ -262,6 +259,7 @@
262
259
 
263
260
  if (!response.State) {
264
261
  updateInfo('info', response.Info, 'red');
262
+ document.getElementById('logIn').disabled = false;
265
263
  homebridge.hideSpinner();
266
264
  return;
267
265
  }
@@ -437,13 +435,12 @@
437
435
 
438
436
  await homebridge.updatePluginConfig(pluginConfig);
439
437
  await homebridge.savePluginConfig();
440
-
441
438
  } catch (error) {
442
439
  updateInfo('info', `Prepare config error`, "red");
443
440
  updateInfo('info1', `Error: ${JSON.stringify(error)}`, "red");
444
441
  } finally {
445
- document.getElementById('logIn').className = "btn btn-secondary";
446
442
  homebridge.hideSpinner();
443
+ document.getElementById('logIn').disabled = false;
447
444
  }
448
445
  });
449
446
  })();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "displayName": "MELCloud Control",
3
3
  "name": "homebridge-melcloud-control",
4
- "version": "4.6.7-beta.9",
4
+ "version": "4.7.0-beta.1",
5
5
  "description": "Homebridge plugin to control Mitsubishi Air Conditioner, Heat Pump and Energy Recovery Ventilation.",
6
6
  "license": "MIT",
7
7
  "author": "grzegorz914",
package/src/mqtt.js CHANGED
@@ -38,10 +38,8 @@ class Mqtt extends EventEmitter {
38
38
  }
39
39
  });
40
40
 
41
- // MQTT v5 subscription results contain reason codes
42
- if (config.logDebug) this.emit('debug', `Subscribed to ${subscribeTopic}, reason codes: ${JSON.stringify(result)}`);
43
- this.emit('subscribed', `MQTT Subscribe topic: ${subscribeTopic}`);
44
-
41
+ // MQTT v5 subscription results
42
+ this.emit('connected', `MQTT Subscribe topic: ${subscribeTopic}`);
45
43
  } catch (error) {
46
44
  if (config.logWarn) this.emit('warn', `MQTT Subscribe error: ${error}`);
47
45
  }