homebridge-melcloud-control 4.2.3-beta.4 → 4.2.3-beta.6

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "displayName": "MELCloud Control",
3
3
  "name": "homebridge-melcloud-control",
4
- "version": "4.2.3-beta.4",
4
+ "version": "4.2.3-beta.6",
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/melcloud.js CHANGED
@@ -142,19 +142,21 @@ class MelCloud extends EventEmitter {
142
142
 
143
143
  try {
144
144
  const accountInfo = { State: false, Info: '', LoginData: null, ContextKey: null, UseFahrenheit: false }
145
+
146
+ const payload = {
147
+ Email: this.user,
148
+ Password: this.passwd,
149
+ Language: this.language,
150
+ AppVersion: '1.34.12',
151
+ CaptchaChallenge: '',
152
+ CaptchaResponse: '',
153
+ Persist: true
154
+ };
145
155
  const accountData = await axios(ApiUrls.ClientLogin, {
146
156
  method: 'POST',
147
157
  baseURL: ApiUrls.BaseURL,
148
158
  timeout: 15000,
149
- data: {
150
- Email: this.user,
151
- Password: this.passwd,
152
- Language: this.language,
153
- AppVersion: '1.34.12',
154
- CaptchaChallenge: '',
155
- CaptchaResponse: '',
156
- Persist: true
157
- }
159
+ data: payload
158
160
  });
159
161
  const account = accountData.data;
160
162
  const loginData = account.LoginData ?? [];
@@ -52,10 +52,6 @@ class MelCloudAta extends EventEmitter {
52
52
  try {
53
53
  //read device info from file
54
54
  const devicesData = await this.functions.readData(this.devicesFile, true);
55
- if (!Array.isArray(devicesData)) {
56
- if (this.logWarn) this.emit('warn', `Device data not found`);
57
- return null;
58
- }
59
55
  const deviceData = devicesData.find(device => device.DeviceID === this.deviceId);
60
56
 
61
57
  if (this.accountType === 'melcloudhome') {
@@ -118,10 +114,7 @@ class MelCloudAta extends EventEmitter {
118
114
 
119
115
  //check state changes
120
116
  const deviceDataHasNotChanged = JSON.stringify(deviceData) === JSON.stringify(this.deviceData);
121
- if (deviceDataHasNotChanged) {
122
- if (this.logDebug) this.emit('debug', `Device state not changed`);
123
- return;
124
- }
117
+ if (deviceDataHasNotChanged) return;
125
118
  this.deviceData = deviceData;
126
119
 
127
120
  //emit info
@@ -268,6 +261,5 @@ class MelCloudAta extends EventEmitter {
268
261
  this.lock = false
269
262
  }, 3000);
270
263
  }
271
-
272
264
  };
273
265
  export default MelCloudAta;
@@ -52,10 +52,6 @@ class MelCloudAtw extends EventEmitter {
52
52
  try {
53
53
  //read device info from file
54
54
  const devicesData = await this.functions.readData(this.devicesFile, true);
55
- if (!Array.isArray(devicesData)) {
56
- if (this.logWarn) this.emit('warn', `Device data not found`);
57
- return null;
58
- }
59
55
  const deviceData = devicesData.find(device => device.DeviceID === this.deviceId);
60
56
 
61
57
  if (this.accountType === 'melcloudhome') {
@@ -109,10 +105,7 @@ class MelCloudAtw extends EventEmitter {
109
105
 
110
106
  //check state changes
111
107
  const deviceDataHasNotChanged = JSON.stringify(devicesData) === JSON.stringify(this.devicesData);
112
- if (deviceDataHasNotChanged) {
113
- if (this.logDebug) this.emit('debug', `Device state not changed`);
114
- return;
115
- }
108
+ if (deviceDataHasNotChanged) return;
116
109
  this.devicesData = devicesData;
117
110
 
118
111
  //emit info
@@ -52,10 +52,6 @@ class MelCloudErv extends EventEmitter {
52
52
  try {
53
53
  //read device info from file
54
54
  const devicesData = await this.functions.readData(this.devicesFile, true);
55
- if (!Array.isArray(devicesData)) {
56
- if (this.logWarn) this.emit('warn', `Device data not found`);
57
- return null;
58
- }
59
55
  const deviceData = devicesData.find(device => device.DeviceID === this.deviceId);
60
56
 
61
57
  if (this.accountType === 'melcloudhome') {
@@ -112,10 +108,7 @@ class MelCloudErv extends EventEmitter {
112
108
 
113
109
  //check state changes
114
110
  const deviceDataHasNotChanged = JSON.stringify(devicesData) === JSON.stringify(this.devicesData);
115
- if (deviceDataHasNotChanged) {
116
- if (this.logDebug) this.emit('debug', `Device state not changed`);
117
- return;
118
- }
111
+ if (deviceDataHasNotChanged) return;
119
112
  this.devicesData = devicesData;
120
113
 
121
114
  //emit info