homebridge-melcloud-control 4.0.0-beta.152 → 4.0.0-beta.153
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/deviceata.js +33 -42
- package/src/melcloudata.js +4 -4
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.153",
|
|
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/deviceata.js
CHANGED
|
@@ -151,8 +151,6 @@ class DeviceAta extends EventEmitter {
|
|
|
151
151
|
async setOverExternalIntegration(integration, deviceData, key, value) {
|
|
152
152
|
try {
|
|
153
153
|
let set = false
|
|
154
|
-
const vaneVerticalKey = this.accountType === 'melcloud' ? 'VaneVertical' : 'VaneVerticalDirection';
|
|
155
|
-
const vaneHorizontalKey = this.accountType === 'melcloud' ? 'VaneHorizontal' : 'VaneHorizontalDirection';
|
|
156
154
|
switch (key) {
|
|
157
155
|
case 'Power':
|
|
158
156
|
deviceData.Device[key] = value;
|
|
@@ -186,12 +184,12 @@ class DeviceAta extends EventEmitter {
|
|
|
186
184
|
break;
|
|
187
185
|
case 'VaneHorizontalDirection':
|
|
188
186
|
deviceData.Device[key] = value;
|
|
189
|
-
deviceData.Device.EffectiveFlags = AirConditioner.EffectiveFlags
|
|
187
|
+
deviceData.Device.EffectiveFlags = AirConditioner.EffectiveFlags.VaneHorizontalDirection;
|
|
190
188
|
set = await this.melCloudAta.send(this.accountType, deviceData, this.displayMode);
|
|
191
189
|
break;
|
|
192
190
|
case 'VaneVerticalDirection':
|
|
193
191
|
deviceData.Device[key] = value;
|
|
194
|
-
deviceData.Device.EffectiveFlags = AirConditioner.EffectiveFlags
|
|
192
|
+
deviceData.Device.EffectiveFlags = AirConditioner.EffectiveFlags.VaneVerticalDirection;
|
|
195
193
|
set = await this.melCloudAta.send(this.accountType, deviceData, this.displayMode);
|
|
196
194
|
break;
|
|
197
195
|
case 'HideVaneControls':
|
|
@@ -333,6 +331,7 @@ class DeviceAta extends EventEmitter {
|
|
|
333
331
|
return;
|
|
334
332
|
};
|
|
335
333
|
|
|
334
|
+
this.emit('warn', deviceData.Device.OperationMode);
|
|
336
335
|
deviceData.Device.EffectiveFlags = AirConditioner.EffectiveFlags.OperationMode;
|
|
337
336
|
await this.melCloudAta.send(this.accountType, deviceData, this.displayMode);
|
|
338
337
|
const operationModeText = AirConditioner.OperationMode[deviceData.Device.OperationMode];
|
|
@@ -354,7 +353,7 @@ class DeviceAta extends EventEmitter {
|
|
|
354
353
|
minStep: 1
|
|
355
354
|
})
|
|
356
355
|
.onGet(async () => {
|
|
357
|
-
const value = this.accessory.
|
|
356
|
+
const value = this.accessory.currentFanSpeed; //AUTO, 1, 2, 3, 4, 5, 6, OFF
|
|
358
357
|
return value;
|
|
359
358
|
})
|
|
360
359
|
.onSet(async (value) => {
|
|
@@ -391,15 +390,13 @@ class DeviceAta extends EventEmitter {
|
|
|
391
390
|
this.melCloudService.getCharacteristic(Characteristic.SwingMode)
|
|
392
391
|
.onGet(async () => {
|
|
393
392
|
//Vane Horizontal: Auto, 1, 2, 3, 4, 5, 6, 7 = Sp;it, 12 = Swing //Vertical: Auto, 1, 2, 3, 4, 5, 7 = Swing
|
|
394
|
-
const value = this.accessory.
|
|
393
|
+
const value = this.accessory.currentSwingMode;
|
|
395
394
|
return value;
|
|
396
395
|
})
|
|
397
396
|
.onSet(async (value) => {
|
|
398
397
|
try {
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
deviceData.Device[vaneHorizontalKey] = value ? 12 : 0;
|
|
402
|
-
deviceData.Device[vaneVerticalKey] = value ? 7 : 0;
|
|
398
|
+
deviceData.Device.VaneHorizontalDirection = value ? 12 : 0;
|
|
399
|
+
deviceData.Device.VaneVerticalDirection = value ? 7 : 0;
|
|
403
400
|
deviceData.Device.EffectiveFlags = AirConditioner.EffectiveFlags.VaneVerticalVaneHorizontal;
|
|
404
401
|
await this.melCloudAta.send(this.accountType, deviceData, this.displayMode);
|
|
405
402
|
if (this.logInfo) this.emit('info', `Set air direction mode: ${AirConditioner.AirDirection[value]}`);
|
|
@@ -645,16 +642,14 @@ class DeviceAta extends EventEmitter {
|
|
|
645
642
|
.onSet(async (state) => {
|
|
646
643
|
try {
|
|
647
644
|
const fanKey = this.accountType === 'melcloud' ? 'FanSpeed' : 'SetFanSpeed';
|
|
648
|
-
const vaneVerticalKey = this.accountType === 'melcloud' ? 'VaneVertical' : 'VaneVerticalDirection';
|
|
649
|
-
const vaneHorizontalKey = this.accountType === 'melcloud' ? 'VaneHorizontal' : 'VaneHorizontalDirection';
|
|
650
645
|
switch (state) {
|
|
651
646
|
case true:
|
|
652
647
|
preset.previousSettings = deviceData.Device;
|
|
653
648
|
deviceData.Device.Power = presetData.Power;
|
|
654
649
|
deviceData.Device.OperationMode = presetData.OperationMode;
|
|
655
650
|
deviceData.Device.SetTemperature = presetData.SetTemperature;
|
|
656
|
-
deviceData.Device
|
|
657
|
-
deviceData.Device
|
|
651
|
+
deviceData.Device.VaneHorizontalDirection = presetData.VaneHorizontalDirection;
|
|
652
|
+
deviceData.Device.VaneVerticalDirection = presetData.VaneVerticalDirection;
|
|
658
653
|
deviceData.Device[fanKey] = presetData[fanKey];
|
|
659
654
|
deviceData.Device.EffectiveFlags = AirConditioner.EffectiveFlags.Presets;
|
|
660
655
|
break;
|
|
@@ -662,8 +657,8 @@ class DeviceAta extends EventEmitter {
|
|
|
662
657
|
deviceData.Device.Power = preset.previousSettings.Power;
|
|
663
658
|
deviceData.Device.OperationMode = preset.previousSettings.OperationMode;
|
|
664
659
|
deviceData.Device.SetTemperature = preset.previousSettings.SetTemperature;
|
|
665
|
-
deviceData.Device
|
|
666
|
-
deviceData.Device
|
|
660
|
+
deviceData.Device.VaneHorizontalDirection = preset.previousSettings.VaneHorizontalDirection;
|
|
661
|
+
deviceData.Device.VaneVerticalDirection = preset.previousSettings.VaneVerticalDirection;
|
|
667
662
|
deviceData.Device[fanKey] = preset.previousSettings[fanKey];
|
|
668
663
|
deviceData.Device.EffectiveFlags = AirConditioner.EffectiveFlags.Presets;
|
|
669
664
|
break;
|
|
@@ -920,7 +915,6 @@ class DeviceAta extends EventEmitter {
|
|
|
920
915
|
accessory.addService(buttonService);
|
|
921
916
|
});
|
|
922
917
|
};
|
|
923
|
-
this.deviceData = deviceData;
|
|
924
918
|
|
|
925
919
|
return accessory;
|
|
926
920
|
} catch (error) {
|
|
@@ -991,10 +985,7 @@ class DeviceAta extends EventEmitter {
|
|
|
991
985
|
const maxTempCoolDryAuto = 31;
|
|
992
986
|
|
|
993
987
|
//device state
|
|
994
|
-
const fanKey = this.accountType === 'melcloud' ? 'FanSpeed' : 'SetFanSpeed';
|
|
995
988
|
const tempStepKey = this.accountType === 'melcloud' ? 'TemperatureIncrement' : 'HasHalfDegreeIncrements';
|
|
996
|
-
const vaneVerticalKey = this.accountType === 'melcloud' ? 'VaneVertical' : 'VaneVerticalDirection';
|
|
997
|
-
const vaneHorizontalKey = this.accountType === 'melcloud' ? 'VaneHorizontal' : 'VaneHorizontalDirection';
|
|
998
989
|
const power = deviceData.Device.Power ?? false;
|
|
999
990
|
const inStandbyMode = deviceData.Device.InStandbyMode ?? false;
|
|
1000
991
|
const roomTemperature = deviceData.Device.RoomTemperature;
|
|
@@ -1003,11 +994,11 @@ class DeviceAta extends EventEmitter {
|
|
|
1003
994
|
const defaultCoolingSetTemperature = deviceData.Device.DefaultCoolingSetTemperature ?? 23;
|
|
1004
995
|
const actualFanSpeed = deviceData.Device.ActualFanSpeed;
|
|
1005
996
|
const automaticFanSpeed = deviceData.Device.AutomaticFanSpeed;
|
|
1006
|
-
const
|
|
997
|
+
const setFanSpeed = deviceData.Device.SetFanSpeed;
|
|
1007
998
|
const operationMode = deviceData.Device.OperationMode;
|
|
1008
|
-
const vaneVerticalDirection = deviceData.Device
|
|
999
|
+
const vaneVerticalDirection = deviceData.Device.VaneVerticalDirection;
|
|
1009
1000
|
const vaneVerticalSwing = deviceData.Device.VaneVerticalSwing;
|
|
1010
|
-
const vaneHorizontalDirection = deviceData.Device
|
|
1001
|
+
const vaneHorizontalDirection = deviceData.Device.VaneHorizontalDirection;
|
|
1011
1002
|
const vaneHorizontalSwing = deviceData.Device.VaneHorizontalSwing;
|
|
1012
1003
|
const prohibitSetTemperature = deviceData.Device.ProhibitSetTemperature ?? false;
|
|
1013
1004
|
const prohibitOperationMode = deviceData.Device.ProhibitOperationMode ?? false;
|
|
@@ -1047,7 +1038,7 @@ class DeviceAta extends EventEmitter {
|
|
|
1047
1038
|
automaticFanSpeed: automaticFanSpeed,
|
|
1048
1039
|
vaneVerticalSwing: vaneVerticalSwing,
|
|
1049
1040
|
vaneHorizontalSwing: vaneHorizontalSwing,
|
|
1050
|
-
|
|
1041
|
+
currentSwingMode: supportsSwingFunction && vaneHorizontalDirection === 12 && vaneVerticalDirection === 7 ? 1 : 0,
|
|
1051
1042
|
lockPhysicalControl: prohibitSetTemperature && prohibitOperationMode && prohibitPower ? 1 : 0,
|
|
1052
1043
|
temperatureStep: temperatureStep,
|
|
1053
1044
|
useFahrenheit: this.useFahrenheit,
|
|
@@ -1104,19 +1095,19 @@ class DeviceAta extends EventEmitter {
|
|
|
1104
1095
|
if (supportsFanSpeed) {
|
|
1105
1096
|
switch (numberOfFanSpeeds) {
|
|
1106
1097
|
case 2: //Fan speed mode 2
|
|
1107
|
-
obj.
|
|
1098
|
+
obj.currentFanSpeed = supportsAutomaticFanSpeed ? [3, 1, 2][setFanSpeed] : [0, 1, 2][setFanSpeed];
|
|
1108
1099
|
obj.fanSpeedSetPropsMaxValue = supportsAutomaticFanSpeed ? 3 : 2;
|
|
1109
1100
|
break;
|
|
1110
1101
|
case 3: //Fan speed mode 3
|
|
1111
|
-
obj.
|
|
1102
|
+
obj.currentFanSpeed = supportsAutomaticFanSpeed ? [4, 1, 2, 3][setFanSpeed] : [0, 1, 2, 3][setFanSpeed];
|
|
1112
1103
|
obj.fanSpeedSetPropsMaxValue = supportsAutomaticFanSpeed ? 4 : 3;
|
|
1113
1104
|
break;
|
|
1114
1105
|
case 4: //Fan speed mode 4
|
|
1115
|
-
obj.
|
|
1106
|
+
obj.currentFanSpeed = supportsAutomaticFanSpeed ? [5, 1, 2, 3, 4][setFanSpeed] : [0, 1, 2, 3, 4][setFanSpeed];
|
|
1116
1107
|
obj.fanSpeedSetPropsMaxValue = supportsAutomaticFanSpeed ? 5 : 4;
|
|
1117
1108
|
break;
|
|
1118
1109
|
case 5: //Fan speed mode 5
|
|
1119
|
-
obj.
|
|
1110
|
+
obj.currentFanSpeed = supportsAutomaticFanSpeed ? [6, 1, 2, 3, 4, 5][setFanSpeed] : [0, 1, 2, 3, 4, 5][setFanSpeed];
|
|
1120
1111
|
obj.fanSpeedSetPropsMaxValue = supportsAutomaticFanSpeed ? 6 : 5;
|
|
1121
1112
|
break;
|
|
1122
1113
|
};
|
|
@@ -1132,8 +1123,8 @@ class DeviceAta extends EventEmitter {
|
|
|
1132
1123
|
.updateCharacteristic(Characteristic.TemperatureDisplayUnits, obj.useFahrenheit)
|
|
1133
1124
|
.updateCharacteristic(Characteristic.CoolingThresholdTemperature, defaultCoolingSetTemperature);
|
|
1134
1125
|
if (supportsHeat) this.melCloudService?.updateCharacteristic(Characteristic.HeatingThresholdTemperature, defaultHeatingSetTemperature);
|
|
1135
|
-
if (supportsFanSpeed) this.melCloudService?.updateCharacteristic(Characteristic.RotationSpeed, obj.
|
|
1136
|
-
if (supportsSwingFunction) this.melCloudService?.updateCharacteristic(Characteristic.SwingMode, obj.
|
|
1126
|
+
if (supportsFanSpeed) this.melCloudService?.updateCharacteristic(Characteristic.RotationSpeed, obj.currentFanSpeed);
|
|
1127
|
+
if (supportsSwingFunction) this.melCloudService?.updateCharacteristic(Characteristic.SwingMode, obj.currentSwingMode);
|
|
1137
1128
|
break;
|
|
1138
1129
|
case 2: //Thermostat
|
|
1139
1130
|
switch (operationMode) {
|
|
@@ -1202,9 +1193,9 @@ class DeviceAta extends EventEmitter {
|
|
|
1202
1193
|
preset.state = presetData ? (presetData.Power === power
|
|
1203
1194
|
&& presetData.SetTemperature === setTemperature
|
|
1204
1195
|
&& presetData.OperationMode === operationMode
|
|
1205
|
-
&& presetData
|
|
1206
|
-
&& presetData
|
|
1207
|
-
&& presetData
|
|
1196
|
+
&& presetData.VaneHorizontalDirection === vaneHorizontalDirection
|
|
1197
|
+
&& presetData.VaneVerticalDirection === vaneVerticalDirection
|
|
1198
|
+
&& presetData.SetFanSpeed === setFanSpeed) : false;
|
|
1208
1199
|
|
|
1209
1200
|
const characteristicType = preset.characteristicType;
|
|
1210
1201
|
this.presetsServices?.[i]?.updateCharacteristic(characteristicType, preset.state);
|
|
@@ -1289,25 +1280,25 @@ class DeviceAta extends EventEmitter {
|
|
|
1289
1280
|
button.state = power ? (hideVaneControls === true) : false;
|
|
1290
1281
|
break;
|
|
1291
1282
|
case 30: //FAN SPEED MODE AUTO
|
|
1292
|
-
button.state = power ? (
|
|
1283
|
+
button.state = power ? (setFanSpeed === 0) : false;
|
|
1293
1284
|
break;
|
|
1294
1285
|
case 31: //FAN SPEED MODE 1
|
|
1295
|
-
button.state = power ? (
|
|
1286
|
+
button.state = power ? (setFanSpeed === 1) : false;
|
|
1296
1287
|
break;
|
|
1297
1288
|
case 32: //FAN SPEED MODE 2
|
|
1298
|
-
button.state = power ? (
|
|
1289
|
+
button.state = power ? (setFanSpeed === 2) : false;
|
|
1299
1290
|
break;
|
|
1300
1291
|
case 33: //FAN SPEED MODE 3
|
|
1301
|
-
button.state = power ? (
|
|
1292
|
+
button.state = power ? (setFanSpeed === 3) : false;
|
|
1302
1293
|
break;
|
|
1303
1294
|
case 34: //FAN SPEED MODE 4
|
|
1304
|
-
button.state = power ? (
|
|
1295
|
+
button.state = power ? (setFanSpeed === 4) : false;
|
|
1305
1296
|
break;
|
|
1306
1297
|
case 35: //FAN SPEED MODE 5
|
|
1307
|
-
button.state = power ? (
|
|
1298
|
+
button.state = power ? (setFanSpeed === 5) : false;
|
|
1308
1299
|
break;
|
|
1309
1300
|
case 36: //FAN SPEED MODE 6
|
|
1310
|
-
button.state = power ? (
|
|
1301
|
+
button.state = power ? (setFanSpeed === 6) : false;
|
|
1311
1302
|
break;
|
|
1312
1303
|
case 37: //PHYSICAL LOCK CONTROLS ALL
|
|
1313
1304
|
button.state = (obj.lockPhysicalControl === 1);
|
|
@@ -1340,11 +1331,11 @@ class DeviceAta extends EventEmitter {
|
|
|
1340
1331
|
this.emit('info', `Target temperature: ${setTemperature}${obj.temperatureUnit}`);
|
|
1341
1332
|
this.emit('info', `Current temperature: ${roomTemperature}${obj.temperatureUnit}`);
|
|
1342
1333
|
if (supportsOutdoorTemperature && outdoorTemperature !== null) this.emit('info', `Outdoor temperature: ${outdoorTemperature}${obj.temperatureUnit}`);
|
|
1343
|
-
if (supportsFanSpeed) this.emit('info', `Target fan speed: ${AirConditioner.FanSpeedMapHomekit[
|
|
1334
|
+
if (supportsFanSpeed) this.emit('info', `Target fan speed: ${AirConditioner.FanSpeedMapHomekit[setFanSpeed]}`);
|
|
1344
1335
|
if (supportsFanSpeed) this.emit('info', `Current fan speed: ${AirConditioner.FanSpeedMapHomekit[actualFanSpeed]}`);
|
|
1345
1336
|
if (vaneHorizontalDirection !== null) this.emit('info', `Vane horizontal: ${AirConditioner.VaneHorizontal[vaneHorizontalDirection]}`);
|
|
1346
1337
|
if (vaneVerticalDirection !== null) this.emit('info', `Vane vertical: ${AirConditioner.VaneVertical[vaneVerticalDirection]}`);
|
|
1347
|
-
if (supportsSwingFunction) this.emit('info', `Air direction: ${AirConditioner.AirDirection[obj.
|
|
1338
|
+
if (supportsSwingFunction) this.emit('info', `Air direction: ${AirConditioner.AirDirection[obj.currentSwingMode]}`);
|
|
1348
1339
|
this.emit('info', `Temperature display unit: ${obj.temperatureUnit}`);
|
|
1349
1340
|
this.emit('info', `Lock physical controls: ${obj.lockPhysicalControl ? 'LOCKED' : 'UNLOCKED'}`);
|
|
1350
1341
|
};
|
package/src/melcloudata.js
CHANGED
|
@@ -62,6 +62,7 @@ class MelCloudAta extends EventEmitter {
|
|
|
62
62
|
const serialNumber = deviceData.SerialNumber || deviceData.DeviceID || '4.0.0';
|
|
63
63
|
|
|
64
64
|
//device
|
|
65
|
+
const fanKey = this.accountType === 'melcloud' ? 'FanSpeed' : 'SetFanSpeed';
|
|
65
66
|
const device = deviceData.Device ?? {};
|
|
66
67
|
const prohibitSetTemperature = device.ProhibitSetTemperature;
|
|
67
68
|
const prohibitOperationMode = device.ProhibitOperationMode;
|
|
@@ -71,8 +72,7 @@ class MelCloudAta extends EventEmitter {
|
|
|
71
72
|
const outdoorTemperature = device.OutdoorTemperature;
|
|
72
73
|
const setTemperature = device.SetTemperature;
|
|
73
74
|
const actualFanSpeed = device.ActualFanSpeed;
|
|
74
|
-
const
|
|
75
|
-
const setFanSpeed = device.SetFanSpeed; // melcloud home only
|
|
75
|
+
const setFanSpeed = device[fanKey];
|
|
76
76
|
const automaticFanSpeed = device.AutomaticFanSpeed;
|
|
77
77
|
const vaneVerticalDirection = device.VaneVerticalDirection;
|
|
78
78
|
const vaneVerticalSwing = device.VaneVerticalSwing;
|
|
@@ -147,7 +147,6 @@ class MelCloudAta extends EventEmitter {
|
|
|
147
147
|
OutdoorTemperature: outdoorTemperature,
|
|
148
148
|
SetTemperature: setTemperature,
|
|
149
149
|
ActualFanSpeed: actualFanSpeed,
|
|
150
|
-
FanSpeed: fanSpeed,
|
|
151
150
|
SetFanSpeed: setFanSpeed,
|
|
152
151
|
AutomaticFanSpeed: automaticFanSpeed,
|
|
153
152
|
OperationMode: operationMode,
|
|
@@ -304,9 +303,10 @@ class MelCloudAta extends EventEmitter {
|
|
|
304
303
|
return;
|
|
305
304
|
};
|
|
306
305
|
|
|
306
|
+
deviceData.Device.Power = deviceData.Device.Power.toString();
|
|
307
307
|
deviceData.Device.SetTemperature = deviceData.Device.SetTemperature.toString();
|
|
308
|
-
deviceData.Device.OperationMode = AirConditioner.OperationModeMapEnumToString[deviceData.Device.OperationMode];
|
|
309
308
|
deviceData.Device.SetFanSpeed = deviceData.Device.SetFanSpeed.toString();
|
|
309
|
+
deviceData.Device.OperationMode = AirConditioner.OperationModeMapEnumToString[deviceData.Device.OperationMode];
|
|
310
310
|
deviceData.Device.VaneHorizontalDirection = AirConditioner.VaneHorizontalDirectionMapEnumToString[deviceData.Device.VaneHorizontalDirection];
|
|
311
311
|
deviceData.Device.VaneVerticalDirection = AirConditioner.VaneVerticalDirectionMapEnumToString[deviceData.Device.VaneVerticalDirection];
|
|
312
312
|
this.emit('warn', JSON.stringify(deviceData.Device, null, 2));
|