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

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/melcloud.js +6 -8
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.2",
4
+ "version": "4.2.3-beta.3",
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
@@ -68,16 +68,15 @@ class MelCloud extends EventEmitter {
68
68
  'X-MitsContextKey': this.contextKey,
69
69
  'Content-Type': 'application/json'
70
70
  }
71
- const axiosInstance = axios.create({
71
+
72
+ if (this.logDebug) this.emit('debug', `Scanning for devices...`);
73
+ const listDevicesData = await axios(ApiUrls.ListDevices, {
72
74
  method: 'GET',
73
75
  baseURL: ApiUrls.BaseURL,
74
76
  timeout: 15000,
75
77
  headers: headers
76
78
  });
77
79
 
78
- if (this.logDebug) this.emit('debug', `Scanning for devices...`);
79
- const listDevicesData = await axiosInstance(ApiUrls.ListDevices);
80
-
81
80
  if (!listDevicesData || !listDevicesData.data) {
82
81
  devicesList.Info = 'Invalid or empty response from MELCloud API'
83
82
  return devicesList;
@@ -207,15 +206,14 @@ class MelCloud extends EventEmitter {
207
206
  'Sec-Fetch-Site': 'same-origin',
208
207
  'X-CSRF': '1'
209
208
  };
210
- const axiosInstance = axios.create({
209
+
210
+ if (this.logDebug) this.emit('debug', `Scanning for devices`);
211
+ const listDevicesData = await axios(ApiUrlsHome.GetUserContext, {
211
212
  method: 'GET',
212
213
  baseURL: ApiUrlsHome.BaseURL,
213
214
  timeout: 25000,
214
215
  headers: headers
215
216
  });
216
-
217
- if (this.logDebug) this.emit('debug', `Scanning for devices`);
218
- const listDevicesData = await axiosInstance(ApiUrlsHome.GetUserContext);
219
217
  const buildingsList = listDevicesData.data.buildings;
220
218
  if (this.logDebug) this.emit('debug', `Buildings: ${JSON.stringify(buildingsList, null, 2)}`);
221
219