homebridge-melcloud-control 4.0.0-beta.417 → 4.0.0-beta.419

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 +11 -14
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "displayName": "MELCloud Control",
3
3
  "name": "homebridge-melcloud-control",
4
- "version": "4.0.0-beta.417",
4
+ "version": "4.0.0-beta.419",
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
@@ -133,7 +133,6 @@ class MelCloud extends EventEmitter {
133
133
  }
134
134
  }
135
135
 
136
-
137
136
  async connectToMelCloud() {
138
137
  if (this.logDebug) this.emit('debug', `Connecting to MELCloud`);
139
138
 
@@ -176,16 +175,6 @@ class MelCloud extends EventEmitter {
176
175
  return null;
177
176
  }
178
177
 
179
- this.axiosInstancePost = axios.create({
180
- method: 'POST',
181
- baseURL: ApiUrls.BaseURL,
182
- timeout: 15000,
183
- headers: {
184
- 'X-MitsContextKey': contextKey,
185
- 'content-type': 'application/json'
186
- }
187
- });
188
-
189
178
  await this.functions.saveData(this.accountFile, accountInfo);
190
179
  this.emit('success', `Connect to MELCloud Success`);
191
180
 
@@ -199,7 +188,6 @@ class MelCloud extends EventEmitter {
199
188
  async checkMelcloudHomeDevicesList(contextKey) {
200
189
  try {
201
190
  const axiosInstance = axios.create({
202
- method: 'GET',
203
191
  baseURL: ApiUrlsHome.BaseURL,
204
192
  timeout: 25000,
205
193
  headers: {
@@ -218,7 +206,7 @@ class MelCloud extends EventEmitter {
218
206
  });
219
207
 
220
208
  if (this.logDebug) this.emit('debug', `Scanning for devices`);
221
- const listDevicesData = await axiosInstance(ApiUrlsHome.GetUserContext);
209
+ const listDevicesData = await axiosInstance.get(ApiUrlsHome.GetUserContext);
222
210
  const buildingsList = listDevicesData.data.buildings;
223
211
  if (this.logDebug) this.emit('debug', `Buildings: ${JSON.stringify(buildingsList, null, 2)}`);
224
212
 
@@ -523,8 +511,17 @@ class MelCloud extends EventEmitter {
523
511
 
524
512
  async send(accountInfo) {
525
513
  try {
514
+ const axiosInstance = axios.create({
515
+ baseURL: ApiUrls.BaseURL,
516
+ timeout: 15000,
517
+ headers: {
518
+ 'X-MitsContextKey': this.contextKey,
519
+ 'content-type': 'application/json'
520
+ }
521
+ });
522
+
526
523
  const options = { data: accountInfo };
527
- await this.axiosInstancePost(ApiUrls.UpdateApplicationOptions, options);
524
+ await axiosInstance.post(ApiUrls.UpdateApplicationOptions, options);
528
525
  await this.functions.saveData(this.accountFile, accountInfo);
529
526
  return true;
530
527
  } catch (error) {