homebridge-melcloud-control 4.3.9-beta.7 → 4.3.9-beta.9
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 +5 -1
- package/src/deviceata.js +2 -1
- package/src/melcloudata.js +22 -10
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"displayName": "MELCloud Control",
|
|
3
3
|
"name": "homebridge-melcloud-control",
|
|
4
|
-
"version": "4.3.9-beta.
|
|
4
|
+
"version": "4.3.9-beta.9",
|
|
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
|
@@ -58,14 +58,18 @@ export const TemperatureDisplayUnits = ["°C", "°F"];
|
|
|
58
58
|
|
|
59
59
|
export const AirConditioner = {
|
|
60
60
|
SystemMapEnumToString: { 0: "Air Conditioner Off", 1: "Air Conditioner On", 2: "Air Conditioner Offline" },
|
|
61
|
-
OperationModeMapStringToEnum: { "0": 0, "Heat": 1, "Dry": 2, "Cool": 3, "4":
|
|
61
|
+
OperationModeMapStringToEnum: { "0": 0, "Heat": 1, "Dry": 2, "Cool": 3, "4": 4, "5": 5, "6": 6, "Fan": 7, "Automatic": 8, "Isee Heat": 9, "Isee Dry": 10, "Isee Cool": 11 },
|
|
62
|
+
OperationModeMapEnumToEnumWs: { 0: 0, 1: 1, 2: 2, 3: 3, 4: 7, 5: 8, 6: 9, 7: 10, 8: 11 },
|
|
62
63
|
OperationModeMapEnumToString: { 0: "0", 1: "Heat", 2: "Dry", 3: "Cool", 4: "4", 5: "5", 6: "6", 7: "Fan", 8: "Automatic", 9: "Isee Heat", 10: "Isee Dry", 11: "Isee Cool" },
|
|
63
64
|
FanSpeedMapStringToEnum: { "Auto": 0, "One": 1, "Two": 2, "Three": 3, "Four": 4, "Five": 5 },
|
|
64
65
|
FanSpeedMapEnumToString: { 0: "Auto", 1: "One", 2: "Two", 3: "Three", 4: "Four", 5: "Five" },
|
|
66
|
+
AktualFanSpeedMapStringToEnum: { "Auto": 0, "One": 1, "Two": 2, "Three": 3, "Four": 4, "Five": 5 },
|
|
65
67
|
AktualFanSpeedMapEnumToString: { 0: "Quiet", 1: "One", 2: "Two", 3: "Three", 4: "Four", 5: "Five" },
|
|
66
68
|
VaneVerticalDirectionMapStringToEnum: { "Auto": 0, "One": 1, "Two": 2, "Three": 3, "Four": 4, "Five": 5, "Six": 6, "Swing": 7 },
|
|
69
|
+
VaneVerticalDirectionMapEnumToEnumWs: { 6: 7 },
|
|
67
70
|
VaneVerticalDirectionMapEnumToString: { 0: "Auto", 1: "One", 2: "Two", 3: "Three", 4: "Four", 5: "Five", 6: "Six", 7: "Swing" },
|
|
68
71
|
VaneHorizontalDirectionMapStringToEnum: { "Auto": 0, "Left": 1, "LeftCentre": 2, "Centre": 3, "RightCentre": 4, "Right": 5, "Six": 6, "Seven": 7, "Split": 8, "Nine": 9, "Ten": 10, "Eleven": 11, "Swing": 12 },
|
|
72
|
+
VaneHorizontalDirectionMapEnumToEnumWs: { 7: 12 },
|
|
69
73
|
VaneHorizontalDirectionMapEnumToString: { 0: "Auto", 1: "Left", 2: "LeftCentre", 3: "Centre", 4: "RightCentre", 5: "Right", 6: "Six", 7: "Seven", 8: "Split", 9: "Nine", 10: "Ten", 11: "Eleven", 12: "Swing" },
|
|
70
74
|
AirDirectionMapEnumToString: { 0: "Auto", 1: "Swing" },
|
|
71
75
|
CurrentOperationModeMapEnumToStringHeatherCooler: { 0: "Inactive", 1: "Idle", 2: "Heating", 3: "Cooling" },
|
package/src/deviceata.js
CHANGED
|
@@ -439,7 +439,8 @@ class DeviceAta extends EventEmitter {
|
|
|
439
439
|
if (supportsSwingFunction) {
|
|
440
440
|
melCloudService.getCharacteristic(Characteristic.SwingMode)
|
|
441
441
|
.onGet(async () => {
|
|
442
|
-
//Vane Horizontal: Auto, 1, 2, 3, 4, 5, 6, 7 =
|
|
442
|
+
//Vane Horizontal: Auto, 1, 2, 3, 4, 5, 6, 7 = Split, 12 = Swing //Vertical: Auto, 1, 2, 3, 4, 5, 7 = Swing
|
|
443
|
+
//Home Vane Horizontal: Auto, 1, 2, 3, 4, 5, 6, 7 = Swing, 8 = Split //Vertical: Auto, 1, 2, 3, 4, 5, 6 = Swing
|
|
443
444
|
const value = this.accessory.currentSwingMode;
|
|
444
445
|
return value;
|
|
445
446
|
})
|
package/src/melcloudata.js
CHANGED
|
@@ -62,9 +62,12 @@ class MelCloudAta extends EventEmitter {
|
|
|
62
62
|
|
|
63
63
|
//update device settings
|
|
64
64
|
if (key in deviceData.Device) {
|
|
65
|
-
|
|
65
|
+
let parsedValue = this.functions.convertValue(value);
|
|
66
|
+
deviceData.Device[key] = parsedValue;
|
|
66
67
|
}
|
|
67
68
|
}
|
|
69
|
+
|
|
70
|
+
if (!this.logDebug) this.emit('debug', `Update device settings: ${JSON.stringify(deviceData.Device, null, 2)}`);
|
|
68
71
|
updateState = true;
|
|
69
72
|
break;
|
|
70
73
|
case 'unitHolidayModeTriggered':
|
|
@@ -88,21 +91,30 @@ class MelCloudAta extends EventEmitter {
|
|
|
88
91
|
}
|
|
89
92
|
|
|
90
93
|
//update state
|
|
91
|
-
if (updateState) await this.updateState(deviceData);
|
|
94
|
+
if (updateState) await this.updateState(deviceData, 'ws');
|
|
92
95
|
} catch (error) {
|
|
93
96
|
if (this.logError) this.emit('error', `Web socket process message error: ${error}`);
|
|
94
97
|
}
|
|
95
98
|
});
|
|
96
99
|
}
|
|
97
100
|
|
|
98
|
-
async updateState(deviceData) {
|
|
101
|
+
async updateState(deviceData, type) {
|
|
99
102
|
try {
|
|
100
103
|
if (this.accountType === 'melcloudhome') {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
104
|
+
|
|
105
|
+
if (type === 'ws') {
|
|
106
|
+
deviceData.Device.OperationMode = AirConditioner.OperationModeMapEnumToEnumWs[deviceData.Device.OperationMode] ?? deviceData.Device.OperationMode;
|
|
107
|
+
deviceData.Device.ActualFanSpeed = AirConditioner.AktualFanSpeedMapStringToEnum[deviceData.Device.ActualFanSpeed] ?? deviceData.Device.ActualFanSpeed;
|
|
108
|
+
deviceData.Device.SetFanSpeed = AirConditioner.FanSpeedMapStringToEnum[deviceData.Device.SetFanSpeed] ?? deviceData.Device.SetFanSpeed;
|
|
109
|
+
deviceData.Device.VaneHorizontalDirection = AirConditioner.VaneHorizontalDirectionMapEnumToEnumWs[deviceData.Device.VaneHorizontalDirection] ?? deviceData.Device.VaneHorizontalDirection;
|
|
110
|
+
deviceData.Device.VaneVerticalDirection = AirConditioner.VaneVerticalDirectionMapEnumToEnumWs[deviceData.Device.VaneVerticalDirection] ?? deviceData.Device.VaneVerticalDirection;
|
|
111
|
+
} else {
|
|
112
|
+
deviceData.Device.OperationMode = AirConditioner.OperationModeMapStringToEnum[deviceData.Device.OperationMode] ?? deviceData.Device.OperationMode;
|
|
113
|
+
deviceData.Device.ActualFanSpeed = AirConditioner.AktualFanSpeedMapStringToEnum[deviceData.Device.ActualFanSpeed] ?? deviceData.Device.ActualFanSpeed;
|
|
114
|
+
deviceData.Device.SetFanSpeed = AirConditioner.FanSpeedMapStringToEnum[deviceData.Device.SetFanSpeed] ?? deviceData.Device.SetFanSpeed;
|
|
115
|
+
deviceData.Device.VaneHorizontalDirection = AirConditioner.VaneHorizontalDirectionMapStringToEnum[deviceData.Device.VaneHorizontalDirection] ?? deviceData.Device.VaneHorizontalDirection;
|
|
116
|
+
deviceData.Device.VaneVerticalDirection = AirConditioner.VaneVerticalDirectionMapStringToEnum[deviceData.Device.VaneVerticalDirection] ?? deviceData.Device.VaneVerticalDirection;
|
|
117
|
+
}
|
|
106
118
|
|
|
107
119
|
//read default temps
|
|
108
120
|
const temps = await this.functions.readData(this.defaultTempsFile, true);
|
|
@@ -110,7 +122,7 @@ class MelCloudAta extends EventEmitter {
|
|
|
110
122
|
deviceData.Device.DefaultCoolingSetTemperature = temps?.defaultCoolingSetTemperature ?? 24;
|
|
111
123
|
|
|
112
124
|
}
|
|
113
|
-
if (
|
|
125
|
+
if (this.logDebug) this.emit('debug', `Device Data: ${JSON.stringify(deviceData, null, 2)}`);
|
|
114
126
|
|
|
115
127
|
//device
|
|
116
128
|
const serialNumber = deviceData.SerialNumber || '4.0.0';
|
|
@@ -224,7 +236,7 @@ class MelCloudAta extends EventEmitter {
|
|
|
224
236
|
}
|
|
225
237
|
|
|
226
238
|
if (this.logDebug) this.emit('debug', `Send Data: ${JSON.stringify(payload, null, 2)}`);
|
|
227
|
-
|
|
239
|
+
|
|
228
240
|
await axios(path, {
|
|
229
241
|
method: 'POST',
|
|
230
242
|
baseURL: ApiUrls.BaseURL,
|