homebridge-melcloud-control 4.0.0-beta.136 → 4.0.0-beta.138
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/constants.js +4 -4
- package/src/deviceata.js +83 -86
- package/src/melcloud.js +0 -11
- package/src/melcloudata.js +2 -13
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.138",
|
|
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/constants.js
CHANGED
|
@@ -18,7 +18,7 @@ export const ApiUrls = {
|
|
|
18
18
|
};
|
|
19
19
|
|
|
20
20
|
export const ApiUrlsHome = {
|
|
21
|
-
BaseURL:
|
|
21
|
+
BaseURL: "https://melcloudhome.com",
|
|
22
22
|
GetUserContext: "/api/user/context",
|
|
23
23
|
SetAta: "/api/ataunit/deviceid",
|
|
24
24
|
SetAtw: "/api/atwunit/deviceid",
|
|
@@ -76,10 +76,10 @@ export const AirConditioner = {
|
|
|
76
76
|
},
|
|
77
77
|
OperationModeMapStringToEnum: { "0": 0, "Heat": 1, "Dry": 2, "Cool": 3, "4": 4, "5": 5, "6": 6, "Fan": 7, "Auto": 8, "Isee Heat": 9, "Isee Dry": 10, "Isee Cool": 11 },
|
|
78
78
|
OperationModeMapEnumToString: { 0: "0", 1: "Heat", 2: "Dry", 3: "Cool", 4: "4", 5: "5", 6: "6", 7: "Fan", 8: "Auto", 9: "Isee Heat", 10: "Isee Dry", 11: "Isee Cool" },
|
|
79
|
-
FanSpeedMapStringToEnum: { "Auto": 0, "One": 1, "Two": 2, "Three": 3, "Four": 4, "Five": 5, },
|
|
79
|
+
FanSpeedMapStringToEnum: { "Auto": 0, "One": 1, "Two": 2, "Three": 3, "Four": 4, "Five": 5, "0": 0, "1": 1, "2": 2, "3": 3, "4": 4, "5": 5, },
|
|
80
80
|
FanSpeedMapEnumToString: { 0: "Auto", 1: "One", 2: "Two", 3: "Three", 4: "Four", 5: "Five" },
|
|
81
|
-
VaneVerticalDirectionMapStringToEnum: { "Auto": 0, "
|
|
82
|
-
VaneHorizontalDirectionMapStringToEnum: { "Auto": 0, "
|
|
81
|
+
VaneVerticalDirectionMapStringToEnum: { "Auto": 0, "One": 1, "Two": 2, "Three": 3, "Four": 4, "Five": 5, "Six": 6, "Swing": 7 },
|
|
82
|
+
VaneHorizontalDirectionMapStringToEnum: { "Auto": 0, "One": 1, "Two": 2, "Three": 3, "Four": 4, "Five": 5, "Six": 6, "Seven": 7, "Split": 8, "9": 9, "10": 10, "11": 11, "Swing": 12 },
|
|
83
83
|
};
|
|
84
84
|
|
|
85
85
|
export const HeatPump = {
|
package/src/deviceata.js
CHANGED
|
@@ -246,18 +246,18 @@ class DeviceAta extends EventEmitter {
|
|
|
246
246
|
const deviceName = this.deviceName;
|
|
247
247
|
const accountName = this.accountName;
|
|
248
248
|
const presetsOnServer = this.accessory.presets;
|
|
249
|
-
const
|
|
250
|
-
const
|
|
251
|
-
const
|
|
252
|
-
const
|
|
253
|
-
const
|
|
254
|
-
const
|
|
255
|
-
const
|
|
249
|
+
const supportsHeat = this.accessory.supportsHeat;
|
|
250
|
+
const supportsDry = this.accessory.supportsDry;
|
|
251
|
+
const supportsCool = this.accessory.supportsCool;
|
|
252
|
+
const supportsAuto = this.accessory.supportsAuto;
|
|
253
|
+
const supportsFanSpeed = this.accessory.supportsFanSpeed;
|
|
254
|
+
const supportsAutomaticFanSpeed = this.accessory.supportsAutomaticFanSpeed;
|
|
255
|
+
const supportsOutdoorTemperature = this.accessory.supportsOutdoorTemperature;
|
|
256
256
|
const numberOfFanSpeeds = this.accessory.numberOfFanSpeeds;
|
|
257
|
-
const
|
|
258
|
-
const autoDryFanMode = [this.accessory.operationMode, 8,
|
|
259
|
-
const heatDryFanMode = [this.accessory.operationMode, 1,
|
|
260
|
-
const coolDryFanMode = [this.accessory.operationMode, 3,
|
|
257
|
+
const supportsSwingFunction = this.accessory.supportsSwingFunction;
|
|
258
|
+
const autoDryFanMode = [this.accessory.operationMode, 8, supportsDry ? 2 : 8, 7][this.autoDryFanMode]; //NONE, AUTO - 8, DRY - 2, FAN - 7
|
|
259
|
+
const heatDryFanMode = [this.accessory.operationMode, 1, supportsDry ? 2 : 1, 7][this.heatDryFanMode]; //NONE, HEAT - 1, DRY - 2, FAN - 7
|
|
260
|
+
const coolDryFanMode = [this.accessory.operationMode, 3, supportsDry ? 2 : 3, 7][this.coolDryFanMode]; //NONE, COOL - 3, DRY - 2, FAN - 7
|
|
261
261
|
|
|
262
262
|
//accessory
|
|
263
263
|
if (this.logDebug) this.emit('debug', `Prepare accessory`);
|
|
@@ -339,7 +339,7 @@ class DeviceAta extends EventEmitter {
|
|
|
339
339
|
const value = this.accessory.roomTemperature;
|
|
340
340
|
return value;
|
|
341
341
|
});
|
|
342
|
-
if (
|
|
342
|
+
if (supportsFanSpeed) {
|
|
343
343
|
this.melCloudService.getCharacteristic(Characteristic.RotationSpeed)
|
|
344
344
|
.setProps({
|
|
345
345
|
minValue: 0,
|
|
@@ -356,24 +356,20 @@ class DeviceAta extends EventEmitter {
|
|
|
356
356
|
const fanKey = this.accountType === 'melcloud' ? 'FanSpeed' : 'SetFanSpeed';
|
|
357
357
|
switch (numberOfFanSpeeds) {
|
|
358
358
|
case 2: //Fan speed mode 2
|
|
359
|
-
fanSpeedModeText =
|
|
360
|
-
deviceData.Device[fanKey] =
|
|
359
|
+
fanSpeedModeText = supportsAutomaticFanSpeed ? [7, 1, 2, 0][value] : [7, 1, 2][value];
|
|
360
|
+
deviceData.Device[fanKey] = supportsAutomaticFanSpeed ? [0, 1, 2, 0][value] : [1, 1, 2][value];
|
|
361
361
|
break;
|
|
362
362
|
case 3: //Fan speed mode 3
|
|
363
|
-
fanSpeedModeText =
|
|
364
|
-
deviceData.Device[fanKey] =
|
|
363
|
+
fanSpeedModeText = supportsAutomaticFanSpeed ? [7, 1, 2, 3, 0][value] : [7, 1, 2, 3][value];
|
|
364
|
+
deviceData.Device[fanKey] = supportsAutomaticFanSpeed ? [0, 1, 2, 3, 0][value] : [1, 1, 2, 3][value];
|
|
365
365
|
break;
|
|
366
366
|
case 4: //Fan speed mode 4
|
|
367
|
-
fanSpeedModeText =
|
|
368
|
-
deviceData.Device[fanKey] =
|
|
367
|
+
fanSpeedModeText = supportsAutomaticFanSpeed ? [7, 1, 2, 3, 4, 0][value] : [7, 1, 2, 3, 4][value];
|
|
368
|
+
deviceData.Device[fanKey] = supportsAutomaticFanSpeed ? [0, 1, 2, 3, 4, 0][value] : [1, 1, 2, 3, 4][value];
|
|
369
369
|
break;
|
|
370
370
|
case 5: //Fan speed mode 5
|
|
371
|
-
|
|
372
|
-
deviceData.Device[fanKey] =
|
|
373
|
-
break;
|
|
374
|
-
case 6: //Fan speed mode 6
|
|
375
|
-
fanSpeedModeText = hasAutomaticFanSpeed ? [7, 1, 2, 3, 4, 5, 6, 0][value] : [7, 1, 2, 3, 4, 5, 6][value];
|
|
376
|
-
deviceData.Device[fanKey] = hasAutomaticFanSpeed ? [0, 1, 2, 3, 4, 5, 6, 0][value] : [1, 1, 2, 3, 4, 5, 6][value];
|
|
371
|
+
fanSpeedModeText = supportsAutomaticFanSpeed ? [7, 1, 2, 3, 4, 5, 0][value] : [7, 1, 2, 3, 4, 5][value];
|
|
372
|
+
deviceData.Device[fanKey] = supportsAutomaticFanSpeed ? [0, 1, 2, 3, 4, 5, 0][value] : [1, 1, 2, 3, 4, 5][value];
|
|
377
373
|
break;
|
|
378
374
|
};
|
|
379
375
|
deviceData.Device.EffectiveFlags = AirConditioner.EffectiveFlags.SetFanSpeed;
|
|
@@ -384,7 +380,7 @@ class DeviceAta extends EventEmitter {
|
|
|
384
380
|
};
|
|
385
381
|
});
|
|
386
382
|
};
|
|
387
|
-
if (
|
|
383
|
+
if (supportsSwingFunction) {
|
|
388
384
|
this.melCloudService.getCharacteristic(Characteristic.SwingMode)
|
|
389
385
|
.onGet(async () => {
|
|
390
386
|
//Vane Horizontal: Auto, 1, 2, 3, 4, 5, 6, 12 = Swing //Vertical: Auto, 1, 2, 3, 4, 5, 7 = Swing
|
|
@@ -405,9 +401,9 @@ class DeviceAta extends EventEmitter {
|
|
|
405
401
|
};
|
|
406
402
|
this.melCloudService.getCharacteristic(Characteristic.CoolingThresholdTemperature)
|
|
407
403
|
.setProps({
|
|
408
|
-
minValue: this.accessory.
|
|
409
|
-
maxValue: this.accessory.
|
|
410
|
-
minStep: this.accessory.
|
|
404
|
+
minValue: this.accessory.minTempCoolDryAuto,
|
|
405
|
+
maxValue: this.accessory.maxTempCoolDryAuto,
|
|
406
|
+
minStep: this.accessory.temperatureStep
|
|
411
407
|
})
|
|
412
408
|
.onGet(async () => {
|
|
413
409
|
const value = this.accessory.operationMode === 8 ? this.accessory.defaultCoolingSetTemperature : this.accessory.setTemperature;
|
|
@@ -424,12 +420,12 @@ class DeviceAta extends EventEmitter {
|
|
|
424
420
|
if (this.logWarn) this.emit('warn', `Set cooling threshold temperature error: ${error}`);
|
|
425
421
|
};
|
|
426
422
|
});
|
|
427
|
-
if (
|
|
423
|
+
if (supportsHeat) {
|
|
428
424
|
this.melCloudService.getCharacteristic(Characteristic.HeatingThresholdTemperature)
|
|
429
425
|
.setProps({
|
|
430
426
|
minValue: this.accessory.minTempHeat,
|
|
431
427
|
maxValue: this.accessory.maxTempHeat,
|
|
432
|
-
minStep: this.accessory.
|
|
428
|
+
minStep: this.accessory.temperatureStep
|
|
433
429
|
})
|
|
434
430
|
.onGet(async () => {
|
|
435
431
|
const value = this.accessory.operationMode === 8 ? this.accessory.defaultHeatingSetTemperature : this.accessory.setTemperature;
|
|
@@ -541,7 +537,7 @@ class DeviceAta extends EventEmitter {
|
|
|
541
537
|
.setProps({
|
|
542
538
|
minValue: this.accessory.minTempHeat,
|
|
543
539
|
maxValue: this.accessory.maxTempHeat,
|
|
544
|
-
minStep: this.accessory.
|
|
540
|
+
minStep: this.accessory.temperatureStep
|
|
545
541
|
})
|
|
546
542
|
.onGet(async () => {
|
|
547
543
|
const value = this.accessory.setTemperature;
|
|
@@ -595,7 +591,7 @@ class DeviceAta extends EventEmitter {
|
|
|
595
591
|
accessory.addService(this.roomTemperatureSensorService);
|
|
596
592
|
};
|
|
597
593
|
|
|
598
|
-
if (this.temperatureSensorOutdoor &&
|
|
594
|
+
if (this.temperatureSensorOutdoor && supportsOutdoorTemperature && this.accessory.outdoorTemperature !== null) {
|
|
599
595
|
if (this.logDebug) this.emit('debug', `Prepare outdoor temperature sensor service`);
|
|
600
596
|
this.outdoorTemperatureSensorService = new Service.TemperatureSensor(`${serviceName} Outdoor`, `Outdoor Temperature Sensor ${deviceId}`);
|
|
601
597
|
this.outdoorTemperatureSensorService.addOptionalCharacteristic(Characteristic.ConfiguredName);
|
|
@@ -951,6 +947,7 @@ class DeviceAta extends EventEmitter {
|
|
|
951
947
|
deviceData.Device.OperationMode = AirConditioner.OperationModeMapStringToEnum[deviceData.Device.OperationMode];
|
|
952
948
|
deviceData.Device.VaneVerticalDirection = AirConditioner.VaneVerticalDirectionMapStringToEnum[deviceData.Device.VaneVerticalDirection];
|
|
953
949
|
deviceData.Device.VaneHorizontalDirection = AirConditioner.VaneHorizontalDirectionMapStringToEnum[deviceData.Device.VaneHorizontalDirection];
|
|
950
|
+
deviceData.Device.ActualFanSpeed = AirConditioner.FanSpeedMapStringToEnum[deviceData.Device.ActualFanSpeed]
|
|
954
951
|
}
|
|
955
952
|
this.deviceData = deviceData;
|
|
956
953
|
|
|
@@ -962,25 +959,28 @@ class DeviceAta extends EventEmitter {
|
|
|
962
959
|
const hideDryModeControl = deviceData.HideDryModeControl ?? false;
|
|
963
960
|
|
|
964
961
|
//device info
|
|
965
|
-
const
|
|
966
|
-
const
|
|
967
|
-
const
|
|
968
|
-
const
|
|
969
|
-
const
|
|
970
|
-
const
|
|
971
|
-
const
|
|
972
|
-
const
|
|
973
|
-
const
|
|
974
|
-
const
|
|
975
|
-
const
|
|
976
|
-
const
|
|
962
|
+
const supportsAutomaticFanSpeed = deviceData.Device.HasAutomaticFanSpeed ?? false;
|
|
963
|
+
const supportsAirDirectionFunction = this.accountMelcloud ? deviceData.Device.AirDirectionFunction : deviceData.Device.HasAirDirectionFunction;;
|
|
964
|
+
const supportsSwingFunction = this.accountMelcloud ? deviceData.Device.SwingFunction : deviceData.Device.HasSwing;
|
|
965
|
+
const supportsWideVane = this.accountMelcloud ? deviceData.Device.ModelSupportsWideVane : deviceData.Device.SupportsWideVane;
|
|
966
|
+
const supportsOutdoorTemperature = deviceData.Device.HasOutdoorTemperature ?? false;
|
|
967
|
+
const supportsFanSpeed = this.accountMelcloud ? deviceData.Device.ModelSupportsFanSpeed : deviceData.Device.NumberOfFanSpeeds > 0;
|
|
968
|
+
const supportsAuto1 = this.accountMelcloud ? deviceData.Device.ModelSupportsAuto : deviceData.Device.HasAutoOperationMode;
|
|
969
|
+
const supportsAuto = this.autoDryFanMode >= 1 && supportsAuto1
|
|
970
|
+
const supportsHeat1 = this.accountMelcloud ? deviceData.Device.ModelSupportsHeat : deviceData.Device.HasHeatOperationMode
|
|
971
|
+
const supportsHeat = this.heatDryFanMode >= 1 && supportsHeat1;
|
|
972
|
+
const supportsDry = this.accountMelcloud ? deviceData.Device.ModelSupportsDry : deviceData.Device.HasDryOperationMode;
|
|
973
|
+
const supportsCool1 = this.accountMelcloud ? deviceData.Device.ModelSupportsCool : deviceData.Device.HasCoolOperationMode;
|
|
974
|
+
const supportsCool = this.coolDryFanMode >= 1 && supportsCool1;
|
|
975
|
+
const numberOfFanSpeeds = supportsFanSpeed ? deviceData.Device.NumberOfFanSpeeds : 0;
|
|
977
976
|
const minTempHeat = 10;
|
|
978
977
|
const maxTempHeat = 31;
|
|
979
|
-
const
|
|
980
|
-
const
|
|
978
|
+
const minTempCoolDryAuto = 16;
|
|
979
|
+
const maxTempCoolDryAuto = 31;
|
|
981
980
|
|
|
982
981
|
//device state
|
|
983
982
|
const fanKey = this.accountType === 'melcloud' ? 'FanSpeed' : 'SetFanSpeed';
|
|
983
|
+
const tempStepKey = this.accountType === 'melcloud' ? 'TemperatureIncrement' : 'HasHalfDegreeIncrements';
|
|
984
984
|
const power = deviceData.Device.Power ?? false;
|
|
985
985
|
const inStandbyMode = deviceData.Device.InStandbyMode ?? false;
|
|
986
986
|
const roomTemperature = deviceData.Device.RoomTemperature;
|
|
@@ -998,26 +998,27 @@ class DeviceAta extends EventEmitter {
|
|
|
998
998
|
const prohibitSetTemperature = deviceData.Device.ProhibitSetTemperature ?? false;
|
|
999
999
|
const prohibitOperationMode = deviceData.Device.ProhibitOperationMode ?? false;
|
|
1000
1000
|
const prohibitPower = deviceData.Device.ProhibitPower ?? false;
|
|
1001
|
-
const
|
|
1001
|
+
const temperatureStep = deviceData.Device[tempStepKey] ? 0.5 : 1;
|
|
1002
1002
|
const outdoorTemperature = deviceData.Device.OutdoorTemperature;
|
|
1003
1003
|
|
|
1004
1004
|
//accessory
|
|
1005
1005
|
const obj = {
|
|
1006
1006
|
presets: presetsOnServer,
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1007
|
+
supportsAutomaticFanSpeed: supportsAutomaticFanSpeed,
|
|
1008
|
+
supportsAirDirectionFunction: supportsAirDirectionFunction,
|
|
1009
|
+
supportsSwingFunction: supportsSwingFunction,
|
|
1010
|
+
supportsWideVane: supportsWideVane,
|
|
1011
|
+
supportsOutdoorTemperature: supportsOutdoorTemperature,
|
|
1011
1012
|
numberOfFanSpeeds: numberOfFanSpeeds,
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1013
|
+
supportsFanSpeed: supportsFanSpeed,
|
|
1014
|
+
supportsAuto: supportsAuto,
|
|
1015
|
+
supportsHeat: supportsHeat,
|
|
1016
|
+
supportsDry: supportsDry,
|
|
1017
|
+
supportsCool: supportsCool,
|
|
1017
1018
|
minTempHeat: minTempHeat,
|
|
1018
1019
|
maxTempHeat: maxTempHeat,
|
|
1019
|
-
|
|
1020
|
-
|
|
1020
|
+
minTempCoolDryAuto: minTempCoolDryAuto,
|
|
1021
|
+
maxTempCoolDryAuto: maxTempCoolDryAuto,
|
|
1021
1022
|
power: power ? 1 : 0,
|
|
1022
1023
|
inStandbyMode: inStandbyMode,
|
|
1023
1024
|
operationMode: operationMode,
|
|
@@ -1032,9 +1033,9 @@ class DeviceAta extends EventEmitter {
|
|
|
1032
1033
|
automaticFanSpeed: automaticFanSpeed,
|
|
1033
1034
|
vaneVerticalSwing: vaneVerticalSwing,
|
|
1034
1035
|
vaneHorizontalSwing: vaneHorizontalSwing,
|
|
1035
|
-
swingMode:
|
|
1036
|
+
swingMode: supportsSwingFunction && vaneHorizontalDirection === 12 && vaneVerticalDirection === 7 ? 1 : 0,
|
|
1036
1037
|
lockPhysicalControl: prohibitSetTemperature && prohibitOperationMode && prohibitPower ? 1 : 0,
|
|
1037
|
-
|
|
1038
|
+
temperatureStep: temperatureStep,
|
|
1038
1039
|
useFahrenheit: this.useFahrenheit,
|
|
1039
1040
|
temperatureUnit: TemperatureDisplayUnits[this.useFahrenheit]
|
|
1040
1041
|
};
|
|
@@ -1081,32 +1082,28 @@ class DeviceAta extends EventEmitter {
|
|
|
1081
1082
|
};
|
|
1082
1083
|
|
|
1083
1084
|
obj.currentOperationMode = !power ? 0 : inStandbyMode ? 1 : obj.currentOperationMode;
|
|
1084
|
-
obj.operationModeSetPropsMinValue =
|
|
1085
|
+
obj.operationModeSetPropsMinValue = supportsAuto && supportsHeat ? 0 : !supportsAuto && supportsHeat ? 1 : supportsAuto && !supportsHeat ? 0 : 2;
|
|
1085
1086
|
obj.operationModeSetPropsMaxValue = 2
|
|
1086
|
-
obj.operationModeSetPropsValidValues =
|
|
1087
|
+
obj.operationModeSetPropsValidValues = supportsAuto && supportsHeat ? [0, 1, 2] : !supportsAuto && supportsHeat ? [1, 2] : supportsAuto && !supportsHeat ? [0, 2] : [2];
|
|
1087
1088
|
|
|
1088
1089
|
//fan speed mode
|
|
1089
|
-
if (
|
|
1090
|
+
if (supportsFanSpeed) {
|
|
1090
1091
|
switch (numberOfFanSpeeds) {
|
|
1091
1092
|
case 2: //Fan speed mode 2
|
|
1092
|
-
obj.fanSpeed =
|
|
1093
|
-
obj.fanSpeedSetPropsMaxValue =
|
|
1093
|
+
obj.fanSpeed = supportsAutomaticFanSpeed ? [3, 1, 2][fanSpeed] : [0, 1, 2][fanSpeed];
|
|
1094
|
+
obj.fanSpeedSetPropsMaxValue = supportsAutomaticFanSpeed ? 3 : 2;
|
|
1094
1095
|
break;
|
|
1095
1096
|
case 3: //Fan speed mode 3
|
|
1096
|
-
obj.fanSpeed =
|
|
1097
|
-
obj.fanSpeedSetPropsMaxValue =
|
|
1097
|
+
obj.fanSpeed = supportsAutomaticFanSpeed ? [4, 1, 2, 3][fanSpeed] : [0, 1, 2, 3][fanSpeed];
|
|
1098
|
+
obj.fanSpeedSetPropsMaxValue = supportsAutomaticFanSpeed ? 4 : 3;
|
|
1098
1099
|
break;
|
|
1099
1100
|
case 4: //Fan speed mode 4
|
|
1100
|
-
obj.fanSpeed =
|
|
1101
|
-
obj.fanSpeedSetPropsMaxValue =
|
|
1101
|
+
obj.fanSpeed = supportsAutomaticFanSpeed ? [5, 1, 2, 3, 4][fanSpeed] : [0, 1, 2, 3, 4][fanSpeed];
|
|
1102
|
+
obj.fanSpeedSetPropsMaxValue = supportsAutomaticFanSpeed ? 5 : 4;
|
|
1102
1103
|
break;
|
|
1103
1104
|
case 5: //Fan speed mode 5
|
|
1104
|
-
obj.fanSpeed =
|
|
1105
|
-
obj.fanSpeedSetPropsMaxValue =
|
|
1106
|
-
break;
|
|
1107
|
-
case 6: //Fan speed mode 6
|
|
1108
|
-
obj.fanSpeed = hasAutomaticFanSpeed ? [7, 1, 2, 3, 4, 5, 6][fanSpeed] : [0, 1, 2, 3, 4, 5, 6][fanSpeed];
|
|
1109
|
-
obj.fanSpeedSetPropsMaxValue = hasAutomaticFanSpeed ? 7 : 6;
|
|
1105
|
+
obj.fanSpeed = supportsAutomaticFanSpeed ? [6, 1, 2, 3, 4, 5][fanSpeed] : [0, 1, 2, 3, 4, 5][fanSpeed];
|
|
1106
|
+
obj.fanSpeedSetPropsMaxValue = supportsAutomaticFanSpeed ? 6 : 5;
|
|
1110
1107
|
break;
|
|
1111
1108
|
};
|
|
1112
1109
|
};
|
|
@@ -1120,9 +1117,9 @@ class DeviceAta extends EventEmitter {
|
|
|
1120
1117
|
.updateCharacteristic(Characteristic.LockPhysicalControls, obj.lockPhysicalControl)
|
|
1121
1118
|
.updateCharacteristic(Characteristic.TemperatureDisplayUnits, obj.useFahrenheit)
|
|
1122
1119
|
.updateCharacteristic(Characteristic.CoolingThresholdTemperature, defaultCoolingSetTemperature);
|
|
1123
|
-
if (
|
|
1124
|
-
if (
|
|
1125
|
-
if (
|
|
1120
|
+
if (supportsHeat) this.melCloudService?.updateCharacteristic(Characteristic.HeatingThresholdTemperature, defaultHeatingSetTemperature);
|
|
1121
|
+
if (supportsFanSpeed) this.melCloudService?.updateCharacteristic(Characteristic.RotationSpeed, obj.fanSpeed);
|
|
1122
|
+
if (supportsSwingFunction) this.melCloudService?.updateCharacteristic(Characteristic.SwingMode, obj.swingMode);
|
|
1126
1123
|
break;
|
|
1127
1124
|
case 2: //Thermostat
|
|
1128
1125
|
switch (operationMode) {
|
|
@@ -1166,8 +1163,8 @@ class DeviceAta extends EventEmitter {
|
|
|
1166
1163
|
obj.currentOperationMode = !power ? 0 : obj.currentOperationMode;
|
|
1167
1164
|
obj.targetOperationMode = !power ? 0 : obj.targetOperationMode;
|
|
1168
1165
|
obj.operationModeSetPropsMinValue = 0
|
|
1169
|
-
obj.operationModeSetPropsMaxValue =
|
|
1170
|
-
obj.operationModeSetPropsValidValues =
|
|
1166
|
+
obj.operationModeSetPropsMaxValue = supportsAuto && supportsHeat ? 3 : !supportsAuto && supportsHeat ? 2 : supportsAuto && !supportsHeat ? 3 : 2;
|
|
1167
|
+
obj.operationModeSetPropsValidValues = supportsAuto && supportsHeat ? [0, 1, 2, 3] : !supportsAuto && supportsHeat ? [0, 1, 2] : supportsAuto && !supportsHeat ? [0, 2, 3] : [0, 2];
|
|
1171
1168
|
|
|
1172
1169
|
//update characteristics
|
|
1173
1170
|
this.melCloudService
|
|
@@ -1328,12 +1325,12 @@ class DeviceAta extends EventEmitter {
|
|
|
1328
1325
|
this.emit('info', `Current operation mode: ${this.displayMode === 1 ? AirConditioner.CurrentOperationModeHeatherCooler[obj.currentOperationMode] : AirConditioner.CurrentOperationModeThermostat[obj.currentOperationMode]}`);
|
|
1329
1326
|
this.emit('info', `Target temperature: ${setTemperature}${obj.temperatureUnit}`);
|
|
1330
1327
|
this.emit('info', `Current temperature: ${roomTemperature}${obj.temperatureUnit}`);
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1328
|
+
if (supportsOutdoorTemperature && outdoorTemperature !== null) this.emit('info', `Outdoor temperature: ${outdoorTemperature}${obj.temperatureUnit}`);
|
|
1329
|
+
if (supportsFanSpeed) this.emit('info', `Target fan speed: ${AirConditioner.FanSpeedMapHomekit[fanSpeed]}`);
|
|
1330
|
+
if (supportsFanSpeed) this.emit('info', `Current fan speed: ${AirConditioner.FanSpeedMapHomekit[actualFanSpeed]}`);
|
|
1331
|
+
if (vaneHorizontalDirection !== null) this.emit('info', `Vane horizontal: ${AirConditioner.HorizontalVane[vaneHorizontalDirection] ?? vaneHorizontalDirection}`);
|
|
1332
|
+
if (vaneVerticalDirection !== null) this.emit('info', `Vane vertical: ${AirConditioner.VerticalVane[vaneVerticalDirection] ?? vaneVerticalDirection}`);
|
|
1333
|
+
if (supportsSwingFunction) this.emit('info', `Air direction: ${AirConditioner.AirDirection[obj.swingMode]}`);
|
|
1337
1334
|
this.emit('info', `Temperature display unit: ${obj.temperatureUnit}`);
|
|
1338
1335
|
this.emit('info', `Lock physical controls: ${obj.lockPhysicalControl ? 'LOCKED' : 'UNLOCKED'}`);
|
|
1339
1336
|
};
|
package/src/melcloud.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Agent } from 'https';
|
|
2
1
|
import axios from 'axios';
|
|
3
2
|
import puppeteer from 'puppeteer';
|
|
4
3
|
import EventEmitter from 'events';
|
|
@@ -33,16 +32,6 @@ class MelCloud extends EventEmitter {
|
|
|
33
32
|
Persist: true
|
|
34
33
|
};
|
|
35
34
|
|
|
36
|
-
this.axiosDefaults = {
|
|
37
|
-
timeout: 15000,
|
|
38
|
-
maxContentLength: 100000000,
|
|
39
|
-
maxBodyLength: 1000000000,
|
|
40
|
-
httpsAgent: new Agent({
|
|
41
|
-
keepAlive: false,
|
|
42
|
-
rejectUnauthorized: false
|
|
43
|
-
})
|
|
44
|
-
};
|
|
45
|
-
|
|
46
35
|
if (!requestConfig) {
|
|
47
36
|
this.impulseGenerator = new ImpulseGenerator()
|
|
48
37
|
.on('connect', async () => {
|
package/src/melcloudata.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Agent } from 'https';
|
|
2
1
|
import axios from 'axios';
|
|
3
2
|
import EventEmitter from 'events';
|
|
4
3
|
import ImpulseGenerator from './impulsegenerator.js';
|
|
@@ -194,28 +193,18 @@ class MelCloudAta extends EventEmitter {
|
|
|
194
193
|
};
|
|
195
194
|
|
|
196
195
|
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
196
|
switch (accountType) {
|
|
208
197
|
case "melcloud":
|
|
209
198
|
try {
|
|
210
199
|
const axiosInstancePost = axios.create({
|
|
211
200
|
method: 'POST',
|
|
212
201
|
baseURL: ApiUrls.BaseURL,
|
|
202
|
+
timeout: 25000,
|
|
213
203
|
headers: {
|
|
214
204
|
'X-MitsContextKey': deviceData.ContextKey,
|
|
215
205
|
'content-type': 'application/json'
|
|
216
206
|
},
|
|
217
|
-
withCredentials: true
|
|
218
|
-
...axiosDefaults
|
|
207
|
+
withCredentials: true
|
|
219
208
|
});
|
|
220
209
|
|
|
221
210
|
//set target temp based on display mode and operation mode
|