homebridge-melcloud-control 4.0.0-beta.152 → 4.0.0-beta.154
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 -41
- 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.154",
|
|
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) {
|
|
@@ -993,8 +987,6 @@ class DeviceAta extends EventEmitter {
|
|
|
993
987
|
//device state
|
|
994
988
|
const fanKey = this.accountType === 'melcloud' ? 'FanSpeed' : 'SetFanSpeed';
|
|
995
989
|
const tempStepKey = this.accountType === 'melcloud' ? 'TemperatureIncrement' : 'HasHalfDegreeIncrements';
|
|
996
|
-
const vaneVerticalKey = this.accountType === 'melcloud' ? 'VaneVertical' : 'VaneVerticalDirection';
|
|
997
|
-
const vaneHorizontalKey = this.accountType === 'melcloud' ? 'VaneHorizontal' : 'VaneHorizontalDirection';
|
|
998
990
|
const power = deviceData.Device.Power ?? false;
|
|
999
991
|
const inStandbyMode = deviceData.Device.InStandbyMode ?? false;
|
|
1000
992
|
const roomTemperature = deviceData.Device.RoomTemperature;
|
|
@@ -1003,11 +995,11 @@ class DeviceAta extends EventEmitter {
|
|
|
1003
995
|
const defaultCoolingSetTemperature = deviceData.Device.DefaultCoolingSetTemperature ?? 23;
|
|
1004
996
|
const actualFanSpeed = deviceData.Device.ActualFanSpeed;
|
|
1005
997
|
const automaticFanSpeed = deviceData.Device.AutomaticFanSpeed;
|
|
1006
|
-
const
|
|
998
|
+
const setFanSpeed = deviceData.Device[fanKey];
|
|
1007
999
|
const operationMode = deviceData.Device.OperationMode;
|
|
1008
|
-
const vaneVerticalDirection = deviceData.Device
|
|
1000
|
+
const vaneVerticalDirection = deviceData.Device.VaneVerticalDirection;
|
|
1009
1001
|
const vaneVerticalSwing = deviceData.Device.VaneVerticalSwing;
|
|
1010
|
-
const vaneHorizontalDirection = deviceData.Device
|
|
1002
|
+
const vaneHorizontalDirection = deviceData.Device.VaneHorizontalDirection;
|
|
1011
1003
|
const vaneHorizontalSwing = deviceData.Device.VaneHorizontalSwing;
|
|
1012
1004
|
const prohibitSetTemperature = deviceData.Device.ProhibitSetTemperature ?? false;
|
|
1013
1005
|
const prohibitOperationMode = deviceData.Device.ProhibitOperationMode ?? false;
|
|
@@ -1047,7 +1039,7 @@ class DeviceAta extends EventEmitter {
|
|
|
1047
1039
|
automaticFanSpeed: automaticFanSpeed,
|
|
1048
1040
|
vaneVerticalSwing: vaneVerticalSwing,
|
|
1049
1041
|
vaneHorizontalSwing: vaneHorizontalSwing,
|
|
1050
|
-
|
|
1042
|
+
currentSwingMode: supportsSwingFunction && vaneHorizontalDirection === 12 && vaneVerticalDirection === 7 ? 1 : 0,
|
|
1051
1043
|
lockPhysicalControl: prohibitSetTemperature && prohibitOperationMode && prohibitPower ? 1 : 0,
|
|
1052
1044
|
temperatureStep: temperatureStep,
|
|
1053
1045
|
useFahrenheit: this.useFahrenheit,
|
|
@@ -1104,19 +1096,19 @@ class DeviceAta extends EventEmitter {
|
|
|
1104
1096
|
if (supportsFanSpeed) {
|
|
1105
1097
|
switch (numberOfFanSpeeds) {
|
|
1106
1098
|
case 2: //Fan speed mode 2
|
|
1107
|
-
obj.
|
|
1099
|
+
obj.currentFanSpeed = supportsAutomaticFanSpeed ? [3, 1, 2][setFanSpeed] : [0, 1, 2][setFanSpeed];
|
|
1108
1100
|
obj.fanSpeedSetPropsMaxValue = supportsAutomaticFanSpeed ? 3 : 2;
|
|
1109
1101
|
break;
|
|
1110
1102
|
case 3: //Fan speed mode 3
|
|
1111
|
-
obj.
|
|
1103
|
+
obj.currentFanSpeed = supportsAutomaticFanSpeed ? [4, 1, 2, 3][setFanSpeed] : [0, 1, 2, 3][setFanSpeed];
|
|
1112
1104
|
obj.fanSpeedSetPropsMaxValue = supportsAutomaticFanSpeed ? 4 : 3;
|
|
1113
1105
|
break;
|
|
1114
1106
|
case 4: //Fan speed mode 4
|
|
1115
|
-
obj.
|
|
1107
|
+
obj.currentFanSpeed = supportsAutomaticFanSpeed ? [5, 1, 2, 3, 4][setFanSpeed] : [0, 1, 2, 3, 4][setFanSpeed];
|
|
1116
1108
|
obj.fanSpeedSetPropsMaxValue = supportsAutomaticFanSpeed ? 5 : 4;
|
|
1117
1109
|
break;
|
|
1118
1110
|
case 5: //Fan speed mode 5
|
|
1119
|
-
obj.
|
|
1111
|
+
obj.currentFanSpeed = supportsAutomaticFanSpeed ? [6, 1, 2, 3, 4, 5][setFanSpeed] : [0, 1, 2, 3, 4, 5][setFanSpeed];
|
|
1120
1112
|
obj.fanSpeedSetPropsMaxValue = supportsAutomaticFanSpeed ? 6 : 5;
|
|
1121
1113
|
break;
|
|
1122
1114
|
};
|
|
@@ -1132,8 +1124,8 @@ class DeviceAta extends EventEmitter {
|
|
|
1132
1124
|
.updateCharacteristic(Characteristic.TemperatureDisplayUnits, obj.useFahrenheit)
|
|
1133
1125
|
.updateCharacteristic(Characteristic.CoolingThresholdTemperature, defaultCoolingSetTemperature);
|
|
1134
1126
|
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.
|
|
1127
|
+
if (supportsFanSpeed) this.melCloudService?.updateCharacteristic(Characteristic.RotationSpeed, obj.currentFanSpeed);
|
|
1128
|
+
if (supportsSwingFunction) this.melCloudService?.updateCharacteristic(Characteristic.SwingMode, obj.currentSwingMode);
|
|
1137
1129
|
break;
|
|
1138
1130
|
case 2: //Thermostat
|
|
1139
1131
|
switch (operationMode) {
|
|
@@ -1202,9 +1194,9 @@ class DeviceAta extends EventEmitter {
|
|
|
1202
1194
|
preset.state = presetData ? (presetData.Power === power
|
|
1203
1195
|
&& presetData.SetTemperature === setTemperature
|
|
1204
1196
|
&& presetData.OperationMode === operationMode
|
|
1205
|
-
&& presetData
|
|
1206
|
-
&& presetData
|
|
1207
|
-
&& presetData[fanKey] ===
|
|
1197
|
+
&& presetData.VaneHorizontalDirection === vaneHorizontalDirection
|
|
1198
|
+
&& presetData.VaneVerticalDirection === vaneVerticalDirection
|
|
1199
|
+
&& presetData[fanKey] === setFanSpeed) : false;
|
|
1208
1200
|
|
|
1209
1201
|
const characteristicType = preset.characteristicType;
|
|
1210
1202
|
this.presetsServices?.[i]?.updateCharacteristic(characteristicType, preset.state);
|
|
@@ -1289,25 +1281,25 @@ class DeviceAta extends EventEmitter {
|
|
|
1289
1281
|
button.state = power ? (hideVaneControls === true) : false;
|
|
1290
1282
|
break;
|
|
1291
1283
|
case 30: //FAN SPEED MODE AUTO
|
|
1292
|
-
button.state = power ? (
|
|
1284
|
+
button.state = power ? (setFanSpeed === 0) : false;
|
|
1293
1285
|
break;
|
|
1294
1286
|
case 31: //FAN SPEED MODE 1
|
|
1295
|
-
button.state = power ? (
|
|
1287
|
+
button.state = power ? (setFanSpeed === 1) : false;
|
|
1296
1288
|
break;
|
|
1297
1289
|
case 32: //FAN SPEED MODE 2
|
|
1298
|
-
button.state = power ? (
|
|
1290
|
+
button.state = power ? (setFanSpeed === 2) : false;
|
|
1299
1291
|
break;
|
|
1300
1292
|
case 33: //FAN SPEED MODE 3
|
|
1301
|
-
button.state = power ? (
|
|
1293
|
+
button.state = power ? (setFanSpeed === 3) : false;
|
|
1302
1294
|
break;
|
|
1303
1295
|
case 34: //FAN SPEED MODE 4
|
|
1304
|
-
button.state = power ? (
|
|
1296
|
+
button.state = power ? (setFanSpeed === 4) : false;
|
|
1305
1297
|
break;
|
|
1306
1298
|
case 35: //FAN SPEED MODE 5
|
|
1307
|
-
button.state = power ? (
|
|
1299
|
+
button.state = power ? (setFanSpeed === 5) : false;
|
|
1308
1300
|
break;
|
|
1309
1301
|
case 36: //FAN SPEED MODE 6
|
|
1310
|
-
button.state = power ? (
|
|
1302
|
+
button.state = power ? (setFanSpeed === 6) : false;
|
|
1311
1303
|
break;
|
|
1312
1304
|
case 37: //PHYSICAL LOCK CONTROLS ALL
|
|
1313
1305
|
button.state = (obj.lockPhysicalControl === 1);
|
|
@@ -1340,11 +1332,11 @@ class DeviceAta extends EventEmitter {
|
|
|
1340
1332
|
this.emit('info', `Target temperature: ${setTemperature}${obj.temperatureUnit}`);
|
|
1341
1333
|
this.emit('info', `Current temperature: ${roomTemperature}${obj.temperatureUnit}`);
|
|
1342
1334
|
if (supportsOutdoorTemperature && outdoorTemperature !== null) this.emit('info', `Outdoor temperature: ${outdoorTemperature}${obj.temperatureUnit}`);
|
|
1343
|
-
if (supportsFanSpeed) this.emit('info', `Target fan speed: ${AirConditioner.FanSpeedMapHomekit[
|
|
1335
|
+
if (supportsFanSpeed) this.emit('info', `Target fan speed: ${AirConditioner.FanSpeedMapHomekit[setFanSpeed]}`);
|
|
1344
1336
|
if (supportsFanSpeed) this.emit('info', `Current fan speed: ${AirConditioner.FanSpeedMapHomekit[actualFanSpeed]}`);
|
|
1345
1337
|
if (vaneHorizontalDirection !== null) this.emit('info', `Vane horizontal: ${AirConditioner.VaneHorizontal[vaneHorizontalDirection]}`);
|
|
1346
1338
|
if (vaneVerticalDirection !== null) this.emit('info', `Vane vertical: ${AirConditioner.VaneVertical[vaneVerticalDirection]}`);
|
|
1347
|
-
if (supportsSwingFunction) this.emit('info', `Air direction: ${AirConditioner.AirDirection[obj.
|
|
1339
|
+
if (supportsSwingFunction) this.emit('info', `Air direction: ${AirConditioner.AirDirection[obj.currentSwingMode]}`);
|
|
1348
1340
|
this.emit('info', `Temperature display unit: ${obj.temperatureUnit}`);
|
|
1349
1341
|
this.emit('info', `Lock physical controls: ${obj.lockPhysicalControl ? 'LOCKED' : 'UNLOCKED'}`);
|
|
1350
1342
|
};
|
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));
|