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

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,7 @@
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');
147
145
 
148
146
  this.account = account;
149
147
  });
@@ -155,15 +153,12 @@
155
153
  // Jeden listener input dla całego formularza
156
154
  document.getElementById('configForm').addEventListener('input', async () => {
157
155
  const account = this.account;
158
- if (!account) return;
159
-
160
156
  account.name = formElements.name.value;
161
157
  account.user = formElements.user.value;
162
158
  account.passwd = formElements.passwd.value;
163
159
  account.language = formElements.language.value;
164
160
  account.type = formElements.accountType.value;
165
-
166
- formElements.logIn.disabled = !(account.name && account.user && account.passwd && account.language && account.type);
161
+ formElements.logIn.disabled = !(account.name && account.user && account.passwd && account.language && account.type !== 'disabled');
167
162
 
168
163
  await homebridge.updatePluginConfig(pluginConfig);
169
164
  await homebridge.savePluginConfig();
@@ -247,7 +242,7 @@
247
242
 
248
243
  // Login & Sync Logic
249
244
  document.getElementById('logIn').addEventListener('click', async () => {
250
- document.getElementById('logIn').className = "btn btn-primary";
245
+ document.getElementById('logIn').disabled = true;
251
246
  const lightingMode = homebridge.userCurrentLightingMode();
252
247
  const fontColor = lightingMode === 'dark' ? 'black' : 'white';
253
248
 
@@ -262,6 +257,7 @@
262
257
 
263
258
  if (!response.State) {
264
259
  updateInfo('info', response.Info, 'red');
260
+ document.getElementById('logIn').disabled = false;
265
261
  homebridge.hideSpinner();
266
262
  return;
267
263
  }
@@ -437,13 +433,12 @@
437
433
 
438
434
  await homebridge.updatePluginConfig(pluginConfig);
439
435
  await homebridge.savePluginConfig();
440
-
441
436
  } catch (error) {
442
437
  updateInfo('info', `Prepare config error`, "red");
443
438
  updateInfo('info1', `Error: ${JSON.stringify(error)}`, "red");
444
439
  } finally {
445
- document.getElementById('logIn').className = "btn btn-secondary";
446
440
  homebridge.hideSpinner();
441
+ document.getElementById('logIn').disabled = false;
447
442
  }
448
443
  });
449
444
  })();
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.0",
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
  }