homebridge-melcloud-control 4.2.3-beta.0 → 4.2.3-beta.2

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.0",
4
+ "version": "4.2.3-beta.2",
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
@@ -143,7 +143,7 @@ class MelCloud extends EventEmitter {
143
143
 
144
144
  try {
145
145
  const accountInfo = { State: false, Info: '', LoginData: null, ContextKey: null, UseFahrenheit: false }
146
- const axiosInstance = axios.create({
146
+ const accountData = await axios(ApiUrls.ClientLogin, {
147
147
  method: 'POST',
148
148
  baseURL: ApiUrls.BaseURL,
149
149
  timeout: 15000,
@@ -157,9 +157,6 @@ class MelCloud extends EventEmitter {
157
157
  Persist: true
158
158
  }
159
159
  });
160
-
161
-
162
- const accountData = await axiosInstance(ApiUrls.ClientLogin, { data: data });
163
160
  const account = accountData.data;
164
161
  const loginData = account.LoginData ?? [];
165
162
  const contextKey = loginData.ContextKey;
@@ -243,16 +243,14 @@ class MelCloudAta extends EventEmitter {
243
243
  break
244
244
  }
245
245
 
246
- const axiosInstancePut = axios.create({
246
+ if (this.logDebug) this.emit('debug', `Send Data: ${JSON.stringify(payload, null, 2)}`);
247
+ await axios(path, {
247
248
  method: method,
248
249
  baseURL: ApiUrlsHome.BaseURL,
249
250
  timeout: 10000,
250
251
  headers: deviceData.Headers,
251
252
  data: payload
252
253
  });
253
-
254
- if (this.logDebug) this.emit('debug', `Send Data: ${JSON.stringify(payload, null, 2)}`);
255
- await axiosInstancePut(path);
256
254
  this.updateData(deviceData);
257
255
  return true;
258
256
  default: