homebridge-melcloud-control 4.0.0-beta.555 → 4.0.0-beta.557

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.
@@ -395,6 +395,12 @@
395
395
  "default": false,
396
396
  "description": "This enable extra outdoor temperature sensor to use with automations in HomeKit app."
397
397
  },
398
+ "errorSensor": {
399
+ "title": "Error",
400
+ "type": "boolean",
401
+ "default": false,
402
+ "description": "This enable error sensor to use with automations in HomeKit app."
403
+ },
398
404
  "refreshInterval": {
399
405
  "title": "Refresh Interval",
400
406
  "type": "integer",
@@ -1004,6 +1010,12 @@
1004
1010
  "default": false,
1005
1011
  "description": "This enable extra Return Zone 2 temperature sensor to use with automations in HomeKit app."
1006
1012
  },
1013
+ "errorSensor": {
1014
+ "title": "Error",
1015
+ "type": "boolean",
1016
+ "default": false,
1017
+ "description": "This enable error sensor to use with automations in HomeKit app."
1018
+ },
1007
1019
  "refreshInterval": {
1008
1020
  "title": "Refresh Interval",
1009
1021
  "type": "integer",
@@ -1391,6 +1403,12 @@
1391
1403
  "default": false,
1392
1404
  "description": "This enable extra supply temperature sensor to use with automations in HomeKit app."
1393
1405
  },
1406
+ "errorSensor": {
1407
+ "title": "Error",
1408
+ "type": "boolean",
1409
+ "default": false,
1410
+ "description": "This enable error sensor to use with automations in HomeKit app."
1411
+ },
1394
1412
  "refreshInterval": {
1395
1413
  "title": "Refresh Interval",
1396
1414
  "type": "integer",
@@ -1868,19 +1886,6 @@
1868
1886
  "functionBody": "return model.accounts[arrayIndices[0]].ataDevices[arrayIndices[1]].displayType > 0;"
1869
1887
  }
1870
1888
  },
