homebridge-melcloud-control 4.0.0-beta.126 → 4.0.0-beta.127
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 +1 -1
- package/src/melcloudata.js +16 -15
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.
|
|
4
|
+
"version": "4.0.0-beta.127",
|
|
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/melcloudata.js
CHANGED
|
@@ -18,16 +18,6 @@ class MelCloudAta extends EventEmitter {
|
|
|
18
18
|
//set default values
|
|
19
19
|
this.deviceState = {};
|
|
20
20
|
|
|
21
|
-
this.axiosDefaults = {
|
|
22
|
-
timeout: 25000,
|
|
23
|
-
maxContentLength: 100000000,
|
|
24
|
-
maxBodyLength: 1000000000,
|
|
25
|
-
httpsAgent: new Agent({
|
|
26
|
-
keepAlive: false,
|
|
27
|
-
rejectUnauthorized: false
|
|
28
|
-
})
|
|
29
|
-
};;
|
|
30
|
-
|
|
31
21
|
//lock flags
|
|
32
22
|
this.locks = {
|
|
33
23
|
checkState: false,
|
|
@@ -204,6 +194,16 @@ class MelCloudAta extends EventEmitter {
|
|
|
204
194
|
};
|
|
205
195
|
|
|
206
196
|
async send(accountType, deviceData, displayMode) {
|
|
197
|
+
const axiosDefaults = {
|
|
198
|
+
timeout: 25000,
|
|
199
|
+
maxContentLength: 100000000,
|
|
200
|
+
maxBodyLength: 1000000000,
|
|
201
|
+
httpsAgent: new Agent({
|
|
202
|
+
keepAlive: false,
|
|
203
|
+
rejectUnauthorized: false
|
|
204
|
+
})
|
|
205
|
+
};
|
|
206
|
+
|
|
207
207
|
switch (accountType) {
|
|
208
208
|
case "melcloud":
|
|
209
209
|
try {
|
|
@@ -215,7 +215,7 @@ class MelCloudAta extends EventEmitter {
|
|
|
215
215
|
'content-type': 'application/json'
|
|
216
216
|
},
|
|
217
217
|
withCredentials: true,
|
|
218
|
-
...
|
|
218
|
+
...axiosDefaults
|
|
219
219
|
});
|
|
220
220
|
|
|
221
221
|
//set target temp based on display mode and operation mode
|
|
@@ -236,8 +236,7 @@ class MelCloudAta extends EventEmitter {
|
|
|
236
236
|
deviceData.Device.SetTemperature = deviceData.Device.SetTemperature;
|
|
237
237
|
break;
|
|
238
238
|
case 8: //AUTO
|
|
239
|
-
|
|
240
|
-
deviceData.Device.SetTemperature = setTemperature;
|
|
239
|
+
deviceData.Device.SetTemperature = (deviceData.Device.DefaultCoolingSetTemperature + deviceData.Device.DefaultHeatingSetTemperature) / 2;
|
|
241
240
|
break;
|
|
242
241
|
default:
|
|
243
242
|
deviceData.Device.SetTemperature = deviceData.Device.SetTemperature;
|
|
@@ -295,7 +294,7 @@ class MelCloudAta extends EventEmitter {
|
|
|
295
294
|
'Sec-Fetch-Site': 'same-origin',
|
|
296
295
|
'X-CSRF': '1'
|
|
297
296
|
},
|
|
298
|
-
...
|
|
297
|
+
...axiosDefaults
|
|
299
298
|
});
|
|
300
299
|
|
|
301
300
|
//set target temp based on display mode and operation mode
|
|
@@ -333,7 +332,9 @@ class MelCloudAta extends EventEmitter {
|
|
|
333
332
|
this.emit('warn', JSON.stringify(payload, null, 2));
|
|
334
333
|
|
|
335
334
|
const path = ApiUrlsHome.SetAta.replace('deviceid', deviceData.DeviceID);
|
|
336
|
-
await axiosInstancePut(path, payload);
|
|
335
|
+
const response = await axiosInstancePut(path, payload);
|
|
336
|
+
this.emit('warn', JSON.stringify(response, null, 2));
|
|
337
|
+
this.emit('deviceState', deviceData);
|
|
337
338
|
return true;
|
|
338
339
|
} catch (error) {
|
|
339
340
|
throw new Error(`Send data error: ${error}`);
|