1871
- {
1872
- "title": "Temperature Sensors",
1873
- "type": "section",
1874
- "expandable": true,
1875
- "expanded": false,
1876
- "items": [
1877
- "accounts[].ataDevices[].temperatureSensor",
1878
- "accounts[].ataDevices[].temperatureSensorOutdoor"
1879
- ],
1880
- "condition": {
1881
- "functionBody": "return model.accounts[arrayIndices[0]].ataDevices[arrayIndices[1]].displayType > 0;"
1882
- }
1883
- },
1884
1889
  {
1885
1890
  "title": "Presets",
1886
1891
  "type": "section",
@@ -1912,6 +1917,9 @@
1912
1917
  "expandable": true,
1913
1918
  "expanded": false,
1914
1919
  "items": [
1920
+ "accounts[].ataDevices[].temperatureSensor",
1921
+ "accounts[].ataDevices[].temperatureSensorOutdoor",
1922
+ "accounts[].ataDevices[].errorSensor",
1915
1923
  {
1916
1924
  "key": "accounts[].ataDevices[].buttonsSensors",
1917
1925
  "type": "tabarray",
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.555",
4
+ "version": "4.0.0-beta.557",
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
@@ -498,6 +498,7 @@ class MelCloud extends EventEmitter {
498
498
  async send(accountInfo) {
499
499
  try {
500
500
  const axiosInstance = axios.create({
501
+ method: 'POST',
501
502
  baseURL: ApiUrls.BaseURL,
502
503
  timeout: 15000,
503
504
  headers: {
@@ -506,8 +507,8 @@ class MelCloud extends EventEmitter {
506
507
  }
507
508
  });
508
509
 
509
- const options = { data: accountInfo.LoginData };
510
- await axiosInstance.post(ApiUrls.UpdateApplicationOptions, options);
510
+ const payload = { data: accountInfo.LoginData };
511
+ await axiosInstance(ApiUrls.UpdateApplicationOptions, payload);
511
512
  await this.functions.saveData(this.accountFile, accountInfo);
512
513
  return true;
513
514
  } catch (error) {
@@ -52,7 +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
-
56
55
  if (!Array.isArray(devicesData)) {
57
56
  if (this.logWarn) this.emit('warn', `Device data not found`);
58
57
  return null;
@@ -75,8 +74,8 @@ class MelCloudAta extends EventEmitter {
75
74
  if (this.logDebug) this.emit('debug', `Device Data: ${JSON.stringify(deviceData, null, 2)}`);
76
75
 
77
76
  //device info
78
- const hideVaneControls = deviceData.HideVaneControls ?? false;
79
- const hideDryModeControl = deviceData.HideDryModeControl ?? false;
77
+ const hideVaneControls = deviceData.HideVaneControls;
78
+ const hideDryModeControl = deviceData.HideDryModeControl;
80
79
  const serialNumber = deviceData.SerialNumber;
81
80
 
82
81
  //device
@@ -147,7 +146,8 @@ class MelCloudAta extends EventEmitter {
147
146
  ProhibitOperationMode: prohibitOperationMode,
148
147
  HideVaneControls: hideVaneControls,
149
148
  HideDryModeControl: hideDryModeControl,
150
- IsInError: isInError
149
+ IsInError: isInError,
150
+ Headers: deviceData.Headers
151
151
  }
152
152
 
153
153
  //restFul
@@ -185,11 +185,8 @@ class MelCloudAta extends EventEmitter {
185
185
  const axiosInstancePost = axios.create({
186
186
  method: 'POST',
187
187
  baseURL: ApiUrls.BaseURL,
188
- timeout: 25000,
189
- headers: {
190
- 'X-MitsContextKey': deviceData.ContextKey,
191
- 'Content-Type': 'application/json'
192
- },
188
+ timeout: 10000,
189
+ headers: deviceData.Headers,
193
190
  withCredentials: true
194
191
  });
195
192
 
@@ -227,8 +224,9 @@ class MelCloudAta extends EventEmitter {
227
224
  const axiosInstancePut = axios.create({
228
225
  method: 'PUT',
229
226
  baseURL: ApiUrlsHome.BaseURL,
230
- timeout: 25000,
231
- headers: deviceData.Headers
227
+ timeout: 10000,
228
+ headers: deviceData.Headers,
229
+ withCredentials: true
232
230
  });
233
231
 
234
232
  if (displayType === 1 && deviceData.Device.OperationMode === 8) {
@@ -148,7 +148,8 @@ class MelCloudAtw extends EventEmitter {
148
148
  ProhibitZone1: prohibitHeatingZone1,
149
149
  ProhibitZone2: prohibitHeatingZone2,
150
150
  ProhibitHotWater: prohibitHotWater,
151
- IsInError: isInError
151
+ IsInError: isInError,
152
+ Headers: deviceData.Headers
152
153
  }
153
154
 
154
155
  //restFul
@@ -186,11 +187,8 @@ class MelCloudAtw extends EventEmitter {
186
187
  const axiosInstancePost = axios.create({
187
188
  method: 'POST',
188
189
  baseURL: ApiUrls.BaseURL,
189
- timeout: 25000,
190
- headers: {
191
- 'X-MitsContextKey': deviceData.ContextKey,
192
- 'Content-Type': 'application/json'
193
- },
190
+ timeout: 10000,
191
+ headers: deviceData.Headers,
194
192
  withCredentials: true
195
193
  });
196
194
 
@@ -240,20 +238,9 @@ class MelCloudAtw extends EventEmitter {
240
238
  const axiosInstancePut = axios.create({
241
239
  method: 'PUT',
242
240
  baseURL: ApiUrlsHome.BaseURL,
243
- timeout: 25000,
244
- headers: {
245
- 'Accept': '*/*',
246
- 'Accept-Language': 'en-US,en;q=0.9',
247
- 'Cookie': deviceData.ContextKey,
248
- 'User-Agent': 'homebridge-melcloud-control/4.0.0',
249
- 'DNT': '1',
250
- 'Origin': 'https://melcloudhome.com',
251
- 'Referer': 'https://melcloudhome.com/dashboard',
252
- 'Sec-Fetch-Dest': 'empty',
253
- 'Sec-Fetch-Mode': 'cors',
254
- 'Sec-Fetch-Site': 'same-origin',
255
- 'X-CSRF': '1'
256
- }
241
+ timeout: 10000,
242
+ headers: deviceData.Headers,
243
+ withCredentials: true
257
244
  });
258
245
 
259
246
  if (displayType === 1 && deviceData.Device.OperationMode === 8) {
@@ -140,7 +140,8 @@ class MelCloudErv extends EventEmitter {
140
140
  HideRoomTemperature: hideRoomTemperature,
141
141
  HideSupplyTemperature: hideSupplyTemperature,
142
142
  HideOutdoorTemperature: hideOutdoorTemperature,
143
- IsInError: isInError
143
+ IsInError: isInError,
144
+ Headers: deviceData.Headers
144
145
  }
145
146
 
146
147
  //restFul
@@ -178,11 +179,8 @@ class MelCloudErv extends EventEmitter {
178
179
  const axiosInstancePost = axios.create({
179
180
  method: 'POST',
180
181
  baseURL: ApiUrls.BaseURL,
181
- timeout: 25000,
182
- headers: {
183
- 'X-MitsContextKey': deviceData.ContextKey,
184
- 'Content-Type': 'application/json'
185
- },
182
+ timeout: 10000,
183
+ headers: deviceData.Headers,
186
184
  withCredentials: true
187
185
  });
188
186
 
@@ -234,20 +232,9 @@ class MelCloudErv extends EventEmitter {
234
232
  const axiosInstancePut = axios.create({
235
233
  method: 'PUT',
236
234
  baseURL: ApiUrlsHome.BaseURL,
237
- timeout: 25000,
238
- headers: {
239
- 'Accept': '*/*',
240
- 'Accept-Language': 'en-US,en;q=0.9',
241
- 'Cookie': deviceData.ContextKey,
242
- 'User-Agent': 'homebridge-melcloud-control/4.0.0',
243
- 'DNT': '1',
244
- 'Origin': 'https://melcloudhome.com',
245
- 'Referer': 'https://melcloudhome.com/dashboard',
246
- 'Sec-Fetch-Dest': 'empty',
247
- 'Sec-Fetch-Mode': 'cors',
248
- 'Sec-Fetch-Site': 'same-origin',
249
- 'X-CSRF': '1'
250
- }
235
+ timeout: 10000,
236
+ headers: deviceData.Headers,
237
+ withCredentials: true
251
238
  });
252
239
 
253
240
  if (displayType === 1 && deviceData.Device.OperationMode === 8) {